vue.runtime.global.js 321 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664
  1. var Vue = (function (exports) {
  2. 'use strict';
  3. function makeMap(str, expectsLowerCase) {
  4. const map = /* @__PURE__ */ Object.create(null);
  5. const list = str.split(",");
  6. for (let i = 0; i < list.length; i++) {
  7. map[list[i]] = true;
  8. }
  9. return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
  10. }
  11. const EMPTY_OBJ = Object.freeze({}) ;
  12. const EMPTY_ARR = Object.freeze([]) ;
  13. const NOOP = () => {
  14. };
  15. const NO = () => false;
  16. const onRE = /^on[^a-z]/;
  17. const isOn = (key) => onRE.test(key);
  18. const isModelListener = (key) => key.startsWith("onUpdate:");
  19. const extend = Object.assign;
  20. const remove = (arr, el) => {
  21. const i = arr.indexOf(el);
  22. if (i > -1) {
  23. arr.splice(i, 1);
  24. }
  25. };
  26. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  27. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  28. const isArray = Array.isArray;
  29. const isMap = (val) => toTypeString(val) === "[object Map]";
  30. const isSet = (val) => toTypeString(val) === "[object Set]";
  31. const isDate = (val) => toTypeString(val) === "[object Date]";
  32. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  33. const isFunction = (val) => typeof val === "function";
  34. const isString = (val) => typeof val === "string";
  35. const isSymbol = (val) => typeof val === "symbol";
  36. const isObject = (val) => val !== null && typeof val === "object";
  37. const isPromise = (val) => {
  38. return isObject(val) && isFunction(val.then) && isFunction(val.catch);
  39. };
  40. const objectToString = Object.prototype.toString;
  41. const toTypeString = (value) => objectToString.call(value);
  42. const toRawType = (value) => {
  43. return toTypeString(value).slice(8, -1);
  44. };
  45. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  46. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  47. const isReservedProp = /* @__PURE__ */ makeMap(
  48. // the leading comma is intentional so empty string "" is also included
  49. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  50. );
  51. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  52. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  53. );
  54. const cacheStringFunction = (fn) => {
  55. const cache = /* @__PURE__ */ Object.create(null);
  56. return (str) => {
  57. const hit = cache[str];
  58. return hit || (cache[str] = fn(str));
  59. };
  60. };
  61. const camelizeRE = /-(\w)/g;
  62. const camelize = cacheStringFunction((str) => {
  63. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  64. });
  65. const hyphenateRE = /\B([A-Z])/g;
  66. const hyphenate = cacheStringFunction(
  67. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  68. );
  69. const capitalize = cacheStringFunction(
  70. (str) => str.charAt(0).toUpperCase() + str.slice(1)
  71. );
  72. const toHandlerKey = cacheStringFunction(
  73. (str) => str ? `on${capitalize(str)}` : ``
  74. );
  75. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  76. const invokeArrayFns = (fns, arg) => {
  77. for (let i = 0; i < fns.length; i++) {
  78. fns[i](arg);
  79. }
  80. };
  81. const def = (obj, key, value) => {
  82. Object.defineProperty(obj, key, {
  83. configurable: true,
  84. enumerable: false,
  85. value
  86. });
  87. };
  88. const looseToNumber = (val) => {
  89. const n = parseFloat(val);
  90. return isNaN(n) ? val : n;
  91. };
  92. const toNumber = (val) => {
  93. const n = isString(val) ? Number(val) : NaN;
  94. return isNaN(n) ? val : n;
  95. };
  96. let _globalThis;
  97. const getGlobalThis = () => {
  98. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  99. };
  100. const GLOBALS_WHITE_LISTED = "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";
  101. const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
  102. function normalizeStyle(value) {
  103. if (isArray(value)) {
  104. const res = {};
  105. for (let i = 0; i < value.length; i++) {
  106. const item = value[i];
  107. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  108. if (normalized) {
  109. for (const key in normalized) {
  110. res[key] = normalized[key];
  111. }
  112. }
  113. }
  114. return res;
  115. } else if (isString(value)) {
  116. return value;
  117. } else if (isObject(value)) {
  118. return value;
  119. }
  120. }
  121. const listDelimiterRE = /;(?![^(]*\))/g;
  122. const propertyDelimiterRE = /:([^]+)/;
  123. const styleCommentRE = /\/\*[^]*?\*\//g;
  124. function parseStringStyle(cssText) {
  125. const ret = {};
  126. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  127. if (item) {
  128. const tmp = item.split(propertyDelimiterRE);
  129. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  130. }
  131. });
  132. return ret;
  133. }
  134. function normalizeClass(value) {
  135. let res = "";
  136. if (isString(value)) {
  137. res = value;
  138. } else if (isArray(value)) {
  139. for (let i = 0; i < value.length; i++) {
  140. const normalized = normalizeClass(value[i]);
  141. if (normalized) {
  142. res += normalized + " ";
  143. }
  144. }
  145. } else if (isObject(value)) {
  146. for (const name in value) {
  147. if (value[name]) {
  148. res += name + " ";
  149. }
  150. }
  151. }
  152. return res.trim();
  153. }
  154. function normalizeProps(props) {
  155. if (!props)
  156. return null;
  157. let { class: klass, style } = props;
  158. if (klass && !isString(klass)) {
  159. props.class = normalizeClass(klass);
  160. }
  161. if (style) {
  162. props.style = normalizeStyle(style);
  163. }
  164. return props;
  165. }
  166. 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";
  167. 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";
  168. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  169. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  170. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  171. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  172. function includeBooleanAttr(value) {
  173. return !!value || value === "";
  174. }
  175. function looseCompareArrays(a, b) {
  176. if (a.length !== b.length)
  177. return false;
  178. let equal = true;
  179. for (let i = 0; equal && i < a.length; i++) {
  180. equal = looseEqual(a[i], b[i]);
  181. }
  182. return equal;
  183. }
  184. function looseEqual(a, b) {
  185. if (a === b)
  186. return true;
  187. let aValidType = isDate(a);
  188. let bValidType = isDate(b);
  189. if (aValidType || bValidType) {
  190. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  191. }
  192. aValidType = isSymbol(a);
  193. bValidType = isSymbol(b);
  194. if (aValidType || bValidType) {
  195. return a === b;
  196. }
  197. aValidType = isArray(a);
  198. bValidType = isArray(b);
  199. if (aValidType || bValidType) {
  200. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  201. }
  202. aValidType = isObject(a);
  203. bValidType = isObject(b);
  204. if (aValidType || bValidType) {
  205. if (!aValidType || !bValidType) {
  206. return false;
  207. }
  208. const aKeysCount = Object.keys(a).length;
  209. const bKeysCount = Object.keys(b).length;
  210. if (aKeysCount !== bKeysCount) {
  211. return false;
  212. }
  213. for (const key in a) {
  214. const aHasKey = a.hasOwnProperty(key);
  215. const bHasKey = b.hasOwnProperty(key);
  216. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  217. return false;
  218. }
  219. }
  220. }
  221. return String(a) === String(b);
  222. }
  223. function looseIndexOf(arr, val) {
  224. return arr.findIndex((item) => looseEqual(item, val));
  225. }
  226. const toDisplayString = (val) => {
  227. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  228. };
  229. const replacer = (_key, val) => {
  230. if (val && val.__v_isRef) {
  231. return replacer(_key, val.value);
  232. } else if (isMap(val)) {
  233. return {
  234. [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
  235. entries[`${key} =>`] = val2;
  236. return entries;
  237. }, {})
  238. };
  239. } else if (isSet(val)) {
  240. return {
  241. [`Set(${val.size})`]: [...val.values()]
  242. };
  243. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  244. return String(val);
  245. }
  246. return val;
  247. };
  248. function warn$1(msg, ...args) {
  249. console.warn(`[Vue warn] ${msg}`, ...args);
  250. }
  251. let activeEffectScope;
  252. class EffectScope {
  253. constructor(detached = false) {
  254. this.detached = detached;
  255. /**
  256. * @internal
  257. */
  258. this._active = true;
  259. /**
  260. * @internal
  261. */
  262. this.effects = [];
  263. /**
  264. * @internal
  265. */
  266. this.cleanups = [];
  267. this.parent = activeEffectScope;
  268. if (!detached && activeEffectScope) {
  269. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  270. this
  271. ) - 1;
  272. }
  273. }
  274. get active() {
  275. return this._active;
  276. }
  277. run(fn) {
  278. if (this._active) {
  279. const currentEffectScope = activeEffectScope;
  280. try {
  281. activeEffectScope = this;
  282. return fn();
  283. } finally {
  284. activeEffectScope = currentEffectScope;
  285. }
  286. } else {
  287. warn$1(`cannot run an inactive effect scope.`);
  288. }
  289. }
  290. /**
  291. * This should only be called on non-detached scopes
  292. * @internal
  293. */
  294. on() {
  295. activeEffectScope = this;
  296. }
  297. /**
  298. * This should only be called on non-detached scopes
  299. * @internal
  300. */
  301. off() {
  302. activeEffectScope = this.parent;
  303. }
  304. stop(fromParent) {
  305. if (this._active) {
  306. let i, l;
  307. for (i = 0, l = this.effects.length; i < l; i++) {
  308. this.effects[i].stop();
  309. }
  310. for (i = 0, l = this.cleanups.length; i < l; i++) {
  311. this.cleanups[i]();
  312. }
  313. if (this.scopes) {
  314. for (i = 0, l = this.scopes.length; i < l; i++) {
  315. this.scopes[i].stop(true);
  316. }
  317. }
  318. if (!this.detached && this.parent && !fromParent) {
  319. const last = this.parent.scopes.pop();
  320. if (last && last !== this) {
  321. this.parent.scopes[this.index] = last;
  322. last.index = this.index;
  323. }
  324. }
  325. this.parent = void 0;
  326. this._active = false;
  327. }
  328. }
  329. }
  330. function effectScope(detached) {
  331. return new EffectScope(detached);
  332. }
  333. function recordEffectScope(effect, scope = activeEffectScope) {
  334. if (scope && scope.active) {
  335. scope.effects.push(effect);
  336. }
  337. }
  338. function getCurrentScope() {
  339. return activeEffectScope;
  340. }
  341. function onScopeDispose(fn) {
  342. if (activeEffectScope) {
  343. activeEffectScope.cleanups.push(fn);
  344. } else {
  345. warn$1(
  346. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  347. );
  348. }
  349. }
  350. const createDep = (effects) => {
  351. const dep = new Set(effects);
  352. dep.w = 0;
  353. dep.n = 0;
  354. return dep;
  355. };
  356. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  357. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  358. const initDepMarkers = ({ deps }) => {
  359. if (deps.length) {
  360. for (let i = 0; i < deps.length; i++) {
  361. deps[i].w |= trackOpBit;
  362. }
  363. }
  364. };
  365. const finalizeDepMarkers = (effect) => {
  366. const { deps } = effect;
  367. if (deps.length) {
  368. let ptr = 0;
  369. for (let i = 0; i < deps.length; i++) {
  370. const dep = deps[i];
  371. if (wasTracked(dep) && !newTracked(dep)) {
  372. dep.delete(effect);
  373. } else {
  374. deps[ptr++] = dep;
  375. }
  376. dep.w &= ~trackOpBit;
  377. dep.n &= ~trackOpBit;
  378. }
  379. deps.length = ptr;
  380. }
  381. };
  382. const targetMap = /* @__PURE__ */ new WeakMap();
  383. let effectTrackDepth = 0;
  384. let trackOpBit = 1;
  385. const maxMarkerBits = 30;
  386. let activeEffect;
  387. const ITERATE_KEY = Symbol("iterate" );
  388. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
  389. class ReactiveEffect {
  390. constructor(fn, scheduler = null, scope) {
  391. this.fn = fn;
  392. this.scheduler = scheduler;
  393. this.active = true;
  394. this.deps = [];
  395. this.parent = void 0;
  396. recordEffectScope(this, scope);
  397. }
  398. run() {
  399. if (!this.active) {
  400. return this.fn();
  401. }
  402. let parent = activeEffect;
  403. let lastShouldTrack = shouldTrack;
  404. while (parent) {
  405. if (parent === this) {
  406. return;
  407. }
  408. parent = parent.parent;
  409. }
  410. try {
  411. this.parent = activeEffect;
  412. activeEffect = this;
  413. shouldTrack = true;
  414. trackOpBit = 1 << ++effectTrackDepth;
  415. if (effectTrackDepth <= maxMarkerBits) {
  416. initDepMarkers(this);
  417. } else {
  418. cleanupEffect(this);
  419. }
  420. return this.fn();
  421. } finally {
  422. if (effectTrackDepth <= maxMarkerBits) {
  423. finalizeDepMarkers(this);
  424. }
  425. trackOpBit = 1 << --effectTrackDepth;
  426. activeEffect = this.parent;
  427. shouldTrack = lastShouldTrack;
  428. this.parent = void 0;
  429. if (this.deferStop) {
  430. this.stop();
  431. }
  432. }
  433. }
  434. stop() {
  435. if (activeEffect === this) {
  436. this.deferStop = true;
  437. } else if (this.active) {
  438. cleanupEffect(this);
  439. if (this.onStop) {
  440. this.onStop();
  441. }
  442. this.active = false;
  443. }
  444. }
  445. }
  446. function cleanupEffect(effect2) {
  447. const { deps } = effect2;
  448. if (deps.length) {
  449. for (let i = 0; i < deps.length; i++) {
  450. deps[i].delete(effect2);
  451. }
  452. deps.length = 0;
  453. }
  454. }
  455. function effect(fn, options) {
  456. if (fn.effect) {
  457. fn = fn.effect.fn;
  458. }
  459. const _effect = new ReactiveEffect(fn);
  460. if (options) {
  461. extend(_effect, options);
  462. if (options.scope)
  463. recordEffectScope(_effect, options.scope);
  464. }
  465. if (!options || !options.lazy) {
  466. _effect.run();
  467. }
  468. const runner = _effect.run.bind(_effect);
  469. runner.effect = _effect;
  470. return runner;
  471. }
  472. function stop(runner) {
  473. runner.effect.stop();
  474. }
  475. let shouldTrack = true;
  476. const trackStack = [];
  477. function pauseTracking() {
  478. trackStack.push(shouldTrack);
  479. shouldTrack = false;
  480. }
  481. function resetTracking() {
  482. const last = trackStack.pop();
  483. shouldTrack = last === void 0 ? true : last;
  484. }
  485. function track(target, type, key) {
  486. if (shouldTrack && activeEffect) {
  487. let depsMap = targetMap.get(target);
  488. if (!depsMap) {
  489. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  490. }
  491. let dep = depsMap.get(key);
  492. if (!dep) {
  493. depsMap.set(key, dep = createDep());
  494. }
  495. const eventInfo = { effect: activeEffect, target, type, key } ;
  496. trackEffects(dep, eventInfo);
  497. }
  498. }
  499. function trackEffects(dep, debuggerEventExtraInfo) {
  500. let shouldTrack2 = false;
  501. if (effectTrackDepth <= maxMarkerBits) {
  502. if (!newTracked(dep)) {
  503. dep.n |= trackOpBit;
  504. shouldTrack2 = !wasTracked(dep);
  505. }
  506. } else {
  507. shouldTrack2 = !dep.has(activeEffect);
  508. }
  509. if (shouldTrack2) {
  510. dep.add(activeEffect);
  511. activeEffect.deps.push(dep);
  512. if (activeEffect.onTrack) {
  513. activeEffect.onTrack(
  514. extend(
  515. {
  516. effect: activeEffect
  517. },
  518. debuggerEventExtraInfo
  519. )
  520. );
  521. }
  522. }
  523. }
  524. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  525. const depsMap = targetMap.get(target);
  526. if (!depsMap) {
  527. return;
  528. }
  529. let deps = [];
  530. if (type === "clear") {
  531. deps = [...depsMap.values()];
  532. } else if (key === "length" && isArray(target)) {
  533. const newLength = Number(newValue);
  534. depsMap.forEach((dep, key2) => {
  535. if (key2 === "length" || key2 >= newLength) {
  536. deps.push(dep);
  537. }
  538. });
  539. } else {
  540. if (key !== void 0) {
  541. deps.push(depsMap.get(key));
  542. }
  543. switch (type) {
  544. case "add":
  545. if (!isArray(target)) {
  546. deps.push(depsMap.get(ITERATE_KEY));
  547. if (isMap(target)) {
  548. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  549. }
  550. } else if (isIntegerKey(key)) {
  551. deps.push(depsMap.get("length"));
  552. }
  553. break;
  554. case "delete":
  555. if (!isArray(target)) {
  556. deps.push(depsMap.get(ITERATE_KEY));
  557. if (isMap(target)) {
  558. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  559. }
  560. }
  561. break;
  562. case "set":
  563. if (isMap(target)) {
  564. deps.push(depsMap.get(ITERATE_KEY));
  565. }
  566. break;
  567. }
  568. }
  569. const eventInfo = { target, type, key, newValue, oldValue, oldTarget } ;
  570. if (deps.length === 1) {
  571. if (deps[0]) {
  572. {
  573. triggerEffects(deps[0], eventInfo);
  574. }
  575. }
  576. } else {
  577. const effects = [];
  578. for (const dep of deps) {
  579. if (dep) {
  580. effects.push(...dep);
  581. }
  582. }
  583. {
  584. triggerEffects(createDep(effects), eventInfo);
  585. }
  586. }
  587. }
  588. function triggerEffects(dep, debuggerEventExtraInfo) {
  589. const effects = isArray(dep) ? dep : [...dep];
  590. for (const effect2 of effects) {
  591. if (effect2.computed) {
  592. triggerEffect(effect2, debuggerEventExtraInfo);
  593. }
  594. }
  595. for (const effect2 of effects) {
  596. if (!effect2.computed) {
  597. triggerEffect(effect2, debuggerEventExtraInfo);
  598. }
  599. }
  600. }
  601. function triggerEffect(effect2, debuggerEventExtraInfo) {
  602. if (effect2 !== activeEffect || effect2.allowRecurse) {
  603. if (effect2.onTrigger) {
  604. effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
  605. }
  606. if (effect2.scheduler) {
  607. effect2.scheduler();
  608. } else {
  609. effect2.run();
  610. }
  611. }
  612. }
  613. function getDepFromReactive(object, key) {
  614. var _a;
  615. return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
  616. }
  617. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  618. const builtInSymbols = new Set(
  619. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  620. );
  621. const get$1 = /* @__PURE__ */ createGetter();
  622. const shallowGet = /* @__PURE__ */ createGetter(false, true);
  623. const readonlyGet = /* @__PURE__ */ createGetter(true);
  624. const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
  625. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  626. function createArrayInstrumentations() {
  627. const instrumentations = {};
  628. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  629. instrumentations[key] = function(...args) {
  630. const arr = toRaw(this);
  631. for (let i = 0, l = this.length; i < l; i++) {
  632. track(arr, "get", i + "");
  633. }
  634. const res = arr[key](...args);
  635. if (res === -1 || res === false) {
  636. return arr[key](...args.map(toRaw));
  637. } else {
  638. return res;
  639. }
  640. };
  641. });
  642. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  643. instrumentations[key] = function(...args) {
  644. pauseTracking();
  645. const res = toRaw(this)[key].apply(this, args);
  646. resetTracking();
  647. return res;
  648. };
  649. });
  650. return instrumentations;
  651. }
  652. function hasOwnProperty(key) {
  653. const obj = toRaw(this);
  654. track(obj, "has", key);
  655. return obj.hasOwnProperty(key);
  656. }
  657. function createGetter(isReadonly2 = false, shallow = false) {
  658. return function get2(target, key, receiver) {
  659. if (key === "__v_isReactive") {
  660. return !isReadonly2;
  661. } else if (key === "__v_isReadonly") {
  662. return isReadonly2;
  663. } else if (key === "__v_isShallow") {
  664. return shallow;
  665. } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
  666. return target;
  667. }
  668. const targetIsArray = isArray(target);
  669. if (!isReadonly2) {
  670. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  671. return Reflect.get(arrayInstrumentations, key, receiver);
  672. }
  673. if (key === "hasOwnProperty") {
  674. return hasOwnProperty;
  675. }
  676. }
  677. const res = Reflect.get(target, key, receiver);
  678. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  679. return res;
  680. }
  681. if (!isReadonly2) {
  682. track(target, "get", key);
  683. }
  684. if (shallow) {
  685. return res;
  686. }
  687. if (isRef(res)) {
  688. return targetIsArray && isIntegerKey(key) ? res : res.value;
  689. }
  690. if (isObject(res)) {
  691. return isReadonly2 ? readonly(res) : reactive(res);
  692. }
  693. return res;
  694. };
  695. }
  696. const set$1 = /* @__PURE__ */ createSetter();
  697. const shallowSet = /* @__PURE__ */ createSetter(true);
  698. function createSetter(shallow = false) {
  699. return function set2(target, key, value, receiver) {
  700. let oldValue = target[key];
  701. if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
  702. return false;
  703. }
  704. if (!shallow) {
  705. if (!isShallow(value) && !isReadonly(value)) {
  706. oldValue = toRaw(oldValue);
  707. value = toRaw(value);
  708. }
  709. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  710. oldValue.value = value;
  711. return true;
  712. }
  713. }
  714. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  715. const result = Reflect.set(target, key, value, receiver);
  716. if (target === toRaw(receiver)) {
  717. if (!hadKey) {
  718. trigger(target, "add", key, value);
  719. } else if (hasChanged(value, oldValue)) {
  720. trigger(target, "set", key, value, oldValue);
  721. }
  722. }
  723. return result;
  724. };
  725. }
  726. function deleteProperty(target, key) {
  727. const hadKey = hasOwn(target, key);
  728. const oldValue = target[key];
  729. const result = Reflect.deleteProperty(target, key);
  730. if (result && hadKey) {
  731. trigger(target, "delete", key, void 0, oldValue);
  732. }
  733. return result;
  734. }
  735. function has$1(target, key) {
  736. const result = Reflect.has(target, key);
  737. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  738. track(target, "has", key);
  739. }
  740. return result;
  741. }
  742. function ownKeys(target) {
  743. track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
  744. return Reflect.ownKeys(target);
  745. }
  746. const mutableHandlers = {
  747. get: get$1,
  748. set: set$1,
  749. deleteProperty,
  750. has: has$1,
  751. ownKeys
  752. };
  753. const readonlyHandlers = {
  754. get: readonlyGet,
  755. set(target, key) {
  756. {
  757. warn$1(
  758. `Set operation on key "${String(key)}" failed: target is readonly.`,
  759. target
  760. );
  761. }
  762. return true;
  763. },
  764. deleteProperty(target, key) {
  765. {
  766. warn$1(
  767. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  768. target
  769. );
  770. }
  771. return true;
  772. }
  773. };
  774. const shallowReactiveHandlers = /* @__PURE__ */ extend(
  775. {},
  776. mutableHandlers,
  777. {
  778. get: shallowGet,
  779. set: shallowSet
  780. }
  781. );
  782. const shallowReadonlyHandlers = /* @__PURE__ */ extend(
  783. {},
  784. readonlyHandlers,
  785. {
  786. get: shallowReadonlyGet
  787. }
  788. );
  789. const toShallow = (value) => value;
  790. const getProto = (v) => Reflect.getPrototypeOf(v);
  791. function get(target, key, isReadonly = false, isShallow = false) {
  792. target = target["__v_raw"];
  793. const rawTarget = toRaw(target);
  794. const rawKey = toRaw(key);
  795. if (!isReadonly) {
  796. if (key !== rawKey) {
  797. track(rawTarget, "get", key);
  798. }
  799. track(rawTarget, "get", rawKey);
  800. }
  801. const { has: has2 } = getProto(rawTarget);
  802. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  803. if (has2.call(rawTarget, key)) {
  804. return wrap(target.get(key));
  805. } else if (has2.call(rawTarget, rawKey)) {
  806. return wrap(target.get(rawKey));
  807. } else if (target !== rawTarget) {
  808. target.get(key);
  809. }
  810. }
  811. function has(key, isReadonly = false) {
  812. const target = this["__v_raw"];
  813. const rawTarget = toRaw(target);
  814. const rawKey = toRaw(key);
  815. if (!isReadonly) {
  816. if (key !== rawKey) {
  817. track(rawTarget, "has", key);
  818. }
  819. track(rawTarget, "has", rawKey);
  820. }
  821. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  822. }
  823. function size(target, isReadonly = false) {
  824. target = target["__v_raw"];
  825. !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
  826. return Reflect.get(target, "size", target);
  827. }
  828. function add(value) {
  829. value = toRaw(value);
  830. const target = toRaw(this);
  831. const proto = getProto(target);
  832. const hadKey = proto.has.call(target, value);
  833. if (!hadKey) {
  834. target.add(value);
  835. trigger(target, "add", value, value);
  836. }
  837. return this;
  838. }
  839. function set(key, value) {
  840. value = toRaw(value);
  841. const target = toRaw(this);
  842. const { has: has2, get: get2 } = getProto(target);
  843. let hadKey = has2.call(target, key);
  844. if (!hadKey) {
  845. key = toRaw(key);
  846. hadKey = has2.call(target, key);
  847. } else {
  848. checkIdentityKeys(target, has2, key);
  849. }
  850. const oldValue = get2.call(target, key);
  851. target.set(key, value);
  852. if (!hadKey) {
  853. trigger(target, "add", key, value);
  854. } else if (hasChanged(value, oldValue)) {
  855. trigger(target, "set", key, value, oldValue);
  856. }
  857. return this;
  858. }
  859. function deleteEntry(key) {
  860. const target = toRaw(this);
  861. const { has: has2, get: get2 } = getProto(target);
  862. let hadKey = has2.call(target, key);
  863. if (!hadKey) {
  864. key = toRaw(key);
  865. hadKey = has2.call(target, key);
  866. } else {
  867. checkIdentityKeys(target, has2, key);
  868. }
  869. const oldValue = get2 ? get2.call(target, key) : void 0;
  870. const result = target.delete(key);
  871. if (hadKey) {
  872. trigger(target, "delete", key, void 0, oldValue);
  873. }
  874. return result;
  875. }
  876. function clear() {
  877. const target = toRaw(this);
  878. const hadItems = target.size !== 0;
  879. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  880. const result = target.clear();
  881. if (hadItems) {
  882. trigger(target, "clear", void 0, void 0, oldTarget);
  883. }
  884. return result;
  885. }
  886. function createForEach(isReadonly, isShallow) {
  887. return function forEach(callback, thisArg) {
  888. const observed = this;
  889. const target = observed["__v_raw"];
  890. const rawTarget = toRaw(target);
  891. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  892. !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
  893. return target.forEach((value, key) => {
  894. return callback.call(thisArg, wrap(value), wrap(key), observed);
  895. });
  896. };
  897. }
  898. function createIterableMethod(method, isReadonly, isShallow) {
  899. return function(...args) {
  900. const target = this["__v_raw"];
  901. const rawTarget = toRaw(target);
  902. const targetIsMap = isMap(rawTarget);
  903. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  904. const isKeyOnly = method === "keys" && targetIsMap;
  905. const innerIterator = target[method](...args);
  906. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  907. !isReadonly && track(
  908. rawTarget,
  909. "iterate",
  910. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  911. );
  912. return {
  913. // iterator protocol
  914. next() {
  915. const { value, done } = innerIterator.next();
  916. return done ? { value, done } : {
  917. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  918. done
  919. };
  920. },
  921. // iterable protocol
  922. [Symbol.iterator]() {
  923. return this;
  924. }
  925. };
  926. };
  927. }
  928. function createReadonlyMethod(type) {
  929. return function(...args) {
  930. {
  931. const key = args[0] ? `on key "${args[0]}" ` : ``;
  932. console.warn(
  933. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  934. toRaw(this)
  935. );
  936. }
  937. return type === "delete" ? false : this;
  938. };
  939. }
  940. function createInstrumentations() {
  941. const mutableInstrumentations2 = {
  942. get(key) {
  943. return get(this, key);
  944. },
  945. get size() {
  946. return size(this);
  947. },
  948. has,
  949. add,
  950. set,
  951. delete: deleteEntry,
  952. clear,
  953. forEach: createForEach(false, false)
  954. };
  955. const shallowInstrumentations2 = {
  956. get(key) {
  957. return get(this, key, false, true);
  958. },
  959. get size() {
  960. return size(this);
  961. },
  962. has,
  963. add,
  964. set,
  965. delete: deleteEntry,
  966. clear,
  967. forEach: createForEach(false, true)
  968. };
  969. const readonlyInstrumentations2 = {
  970. get(key) {
  971. return get(this, key, true);
  972. },
  973. get size() {
  974. return size(this, true);
  975. },
  976. has(key) {
  977. return has.call(this, key, true);
  978. },
  979. add: createReadonlyMethod("add"),
  980. set: createReadonlyMethod("set"),
  981. delete: createReadonlyMethod("delete"),
  982. clear: createReadonlyMethod("clear"),
  983. forEach: createForEach(true, false)
  984. };
  985. const shallowReadonlyInstrumentations2 = {
  986. get(key) {
  987. return get(this, key, true, true);
  988. },
  989. get size() {
  990. return size(this, true);
  991. },
  992. has(key) {
  993. return has.call(this, key, true);
  994. },
  995. add: createReadonlyMethod("add"),
  996. set: createReadonlyMethod("set"),
  997. delete: createReadonlyMethod("delete"),
  998. clear: createReadonlyMethod("clear"),
  999. forEach: createForEach(true, true)
  1000. };
  1001. const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  1002. iteratorMethods.forEach((method) => {
  1003. mutableInstrumentations2[method] = createIterableMethod(
  1004. method,
  1005. false,
  1006. false
  1007. );
  1008. readonlyInstrumentations2[method] = createIterableMethod(
  1009. method,
  1010. true,
  1011. false
  1012. );
  1013. shallowInstrumentations2[method] = createIterableMethod(
  1014. method,
  1015. false,
  1016. true
  1017. );
  1018. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1019. method,
  1020. true,
  1021. true
  1022. );
  1023. });
  1024. return [
  1025. mutableInstrumentations2,
  1026. readonlyInstrumentations2,
  1027. shallowInstrumentations2,
  1028. shallowReadonlyInstrumentations2
  1029. ];
  1030. }
  1031. const [
  1032. mutableInstrumentations,
  1033. readonlyInstrumentations,
  1034. shallowInstrumentations,
  1035. shallowReadonlyInstrumentations
  1036. ] = /* @__PURE__ */ createInstrumentations();
  1037. function createInstrumentationGetter(isReadonly, shallow) {
  1038. const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
  1039. return (target, key, receiver) => {
  1040. if (key === "__v_isReactive") {
  1041. return !isReadonly;
  1042. } else if (key === "__v_isReadonly") {
  1043. return isReadonly;
  1044. } else if (key === "__v_raw") {
  1045. return target;
  1046. }
  1047. return Reflect.get(
  1048. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1049. key,
  1050. receiver
  1051. );
  1052. };
  1053. }
  1054. const mutableCollectionHandlers = {
  1055. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1056. };
  1057. const shallowCollectionHandlers = {
  1058. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1059. };
  1060. const readonlyCollectionHandlers = {
  1061. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1062. };
  1063. const shallowReadonlyCollectionHandlers = {
  1064. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1065. };
  1066. function checkIdentityKeys(target, has2, key) {
  1067. const rawKey = toRaw(key);
  1068. if (rawKey !== key && has2.call(target, rawKey)) {
  1069. const type = toRawType(target);
  1070. console.warn(
  1071. `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.`
  1072. );
  1073. }
  1074. }
  1075. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1076. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1077. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1078. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1079. function targetTypeMap(rawType) {
  1080. switch (rawType) {
  1081. case "Object":
  1082. case "Array":
  1083. return 1 /* COMMON */;
  1084. case "Map":
  1085. case "Set":
  1086. case "WeakMap":
  1087. case "WeakSet":
  1088. return 2 /* COLLECTION */;
  1089. default:
  1090. return 0 /* INVALID */;
  1091. }
  1092. }
  1093. function getTargetType(value) {
  1094. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1095. }
  1096. function reactive(target) {
  1097. if (isReadonly(target)) {
  1098. return target;
  1099. }
  1100. return createReactiveObject(
  1101. target,
  1102. false,
  1103. mutableHandlers,
  1104. mutableCollectionHandlers,
  1105. reactiveMap
  1106. );
  1107. }
  1108. function shallowReactive(target) {
  1109. return createReactiveObject(
  1110. target,
  1111. false,
  1112. shallowReactiveHandlers,
  1113. shallowCollectionHandlers,
  1114. shallowReactiveMap
  1115. );
  1116. }
  1117. function readonly(target) {
  1118. return createReactiveObject(
  1119. target,
  1120. true,
  1121. readonlyHandlers,
  1122. readonlyCollectionHandlers,
  1123. readonlyMap
  1124. );
  1125. }
  1126. function shallowReadonly(target) {
  1127. return createReactiveObject(
  1128. target,
  1129. true,
  1130. shallowReadonlyHandlers,
  1131. shallowReadonlyCollectionHandlers,
  1132. shallowReadonlyMap
  1133. );
  1134. }
  1135. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1136. if (!isObject(target)) {
  1137. {
  1138. console.warn(`value cannot be made reactive: ${String(target)}`);
  1139. }
  1140. return target;
  1141. }
  1142. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1143. return target;
  1144. }
  1145. const existingProxy = proxyMap.get(target);
  1146. if (existingProxy) {
  1147. return existingProxy;
  1148. }
  1149. const targetType = getTargetType(target);
  1150. if (targetType === 0 /* INVALID */) {
  1151. return target;
  1152. }
  1153. const proxy = new Proxy(
  1154. target,
  1155. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1156. );
  1157. proxyMap.set(target, proxy);
  1158. return proxy;
  1159. }
  1160. function isReactive(value) {
  1161. if (isReadonly(value)) {
  1162. return isReactive(value["__v_raw"]);
  1163. }
  1164. return !!(value && value["__v_isReactive"]);
  1165. }
  1166. function isReadonly(value) {
  1167. return !!(value && value["__v_isReadonly"]);
  1168. }
  1169. function isShallow(value) {
  1170. return !!(value && value["__v_isShallow"]);
  1171. }
  1172. function isProxy(value) {
  1173. return isReactive(value) || isReadonly(value);
  1174. }
  1175. function toRaw(observed) {
  1176. const raw = observed && observed["__v_raw"];
  1177. return raw ? toRaw(raw) : observed;
  1178. }
  1179. function markRaw(value) {
  1180. def(value, "__v_skip", true);
  1181. return value;
  1182. }
  1183. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1184. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1185. function trackRefValue(ref2) {
  1186. if (shouldTrack && activeEffect) {
  1187. ref2 = toRaw(ref2);
  1188. {
  1189. trackEffects(ref2.dep || (ref2.dep = createDep()), {
  1190. target: ref2,
  1191. type: "get",
  1192. key: "value"
  1193. });
  1194. }
  1195. }
  1196. }
  1197. function triggerRefValue(ref2, newVal) {
  1198. ref2 = toRaw(ref2);
  1199. const dep = ref2.dep;
  1200. if (dep) {
  1201. {
  1202. triggerEffects(dep, {
  1203. target: ref2,
  1204. type: "set",
  1205. key: "value",
  1206. newValue: newVal
  1207. });
  1208. }
  1209. }
  1210. }
  1211. function isRef(r) {
  1212. return !!(r && r.__v_isRef === true);
  1213. }
  1214. function ref(value) {
  1215. return createRef(value, false);
  1216. }
  1217. function shallowRef(value) {
  1218. return createRef(value, true);
  1219. }
  1220. function createRef(rawValue, shallow) {
  1221. if (isRef(rawValue)) {
  1222. return rawValue;
  1223. }
  1224. return new RefImpl(rawValue, shallow);
  1225. }
  1226. class RefImpl {
  1227. constructor(value, __v_isShallow) {
  1228. this.__v_isShallow = __v_isShallow;
  1229. this.dep = void 0;
  1230. this.__v_isRef = true;
  1231. this._rawValue = __v_isShallow ? value : toRaw(value);
  1232. this._value = __v_isShallow ? value : toReactive(value);
  1233. }
  1234. get value() {
  1235. trackRefValue(this);
  1236. return this._value;
  1237. }
  1238. set value(newVal) {
  1239. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1240. newVal = useDirectValue ? newVal : toRaw(newVal);
  1241. if (hasChanged(newVal, this._rawValue)) {
  1242. this._rawValue = newVal;
  1243. this._value = useDirectValue ? newVal : toReactive(newVal);
  1244. triggerRefValue(this, newVal);
  1245. }
  1246. }
  1247. }
  1248. function triggerRef(ref2) {
  1249. triggerRefValue(ref2, ref2.value );
  1250. }
  1251. function unref(ref2) {
  1252. return isRef(ref2) ? ref2.value : ref2;
  1253. }
  1254. function toValue(source) {
  1255. return isFunction(source) ? source() : unref(source);
  1256. }
  1257. const shallowUnwrapHandlers = {
  1258. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1259. set: (target, key, value, receiver) => {
  1260. const oldValue = target[key];
  1261. if (isRef(oldValue) && !isRef(value)) {
  1262. oldValue.value = value;
  1263. return true;
  1264. } else {
  1265. return Reflect.set(target, key, value, receiver);
  1266. }
  1267. }
  1268. };
  1269. function proxyRefs(objectWithRefs) {
  1270. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1271. }
  1272. class CustomRefImpl {
  1273. constructor(factory) {
  1274. this.dep = void 0;
  1275. this.__v_isRef = true;
  1276. const { get, set } = factory(
  1277. () => trackRefValue(this),
  1278. () => triggerRefValue(this)
  1279. );
  1280. this._get = get;
  1281. this._set = set;
  1282. }
  1283. get value() {
  1284. return this._get();
  1285. }
  1286. set value(newVal) {
  1287. this._set(newVal);
  1288. }
  1289. }
  1290. function customRef(factory) {
  1291. return new CustomRefImpl(factory);
  1292. }
  1293. function toRefs(object) {
  1294. if (!isProxy(object)) {
  1295. console.warn(`toRefs() expects a reactive object but received a plain one.`);
  1296. }
  1297. const ret = isArray(object) ? new Array(object.length) : {};
  1298. for (const key in object) {
  1299. ret[key] = propertyToRef(object, key);
  1300. }
  1301. return ret;
  1302. }
  1303. class ObjectRefImpl {
  1304. constructor(_object, _key, _defaultValue) {
  1305. this._object = _object;
  1306. this._key = _key;
  1307. this._defaultValue = _defaultValue;
  1308. this.__v_isRef = true;
  1309. }
  1310. get value() {
  1311. const val = this._object[this._key];
  1312. return val === void 0 ? this._defaultValue : val;
  1313. }
  1314. set value(newVal) {
  1315. this._object[this._key] = newVal;
  1316. }
  1317. get dep() {
  1318. return getDepFromReactive(toRaw(this._object), this._key);
  1319. }
  1320. }
  1321. class GetterRefImpl {
  1322. constructor(_getter) {
  1323. this._getter = _getter;
  1324. this.__v_isRef = true;
  1325. this.__v_isReadonly = true;
  1326. }
  1327. get value() {
  1328. return this._getter();
  1329. }
  1330. }
  1331. function toRef(source, key, defaultValue) {
  1332. if (isRef(source)) {
  1333. return source;
  1334. } else if (isFunction(source)) {
  1335. return new GetterRefImpl(source);
  1336. } else if (isObject(source) && arguments.length > 1) {
  1337. return propertyToRef(source, key, defaultValue);
  1338. } else {
  1339. return ref(source);
  1340. }
  1341. }
  1342. function propertyToRef(source, key, defaultValue) {
  1343. const val = source[key];
  1344. return isRef(val) ? val : new ObjectRefImpl(
  1345. source,
  1346. key,
  1347. defaultValue
  1348. );
  1349. }
  1350. class ComputedRefImpl {
  1351. constructor(getter, _setter, isReadonly, isSSR) {
  1352. this._setter = _setter;
  1353. this.dep = void 0;
  1354. this.__v_isRef = true;
  1355. this["__v_isReadonly"] = false;
  1356. this._dirty = true;
  1357. this.effect = new ReactiveEffect(getter, () => {
  1358. if (!this._dirty) {
  1359. this._dirty = true;
  1360. triggerRefValue(this);
  1361. }
  1362. });
  1363. this.effect.computed = this;
  1364. this.effect.active = this._cacheable = !isSSR;
  1365. this["__v_isReadonly"] = isReadonly;
  1366. }
  1367. get value() {
  1368. const self = toRaw(this);
  1369. trackRefValue(self);
  1370. if (self._dirty || !self._cacheable) {
  1371. self._dirty = false;
  1372. self._value = self.effect.run();
  1373. }
  1374. return self._value;
  1375. }
  1376. set value(newValue) {
  1377. this._setter(newValue);
  1378. }
  1379. }
  1380. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1381. let getter;
  1382. let setter;
  1383. const onlyGetter = isFunction(getterOrOptions);
  1384. if (onlyGetter) {
  1385. getter = getterOrOptions;
  1386. setter = () => {
  1387. console.warn("Write operation failed: computed value is readonly");
  1388. } ;
  1389. } else {
  1390. getter = getterOrOptions.get;
  1391. setter = getterOrOptions.set;
  1392. }
  1393. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1394. if (debugOptions && !isSSR) {
  1395. cRef.effect.onTrack = debugOptions.onTrack;
  1396. cRef.effect.onTrigger = debugOptions.onTrigger;
  1397. }
  1398. return cRef;
  1399. }
  1400. const stack = [];
  1401. function pushWarningContext(vnode) {
  1402. stack.push(vnode);
  1403. }
  1404. function popWarningContext() {
  1405. stack.pop();
  1406. }
  1407. function warn(msg, ...args) {
  1408. pauseTracking();
  1409. const instance = stack.length ? stack[stack.length - 1].component : null;
  1410. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1411. const trace = getComponentTrace();
  1412. if (appWarnHandler) {
  1413. callWithErrorHandling(
  1414. appWarnHandler,
  1415. instance,
  1416. 11,
  1417. [
  1418. msg + args.join(""),
  1419. instance && instance.proxy,
  1420. trace.map(
  1421. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1422. ).join("\n"),
  1423. trace
  1424. ]
  1425. );
  1426. } else {
  1427. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1428. if (trace.length && // avoid spamming console during tests
  1429. true) {
  1430. warnArgs.push(`
  1431. `, ...formatTrace(trace));
  1432. }
  1433. console.warn(...warnArgs);
  1434. }
  1435. resetTracking();
  1436. }
  1437. function getComponentTrace() {
  1438. let currentVNode = stack[stack.length - 1];
  1439. if (!currentVNode) {
  1440. return [];
  1441. }
  1442. const normalizedStack = [];
  1443. while (currentVNode) {
  1444. const last = normalizedStack[0];
  1445. if (last && last.vnode === currentVNode) {
  1446. last.recurseCount++;
  1447. } else {
  1448. normalizedStack.push({
  1449. vnode: currentVNode,
  1450. recurseCount: 0
  1451. });
  1452. }
  1453. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1454. currentVNode = parentInstance && parentInstance.vnode;
  1455. }
  1456. return normalizedStack;
  1457. }
  1458. function formatTrace(trace) {
  1459. const logs = [];
  1460. trace.forEach((entry, i) => {
  1461. logs.push(...i === 0 ? [] : [`
  1462. `], ...formatTraceEntry(entry));
  1463. });
  1464. return logs;
  1465. }
  1466. function formatTraceEntry({ vnode, recurseCount }) {
  1467. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1468. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1469. const open = ` at <${formatComponentName(
  1470. vnode.component,
  1471. vnode.type,
  1472. isRoot
  1473. )}`;
  1474. const close = `>` + postfix;
  1475. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1476. }
  1477. function formatProps(props) {
  1478. const res = [];
  1479. const keys = Object.keys(props);
  1480. keys.slice(0, 3).forEach((key) => {
  1481. res.push(...formatProp(key, props[key]));
  1482. });
  1483. if (keys.length > 3) {
  1484. res.push(` ...`);
  1485. }
  1486. return res;
  1487. }
  1488. function formatProp(key, value, raw) {
  1489. if (isString(value)) {
  1490. value = JSON.stringify(value);
  1491. return raw ? value : [`${key}=${value}`];
  1492. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1493. return raw ? value : [`${key}=${value}`];
  1494. } else if (isRef(value)) {
  1495. value = formatProp(key, toRaw(value.value), true);
  1496. return raw ? value : [`${key}=Ref<`, value, `>`];
  1497. } else if (isFunction(value)) {
  1498. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1499. } else {
  1500. value = toRaw(value);
  1501. return raw ? value : [`${key}=`, value];
  1502. }
  1503. }
  1504. function assertNumber(val, type) {
  1505. if (val === void 0) {
  1506. return;
  1507. } else if (typeof val !== "number") {
  1508. warn(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  1509. } else if (isNaN(val)) {
  1510. warn(`${type} is NaN - the duration expression might be incorrect.`);
  1511. }
  1512. }
  1513. const ErrorTypeStrings = {
  1514. ["sp"]: "serverPrefetch hook",
  1515. ["bc"]: "beforeCreate hook",
  1516. ["c"]: "created hook",
  1517. ["bm"]: "beforeMount hook",
  1518. ["m"]: "mounted hook",
  1519. ["bu"]: "beforeUpdate hook",
  1520. ["u"]: "updated",
  1521. ["bum"]: "beforeUnmount hook",
  1522. ["um"]: "unmounted hook",
  1523. ["a"]: "activated hook",
  1524. ["da"]: "deactivated hook",
  1525. ["ec"]: "errorCaptured hook",
  1526. ["rtc"]: "renderTracked hook",
  1527. ["rtg"]: "renderTriggered hook",
  1528. [0]: "setup function",
  1529. [1]: "render function",
  1530. [2]: "watcher getter",
  1531. [3]: "watcher callback",
  1532. [4]: "watcher cleanup function",
  1533. [5]: "native event handler",
  1534. [6]: "component event handler",
  1535. [7]: "vnode hook",
  1536. [8]: "directive hook",
  1537. [9]: "transition hook",
  1538. [10]: "app errorHandler",
  1539. [11]: "app warnHandler",
  1540. [12]: "ref function",
  1541. [13]: "async component loader",
  1542. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
  1543. };
  1544. function callWithErrorHandling(fn, instance, type, args) {
  1545. let res;
  1546. try {
  1547. res = args ? fn(...args) : fn();
  1548. } catch (err) {
  1549. handleError(err, instance, type);
  1550. }
  1551. return res;
  1552. }
  1553. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1554. if (isFunction(fn)) {
  1555. const res = callWithErrorHandling(fn, instance, type, args);
  1556. if (res && isPromise(res)) {
  1557. res.catch((err) => {
  1558. handleError(err, instance, type);
  1559. });
  1560. }
  1561. return res;
  1562. }
  1563. const values = [];
  1564. for (let i = 0; i < fn.length; i++) {
  1565. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1566. }
  1567. return values;
  1568. }
  1569. function handleError(err, instance, type, throwInDev = true) {
  1570. const contextVNode = instance ? instance.vnode : null;
  1571. if (instance) {
  1572. let cur = instance.parent;
  1573. const exposedInstance = instance.proxy;
  1574. const errorInfo = ErrorTypeStrings[type] ;
  1575. while (cur) {
  1576. const errorCapturedHooks = cur.ec;
  1577. if (errorCapturedHooks) {
  1578. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1579. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1580. return;
  1581. }
  1582. }
  1583. }
  1584. cur = cur.parent;
  1585. }
  1586. const appErrorHandler = instance.appContext.config.errorHandler;
  1587. if (appErrorHandler) {
  1588. callWithErrorHandling(
  1589. appErrorHandler,
  1590. null,
  1591. 10,
  1592. [err, exposedInstance, errorInfo]
  1593. );
  1594. return;
  1595. }
  1596. }
  1597. logError(err, type, contextVNode, throwInDev);
  1598. }
  1599. function logError(err, type, contextVNode, throwInDev = true) {
  1600. {
  1601. const info = ErrorTypeStrings[type];
  1602. if (contextVNode) {
  1603. pushWarningContext(contextVNode);
  1604. }
  1605. warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1606. if (contextVNode) {
  1607. popWarningContext();
  1608. }
  1609. if (throwInDev) {
  1610. throw err;
  1611. } else {
  1612. console.error(err);
  1613. }
  1614. }
  1615. }
  1616. let isFlushing = false;
  1617. let isFlushPending = false;
  1618. const queue = [];
  1619. let flushIndex = 0;
  1620. const pendingPostFlushCbs = [];
  1621. let activePostFlushCbs = null;
  1622. let postFlushIndex = 0;
  1623. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1624. let currentFlushPromise = null;
  1625. const RECURSION_LIMIT = 100;
  1626. function nextTick(fn) {
  1627. const p = currentFlushPromise || resolvedPromise;
  1628. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  1629. }
  1630. function findInsertionIndex(id) {
  1631. let start = flushIndex + 1;
  1632. let end = queue.length;
  1633. while (start < end) {
  1634. const middle = start + end >>> 1;
  1635. const middleJobId = getId(queue[middle]);
  1636. middleJobId < id ? start = middle + 1 : end = middle;
  1637. }
  1638. return start;
  1639. }
  1640. function queueJob(job) {
  1641. if (!queue.length || !queue.includes(
  1642. job,
  1643. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1644. )) {
  1645. if (job.id == null) {
  1646. queue.push(job);
  1647. } else {
  1648. queue.splice(findInsertionIndex(job.id), 0, job);
  1649. }
  1650. queueFlush();
  1651. }
  1652. }
  1653. function queueFlush() {
  1654. if (!isFlushing && !isFlushPending) {
  1655. isFlushPending = true;
  1656. currentFlushPromise = resolvedPromise.then(flushJobs);
  1657. }
  1658. }
  1659. function invalidateJob(job) {
  1660. const i = queue.indexOf(job);
  1661. if (i > flushIndex) {
  1662. queue.splice(i, 1);
  1663. }
  1664. }
  1665. function queuePostFlushCb(cb) {
  1666. if (!isArray(cb)) {
  1667. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1668. cb,
  1669. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1670. )) {
  1671. pendingPostFlushCbs.push(cb);
  1672. }
  1673. } else {
  1674. pendingPostFlushCbs.push(...cb);
  1675. }
  1676. queueFlush();
  1677. }
  1678. function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
  1679. {
  1680. seen = seen || /* @__PURE__ */ new Map();
  1681. }
  1682. for (; i < queue.length; i++) {
  1683. const cb = queue[i];
  1684. if (cb && cb.pre) {
  1685. if (checkRecursiveUpdates(seen, cb)) {
  1686. continue;
  1687. }
  1688. queue.splice(i, 1);
  1689. i--;
  1690. cb();
  1691. }
  1692. }
  1693. }
  1694. function flushPostFlushCbs(seen) {
  1695. if (pendingPostFlushCbs.length) {
  1696. const deduped = [...new Set(pendingPostFlushCbs)];
  1697. pendingPostFlushCbs.length = 0;
  1698. if (activePostFlushCbs) {
  1699. activePostFlushCbs.push(...deduped);
  1700. return;
  1701. }
  1702. activePostFlushCbs = deduped;
  1703. {
  1704. seen = seen || /* @__PURE__ */ new Map();
  1705. }
  1706. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  1707. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1708. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  1709. continue;
  1710. }
  1711. activePostFlushCbs[postFlushIndex]();
  1712. }
  1713. activePostFlushCbs = null;
  1714. postFlushIndex = 0;
  1715. }
  1716. }
  1717. const getId = (job) => job.id == null ? Infinity : job.id;
  1718. const comparator = (a, b) => {
  1719. const diff = getId(a) - getId(b);
  1720. if (diff === 0) {
  1721. if (a.pre && !b.pre)
  1722. return -1;
  1723. if (b.pre && !a.pre)
  1724. return 1;
  1725. }
  1726. return diff;
  1727. };
  1728. function flushJobs(seen) {
  1729. isFlushPending = false;
  1730. isFlushing = true;
  1731. {
  1732. seen = seen || /* @__PURE__ */ new Map();
  1733. }
  1734. queue.sort(comparator);
  1735. const check = (job) => checkRecursiveUpdates(seen, job) ;
  1736. try {
  1737. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1738. const job = queue[flushIndex];
  1739. if (job && job.active !== false) {
  1740. if (check(job)) {
  1741. continue;
  1742. }
  1743. callWithErrorHandling(job, null, 14);
  1744. }
  1745. }
  1746. } finally {
  1747. flushIndex = 0;
  1748. queue.length = 0;
  1749. flushPostFlushCbs(seen);
  1750. isFlushing = false;
  1751. currentFlushPromise = null;
  1752. if (queue.length || pendingPostFlushCbs.length) {
  1753. flushJobs(seen);
  1754. }
  1755. }
  1756. }
  1757. function checkRecursiveUpdates(seen, fn) {
  1758. if (!seen.has(fn)) {
  1759. seen.set(fn, 1);
  1760. } else {
  1761. const count = seen.get(fn);
  1762. if (count > RECURSION_LIMIT) {
  1763. const instance = fn.ownerInstance;
  1764. const componentName = instance && getComponentName(instance.type);
  1765. warn(
  1766. `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.`
  1767. );
  1768. return true;
  1769. } else {
  1770. seen.set(fn, count + 1);
  1771. }
  1772. }
  1773. }
  1774. let isHmrUpdating = false;
  1775. const hmrDirtyComponents = /* @__PURE__ */ new Set();
  1776. {
  1777. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  1778. createRecord: tryWrap(createRecord),
  1779. rerender: tryWrap(rerender),
  1780. reload: tryWrap(reload)
  1781. };
  1782. }
  1783. const map = /* @__PURE__ */ new Map();
  1784. function registerHMR(instance) {
  1785. const id = instance.type.__hmrId;
  1786. let record = map.get(id);
  1787. if (!record) {
  1788. createRecord(id, instance.type);
  1789. record = map.get(id);
  1790. }
  1791. record.instances.add(instance);
  1792. }
  1793. function unregisterHMR(instance) {
  1794. map.get(instance.type.__hmrId).instances.delete(instance);
  1795. }
  1796. function createRecord(id, initialDef) {
  1797. if (map.has(id)) {
  1798. return false;
  1799. }
  1800. map.set(id, {
  1801. initialDef: normalizeClassComponent(initialDef),
  1802. instances: /* @__PURE__ */ new Set()
  1803. });
  1804. return true;
  1805. }
  1806. function normalizeClassComponent(component) {
  1807. return isClassComponent(component) ? component.__vccOpts : component;
  1808. }
  1809. function rerender(id, newRender) {
  1810. const record = map.get(id);
  1811. if (!record) {
  1812. return;
  1813. }
  1814. record.initialDef.render = newRender;
  1815. [...record.instances].forEach((instance) => {
  1816. if (newRender) {
  1817. instance.render = newRender;
  1818. normalizeClassComponent(instance.type).render = newRender;
  1819. }
  1820. instance.renderCache = [];
  1821. isHmrUpdating = true;
  1822. instance.update();
  1823. isHmrUpdating = false;
  1824. });
  1825. }
  1826. function reload(id, newComp) {
  1827. const record = map.get(id);
  1828. if (!record)
  1829. return;
  1830. newComp = normalizeClassComponent(newComp);
  1831. updateComponentDef(record.initialDef, newComp);
  1832. const instances = [...record.instances];
  1833. for (const instance of instances) {
  1834. const oldComp = normalizeClassComponent(instance.type);
  1835. if (!hmrDirtyComponents.has(oldComp)) {
  1836. if (oldComp !== record.initialDef) {
  1837. updateComponentDef(oldComp, newComp);
  1838. }
  1839. hmrDirtyComponents.add(oldComp);
  1840. }
  1841. instance.appContext.propsCache.delete(instance.type);
  1842. instance.appContext.emitsCache.delete(instance.type);
  1843. instance.appContext.optionsCache.delete(instance.type);
  1844. if (instance.ceReload) {
  1845. hmrDirtyComponents.add(oldComp);
  1846. instance.ceReload(newComp.styles);
  1847. hmrDirtyComponents.delete(oldComp);
  1848. } else if (instance.parent) {
  1849. queueJob(instance.parent.update);
  1850. } else if (instance.appContext.reload) {
  1851. instance.appContext.reload();
  1852. } else if (typeof window !== "undefined") {
  1853. window.location.reload();
  1854. } else {
  1855. console.warn(
  1856. "[HMR] Root or manually mounted instance modified. Full reload required."
  1857. );
  1858. }
  1859. }
  1860. queuePostFlushCb(() => {
  1861. for (const instance of instances) {
  1862. hmrDirtyComponents.delete(
  1863. normalizeClassComponent(instance.type)
  1864. );
  1865. }
  1866. });
  1867. }
  1868. function updateComponentDef(oldComp, newComp) {
  1869. extend(oldComp, newComp);
  1870. for (const key in oldComp) {
  1871. if (key !== "__file" && !(key in newComp)) {
  1872. delete oldComp[key];
  1873. }
  1874. }
  1875. }
  1876. function tryWrap(fn) {
  1877. return (id, arg) => {
  1878. try {
  1879. return fn(id, arg);
  1880. } catch (e) {
  1881. console.error(e);
  1882. console.warn(
  1883. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  1884. );
  1885. }
  1886. };
  1887. }
  1888. exports.devtools = void 0;
  1889. let buffer = [];
  1890. let devtoolsNotInstalled = false;
  1891. function emit$1(event, ...args) {
  1892. if (exports.devtools) {
  1893. exports.devtools.emit(event, ...args);
  1894. } else if (!devtoolsNotInstalled) {
  1895. buffer.push({ event, args });
  1896. }
  1897. }
  1898. function setDevtoolsHook(hook, target) {
  1899. var _a, _b;
  1900. exports.devtools = hook;
  1901. if (exports.devtools) {
  1902. exports.devtools.enabled = true;
  1903. buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
  1904. buffer = [];
  1905. } else if (
  1906. // handle late devtools injection - only do this if we are in an actual
  1907. // browser environment to avoid the timer handle stalling test runner exit
  1908. // (#4815)
  1909. typeof window !== "undefined" && // some envs mock window but not fully
  1910. window.HTMLElement && // also exclude jsdom
  1911. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  1912. ) {
  1913. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  1914. replay.push((newHook) => {
  1915. setDevtoolsHook(newHook, target);
  1916. });
  1917. setTimeout(() => {
  1918. if (!exports.devtools) {
  1919. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  1920. devtoolsNotInstalled = true;
  1921. buffer = [];
  1922. }
  1923. }, 3e3);
  1924. } else {
  1925. devtoolsNotInstalled = true;
  1926. buffer = [];
  1927. }
  1928. }
  1929. function devtoolsInitApp(app, version) {
  1930. emit$1("app:init" /* APP_INIT */, app, version, {
  1931. Fragment,
  1932. Text,
  1933. Comment,
  1934. Static
  1935. });
  1936. }
  1937. function devtoolsUnmountApp(app) {
  1938. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  1939. }
  1940. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  1941. "component:added" /* COMPONENT_ADDED */
  1942. );
  1943. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  1944. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  1945. "component:removed" /* COMPONENT_REMOVED */
  1946. );
  1947. const devtoolsComponentRemoved = (component) => {
  1948. if (exports.devtools && typeof exports.devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  1949. !exports.devtools.cleanupBuffer(component)) {
  1950. _devtoolsComponentRemoved(component);
  1951. }
  1952. };
  1953. function createDevtoolsComponentHook(hook) {
  1954. return (component) => {
  1955. emit$1(
  1956. hook,
  1957. component.appContext.app,
  1958. component.uid,
  1959. component.parent ? component.parent.uid : void 0,
  1960. component
  1961. );
  1962. };
  1963. }
  1964. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  1965. "perf:start" /* PERFORMANCE_START */
  1966. );
  1967. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  1968. "perf:end" /* PERFORMANCE_END */
  1969. );
  1970. function createDevtoolsPerformanceHook(hook) {
  1971. return (component, type, time) => {
  1972. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  1973. };
  1974. }
  1975. function devtoolsComponentEmit(component, event, params) {
  1976. emit$1(
  1977. "component:emit" /* COMPONENT_EMIT */,
  1978. component.appContext.app,
  1979. component,
  1980. event,
  1981. params
  1982. );
  1983. }
  1984. function emit(instance, event, ...rawArgs) {
  1985. if (instance.isUnmounted)
  1986. return;
  1987. const props = instance.vnode.props || EMPTY_OBJ;
  1988. {
  1989. const {
  1990. emitsOptions,
  1991. propsOptions: [propsOptions]
  1992. } = instance;
  1993. if (emitsOptions) {
  1994. if (!(event in emitsOptions) && true) {
  1995. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  1996. warn(
  1997. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  1998. );
  1999. }
  2000. } else {
  2001. const validator = emitsOptions[event];
  2002. if (isFunction(validator)) {
  2003. const isValid = validator(...rawArgs);
  2004. if (!isValid) {
  2005. warn(
  2006. `Invalid event arguments: event validation failed for event "${event}".`
  2007. );
  2008. }
  2009. }
  2010. }
  2011. }
  2012. }
  2013. let args = rawArgs;
  2014. const isModelListener = event.startsWith("update:");
  2015. const modelArg = isModelListener && event.slice(7);
  2016. if (modelArg && modelArg in props) {
  2017. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  2018. const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
  2019. if (trim) {
  2020. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  2021. }
  2022. if (number) {
  2023. args = rawArgs.map(looseToNumber);
  2024. }
  2025. }
  2026. {
  2027. devtoolsComponentEmit(instance, event, args);
  2028. }
  2029. {
  2030. const lowerCaseEvent = event.toLowerCase();
  2031. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  2032. warn(
  2033. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  2034. instance,
  2035. instance.type
  2036. )} 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(event)}" instead of "${event}".`
  2037. );
  2038. }
  2039. }
  2040. let handlerName;
  2041. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  2042. props[handlerName = toHandlerKey(camelize(event))];
  2043. if (!handler && isModelListener) {
  2044. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  2045. }
  2046. if (handler) {
  2047. callWithAsyncErrorHandling(
  2048. handler,
  2049. instance,
  2050. 6,
  2051. args
  2052. );
  2053. }
  2054. const onceHandler = props[handlerName + `Once`];
  2055. if (onceHandler) {
  2056. if (!instance.emitted) {
  2057. instance.emitted = {};
  2058. } else if (instance.emitted[handlerName]) {
  2059. return;
  2060. }
  2061. instance.emitted[handlerName] = true;
  2062. callWithAsyncErrorHandling(
  2063. onceHandler,
  2064. instance,
  2065. 6,
  2066. args
  2067. );
  2068. }
  2069. }
  2070. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  2071. const cache = appContext.emitsCache;
  2072. const cached = cache.get(comp);
  2073. if (cached !== void 0) {
  2074. return cached;
  2075. }
  2076. const raw = comp.emits;
  2077. let normalized = {};
  2078. let hasExtends = false;
  2079. if (!isFunction(comp)) {
  2080. const extendEmits = (raw2) => {
  2081. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  2082. if (normalizedFromExtend) {
  2083. hasExtends = true;
  2084. extend(normalized, normalizedFromExtend);
  2085. }
  2086. };
  2087. if (!asMixin && appContext.mixins.length) {
  2088. appContext.mixins.forEach(extendEmits);
  2089. }
  2090. if (comp.extends) {
  2091. extendEmits(comp.extends);
  2092. }
  2093. if (comp.mixins) {
  2094. comp.mixins.forEach(extendEmits);
  2095. }
  2096. }
  2097. if (!raw && !hasExtends) {
  2098. if (isObject(comp)) {
  2099. cache.set(comp, null);
  2100. }
  2101. return null;
  2102. }
  2103. if (isArray(raw)) {
  2104. raw.forEach((key) => normalized[key] = null);
  2105. } else {
  2106. extend(normalized, raw);
  2107. }
  2108. if (isObject(comp)) {
  2109. cache.set(comp, normalized);
  2110. }
  2111. return normalized;
  2112. }
  2113. function isEmitListener(options, key) {
  2114. if (!options || !isOn(key)) {
  2115. return false;
  2116. }
  2117. key = key.slice(2).replace(/Once$/, "");
  2118. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  2119. }
  2120. let currentRenderingInstance = null;
  2121. let currentScopeId = null;
  2122. function setCurrentRenderingInstance(instance) {
  2123. const prev = currentRenderingInstance;
  2124. currentRenderingInstance = instance;
  2125. currentScopeId = instance && instance.type.__scopeId || null;
  2126. return prev;
  2127. }
  2128. function pushScopeId(id) {
  2129. currentScopeId = id;
  2130. }
  2131. function popScopeId() {
  2132. currentScopeId = null;
  2133. }
  2134. const withScopeId = (_id) => withCtx;
  2135. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2136. if (!ctx)
  2137. return fn;
  2138. if (fn._n) {
  2139. return fn;
  2140. }
  2141. const renderFnWithContext = (...args) => {
  2142. if (renderFnWithContext._d) {
  2143. setBlockTracking(-1);
  2144. }
  2145. const prevInstance = setCurrentRenderingInstance(ctx);
  2146. let res;
  2147. try {
  2148. res = fn(...args);
  2149. } finally {
  2150. setCurrentRenderingInstance(prevInstance);
  2151. if (renderFnWithContext._d) {
  2152. setBlockTracking(1);
  2153. }
  2154. }
  2155. {
  2156. devtoolsComponentUpdated(ctx);
  2157. }
  2158. return res;
  2159. };
  2160. renderFnWithContext._n = true;
  2161. renderFnWithContext._c = true;
  2162. renderFnWithContext._d = true;
  2163. return renderFnWithContext;
  2164. }
  2165. let accessedAttrs = false;
  2166. function markAttrsAccessed() {
  2167. accessedAttrs = true;
  2168. }
  2169. function renderComponentRoot(instance) {
  2170. const {
  2171. type: Component,
  2172. vnode,
  2173. proxy,
  2174. withProxy,
  2175. props,
  2176. propsOptions: [propsOptions],
  2177. slots,
  2178. attrs,
  2179. emit,
  2180. render,
  2181. renderCache,
  2182. data,
  2183. setupState,
  2184. ctx,
  2185. inheritAttrs
  2186. } = instance;
  2187. let result;
  2188. let fallthroughAttrs;
  2189. const prev = setCurrentRenderingInstance(instance);
  2190. {
  2191. accessedAttrs = false;
  2192. }
  2193. try {
  2194. if (vnode.shapeFlag & 4) {
  2195. const proxyToUse = withProxy || proxy;
  2196. result = normalizeVNode(
  2197. render.call(
  2198. proxyToUse,
  2199. proxyToUse,
  2200. renderCache,
  2201. props,
  2202. setupState,
  2203. data,
  2204. ctx
  2205. )
  2206. );
  2207. fallthroughAttrs = attrs;
  2208. } else {
  2209. const render2 = Component;
  2210. if (attrs === props) {
  2211. markAttrsAccessed();
  2212. }
  2213. result = normalizeVNode(
  2214. render2.length > 1 ? render2(
  2215. props,
  2216. true ? {
  2217. get attrs() {
  2218. markAttrsAccessed();
  2219. return attrs;
  2220. },
  2221. slots,
  2222. emit
  2223. } : { attrs, slots, emit }
  2224. ) : render2(
  2225. props,
  2226. null
  2227. /* we know it doesn't need it */
  2228. )
  2229. );
  2230. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  2231. }
  2232. } catch (err) {
  2233. blockStack.length = 0;
  2234. handleError(err, instance, 1);
  2235. result = createVNode(Comment);
  2236. }
  2237. let root = result;
  2238. let setRoot = void 0;
  2239. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  2240. [root, setRoot] = getChildRoot(result);
  2241. }
  2242. if (fallthroughAttrs && inheritAttrs !== false) {
  2243. const keys = Object.keys(fallthroughAttrs);
  2244. const { shapeFlag } = root;
  2245. if (keys.length) {
  2246. if (shapeFlag & (1 | 6)) {
  2247. if (propsOptions && keys.some(isModelListener)) {
  2248. fallthroughAttrs = filterModelListeners(
  2249. fallthroughAttrs,
  2250. propsOptions
  2251. );
  2252. }
  2253. root = cloneVNode(root, fallthroughAttrs);
  2254. } else if (!accessedAttrs && root.type !== Comment) {
  2255. const allAttrs = Object.keys(attrs);
  2256. const eventAttrs = [];
  2257. const extraAttrs = [];
  2258. for (let i = 0, l = allAttrs.length; i < l; i++) {
  2259. const key = allAttrs[i];
  2260. if (isOn(key)) {
  2261. if (!isModelListener(key)) {
  2262. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  2263. }
  2264. } else {
  2265. extraAttrs.push(key);
  2266. }
  2267. }
  2268. if (extraAttrs.length) {
  2269. warn(
  2270. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  2271. );
  2272. }
  2273. if (eventAttrs.length) {
  2274. warn(
  2275. `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.`
  2276. );
  2277. }
  2278. }
  2279. }
  2280. }
  2281. if (vnode.dirs) {
  2282. if (!isElementRoot(root)) {
  2283. warn(
  2284. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  2285. );
  2286. }
  2287. root = cloneVNode(root);
  2288. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  2289. }
  2290. if (vnode.transition) {
  2291. if (!isElementRoot(root)) {
  2292. warn(
  2293. `Component inside <Transition> renders non-element root node that cannot be animated.`
  2294. );
  2295. }
  2296. root.transition = vnode.transition;
  2297. }
  2298. if (setRoot) {
  2299. setRoot(root);
  2300. } else {
  2301. result = root;
  2302. }
  2303. setCurrentRenderingInstance(prev);
  2304. return result;
  2305. }
  2306. const getChildRoot = (vnode) => {
  2307. const rawChildren = vnode.children;
  2308. const dynamicChildren = vnode.dynamicChildren;
  2309. const childRoot = filterSingleRoot(rawChildren);
  2310. if (!childRoot) {
  2311. return [vnode, void 0];
  2312. }
  2313. const index = rawChildren.indexOf(childRoot);
  2314. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  2315. const setRoot = (updatedRoot) => {
  2316. rawChildren[index] = updatedRoot;
  2317. if (dynamicChildren) {
  2318. if (dynamicIndex > -1) {
  2319. dynamicChildren[dynamicIndex] = updatedRoot;
  2320. } else if (updatedRoot.patchFlag > 0) {
  2321. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  2322. }
  2323. }
  2324. };
  2325. return [normalizeVNode(childRoot), setRoot];
  2326. };
  2327. function filterSingleRoot(children) {
  2328. let singleRoot;
  2329. for (let i = 0; i < children.length; i++) {
  2330. const child = children[i];
  2331. if (isVNode(child)) {
  2332. if (child.type !== Comment || child.children === "v-if") {
  2333. if (singleRoot) {
  2334. return;
  2335. } else {
  2336. singleRoot = child;
  2337. }
  2338. }
  2339. } else {
  2340. return;
  2341. }
  2342. }
  2343. return singleRoot;
  2344. }
  2345. const getFunctionalFallthrough = (attrs) => {
  2346. let res;
  2347. for (const key in attrs) {
  2348. if (key === "class" || key === "style" || isOn(key)) {
  2349. (res || (res = {}))[key] = attrs[key];
  2350. }
  2351. }
  2352. return res;
  2353. };
  2354. const filterModelListeners = (attrs, props) => {
  2355. const res = {};
  2356. for (const key in attrs) {
  2357. if (!isModelListener(key) || !(key.slice(9) in props)) {
  2358. res[key] = attrs[key];
  2359. }
  2360. }
  2361. return res;
  2362. };
  2363. const isElementRoot = (vnode) => {
  2364. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  2365. };
  2366. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  2367. const { props: prevProps, children: prevChildren, component } = prevVNode;
  2368. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  2369. const emits = component.emitsOptions;
  2370. if ((prevChildren || nextChildren) && isHmrUpdating) {
  2371. return true;
  2372. }
  2373. if (nextVNode.dirs || nextVNode.transition) {
  2374. return true;
  2375. }
  2376. if (optimized && patchFlag >= 0) {
  2377. if (patchFlag & 1024) {
  2378. return true;
  2379. }
  2380. if (patchFlag & 16) {
  2381. if (!prevProps) {
  2382. return !!nextProps;
  2383. }
  2384. return hasPropsChanged(prevProps, nextProps, emits);
  2385. } else if (patchFlag & 8) {
  2386. const dynamicProps = nextVNode.dynamicProps;
  2387. for (let i = 0; i < dynamicProps.length; i++) {
  2388. const key = dynamicProps[i];
  2389. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  2390. return true;
  2391. }
  2392. }
  2393. }
  2394. } else {
  2395. if (prevChildren || nextChildren) {
  2396. if (!nextChildren || !nextChildren.$stable) {
  2397. return true;
  2398. }
  2399. }
  2400. if (prevProps === nextProps) {
  2401. return false;
  2402. }
  2403. if (!prevProps) {
  2404. return !!nextProps;
  2405. }
  2406. if (!nextProps) {
  2407. return true;
  2408. }
  2409. return hasPropsChanged(prevProps, nextProps, emits);
  2410. }
  2411. return false;
  2412. }
  2413. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  2414. const nextKeys = Object.keys(nextProps);
  2415. if (nextKeys.length !== Object.keys(prevProps).length) {
  2416. return true;
  2417. }
  2418. for (let i = 0; i < nextKeys.length; i++) {
  2419. const key = nextKeys[i];
  2420. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  2421. return true;
  2422. }
  2423. }
  2424. return false;
  2425. }
  2426. function updateHOCHostEl({ vnode, parent }, el) {
  2427. while (parent && parent.subTree === vnode) {
  2428. (vnode = parent.vnode).el = el;
  2429. parent = parent.parent;
  2430. }
  2431. }
  2432. const isSuspense = (type) => type.__isSuspense;
  2433. const SuspenseImpl = {
  2434. name: "Suspense",
  2435. // In order to make Suspense tree-shakable, we need to avoid importing it
  2436. // directly in the renderer. The renderer checks for the __isSuspense flag
  2437. // on a vnode's type and calls the `process` method, passing in renderer
  2438. // internals.
  2439. __isSuspense: true,
  2440. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  2441. if (n1 == null) {
  2442. mountSuspense(
  2443. n2,
  2444. container,
  2445. anchor,
  2446. parentComponent,
  2447. parentSuspense,
  2448. isSVG,
  2449. slotScopeIds,
  2450. optimized,
  2451. rendererInternals
  2452. );
  2453. } else {
  2454. patchSuspense(
  2455. n1,
  2456. n2,
  2457. container,
  2458. anchor,
  2459. parentComponent,
  2460. isSVG,
  2461. slotScopeIds,
  2462. optimized,
  2463. rendererInternals
  2464. );
  2465. }
  2466. },
  2467. hydrate: hydrateSuspense,
  2468. create: createSuspenseBoundary,
  2469. normalize: normalizeSuspenseChildren
  2470. };
  2471. const Suspense = SuspenseImpl ;
  2472. function triggerEvent(vnode, name) {
  2473. const eventListener = vnode.props && vnode.props[name];
  2474. if (isFunction(eventListener)) {
  2475. eventListener();
  2476. }
  2477. }
  2478. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  2479. const {
  2480. p: patch,
  2481. o: { createElement }
  2482. } = rendererInternals;
  2483. const hiddenContainer = createElement("div");
  2484. const suspense = vnode.suspense = createSuspenseBoundary(
  2485. vnode,
  2486. parentSuspense,
  2487. parentComponent,
  2488. container,
  2489. hiddenContainer,
  2490. anchor,
  2491. isSVG,
  2492. slotScopeIds,
  2493. optimized,
  2494. rendererInternals
  2495. );
  2496. patch(
  2497. null,
  2498. suspense.pendingBranch = vnode.ssContent,
  2499. hiddenContainer,
  2500. null,
  2501. parentComponent,
  2502. suspense,
  2503. isSVG,
  2504. slotScopeIds
  2505. );
  2506. if (suspense.deps > 0) {
  2507. triggerEvent(vnode, "onPending");
  2508. triggerEvent(vnode, "onFallback");
  2509. patch(
  2510. null,
  2511. vnode.ssFallback,
  2512. container,
  2513. anchor,
  2514. parentComponent,
  2515. null,
  2516. // fallback tree will not have suspense context
  2517. isSVG,
  2518. slotScopeIds
  2519. );
  2520. setActiveBranch(suspense, vnode.ssFallback);
  2521. } else {
  2522. suspense.resolve(false, true);
  2523. }
  2524. }
  2525. function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  2526. const suspense = n2.suspense = n1.suspense;
  2527. suspense.vnode = n2;
  2528. n2.el = n1.el;
  2529. const newBranch = n2.ssContent;
  2530. const newFallback = n2.ssFallback;
  2531. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  2532. if (pendingBranch) {
  2533. suspense.pendingBranch = newBranch;
  2534. if (isSameVNodeType(newBranch, pendingBranch)) {
  2535. patch(
  2536. pendingBranch,
  2537. newBranch,
  2538. suspense.hiddenContainer,
  2539. null,
  2540. parentComponent,
  2541. suspense,
  2542. isSVG,
  2543. slotScopeIds,
  2544. optimized
  2545. );
  2546. if (suspense.deps <= 0) {
  2547. suspense.resolve();
  2548. } else if (isInFallback) {
  2549. patch(
  2550. activeBranch,
  2551. newFallback,
  2552. container,
  2553. anchor,
  2554. parentComponent,
  2555. null,
  2556. // fallback tree will not have suspense context
  2557. isSVG,
  2558. slotScopeIds,
  2559. optimized
  2560. );
  2561. setActiveBranch(suspense, newFallback);
  2562. }
  2563. } else {
  2564. suspense.pendingId++;
  2565. if (isHydrating) {
  2566. suspense.isHydrating = false;
  2567. suspense.activeBranch = pendingBranch;
  2568. } else {
  2569. unmount(pendingBranch, parentComponent, suspense);
  2570. }
  2571. suspense.deps = 0;
  2572. suspense.effects.length = 0;
  2573. suspense.hiddenContainer = createElement("div");
  2574. if (isInFallback) {
  2575. patch(
  2576. null,
  2577. newBranch,
  2578. suspense.hiddenContainer,
  2579. null,
  2580. parentComponent,
  2581. suspense,
  2582. isSVG,
  2583. slotScopeIds,
  2584. optimized
  2585. );
  2586. if (suspense.deps <= 0) {
  2587. suspense.resolve();
  2588. } else {
  2589. patch(
  2590. activeBranch,
  2591. newFallback,
  2592. container,
  2593. anchor,
  2594. parentComponent,
  2595. null,
  2596. // fallback tree will not have suspense context
  2597. isSVG,
  2598. slotScopeIds,
  2599. optimized
  2600. );
  2601. setActiveBranch(suspense, newFallback);
  2602. }
  2603. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2604. patch(
  2605. activeBranch,
  2606. newBranch,
  2607. container,
  2608. anchor,
  2609. parentComponent,
  2610. suspense,
  2611. isSVG,
  2612. slotScopeIds,
  2613. optimized
  2614. );
  2615. suspense.resolve(true);
  2616. } else {
  2617. patch(
  2618. null,
  2619. newBranch,
  2620. suspense.hiddenContainer,
  2621. null,
  2622. parentComponent,
  2623. suspense,
  2624. isSVG,
  2625. slotScopeIds,
  2626. optimized
  2627. );
  2628. if (suspense.deps <= 0) {
  2629. suspense.resolve();
  2630. }
  2631. }
  2632. }
  2633. } else {
  2634. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2635. patch(
  2636. activeBranch,
  2637. newBranch,
  2638. container,
  2639. anchor,
  2640. parentComponent,
  2641. suspense,
  2642. isSVG,
  2643. slotScopeIds,
  2644. optimized
  2645. );
  2646. setActiveBranch(suspense, newBranch);
  2647. } else {
  2648. triggerEvent(n2, "onPending");
  2649. suspense.pendingBranch = newBranch;
  2650. suspense.pendingId++;
  2651. patch(
  2652. null,
  2653. newBranch,
  2654. suspense.hiddenContainer,
  2655. null,
  2656. parentComponent,
  2657. suspense,
  2658. isSVG,
  2659. slotScopeIds,
  2660. optimized
  2661. );
  2662. if (suspense.deps <= 0) {
  2663. suspense.resolve();
  2664. } else {
  2665. const { timeout, pendingId } = suspense;
  2666. if (timeout > 0) {
  2667. setTimeout(() => {
  2668. if (suspense.pendingId === pendingId) {
  2669. suspense.fallback(newFallback);
  2670. }
  2671. }, timeout);
  2672. } else if (timeout === 0) {
  2673. suspense.fallback(newFallback);
  2674. }
  2675. }
  2676. }
  2677. }
  2678. }
  2679. let hasWarned = false;
  2680. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  2681. if (!hasWarned) {
  2682. hasWarned = true;
  2683. console[console.info ? "info" : "log"](
  2684. `<Suspense> is an experimental feature and its API will likely change.`
  2685. );
  2686. }
  2687. const {
  2688. p: patch,
  2689. m: move,
  2690. um: unmount,
  2691. n: next,
  2692. o: { parentNode, remove }
  2693. } = rendererInternals;
  2694. let parentSuspenseId;
  2695. const isSuspensible = isVNodeSuspensible(vnode);
  2696. if (isSuspensible) {
  2697. if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
  2698. parentSuspenseId = parentSuspense.pendingId;
  2699. parentSuspense.deps++;
  2700. }
  2701. }
  2702. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  2703. {
  2704. assertNumber(timeout, `Suspense timeout`);
  2705. }
  2706. const suspense = {
  2707. vnode,
  2708. parent: parentSuspense,
  2709. parentComponent,
  2710. isSVG,
  2711. container,
  2712. hiddenContainer,
  2713. anchor,
  2714. deps: 0,
  2715. pendingId: 0,
  2716. timeout: typeof timeout === "number" ? timeout : -1,
  2717. activeBranch: null,
  2718. pendingBranch: null,
  2719. isInFallback: true,
  2720. isHydrating,
  2721. isUnmounted: false,
  2722. effects: [],
  2723. resolve(resume = false, sync = false) {
  2724. {
  2725. if (!resume && !suspense.pendingBranch) {
  2726. throw new Error(
  2727. `suspense.resolve() is called without a pending branch.`
  2728. );
  2729. }
  2730. if (suspense.isUnmounted) {
  2731. throw new Error(
  2732. `suspense.resolve() is called on an already unmounted suspense boundary.`
  2733. );
  2734. }
  2735. }
  2736. const {
  2737. vnode: vnode2,
  2738. activeBranch,
  2739. pendingBranch,
  2740. pendingId,
  2741. effects,
  2742. parentComponent: parentComponent2,
  2743. container: container2
  2744. } = suspense;
  2745. if (suspense.isHydrating) {
  2746. suspense.isHydrating = false;
  2747. } else if (!resume) {
  2748. const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  2749. if (delayEnter) {
  2750. activeBranch.transition.afterLeave = () => {
  2751. if (pendingId === suspense.pendingId) {
  2752. move(pendingBranch, container2, anchor2, 0);
  2753. }
  2754. };
  2755. }
  2756. let { anchor: anchor2 } = suspense;
  2757. if (activeBranch) {
  2758. anchor2 = next(activeBranch);
  2759. unmount(activeBranch, parentComponent2, suspense, true);
  2760. }
  2761. if (!delayEnter) {
  2762. move(pendingBranch, container2, anchor2, 0);
  2763. }
  2764. }
  2765. setActiveBranch(suspense, pendingBranch);
  2766. suspense.pendingBranch = null;
  2767. suspense.isInFallback = false;
  2768. let parent = suspense.parent;
  2769. let hasUnresolvedAncestor = false;
  2770. while (parent) {
  2771. if (parent.pendingBranch) {
  2772. parent.effects.push(...effects);
  2773. hasUnresolvedAncestor = true;
  2774. break;
  2775. }
  2776. parent = parent.parent;
  2777. }
  2778. if (!hasUnresolvedAncestor) {
  2779. queuePostFlushCb(effects);
  2780. }
  2781. suspense.effects = [];
  2782. if (isSuspensible) {
  2783. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  2784. parentSuspense.deps--;
  2785. if (parentSuspense.deps === 0 && !sync) {
  2786. parentSuspense.resolve();
  2787. }
  2788. }
  2789. }
  2790. triggerEvent(vnode2, "onResolve");
  2791. },
  2792. fallback(fallbackVNode) {
  2793. if (!suspense.pendingBranch) {
  2794. return;
  2795. }
  2796. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
  2797. triggerEvent(vnode2, "onFallback");
  2798. const anchor2 = next(activeBranch);
  2799. const mountFallback = () => {
  2800. if (!suspense.isInFallback) {
  2801. return;
  2802. }
  2803. patch(
  2804. null,
  2805. fallbackVNode,
  2806. container2,
  2807. anchor2,
  2808. parentComponent2,
  2809. null,
  2810. // fallback tree will not have suspense context
  2811. isSVG2,
  2812. slotScopeIds,
  2813. optimized
  2814. );
  2815. setActiveBranch(suspense, fallbackVNode);
  2816. };
  2817. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  2818. if (delayEnter) {
  2819. activeBranch.transition.afterLeave = mountFallback;
  2820. }
  2821. suspense.isInFallback = true;
  2822. unmount(
  2823. activeBranch,
  2824. parentComponent2,
  2825. null,
  2826. // no suspense so unmount hooks fire now
  2827. true
  2828. // shouldRemove
  2829. );
  2830. if (!delayEnter) {
  2831. mountFallback();
  2832. }
  2833. },
  2834. move(container2, anchor2, type) {
  2835. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  2836. suspense.container = container2;
  2837. },
  2838. next() {
  2839. return suspense.activeBranch && next(suspense.activeBranch);
  2840. },
  2841. registerDep(instance, setupRenderEffect) {
  2842. const isInPendingSuspense = !!suspense.pendingBranch;
  2843. if (isInPendingSuspense) {
  2844. suspense.deps++;
  2845. }
  2846. const hydratedEl = instance.vnode.el;
  2847. instance.asyncDep.catch((err) => {
  2848. handleError(err, instance, 0);
  2849. }).then((asyncSetupResult) => {
  2850. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  2851. return;
  2852. }
  2853. instance.asyncResolved = true;
  2854. const { vnode: vnode2 } = instance;
  2855. {
  2856. pushWarningContext(vnode2);
  2857. }
  2858. handleSetupResult(instance, asyncSetupResult, false);
  2859. if (hydratedEl) {
  2860. vnode2.el = hydratedEl;
  2861. }
  2862. const placeholder = !hydratedEl && instance.subTree.el;
  2863. setupRenderEffect(
  2864. instance,
  2865. vnode2,
  2866. // component may have been moved before resolve.
  2867. // if this is not a hydration, instance.subTree will be the comment
  2868. // placeholder.
  2869. parentNode(hydratedEl || instance.subTree.el),
  2870. // anchor will not be used if this is hydration, so only need to
  2871. // consider the comment placeholder case.
  2872. hydratedEl ? null : next(instance.subTree),
  2873. suspense,
  2874. isSVG,
  2875. optimized
  2876. );
  2877. if (placeholder) {
  2878. remove(placeholder);
  2879. }
  2880. updateHOCHostEl(instance, vnode2.el);
  2881. {
  2882. popWarningContext();
  2883. }
  2884. if (isInPendingSuspense && --suspense.deps === 0) {
  2885. suspense.resolve();
  2886. }
  2887. });
  2888. },
  2889. unmount(parentSuspense2, doRemove) {
  2890. suspense.isUnmounted = true;
  2891. if (suspense.activeBranch) {
  2892. unmount(
  2893. suspense.activeBranch,
  2894. parentComponent,
  2895. parentSuspense2,
  2896. doRemove
  2897. );
  2898. }
  2899. if (suspense.pendingBranch) {
  2900. unmount(
  2901. suspense.pendingBranch,
  2902. parentComponent,
  2903. parentSuspense2,
  2904. doRemove
  2905. );
  2906. }
  2907. }
  2908. };
  2909. return suspense;
  2910. }
  2911. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  2912. const suspense = vnode.suspense = createSuspenseBoundary(
  2913. vnode,
  2914. parentSuspense,
  2915. parentComponent,
  2916. node.parentNode,
  2917. document.createElement("div"),
  2918. null,
  2919. isSVG,
  2920. slotScopeIds,
  2921. optimized,
  2922. rendererInternals,
  2923. true
  2924. /* hydrating */
  2925. );
  2926. const result = hydrateNode(
  2927. node,
  2928. suspense.pendingBranch = vnode.ssContent,
  2929. parentComponent,
  2930. suspense,
  2931. slotScopeIds,
  2932. optimized
  2933. );
  2934. if (suspense.deps === 0) {
  2935. suspense.resolve(false, true);
  2936. }
  2937. return result;
  2938. }
  2939. function normalizeSuspenseChildren(vnode) {
  2940. const { shapeFlag, children } = vnode;
  2941. const isSlotChildren = shapeFlag & 32;
  2942. vnode.ssContent = normalizeSuspenseSlot(
  2943. isSlotChildren ? children.default : children
  2944. );
  2945. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  2946. }
  2947. function normalizeSuspenseSlot(s) {
  2948. let block;
  2949. if (isFunction(s)) {
  2950. const trackBlock = isBlockTreeEnabled && s._c;
  2951. if (trackBlock) {
  2952. s._d = false;
  2953. openBlock();
  2954. }
  2955. s = s();
  2956. if (trackBlock) {
  2957. s._d = true;
  2958. block = currentBlock;
  2959. closeBlock();
  2960. }
  2961. }
  2962. if (isArray(s)) {
  2963. const singleChild = filterSingleRoot(s);
  2964. if (!singleChild) {
  2965. warn(`<Suspense> slots expect a single root node.`);
  2966. }
  2967. s = singleChild;
  2968. }
  2969. s = normalizeVNode(s);
  2970. if (block && !s.dynamicChildren) {
  2971. s.dynamicChildren = block.filter((c) => c !== s);
  2972. }
  2973. return s;
  2974. }
  2975. function queueEffectWithSuspense(fn, suspense) {
  2976. if (suspense && suspense.pendingBranch) {
  2977. if (isArray(fn)) {
  2978. suspense.effects.push(...fn);
  2979. } else {
  2980. suspense.effects.push(fn);
  2981. }
  2982. } else {
  2983. queuePostFlushCb(fn);
  2984. }
  2985. }
  2986. function setActiveBranch(suspense, branch) {
  2987. suspense.activeBranch = branch;
  2988. const { vnode, parentComponent } = suspense;
  2989. const el = vnode.el = branch.el;
  2990. if (parentComponent && parentComponent.subTree === vnode) {
  2991. parentComponent.vnode.el = el;
  2992. updateHOCHostEl(parentComponent, el);
  2993. }
  2994. }
  2995. function isVNodeSuspensible(vnode) {
  2996. var _a;
  2997. return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
  2998. }
  2999. function watchEffect(effect, options) {
  3000. return doWatch(effect, null, options);
  3001. }
  3002. function watchPostEffect(effect, options) {
  3003. return doWatch(
  3004. effect,
  3005. null,
  3006. extend({}, options, { flush: "post" })
  3007. );
  3008. }
  3009. function watchSyncEffect(effect, options) {
  3010. return doWatch(
  3011. effect,
  3012. null,
  3013. extend({}, options, { flush: "sync" })
  3014. );
  3015. }
  3016. const INITIAL_WATCHER_VALUE = {};
  3017. function watch(source, cb, options) {
  3018. if (!isFunction(cb)) {
  3019. warn(
  3020. `\`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.`
  3021. );
  3022. }
  3023. return doWatch(source, cb, options);
  3024. }
  3025. function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
  3026. var _a;
  3027. if (!cb) {
  3028. if (immediate !== void 0) {
  3029. warn(
  3030. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  3031. );
  3032. }
  3033. if (deep !== void 0) {
  3034. warn(
  3035. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  3036. );
  3037. }
  3038. }
  3039. const warnInvalidSource = (s) => {
  3040. warn(
  3041. `Invalid watch source: `,
  3042. s,
  3043. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  3044. );
  3045. };
  3046. const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
  3047. let getter;
  3048. let forceTrigger = false;
  3049. let isMultiSource = false;
  3050. if (isRef(source)) {
  3051. getter = () => source.value;
  3052. forceTrigger = isShallow(source);
  3053. } else if (isReactive(source)) {
  3054. getter = () => source;
  3055. deep = true;
  3056. } else if (isArray(source)) {
  3057. isMultiSource = true;
  3058. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  3059. getter = () => source.map((s) => {
  3060. if (isRef(s)) {
  3061. return s.value;
  3062. } else if (isReactive(s)) {
  3063. return traverse(s);
  3064. } else if (isFunction(s)) {
  3065. return callWithErrorHandling(s, instance, 2);
  3066. } else {
  3067. warnInvalidSource(s);
  3068. }
  3069. });
  3070. } else if (isFunction(source)) {
  3071. if (cb) {
  3072. getter = () => callWithErrorHandling(source, instance, 2);
  3073. } else {
  3074. getter = () => {
  3075. if (instance && instance.isUnmounted) {
  3076. return;
  3077. }
  3078. if (cleanup) {
  3079. cleanup();
  3080. }
  3081. return callWithAsyncErrorHandling(
  3082. source,
  3083. instance,
  3084. 3,
  3085. [onCleanup]
  3086. );
  3087. };
  3088. }
  3089. } else {
  3090. getter = NOOP;
  3091. warnInvalidSource(source);
  3092. }
  3093. if (cb && deep) {
  3094. const baseGetter = getter;
  3095. getter = () => traverse(baseGetter());
  3096. }
  3097. let cleanup;
  3098. let onCleanup = (fn) => {
  3099. cleanup = effect.onStop = () => {
  3100. callWithErrorHandling(fn, instance, 4);
  3101. };
  3102. };
  3103. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  3104. const job = () => {
  3105. if (!effect.active) {
  3106. return;
  3107. }
  3108. if (cb) {
  3109. const newValue = effect.run();
  3110. if (deep || forceTrigger || (isMultiSource ? newValue.some(
  3111. (v, i) => hasChanged(v, oldValue[i])
  3112. ) : hasChanged(newValue, oldValue)) || false) {
  3113. if (cleanup) {
  3114. cleanup();
  3115. }
  3116. callWithAsyncErrorHandling(cb, instance, 3, [
  3117. newValue,
  3118. // pass undefined as the old value when it's changed for the first time
  3119. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  3120. onCleanup
  3121. ]);
  3122. oldValue = newValue;
  3123. }
  3124. } else {
  3125. effect.run();
  3126. }
  3127. };
  3128. job.allowRecurse = !!cb;
  3129. let scheduler;
  3130. if (flush === "sync") {
  3131. scheduler = job;
  3132. } else if (flush === "post") {
  3133. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  3134. } else {
  3135. job.pre = true;
  3136. if (instance)
  3137. job.id = instance.uid;
  3138. scheduler = () => queueJob(job);
  3139. }
  3140. const effect = new ReactiveEffect(getter, scheduler);
  3141. {
  3142. effect.onTrack = onTrack;
  3143. effect.onTrigger = onTrigger;
  3144. }
  3145. if (cb) {
  3146. if (immediate) {
  3147. job();
  3148. } else {
  3149. oldValue = effect.run();
  3150. }
  3151. } else if (flush === "post") {
  3152. queuePostRenderEffect(
  3153. effect.run.bind(effect),
  3154. instance && instance.suspense
  3155. );
  3156. } else {
  3157. effect.run();
  3158. }
  3159. const unwatch = () => {
  3160. effect.stop();
  3161. if (instance && instance.scope) {
  3162. remove(instance.scope.effects, effect);
  3163. }
  3164. };
  3165. return unwatch;
  3166. }
  3167. function instanceWatch(source, value, options) {
  3168. const publicThis = this.proxy;
  3169. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3170. let cb;
  3171. if (isFunction(value)) {
  3172. cb = value;
  3173. } else {
  3174. cb = value.handler;
  3175. options = value;
  3176. }
  3177. const cur = currentInstance;
  3178. setCurrentInstance(this);
  3179. const res = doWatch(getter, cb.bind(publicThis), options);
  3180. if (cur) {
  3181. setCurrentInstance(cur);
  3182. } else {
  3183. unsetCurrentInstance();
  3184. }
  3185. return res;
  3186. }
  3187. function createPathGetter(ctx, path) {
  3188. const segments = path.split(".");
  3189. return () => {
  3190. let cur = ctx;
  3191. for (let i = 0; i < segments.length && cur; i++) {
  3192. cur = cur[segments[i]];
  3193. }
  3194. return cur;
  3195. };
  3196. }
  3197. function traverse(value, seen) {
  3198. if (!isObject(value) || value["__v_skip"]) {
  3199. return value;
  3200. }
  3201. seen = seen || /* @__PURE__ */ new Set();
  3202. if (seen.has(value)) {
  3203. return value;
  3204. }
  3205. seen.add(value);
  3206. if (isRef(value)) {
  3207. traverse(value.value, seen);
  3208. } else if (isArray(value)) {
  3209. for (let i = 0; i < value.length; i++) {
  3210. traverse(value[i], seen);
  3211. }
  3212. } else if (isSet(value) || isMap(value)) {
  3213. value.forEach((v) => {
  3214. traverse(v, seen);
  3215. });
  3216. } else if (isPlainObject(value)) {
  3217. for (const key in value) {
  3218. traverse(value[key], seen);
  3219. }
  3220. }
  3221. return value;
  3222. }
  3223. function validateDirectiveName(name) {
  3224. if (isBuiltInDirective(name)) {
  3225. warn("Do not use built-in directive ids as custom directive id: " + name);
  3226. }
  3227. }
  3228. function withDirectives(vnode, directives) {
  3229. const internalInstance = currentRenderingInstance;
  3230. if (internalInstance === null) {
  3231. warn(`withDirectives can only be used inside render functions.`);
  3232. return vnode;
  3233. }
  3234. const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  3235. const bindings = vnode.dirs || (vnode.dirs = []);
  3236. for (let i = 0; i < directives.length; i++) {
  3237. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  3238. if (dir) {
  3239. if (isFunction(dir)) {
  3240. dir = {
  3241. mounted: dir,
  3242. updated: dir
  3243. };
  3244. }
  3245. if (dir.deep) {
  3246. traverse(value);
  3247. }
  3248. bindings.push({
  3249. dir,
  3250. instance,
  3251. value,
  3252. oldValue: void 0,
  3253. arg,
  3254. modifiers
  3255. });
  3256. }
  3257. }
  3258. return vnode;
  3259. }
  3260. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  3261. const bindings = vnode.dirs;
  3262. const oldBindings = prevVNode && prevVNode.dirs;
  3263. for (let i = 0; i < bindings.length; i++) {
  3264. const binding = bindings[i];
  3265. if (oldBindings) {
  3266. binding.oldValue = oldBindings[i].value;
  3267. }
  3268. let hook = binding.dir[name];
  3269. if (hook) {
  3270. pauseTracking();
  3271. callWithAsyncErrorHandling(hook, instance, 8, [
  3272. vnode.el,
  3273. binding,
  3274. vnode,
  3275. prevVNode
  3276. ]);
  3277. resetTracking();
  3278. }
  3279. }
  3280. }
  3281. function useTransitionState() {
  3282. const state = {
  3283. isMounted: false,
  3284. isLeaving: false,
  3285. isUnmounting: false,
  3286. leavingVNodes: /* @__PURE__ */ new Map()
  3287. };
  3288. onMounted(() => {
  3289. state.isMounted = true;
  3290. });
  3291. onBeforeUnmount(() => {
  3292. state.isUnmounting = true;
  3293. });
  3294. return state;
  3295. }
  3296. const TransitionHookValidator = [Function, Array];
  3297. const BaseTransitionPropsValidators = {
  3298. mode: String,
  3299. appear: Boolean,
  3300. persisted: Boolean,
  3301. // enter
  3302. onBeforeEnter: TransitionHookValidator,
  3303. onEnter: TransitionHookValidator,
  3304. onAfterEnter: TransitionHookValidator,
  3305. onEnterCancelled: TransitionHookValidator,
  3306. // leave
  3307. onBeforeLeave: TransitionHookValidator,
  3308. onLeave: TransitionHookValidator,
  3309. onAfterLeave: TransitionHookValidator,
  3310. onLeaveCancelled: TransitionHookValidator,
  3311. // appear
  3312. onBeforeAppear: TransitionHookValidator,
  3313. onAppear: TransitionHookValidator,
  3314. onAfterAppear: TransitionHookValidator,
  3315. onAppearCancelled: TransitionHookValidator
  3316. };
  3317. const BaseTransitionImpl = {
  3318. name: `BaseTransition`,
  3319. props: BaseTransitionPropsValidators,
  3320. setup(props, { slots }) {
  3321. const instance = getCurrentInstance();
  3322. const state = useTransitionState();
  3323. let prevTransitionKey;
  3324. return () => {
  3325. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3326. if (!children || !children.length) {
  3327. return;
  3328. }
  3329. let child = children[0];
  3330. if (children.length > 1) {
  3331. let hasFound = false;
  3332. for (const c of children) {
  3333. if (c.type !== Comment) {
  3334. if (hasFound) {
  3335. warn(
  3336. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3337. );
  3338. break;
  3339. }
  3340. child = c;
  3341. hasFound = true;
  3342. }
  3343. }
  3344. }
  3345. const rawProps = toRaw(props);
  3346. const { mode } = rawProps;
  3347. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3348. warn(`invalid <transition> mode: ${mode}`);
  3349. }
  3350. if (state.isLeaving) {
  3351. return emptyPlaceholder(child);
  3352. }
  3353. const innerChild = getKeepAliveChild(child);
  3354. if (!innerChild) {
  3355. return emptyPlaceholder(child);
  3356. }
  3357. const enterHooks = resolveTransitionHooks(
  3358. innerChild,
  3359. rawProps,
  3360. state,
  3361. instance
  3362. );
  3363. setTransitionHooks(innerChild, enterHooks);
  3364. const oldChild = instance.subTree;
  3365. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  3366. let transitionKeyChanged = false;
  3367. const { getTransitionKey } = innerChild.type;
  3368. if (getTransitionKey) {
  3369. const key = getTransitionKey();
  3370. if (prevTransitionKey === void 0) {
  3371. prevTransitionKey = key;
  3372. } else if (key !== prevTransitionKey) {
  3373. prevTransitionKey = key;
  3374. transitionKeyChanged = true;
  3375. }
  3376. }
  3377. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  3378. const leavingHooks = resolveTransitionHooks(
  3379. oldInnerChild,
  3380. rawProps,
  3381. state,
  3382. instance
  3383. );
  3384. setTransitionHooks(oldInnerChild, leavingHooks);
  3385. if (mode === "out-in") {
  3386. state.isLeaving = true;
  3387. leavingHooks.afterLeave = () => {
  3388. state.isLeaving = false;
  3389. if (instance.update.active !== false) {
  3390. instance.update();
  3391. }
  3392. };
  3393. return emptyPlaceholder(child);
  3394. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3395. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3396. const leavingVNodesCache = getLeavingNodesForType(
  3397. state,
  3398. oldInnerChild
  3399. );
  3400. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3401. el._leaveCb = () => {
  3402. earlyRemove();
  3403. el._leaveCb = void 0;
  3404. delete enterHooks.delayedLeave;
  3405. };
  3406. enterHooks.delayedLeave = delayedLeave;
  3407. };
  3408. }
  3409. }
  3410. return child;
  3411. };
  3412. }
  3413. };
  3414. const BaseTransition = BaseTransitionImpl;
  3415. function getLeavingNodesForType(state, vnode) {
  3416. const { leavingVNodes } = state;
  3417. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3418. if (!leavingVNodesCache) {
  3419. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3420. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3421. }
  3422. return leavingVNodesCache;
  3423. }
  3424. function resolveTransitionHooks(vnode, props, state, instance) {
  3425. const {
  3426. appear,
  3427. mode,
  3428. persisted = false,
  3429. onBeforeEnter,
  3430. onEnter,
  3431. onAfterEnter,
  3432. onEnterCancelled,
  3433. onBeforeLeave,
  3434. onLeave,
  3435. onAfterLeave,
  3436. onLeaveCancelled,
  3437. onBeforeAppear,
  3438. onAppear,
  3439. onAfterAppear,
  3440. onAppearCancelled
  3441. } = props;
  3442. const key = String(vnode.key);
  3443. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3444. const callHook = (hook, args) => {
  3445. hook && callWithAsyncErrorHandling(
  3446. hook,
  3447. instance,
  3448. 9,
  3449. args
  3450. );
  3451. };
  3452. const callAsyncHook = (hook, args) => {
  3453. const done = args[1];
  3454. callHook(hook, args);
  3455. if (isArray(hook)) {
  3456. if (hook.every((hook2) => hook2.length <= 1))
  3457. done();
  3458. } else if (hook.length <= 1) {
  3459. done();
  3460. }
  3461. };
  3462. const hooks = {
  3463. mode,
  3464. persisted,
  3465. beforeEnter(el) {
  3466. let hook = onBeforeEnter;
  3467. if (!state.isMounted) {
  3468. if (appear) {
  3469. hook = onBeforeAppear || onBeforeEnter;
  3470. } else {
  3471. return;
  3472. }
  3473. }
  3474. if (el._leaveCb) {
  3475. el._leaveCb(
  3476. true
  3477. /* cancelled */
  3478. );
  3479. }
  3480. const leavingVNode = leavingVNodesCache[key];
  3481. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {
  3482. leavingVNode.el._leaveCb();
  3483. }
  3484. callHook(hook, [el]);
  3485. },
  3486. enter(el) {
  3487. let hook = onEnter;
  3488. let afterHook = onAfterEnter;
  3489. let cancelHook = onEnterCancelled;
  3490. if (!state.isMounted) {
  3491. if (appear) {
  3492. hook = onAppear || onEnter;
  3493. afterHook = onAfterAppear || onAfterEnter;
  3494. cancelHook = onAppearCancelled || onEnterCancelled;
  3495. } else {
  3496. return;
  3497. }
  3498. }
  3499. let called = false;
  3500. const done = el._enterCb = (cancelled) => {
  3501. if (called)
  3502. return;
  3503. called = true;
  3504. if (cancelled) {
  3505. callHook(cancelHook, [el]);
  3506. } else {
  3507. callHook(afterHook, [el]);
  3508. }
  3509. if (hooks.delayedLeave) {
  3510. hooks.delayedLeave();
  3511. }
  3512. el._enterCb = void 0;
  3513. };
  3514. if (hook) {
  3515. callAsyncHook(hook, [el, done]);
  3516. } else {
  3517. done();
  3518. }
  3519. },
  3520. leave(el, remove) {
  3521. const key2 = String(vnode.key);
  3522. if (el._enterCb) {
  3523. el._enterCb(
  3524. true
  3525. /* cancelled */
  3526. );
  3527. }
  3528. if (state.isUnmounting) {
  3529. return remove();
  3530. }
  3531. callHook(onBeforeLeave, [el]);
  3532. let called = false;
  3533. const done = el._leaveCb = (cancelled) => {
  3534. if (called)
  3535. return;
  3536. called = true;
  3537. remove();
  3538. if (cancelled) {
  3539. callHook(onLeaveCancelled, [el]);
  3540. } else {
  3541. callHook(onAfterLeave, [el]);
  3542. }
  3543. el._leaveCb = void 0;
  3544. if (leavingVNodesCache[key2] === vnode) {
  3545. delete leavingVNodesCache[key2];
  3546. }
  3547. };
  3548. leavingVNodesCache[key2] = vnode;
  3549. if (onLeave) {
  3550. callAsyncHook(onLeave, [el, done]);
  3551. } else {
  3552. done();
  3553. }
  3554. },
  3555. clone(vnode2) {
  3556. return resolveTransitionHooks(vnode2, props, state, instance);
  3557. }
  3558. };
  3559. return hooks;
  3560. }
  3561. function emptyPlaceholder(vnode) {
  3562. if (isKeepAlive(vnode)) {
  3563. vnode = cloneVNode(vnode);
  3564. vnode.children = null;
  3565. return vnode;
  3566. }
  3567. }
  3568. function getKeepAliveChild(vnode) {
  3569. return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
  3570. }
  3571. function setTransitionHooks(vnode, hooks) {
  3572. if (vnode.shapeFlag & 6 && vnode.component) {
  3573. setTransitionHooks(vnode.component.subTree, hooks);
  3574. } else if (vnode.shapeFlag & 128) {
  3575. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3576. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3577. } else {
  3578. vnode.transition = hooks;
  3579. }
  3580. }
  3581. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3582. let ret = [];
  3583. let keyedFragmentCount = 0;
  3584. for (let i = 0; i < children.length; i++) {
  3585. let child = children[i];
  3586. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3587. if (child.type === Fragment) {
  3588. if (child.patchFlag & 128)
  3589. keyedFragmentCount++;
  3590. ret = ret.concat(
  3591. getTransitionRawChildren(child.children, keepComment, key)
  3592. );
  3593. } else if (keepComment || child.type !== Comment) {
  3594. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3595. }
  3596. }
  3597. if (keyedFragmentCount > 1) {
  3598. for (let i = 0; i < ret.length; i++) {
  3599. ret[i].patchFlag = -2;
  3600. }
  3601. }
  3602. return ret;
  3603. }
  3604. function defineComponent(options, extraOptions) {
  3605. return isFunction(options) ? (
  3606. // #8326: extend call and options.name access are considered side-effects
  3607. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3608. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3609. ) : options;
  3610. }
  3611. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  3612. function defineAsyncComponent(source) {
  3613. if (isFunction(source)) {
  3614. source = { loader: source };
  3615. }
  3616. const {
  3617. loader,
  3618. loadingComponent,
  3619. errorComponent,
  3620. delay = 200,
  3621. timeout,
  3622. // undefined = never times out
  3623. suspensible = true,
  3624. onError: userOnError
  3625. } = source;
  3626. let pendingRequest = null;
  3627. let resolvedComp;
  3628. let retries = 0;
  3629. const retry = () => {
  3630. retries++;
  3631. pendingRequest = null;
  3632. return load();
  3633. };
  3634. const load = () => {
  3635. let thisRequest;
  3636. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  3637. err = err instanceof Error ? err : new Error(String(err));
  3638. if (userOnError) {
  3639. return new Promise((resolve, reject) => {
  3640. const userRetry = () => resolve(retry());
  3641. const userFail = () => reject(err);
  3642. userOnError(err, userRetry, userFail, retries + 1);
  3643. });
  3644. } else {
  3645. throw err;
  3646. }
  3647. }).then((comp) => {
  3648. if (thisRequest !== pendingRequest && pendingRequest) {
  3649. return pendingRequest;
  3650. }
  3651. if (!comp) {
  3652. warn(
  3653. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  3654. );
  3655. }
  3656. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  3657. comp = comp.default;
  3658. }
  3659. if (comp && !isObject(comp) && !isFunction(comp)) {
  3660. throw new Error(`Invalid async component load result: ${comp}`);
  3661. }
  3662. resolvedComp = comp;
  3663. return comp;
  3664. }));
  3665. };
  3666. return defineComponent({
  3667. name: "AsyncComponentWrapper",
  3668. __asyncLoader: load,
  3669. get __asyncResolved() {
  3670. return resolvedComp;
  3671. },
  3672. setup() {
  3673. const instance = currentInstance;
  3674. if (resolvedComp) {
  3675. return () => createInnerComp(resolvedComp, instance);
  3676. }
  3677. const onError = (err) => {
  3678. pendingRequest = null;
  3679. handleError(
  3680. err,
  3681. instance,
  3682. 13,
  3683. !errorComponent
  3684. /* do not throw in dev if user provided error component */
  3685. );
  3686. };
  3687. if (suspensible && instance.suspense || false) {
  3688. return load().then((comp) => {
  3689. return () => createInnerComp(comp, instance);
  3690. }).catch((err) => {
  3691. onError(err);
  3692. return () => errorComponent ? createVNode(errorComponent, {
  3693. error: err
  3694. }) : null;
  3695. });
  3696. }
  3697. const loaded = ref(false);
  3698. const error = ref();
  3699. const delayed = ref(!!delay);
  3700. if (delay) {
  3701. setTimeout(() => {
  3702. delayed.value = false;
  3703. }, delay);
  3704. }
  3705. if (timeout != null) {
  3706. setTimeout(() => {
  3707. if (!loaded.value && !error.value) {
  3708. const err = new Error(
  3709. `Async component timed out after ${timeout}ms.`
  3710. );
  3711. onError(err);
  3712. error.value = err;
  3713. }
  3714. }, timeout);
  3715. }
  3716. load().then(() => {
  3717. loaded.value = true;
  3718. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  3719. queueJob(instance.parent.update);
  3720. }
  3721. }).catch((err) => {
  3722. onError(err);
  3723. error.value = err;
  3724. });
  3725. return () => {
  3726. if (loaded.value && resolvedComp) {
  3727. return createInnerComp(resolvedComp, instance);
  3728. } else if (error.value && errorComponent) {
  3729. return createVNode(errorComponent, {
  3730. error: error.value
  3731. });
  3732. } else if (loadingComponent && !delayed.value) {
  3733. return createVNode(loadingComponent);
  3734. }
  3735. };
  3736. }
  3737. });
  3738. }
  3739. function createInnerComp(comp, parent) {
  3740. const { ref: ref2, props, children, ce } = parent.vnode;
  3741. const vnode = createVNode(comp, props, children);
  3742. vnode.ref = ref2;
  3743. vnode.ce = ce;
  3744. delete parent.vnode.ce;
  3745. return vnode;
  3746. }
  3747. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  3748. const KeepAliveImpl = {
  3749. name: `KeepAlive`,
  3750. // Marker for special handling inside the renderer. We are not using a ===
  3751. // check directly on KeepAlive in the renderer, because importing it directly
  3752. // would prevent it from being tree-shaken.
  3753. __isKeepAlive: true,
  3754. props: {
  3755. include: [String, RegExp, Array],
  3756. exclude: [String, RegExp, Array],
  3757. max: [String, Number]
  3758. },
  3759. setup(props, { slots }) {
  3760. const instance = getCurrentInstance();
  3761. const sharedContext = instance.ctx;
  3762. const cache = /* @__PURE__ */ new Map();
  3763. const keys = /* @__PURE__ */ new Set();
  3764. let current = null;
  3765. {
  3766. instance.__v_cache = cache;
  3767. }
  3768. const parentSuspense = instance.suspense;
  3769. const {
  3770. renderer: {
  3771. p: patch,
  3772. m: move,
  3773. um: _unmount,
  3774. o: { createElement }
  3775. }
  3776. } = sharedContext;
  3777. const storageContainer = createElement("div");
  3778. sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
  3779. const instance2 = vnode.component;
  3780. move(vnode, container, anchor, 0, parentSuspense);
  3781. patch(
  3782. instance2.vnode,
  3783. vnode,
  3784. container,
  3785. anchor,
  3786. instance2,
  3787. parentSuspense,
  3788. isSVG,
  3789. vnode.slotScopeIds,
  3790. optimized
  3791. );
  3792. queuePostRenderEffect(() => {
  3793. instance2.isDeactivated = false;
  3794. if (instance2.a) {
  3795. invokeArrayFns(instance2.a);
  3796. }
  3797. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  3798. if (vnodeHook) {
  3799. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  3800. }
  3801. }, parentSuspense);
  3802. {
  3803. devtoolsComponentAdded(instance2);
  3804. }
  3805. };
  3806. sharedContext.deactivate = (vnode) => {
  3807. const instance2 = vnode.component;
  3808. move(vnode, storageContainer, null, 1, parentSuspense);
  3809. queuePostRenderEffect(() => {
  3810. if (instance2.da) {
  3811. invokeArrayFns(instance2.da);
  3812. }
  3813. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  3814. if (vnodeHook) {
  3815. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  3816. }
  3817. instance2.isDeactivated = true;
  3818. }, parentSuspense);
  3819. {
  3820. devtoolsComponentAdded(instance2);
  3821. }
  3822. };
  3823. function unmount(vnode) {
  3824. resetShapeFlag(vnode);
  3825. _unmount(vnode, instance, parentSuspense, true);
  3826. }
  3827. function pruneCache(filter) {
  3828. cache.forEach((vnode, key) => {
  3829. const name = getComponentName(vnode.type);
  3830. if (name && (!filter || !filter(name))) {
  3831. pruneCacheEntry(key);
  3832. }
  3833. });
  3834. }
  3835. function pruneCacheEntry(key) {
  3836. const cached = cache.get(key);
  3837. if (!current || !isSameVNodeType(cached, current)) {
  3838. unmount(cached);
  3839. } else if (current) {
  3840. resetShapeFlag(current);
  3841. }
  3842. cache.delete(key);
  3843. keys.delete(key);
  3844. }
  3845. watch(
  3846. () => [props.include, props.exclude],
  3847. ([include, exclude]) => {
  3848. include && pruneCache((name) => matches(include, name));
  3849. exclude && pruneCache((name) => !matches(exclude, name));
  3850. },
  3851. // prune post-render after `current` has been updated
  3852. { flush: "post", deep: true }
  3853. );
  3854. let pendingCacheKey = null;
  3855. const cacheSubtree = () => {
  3856. if (pendingCacheKey != null) {
  3857. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  3858. }
  3859. };
  3860. onMounted(cacheSubtree);
  3861. onUpdated(cacheSubtree);
  3862. onBeforeUnmount(() => {
  3863. cache.forEach((cached) => {
  3864. const { subTree, suspense } = instance;
  3865. const vnode = getInnerChild(subTree);
  3866. if (cached.type === vnode.type && cached.key === vnode.key) {
  3867. resetShapeFlag(vnode);
  3868. const da = vnode.component.da;
  3869. da && queuePostRenderEffect(da, suspense);
  3870. return;
  3871. }
  3872. unmount(cached);
  3873. });
  3874. });
  3875. return () => {
  3876. pendingCacheKey = null;
  3877. if (!slots.default) {
  3878. return null;
  3879. }
  3880. const children = slots.default();
  3881. const rawVNode = children[0];
  3882. if (children.length > 1) {
  3883. {
  3884. warn(`KeepAlive should contain exactly one component child.`);
  3885. }
  3886. current = null;
  3887. return children;
  3888. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  3889. current = null;
  3890. return rawVNode;
  3891. }
  3892. let vnode = getInnerChild(rawVNode);
  3893. const comp = vnode.type;
  3894. const name = getComponentName(
  3895. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  3896. );
  3897. const { include, exclude, max } = props;
  3898. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  3899. current = vnode;
  3900. return rawVNode;
  3901. }
  3902. const key = vnode.key == null ? comp : vnode.key;
  3903. const cachedVNode = cache.get(key);
  3904. if (vnode.el) {
  3905. vnode = cloneVNode(vnode);
  3906. if (rawVNode.shapeFlag & 128) {
  3907. rawVNode.ssContent = vnode;
  3908. }
  3909. }
  3910. pendingCacheKey = key;
  3911. if (cachedVNode) {
  3912. vnode.el = cachedVNode.el;
  3913. vnode.component = cachedVNode.component;
  3914. if (vnode.transition) {
  3915. setTransitionHooks(vnode, vnode.transition);
  3916. }
  3917. vnode.shapeFlag |= 512;
  3918. keys.delete(key);
  3919. keys.add(key);
  3920. } else {
  3921. keys.add(key);
  3922. if (max && keys.size > parseInt(max, 10)) {
  3923. pruneCacheEntry(keys.values().next().value);
  3924. }
  3925. }
  3926. vnode.shapeFlag |= 256;
  3927. current = vnode;
  3928. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  3929. };
  3930. }
  3931. };
  3932. const KeepAlive = KeepAliveImpl;
  3933. function matches(pattern, name) {
  3934. if (isArray(pattern)) {
  3935. return pattern.some((p) => matches(p, name));
  3936. } else if (isString(pattern)) {
  3937. return pattern.split(",").includes(name);
  3938. } else if (isRegExp(pattern)) {
  3939. return pattern.test(name);
  3940. }
  3941. return false;
  3942. }
  3943. function onActivated(hook, target) {
  3944. registerKeepAliveHook(hook, "a", target);
  3945. }
  3946. function onDeactivated(hook, target) {
  3947. registerKeepAliveHook(hook, "da", target);
  3948. }
  3949. function registerKeepAliveHook(hook, type, target = currentInstance) {
  3950. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  3951. let current = target;
  3952. while (current) {
  3953. if (current.isDeactivated) {
  3954. return;
  3955. }
  3956. current = current.parent;
  3957. }
  3958. return hook();
  3959. });
  3960. injectHook(type, wrappedHook, target);
  3961. if (target) {
  3962. let current = target.parent;
  3963. while (current && current.parent) {
  3964. if (isKeepAlive(current.parent.vnode)) {
  3965. injectToKeepAliveRoot(wrappedHook, type, target, current);
  3966. }
  3967. current = current.parent;
  3968. }
  3969. }
  3970. }
  3971. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  3972. const injected = injectHook(
  3973. type,
  3974. hook,
  3975. keepAliveRoot,
  3976. true
  3977. /* prepend */
  3978. );
  3979. onUnmounted(() => {
  3980. remove(keepAliveRoot[type], injected);
  3981. }, target);
  3982. }
  3983. function resetShapeFlag(vnode) {
  3984. vnode.shapeFlag &= ~256;
  3985. vnode.shapeFlag &= ~512;
  3986. }
  3987. function getInnerChild(vnode) {
  3988. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  3989. }
  3990. function injectHook(type, hook, target = currentInstance, prepend = false) {
  3991. if (target) {
  3992. const hooks = target[type] || (target[type] = []);
  3993. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  3994. if (target.isUnmounted) {
  3995. return;
  3996. }
  3997. pauseTracking();
  3998. setCurrentInstance(target);
  3999. const res = callWithAsyncErrorHandling(hook, target, type, args);
  4000. unsetCurrentInstance();
  4001. resetTracking();
  4002. return res;
  4003. });
  4004. if (prepend) {
  4005. hooks.unshift(wrappedHook);
  4006. } else {
  4007. hooks.push(wrappedHook);
  4008. }
  4009. return wrappedHook;
  4010. } else {
  4011. const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
  4012. warn(
  4013. `${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.` )
  4014. );
  4015. }
  4016. }
  4017. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  4018. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  4019. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  4020. );
  4021. const onBeforeMount = createHook("bm");
  4022. const onMounted = createHook("m");
  4023. const onBeforeUpdate = createHook("bu");
  4024. const onUpdated = createHook("u");
  4025. const onBeforeUnmount = createHook("bum");
  4026. const onUnmounted = createHook("um");
  4027. const onServerPrefetch = createHook("sp");
  4028. const onRenderTriggered = createHook(
  4029. "rtg"
  4030. );
  4031. const onRenderTracked = createHook(
  4032. "rtc"
  4033. );
  4034. function onErrorCaptured(hook, target = currentInstance) {
  4035. injectHook("ec", hook, target);
  4036. }
  4037. const COMPONENTS = "components";
  4038. const DIRECTIVES = "directives";
  4039. function resolveComponent(name, maybeSelfReference) {
  4040. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  4041. }
  4042. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  4043. function resolveDynamicComponent(component) {
  4044. if (isString(component)) {
  4045. return resolveAsset(COMPONENTS, component, false) || component;
  4046. } else {
  4047. return component || NULL_DYNAMIC_COMPONENT;
  4048. }
  4049. }
  4050. function resolveDirective(name) {
  4051. return resolveAsset(DIRECTIVES, name);
  4052. }
  4053. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  4054. const instance = currentRenderingInstance || currentInstance;
  4055. if (instance) {
  4056. const Component = instance.type;
  4057. if (type === COMPONENTS) {
  4058. const selfName = getComponentName(
  4059. Component,
  4060. false
  4061. /* do not include inferred name to avoid breaking existing code */
  4062. );
  4063. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  4064. return Component;
  4065. }
  4066. }
  4067. const res = (
  4068. // local registration
  4069. // check instance[type] first which is resolved for options API
  4070. resolve(instance[type] || Component[type], name) || // global registration
  4071. resolve(instance.appContext[type], name)
  4072. );
  4073. if (!res && maybeSelfReference) {
  4074. return Component;
  4075. }
  4076. if (warnMissing && !res) {
  4077. const extra = type === COMPONENTS ? `
  4078. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  4079. warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  4080. }
  4081. return res;
  4082. } else {
  4083. warn(
  4084. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  4085. );
  4086. }
  4087. }
  4088. function resolve(registry, name) {
  4089. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  4090. }
  4091. function renderList(source, renderItem, cache, index) {
  4092. let ret;
  4093. const cached = cache && cache[index];
  4094. if (isArray(source) || isString(source)) {
  4095. ret = new Array(source.length);
  4096. for (let i = 0, l = source.length; i < l; i++) {
  4097. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  4098. }
  4099. } else if (typeof source === "number") {
  4100. if (!Number.isInteger(source)) {
  4101. warn(`The v-for range expect an integer value but got ${source}.`);
  4102. }
  4103. ret = new Array(source);
  4104. for (let i = 0; i < source; i++) {
  4105. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  4106. }
  4107. } else if (isObject(source)) {
  4108. if (source[Symbol.iterator]) {
  4109. ret = Array.from(
  4110. source,
  4111. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  4112. );
  4113. } else {
  4114. const keys = Object.keys(source);
  4115. ret = new Array(keys.length);
  4116. for (let i = 0, l = keys.length; i < l; i++) {
  4117. const key = keys[i];
  4118. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  4119. }
  4120. }
  4121. } else {
  4122. ret = [];
  4123. }
  4124. if (cache) {
  4125. cache[index] = ret;
  4126. }
  4127. return ret;
  4128. }
  4129. function createSlots(slots, dynamicSlots) {
  4130. for (let i = 0; i < dynamicSlots.length; i++) {
  4131. const slot = dynamicSlots[i];
  4132. if (isArray(slot)) {
  4133. for (let j = 0; j < slot.length; j++) {
  4134. slots[slot[j].name] = slot[j].fn;
  4135. }
  4136. } else if (slot) {
  4137. slots[slot.name] = slot.key ? (...args) => {
  4138. const res = slot.fn(...args);
  4139. if (res)
  4140. res.key = slot.key;
  4141. return res;
  4142. } : slot.fn;
  4143. }
  4144. }
  4145. return slots;
  4146. }
  4147. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  4148. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  4149. if (name !== "default")
  4150. props.name = name;
  4151. return createVNode("slot", props, fallback && fallback());
  4152. }
  4153. let slot = slots[name];
  4154. if (slot && slot.length > 1) {
  4155. warn(
  4156. `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.`
  4157. );
  4158. slot = () => [];
  4159. }
  4160. if (slot && slot._c) {
  4161. slot._d = false;
  4162. }
  4163. openBlock();
  4164. const validSlotContent = slot && ensureValidVNode(slot(props));
  4165. const rendered = createBlock(
  4166. Fragment,
  4167. {
  4168. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  4169. // key attached in the `createSlots` helper, respect that
  4170. validSlotContent && validSlotContent.key || `_${name}`
  4171. },
  4172. validSlotContent || (fallback ? fallback() : []),
  4173. validSlotContent && slots._ === 1 ? 64 : -2
  4174. );
  4175. if (!noSlotted && rendered.scopeId) {
  4176. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  4177. }
  4178. if (slot && slot._c) {
  4179. slot._d = true;
  4180. }
  4181. return rendered;
  4182. }
  4183. function ensureValidVNode(vnodes) {
  4184. return vnodes.some((child) => {
  4185. if (!isVNode(child))
  4186. return true;
  4187. if (child.type === Comment)
  4188. return false;
  4189. if (child.type === Fragment && !ensureValidVNode(child.children))
  4190. return false;
  4191. return true;
  4192. }) ? vnodes : null;
  4193. }
  4194. function toHandlers(obj, preserveCaseIfNecessary) {
  4195. const ret = {};
  4196. if (!isObject(obj)) {
  4197. warn(`v-on with no argument expects an object value.`);
  4198. return ret;
  4199. }
  4200. for (const key in obj) {
  4201. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  4202. }
  4203. return ret;
  4204. }
  4205. const getPublicInstance = (i) => {
  4206. if (!i)
  4207. return null;
  4208. if (isStatefulComponent(i))
  4209. return getExposeProxy(i) || i.proxy;
  4210. return getPublicInstance(i.parent);
  4211. };
  4212. const publicPropertiesMap = (
  4213. // Move PURE marker to new line to workaround compiler discarding it
  4214. // due to type annotation
  4215. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  4216. $: (i) => i,
  4217. $el: (i) => i.vnode.el,
  4218. $data: (i) => i.data,
  4219. $props: (i) => shallowReadonly(i.props) ,
  4220. $attrs: (i) => shallowReadonly(i.attrs) ,
  4221. $slots: (i) => shallowReadonly(i.slots) ,
  4222. $refs: (i) => shallowReadonly(i.refs) ,
  4223. $parent: (i) => getPublicInstance(i.parent),
  4224. $root: (i) => getPublicInstance(i.root),
  4225. $emit: (i) => i.emit,
  4226. $options: (i) => resolveMergedOptions(i) ,
  4227. $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
  4228. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  4229. $watch: (i) => instanceWatch.bind(i)
  4230. })
  4231. );
  4232. const isReservedPrefix = (key) => key === "_" || key === "$";
  4233. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  4234. const PublicInstanceProxyHandlers = {
  4235. get({ _: instance }, key) {
  4236. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  4237. if (key === "__isVue") {
  4238. return true;
  4239. }
  4240. let normalizedProps;
  4241. if (key[0] !== "$") {
  4242. const n = accessCache[key];
  4243. if (n !== void 0) {
  4244. switch (n) {
  4245. case 1 /* SETUP */:
  4246. return setupState[key];
  4247. case 2 /* DATA */:
  4248. return data[key];
  4249. case 4 /* CONTEXT */:
  4250. return ctx[key];
  4251. case 3 /* PROPS */:
  4252. return props[key];
  4253. }
  4254. } else if (hasSetupBinding(setupState, key)) {
  4255. accessCache[key] = 1 /* SETUP */;
  4256. return setupState[key];
  4257. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4258. accessCache[key] = 2 /* DATA */;
  4259. return data[key];
  4260. } else if (
  4261. // only cache other properties when instance has declared (thus stable)
  4262. // props
  4263. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  4264. ) {
  4265. accessCache[key] = 3 /* PROPS */;
  4266. return props[key];
  4267. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4268. accessCache[key] = 4 /* CONTEXT */;
  4269. return ctx[key];
  4270. } else if (shouldCacheAccess) {
  4271. accessCache[key] = 0 /* OTHER */;
  4272. }
  4273. }
  4274. const publicGetter = publicPropertiesMap[key];
  4275. let cssModule, globalProperties;
  4276. if (publicGetter) {
  4277. if (key === "$attrs") {
  4278. track(instance, "get", key);
  4279. markAttrsAccessed();
  4280. } else if (key === "$slots") {
  4281. track(instance, "get", key);
  4282. }
  4283. return publicGetter(instance);
  4284. } else if (
  4285. // css module (injected by vue-loader)
  4286. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  4287. ) {
  4288. return cssModule;
  4289. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4290. accessCache[key] = 4 /* CONTEXT */;
  4291. return ctx[key];
  4292. } else if (
  4293. // global properties
  4294. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  4295. ) {
  4296. {
  4297. return globalProperties[key];
  4298. }
  4299. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  4300. // to infinite warning loop
  4301. key.indexOf("__v") !== 0)) {
  4302. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  4303. warn(
  4304. `Property ${JSON.stringify(
  4305. key
  4306. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  4307. );
  4308. } else if (instance === currentRenderingInstance) {
  4309. warn(
  4310. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  4311. );
  4312. }
  4313. }
  4314. },
  4315. set({ _: instance }, key, value) {
  4316. const { data, setupState, ctx } = instance;
  4317. if (hasSetupBinding(setupState, key)) {
  4318. setupState[key] = value;
  4319. return true;
  4320. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  4321. warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  4322. return false;
  4323. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4324. data[key] = value;
  4325. return true;
  4326. } else if (hasOwn(instance.props, key)) {
  4327. warn(`Attempting to mutate prop "${key}". Props are readonly.`);
  4328. return false;
  4329. }
  4330. if (key[0] === "$" && key.slice(1) in instance) {
  4331. warn(
  4332. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  4333. );
  4334. return false;
  4335. } else {
  4336. if (key in instance.appContext.config.globalProperties) {
  4337. Object.defineProperty(ctx, key, {
  4338. enumerable: true,
  4339. configurable: true,
  4340. value
  4341. });
  4342. } else {
  4343. ctx[key] = value;
  4344. }
  4345. }
  4346. return true;
  4347. },
  4348. has({
  4349. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  4350. }, key) {
  4351. let normalizedProps;
  4352. 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);
  4353. },
  4354. defineProperty(target, key, descriptor) {
  4355. if (descriptor.get != null) {
  4356. target._.accessCache[key] = 0;
  4357. } else if (hasOwn(descriptor, "value")) {
  4358. this.set(target, key, descriptor.value, null);
  4359. }
  4360. return Reflect.defineProperty(target, key, descriptor);
  4361. }
  4362. };
  4363. {
  4364. PublicInstanceProxyHandlers.ownKeys = (target) => {
  4365. warn(
  4366. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  4367. );
  4368. return Reflect.ownKeys(target);
  4369. };
  4370. }
  4371. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  4372. {},
  4373. PublicInstanceProxyHandlers,
  4374. {
  4375. get(target, key) {
  4376. if (key === Symbol.unscopables) {
  4377. return;
  4378. }
  4379. return PublicInstanceProxyHandlers.get(target, key, target);
  4380. },
  4381. has(_, key) {
  4382. const has = key[0] !== "_" && !isGloballyWhitelisted(key);
  4383. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  4384. warn(
  4385. `Property ${JSON.stringify(
  4386. key
  4387. )} should not start with _ which is a reserved prefix for Vue internals.`
  4388. );
  4389. }
  4390. return has;
  4391. }
  4392. }
  4393. );
  4394. function createDevRenderContext(instance) {
  4395. const target = {};
  4396. Object.defineProperty(target, `_`, {
  4397. configurable: true,
  4398. enumerable: false,
  4399. get: () => instance
  4400. });
  4401. Object.keys(publicPropertiesMap).forEach((key) => {
  4402. Object.defineProperty(target, key, {
  4403. configurable: true,
  4404. enumerable: false,
  4405. get: () => publicPropertiesMap[key](instance),
  4406. // intercepted by the proxy so no need for implementation,
  4407. // but needed to prevent set errors
  4408. set: NOOP
  4409. });
  4410. });
  4411. return target;
  4412. }
  4413. function exposePropsOnRenderContext(instance) {
  4414. const {
  4415. ctx,
  4416. propsOptions: [propsOptions]
  4417. } = instance;
  4418. if (propsOptions) {
  4419. Object.keys(propsOptions).forEach((key) => {
  4420. Object.defineProperty(ctx, key, {
  4421. enumerable: true,
  4422. configurable: true,
  4423. get: () => instance.props[key],
  4424. set: NOOP
  4425. });
  4426. });
  4427. }
  4428. }
  4429. function exposeSetupStateOnRenderContext(instance) {
  4430. const { ctx, setupState } = instance;
  4431. Object.keys(toRaw(setupState)).forEach((key) => {
  4432. if (!setupState.__isScriptSetup) {
  4433. if (isReservedPrefix(key[0])) {
  4434. warn(
  4435. `setup() return property ${JSON.stringify(
  4436. key
  4437. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  4438. );
  4439. return;
  4440. }
  4441. Object.defineProperty(ctx, key, {
  4442. enumerable: true,
  4443. configurable: true,
  4444. get: () => setupState[key],
  4445. set: NOOP
  4446. });
  4447. }
  4448. });
  4449. }
  4450. const warnRuntimeUsage = (method) => warn(
  4451. `${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.`
  4452. );
  4453. function defineProps() {
  4454. {
  4455. warnRuntimeUsage(`defineProps`);
  4456. }
  4457. return null;
  4458. }
  4459. function defineEmits() {
  4460. {
  4461. warnRuntimeUsage(`defineEmits`);
  4462. }
  4463. return null;
  4464. }
  4465. function defineExpose(exposed) {
  4466. {
  4467. warnRuntimeUsage(`defineExpose`);
  4468. }
  4469. }
  4470. function defineOptions(options) {
  4471. {
  4472. warnRuntimeUsage(`defineOptions`);
  4473. }
  4474. }
  4475. function defineSlots() {
  4476. {
  4477. warnRuntimeUsage(`defineSlots`);
  4478. }
  4479. return null;
  4480. }
  4481. function defineModel() {
  4482. {
  4483. warnRuntimeUsage("defineModel");
  4484. }
  4485. }
  4486. function withDefaults(props, defaults) {
  4487. {
  4488. warnRuntimeUsage(`withDefaults`);
  4489. }
  4490. return null;
  4491. }
  4492. function useSlots() {
  4493. return getContext().slots;
  4494. }
  4495. function useAttrs() {
  4496. return getContext().attrs;
  4497. }
  4498. function useModel(props, name, options) {
  4499. const i = getCurrentInstance();
  4500. if (!i) {
  4501. warn(`useModel() called without active instance.`);
  4502. return ref();
  4503. }
  4504. if (!i.propsOptions[0][name]) {
  4505. warn(`useModel() called with prop "${name}" which is not declared.`);
  4506. return ref();
  4507. }
  4508. if (options && options.local) {
  4509. const proxy = ref(props[name]);
  4510. watch(
  4511. () => props[name],
  4512. (v) => proxy.value = v
  4513. );
  4514. watch(proxy, (value) => {
  4515. if (value !== props[name]) {
  4516. i.emit(`update:${name}`, value);
  4517. }
  4518. });
  4519. return proxy;
  4520. } else {
  4521. return {
  4522. __v_isRef: true,
  4523. get value() {
  4524. return props[name];
  4525. },
  4526. set value(value) {
  4527. i.emit(`update:${name}`, value);
  4528. }
  4529. };
  4530. }
  4531. }
  4532. function getContext() {
  4533. const i = getCurrentInstance();
  4534. if (!i) {
  4535. warn(`useContext() called without active instance.`);
  4536. }
  4537. return i.setupContext || (i.setupContext = createSetupContext(i));
  4538. }
  4539. function normalizePropsOrEmits(props) {
  4540. return isArray(props) ? props.reduce(
  4541. (normalized, p) => (normalized[p] = null, normalized),
  4542. {}
  4543. ) : props;
  4544. }
  4545. function mergeDefaults(raw, defaults) {
  4546. const props = normalizePropsOrEmits(raw);
  4547. for (const key in defaults) {
  4548. if (key.startsWith("__skip"))
  4549. continue;
  4550. let opt = props[key];
  4551. if (opt) {
  4552. if (isArray(opt) || isFunction(opt)) {
  4553. opt = props[key] = { type: opt, default: defaults[key] };
  4554. } else {
  4555. opt.default = defaults[key];
  4556. }
  4557. } else if (opt === null) {
  4558. opt = props[key] = { default: defaults[key] };
  4559. } else {
  4560. warn(`props default key "${key}" has no corresponding declaration.`);
  4561. }
  4562. if (opt && defaults[`__skip_${key}`]) {
  4563. opt.skipFactory = true;
  4564. }
  4565. }
  4566. return props;
  4567. }
  4568. function mergeModels(a, b) {
  4569. if (!a || !b)
  4570. return a || b;
  4571. if (isArray(a) && isArray(b))
  4572. return a.concat(b);
  4573. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  4574. }
  4575. function createPropsRestProxy(props, excludedKeys) {
  4576. const ret = {};
  4577. for (const key in props) {
  4578. if (!excludedKeys.includes(key)) {
  4579. Object.defineProperty(ret, key, {
  4580. enumerable: true,
  4581. get: () => props[key]
  4582. });
  4583. }
  4584. }
  4585. return ret;
  4586. }
  4587. function withAsyncContext(getAwaitable) {
  4588. const ctx = getCurrentInstance();
  4589. if (!ctx) {
  4590. warn(
  4591. `withAsyncContext called without active current instance. This is likely a bug.`
  4592. );
  4593. }
  4594. let awaitable = getAwaitable();
  4595. unsetCurrentInstance();
  4596. if (isPromise(awaitable)) {
  4597. awaitable = awaitable.catch((e) => {
  4598. setCurrentInstance(ctx);
  4599. throw e;
  4600. });
  4601. }
  4602. return [awaitable, () => setCurrentInstance(ctx)];
  4603. }
  4604. function createDuplicateChecker() {
  4605. const cache = /* @__PURE__ */ Object.create(null);
  4606. return (type, key) => {
  4607. if (cache[key]) {
  4608. warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
  4609. } else {
  4610. cache[key] = type;
  4611. }
  4612. };
  4613. }
  4614. let shouldCacheAccess = true;
  4615. function applyOptions(instance) {
  4616. const options = resolveMergedOptions(instance);
  4617. const publicThis = instance.proxy;
  4618. const ctx = instance.ctx;
  4619. shouldCacheAccess = false;
  4620. if (options.beforeCreate) {
  4621. callHook$1(options.beforeCreate, instance, "bc");
  4622. }
  4623. const {
  4624. // state
  4625. data: dataOptions,
  4626. computed: computedOptions,
  4627. methods,
  4628. watch: watchOptions,
  4629. provide: provideOptions,
  4630. inject: injectOptions,
  4631. // lifecycle
  4632. created,
  4633. beforeMount,
  4634. mounted,
  4635. beforeUpdate,
  4636. updated,
  4637. activated,
  4638. deactivated,
  4639. beforeDestroy,
  4640. beforeUnmount,
  4641. destroyed,
  4642. unmounted,
  4643. render,
  4644. renderTracked,
  4645. renderTriggered,
  4646. errorCaptured,
  4647. serverPrefetch,
  4648. // public API
  4649. expose,
  4650. inheritAttrs,
  4651. // assets
  4652. components,
  4653. directives,
  4654. filters
  4655. } = options;
  4656. const checkDuplicateProperties = createDuplicateChecker() ;
  4657. {
  4658. const [propsOptions] = instance.propsOptions;
  4659. if (propsOptions) {
  4660. for (const key in propsOptions) {
  4661. checkDuplicateProperties("Props" /* PROPS */, key);
  4662. }
  4663. }
  4664. }
  4665. if (injectOptions) {
  4666. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  4667. }
  4668. if (methods) {
  4669. for (const key in methods) {
  4670. const methodHandler = methods[key];
  4671. if (isFunction(methodHandler)) {
  4672. {
  4673. Object.defineProperty(ctx, key, {
  4674. value: methodHandler.bind(publicThis),
  4675. configurable: true,
  4676. enumerable: true,
  4677. writable: true
  4678. });
  4679. }
  4680. {
  4681. checkDuplicateProperties("Methods" /* METHODS */, key);
  4682. }
  4683. } else {
  4684. warn(
  4685. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  4686. );
  4687. }
  4688. }
  4689. }
  4690. if (dataOptions) {
  4691. if (!isFunction(dataOptions)) {
  4692. warn(
  4693. `The data option must be a function. Plain object usage is no longer supported.`
  4694. );
  4695. }
  4696. const data = dataOptions.call(publicThis, publicThis);
  4697. if (isPromise(data)) {
  4698. warn(
  4699. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  4700. );
  4701. }
  4702. if (!isObject(data)) {
  4703. warn(`data() should return an object.`);
  4704. } else {
  4705. instance.data = reactive(data);
  4706. {
  4707. for (const key in data) {
  4708. checkDuplicateProperties("Data" /* DATA */, key);
  4709. if (!isReservedPrefix(key[0])) {
  4710. Object.defineProperty(ctx, key, {
  4711. configurable: true,
  4712. enumerable: true,
  4713. get: () => data[key],
  4714. set: NOOP
  4715. });
  4716. }
  4717. }
  4718. }
  4719. }
  4720. }
  4721. shouldCacheAccess = true;
  4722. if (computedOptions) {
  4723. for (const key in computedOptions) {
  4724. const opt = computedOptions[key];
  4725. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  4726. if (get === NOOP) {
  4727. warn(`Computed property "${key}" has no getter.`);
  4728. }
  4729. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  4730. warn(
  4731. `Write operation failed: computed property "${key}" is readonly.`
  4732. );
  4733. } ;
  4734. const c = computed({
  4735. get,
  4736. set
  4737. });
  4738. Object.defineProperty(ctx, key, {
  4739. enumerable: true,
  4740. configurable: true,
  4741. get: () => c.value,
  4742. set: (v) => c.value = v
  4743. });
  4744. {
  4745. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  4746. }
  4747. }
  4748. }
  4749. if (watchOptions) {
  4750. for (const key in watchOptions) {
  4751. createWatcher(watchOptions[key], ctx, publicThis, key);
  4752. }
  4753. }
  4754. if (provideOptions) {
  4755. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  4756. Reflect.ownKeys(provides).forEach((key) => {
  4757. provide(key, provides[key]);
  4758. });
  4759. }
  4760. if (created) {
  4761. callHook$1(created, instance, "c");
  4762. }
  4763. function registerLifecycleHook(register, hook) {
  4764. if (isArray(hook)) {
  4765. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  4766. } else if (hook) {
  4767. register(hook.bind(publicThis));
  4768. }
  4769. }
  4770. registerLifecycleHook(onBeforeMount, beforeMount);
  4771. registerLifecycleHook(onMounted, mounted);
  4772. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  4773. registerLifecycleHook(onUpdated, updated);
  4774. registerLifecycleHook(onActivated, activated);
  4775. registerLifecycleHook(onDeactivated, deactivated);
  4776. registerLifecycleHook(onErrorCaptured, errorCaptured);
  4777. registerLifecycleHook(onRenderTracked, renderTracked);
  4778. registerLifecycleHook(onRenderTriggered, renderTriggered);
  4779. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  4780. registerLifecycleHook(onUnmounted, unmounted);
  4781. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  4782. if (isArray(expose)) {
  4783. if (expose.length) {
  4784. const exposed = instance.exposed || (instance.exposed = {});
  4785. expose.forEach((key) => {
  4786. Object.defineProperty(exposed, key, {
  4787. get: () => publicThis[key],
  4788. set: (val) => publicThis[key] = val
  4789. });
  4790. });
  4791. } else if (!instance.exposed) {
  4792. instance.exposed = {};
  4793. }
  4794. }
  4795. if (render && instance.render === NOOP) {
  4796. instance.render = render;
  4797. }
  4798. if (inheritAttrs != null) {
  4799. instance.inheritAttrs = inheritAttrs;
  4800. }
  4801. if (components)
  4802. instance.components = components;
  4803. if (directives)
  4804. instance.directives = directives;
  4805. }
  4806. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  4807. if (isArray(injectOptions)) {
  4808. injectOptions = normalizeInject(injectOptions);
  4809. }
  4810. for (const key in injectOptions) {
  4811. const opt = injectOptions[key];
  4812. let injected;
  4813. if (isObject(opt)) {
  4814. if ("default" in opt) {
  4815. injected = inject(
  4816. opt.from || key,
  4817. opt.default,
  4818. true
  4819. /* treat default function as factory */
  4820. );
  4821. } else {
  4822. injected = inject(opt.from || key);
  4823. }
  4824. } else {
  4825. injected = inject(opt);
  4826. }
  4827. if (isRef(injected)) {
  4828. Object.defineProperty(ctx, key, {
  4829. enumerable: true,
  4830. configurable: true,
  4831. get: () => injected.value,
  4832. set: (v) => injected.value = v
  4833. });
  4834. } else {
  4835. ctx[key] = injected;
  4836. }
  4837. {
  4838. checkDuplicateProperties("Inject" /* INJECT */, key);
  4839. }
  4840. }
  4841. }
  4842. function callHook$1(hook, instance, type) {
  4843. callWithAsyncErrorHandling(
  4844. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  4845. instance,
  4846. type
  4847. );
  4848. }
  4849. function createWatcher(raw, ctx, publicThis, key) {
  4850. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  4851. if (isString(raw)) {
  4852. const handler = ctx[raw];
  4853. if (isFunction(handler)) {
  4854. watch(getter, handler);
  4855. } else {
  4856. warn(`Invalid watch handler specified by key "${raw}"`, handler);
  4857. }
  4858. } else if (isFunction(raw)) {
  4859. watch(getter, raw.bind(publicThis));
  4860. } else if (isObject(raw)) {
  4861. if (isArray(raw)) {
  4862. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  4863. } else {
  4864. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  4865. if (isFunction(handler)) {
  4866. watch(getter, handler, raw);
  4867. } else {
  4868. warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  4869. }
  4870. }
  4871. } else {
  4872. warn(`Invalid watch option: "${key}"`, raw);
  4873. }
  4874. }
  4875. function resolveMergedOptions(instance) {
  4876. const base = instance.type;
  4877. const { mixins, extends: extendsOptions } = base;
  4878. const {
  4879. mixins: globalMixins,
  4880. optionsCache: cache,
  4881. config: { optionMergeStrategies }
  4882. } = instance.appContext;
  4883. const cached = cache.get(base);
  4884. let resolved;
  4885. if (cached) {
  4886. resolved = cached;
  4887. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  4888. {
  4889. resolved = base;
  4890. }
  4891. } else {
  4892. resolved = {};
  4893. if (globalMixins.length) {
  4894. globalMixins.forEach(
  4895. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  4896. );
  4897. }
  4898. mergeOptions(resolved, base, optionMergeStrategies);
  4899. }
  4900. if (isObject(base)) {
  4901. cache.set(base, resolved);
  4902. }
  4903. return resolved;
  4904. }
  4905. function mergeOptions(to, from, strats, asMixin = false) {
  4906. const { mixins, extends: extendsOptions } = from;
  4907. if (extendsOptions) {
  4908. mergeOptions(to, extendsOptions, strats, true);
  4909. }
  4910. if (mixins) {
  4911. mixins.forEach(
  4912. (m) => mergeOptions(to, m, strats, true)
  4913. );
  4914. }
  4915. for (const key in from) {
  4916. if (asMixin && key === "expose") {
  4917. warn(
  4918. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  4919. );
  4920. } else {
  4921. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  4922. to[key] = strat ? strat(to[key], from[key]) : from[key];
  4923. }
  4924. }
  4925. return to;
  4926. }
  4927. const internalOptionMergeStrats = {
  4928. data: mergeDataFn,
  4929. props: mergeEmitsOrPropsOptions,
  4930. emits: mergeEmitsOrPropsOptions,
  4931. // objects
  4932. methods: mergeObjectOptions,
  4933. computed: mergeObjectOptions,
  4934. // lifecycle
  4935. beforeCreate: mergeAsArray,
  4936. created: mergeAsArray,
  4937. beforeMount: mergeAsArray,
  4938. mounted: mergeAsArray,
  4939. beforeUpdate: mergeAsArray,
  4940. updated: mergeAsArray,
  4941. beforeDestroy: mergeAsArray,
  4942. beforeUnmount: mergeAsArray,
  4943. destroyed: mergeAsArray,
  4944. unmounted: mergeAsArray,
  4945. activated: mergeAsArray,
  4946. deactivated: mergeAsArray,
  4947. errorCaptured: mergeAsArray,
  4948. serverPrefetch: mergeAsArray,
  4949. // assets
  4950. components: mergeObjectOptions,
  4951. directives: mergeObjectOptions,
  4952. // watch
  4953. watch: mergeWatchOptions,
  4954. // provide / inject
  4955. provide: mergeDataFn,
  4956. inject: mergeInject
  4957. };
  4958. function mergeDataFn(to, from) {
  4959. if (!from) {
  4960. return to;
  4961. }
  4962. if (!to) {
  4963. return from;
  4964. }
  4965. return function mergedDataFn() {
  4966. return (extend)(
  4967. isFunction(to) ? to.call(this, this) : to,
  4968. isFunction(from) ? from.call(this, this) : from
  4969. );
  4970. };
  4971. }
  4972. function mergeInject(to, from) {
  4973. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  4974. }
  4975. function normalizeInject(raw) {
  4976. if (isArray(raw)) {
  4977. const res = {};
  4978. for (let i = 0; i < raw.length; i++) {
  4979. res[raw[i]] = raw[i];
  4980. }
  4981. return res;
  4982. }
  4983. return raw;
  4984. }
  4985. function mergeAsArray(to, from) {
  4986. return to ? [...new Set([].concat(to, from))] : from;
  4987. }
  4988. function mergeObjectOptions(to, from) {
  4989. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  4990. }
  4991. function mergeEmitsOrPropsOptions(to, from) {
  4992. if (to) {
  4993. if (isArray(to) && isArray(from)) {
  4994. return [.../* @__PURE__ */ new Set([...to, ...from])];
  4995. }
  4996. return extend(
  4997. /* @__PURE__ */ Object.create(null),
  4998. normalizePropsOrEmits(to),
  4999. normalizePropsOrEmits(from != null ? from : {})
  5000. );
  5001. } else {
  5002. return from;
  5003. }
  5004. }
  5005. function mergeWatchOptions(to, from) {
  5006. if (!to)
  5007. return from;
  5008. if (!from)
  5009. return to;
  5010. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5011. for (const key in from) {
  5012. merged[key] = mergeAsArray(to[key], from[key]);
  5013. }
  5014. return merged;
  5015. }
  5016. function createAppContext() {
  5017. return {
  5018. app: null,
  5019. config: {
  5020. isNativeTag: NO,
  5021. performance: false,
  5022. globalProperties: {},
  5023. optionMergeStrategies: {},
  5024. errorHandler: void 0,
  5025. warnHandler: void 0,
  5026. compilerOptions: {}
  5027. },
  5028. mixins: [],
  5029. components: {},
  5030. directives: {},
  5031. provides: /* @__PURE__ */ Object.create(null),
  5032. optionsCache: /* @__PURE__ */ new WeakMap(),
  5033. propsCache: /* @__PURE__ */ new WeakMap(),
  5034. emitsCache: /* @__PURE__ */ new WeakMap()
  5035. };
  5036. }
  5037. let uid$1 = 0;
  5038. function createAppAPI(render, hydrate) {
  5039. return function createApp(rootComponent, rootProps = null) {
  5040. if (!isFunction(rootComponent)) {
  5041. rootComponent = extend({}, rootComponent);
  5042. }
  5043. if (rootProps != null && !isObject(rootProps)) {
  5044. warn(`root props passed to app.mount() must be an object.`);
  5045. rootProps = null;
  5046. }
  5047. const context = createAppContext();
  5048. {
  5049. Object.defineProperty(context.config, "unwrapInjectedRef", {
  5050. get() {
  5051. return true;
  5052. },
  5053. set() {
  5054. warn(
  5055. `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
  5056. );
  5057. }
  5058. });
  5059. }
  5060. const installedPlugins = /* @__PURE__ */ new Set();
  5061. let isMounted = false;
  5062. const app = context.app = {
  5063. _uid: uid$1++,
  5064. _component: rootComponent,
  5065. _props: rootProps,
  5066. _container: null,
  5067. _context: context,
  5068. _instance: null,
  5069. version,
  5070. get config() {
  5071. return context.config;
  5072. },
  5073. set config(v) {
  5074. {
  5075. warn(
  5076. `app.config cannot be replaced. Modify individual options instead.`
  5077. );
  5078. }
  5079. },
  5080. use(plugin, ...options) {
  5081. if (installedPlugins.has(plugin)) {
  5082. warn(`Plugin has already been applied to target app.`);
  5083. } else if (plugin && isFunction(plugin.install)) {
  5084. installedPlugins.add(plugin);
  5085. plugin.install(app, ...options);
  5086. } else if (isFunction(plugin)) {
  5087. installedPlugins.add(plugin);
  5088. plugin(app, ...options);
  5089. } else {
  5090. warn(
  5091. `A plugin must either be a function or an object with an "install" function.`
  5092. );
  5093. }
  5094. return app;
  5095. },
  5096. mixin(mixin) {
  5097. {
  5098. if (!context.mixins.includes(mixin)) {
  5099. context.mixins.push(mixin);
  5100. } else {
  5101. warn(
  5102. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  5103. );
  5104. }
  5105. }
  5106. return app;
  5107. },
  5108. component(name, component) {
  5109. {
  5110. validateComponentName(name, context.config);
  5111. }
  5112. if (!component) {
  5113. return context.components[name];
  5114. }
  5115. if (context.components[name]) {
  5116. warn(`Component "${name}" has already been registered in target app.`);
  5117. }
  5118. context.components[name] = component;
  5119. return app;
  5120. },
  5121. directive(name, directive) {
  5122. {
  5123. validateDirectiveName(name);
  5124. }
  5125. if (!directive) {
  5126. return context.directives[name];
  5127. }
  5128. if (context.directives[name]) {
  5129. warn(`Directive "${name}" has already been registered in target app.`);
  5130. }
  5131. context.directives[name] = directive;
  5132. return app;
  5133. },
  5134. mount(rootContainer, isHydrate, isSVG) {
  5135. if (!isMounted) {
  5136. if (rootContainer.__vue_app__) {
  5137. warn(
  5138. `There is already an app instance mounted on the host container.
  5139. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  5140. );
  5141. }
  5142. const vnode = createVNode(
  5143. rootComponent,
  5144. rootProps
  5145. );
  5146. vnode.appContext = context;
  5147. {
  5148. context.reload = () => {
  5149. render(cloneVNode(vnode), rootContainer, isSVG);
  5150. };
  5151. }
  5152. if (isHydrate && hydrate) {
  5153. hydrate(vnode, rootContainer);
  5154. } else {
  5155. render(vnode, rootContainer, isSVG);
  5156. }
  5157. isMounted = true;
  5158. app._container = rootContainer;
  5159. rootContainer.__vue_app__ = app;
  5160. {
  5161. app._instance = vnode.component;
  5162. devtoolsInitApp(app, version);
  5163. }
  5164. return getExposeProxy(vnode.component) || vnode.component.proxy;
  5165. } else {
  5166. warn(
  5167. `App has already been mounted.
  5168. 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)\``
  5169. );
  5170. }
  5171. },
  5172. unmount() {
  5173. if (isMounted) {
  5174. render(null, app._container);
  5175. {
  5176. app._instance = null;
  5177. devtoolsUnmountApp(app);
  5178. }
  5179. delete app._container.__vue_app__;
  5180. } else {
  5181. warn(`Cannot unmount an app that is not mounted.`);
  5182. }
  5183. },
  5184. provide(key, value) {
  5185. if (key in context.provides) {
  5186. warn(
  5187. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  5188. );
  5189. }
  5190. context.provides[key] = value;
  5191. return app;
  5192. },
  5193. runWithContext(fn) {
  5194. currentApp = app;
  5195. try {
  5196. return fn();
  5197. } finally {
  5198. currentApp = null;
  5199. }
  5200. }
  5201. };
  5202. return app;
  5203. };
  5204. }
  5205. let currentApp = null;
  5206. function provide(key, value) {
  5207. if (!currentInstance) {
  5208. {
  5209. warn(`provide() can only be used inside setup().`);
  5210. }
  5211. } else {
  5212. let provides = currentInstance.provides;
  5213. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  5214. if (parentProvides === provides) {
  5215. provides = currentInstance.provides = Object.create(parentProvides);
  5216. }
  5217. provides[key] = value;
  5218. }
  5219. }
  5220. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  5221. const instance = currentInstance || currentRenderingInstance;
  5222. if (instance || currentApp) {
  5223. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  5224. if (provides && key in provides) {
  5225. return provides[key];
  5226. } else if (arguments.length > 1) {
  5227. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  5228. } else {
  5229. warn(`injection "${String(key)}" not found.`);
  5230. }
  5231. } else {
  5232. warn(`inject() can only be used inside setup() or functional components.`);
  5233. }
  5234. }
  5235. function hasInjectionContext() {
  5236. return !!(currentInstance || currentRenderingInstance || currentApp);
  5237. }
  5238. function initProps(instance, rawProps, isStateful, isSSR = false) {
  5239. const props = {};
  5240. const attrs = {};
  5241. def(attrs, InternalObjectKey, 1);
  5242. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  5243. setFullProps(instance, rawProps, props, attrs);
  5244. for (const key in instance.propsOptions[0]) {
  5245. if (!(key in props)) {
  5246. props[key] = void 0;
  5247. }
  5248. }
  5249. {
  5250. validateProps(rawProps || {}, props, instance);
  5251. }
  5252. if (isStateful) {
  5253. instance.props = isSSR ? props : shallowReactive(props);
  5254. } else {
  5255. if (!instance.type.props) {
  5256. instance.props = attrs;
  5257. } else {
  5258. instance.props = props;
  5259. }
  5260. }
  5261. instance.attrs = attrs;
  5262. }
  5263. function isInHmrContext(instance) {
  5264. while (instance) {
  5265. if (instance.type.__hmrId)
  5266. return true;
  5267. instance = instance.parent;
  5268. }
  5269. }
  5270. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  5271. const {
  5272. props,
  5273. attrs,
  5274. vnode: { patchFlag }
  5275. } = instance;
  5276. const rawCurrentProps = toRaw(props);
  5277. const [options] = instance.propsOptions;
  5278. let hasAttrsChanged = false;
  5279. if (
  5280. // always force full diff in dev
  5281. // - #1942 if hmr is enabled with sfc component
  5282. // - vite#872 non-sfc component used by sfc component
  5283. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  5284. ) {
  5285. if (patchFlag & 8) {
  5286. const propsToUpdate = instance.vnode.dynamicProps;
  5287. for (let i = 0; i < propsToUpdate.length; i++) {
  5288. let key = propsToUpdate[i];
  5289. if (isEmitListener(instance.emitsOptions, key)) {
  5290. continue;
  5291. }
  5292. const value = rawProps[key];
  5293. if (options) {
  5294. if (hasOwn(attrs, key)) {
  5295. if (value !== attrs[key]) {
  5296. attrs[key] = value;
  5297. hasAttrsChanged = true;
  5298. }
  5299. } else {
  5300. const camelizedKey = camelize(key);
  5301. props[camelizedKey] = resolvePropValue(
  5302. options,
  5303. rawCurrentProps,
  5304. camelizedKey,
  5305. value,
  5306. instance,
  5307. false
  5308. /* isAbsent */
  5309. );
  5310. }
  5311. } else {
  5312. if (value !== attrs[key]) {
  5313. attrs[key] = value;
  5314. hasAttrsChanged = true;
  5315. }
  5316. }
  5317. }
  5318. }
  5319. } else {
  5320. if (setFullProps(instance, rawProps, props, attrs)) {
  5321. hasAttrsChanged = true;
  5322. }
  5323. let kebabKey;
  5324. for (const key in rawCurrentProps) {
  5325. if (!rawProps || // for camelCase
  5326. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  5327. // and converted to camelCase (#955)
  5328. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  5329. if (options) {
  5330. if (rawPrevProps && // for camelCase
  5331. (rawPrevProps[key] !== void 0 || // for kebab-case
  5332. rawPrevProps[kebabKey] !== void 0)) {
  5333. props[key] = resolvePropValue(
  5334. options,
  5335. rawCurrentProps,
  5336. key,
  5337. void 0,
  5338. instance,
  5339. true
  5340. /* isAbsent */
  5341. );
  5342. }
  5343. } else {
  5344. delete props[key];
  5345. }
  5346. }
  5347. }
  5348. if (attrs !== rawCurrentProps) {
  5349. for (const key in attrs) {
  5350. if (!rawProps || !hasOwn(rawProps, key) && true) {
  5351. delete attrs[key];
  5352. hasAttrsChanged = true;
  5353. }
  5354. }
  5355. }
  5356. }
  5357. if (hasAttrsChanged) {
  5358. trigger(instance, "set", "$attrs");
  5359. }
  5360. {
  5361. validateProps(rawProps || {}, props, instance);
  5362. }
  5363. }
  5364. function setFullProps(instance, rawProps, props, attrs) {
  5365. const [options, needCastKeys] = instance.propsOptions;
  5366. let hasAttrsChanged = false;
  5367. let rawCastValues;
  5368. if (rawProps) {
  5369. for (let key in rawProps) {
  5370. if (isReservedProp(key)) {
  5371. continue;
  5372. }
  5373. const value = rawProps[key];
  5374. let camelKey;
  5375. if (options && hasOwn(options, camelKey = camelize(key))) {
  5376. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  5377. props[camelKey] = value;
  5378. } else {
  5379. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  5380. }
  5381. } else if (!isEmitListener(instance.emitsOptions, key)) {
  5382. if (!(key in attrs) || value !== attrs[key]) {
  5383. attrs[key] = value;
  5384. hasAttrsChanged = true;
  5385. }
  5386. }
  5387. }
  5388. }
  5389. if (needCastKeys) {
  5390. const rawCurrentProps = toRaw(props);
  5391. const castValues = rawCastValues || EMPTY_OBJ;
  5392. for (let i = 0; i < needCastKeys.length; i++) {
  5393. const key = needCastKeys[i];
  5394. props[key] = resolvePropValue(
  5395. options,
  5396. rawCurrentProps,
  5397. key,
  5398. castValues[key],
  5399. instance,
  5400. !hasOwn(castValues, key)
  5401. );
  5402. }
  5403. }
  5404. return hasAttrsChanged;
  5405. }
  5406. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  5407. const opt = options[key];
  5408. if (opt != null) {
  5409. const hasDefault = hasOwn(opt, "default");
  5410. if (hasDefault && value === void 0) {
  5411. const defaultValue = opt.default;
  5412. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  5413. const { propsDefaults } = instance;
  5414. if (key in propsDefaults) {
  5415. value = propsDefaults[key];
  5416. } else {
  5417. setCurrentInstance(instance);
  5418. value = propsDefaults[key] = defaultValue.call(
  5419. null,
  5420. props
  5421. );
  5422. unsetCurrentInstance();
  5423. }
  5424. } else {
  5425. value = defaultValue;
  5426. }
  5427. }
  5428. if (opt[0 /* shouldCast */]) {
  5429. if (isAbsent && !hasDefault) {
  5430. value = false;
  5431. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  5432. value = true;
  5433. }
  5434. }
  5435. }
  5436. return value;
  5437. }
  5438. function normalizePropsOptions(comp, appContext, asMixin = false) {
  5439. const cache = appContext.propsCache;
  5440. const cached = cache.get(comp);
  5441. if (cached) {
  5442. return cached;
  5443. }
  5444. const raw = comp.props;
  5445. const normalized = {};
  5446. const needCastKeys = [];
  5447. let hasExtends = false;
  5448. if (!isFunction(comp)) {
  5449. const extendProps = (raw2) => {
  5450. hasExtends = true;
  5451. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  5452. extend(normalized, props);
  5453. if (keys)
  5454. needCastKeys.push(...keys);
  5455. };
  5456. if (!asMixin && appContext.mixins.length) {
  5457. appContext.mixins.forEach(extendProps);
  5458. }
  5459. if (comp.extends) {
  5460. extendProps(comp.extends);
  5461. }
  5462. if (comp.mixins) {
  5463. comp.mixins.forEach(extendProps);
  5464. }
  5465. }
  5466. if (!raw && !hasExtends) {
  5467. if (isObject(comp)) {
  5468. cache.set(comp, EMPTY_ARR);
  5469. }
  5470. return EMPTY_ARR;
  5471. }
  5472. if (isArray(raw)) {
  5473. for (let i = 0; i < raw.length; i++) {
  5474. if (!isString(raw[i])) {
  5475. warn(`props must be strings when using array syntax.`, raw[i]);
  5476. }
  5477. const normalizedKey = camelize(raw[i]);
  5478. if (validatePropName(normalizedKey)) {
  5479. normalized[normalizedKey] = EMPTY_OBJ;
  5480. }
  5481. }
  5482. } else if (raw) {
  5483. if (!isObject(raw)) {
  5484. warn(`invalid props options`, raw);
  5485. }
  5486. for (const key in raw) {
  5487. const normalizedKey = camelize(key);
  5488. if (validatePropName(normalizedKey)) {
  5489. const opt = raw[key];
  5490. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  5491. if (prop) {
  5492. const booleanIndex = getTypeIndex(Boolean, prop.type);
  5493. const stringIndex = getTypeIndex(String, prop.type);
  5494. prop[0 /* shouldCast */] = booleanIndex > -1;
  5495. prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  5496. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  5497. needCastKeys.push(normalizedKey);
  5498. }
  5499. }
  5500. }
  5501. }
  5502. }
  5503. const res = [normalized, needCastKeys];
  5504. if (isObject(comp)) {
  5505. cache.set(comp, res);
  5506. }
  5507. return res;
  5508. }
  5509. function validatePropName(key) {
  5510. if (key[0] !== "$") {
  5511. return true;
  5512. } else {
  5513. warn(`Invalid prop name: "${key}" is a reserved property.`);
  5514. }
  5515. return false;
  5516. }
  5517. function getType(ctor) {
  5518. const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  5519. return match ? match[2] : ctor === null ? "null" : "";
  5520. }
  5521. function isSameType(a, b) {
  5522. return getType(a) === getType(b);
  5523. }
  5524. function getTypeIndex(type, expectedTypes) {
  5525. if (isArray(expectedTypes)) {
  5526. return expectedTypes.findIndex((t) => isSameType(t, type));
  5527. } else if (isFunction(expectedTypes)) {
  5528. return isSameType(expectedTypes, type) ? 0 : -1;
  5529. }
  5530. return -1;
  5531. }
  5532. function validateProps(rawProps, props, instance) {
  5533. const resolvedValues = toRaw(props);
  5534. const options = instance.propsOptions[0];
  5535. for (const key in options) {
  5536. let opt = options[key];
  5537. if (opt == null)
  5538. continue;
  5539. validateProp(
  5540. key,
  5541. resolvedValues[key],
  5542. opt,
  5543. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  5544. );
  5545. }
  5546. }
  5547. function validateProp(name, value, prop, isAbsent) {
  5548. const { type, required, validator, skipCheck } = prop;
  5549. if (required && isAbsent) {
  5550. warn('Missing required prop: "' + name + '"');
  5551. return;
  5552. }
  5553. if (value == null && !required) {
  5554. return;
  5555. }
  5556. if (type != null && type !== true && !skipCheck) {
  5557. let isValid = false;
  5558. const types = isArray(type) ? type : [type];
  5559. const expectedTypes = [];
  5560. for (let i = 0; i < types.length && !isValid; i++) {
  5561. const { valid, expectedType } = assertType(value, types[i]);
  5562. expectedTypes.push(expectedType || "");
  5563. isValid = valid;
  5564. }
  5565. if (!isValid) {
  5566. warn(getInvalidTypeMessage(name, value, expectedTypes));
  5567. return;
  5568. }
  5569. }
  5570. if (validator && !validator(value)) {
  5571. warn('Invalid prop: custom validator check failed for prop "' + name + '".');
  5572. }
  5573. }
  5574. const isSimpleType = /* @__PURE__ */ makeMap(
  5575. "String,Number,Boolean,Function,Symbol,BigInt"
  5576. );
  5577. function assertType(value, type) {
  5578. let valid;
  5579. const expectedType = getType(type);
  5580. if (isSimpleType(expectedType)) {
  5581. const t = typeof value;
  5582. valid = t === expectedType.toLowerCase();
  5583. if (!valid && t === "object") {
  5584. valid = value instanceof type;
  5585. }
  5586. } else if (expectedType === "Object") {
  5587. valid = isObject(value);
  5588. } else if (expectedType === "Array") {
  5589. valid = isArray(value);
  5590. } else if (expectedType === "null") {
  5591. valid = value === null;
  5592. } else {
  5593. valid = value instanceof type;
  5594. }
  5595. return {
  5596. valid,
  5597. expectedType
  5598. };
  5599. }
  5600. function getInvalidTypeMessage(name, value, expectedTypes) {
  5601. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  5602. const expectedType = expectedTypes[0];
  5603. const receivedType = toRawType(value);
  5604. const expectedValue = styleValue(value, expectedType);
  5605. const receivedValue = styleValue(value, receivedType);
  5606. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  5607. message += ` with value ${expectedValue}`;
  5608. }
  5609. message += `, got ${receivedType} `;
  5610. if (isExplicable(receivedType)) {
  5611. message += `with value ${receivedValue}.`;
  5612. }
  5613. return message;
  5614. }
  5615. function styleValue(value, type) {
  5616. if (type === "String") {
  5617. return `"${value}"`;
  5618. } else if (type === "Number") {
  5619. return `${Number(value)}`;
  5620. } else {
  5621. return `${value}`;
  5622. }
  5623. }
  5624. function isExplicable(type) {
  5625. const explicitTypes = ["string", "number", "boolean"];
  5626. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  5627. }
  5628. function isBoolean(...args) {
  5629. return args.some((elem) => elem.toLowerCase() === "boolean");
  5630. }
  5631. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  5632. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  5633. const normalizeSlot = (key, rawSlot, ctx) => {
  5634. if (rawSlot._n) {
  5635. return rawSlot;
  5636. }
  5637. const normalized = withCtx((...args) => {
  5638. if (currentInstance) {
  5639. warn(
  5640. `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.`
  5641. );
  5642. }
  5643. return normalizeSlotValue(rawSlot(...args));
  5644. }, ctx);
  5645. normalized._c = false;
  5646. return normalized;
  5647. };
  5648. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  5649. const ctx = rawSlots._ctx;
  5650. for (const key in rawSlots) {
  5651. if (isInternalKey(key))
  5652. continue;
  5653. const value = rawSlots[key];
  5654. if (isFunction(value)) {
  5655. slots[key] = normalizeSlot(key, value, ctx);
  5656. } else if (value != null) {
  5657. {
  5658. warn(
  5659. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  5660. );
  5661. }
  5662. const normalized = normalizeSlotValue(value);
  5663. slots[key] = () => normalized;
  5664. }
  5665. }
  5666. };
  5667. const normalizeVNodeSlots = (instance, children) => {
  5668. if (!isKeepAlive(instance.vnode) && true) {
  5669. warn(
  5670. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  5671. );
  5672. }
  5673. const normalized = normalizeSlotValue(children);
  5674. instance.slots.default = () => normalized;
  5675. };
  5676. const initSlots = (instance, children) => {
  5677. if (instance.vnode.shapeFlag & 32) {
  5678. const type = children._;
  5679. if (type) {
  5680. instance.slots = toRaw(children);
  5681. def(children, "_", type);
  5682. } else {
  5683. normalizeObjectSlots(
  5684. children,
  5685. instance.slots = {});
  5686. }
  5687. } else {
  5688. instance.slots = {};
  5689. if (children) {
  5690. normalizeVNodeSlots(instance, children);
  5691. }
  5692. }
  5693. def(instance.slots, InternalObjectKey, 1);
  5694. };
  5695. const updateSlots = (instance, children, optimized) => {
  5696. const { vnode, slots } = instance;
  5697. let needDeletionCheck = true;
  5698. let deletionComparisonTarget = EMPTY_OBJ;
  5699. if (vnode.shapeFlag & 32) {
  5700. const type = children._;
  5701. if (type) {
  5702. if (isHmrUpdating) {
  5703. extend(slots, children);
  5704. trigger(instance, "set", "$slots");
  5705. } else if (optimized && type === 1) {
  5706. needDeletionCheck = false;
  5707. } else {
  5708. extend(slots, children);
  5709. if (!optimized && type === 1) {
  5710. delete slots._;
  5711. }
  5712. }
  5713. } else {
  5714. needDeletionCheck = !children.$stable;
  5715. normalizeObjectSlots(children, slots);
  5716. }
  5717. deletionComparisonTarget = children;
  5718. } else if (children) {
  5719. normalizeVNodeSlots(instance, children);
  5720. deletionComparisonTarget = { default: 1 };
  5721. }
  5722. if (needDeletionCheck) {
  5723. for (const key in slots) {
  5724. if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
  5725. delete slots[key];
  5726. }
  5727. }
  5728. }
  5729. };
  5730. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  5731. if (isArray(rawRef)) {
  5732. rawRef.forEach(
  5733. (r, i) => setRef(
  5734. r,
  5735. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  5736. parentSuspense,
  5737. vnode,
  5738. isUnmount
  5739. )
  5740. );
  5741. return;
  5742. }
  5743. if (isAsyncWrapper(vnode) && !isUnmount) {
  5744. return;
  5745. }
  5746. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  5747. const value = isUnmount ? null : refValue;
  5748. const { i: owner, r: ref } = rawRef;
  5749. if (!owner) {
  5750. warn(
  5751. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  5752. );
  5753. return;
  5754. }
  5755. const oldRef = oldRawRef && oldRawRef.r;
  5756. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  5757. const setupState = owner.setupState;
  5758. if (oldRef != null && oldRef !== ref) {
  5759. if (isString(oldRef)) {
  5760. refs[oldRef] = null;
  5761. if (hasOwn(setupState, oldRef)) {
  5762. setupState[oldRef] = null;
  5763. }
  5764. } else if (isRef(oldRef)) {
  5765. oldRef.value = null;
  5766. }
  5767. }
  5768. if (isFunction(ref)) {
  5769. callWithErrorHandling(ref, owner, 12, [value, refs]);
  5770. } else {
  5771. const _isString = isString(ref);
  5772. const _isRef = isRef(ref);
  5773. if (_isString || _isRef) {
  5774. const doSet = () => {
  5775. if (rawRef.f) {
  5776. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  5777. if (isUnmount) {
  5778. isArray(existing) && remove(existing, refValue);
  5779. } else {
  5780. if (!isArray(existing)) {
  5781. if (_isString) {
  5782. refs[ref] = [refValue];
  5783. if (hasOwn(setupState, ref)) {
  5784. setupState[ref] = refs[ref];
  5785. }
  5786. } else {
  5787. ref.value = [refValue];
  5788. if (rawRef.k)
  5789. refs[rawRef.k] = ref.value;
  5790. }
  5791. } else if (!existing.includes(refValue)) {
  5792. existing.push(refValue);
  5793. }
  5794. }
  5795. } else if (_isString) {
  5796. refs[ref] = value;
  5797. if (hasOwn(setupState, ref)) {
  5798. setupState[ref] = value;
  5799. }
  5800. } else if (_isRef) {
  5801. ref.value = value;
  5802. if (rawRef.k)
  5803. refs[rawRef.k] = value;
  5804. } else {
  5805. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  5806. }
  5807. };
  5808. if (value) {
  5809. doSet.id = -1;
  5810. queuePostRenderEffect(doSet, parentSuspense);
  5811. } else {
  5812. doSet();
  5813. }
  5814. } else {
  5815. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  5816. }
  5817. }
  5818. }
  5819. let hasMismatch = false;
  5820. const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
  5821. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  5822. function createHydrationFunctions(rendererInternals) {
  5823. const {
  5824. mt: mountComponent,
  5825. p: patch,
  5826. o: {
  5827. patchProp,
  5828. createText,
  5829. nextSibling,
  5830. parentNode,
  5831. remove,
  5832. insert,
  5833. createComment
  5834. }
  5835. } = rendererInternals;
  5836. const hydrate = (vnode, container) => {
  5837. if (!container.hasChildNodes()) {
  5838. warn(
  5839. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  5840. );
  5841. patch(null, vnode, container);
  5842. flushPostFlushCbs();
  5843. container._vnode = vnode;
  5844. return;
  5845. }
  5846. hasMismatch = false;
  5847. hydrateNode(container.firstChild, vnode, null, null, null);
  5848. flushPostFlushCbs();
  5849. container._vnode = vnode;
  5850. if (hasMismatch && true) {
  5851. console.error(`Hydration completed but contains mismatches.`);
  5852. }
  5853. };
  5854. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  5855. const isFragmentStart = isComment(node) && node.data === "[";
  5856. const onMismatch = () => handleMismatch(
  5857. node,
  5858. vnode,
  5859. parentComponent,
  5860. parentSuspense,
  5861. slotScopeIds,
  5862. isFragmentStart
  5863. );
  5864. const { type, ref, shapeFlag, patchFlag } = vnode;
  5865. let domType = node.nodeType;
  5866. vnode.el = node;
  5867. if (patchFlag === -2) {
  5868. optimized = false;
  5869. vnode.dynamicChildren = null;
  5870. }
  5871. let nextNode = null;
  5872. switch (type) {
  5873. case Text:
  5874. if (domType !== 3 /* TEXT */) {
  5875. if (vnode.children === "") {
  5876. insert(vnode.el = createText(""), parentNode(node), node);
  5877. nextNode = node;
  5878. } else {
  5879. nextNode = onMismatch();
  5880. }
  5881. } else {
  5882. if (node.data !== vnode.children) {
  5883. hasMismatch = true;
  5884. warn(
  5885. `Hydration text mismatch:
  5886. - Client: ${JSON.stringify(node.data)}
  5887. - Server: ${JSON.stringify(vnode.children)}`
  5888. );
  5889. node.data = vnode.children;
  5890. }
  5891. nextNode = nextSibling(node);
  5892. }
  5893. break;
  5894. case Comment:
  5895. if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  5896. nextNode = onMismatch();
  5897. } else {
  5898. nextNode = nextSibling(node);
  5899. }
  5900. break;
  5901. case Static:
  5902. if (isFragmentStart) {
  5903. node = nextSibling(node);
  5904. domType = node.nodeType;
  5905. }
  5906. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  5907. nextNode = node;
  5908. const needToAdoptContent = !vnode.children.length;
  5909. for (let i = 0; i < vnode.staticCount; i++) {
  5910. if (needToAdoptContent)
  5911. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  5912. if (i === vnode.staticCount - 1) {
  5913. vnode.anchor = nextNode;
  5914. }
  5915. nextNode = nextSibling(nextNode);
  5916. }
  5917. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  5918. } else {
  5919. onMismatch();
  5920. }
  5921. break;
  5922. case Fragment:
  5923. if (!isFragmentStart) {
  5924. nextNode = onMismatch();
  5925. } else {
  5926. nextNode = hydrateFragment(
  5927. node,
  5928. vnode,
  5929. parentComponent,
  5930. parentSuspense,
  5931. slotScopeIds,
  5932. optimized
  5933. );
  5934. }
  5935. break;
  5936. default:
  5937. if (shapeFlag & 1) {
  5938. if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
  5939. nextNode = onMismatch();
  5940. } else {
  5941. nextNode = hydrateElement(
  5942. node,
  5943. vnode,
  5944. parentComponent,
  5945. parentSuspense,
  5946. slotScopeIds,
  5947. optimized
  5948. );
  5949. }
  5950. } else if (shapeFlag & 6) {
  5951. vnode.slotScopeIds = slotScopeIds;
  5952. const container = parentNode(node);
  5953. mountComponent(
  5954. vnode,
  5955. container,
  5956. null,
  5957. parentComponent,
  5958. parentSuspense,
  5959. isSVGContainer(container),
  5960. optimized
  5961. );
  5962. nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
  5963. if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
  5964. nextNode = nextSibling(nextNode);
  5965. }
  5966. if (isAsyncWrapper(vnode)) {
  5967. let subTree;
  5968. if (isFragmentStart) {
  5969. subTree = createVNode(Fragment);
  5970. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  5971. } else {
  5972. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  5973. }
  5974. subTree.el = node;
  5975. vnode.component.subTree = subTree;
  5976. }
  5977. } else if (shapeFlag & 64) {
  5978. if (domType !== 8 /* COMMENT */) {
  5979. nextNode = onMismatch();
  5980. } else {
  5981. nextNode = vnode.type.hydrate(
  5982. node,
  5983. vnode,
  5984. parentComponent,
  5985. parentSuspense,
  5986. slotScopeIds,
  5987. optimized,
  5988. rendererInternals,
  5989. hydrateChildren
  5990. );
  5991. }
  5992. } else if (shapeFlag & 128) {
  5993. nextNode = vnode.type.hydrate(
  5994. node,
  5995. vnode,
  5996. parentComponent,
  5997. parentSuspense,
  5998. isSVGContainer(parentNode(node)),
  5999. slotScopeIds,
  6000. optimized,
  6001. rendererInternals,
  6002. hydrateNode
  6003. );
  6004. } else {
  6005. warn("Invalid HostVNode type:", type, `(${typeof type})`);
  6006. }
  6007. }
  6008. if (ref != null) {
  6009. setRef(ref, null, parentSuspense, vnode);
  6010. }
  6011. return nextNode;
  6012. };
  6013. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6014. optimized = optimized || !!vnode.dynamicChildren;
  6015. const { type, props, patchFlag, shapeFlag, dirs } = vnode;
  6016. const forcePatchValue = type === "input" && dirs || type === "option";
  6017. {
  6018. if (dirs) {
  6019. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6020. }
  6021. if (props) {
  6022. if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
  6023. for (const key in props) {
  6024. if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
  6025. patchProp(
  6026. el,
  6027. key,
  6028. null,
  6029. props[key],
  6030. false,
  6031. void 0,
  6032. parentComponent
  6033. );
  6034. }
  6035. }
  6036. } else if (props.onClick) {
  6037. patchProp(
  6038. el,
  6039. "onClick",
  6040. null,
  6041. props.onClick,
  6042. false,
  6043. void 0,
  6044. parentComponent
  6045. );
  6046. }
  6047. }
  6048. let vnodeHooks;
  6049. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  6050. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6051. }
  6052. if (dirs) {
  6053. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6054. }
  6055. if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
  6056. queueEffectWithSuspense(() => {
  6057. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6058. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6059. }, parentSuspense);
  6060. }
  6061. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  6062. !(props && (props.innerHTML || props.textContent))) {
  6063. let next = hydrateChildren(
  6064. el.firstChild,
  6065. vnode,
  6066. el,
  6067. parentComponent,
  6068. parentSuspense,
  6069. slotScopeIds,
  6070. optimized
  6071. );
  6072. let hasWarned = false;
  6073. while (next) {
  6074. hasMismatch = true;
  6075. if (!hasWarned) {
  6076. warn(
  6077. `Hydration children mismatch in <${vnode.type}>: server rendered element contains more child nodes than client vdom.`
  6078. );
  6079. hasWarned = true;
  6080. }
  6081. const cur = next;
  6082. next = next.nextSibling;
  6083. remove(cur);
  6084. }
  6085. } else if (shapeFlag & 8) {
  6086. if (el.textContent !== vnode.children) {
  6087. hasMismatch = true;
  6088. warn(
  6089. `Hydration text content mismatch in <${vnode.type}>:
  6090. - Client: ${el.textContent}
  6091. - Server: ${vnode.children}`
  6092. );
  6093. el.textContent = vnode.children;
  6094. }
  6095. }
  6096. }
  6097. return el.nextSibling;
  6098. };
  6099. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6100. optimized = optimized || !!parentVNode.dynamicChildren;
  6101. const children = parentVNode.children;
  6102. const l = children.length;
  6103. let hasWarned = false;
  6104. for (let i = 0; i < l; i++) {
  6105. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  6106. if (node) {
  6107. node = hydrateNode(
  6108. node,
  6109. vnode,
  6110. parentComponent,
  6111. parentSuspense,
  6112. slotScopeIds,
  6113. optimized
  6114. );
  6115. } else if (vnode.type === Text && !vnode.children) {
  6116. continue;
  6117. } else {
  6118. hasMismatch = true;
  6119. if (!hasWarned) {
  6120. warn(
  6121. `Hydration children mismatch in <${container.tagName.toLowerCase()}>: server rendered element contains fewer child nodes than client vdom.`
  6122. );
  6123. hasWarned = true;
  6124. }
  6125. patch(
  6126. null,
  6127. vnode,
  6128. container,
  6129. null,
  6130. parentComponent,
  6131. parentSuspense,
  6132. isSVGContainer(container),
  6133. slotScopeIds
  6134. );
  6135. }
  6136. }
  6137. return node;
  6138. };
  6139. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6140. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  6141. if (fragmentSlotScopeIds) {
  6142. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6143. }
  6144. const container = parentNode(node);
  6145. const next = hydrateChildren(
  6146. nextSibling(node),
  6147. vnode,
  6148. container,
  6149. parentComponent,
  6150. parentSuspense,
  6151. slotScopeIds,
  6152. optimized
  6153. );
  6154. if (next && isComment(next) && next.data === "]") {
  6155. return nextSibling(vnode.anchor = next);
  6156. } else {
  6157. hasMismatch = true;
  6158. insert(vnode.anchor = createComment(`]`), container, next);
  6159. return next;
  6160. }
  6161. };
  6162. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  6163. hasMismatch = true;
  6164. warn(
  6165. `Hydration node mismatch:
  6166. - Client vnode:`,
  6167. vnode.type,
  6168. `
  6169. - Server rendered DOM:`,
  6170. node,
  6171. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``
  6172. );
  6173. vnode.el = null;
  6174. if (isFragment) {
  6175. const end = locateClosingAsyncAnchor(node);
  6176. while (true) {
  6177. const next2 = nextSibling(node);
  6178. if (next2 && next2 !== end) {
  6179. remove(next2);
  6180. } else {
  6181. break;
  6182. }
  6183. }
  6184. }
  6185. const next = nextSibling(node);
  6186. const container = parentNode(node);
  6187. remove(node);
  6188. patch(
  6189. null,
  6190. vnode,
  6191. container,
  6192. next,
  6193. parentComponent,
  6194. parentSuspense,
  6195. isSVGContainer(container),
  6196. slotScopeIds
  6197. );
  6198. return next;
  6199. };
  6200. const locateClosingAsyncAnchor = (node) => {
  6201. let match = 0;
  6202. while (node) {
  6203. node = nextSibling(node);
  6204. if (node && isComment(node)) {
  6205. if (node.data === "[")
  6206. match++;
  6207. if (node.data === "]") {
  6208. if (match === 0) {
  6209. return nextSibling(node);
  6210. } else {
  6211. match--;
  6212. }
  6213. }
  6214. }
  6215. }
  6216. return node;
  6217. };
  6218. return [hydrate, hydrateNode];
  6219. }
  6220. let supported;
  6221. let perf;
  6222. function startMeasure(instance, type) {
  6223. if (instance.appContext.config.performance && isSupported()) {
  6224. perf.mark(`vue-${type}-${instance.uid}`);
  6225. }
  6226. {
  6227. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6228. }
  6229. }
  6230. function endMeasure(instance, type) {
  6231. if (instance.appContext.config.performance && isSupported()) {
  6232. const startTag = `vue-${type}-${instance.uid}`;
  6233. const endTag = startTag + `:end`;
  6234. perf.mark(endTag);
  6235. perf.measure(
  6236. `<${formatComponentName(instance, instance.type)}> ${type}`,
  6237. startTag,
  6238. endTag
  6239. );
  6240. perf.clearMarks(startTag);
  6241. perf.clearMarks(endTag);
  6242. }
  6243. {
  6244. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6245. }
  6246. }
  6247. function isSupported() {
  6248. if (supported !== void 0) {
  6249. return supported;
  6250. }
  6251. if (typeof window !== "undefined" && window.performance) {
  6252. supported = true;
  6253. perf = window.performance;
  6254. } else {
  6255. supported = false;
  6256. }
  6257. return supported;
  6258. }
  6259. const queuePostRenderEffect = queueEffectWithSuspense ;
  6260. function createRenderer(options) {
  6261. return baseCreateRenderer(options);
  6262. }
  6263. function createHydrationRenderer(options) {
  6264. return baseCreateRenderer(options, createHydrationFunctions);
  6265. }
  6266. function baseCreateRenderer(options, createHydrationFns) {
  6267. const target = getGlobalThis();
  6268. target.__VUE__ = true;
  6269. {
  6270. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6271. }
  6272. const {
  6273. insert: hostInsert,
  6274. remove: hostRemove,
  6275. patchProp: hostPatchProp,
  6276. createElement: hostCreateElement,
  6277. createText: hostCreateText,
  6278. createComment: hostCreateComment,
  6279. setText: hostSetText,
  6280. setElementText: hostSetElementText,
  6281. parentNode: hostParentNode,
  6282. nextSibling: hostNextSibling,
  6283. setScopeId: hostSetScopeId = NOOP,
  6284. insertStaticContent: hostInsertStaticContent
  6285. } = options;
  6286. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6287. if (n1 === n2) {
  6288. return;
  6289. }
  6290. if (n1 && !isSameVNodeType(n1, n2)) {
  6291. anchor = getNextHostNode(n1);
  6292. unmount(n1, parentComponent, parentSuspense, true);
  6293. n1 = null;
  6294. }
  6295. if (n2.patchFlag === -2) {
  6296. optimized = false;
  6297. n2.dynamicChildren = null;
  6298. }
  6299. const { type, ref, shapeFlag } = n2;
  6300. switch (type) {
  6301. case Text:
  6302. processText(n1, n2, container, anchor);
  6303. break;
  6304. case Comment:
  6305. processCommentNode(n1, n2, container, anchor);
  6306. break;
  6307. case Static:
  6308. if (n1 == null) {
  6309. mountStaticNode(n2, container, anchor, isSVG);
  6310. } else {
  6311. patchStaticNode(n1, n2, container, isSVG);
  6312. }
  6313. break;
  6314. case Fragment:
  6315. processFragment(
  6316. n1,
  6317. n2,
  6318. container,
  6319. anchor,
  6320. parentComponent,
  6321. parentSuspense,
  6322. isSVG,
  6323. slotScopeIds,
  6324. optimized
  6325. );
  6326. break;
  6327. default:
  6328. if (shapeFlag & 1) {
  6329. processElement(
  6330. n1,
  6331. n2,
  6332. container,
  6333. anchor,
  6334. parentComponent,
  6335. parentSuspense,
  6336. isSVG,
  6337. slotScopeIds,
  6338. optimized
  6339. );
  6340. } else if (shapeFlag & 6) {
  6341. processComponent(
  6342. n1,
  6343. n2,
  6344. container,
  6345. anchor,
  6346. parentComponent,
  6347. parentSuspense,
  6348. isSVG,
  6349. slotScopeIds,
  6350. optimized
  6351. );
  6352. } else if (shapeFlag & 64) {
  6353. type.process(
  6354. n1,
  6355. n2,
  6356. container,
  6357. anchor,
  6358. parentComponent,
  6359. parentSuspense,
  6360. isSVG,
  6361. slotScopeIds,
  6362. optimized,
  6363. internals
  6364. );
  6365. } else if (shapeFlag & 128) {
  6366. type.process(
  6367. n1,
  6368. n2,
  6369. container,
  6370. anchor,
  6371. parentComponent,
  6372. parentSuspense,
  6373. isSVG,
  6374. slotScopeIds,
  6375. optimized,
  6376. internals
  6377. );
  6378. } else {
  6379. warn("Invalid VNode type:", type, `(${typeof type})`);
  6380. }
  6381. }
  6382. if (ref != null && parentComponent) {
  6383. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6384. }
  6385. };
  6386. const processText = (n1, n2, container, anchor) => {
  6387. if (n1 == null) {
  6388. hostInsert(
  6389. n2.el = hostCreateText(n2.children),
  6390. container,
  6391. anchor
  6392. );
  6393. } else {
  6394. const el = n2.el = n1.el;
  6395. if (n2.children !== n1.children) {
  6396. hostSetText(el, n2.children);
  6397. }
  6398. }
  6399. };
  6400. const processCommentNode = (n1, n2, container, anchor) => {
  6401. if (n1 == null) {
  6402. hostInsert(
  6403. n2.el = hostCreateComment(n2.children || ""),
  6404. container,
  6405. anchor
  6406. );
  6407. } else {
  6408. n2.el = n1.el;
  6409. }
  6410. };
  6411. const mountStaticNode = (n2, container, anchor, isSVG) => {
  6412. [n2.el, n2.anchor] = hostInsertStaticContent(
  6413. n2.children,
  6414. container,
  6415. anchor,
  6416. isSVG,
  6417. n2.el,
  6418. n2.anchor
  6419. );
  6420. };
  6421. const patchStaticNode = (n1, n2, container, isSVG) => {
  6422. if (n2.children !== n1.children) {
  6423. const anchor = hostNextSibling(n1.anchor);
  6424. removeStaticNode(n1);
  6425. [n2.el, n2.anchor] = hostInsertStaticContent(
  6426. n2.children,
  6427. container,
  6428. anchor,
  6429. isSVG
  6430. );
  6431. } else {
  6432. n2.el = n1.el;
  6433. n2.anchor = n1.anchor;
  6434. }
  6435. };
  6436. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  6437. let next;
  6438. while (el && el !== anchor) {
  6439. next = hostNextSibling(el);
  6440. hostInsert(el, container, nextSibling);
  6441. el = next;
  6442. }
  6443. hostInsert(anchor, container, nextSibling);
  6444. };
  6445. const removeStaticNode = ({ el, anchor }) => {
  6446. let next;
  6447. while (el && el !== anchor) {
  6448. next = hostNextSibling(el);
  6449. hostRemove(el);
  6450. el = next;
  6451. }
  6452. hostRemove(anchor);
  6453. };
  6454. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6455. isSVG = isSVG || n2.type === "svg";
  6456. if (n1 == null) {
  6457. mountElement(
  6458. n2,
  6459. container,
  6460. anchor,
  6461. parentComponent,
  6462. parentSuspense,
  6463. isSVG,
  6464. slotScopeIds,
  6465. optimized
  6466. );
  6467. } else {
  6468. patchElement(
  6469. n1,
  6470. n2,
  6471. parentComponent,
  6472. parentSuspense,
  6473. isSVG,
  6474. slotScopeIds,
  6475. optimized
  6476. );
  6477. }
  6478. };
  6479. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6480. let el;
  6481. let vnodeHook;
  6482. const { type, props, shapeFlag, transition, dirs } = vnode;
  6483. el = vnode.el = hostCreateElement(
  6484. vnode.type,
  6485. isSVG,
  6486. props && props.is,
  6487. props
  6488. );
  6489. if (shapeFlag & 8) {
  6490. hostSetElementText(el, vnode.children);
  6491. } else if (shapeFlag & 16) {
  6492. mountChildren(
  6493. vnode.children,
  6494. el,
  6495. null,
  6496. parentComponent,
  6497. parentSuspense,
  6498. isSVG && type !== "foreignObject",
  6499. slotScopeIds,
  6500. optimized
  6501. );
  6502. }
  6503. if (dirs) {
  6504. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6505. }
  6506. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6507. if (props) {
  6508. for (const key in props) {
  6509. if (key !== "value" && !isReservedProp(key)) {
  6510. hostPatchProp(
  6511. el,
  6512. key,
  6513. null,
  6514. props[key],
  6515. isSVG,
  6516. vnode.children,
  6517. parentComponent,
  6518. parentSuspense,
  6519. unmountChildren
  6520. );
  6521. }
  6522. }
  6523. if ("value" in props) {
  6524. hostPatchProp(el, "value", null, props.value);
  6525. }
  6526. if (vnodeHook = props.onVnodeBeforeMount) {
  6527. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6528. }
  6529. }
  6530. {
  6531. Object.defineProperty(el, "__vnode", {
  6532. value: vnode,
  6533. enumerable: false
  6534. });
  6535. Object.defineProperty(el, "__vueParentComponent", {
  6536. value: parentComponent,
  6537. enumerable: false
  6538. });
  6539. }
  6540. if (dirs) {
  6541. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6542. }
  6543. const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  6544. if (needCallTransitionHooks) {
  6545. transition.beforeEnter(el);
  6546. }
  6547. hostInsert(el, container, anchor);
  6548. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6549. queuePostRenderEffect(() => {
  6550. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6551. needCallTransitionHooks && transition.enter(el);
  6552. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6553. }, parentSuspense);
  6554. }
  6555. };
  6556. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6557. if (scopeId) {
  6558. hostSetScopeId(el, scopeId);
  6559. }
  6560. if (slotScopeIds) {
  6561. for (let i = 0; i < slotScopeIds.length; i++) {
  6562. hostSetScopeId(el, slotScopeIds[i]);
  6563. }
  6564. }
  6565. if (parentComponent) {
  6566. let subTree = parentComponent.subTree;
  6567. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  6568. subTree = filterSingleRoot(subTree.children) || subTree;
  6569. }
  6570. if (vnode === subTree) {
  6571. const parentVNode = parentComponent.vnode;
  6572. setScopeId(
  6573. el,
  6574. parentVNode,
  6575. parentVNode.scopeId,
  6576. parentVNode.slotScopeIds,
  6577. parentComponent.parent
  6578. );
  6579. }
  6580. }
  6581. };
  6582. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
  6583. for (let i = start; i < children.length; i++) {
  6584. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6585. patch(
  6586. null,
  6587. child,
  6588. container,
  6589. anchor,
  6590. parentComponent,
  6591. parentSuspense,
  6592. isSVG,
  6593. slotScopeIds,
  6594. optimized
  6595. );
  6596. }
  6597. };
  6598. const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6599. const el = n2.el = n1.el;
  6600. let { patchFlag, dynamicChildren, dirs } = n2;
  6601. patchFlag |= n1.patchFlag & 16;
  6602. const oldProps = n1.props || EMPTY_OBJ;
  6603. const newProps = n2.props || EMPTY_OBJ;
  6604. let vnodeHook;
  6605. parentComponent && toggleRecurse(parentComponent, false);
  6606. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  6607. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6608. }
  6609. if (dirs) {
  6610. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  6611. }
  6612. parentComponent && toggleRecurse(parentComponent, true);
  6613. if (isHmrUpdating) {
  6614. patchFlag = 0;
  6615. optimized = false;
  6616. dynamicChildren = null;
  6617. }
  6618. const areChildrenSVG = isSVG && n2.type !== "foreignObject";
  6619. if (dynamicChildren) {
  6620. patchBlockChildren(
  6621. n1.dynamicChildren,
  6622. dynamicChildren,
  6623. el,
  6624. parentComponent,
  6625. parentSuspense,
  6626. areChildrenSVG,
  6627. slotScopeIds
  6628. );
  6629. {
  6630. traverseStaticChildren(n1, n2);
  6631. }
  6632. } else if (!optimized) {
  6633. patchChildren(
  6634. n1,
  6635. n2,
  6636. el,
  6637. null,
  6638. parentComponent,
  6639. parentSuspense,
  6640. areChildrenSVG,
  6641. slotScopeIds,
  6642. false
  6643. );
  6644. }
  6645. if (patchFlag > 0) {
  6646. if (patchFlag & 16) {
  6647. patchProps(
  6648. el,
  6649. n2,
  6650. oldProps,
  6651. newProps,
  6652. parentComponent,
  6653. parentSuspense,
  6654. isSVG
  6655. );
  6656. } else {
  6657. if (patchFlag & 2) {
  6658. if (oldProps.class !== newProps.class) {
  6659. hostPatchProp(el, "class", null, newProps.class, isSVG);
  6660. }
  6661. }
  6662. if (patchFlag & 4) {
  6663. hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
  6664. }
  6665. if (patchFlag & 8) {
  6666. const propsToUpdate = n2.dynamicProps;
  6667. for (let i = 0; i < propsToUpdate.length; i++) {
  6668. const key = propsToUpdate[i];
  6669. const prev = oldProps[key];
  6670. const next = newProps[key];
  6671. if (next !== prev || key === "value") {
  6672. hostPatchProp(
  6673. el,
  6674. key,
  6675. prev,
  6676. next,
  6677. isSVG,
  6678. n1.children,
  6679. parentComponent,
  6680. parentSuspense,
  6681. unmountChildren
  6682. );
  6683. }
  6684. }
  6685. }
  6686. }
  6687. if (patchFlag & 1) {
  6688. if (n1.children !== n2.children) {
  6689. hostSetElementText(el, n2.children);
  6690. }
  6691. }
  6692. } else if (!optimized && dynamicChildren == null) {
  6693. patchProps(
  6694. el,
  6695. n2,
  6696. oldProps,
  6697. newProps,
  6698. parentComponent,
  6699. parentSuspense,
  6700. isSVG
  6701. );
  6702. }
  6703. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  6704. queuePostRenderEffect(() => {
  6705. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6706. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  6707. }, parentSuspense);
  6708. }
  6709. };
  6710. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  6711. for (let i = 0; i < newChildren.length; i++) {
  6712. const oldVNode = oldChildren[i];
  6713. const newVNode = newChildren[i];
  6714. const container = (
  6715. // oldVNode may be an errored async setup() component inside Suspense
  6716. // which will not have a mounted element
  6717. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  6718. // of the Fragment itself so it can move its children.
  6719. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  6720. // which also requires the correct parent container
  6721. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  6722. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  6723. // In other cases, the parent container is not actually used so we
  6724. // just pass the block element here to avoid a DOM parentNode call.
  6725. fallbackContainer
  6726. )
  6727. );
  6728. patch(
  6729. oldVNode,
  6730. newVNode,
  6731. container,
  6732. null,
  6733. parentComponent,
  6734. parentSuspense,
  6735. isSVG,
  6736. slotScopeIds,
  6737. true
  6738. );
  6739. }
  6740. };
  6741. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  6742. if (oldProps !== newProps) {
  6743. if (oldProps !== EMPTY_OBJ) {
  6744. for (const key in oldProps) {
  6745. if (!isReservedProp(key) && !(key in newProps)) {
  6746. hostPatchProp(
  6747. el,
  6748. key,
  6749. oldProps[key],
  6750. null,
  6751. isSVG,
  6752. vnode.children,
  6753. parentComponent,
  6754. parentSuspense,
  6755. unmountChildren
  6756. );
  6757. }
  6758. }
  6759. }
  6760. for (const key in newProps) {
  6761. if (isReservedProp(key))
  6762. continue;
  6763. const next = newProps[key];
  6764. const prev = oldProps[key];
  6765. if (next !== prev && key !== "value") {
  6766. hostPatchProp(
  6767. el,
  6768. key,
  6769. prev,
  6770. next,
  6771. isSVG,
  6772. vnode.children,
  6773. parentComponent,
  6774. parentSuspense,
  6775. unmountChildren
  6776. );
  6777. }
  6778. }
  6779. if ("value" in newProps) {
  6780. hostPatchProp(el, "value", oldProps.value, newProps.value);
  6781. }
  6782. }
  6783. };
  6784. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6785. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  6786. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  6787. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  6788. if (
  6789. // #5523 dev root fragment may inherit directives
  6790. isHmrUpdating || patchFlag & 2048
  6791. ) {
  6792. patchFlag = 0;
  6793. optimized = false;
  6794. dynamicChildren = null;
  6795. }
  6796. if (fragmentSlotScopeIds) {
  6797. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6798. }
  6799. if (n1 == null) {
  6800. hostInsert(fragmentStartAnchor, container, anchor);
  6801. hostInsert(fragmentEndAnchor, container, anchor);
  6802. mountChildren(
  6803. n2.children,
  6804. container,
  6805. fragmentEndAnchor,
  6806. parentComponent,
  6807. parentSuspense,
  6808. isSVG,
  6809. slotScopeIds,
  6810. optimized
  6811. );
  6812. } else {
  6813. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  6814. // of renderSlot() with no valid children
  6815. n1.dynamicChildren) {
  6816. patchBlockChildren(
  6817. n1.dynamicChildren,
  6818. dynamicChildren,
  6819. container,
  6820. parentComponent,
  6821. parentSuspense,
  6822. isSVG,
  6823. slotScopeIds
  6824. );
  6825. {
  6826. traverseStaticChildren(n1, n2);
  6827. }
  6828. } else {
  6829. patchChildren(
  6830. n1,
  6831. n2,
  6832. container,
  6833. fragmentEndAnchor,
  6834. parentComponent,
  6835. parentSuspense,
  6836. isSVG,
  6837. slotScopeIds,
  6838. optimized
  6839. );
  6840. }
  6841. }
  6842. };
  6843. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6844. n2.slotScopeIds = slotScopeIds;
  6845. if (n1 == null) {
  6846. if (n2.shapeFlag & 512) {
  6847. parentComponent.ctx.activate(
  6848. n2,
  6849. container,
  6850. anchor,
  6851. isSVG,
  6852. optimized
  6853. );
  6854. } else {
  6855. mountComponent(
  6856. n2,
  6857. container,
  6858. anchor,
  6859. parentComponent,
  6860. parentSuspense,
  6861. isSVG,
  6862. optimized
  6863. );
  6864. }
  6865. } else {
  6866. updateComponent(n1, n2, optimized);
  6867. }
  6868. };
  6869. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  6870. const instance = (initialVNode.component = createComponentInstance(
  6871. initialVNode,
  6872. parentComponent,
  6873. parentSuspense
  6874. ));
  6875. if (instance.type.__hmrId) {
  6876. registerHMR(instance);
  6877. }
  6878. {
  6879. pushWarningContext(initialVNode);
  6880. startMeasure(instance, `mount`);
  6881. }
  6882. if (isKeepAlive(initialVNode)) {
  6883. instance.ctx.renderer = internals;
  6884. }
  6885. {
  6886. {
  6887. startMeasure(instance, `init`);
  6888. }
  6889. setupComponent(instance);
  6890. {
  6891. endMeasure(instance, `init`);
  6892. }
  6893. }
  6894. if (instance.asyncDep) {
  6895. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  6896. if (!initialVNode.el) {
  6897. const placeholder = instance.subTree = createVNode(Comment);
  6898. processCommentNode(null, placeholder, container, anchor);
  6899. }
  6900. return;
  6901. }
  6902. setupRenderEffect(
  6903. instance,
  6904. initialVNode,
  6905. container,
  6906. anchor,
  6907. parentSuspense,
  6908. isSVG,
  6909. optimized
  6910. );
  6911. {
  6912. popWarningContext();
  6913. endMeasure(instance, `mount`);
  6914. }
  6915. };
  6916. const updateComponent = (n1, n2, optimized) => {
  6917. const instance = n2.component = n1.component;
  6918. if (shouldUpdateComponent(n1, n2, optimized)) {
  6919. if (instance.asyncDep && !instance.asyncResolved) {
  6920. {
  6921. pushWarningContext(n2);
  6922. }
  6923. updateComponentPreRender(instance, n2, optimized);
  6924. {
  6925. popWarningContext();
  6926. }
  6927. return;
  6928. } else {
  6929. instance.next = n2;
  6930. invalidateJob(instance.update);
  6931. instance.update();
  6932. }
  6933. } else {
  6934. n2.el = n1.el;
  6935. instance.vnode = n2;
  6936. }
  6937. };
  6938. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  6939. const componentUpdateFn = () => {
  6940. if (!instance.isMounted) {
  6941. let vnodeHook;
  6942. const { el, props } = initialVNode;
  6943. const { bm, m, parent } = instance;
  6944. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  6945. toggleRecurse(instance, false);
  6946. if (bm) {
  6947. invokeArrayFns(bm);
  6948. }
  6949. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  6950. invokeVNodeHook(vnodeHook, parent, initialVNode);
  6951. }
  6952. toggleRecurse(instance, true);
  6953. if (el && hydrateNode) {
  6954. const hydrateSubTree = () => {
  6955. {
  6956. startMeasure(instance, `render`);
  6957. }
  6958. instance.subTree = renderComponentRoot(instance);
  6959. {
  6960. endMeasure(instance, `render`);
  6961. }
  6962. {
  6963. startMeasure(instance, `hydrate`);
  6964. }
  6965. hydrateNode(
  6966. el,
  6967. instance.subTree,
  6968. instance,
  6969. parentSuspense,
  6970. null
  6971. );
  6972. {
  6973. endMeasure(instance, `hydrate`);
  6974. }
  6975. };
  6976. if (isAsyncWrapperVNode) {
  6977. initialVNode.type.__asyncLoader().then(
  6978. // note: we are moving the render call into an async callback,
  6979. // which means it won't track dependencies - but it's ok because
  6980. // a server-rendered async wrapper is already in resolved state
  6981. // and it will never need to change.
  6982. () => !instance.isUnmounted && hydrateSubTree()
  6983. );
  6984. } else {
  6985. hydrateSubTree();
  6986. }
  6987. } else {
  6988. {
  6989. startMeasure(instance, `render`);
  6990. }
  6991. const subTree = instance.subTree = renderComponentRoot(instance);
  6992. {
  6993. endMeasure(instance, `render`);
  6994. }
  6995. {
  6996. startMeasure(instance, `patch`);
  6997. }
  6998. patch(
  6999. null,
  7000. subTree,
  7001. container,
  7002. anchor,
  7003. instance,
  7004. parentSuspense,
  7005. isSVG
  7006. );
  7007. {
  7008. endMeasure(instance, `patch`);
  7009. }
  7010. initialVNode.el = subTree.el;
  7011. }
  7012. if (m) {
  7013. queuePostRenderEffect(m, parentSuspense);
  7014. }
  7015. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7016. const scopedInitialVNode = initialVNode;
  7017. queuePostRenderEffect(
  7018. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7019. parentSuspense
  7020. );
  7021. }
  7022. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7023. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7024. }
  7025. instance.isMounted = true;
  7026. {
  7027. devtoolsComponentAdded(instance);
  7028. }
  7029. initialVNode = container = anchor = null;
  7030. } else {
  7031. let { next, bu, u, parent, vnode } = instance;
  7032. let originNext = next;
  7033. let vnodeHook;
  7034. {
  7035. pushWarningContext(next || instance.vnode);
  7036. }
  7037. toggleRecurse(instance, false);
  7038. if (next) {
  7039. next.el = vnode.el;
  7040. updateComponentPreRender(instance, next, optimized);
  7041. } else {
  7042. next = vnode;
  7043. }
  7044. if (bu) {
  7045. invokeArrayFns(bu);
  7046. }
  7047. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7048. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7049. }
  7050. toggleRecurse(instance, true);
  7051. {
  7052. startMeasure(instance, `render`);
  7053. }
  7054. const nextTree = renderComponentRoot(instance);
  7055. {
  7056. endMeasure(instance, `render`);
  7057. }
  7058. const prevTree = instance.subTree;
  7059. instance.subTree = nextTree;
  7060. {
  7061. startMeasure(instance, `patch`);
  7062. }
  7063. patch(
  7064. prevTree,
  7065. nextTree,
  7066. // parent may have changed if it's in a teleport
  7067. hostParentNode(prevTree.el),
  7068. // anchor may have changed if it's in a fragment
  7069. getNextHostNode(prevTree),
  7070. instance,
  7071. parentSuspense,
  7072. isSVG
  7073. );
  7074. {
  7075. endMeasure(instance, `patch`);
  7076. }
  7077. next.el = nextTree.el;
  7078. if (originNext === null) {
  7079. updateHOCHostEl(instance, nextTree.el);
  7080. }
  7081. if (u) {
  7082. queuePostRenderEffect(u, parentSuspense);
  7083. }
  7084. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7085. queuePostRenderEffect(
  7086. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7087. parentSuspense
  7088. );
  7089. }
  7090. {
  7091. devtoolsComponentUpdated(instance);
  7092. }
  7093. {
  7094. popWarningContext();
  7095. }
  7096. }
  7097. };
  7098. const effect = instance.effect = new ReactiveEffect(
  7099. componentUpdateFn,
  7100. () => queueJob(update),
  7101. instance.scope
  7102. // track it in component's effect scope
  7103. );
  7104. const update = instance.update = () => effect.run();
  7105. update.id = instance.uid;
  7106. toggleRecurse(instance, true);
  7107. {
  7108. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7109. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7110. update.ownerInstance = instance;
  7111. }
  7112. update();
  7113. };
  7114. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7115. nextVNode.component = instance;
  7116. const prevProps = instance.vnode.props;
  7117. instance.vnode = nextVNode;
  7118. instance.next = null;
  7119. updateProps(instance, nextVNode.props, prevProps, optimized);
  7120. updateSlots(instance, nextVNode.children, optimized);
  7121. pauseTracking();
  7122. flushPreFlushCbs();
  7123. resetTracking();
  7124. };
  7125. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
  7126. const c1 = n1 && n1.children;
  7127. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7128. const c2 = n2.children;
  7129. const { patchFlag, shapeFlag } = n2;
  7130. if (patchFlag > 0) {
  7131. if (patchFlag & 128) {
  7132. patchKeyedChildren(
  7133. c1,
  7134. c2,
  7135. container,
  7136. anchor,
  7137. parentComponent,
  7138. parentSuspense,
  7139. isSVG,
  7140. slotScopeIds,
  7141. optimized
  7142. );
  7143. return;
  7144. } else if (patchFlag & 256) {
  7145. patchUnkeyedChildren(
  7146. c1,
  7147. c2,
  7148. container,
  7149. anchor,
  7150. parentComponent,
  7151. parentSuspense,
  7152. isSVG,
  7153. slotScopeIds,
  7154. optimized
  7155. );
  7156. return;
  7157. }
  7158. }
  7159. if (shapeFlag & 8) {
  7160. if (prevShapeFlag & 16) {
  7161. unmountChildren(c1, parentComponent, parentSuspense);
  7162. }
  7163. if (c2 !== c1) {
  7164. hostSetElementText(container, c2);
  7165. }
  7166. } else {
  7167. if (prevShapeFlag & 16) {
  7168. if (shapeFlag & 16) {
  7169. patchKeyedChildren(
  7170. c1,
  7171. c2,
  7172. container,
  7173. anchor,
  7174. parentComponent,
  7175. parentSuspense,
  7176. isSVG,
  7177. slotScopeIds,
  7178. optimized
  7179. );
  7180. } else {
  7181. unmountChildren(c1, parentComponent, parentSuspense, true);
  7182. }
  7183. } else {
  7184. if (prevShapeFlag & 8) {
  7185. hostSetElementText(container, "");
  7186. }
  7187. if (shapeFlag & 16) {
  7188. mountChildren(
  7189. c2,
  7190. container,
  7191. anchor,
  7192. parentComponent,
  7193. parentSuspense,
  7194. isSVG,
  7195. slotScopeIds,
  7196. optimized
  7197. );
  7198. }
  7199. }
  7200. }
  7201. };
  7202. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7203. c1 = c1 || EMPTY_ARR;
  7204. c2 = c2 || EMPTY_ARR;
  7205. const oldLength = c1.length;
  7206. const newLength = c2.length;
  7207. const commonLength = Math.min(oldLength, newLength);
  7208. let i;
  7209. for (i = 0; i < commonLength; i++) {
  7210. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7211. patch(
  7212. c1[i],
  7213. nextChild,
  7214. container,
  7215. null,
  7216. parentComponent,
  7217. parentSuspense,
  7218. isSVG,
  7219. slotScopeIds,
  7220. optimized
  7221. );
  7222. }
  7223. if (oldLength > newLength) {
  7224. unmountChildren(
  7225. c1,
  7226. parentComponent,
  7227. parentSuspense,
  7228. true,
  7229. false,
  7230. commonLength
  7231. );
  7232. } else {
  7233. mountChildren(
  7234. c2,
  7235. container,
  7236. anchor,
  7237. parentComponent,
  7238. parentSuspense,
  7239. isSVG,
  7240. slotScopeIds,
  7241. optimized,
  7242. commonLength
  7243. );
  7244. }
  7245. };
  7246. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7247. let i = 0;
  7248. const l2 = c2.length;
  7249. let e1 = c1.length - 1;
  7250. let e2 = l2 - 1;
  7251. while (i <= e1 && i <= e2) {
  7252. const n1 = c1[i];
  7253. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7254. if (isSameVNodeType(n1, n2)) {
  7255. patch(
  7256. n1,
  7257. n2,
  7258. container,
  7259. null,
  7260. parentComponent,
  7261. parentSuspense,
  7262. isSVG,
  7263. slotScopeIds,
  7264. optimized
  7265. );
  7266. } else {
  7267. break;
  7268. }
  7269. i++;
  7270. }
  7271. while (i <= e1 && i <= e2) {
  7272. const n1 = c1[e1];
  7273. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7274. if (isSameVNodeType(n1, n2)) {
  7275. patch(
  7276. n1,
  7277. n2,
  7278. container,
  7279. null,
  7280. parentComponent,
  7281. parentSuspense,
  7282. isSVG,
  7283. slotScopeIds,
  7284. optimized
  7285. );
  7286. } else {
  7287. break;
  7288. }
  7289. e1--;
  7290. e2--;
  7291. }
  7292. if (i > e1) {
  7293. if (i <= e2) {
  7294. const nextPos = e2 + 1;
  7295. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7296. while (i <= e2) {
  7297. patch(
  7298. null,
  7299. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7300. container,
  7301. anchor,
  7302. parentComponent,
  7303. parentSuspense,
  7304. isSVG,
  7305. slotScopeIds,
  7306. optimized
  7307. );
  7308. i++;
  7309. }
  7310. }
  7311. } else if (i > e2) {
  7312. while (i <= e1) {
  7313. unmount(c1[i], parentComponent, parentSuspense, true);
  7314. i++;
  7315. }
  7316. } else {
  7317. const s1 = i;
  7318. const s2 = i;
  7319. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7320. for (i = s2; i <= e2; i++) {
  7321. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7322. if (nextChild.key != null) {
  7323. if (keyToNewIndexMap.has(nextChild.key)) {
  7324. warn(
  7325. `Duplicate keys found during update:`,
  7326. JSON.stringify(nextChild.key),
  7327. `Make sure keys are unique.`
  7328. );
  7329. }
  7330. keyToNewIndexMap.set(nextChild.key, i);
  7331. }
  7332. }
  7333. let j;
  7334. let patched = 0;
  7335. const toBePatched = e2 - s2 + 1;
  7336. let moved = false;
  7337. let maxNewIndexSoFar = 0;
  7338. const newIndexToOldIndexMap = new Array(toBePatched);
  7339. for (i = 0; i < toBePatched; i++)
  7340. newIndexToOldIndexMap[i] = 0;
  7341. for (i = s1; i <= e1; i++) {
  7342. const prevChild = c1[i];
  7343. if (patched >= toBePatched) {
  7344. unmount(prevChild, parentComponent, parentSuspense, true);
  7345. continue;
  7346. }
  7347. let newIndex;
  7348. if (prevChild.key != null) {
  7349. newIndex = keyToNewIndexMap.get(prevChild.key);
  7350. } else {
  7351. for (j = s2; j <= e2; j++) {
  7352. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7353. newIndex = j;
  7354. break;
  7355. }
  7356. }
  7357. }
  7358. if (newIndex === void 0) {
  7359. unmount(prevChild, parentComponent, parentSuspense, true);
  7360. } else {
  7361. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7362. if (newIndex >= maxNewIndexSoFar) {
  7363. maxNewIndexSoFar = newIndex;
  7364. } else {
  7365. moved = true;
  7366. }
  7367. patch(
  7368. prevChild,
  7369. c2[newIndex],
  7370. container,
  7371. null,
  7372. parentComponent,
  7373. parentSuspense,
  7374. isSVG,
  7375. slotScopeIds,
  7376. optimized
  7377. );
  7378. patched++;
  7379. }
  7380. }
  7381. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7382. j = increasingNewIndexSequence.length - 1;
  7383. for (i = toBePatched - 1; i >= 0; i--) {
  7384. const nextIndex = s2 + i;
  7385. const nextChild = c2[nextIndex];
  7386. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  7387. if (newIndexToOldIndexMap[i] === 0) {
  7388. patch(
  7389. null,
  7390. nextChild,
  7391. container,
  7392. anchor,
  7393. parentComponent,
  7394. parentSuspense,
  7395. isSVG,
  7396. slotScopeIds,
  7397. optimized
  7398. );
  7399. } else if (moved) {
  7400. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7401. move(nextChild, container, anchor, 2);
  7402. } else {
  7403. j--;
  7404. }
  7405. }
  7406. }
  7407. }
  7408. };
  7409. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7410. const { el, type, transition, children, shapeFlag } = vnode;
  7411. if (shapeFlag & 6) {
  7412. move(vnode.component.subTree, container, anchor, moveType);
  7413. return;
  7414. }
  7415. if (shapeFlag & 128) {
  7416. vnode.suspense.move(container, anchor, moveType);
  7417. return;
  7418. }
  7419. if (shapeFlag & 64) {
  7420. type.move(vnode, container, anchor, internals);
  7421. return;
  7422. }
  7423. if (type === Fragment) {
  7424. hostInsert(el, container, anchor);
  7425. for (let i = 0; i < children.length; i++) {
  7426. move(children[i], container, anchor, moveType);
  7427. }
  7428. hostInsert(vnode.anchor, container, anchor);
  7429. return;
  7430. }
  7431. if (type === Static) {
  7432. moveStaticNode(vnode, container, anchor);
  7433. return;
  7434. }
  7435. const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
  7436. if (needTransition) {
  7437. if (moveType === 0) {
  7438. transition.beforeEnter(el);
  7439. hostInsert(el, container, anchor);
  7440. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7441. } else {
  7442. const { leave, delayLeave, afterLeave } = transition;
  7443. const remove2 = () => hostInsert(el, container, anchor);
  7444. const performLeave = () => {
  7445. leave(el, () => {
  7446. remove2();
  7447. afterLeave && afterLeave();
  7448. });
  7449. };
  7450. if (delayLeave) {
  7451. delayLeave(el, remove2, performLeave);
  7452. } else {
  7453. performLeave();
  7454. }
  7455. }
  7456. } else {
  7457. hostInsert(el, container, anchor);
  7458. }
  7459. };
  7460. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  7461. const {
  7462. type,
  7463. props,
  7464. ref,
  7465. children,
  7466. dynamicChildren,
  7467. shapeFlag,
  7468. patchFlag,
  7469. dirs
  7470. } = vnode;
  7471. if (ref != null) {
  7472. setRef(ref, null, parentSuspense, vnode, true);
  7473. }
  7474. if (shapeFlag & 256) {
  7475. parentComponent.ctx.deactivate(vnode);
  7476. return;
  7477. }
  7478. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  7479. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  7480. let vnodeHook;
  7481. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  7482. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7483. }
  7484. if (shapeFlag & 6) {
  7485. unmountComponent(vnode.component, parentSuspense, doRemove);
  7486. } else {
  7487. if (shapeFlag & 128) {
  7488. vnode.suspense.unmount(parentSuspense, doRemove);
  7489. return;
  7490. }
  7491. if (shouldInvokeDirs) {
  7492. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  7493. }
  7494. if (shapeFlag & 64) {
  7495. vnode.type.remove(
  7496. vnode,
  7497. parentComponent,
  7498. parentSuspense,
  7499. optimized,
  7500. internals,
  7501. doRemove
  7502. );
  7503. } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7504. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7505. unmountChildren(
  7506. dynamicChildren,
  7507. parentComponent,
  7508. parentSuspense,
  7509. false,
  7510. true
  7511. );
  7512. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7513. unmountChildren(children, parentComponent, parentSuspense);
  7514. }
  7515. if (doRemove) {
  7516. remove(vnode);
  7517. }
  7518. }
  7519. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7520. queuePostRenderEffect(() => {
  7521. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7522. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7523. }, parentSuspense);
  7524. }
  7525. };
  7526. const remove = (vnode) => {
  7527. const { type, el, anchor, transition } = vnode;
  7528. if (type === Fragment) {
  7529. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7530. vnode.children.forEach((child) => {
  7531. if (child.type === Comment) {
  7532. hostRemove(child.el);
  7533. } else {
  7534. remove(child);
  7535. }
  7536. });
  7537. } else {
  7538. removeFragment(el, anchor);
  7539. }
  7540. return;
  7541. }
  7542. if (type === Static) {
  7543. removeStaticNode(vnode);
  7544. return;
  7545. }
  7546. const performRemove = () => {
  7547. hostRemove(el);
  7548. if (transition && !transition.persisted && transition.afterLeave) {
  7549. transition.afterLeave();
  7550. }
  7551. };
  7552. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7553. const { leave, delayLeave } = transition;
  7554. const performLeave = () => leave(el, performRemove);
  7555. if (delayLeave) {
  7556. delayLeave(vnode.el, performRemove, performLeave);
  7557. } else {
  7558. performLeave();
  7559. }
  7560. } else {
  7561. performRemove();
  7562. }
  7563. };
  7564. const removeFragment = (cur, end) => {
  7565. let next;
  7566. while (cur !== end) {
  7567. next = hostNextSibling(cur);
  7568. hostRemove(cur);
  7569. cur = next;
  7570. }
  7571. hostRemove(end);
  7572. };
  7573. const unmountComponent = (instance, parentSuspense, doRemove) => {
  7574. if (instance.type.__hmrId) {
  7575. unregisterHMR(instance);
  7576. }
  7577. const { bum, scope, update, subTree, um } = instance;
  7578. if (bum) {
  7579. invokeArrayFns(bum);
  7580. }
  7581. scope.stop();
  7582. if (update) {
  7583. update.active = false;
  7584. unmount(subTree, instance, parentSuspense, doRemove);
  7585. }
  7586. if (um) {
  7587. queuePostRenderEffect(um, parentSuspense);
  7588. }
  7589. queuePostRenderEffect(() => {
  7590. instance.isUnmounted = true;
  7591. }, parentSuspense);
  7592. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  7593. parentSuspense.deps--;
  7594. if (parentSuspense.deps === 0) {
  7595. parentSuspense.resolve();
  7596. }
  7597. }
  7598. {
  7599. devtoolsComponentRemoved(instance);
  7600. }
  7601. };
  7602. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  7603. for (let i = start; i < children.length; i++) {
  7604. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  7605. }
  7606. };
  7607. const getNextHostNode = (vnode) => {
  7608. if (vnode.shapeFlag & 6) {
  7609. return getNextHostNode(vnode.component.subTree);
  7610. }
  7611. if (vnode.shapeFlag & 128) {
  7612. return vnode.suspense.next();
  7613. }
  7614. return hostNextSibling(vnode.anchor || vnode.el);
  7615. };
  7616. const render = (vnode, container, isSVG) => {
  7617. if (vnode == null) {
  7618. if (container._vnode) {
  7619. unmount(container._vnode, null, null, true);
  7620. }
  7621. } else {
  7622. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  7623. }
  7624. flushPreFlushCbs();
  7625. flushPostFlushCbs();
  7626. container._vnode = vnode;
  7627. };
  7628. const internals = {
  7629. p: patch,
  7630. um: unmount,
  7631. m: move,
  7632. r: remove,
  7633. mt: mountComponent,
  7634. mc: mountChildren,
  7635. pc: patchChildren,
  7636. pbc: patchBlockChildren,
  7637. n: getNextHostNode,
  7638. o: options
  7639. };
  7640. let hydrate;
  7641. let hydrateNode;
  7642. if (createHydrationFns) {
  7643. [hydrate, hydrateNode] = createHydrationFns(
  7644. internals
  7645. );
  7646. }
  7647. return {
  7648. render,
  7649. hydrate,
  7650. createApp: createAppAPI(render, hydrate)
  7651. };
  7652. }
  7653. function toggleRecurse({ effect, update }, allowed) {
  7654. effect.allowRecurse = update.allowRecurse = allowed;
  7655. }
  7656. function traverseStaticChildren(n1, n2, shallow = false) {
  7657. const ch1 = n1.children;
  7658. const ch2 = n2.children;
  7659. if (isArray(ch1) && isArray(ch2)) {
  7660. for (let i = 0; i < ch1.length; i++) {
  7661. const c1 = ch1[i];
  7662. let c2 = ch2[i];
  7663. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  7664. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  7665. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  7666. c2.el = c1.el;
  7667. }
  7668. if (!shallow)
  7669. traverseStaticChildren(c1, c2);
  7670. }
  7671. if (c2.type === Text) {
  7672. c2.el = c1.el;
  7673. }
  7674. if (c2.type === Comment && !c2.el) {
  7675. c2.el = c1.el;
  7676. }
  7677. }
  7678. }
  7679. }
  7680. function getSequence(arr) {
  7681. const p = arr.slice();
  7682. const result = [0];
  7683. let i, j, u, v, c;
  7684. const len = arr.length;
  7685. for (i = 0; i < len; i++) {
  7686. const arrI = arr[i];
  7687. if (arrI !== 0) {
  7688. j = result[result.length - 1];
  7689. if (arr[j] < arrI) {
  7690. p[i] = j;
  7691. result.push(i);
  7692. continue;
  7693. }
  7694. u = 0;
  7695. v = result.length - 1;
  7696. while (u < v) {
  7697. c = u + v >> 1;
  7698. if (arr[result[c]] < arrI) {
  7699. u = c + 1;
  7700. } else {
  7701. v = c;
  7702. }
  7703. }
  7704. if (arrI < arr[result[u]]) {
  7705. if (u > 0) {
  7706. p[i] = result[u - 1];
  7707. }
  7708. result[u] = i;
  7709. }
  7710. }
  7711. }
  7712. u = result.length;
  7713. v = result[u - 1];
  7714. while (u-- > 0) {
  7715. result[u] = v;
  7716. v = p[v];
  7717. }
  7718. return result;
  7719. }
  7720. const isTeleport = (type) => type.__isTeleport;
  7721. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  7722. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  7723. const resolveTarget = (props, select) => {
  7724. const targetSelector = props && props.to;
  7725. if (isString(targetSelector)) {
  7726. if (!select) {
  7727. warn(
  7728. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  7729. );
  7730. return null;
  7731. } else {
  7732. const target = select(targetSelector);
  7733. if (!target) {
  7734. warn(
  7735. `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.`
  7736. );
  7737. }
  7738. return target;
  7739. }
  7740. } else {
  7741. if (!targetSelector && !isTeleportDisabled(props)) {
  7742. warn(`Invalid Teleport target: ${targetSelector}`);
  7743. }
  7744. return targetSelector;
  7745. }
  7746. };
  7747. const TeleportImpl = {
  7748. __isTeleport: true,
  7749. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  7750. const {
  7751. mc: mountChildren,
  7752. pc: patchChildren,
  7753. pbc: patchBlockChildren,
  7754. o: { insert, querySelector, createText, createComment }
  7755. } = internals;
  7756. const disabled = isTeleportDisabled(n2.props);
  7757. let { shapeFlag, children, dynamicChildren } = n2;
  7758. if (isHmrUpdating) {
  7759. optimized = false;
  7760. dynamicChildren = null;
  7761. }
  7762. if (n1 == null) {
  7763. const placeholder = n2.el = createComment("teleport start") ;
  7764. const mainAnchor = n2.anchor = createComment("teleport end") ;
  7765. insert(placeholder, container, anchor);
  7766. insert(mainAnchor, container, anchor);
  7767. const target = n2.target = resolveTarget(n2.props, querySelector);
  7768. const targetAnchor = n2.targetAnchor = createText("");
  7769. if (target) {
  7770. insert(targetAnchor, target);
  7771. isSVG = isSVG || isTargetSVG(target);
  7772. } else if (!disabled) {
  7773. warn("Invalid Teleport target on mount:", target, `(${typeof target})`);
  7774. }
  7775. const mount = (container2, anchor2) => {
  7776. if (shapeFlag & 16) {
  7777. mountChildren(
  7778. children,
  7779. container2,
  7780. anchor2,
  7781. parentComponent,
  7782. parentSuspense,
  7783. isSVG,
  7784. slotScopeIds,
  7785. optimized
  7786. );
  7787. }
  7788. };
  7789. if (disabled) {
  7790. mount(container, mainAnchor);
  7791. } else if (target) {
  7792. mount(target, targetAnchor);
  7793. }
  7794. } else {
  7795. n2.el = n1.el;
  7796. const mainAnchor = n2.anchor = n1.anchor;
  7797. const target = n2.target = n1.target;
  7798. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  7799. const wasDisabled = isTeleportDisabled(n1.props);
  7800. const currentContainer = wasDisabled ? container : target;
  7801. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  7802. isSVG = isSVG || isTargetSVG(target);
  7803. if (dynamicChildren) {
  7804. patchBlockChildren(
  7805. n1.dynamicChildren,
  7806. dynamicChildren,
  7807. currentContainer,
  7808. parentComponent,
  7809. parentSuspense,
  7810. isSVG,
  7811. slotScopeIds
  7812. );
  7813. traverseStaticChildren(n1, n2, true);
  7814. } else if (!optimized) {
  7815. patchChildren(
  7816. n1,
  7817. n2,
  7818. currentContainer,
  7819. currentAnchor,
  7820. parentComponent,
  7821. parentSuspense,
  7822. isSVG,
  7823. slotScopeIds,
  7824. false
  7825. );
  7826. }
  7827. if (disabled) {
  7828. if (!wasDisabled) {
  7829. moveTeleport(
  7830. n2,
  7831. container,
  7832. mainAnchor,
  7833. internals,
  7834. 1
  7835. );
  7836. }
  7837. } else {
  7838. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  7839. const nextTarget = n2.target = resolveTarget(
  7840. n2.props,
  7841. querySelector
  7842. );
  7843. if (nextTarget) {
  7844. moveTeleport(
  7845. n2,
  7846. nextTarget,
  7847. null,
  7848. internals,
  7849. 0
  7850. );
  7851. } else {
  7852. warn(
  7853. "Invalid Teleport target on update:",
  7854. target,
  7855. `(${typeof target})`
  7856. );
  7857. }
  7858. } else if (wasDisabled) {
  7859. moveTeleport(
  7860. n2,
  7861. target,
  7862. targetAnchor,
  7863. internals,
  7864. 1
  7865. );
  7866. }
  7867. }
  7868. }
  7869. updateCssVars(n2);
  7870. },
  7871. remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  7872. const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
  7873. if (target) {
  7874. hostRemove(targetAnchor);
  7875. }
  7876. if (doRemove || !isTeleportDisabled(props)) {
  7877. hostRemove(anchor);
  7878. if (shapeFlag & 16) {
  7879. for (let i = 0; i < children.length; i++) {
  7880. const child = children[i];
  7881. unmount(
  7882. child,
  7883. parentComponent,
  7884. parentSuspense,
  7885. true,
  7886. !!child.dynamicChildren
  7887. );
  7888. }
  7889. }
  7890. }
  7891. },
  7892. move: moveTeleport,
  7893. hydrate: hydrateTeleport
  7894. };
  7895. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  7896. if (moveType === 0) {
  7897. insert(vnode.targetAnchor, container, parentAnchor);
  7898. }
  7899. const { el, anchor, shapeFlag, children, props } = vnode;
  7900. const isReorder = moveType === 2;
  7901. if (isReorder) {
  7902. insert(el, container, parentAnchor);
  7903. }
  7904. if (!isReorder || isTeleportDisabled(props)) {
  7905. if (shapeFlag & 16) {
  7906. for (let i = 0; i < children.length; i++) {
  7907. move(
  7908. children[i],
  7909. container,
  7910. parentAnchor,
  7911. 2
  7912. );
  7913. }
  7914. }
  7915. }
  7916. if (isReorder) {
  7917. insert(anchor, container, parentAnchor);
  7918. }
  7919. }
  7920. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  7921. o: { nextSibling, parentNode, querySelector }
  7922. }, hydrateChildren) {
  7923. const target = vnode.target = resolveTarget(
  7924. vnode.props,
  7925. querySelector
  7926. );
  7927. if (target) {
  7928. const targetNode = target._lpa || target.firstChild;
  7929. if (vnode.shapeFlag & 16) {
  7930. if (isTeleportDisabled(vnode.props)) {
  7931. vnode.anchor = hydrateChildren(
  7932. nextSibling(node),
  7933. vnode,
  7934. parentNode(node),
  7935. parentComponent,
  7936. parentSuspense,
  7937. slotScopeIds,
  7938. optimized
  7939. );
  7940. vnode.targetAnchor = targetNode;
  7941. } else {
  7942. vnode.anchor = nextSibling(node);
  7943. let targetAnchor = targetNode;
  7944. while (targetAnchor) {
  7945. targetAnchor = nextSibling(targetAnchor);
  7946. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
  7947. vnode.targetAnchor = targetAnchor;
  7948. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  7949. break;
  7950. }
  7951. }
  7952. hydrateChildren(
  7953. targetNode,
  7954. vnode,
  7955. target,
  7956. parentComponent,
  7957. parentSuspense,
  7958. slotScopeIds,
  7959. optimized
  7960. );
  7961. }
  7962. }
  7963. updateCssVars(vnode);
  7964. }
  7965. return vnode.anchor && nextSibling(vnode.anchor);
  7966. }
  7967. const Teleport = TeleportImpl;
  7968. function updateCssVars(vnode) {
  7969. const ctx = vnode.ctx;
  7970. if (ctx && ctx.ut) {
  7971. let node = vnode.children[0].el;
  7972. while (node !== vnode.targetAnchor) {
  7973. if (node.nodeType === 1)
  7974. node.setAttribute("data-v-owner", ctx.uid);
  7975. node = node.nextSibling;
  7976. }
  7977. ctx.ut();
  7978. }
  7979. }
  7980. const Fragment = Symbol.for("v-fgt");
  7981. const Text = Symbol.for("v-txt");
  7982. const Comment = Symbol.for("v-cmt");
  7983. const Static = Symbol.for("v-stc");
  7984. const blockStack = [];
  7985. let currentBlock = null;
  7986. function openBlock(disableTracking = false) {
  7987. blockStack.push(currentBlock = disableTracking ? null : []);
  7988. }
  7989. function closeBlock() {
  7990. blockStack.pop();
  7991. currentBlock = blockStack[blockStack.length - 1] || null;
  7992. }
  7993. let isBlockTreeEnabled = 1;
  7994. function setBlockTracking(value) {
  7995. isBlockTreeEnabled += value;
  7996. }
  7997. function setupBlock(vnode) {
  7998. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  7999. closeBlock();
  8000. if (isBlockTreeEnabled > 0 && currentBlock) {
  8001. currentBlock.push(vnode);
  8002. }
  8003. return vnode;
  8004. }
  8005. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  8006. return setupBlock(
  8007. createBaseVNode(
  8008. type,
  8009. props,
  8010. children,
  8011. patchFlag,
  8012. dynamicProps,
  8013. shapeFlag,
  8014. true
  8015. /* isBlock */
  8016. )
  8017. );
  8018. }
  8019. function createBlock(type, props, children, patchFlag, dynamicProps) {
  8020. return setupBlock(
  8021. createVNode(
  8022. type,
  8023. props,
  8024. children,
  8025. patchFlag,
  8026. dynamicProps,
  8027. true
  8028. /* isBlock: prevent a block from tracking itself */
  8029. )
  8030. );
  8031. }
  8032. function isVNode(value) {
  8033. return value ? value.__v_isVNode === true : false;
  8034. }
  8035. function isSameVNodeType(n1, n2) {
  8036. if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
  8037. n1.shapeFlag &= ~256;
  8038. n2.shapeFlag &= ~512;
  8039. return false;
  8040. }
  8041. return n1.type === n2.type && n1.key === n2.key;
  8042. }
  8043. let vnodeArgsTransformer;
  8044. function transformVNodeArgs(transformer) {
  8045. vnodeArgsTransformer = transformer;
  8046. }
  8047. const createVNodeWithArgsTransform = (...args) => {
  8048. return _createVNode(
  8049. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  8050. );
  8051. };
  8052. const InternalObjectKey = `__vInternal`;
  8053. const normalizeKey = ({ key }) => key != null ? key : null;
  8054. const normalizeRef = ({
  8055. ref,
  8056. ref_key,
  8057. ref_for
  8058. }) => {
  8059. if (typeof ref === "number") {
  8060. ref = "" + ref;
  8061. }
  8062. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  8063. };
  8064. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  8065. const vnode = {
  8066. __v_isVNode: true,
  8067. __v_skip: true,
  8068. type,
  8069. props,
  8070. key: props && normalizeKey(props),
  8071. ref: props && normalizeRef(props),
  8072. scopeId: currentScopeId,
  8073. slotScopeIds: null,
  8074. children,
  8075. component: null,
  8076. suspense: null,
  8077. ssContent: null,
  8078. ssFallback: null,
  8079. dirs: null,
  8080. transition: null,
  8081. el: null,
  8082. anchor: null,
  8083. target: null,
  8084. targetAnchor: null,
  8085. staticCount: 0,
  8086. shapeFlag,
  8087. patchFlag,
  8088. dynamicProps,
  8089. dynamicChildren: null,
  8090. appContext: null,
  8091. ctx: currentRenderingInstance
  8092. };
  8093. if (needFullChildrenNormalization) {
  8094. normalizeChildren(vnode, children);
  8095. if (shapeFlag & 128) {
  8096. type.normalize(vnode);
  8097. }
  8098. } else if (children) {
  8099. vnode.shapeFlag |= isString(children) ? 8 : 16;
  8100. }
  8101. if (vnode.key !== vnode.key) {
  8102. warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  8103. }
  8104. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  8105. !isBlockNode && // has current parent block
  8106. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  8107. // component nodes also should always be patched, because even if the
  8108. // component doesn't need to update, it needs to persist the instance on to
  8109. // the next vnode so that it can be properly unmounted later.
  8110. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  8111. // vnode should not be considered dynamic due to handler caching.
  8112. vnode.patchFlag !== 32) {
  8113. currentBlock.push(vnode);
  8114. }
  8115. return vnode;
  8116. }
  8117. const createVNode = createVNodeWithArgsTransform ;
  8118. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  8119. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  8120. if (!type) {
  8121. warn(`Invalid vnode type when creating vnode: ${type}.`);
  8122. }
  8123. type = Comment;
  8124. }
  8125. if (isVNode(type)) {
  8126. const cloned = cloneVNode(
  8127. type,
  8128. props,
  8129. true
  8130. /* mergeRef: true */
  8131. );
  8132. if (children) {
  8133. normalizeChildren(cloned, children);
  8134. }
  8135. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  8136. if (cloned.shapeFlag & 6) {
  8137. currentBlock[currentBlock.indexOf(type)] = cloned;
  8138. } else {
  8139. currentBlock.push(cloned);
  8140. }
  8141. }
  8142. cloned.patchFlag |= -2;
  8143. return cloned;
  8144. }
  8145. if (isClassComponent(type)) {
  8146. type = type.__vccOpts;
  8147. }
  8148. if (props) {
  8149. props = guardReactiveProps(props);
  8150. let { class: klass, style } = props;
  8151. if (klass && !isString(klass)) {
  8152. props.class = normalizeClass(klass);
  8153. }
  8154. if (isObject(style)) {
  8155. if (isProxy(style) && !isArray(style)) {
  8156. style = extend({}, style);
  8157. }
  8158. props.style = normalizeStyle(style);
  8159. }
  8160. }
  8161. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  8162. if (shapeFlag & 4 && isProxy(type)) {
  8163. type = toRaw(type);
  8164. warn(
  8165. `Vue received a Component which 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\`.`,
  8166. `
  8167. Component that was made reactive: `,
  8168. type
  8169. );
  8170. }
  8171. return createBaseVNode(
  8172. type,
  8173. props,
  8174. children,
  8175. patchFlag,
  8176. dynamicProps,
  8177. shapeFlag,
  8178. isBlockNode,
  8179. true
  8180. );
  8181. }
  8182. function guardReactiveProps(props) {
  8183. if (!props)
  8184. return null;
  8185. return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
  8186. }
  8187. function cloneVNode(vnode, extraProps, mergeRef = false) {
  8188. const { props, ref, patchFlag, children } = vnode;
  8189. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  8190. const cloned = {
  8191. __v_isVNode: true,
  8192. __v_skip: true,
  8193. type: vnode.type,
  8194. props: mergedProps,
  8195. key: mergedProps && normalizeKey(mergedProps),
  8196. ref: extraProps && extraProps.ref ? (
  8197. // #2078 in the case of <component :is="vnode" ref="extra"/>
  8198. // if the vnode itself already has a ref, cloneVNode will need to merge
  8199. // the refs so the single vnode can be set on multiple refs
  8200. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  8201. ) : ref,
  8202. scopeId: vnode.scopeId,
  8203. slotScopeIds: vnode.slotScopeIds,
  8204. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  8205. target: vnode.target,
  8206. targetAnchor: vnode.targetAnchor,
  8207. staticCount: vnode.staticCount,
  8208. shapeFlag: vnode.shapeFlag,
  8209. // if the vnode is cloned with extra props, we can no longer assume its
  8210. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  8211. // note: preserve flag for fragments since they use the flag for children
  8212. // fast paths only.
  8213. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  8214. dynamicProps: vnode.dynamicProps,
  8215. dynamicChildren: vnode.dynamicChildren,
  8216. appContext: vnode.appContext,
  8217. dirs: vnode.dirs,
  8218. transition: vnode.transition,
  8219. // These should technically only be non-null on mounted VNodes. However,
  8220. // they *should* be copied for kept-alive vnodes. So we just always copy
  8221. // them since them being non-null during a mount doesn't affect the logic as
  8222. // they will simply be overwritten.
  8223. component: vnode.component,
  8224. suspense: vnode.suspense,
  8225. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  8226. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  8227. el: vnode.el,
  8228. anchor: vnode.anchor,
  8229. ctx: vnode.ctx,
  8230. ce: vnode.ce
  8231. };
  8232. return cloned;
  8233. }
  8234. function deepCloneVNode(vnode) {
  8235. const cloned = cloneVNode(vnode);
  8236. if (isArray(vnode.children)) {
  8237. cloned.children = vnode.children.map(deepCloneVNode);
  8238. }
  8239. return cloned;
  8240. }
  8241. function createTextVNode(text = " ", flag = 0) {
  8242. return createVNode(Text, null, text, flag);
  8243. }
  8244. function createStaticVNode(content, numberOfNodes) {
  8245. const vnode = createVNode(Static, null, content);
  8246. vnode.staticCount = numberOfNodes;
  8247. return vnode;
  8248. }
  8249. function createCommentVNode(text = "", asBlock = false) {
  8250. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  8251. }
  8252. function normalizeVNode(child) {
  8253. if (child == null || typeof child === "boolean") {
  8254. return createVNode(Comment);
  8255. } else if (isArray(child)) {
  8256. return createVNode(
  8257. Fragment,
  8258. null,
  8259. // #3666, avoid reference pollution when reusing vnode
  8260. child.slice()
  8261. );
  8262. } else if (typeof child === "object") {
  8263. return cloneIfMounted(child);
  8264. } else {
  8265. return createVNode(Text, null, String(child));
  8266. }
  8267. }
  8268. function cloneIfMounted(child) {
  8269. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  8270. }
  8271. function normalizeChildren(vnode, children) {
  8272. let type = 0;
  8273. const { shapeFlag } = vnode;
  8274. if (children == null) {
  8275. children = null;
  8276. } else if (isArray(children)) {
  8277. type = 16;
  8278. } else if (typeof children === "object") {
  8279. if (shapeFlag & (1 | 64)) {
  8280. const slot = children.default;
  8281. if (slot) {
  8282. slot._c && (slot._d = false);
  8283. normalizeChildren(vnode, slot());
  8284. slot._c && (slot._d = true);
  8285. }
  8286. return;
  8287. } else {
  8288. type = 32;
  8289. const slotFlag = children._;
  8290. if (!slotFlag && !(InternalObjectKey in children)) {
  8291. children._ctx = currentRenderingInstance;
  8292. } else if (slotFlag === 3 && currentRenderingInstance) {
  8293. if (currentRenderingInstance.slots._ === 1) {
  8294. children._ = 1;
  8295. } else {
  8296. children._ = 2;
  8297. vnode.patchFlag |= 1024;
  8298. }
  8299. }
  8300. }
  8301. } else if (isFunction(children)) {
  8302. children = { default: children, _ctx: currentRenderingInstance };
  8303. type = 32;
  8304. } else {
  8305. children = String(children);
  8306. if (shapeFlag & 64) {
  8307. type = 16;
  8308. children = [createTextVNode(children)];
  8309. } else {
  8310. type = 8;
  8311. }
  8312. }
  8313. vnode.children = children;
  8314. vnode.shapeFlag |= type;
  8315. }
  8316. function mergeProps(...args) {
  8317. const ret = {};
  8318. for (let i = 0; i < args.length; i++) {
  8319. const toMerge = args[i];
  8320. for (const key in toMerge) {
  8321. if (key === "class") {
  8322. if (ret.class !== toMerge.class) {
  8323. ret.class = normalizeClass([ret.class, toMerge.class]);
  8324. }
  8325. } else if (key === "style") {
  8326. ret.style = normalizeStyle([ret.style, toMerge.style]);
  8327. } else if (isOn(key)) {
  8328. const existing = ret[key];
  8329. const incoming = toMerge[key];
  8330. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  8331. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  8332. }
  8333. } else if (key !== "") {
  8334. ret[key] = toMerge[key];
  8335. }
  8336. }
  8337. }
  8338. return ret;
  8339. }
  8340. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  8341. callWithAsyncErrorHandling(hook, instance, 7, [
  8342. vnode,
  8343. prevVNode
  8344. ]);
  8345. }
  8346. const emptyAppContext = createAppContext();
  8347. let uid = 0;
  8348. function createComponentInstance(vnode, parent, suspense) {
  8349. const type = vnode.type;
  8350. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  8351. const instance = {
  8352. uid: uid++,
  8353. vnode,
  8354. type,
  8355. parent,
  8356. appContext,
  8357. root: null,
  8358. // to be immediately set
  8359. next: null,
  8360. subTree: null,
  8361. // will be set synchronously right after creation
  8362. effect: null,
  8363. update: null,
  8364. // will be set synchronously right after creation
  8365. scope: new EffectScope(
  8366. true
  8367. /* detached */
  8368. ),
  8369. render: null,
  8370. proxy: null,
  8371. exposed: null,
  8372. exposeProxy: null,
  8373. withProxy: null,
  8374. provides: parent ? parent.provides : Object.create(appContext.provides),
  8375. accessCache: null,
  8376. renderCache: [],
  8377. // local resolved assets
  8378. components: null,
  8379. directives: null,
  8380. // resolved props and emits options
  8381. propsOptions: normalizePropsOptions(type, appContext),
  8382. emitsOptions: normalizeEmitsOptions(type, appContext),
  8383. // emit
  8384. emit: null,
  8385. // to be set immediately
  8386. emitted: null,
  8387. // props default value
  8388. propsDefaults: EMPTY_OBJ,
  8389. // inheritAttrs
  8390. inheritAttrs: type.inheritAttrs,
  8391. // state
  8392. ctx: EMPTY_OBJ,
  8393. data: EMPTY_OBJ,
  8394. props: EMPTY_OBJ,
  8395. attrs: EMPTY_OBJ,
  8396. slots: EMPTY_OBJ,
  8397. refs: EMPTY_OBJ,
  8398. setupState: EMPTY_OBJ,
  8399. setupContext: null,
  8400. attrsProxy: null,
  8401. slotsProxy: null,
  8402. // suspense related
  8403. suspense,
  8404. suspenseId: suspense ? suspense.pendingId : 0,
  8405. asyncDep: null,
  8406. asyncResolved: false,
  8407. // lifecycle hooks
  8408. // not using enums here because it results in computed properties
  8409. isMounted: false,
  8410. isUnmounted: false,
  8411. isDeactivated: false,
  8412. bc: null,
  8413. c: null,
  8414. bm: null,
  8415. m: null,
  8416. bu: null,
  8417. u: null,
  8418. um: null,
  8419. bum: null,
  8420. da: null,
  8421. a: null,
  8422. rtg: null,
  8423. rtc: null,
  8424. ec: null,
  8425. sp: null
  8426. };
  8427. {
  8428. instance.ctx = createDevRenderContext(instance);
  8429. }
  8430. instance.root = parent ? parent.root : instance;
  8431. instance.emit = emit.bind(null, instance);
  8432. if (vnode.ce) {
  8433. vnode.ce(instance);
  8434. }
  8435. return instance;
  8436. }
  8437. let currentInstance = null;
  8438. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  8439. let internalSetCurrentInstance;
  8440. {
  8441. internalSetCurrentInstance = (i) => {
  8442. currentInstance = i;
  8443. };
  8444. }
  8445. const setCurrentInstance = (instance) => {
  8446. internalSetCurrentInstance(instance);
  8447. instance.scope.on();
  8448. };
  8449. const unsetCurrentInstance = () => {
  8450. currentInstance && currentInstance.scope.off();
  8451. internalSetCurrentInstance(null);
  8452. };
  8453. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  8454. function validateComponentName(name, config) {
  8455. const appIsNativeTag = config.isNativeTag || NO;
  8456. if (isBuiltInTag(name) || appIsNativeTag(name)) {
  8457. warn(
  8458. "Do not use built-in or reserved HTML elements as component id: " + name
  8459. );
  8460. }
  8461. }
  8462. function isStatefulComponent(instance) {
  8463. return instance.vnode.shapeFlag & 4;
  8464. }
  8465. let isInSSRComponentSetup = false;
  8466. function setupComponent(instance, isSSR = false) {
  8467. isInSSRComponentSetup = isSSR;
  8468. const { props, children } = instance.vnode;
  8469. const isStateful = isStatefulComponent(instance);
  8470. initProps(instance, props, isStateful, isSSR);
  8471. initSlots(instance, children);
  8472. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  8473. isInSSRComponentSetup = false;
  8474. return setupResult;
  8475. }
  8476. function setupStatefulComponent(instance, isSSR) {
  8477. var _a;
  8478. const Component = instance.type;
  8479. {
  8480. if (Component.name) {
  8481. validateComponentName(Component.name, instance.appContext.config);
  8482. }
  8483. if (Component.components) {
  8484. const names = Object.keys(Component.components);
  8485. for (let i = 0; i < names.length; i++) {
  8486. validateComponentName(names[i], instance.appContext.config);
  8487. }
  8488. }
  8489. if (Component.directives) {
  8490. const names = Object.keys(Component.directives);
  8491. for (let i = 0; i < names.length; i++) {
  8492. validateDirectiveName(names[i]);
  8493. }
  8494. }
  8495. if (Component.compilerOptions && isRuntimeOnly()) {
  8496. warn(
  8497. `"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.`
  8498. );
  8499. }
  8500. }
  8501. instance.accessCache = /* @__PURE__ */ Object.create(null);
  8502. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  8503. {
  8504. exposePropsOnRenderContext(instance);
  8505. }
  8506. const { setup } = Component;
  8507. if (setup) {
  8508. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  8509. setCurrentInstance(instance);
  8510. pauseTracking();
  8511. const setupResult = callWithErrorHandling(
  8512. setup,
  8513. instance,
  8514. 0,
  8515. [shallowReadonly(instance.props) , setupContext]
  8516. );
  8517. resetTracking();
  8518. unsetCurrentInstance();
  8519. if (isPromise(setupResult)) {
  8520. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  8521. if (isSSR) {
  8522. return setupResult.then((resolvedResult) => {
  8523. handleSetupResult(instance, resolvedResult, isSSR);
  8524. }).catch((e) => {
  8525. handleError(e, instance, 0);
  8526. });
  8527. } else {
  8528. instance.asyncDep = setupResult;
  8529. if (!instance.suspense) {
  8530. const name = (_a = Component.name) != null ? _a : "Anonymous";
  8531. warn(
  8532. `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.`
  8533. );
  8534. }
  8535. }
  8536. } else {
  8537. handleSetupResult(instance, setupResult, isSSR);
  8538. }
  8539. } else {
  8540. finishComponentSetup(instance, isSSR);
  8541. }
  8542. }
  8543. function handleSetupResult(instance, setupResult, isSSR) {
  8544. if (isFunction(setupResult)) {
  8545. {
  8546. instance.render = setupResult;
  8547. }
  8548. } else if (isObject(setupResult)) {
  8549. if (isVNode(setupResult)) {
  8550. warn(
  8551. `setup() should not return VNodes directly - return a render function instead.`
  8552. );
  8553. }
  8554. {
  8555. instance.devtoolsRawSetupState = setupResult;
  8556. }
  8557. instance.setupState = proxyRefs(setupResult);
  8558. {
  8559. exposeSetupStateOnRenderContext(instance);
  8560. }
  8561. } else if (setupResult !== void 0) {
  8562. warn(
  8563. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  8564. );
  8565. }
  8566. finishComponentSetup(instance, isSSR);
  8567. }
  8568. let compile$1;
  8569. let installWithProxy;
  8570. function registerRuntimeCompiler(_compile) {
  8571. compile$1 = _compile;
  8572. installWithProxy = (i) => {
  8573. if (i.render._rc) {
  8574. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  8575. }
  8576. };
  8577. }
  8578. const isRuntimeOnly = () => !compile$1;
  8579. function finishComponentSetup(instance, isSSR, skipOptions) {
  8580. const Component = instance.type;
  8581. if (!instance.render) {
  8582. if (!isSSR && compile$1 && !Component.render) {
  8583. const template = Component.template || resolveMergedOptions(instance).template;
  8584. if (template) {
  8585. {
  8586. startMeasure(instance, `compile`);
  8587. }
  8588. const { isCustomElement, compilerOptions } = instance.appContext.config;
  8589. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  8590. const finalCompilerOptions = extend(
  8591. extend(
  8592. {
  8593. isCustomElement,
  8594. delimiters
  8595. },
  8596. compilerOptions
  8597. ),
  8598. componentCompilerOptions
  8599. );
  8600. Component.render = compile$1(template, finalCompilerOptions);
  8601. {
  8602. endMeasure(instance, `compile`);
  8603. }
  8604. }
  8605. }
  8606. instance.render = Component.render || NOOP;
  8607. if (installWithProxy) {
  8608. installWithProxy(instance);
  8609. }
  8610. }
  8611. {
  8612. setCurrentInstance(instance);
  8613. pauseTracking();
  8614. applyOptions(instance);
  8615. resetTracking();
  8616. unsetCurrentInstance();
  8617. }
  8618. if (!Component.render && instance.render === NOOP && !isSSR) {
  8619. if (!compile$1 && Component.template) {
  8620. warn(
  8621. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
  8622. /* should not happen */
  8623. );
  8624. } else {
  8625. warn(`Component is missing template or render function.`);
  8626. }
  8627. }
  8628. }
  8629. function getAttrsProxy(instance) {
  8630. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  8631. instance.attrs,
  8632. {
  8633. get(target, key) {
  8634. markAttrsAccessed();
  8635. track(instance, "get", "$attrs");
  8636. return target[key];
  8637. },
  8638. set() {
  8639. warn(`setupContext.attrs is readonly.`);
  8640. return false;
  8641. },
  8642. deleteProperty() {
  8643. warn(`setupContext.attrs is readonly.`);
  8644. return false;
  8645. }
  8646. }
  8647. ));
  8648. }
  8649. function getSlotsProxy(instance) {
  8650. return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
  8651. get(target, key) {
  8652. track(instance, "get", "$slots");
  8653. return target[key];
  8654. }
  8655. }));
  8656. }
  8657. function createSetupContext(instance) {
  8658. const expose = (exposed) => {
  8659. {
  8660. if (instance.exposed) {
  8661. warn(`expose() should be called only once per setup().`);
  8662. }
  8663. if (exposed != null) {
  8664. let exposedType = typeof exposed;
  8665. if (exposedType === "object") {
  8666. if (isArray(exposed)) {
  8667. exposedType = "array";
  8668. } else if (isRef(exposed)) {
  8669. exposedType = "ref";
  8670. }
  8671. }
  8672. if (exposedType !== "object") {
  8673. warn(
  8674. `expose() should be passed a plain object, received ${exposedType}.`
  8675. );
  8676. }
  8677. }
  8678. }
  8679. instance.exposed = exposed || {};
  8680. };
  8681. {
  8682. return Object.freeze({
  8683. get attrs() {
  8684. return getAttrsProxy(instance);
  8685. },
  8686. get slots() {
  8687. return getSlotsProxy(instance);
  8688. },
  8689. get emit() {
  8690. return (event, ...args) => instance.emit(event, ...args);
  8691. },
  8692. expose
  8693. });
  8694. }
  8695. }
  8696. function getExposeProxy(instance) {
  8697. if (instance.exposed) {
  8698. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  8699. get(target, key) {
  8700. if (key in target) {
  8701. return target[key];
  8702. } else if (key in publicPropertiesMap) {
  8703. return publicPropertiesMap[key](instance);
  8704. }
  8705. },
  8706. has(target, key) {
  8707. return key in target || key in publicPropertiesMap;
  8708. }
  8709. }));
  8710. }
  8711. }
  8712. const classifyRE = /(?:^|[-_])(\w)/g;
  8713. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  8714. function getComponentName(Component, includeInferred = true) {
  8715. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  8716. }
  8717. function formatComponentName(instance, Component, isRoot = false) {
  8718. let name = getComponentName(Component);
  8719. if (!name && Component.__file) {
  8720. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  8721. if (match) {
  8722. name = match[1];
  8723. }
  8724. }
  8725. if (!name && instance && instance.parent) {
  8726. const inferFromRegistry = (registry) => {
  8727. for (const key in registry) {
  8728. if (registry[key] === Component) {
  8729. return key;
  8730. }
  8731. }
  8732. };
  8733. name = inferFromRegistry(
  8734. instance.components || instance.parent.type.components
  8735. ) || inferFromRegistry(instance.appContext.components);
  8736. }
  8737. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  8738. }
  8739. function isClassComponent(value) {
  8740. return isFunction(value) && "__vccOpts" in value;
  8741. }
  8742. const computed = (getterOrOptions, debugOptions) => {
  8743. return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  8744. };
  8745. function h(type, propsOrChildren, children) {
  8746. const l = arguments.length;
  8747. if (l === 2) {
  8748. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  8749. if (isVNode(propsOrChildren)) {
  8750. return createVNode(type, null, [propsOrChildren]);
  8751. }
  8752. return createVNode(type, propsOrChildren);
  8753. } else {
  8754. return createVNode(type, null, propsOrChildren);
  8755. }
  8756. } else {
  8757. if (l > 3) {
  8758. children = Array.prototype.slice.call(arguments, 2);
  8759. } else if (l === 3 && isVNode(children)) {
  8760. children = [children];
  8761. }
  8762. return createVNode(type, propsOrChildren, children);
  8763. }
  8764. }
  8765. const ssrContextKey = Symbol.for("v-scx");
  8766. const useSSRContext = () => {
  8767. {
  8768. warn(`useSSRContext() is not supported in the global build.`);
  8769. }
  8770. };
  8771. function initCustomFormatter() {
  8772. if (typeof window === "undefined") {
  8773. return;
  8774. }
  8775. const vueStyle = { style: "color:#3ba776" };
  8776. const numberStyle = { style: "color:#0b1bc9" };
  8777. const stringStyle = { style: "color:#b62e24" };
  8778. const keywordStyle = { style: "color:#9d288c" };
  8779. const formatter = {
  8780. header(obj) {
  8781. if (!isObject(obj)) {
  8782. return null;
  8783. }
  8784. if (obj.__isVue) {
  8785. return ["div", vueStyle, `VueInstance`];
  8786. } else if (isRef(obj)) {
  8787. return [
  8788. "div",
  8789. {},
  8790. ["span", vueStyle, genRefFlag(obj)],
  8791. "<",
  8792. formatValue(obj.value),
  8793. `>`
  8794. ];
  8795. } else if (isReactive(obj)) {
  8796. return [
  8797. "div",
  8798. {},
  8799. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  8800. "<",
  8801. formatValue(obj),
  8802. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  8803. ];
  8804. } else if (isReadonly(obj)) {
  8805. return [
  8806. "div",
  8807. {},
  8808. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  8809. "<",
  8810. formatValue(obj),
  8811. ">"
  8812. ];
  8813. }
  8814. return null;
  8815. },
  8816. hasBody(obj) {
  8817. return obj && obj.__isVue;
  8818. },
  8819. body(obj) {
  8820. if (obj && obj.__isVue) {
  8821. return [
  8822. "div",
  8823. {},
  8824. ...formatInstance(obj.$)
  8825. ];
  8826. }
  8827. }
  8828. };
  8829. function formatInstance(instance) {
  8830. const blocks = [];
  8831. if (instance.type.props && instance.props) {
  8832. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  8833. }
  8834. if (instance.setupState !== EMPTY_OBJ) {
  8835. blocks.push(createInstanceBlock("setup", instance.setupState));
  8836. }
  8837. if (instance.data !== EMPTY_OBJ) {
  8838. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  8839. }
  8840. const computed = extractKeys(instance, "computed");
  8841. if (computed) {
  8842. blocks.push(createInstanceBlock("computed", computed));
  8843. }
  8844. const injected = extractKeys(instance, "inject");
  8845. if (injected) {
  8846. blocks.push(createInstanceBlock("injected", injected));
  8847. }
  8848. blocks.push([
  8849. "div",
  8850. {},
  8851. [
  8852. "span",
  8853. {
  8854. style: keywordStyle.style + ";opacity:0.66"
  8855. },
  8856. "$ (internal): "
  8857. ],
  8858. ["object", { object: instance }]
  8859. ]);
  8860. return blocks;
  8861. }
  8862. function createInstanceBlock(type, target) {
  8863. target = extend({}, target);
  8864. if (!Object.keys(target).length) {
  8865. return ["span", {}];
  8866. }
  8867. return [
  8868. "div",
  8869. { style: "line-height:1.25em;margin-bottom:0.6em" },
  8870. [
  8871. "div",
  8872. {
  8873. style: "color:#476582"
  8874. },
  8875. type
  8876. ],
  8877. [
  8878. "div",
  8879. {
  8880. style: "padding-left:1.25em"
  8881. },
  8882. ...Object.keys(target).map((key) => {
  8883. return [
  8884. "div",
  8885. {},
  8886. ["span", keywordStyle, key + ": "],
  8887. formatValue(target[key], false)
  8888. ];
  8889. })
  8890. ]
  8891. ];
  8892. }
  8893. function formatValue(v, asRaw = true) {
  8894. if (typeof v === "number") {
  8895. return ["span", numberStyle, v];
  8896. } else if (typeof v === "string") {
  8897. return ["span", stringStyle, JSON.stringify(v)];
  8898. } else if (typeof v === "boolean") {
  8899. return ["span", keywordStyle, v];
  8900. } else if (isObject(v)) {
  8901. return ["object", { object: asRaw ? toRaw(v) : v }];
  8902. } else {
  8903. return ["span", stringStyle, String(v)];
  8904. }
  8905. }
  8906. function extractKeys(instance, type) {
  8907. const Comp = instance.type;
  8908. if (isFunction(Comp)) {
  8909. return;
  8910. }
  8911. const extracted = {};
  8912. for (const key in instance.ctx) {
  8913. if (isKeyOfType(Comp, key, type)) {
  8914. extracted[key] = instance.ctx[key];
  8915. }
  8916. }
  8917. return extracted;
  8918. }
  8919. function isKeyOfType(Comp, key, type) {
  8920. const opts = Comp[type];
  8921. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  8922. return true;
  8923. }
  8924. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  8925. return true;
  8926. }
  8927. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  8928. return true;
  8929. }
  8930. }
  8931. function genRefFlag(v) {
  8932. if (isShallow(v)) {
  8933. return `ShallowRef`;
  8934. }
  8935. if (v.effect) {
  8936. return `ComputedRef`;
  8937. }
  8938. return `Ref`;
  8939. }
  8940. if (window.devtoolsFormatters) {
  8941. window.devtoolsFormatters.push(formatter);
  8942. } else {
  8943. window.devtoolsFormatters = [formatter];
  8944. }
  8945. }
  8946. function withMemo(memo, render, cache, index) {
  8947. const cached = cache[index];
  8948. if (cached && isMemoSame(cached, memo)) {
  8949. return cached;
  8950. }
  8951. const ret = render();
  8952. ret.memo = memo.slice();
  8953. return cache[index] = ret;
  8954. }
  8955. function isMemoSame(cached, memo) {
  8956. const prev = cached.memo;
  8957. if (prev.length != memo.length) {
  8958. return false;
  8959. }
  8960. for (let i = 0; i < prev.length; i++) {
  8961. if (hasChanged(prev[i], memo[i])) {
  8962. return false;
  8963. }
  8964. }
  8965. if (isBlockTreeEnabled > 0 && currentBlock) {
  8966. currentBlock.push(cached);
  8967. }
  8968. return true;
  8969. }
  8970. const version = "3.3.4";
  8971. const ssrUtils = null;
  8972. const resolveFilter = null;
  8973. const compatUtils = null;
  8974. const svgNS = "http://www.w3.org/2000/svg";
  8975. const doc = typeof document !== "undefined" ? document : null;
  8976. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  8977. const nodeOps = {
  8978. insert: (child, parent, anchor) => {
  8979. parent.insertBefore(child, anchor || null);
  8980. },
  8981. remove: (child) => {
  8982. const parent = child.parentNode;
  8983. if (parent) {
  8984. parent.removeChild(child);
  8985. }
  8986. },
  8987. createElement: (tag, isSVG, is, props) => {
  8988. const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0);
  8989. if (tag === "select" && props && props.multiple != null) {
  8990. el.setAttribute("multiple", props.multiple);
  8991. }
  8992. return el;
  8993. },
  8994. createText: (text) => doc.createTextNode(text),
  8995. createComment: (text) => doc.createComment(text),
  8996. setText: (node, text) => {
  8997. node.nodeValue = text;
  8998. },
  8999. setElementText: (el, text) => {
  9000. el.textContent = text;
  9001. },
  9002. parentNode: (node) => node.parentNode,
  9003. nextSibling: (node) => node.nextSibling,
  9004. querySelector: (selector) => doc.querySelector(selector),
  9005. setScopeId(el, id) {
  9006. el.setAttribute(id, "");
  9007. },
  9008. // __UNSAFE__
  9009. // Reason: innerHTML.
  9010. // Static content here can only come from compiled templates.
  9011. // As long as the user only uses trusted templates, this is safe.
  9012. insertStaticContent(content, parent, anchor, isSVG, start, end) {
  9013. const before = anchor ? anchor.previousSibling : parent.lastChild;
  9014. if (start && (start === end || start.nextSibling)) {
  9015. while (true) {
  9016. parent.insertBefore(start.cloneNode(true), anchor);
  9017. if (start === end || !(start = start.nextSibling))
  9018. break;
  9019. }
  9020. } else {
  9021. templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
  9022. const template = templateContainer.content;
  9023. if (isSVG) {
  9024. const wrapper = template.firstChild;
  9025. while (wrapper.firstChild) {
  9026. template.appendChild(wrapper.firstChild);
  9027. }
  9028. template.removeChild(wrapper);
  9029. }
  9030. parent.insertBefore(template, anchor);
  9031. }
  9032. return [
  9033. // first
  9034. before ? before.nextSibling : parent.firstChild,
  9035. // last
  9036. anchor ? anchor.previousSibling : parent.lastChild
  9037. ];
  9038. }
  9039. };
  9040. function patchClass(el, value, isSVG) {
  9041. const transitionClasses = el._vtc;
  9042. if (transitionClasses) {
  9043. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  9044. }
  9045. if (value == null) {
  9046. el.removeAttribute("class");
  9047. } else if (isSVG) {
  9048. el.setAttribute("class", value);
  9049. } else {
  9050. el.className = value;
  9051. }
  9052. }
  9053. function patchStyle(el, prev, next) {
  9054. const style = el.style;
  9055. const isCssString = isString(next);
  9056. if (next && !isCssString) {
  9057. if (prev && !isString(prev)) {
  9058. for (const key in prev) {
  9059. if (next[key] == null) {
  9060. setStyle(style, key, "");
  9061. }
  9062. }
  9063. }
  9064. for (const key in next) {
  9065. setStyle(style, key, next[key]);
  9066. }
  9067. } else {
  9068. const currentDisplay = style.display;
  9069. if (isCssString) {
  9070. if (prev !== next) {
  9071. style.cssText = next;
  9072. }
  9073. } else if (prev) {
  9074. el.removeAttribute("style");
  9075. }
  9076. if ("_vod" in el) {
  9077. style.display = currentDisplay;
  9078. }
  9079. }
  9080. }
  9081. const semicolonRE = /[^\\];\s*$/;
  9082. const importantRE = /\s*!important$/;
  9083. function setStyle(style, name, val) {
  9084. if (isArray(val)) {
  9085. val.forEach((v) => setStyle(style, name, v));
  9086. } else {
  9087. if (val == null)
  9088. val = "";
  9089. {
  9090. if (semicolonRE.test(val)) {
  9091. warn(
  9092. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  9093. );
  9094. }
  9095. }
  9096. if (name.startsWith("--")) {
  9097. style.setProperty(name, val);
  9098. } else {
  9099. const prefixed = autoPrefix(style, name);
  9100. if (importantRE.test(val)) {
  9101. style.setProperty(
  9102. hyphenate(prefixed),
  9103. val.replace(importantRE, ""),
  9104. "important"
  9105. );
  9106. } else {
  9107. style[prefixed] = val;
  9108. }
  9109. }
  9110. }
  9111. }
  9112. const prefixes = ["Webkit", "Moz", "ms"];
  9113. const prefixCache = {};
  9114. function autoPrefix(style, rawName) {
  9115. const cached = prefixCache[rawName];
  9116. if (cached) {
  9117. return cached;
  9118. }
  9119. let name = camelize(rawName);
  9120. if (name !== "filter" && name in style) {
  9121. return prefixCache[rawName] = name;
  9122. }
  9123. name = capitalize(name);
  9124. for (let i = 0; i < prefixes.length; i++) {
  9125. const prefixed = prefixes[i] + name;
  9126. if (prefixed in style) {
  9127. return prefixCache[rawName] = prefixed;
  9128. }
  9129. }
  9130. return rawName;
  9131. }
  9132. const xlinkNS = "http://www.w3.org/1999/xlink";
  9133. function patchAttr(el, key, value, isSVG, instance) {
  9134. if (isSVG && key.startsWith("xlink:")) {
  9135. if (value == null) {
  9136. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  9137. } else {
  9138. el.setAttributeNS(xlinkNS, key, value);
  9139. }
  9140. } else {
  9141. const isBoolean = isSpecialBooleanAttr(key);
  9142. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  9143. el.removeAttribute(key);
  9144. } else {
  9145. el.setAttribute(key, isBoolean ? "" : value);
  9146. }
  9147. }
  9148. }
  9149. function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
  9150. if (key === "innerHTML" || key === "textContent") {
  9151. if (prevChildren) {
  9152. unmountChildren(prevChildren, parentComponent, parentSuspense);
  9153. }
  9154. el[key] = value == null ? "" : value;
  9155. return;
  9156. }
  9157. const tag = el.tagName;
  9158. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  9159. !tag.includes("-")) {
  9160. el._value = value;
  9161. const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
  9162. const newValue = value == null ? "" : value;
  9163. if (oldValue !== newValue) {
  9164. el.value = newValue;
  9165. }
  9166. if (value == null) {
  9167. el.removeAttribute(key);
  9168. }
  9169. return;
  9170. }
  9171. let needRemove = false;
  9172. if (value === "" || value == null) {
  9173. const type = typeof el[key];
  9174. if (type === "boolean") {
  9175. value = includeBooleanAttr(value);
  9176. } else if (value == null && type === "string") {
  9177. value = "";
  9178. needRemove = true;
  9179. } else if (type === "number") {
  9180. value = 0;
  9181. needRemove = true;
  9182. }
  9183. }
  9184. try {
  9185. el[key] = value;
  9186. } catch (e) {
  9187. if (!needRemove) {
  9188. warn(
  9189. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  9190. e
  9191. );
  9192. }
  9193. }
  9194. needRemove && el.removeAttribute(key);
  9195. }
  9196. function addEventListener(el, event, handler, options) {
  9197. el.addEventListener(event, handler, options);
  9198. }
  9199. function removeEventListener(el, event, handler, options) {
  9200. el.removeEventListener(event, handler, options);
  9201. }
  9202. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  9203. const invokers = el._vei || (el._vei = {});
  9204. const existingInvoker = invokers[rawName];
  9205. if (nextValue && existingInvoker) {
  9206. existingInvoker.value = nextValue;
  9207. } else {
  9208. const [name, options] = parseName(rawName);
  9209. if (nextValue) {
  9210. const invoker = invokers[rawName] = createInvoker(nextValue, instance);
  9211. addEventListener(el, name, invoker, options);
  9212. } else if (existingInvoker) {
  9213. removeEventListener(el, name, existingInvoker, options);
  9214. invokers[rawName] = void 0;
  9215. }
  9216. }
  9217. }
  9218. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  9219. function parseName(name) {
  9220. let options;
  9221. if (optionsModifierRE.test(name)) {
  9222. options = {};
  9223. let m;
  9224. while (m = name.match(optionsModifierRE)) {
  9225. name = name.slice(0, name.length - m[0].length);
  9226. options[m[0].toLowerCase()] = true;
  9227. }
  9228. }
  9229. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  9230. return [event, options];
  9231. }
  9232. let cachedNow = 0;
  9233. const p = /* @__PURE__ */ Promise.resolve();
  9234. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  9235. function createInvoker(initialValue, instance) {
  9236. const invoker = (e) => {
  9237. if (!e._vts) {
  9238. e._vts = Date.now();
  9239. } else if (e._vts <= invoker.attached) {
  9240. return;
  9241. }
  9242. callWithAsyncErrorHandling(
  9243. patchStopImmediatePropagation(e, invoker.value),
  9244. instance,
  9245. 5,
  9246. [e]
  9247. );
  9248. };
  9249. invoker.value = initialValue;
  9250. invoker.attached = getNow();
  9251. return invoker;
  9252. }
  9253. function patchStopImmediatePropagation(e, value) {
  9254. if (isArray(value)) {
  9255. const originalStop = e.stopImmediatePropagation;
  9256. e.stopImmediatePropagation = () => {
  9257. originalStop.call(e);
  9258. e._stopped = true;
  9259. };
  9260. return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
  9261. } else {
  9262. return value;
  9263. }
  9264. }
  9265. const nativeOnRE = /^on[a-z]/;
  9266. const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
  9267. if (key === "class") {
  9268. patchClass(el, nextValue, isSVG);
  9269. } else if (key === "style") {
  9270. patchStyle(el, prevValue, nextValue);
  9271. } else if (isOn(key)) {
  9272. if (!isModelListener(key)) {
  9273. patchEvent(el, key, prevValue, nextValue, parentComponent);
  9274. }
  9275. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  9276. patchDOMProp(
  9277. el,
  9278. key,
  9279. nextValue,
  9280. prevChildren,
  9281. parentComponent,
  9282. parentSuspense,
  9283. unmountChildren
  9284. );
  9285. } else {
  9286. if (key === "true-value") {
  9287. el._trueValue = nextValue;
  9288. } else if (key === "false-value") {
  9289. el._falseValue = nextValue;
  9290. }
  9291. patchAttr(el, key, nextValue, isSVG);
  9292. }
  9293. };
  9294. function shouldSetAsProp(el, key, value, isSVG) {
  9295. if (isSVG) {
  9296. if (key === "innerHTML" || key === "textContent") {
  9297. return true;
  9298. }
  9299. if (key in el && nativeOnRE.test(key) && isFunction(value)) {
  9300. return true;
  9301. }
  9302. return false;
  9303. }
  9304. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  9305. return false;
  9306. }
  9307. if (key === "form") {
  9308. return false;
  9309. }
  9310. if (key === "list" && el.tagName === "INPUT") {
  9311. return false;
  9312. }
  9313. if (key === "type" && el.tagName === "TEXTAREA") {
  9314. return false;
  9315. }
  9316. if (nativeOnRE.test(key) && isString(value)) {
  9317. return false;
  9318. }
  9319. return key in el;
  9320. }
  9321. function defineCustomElement(options, hydrate2) {
  9322. const Comp = defineComponent(options);
  9323. class VueCustomElement extends VueElement {
  9324. constructor(initialProps) {
  9325. super(Comp, initialProps, hydrate2);
  9326. }
  9327. }
  9328. VueCustomElement.def = Comp;
  9329. return VueCustomElement;
  9330. }
  9331. const defineSSRCustomElement = (options) => {
  9332. return defineCustomElement(options, hydrate);
  9333. };
  9334. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  9335. };
  9336. class VueElement extends BaseClass {
  9337. constructor(_def, _props = {}, hydrate2) {
  9338. super();
  9339. this._def = _def;
  9340. this._props = _props;
  9341. /**
  9342. * @internal
  9343. */
  9344. this._instance = null;
  9345. this._connected = false;
  9346. this._resolved = false;
  9347. this._numberProps = null;
  9348. if (this.shadowRoot && hydrate2) {
  9349. hydrate2(this._createVNode(), this.shadowRoot);
  9350. } else {
  9351. if (this.shadowRoot) {
  9352. warn(
  9353. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  9354. );
  9355. }
  9356. this.attachShadow({ mode: "open" });
  9357. if (!this._def.__asyncLoader) {
  9358. this._resolveProps(this._def);
  9359. }
  9360. }
  9361. }
  9362. connectedCallback() {
  9363. this._connected = true;
  9364. if (!this._instance) {
  9365. if (this._resolved) {
  9366. this._update();
  9367. } else {
  9368. this._resolveDef();
  9369. }
  9370. }
  9371. }
  9372. disconnectedCallback() {
  9373. this._connected = false;
  9374. nextTick(() => {
  9375. if (!this._connected) {
  9376. render(null, this.shadowRoot);
  9377. this._instance = null;
  9378. }
  9379. });
  9380. }
  9381. /**
  9382. * resolve inner component definition (handle possible async component)
  9383. */
  9384. _resolveDef() {
  9385. this._resolved = true;
  9386. for (let i = 0; i < this.attributes.length; i++) {
  9387. this._setAttr(this.attributes[i].name);
  9388. }
  9389. new MutationObserver((mutations) => {
  9390. for (const m of mutations) {
  9391. this._setAttr(m.attributeName);
  9392. }
  9393. }).observe(this, { attributes: true });
  9394. const resolve = (def, isAsync = false) => {
  9395. const { props, styles } = def;
  9396. let numberProps;
  9397. if (props && !isArray(props)) {
  9398. for (const key in props) {
  9399. const opt = props[key];
  9400. if (opt === Number || opt && opt.type === Number) {
  9401. if (key in this._props) {
  9402. this._props[key] = toNumber(this._props[key]);
  9403. }
  9404. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  9405. }
  9406. }
  9407. }
  9408. this._numberProps = numberProps;
  9409. if (isAsync) {
  9410. this._resolveProps(def);
  9411. }
  9412. this._applyStyles(styles);
  9413. this._update();
  9414. };
  9415. const asyncDef = this._def.__asyncLoader;
  9416. if (asyncDef) {
  9417. asyncDef().then((def) => resolve(def, true));
  9418. } else {
  9419. resolve(this._def);
  9420. }
  9421. }
  9422. _resolveProps(def) {
  9423. const { props } = def;
  9424. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  9425. for (const key of Object.keys(this)) {
  9426. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  9427. this._setProp(key, this[key], true, false);
  9428. }
  9429. }
  9430. for (const key of declaredPropKeys.map(camelize)) {
  9431. Object.defineProperty(this, key, {
  9432. get() {
  9433. return this._getProp(key);
  9434. },
  9435. set(val) {
  9436. this._setProp(key, val);
  9437. }
  9438. });
  9439. }
  9440. }
  9441. _setAttr(key) {
  9442. let value = this.getAttribute(key);
  9443. const camelKey = camelize(key);
  9444. if (this._numberProps && this._numberProps[camelKey]) {
  9445. value = toNumber(value);
  9446. }
  9447. this._setProp(camelKey, value, false);
  9448. }
  9449. /**
  9450. * @internal
  9451. */
  9452. _getProp(key) {
  9453. return this._props[key];
  9454. }
  9455. /**
  9456. * @internal
  9457. */
  9458. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  9459. if (val !== this._props[key]) {
  9460. this._props[key] = val;
  9461. if (shouldUpdate && this._instance) {
  9462. this._update();
  9463. }
  9464. if (shouldReflect) {
  9465. if (val === true) {
  9466. this.setAttribute(hyphenate(key), "");
  9467. } else if (typeof val === "string" || typeof val === "number") {
  9468. this.setAttribute(hyphenate(key), val + "");
  9469. } else if (!val) {
  9470. this.removeAttribute(hyphenate(key));
  9471. }
  9472. }
  9473. }
  9474. }
  9475. _update() {
  9476. render(this._createVNode(), this.shadowRoot);
  9477. }
  9478. _createVNode() {
  9479. const vnode = createVNode(this._def, extend({}, this._props));
  9480. if (!this._instance) {
  9481. vnode.ce = (instance) => {
  9482. this._instance = instance;
  9483. instance.isCE = true;
  9484. {
  9485. instance.ceReload = (newStyles) => {
  9486. if (this._styles) {
  9487. this._styles.forEach((s) => this.shadowRoot.removeChild(s));
  9488. this._styles.length = 0;
  9489. }
  9490. this._applyStyles(newStyles);
  9491. this._instance = null;
  9492. this._update();
  9493. };
  9494. }
  9495. const dispatch = (event, args) => {
  9496. this.dispatchEvent(
  9497. new CustomEvent(event, {
  9498. detail: args
  9499. })
  9500. );
  9501. };
  9502. instance.emit = (event, ...args) => {
  9503. dispatch(event, args);
  9504. if (hyphenate(event) !== event) {
  9505. dispatch(hyphenate(event), args);
  9506. }
  9507. };
  9508. let parent = this;
  9509. while (parent = parent && (parent.parentNode || parent.host)) {
  9510. if (parent instanceof VueElement) {
  9511. instance.parent = parent._instance;
  9512. instance.provides = parent._instance.provides;
  9513. break;
  9514. }
  9515. }
  9516. };
  9517. }
  9518. return vnode;
  9519. }
  9520. _applyStyles(styles) {
  9521. if (styles) {
  9522. styles.forEach((css) => {
  9523. const s = document.createElement("style");
  9524. s.textContent = css;
  9525. this.shadowRoot.appendChild(s);
  9526. {
  9527. (this._styles || (this._styles = [])).push(s);
  9528. }
  9529. });
  9530. }
  9531. }
  9532. }
  9533. function useCssModule(name = "$style") {
  9534. {
  9535. {
  9536. warn(`useCssModule() is not supported in the global build.`);
  9537. }
  9538. return EMPTY_OBJ;
  9539. }
  9540. }
  9541. function useCssVars(getter) {
  9542. const instance = getCurrentInstance();
  9543. if (!instance) {
  9544. warn(`useCssVars is called without current active component instance.`);
  9545. return;
  9546. }
  9547. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  9548. Array.from(
  9549. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  9550. ).forEach((node) => setVarsOnNode(node, vars));
  9551. };
  9552. const setVars = () => {
  9553. const vars = getter(instance.proxy);
  9554. setVarsOnVNode(instance.subTree, vars);
  9555. updateTeleports(vars);
  9556. };
  9557. watchPostEffect(setVars);
  9558. onMounted(() => {
  9559. const ob = new MutationObserver(setVars);
  9560. ob.observe(instance.subTree.el.parentNode, { childList: true });
  9561. onUnmounted(() => ob.disconnect());
  9562. });
  9563. }
  9564. function setVarsOnVNode(vnode, vars) {
  9565. if (vnode.shapeFlag & 128) {
  9566. const suspense = vnode.suspense;
  9567. vnode = suspense.activeBranch;
  9568. if (suspense.pendingBranch && !suspense.isHydrating) {
  9569. suspense.effects.push(() => {
  9570. setVarsOnVNode(suspense.activeBranch, vars);
  9571. });
  9572. }
  9573. }
  9574. while (vnode.component) {
  9575. vnode = vnode.component.subTree;
  9576. }
  9577. if (vnode.shapeFlag & 1 && vnode.el) {
  9578. setVarsOnNode(vnode.el, vars);
  9579. } else if (vnode.type === Fragment) {
  9580. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  9581. } else if (vnode.type === Static) {
  9582. let { el, anchor } = vnode;
  9583. while (el) {
  9584. setVarsOnNode(el, vars);
  9585. if (el === anchor)
  9586. break;
  9587. el = el.nextSibling;
  9588. }
  9589. }
  9590. }
  9591. function setVarsOnNode(el, vars) {
  9592. if (el.nodeType === 1) {
  9593. const style = el.style;
  9594. for (const key in vars) {
  9595. style.setProperty(`--${key}`, vars[key]);
  9596. }
  9597. }
  9598. }
  9599. const TRANSITION = "transition";
  9600. const ANIMATION = "animation";
  9601. const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
  9602. Transition.displayName = "Transition";
  9603. const DOMTransitionPropsValidators = {
  9604. name: String,
  9605. type: String,
  9606. css: {
  9607. type: Boolean,
  9608. default: true
  9609. },
  9610. duration: [String, Number, Object],
  9611. enterFromClass: String,
  9612. enterActiveClass: String,
  9613. enterToClass: String,
  9614. appearFromClass: String,
  9615. appearActiveClass: String,
  9616. appearToClass: String,
  9617. leaveFromClass: String,
  9618. leaveActiveClass: String,
  9619. leaveToClass: String
  9620. };
  9621. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
  9622. {},
  9623. BaseTransitionPropsValidators,
  9624. DOMTransitionPropsValidators
  9625. );
  9626. const callHook = (hook, args = []) => {
  9627. if (isArray(hook)) {
  9628. hook.forEach((h2) => h2(...args));
  9629. } else if (hook) {
  9630. hook(...args);
  9631. }
  9632. };
  9633. const hasExplicitCallback = (hook) => {
  9634. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  9635. };
  9636. function resolveTransitionProps(rawProps) {
  9637. const baseProps = {};
  9638. for (const key in rawProps) {
  9639. if (!(key in DOMTransitionPropsValidators)) {
  9640. baseProps[key] = rawProps[key];
  9641. }
  9642. }
  9643. if (rawProps.css === false) {
  9644. return baseProps;
  9645. }
  9646. const {
  9647. name = "v",
  9648. type,
  9649. duration,
  9650. enterFromClass = `${name}-enter-from`,
  9651. enterActiveClass = `${name}-enter-active`,
  9652. enterToClass = `${name}-enter-to`,
  9653. appearFromClass = enterFromClass,
  9654. appearActiveClass = enterActiveClass,
  9655. appearToClass = enterToClass,
  9656. leaveFromClass = `${name}-leave-from`,
  9657. leaveActiveClass = `${name}-leave-active`,
  9658. leaveToClass = `${name}-leave-to`
  9659. } = rawProps;
  9660. const durations = normalizeDuration(duration);
  9661. const enterDuration = durations && durations[0];
  9662. const leaveDuration = durations && durations[1];
  9663. const {
  9664. onBeforeEnter,
  9665. onEnter,
  9666. onEnterCancelled,
  9667. onLeave,
  9668. onLeaveCancelled,
  9669. onBeforeAppear = onBeforeEnter,
  9670. onAppear = onEnter,
  9671. onAppearCancelled = onEnterCancelled
  9672. } = baseProps;
  9673. const finishEnter = (el, isAppear, done) => {
  9674. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9675. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  9676. done && done();
  9677. };
  9678. const finishLeave = (el, done) => {
  9679. el._isLeaving = false;
  9680. removeTransitionClass(el, leaveFromClass);
  9681. removeTransitionClass(el, leaveToClass);
  9682. removeTransitionClass(el, leaveActiveClass);
  9683. done && done();
  9684. };
  9685. const makeEnterHook = (isAppear) => {
  9686. return (el, done) => {
  9687. const hook = isAppear ? onAppear : onEnter;
  9688. const resolve = () => finishEnter(el, isAppear, done);
  9689. callHook(hook, [el, resolve]);
  9690. nextFrame(() => {
  9691. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  9692. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9693. if (!hasExplicitCallback(hook)) {
  9694. whenTransitionEnds(el, type, enterDuration, resolve);
  9695. }
  9696. });
  9697. };
  9698. };
  9699. return extend(baseProps, {
  9700. onBeforeEnter(el) {
  9701. callHook(onBeforeEnter, [el]);
  9702. addTransitionClass(el, enterFromClass);
  9703. addTransitionClass(el, enterActiveClass);
  9704. },
  9705. onBeforeAppear(el) {
  9706. callHook(onBeforeAppear, [el]);
  9707. addTransitionClass(el, appearFromClass);
  9708. addTransitionClass(el, appearActiveClass);
  9709. },
  9710. onEnter: makeEnterHook(false),
  9711. onAppear: makeEnterHook(true),
  9712. onLeave(el, done) {
  9713. el._isLeaving = true;
  9714. const resolve = () => finishLeave(el, done);
  9715. addTransitionClass(el, leaveFromClass);
  9716. forceReflow();
  9717. addTransitionClass(el, leaveActiveClass);
  9718. nextFrame(() => {
  9719. if (!el._isLeaving) {
  9720. return;
  9721. }
  9722. removeTransitionClass(el, leaveFromClass);
  9723. addTransitionClass(el, leaveToClass);
  9724. if (!hasExplicitCallback(onLeave)) {
  9725. whenTransitionEnds(el, type, leaveDuration, resolve);
  9726. }
  9727. });
  9728. callHook(onLeave, [el, resolve]);
  9729. },
  9730. onEnterCancelled(el) {
  9731. finishEnter(el, false);
  9732. callHook(onEnterCancelled, [el]);
  9733. },
  9734. onAppearCancelled(el) {
  9735. finishEnter(el, true);
  9736. callHook(onAppearCancelled, [el]);
  9737. },
  9738. onLeaveCancelled(el) {
  9739. finishLeave(el);
  9740. callHook(onLeaveCancelled, [el]);
  9741. }
  9742. });
  9743. }
  9744. function normalizeDuration(duration) {
  9745. if (duration == null) {
  9746. return null;
  9747. } else if (isObject(duration)) {
  9748. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  9749. } else {
  9750. const n = NumberOf(duration);
  9751. return [n, n];
  9752. }
  9753. }
  9754. function NumberOf(val) {
  9755. const res = toNumber(val);
  9756. {
  9757. assertNumber(res, "<transition> explicit duration");
  9758. }
  9759. return res;
  9760. }
  9761. function addTransitionClass(el, cls) {
  9762. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  9763. (el._vtc || (el._vtc = /* @__PURE__ */ new Set())).add(cls);
  9764. }
  9765. function removeTransitionClass(el, cls) {
  9766. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  9767. const { _vtc } = el;
  9768. if (_vtc) {
  9769. _vtc.delete(cls);
  9770. if (!_vtc.size) {
  9771. el._vtc = void 0;
  9772. }
  9773. }
  9774. }
  9775. function nextFrame(cb) {
  9776. requestAnimationFrame(() => {
  9777. requestAnimationFrame(cb);
  9778. });
  9779. }
  9780. let endId = 0;
  9781. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  9782. const id = el._endId = ++endId;
  9783. const resolveIfNotStale = () => {
  9784. if (id === el._endId) {
  9785. resolve();
  9786. }
  9787. };
  9788. if (explicitTimeout) {
  9789. return setTimeout(resolveIfNotStale, explicitTimeout);
  9790. }
  9791. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  9792. if (!type) {
  9793. return resolve();
  9794. }
  9795. const endEvent = type + "end";
  9796. let ended = 0;
  9797. const end = () => {
  9798. el.removeEventListener(endEvent, onEnd);
  9799. resolveIfNotStale();
  9800. };
  9801. const onEnd = (e) => {
  9802. if (e.target === el && ++ended >= propCount) {
  9803. end();
  9804. }
  9805. };
  9806. setTimeout(() => {
  9807. if (ended < propCount) {
  9808. end();
  9809. }
  9810. }, timeout + 1);
  9811. el.addEventListener(endEvent, onEnd);
  9812. }
  9813. function getTransitionInfo(el, expectedType) {
  9814. const styles = window.getComputedStyle(el);
  9815. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  9816. const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
  9817. const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
  9818. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  9819. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  9820. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  9821. const animationTimeout = getTimeout(animationDelays, animationDurations);
  9822. let type = null;
  9823. let timeout = 0;
  9824. let propCount = 0;
  9825. if (expectedType === TRANSITION) {
  9826. if (transitionTimeout > 0) {
  9827. type = TRANSITION;
  9828. timeout = transitionTimeout;
  9829. propCount = transitionDurations.length;
  9830. }
  9831. } else if (expectedType === ANIMATION) {
  9832. if (animationTimeout > 0) {
  9833. type = ANIMATION;
  9834. timeout = animationTimeout;
  9835. propCount = animationDurations.length;
  9836. }
  9837. } else {
  9838. timeout = Math.max(transitionTimeout, animationTimeout);
  9839. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
  9840. propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
  9841. }
  9842. const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
  9843. getStyleProperties(`${TRANSITION}Property`).toString()
  9844. );
  9845. return {
  9846. type,
  9847. timeout,
  9848. propCount,
  9849. hasTransform
  9850. };
  9851. }
  9852. function getTimeout(delays, durations) {
  9853. while (delays.length < durations.length) {
  9854. delays = delays.concat(delays);
  9855. }
  9856. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  9857. }
  9858. function toMs(s) {
  9859. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  9860. }
  9861. function forceReflow() {
  9862. return document.body.offsetHeight;
  9863. }
  9864. const positionMap = /* @__PURE__ */ new WeakMap();
  9865. const newPositionMap = /* @__PURE__ */ new WeakMap();
  9866. const TransitionGroupImpl = {
  9867. name: "TransitionGroup",
  9868. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  9869. tag: String,
  9870. moveClass: String
  9871. }),
  9872. setup(props, { slots }) {
  9873. const instance = getCurrentInstance();
  9874. const state = useTransitionState();
  9875. let prevChildren;
  9876. let children;
  9877. onUpdated(() => {
  9878. if (!prevChildren.length) {
  9879. return;
  9880. }
  9881. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  9882. if (!hasCSSTransform(
  9883. prevChildren[0].el,
  9884. instance.vnode.el,
  9885. moveClass
  9886. )) {
  9887. return;
  9888. }
  9889. prevChildren.forEach(callPendingCbs);
  9890. prevChildren.forEach(recordPosition);
  9891. const movedChildren = prevChildren.filter(applyTranslation);
  9892. forceReflow();
  9893. movedChildren.forEach((c) => {
  9894. const el = c.el;
  9895. const style = el.style;
  9896. addTransitionClass(el, moveClass);
  9897. style.transform = style.webkitTransform = style.transitionDuration = "";
  9898. const cb = el._moveCb = (e) => {
  9899. if (e && e.target !== el) {
  9900. return;
  9901. }
  9902. if (!e || /transform$/.test(e.propertyName)) {
  9903. el.removeEventListener("transitionend", cb);
  9904. el._moveCb = null;
  9905. removeTransitionClass(el, moveClass);
  9906. }
  9907. };
  9908. el.addEventListener("transitionend", cb);
  9909. });
  9910. });
  9911. return () => {
  9912. const rawProps = toRaw(props);
  9913. const cssTransitionProps = resolveTransitionProps(rawProps);
  9914. let tag = rawProps.tag || Fragment;
  9915. prevChildren = children;
  9916. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  9917. for (let i = 0; i < children.length; i++) {
  9918. const child = children[i];
  9919. if (child.key != null) {
  9920. setTransitionHooks(
  9921. child,
  9922. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  9923. );
  9924. } else {
  9925. warn(`<TransitionGroup> children must be keyed.`);
  9926. }
  9927. }
  9928. if (prevChildren) {
  9929. for (let i = 0; i < prevChildren.length; i++) {
  9930. const child = prevChildren[i];
  9931. setTransitionHooks(
  9932. child,
  9933. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  9934. );
  9935. positionMap.set(child, child.el.getBoundingClientRect());
  9936. }
  9937. }
  9938. return createVNode(tag, null, children);
  9939. };
  9940. }
  9941. };
  9942. const removeMode = (props) => delete props.mode;
  9943. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  9944. const TransitionGroup = TransitionGroupImpl;
  9945. function callPendingCbs(c) {
  9946. const el = c.el;
  9947. if (el._moveCb) {
  9948. el._moveCb();
  9949. }
  9950. if (el._enterCb) {
  9951. el._enterCb();
  9952. }
  9953. }
  9954. function recordPosition(c) {
  9955. newPositionMap.set(c, c.el.getBoundingClientRect());
  9956. }
  9957. function applyTranslation(c) {
  9958. const oldPos = positionMap.get(c);
  9959. const newPos = newPositionMap.get(c);
  9960. const dx = oldPos.left - newPos.left;
  9961. const dy = oldPos.top - newPos.top;
  9962. if (dx || dy) {
  9963. const s = c.el.style;
  9964. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  9965. s.transitionDuration = "0s";
  9966. return c;
  9967. }
  9968. }
  9969. function hasCSSTransform(el, root, moveClass) {
  9970. const clone = el.cloneNode();
  9971. if (el._vtc) {
  9972. el._vtc.forEach((cls) => {
  9973. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  9974. });
  9975. }
  9976. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  9977. clone.style.display = "none";
  9978. const container = root.nodeType === 1 ? root : root.parentNode;
  9979. container.appendChild(clone);
  9980. const { hasTransform } = getTransitionInfo(clone);
  9981. container.removeChild(clone);
  9982. return hasTransform;
  9983. }
  9984. const getModelAssigner = (vnode) => {
  9985. const fn = vnode.props["onUpdate:modelValue"] || false;
  9986. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  9987. };
  9988. function onCompositionStart(e) {
  9989. e.target.composing = true;
  9990. }
  9991. function onCompositionEnd(e) {
  9992. const target = e.target;
  9993. if (target.composing) {
  9994. target.composing = false;
  9995. target.dispatchEvent(new Event("input"));
  9996. }
  9997. }
  9998. const vModelText = {
  9999. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  10000. el._assign = getModelAssigner(vnode);
  10001. const castToNumber = number || vnode.props && vnode.props.type === "number";
  10002. addEventListener(el, lazy ? "change" : "input", (e) => {
  10003. if (e.target.composing)
  10004. return;
  10005. let domValue = el.value;
  10006. if (trim) {
  10007. domValue = domValue.trim();
  10008. }
  10009. if (castToNumber) {
  10010. domValue = looseToNumber(domValue);
  10011. }
  10012. el._assign(domValue);
  10013. });
  10014. if (trim) {
  10015. addEventListener(el, "change", () => {
  10016. el.value = el.value.trim();
  10017. });
  10018. }
  10019. if (!lazy) {
  10020. addEventListener(el, "compositionstart", onCompositionStart);
  10021. addEventListener(el, "compositionend", onCompositionEnd);
  10022. addEventListener(el, "change", onCompositionEnd);
  10023. }
  10024. },
  10025. // set value on mounted so it's after min/max for type="range"
  10026. mounted(el, { value }) {
  10027. el.value = value == null ? "" : value;
  10028. },
  10029. beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
  10030. el._assign = getModelAssigner(vnode);
  10031. if (el.composing)
  10032. return;
  10033. if (document.activeElement === el && el.type !== "range") {
  10034. if (lazy) {
  10035. return;
  10036. }
  10037. if (trim && el.value.trim() === value) {
  10038. return;
  10039. }
  10040. if ((number || el.type === "number") && looseToNumber(el.value) === value) {
  10041. return;
  10042. }
  10043. }
  10044. const newValue = value == null ? "" : value;
  10045. if (el.value !== newValue) {
  10046. el.value = newValue;
  10047. }
  10048. }
  10049. };
  10050. const vModelCheckbox = {
  10051. // #4096 array checkboxes need to be deep traversed
  10052. deep: true,
  10053. created(el, _, vnode) {
  10054. el._assign = getModelAssigner(vnode);
  10055. addEventListener(el, "change", () => {
  10056. const modelValue = el._modelValue;
  10057. const elementValue = getValue(el);
  10058. const checked = el.checked;
  10059. const assign = el._assign;
  10060. if (isArray(modelValue)) {
  10061. const index = looseIndexOf(modelValue, elementValue);
  10062. const found = index !== -1;
  10063. if (checked && !found) {
  10064. assign(modelValue.concat(elementValue));
  10065. } else if (!checked && found) {
  10066. const filtered = [...modelValue];
  10067. filtered.splice(index, 1);
  10068. assign(filtered);
  10069. }
  10070. } else if (isSet(modelValue)) {
  10071. const cloned = new Set(modelValue);
  10072. if (checked) {
  10073. cloned.add(elementValue);
  10074. } else {
  10075. cloned.delete(elementValue);
  10076. }
  10077. assign(cloned);
  10078. } else {
  10079. assign(getCheckboxValue(el, checked));
  10080. }
  10081. });
  10082. },
  10083. // set initial checked on mount to wait for true-value/false-value
  10084. mounted: setChecked,
  10085. beforeUpdate(el, binding, vnode) {
  10086. el._assign = getModelAssigner(vnode);
  10087. setChecked(el, binding, vnode);
  10088. }
  10089. };
  10090. function setChecked(el, { value, oldValue }, vnode) {
  10091. el._modelValue = value;
  10092. if (isArray(value)) {
  10093. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  10094. } else if (isSet(value)) {
  10095. el.checked = value.has(vnode.props.value);
  10096. } else if (value !== oldValue) {
  10097. el.checked = looseEqual(value, getCheckboxValue(el, true));
  10098. }
  10099. }
  10100. const vModelRadio = {
  10101. created(el, { value }, vnode) {
  10102. el.checked = looseEqual(value, vnode.props.value);
  10103. el._assign = getModelAssigner(vnode);
  10104. addEventListener(el, "change", () => {
  10105. el._assign(getValue(el));
  10106. });
  10107. },
  10108. beforeUpdate(el, { value, oldValue }, vnode) {
  10109. el._assign = getModelAssigner(vnode);
  10110. if (value !== oldValue) {
  10111. el.checked = looseEqual(value, vnode.props.value);
  10112. }
  10113. }
  10114. };
  10115. const vModelSelect = {
  10116. // <select multiple> value need to be deep traversed
  10117. deep: true,
  10118. created(el, { value, modifiers: { number } }, vnode) {
  10119. const isSetModel = isSet(value);
  10120. addEventListener(el, "change", () => {
  10121. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  10122. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  10123. );
  10124. el._assign(
  10125. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  10126. );
  10127. });
  10128. el._assign = getModelAssigner(vnode);
  10129. },
  10130. // set value in mounted & updated because <select> relies on its children
  10131. // <option>s.
  10132. mounted(el, { value }) {
  10133. setSelected(el, value);
  10134. },
  10135. beforeUpdate(el, _binding, vnode) {
  10136. el._assign = getModelAssigner(vnode);
  10137. },
  10138. updated(el, { value }) {
  10139. setSelected(el, value);
  10140. }
  10141. };
  10142. function setSelected(el, value) {
  10143. const isMultiple = el.multiple;
  10144. if (isMultiple && !isArray(value) && !isSet(value)) {
  10145. warn(
  10146. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  10147. );
  10148. return;
  10149. }
  10150. for (let i = 0, l = el.options.length; i < l; i++) {
  10151. const option = el.options[i];
  10152. const optionValue = getValue(option);
  10153. if (isMultiple) {
  10154. if (isArray(value)) {
  10155. option.selected = looseIndexOf(value, optionValue) > -1;
  10156. } else {
  10157. option.selected = value.has(optionValue);
  10158. }
  10159. } else {
  10160. if (looseEqual(getValue(option), value)) {
  10161. if (el.selectedIndex !== i)
  10162. el.selectedIndex = i;
  10163. return;
  10164. }
  10165. }
  10166. }
  10167. if (!isMultiple && el.selectedIndex !== -1) {
  10168. el.selectedIndex = -1;
  10169. }
  10170. }
  10171. function getValue(el) {
  10172. return "_value" in el ? el._value : el.value;
  10173. }
  10174. function getCheckboxValue(el, checked) {
  10175. const key = checked ? "_trueValue" : "_falseValue";
  10176. return key in el ? el[key] : checked;
  10177. }
  10178. const vModelDynamic = {
  10179. created(el, binding, vnode) {
  10180. callModelHook(el, binding, vnode, null, "created");
  10181. },
  10182. mounted(el, binding, vnode) {
  10183. callModelHook(el, binding, vnode, null, "mounted");
  10184. },
  10185. beforeUpdate(el, binding, vnode, prevVNode) {
  10186. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  10187. },
  10188. updated(el, binding, vnode, prevVNode) {
  10189. callModelHook(el, binding, vnode, prevVNode, "updated");
  10190. }
  10191. };
  10192. function resolveDynamicModel(tagName, type) {
  10193. switch (tagName) {
  10194. case "SELECT":
  10195. return vModelSelect;
  10196. case "TEXTAREA":
  10197. return vModelText;
  10198. default:
  10199. switch (type) {
  10200. case "checkbox":
  10201. return vModelCheckbox;
  10202. case "radio":
  10203. return vModelRadio;
  10204. default:
  10205. return vModelText;
  10206. }
  10207. }
  10208. }
  10209. function callModelHook(el, binding, vnode, prevVNode, hook) {
  10210. const modelToUse = resolveDynamicModel(
  10211. el.tagName,
  10212. vnode.props && vnode.props.type
  10213. );
  10214. const fn = modelToUse[hook];
  10215. fn && fn(el, binding, vnode, prevVNode);
  10216. }
  10217. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  10218. const modifierGuards = {
  10219. stop: (e) => e.stopPropagation(),
  10220. prevent: (e) => e.preventDefault(),
  10221. self: (e) => e.target !== e.currentTarget,
  10222. ctrl: (e) => !e.ctrlKey,
  10223. shift: (e) => !e.shiftKey,
  10224. alt: (e) => !e.altKey,
  10225. meta: (e) => !e.metaKey,
  10226. left: (e) => "button" in e && e.button !== 0,
  10227. middle: (e) => "button" in e && e.button !== 1,
  10228. right: (e) => "button" in e && e.button !== 2,
  10229. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  10230. };
  10231. const withModifiers = (fn, modifiers) => {
  10232. return (event, ...args) => {
  10233. for (let i = 0; i < modifiers.length; i++) {
  10234. const guard = modifierGuards[modifiers[i]];
  10235. if (guard && guard(event, modifiers))
  10236. return;
  10237. }
  10238. return fn(event, ...args);
  10239. };
  10240. };
  10241. const keyNames = {
  10242. esc: "escape",
  10243. space: " ",
  10244. up: "arrow-up",
  10245. left: "arrow-left",
  10246. right: "arrow-right",
  10247. down: "arrow-down",
  10248. delete: "backspace"
  10249. };
  10250. const withKeys = (fn, modifiers) => {
  10251. return (event) => {
  10252. if (!("key" in event)) {
  10253. return;
  10254. }
  10255. const eventKey = hyphenate(event.key);
  10256. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  10257. return fn(event);
  10258. }
  10259. };
  10260. };
  10261. const vShow = {
  10262. beforeMount(el, { value }, { transition }) {
  10263. el._vod = el.style.display === "none" ? "" : el.style.display;
  10264. if (transition && value) {
  10265. transition.beforeEnter(el);
  10266. } else {
  10267. setDisplay(el, value);
  10268. }
  10269. },
  10270. mounted(el, { value }, { transition }) {
  10271. if (transition && value) {
  10272. transition.enter(el);
  10273. }
  10274. },
  10275. updated(el, { value, oldValue }, { transition }) {
  10276. if (!value === !oldValue)
  10277. return;
  10278. if (transition) {
  10279. if (value) {
  10280. transition.beforeEnter(el);
  10281. setDisplay(el, true);
  10282. transition.enter(el);
  10283. } else {
  10284. transition.leave(el, () => {
  10285. setDisplay(el, false);
  10286. });
  10287. }
  10288. } else {
  10289. setDisplay(el, value);
  10290. }
  10291. },
  10292. beforeUnmount(el, { value }) {
  10293. setDisplay(el, value);
  10294. }
  10295. };
  10296. function setDisplay(el, value) {
  10297. el.style.display = value ? el._vod : "none";
  10298. }
  10299. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  10300. let renderer;
  10301. let enabledHydration = false;
  10302. function ensureRenderer() {
  10303. return renderer || (renderer = createRenderer(rendererOptions));
  10304. }
  10305. function ensureHydrationRenderer() {
  10306. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  10307. enabledHydration = true;
  10308. return renderer;
  10309. }
  10310. const render = (...args) => {
  10311. ensureRenderer().render(...args);
  10312. };
  10313. const hydrate = (...args) => {
  10314. ensureHydrationRenderer().hydrate(...args);
  10315. };
  10316. const createApp = (...args) => {
  10317. const app = ensureRenderer().createApp(...args);
  10318. {
  10319. injectNativeTagCheck(app);
  10320. injectCompilerOptionsCheck(app);
  10321. }
  10322. const { mount } = app;
  10323. app.mount = (containerOrSelector) => {
  10324. const container = normalizeContainer(containerOrSelector);
  10325. if (!container)
  10326. return;
  10327. const component = app._component;
  10328. if (!isFunction(component) && !component.render && !component.template) {
  10329. component.template = container.innerHTML;
  10330. }
  10331. container.innerHTML = "";
  10332. const proxy = mount(container, false, container instanceof SVGElement);
  10333. if (container instanceof Element) {
  10334. container.removeAttribute("v-cloak");
  10335. container.setAttribute("data-v-app", "");
  10336. }
  10337. return proxy;
  10338. };
  10339. return app;
  10340. };
  10341. const createSSRApp = (...args) => {
  10342. const app = ensureHydrationRenderer().createApp(...args);
  10343. {
  10344. injectNativeTagCheck(app);
  10345. injectCompilerOptionsCheck(app);
  10346. }
  10347. const { mount } = app;
  10348. app.mount = (containerOrSelector) => {
  10349. const container = normalizeContainer(containerOrSelector);
  10350. if (container) {
  10351. return mount(container, true, container instanceof SVGElement);
  10352. }
  10353. };
  10354. return app;
  10355. };
  10356. function injectNativeTagCheck(app) {
  10357. Object.defineProperty(app.config, "isNativeTag", {
  10358. value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
  10359. writable: false
  10360. });
  10361. }
  10362. function injectCompilerOptionsCheck(app) {
  10363. if (isRuntimeOnly()) {
  10364. const isCustomElement = app.config.isCustomElement;
  10365. Object.defineProperty(app.config, "isCustomElement", {
  10366. get() {
  10367. return isCustomElement;
  10368. },
  10369. set() {
  10370. warn(
  10371. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  10372. );
  10373. }
  10374. });
  10375. const compilerOptions = app.config.compilerOptions;
  10376. 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.
  10377. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  10378. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  10379. - 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`;
  10380. Object.defineProperty(app.config, "compilerOptions", {
  10381. get() {
  10382. warn(msg);
  10383. return compilerOptions;
  10384. },
  10385. set() {
  10386. warn(msg);
  10387. }
  10388. });
  10389. }
  10390. }
  10391. function normalizeContainer(container) {
  10392. if (isString(container)) {
  10393. const res = document.querySelector(container);
  10394. if (!res) {
  10395. warn(
  10396. `Failed to mount app: mount target selector "${container}" returned null.`
  10397. );
  10398. }
  10399. return res;
  10400. }
  10401. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  10402. warn(
  10403. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  10404. );
  10405. }
  10406. return container;
  10407. }
  10408. const initDirectivesForSSR = NOOP;
  10409. function initDev() {
  10410. {
  10411. {
  10412. console.info(
  10413. `You are running a development build of Vue.
  10414. Make sure to use the production build (*.prod.js) when deploying for production.`
  10415. );
  10416. }
  10417. initCustomFormatter();
  10418. }
  10419. }
  10420. {
  10421. initDev();
  10422. }
  10423. const compile = () => {
  10424. {
  10425. warn(
  10426. `Runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
  10427. /* should not happen */
  10428. );
  10429. }
  10430. };
  10431. exports.BaseTransition = BaseTransition;
  10432. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  10433. exports.Comment = Comment;
  10434. exports.EffectScope = EffectScope;
  10435. exports.Fragment = Fragment;
  10436. exports.KeepAlive = KeepAlive;
  10437. exports.ReactiveEffect = ReactiveEffect;
  10438. exports.Static = Static;
  10439. exports.Suspense = Suspense;
  10440. exports.Teleport = Teleport;
  10441. exports.Text = Text;
  10442. exports.Transition = Transition;
  10443. exports.TransitionGroup = TransitionGroup;
  10444. exports.VueElement = VueElement;
  10445. exports.assertNumber = assertNumber;
  10446. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  10447. exports.callWithErrorHandling = callWithErrorHandling;
  10448. exports.camelize = camelize;
  10449. exports.capitalize = capitalize;
  10450. exports.cloneVNode = cloneVNode;
  10451. exports.compatUtils = compatUtils;
  10452. exports.compile = compile;
  10453. exports.computed = computed;
  10454. exports.createApp = createApp;
  10455. exports.createBlock = createBlock;
  10456. exports.createCommentVNode = createCommentVNode;
  10457. exports.createElementBlock = createElementBlock;
  10458. exports.createElementVNode = createBaseVNode;
  10459. exports.createHydrationRenderer = createHydrationRenderer;
  10460. exports.createPropsRestProxy = createPropsRestProxy;
  10461. exports.createRenderer = createRenderer;
  10462. exports.createSSRApp = createSSRApp;
  10463. exports.createSlots = createSlots;
  10464. exports.createStaticVNode = createStaticVNode;
  10465. exports.createTextVNode = createTextVNode;
  10466. exports.createVNode = createVNode;
  10467. exports.customRef = customRef;
  10468. exports.defineAsyncComponent = defineAsyncComponent;
  10469. exports.defineComponent = defineComponent;
  10470. exports.defineCustomElement = defineCustomElement;
  10471. exports.defineEmits = defineEmits;
  10472. exports.defineExpose = defineExpose;
  10473. exports.defineModel = defineModel;
  10474. exports.defineOptions = defineOptions;
  10475. exports.defineProps = defineProps;
  10476. exports.defineSSRCustomElement = defineSSRCustomElement;
  10477. exports.defineSlots = defineSlots;
  10478. exports.effect = effect;
  10479. exports.effectScope = effectScope;
  10480. exports.getCurrentInstance = getCurrentInstance;
  10481. exports.getCurrentScope = getCurrentScope;
  10482. exports.getTransitionRawChildren = getTransitionRawChildren;
  10483. exports.guardReactiveProps = guardReactiveProps;
  10484. exports.h = h;
  10485. exports.handleError = handleError;
  10486. exports.hasInjectionContext = hasInjectionContext;
  10487. exports.hydrate = hydrate;
  10488. exports.initCustomFormatter = initCustomFormatter;
  10489. exports.initDirectivesForSSR = initDirectivesForSSR;
  10490. exports.inject = inject;
  10491. exports.isMemoSame = isMemoSame;
  10492. exports.isProxy = isProxy;
  10493. exports.isReactive = isReactive;
  10494. exports.isReadonly = isReadonly;
  10495. exports.isRef = isRef;
  10496. exports.isRuntimeOnly = isRuntimeOnly;
  10497. exports.isShallow = isShallow;
  10498. exports.isVNode = isVNode;
  10499. exports.markRaw = markRaw;
  10500. exports.mergeDefaults = mergeDefaults;
  10501. exports.mergeModels = mergeModels;
  10502. exports.mergeProps = mergeProps;
  10503. exports.nextTick = nextTick;
  10504. exports.normalizeClass = normalizeClass;
  10505. exports.normalizeProps = normalizeProps;
  10506. exports.normalizeStyle = normalizeStyle;
  10507. exports.onActivated = onActivated;
  10508. exports.onBeforeMount = onBeforeMount;
  10509. exports.onBeforeUnmount = onBeforeUnmount;
  10510. exports.onBeforeUpdate = onBeforeUpdate;
  10511. exports.onDeactivated = onDeactivated;
  10512. exports.onErrorCaptured = onErrorCaptured;
  10513. exports.onMounted = onMounted;
  10514. exports.onRenderTracked = onRenderTracked;
  10515. exports.onRenderTriggered = onRenderTriggered;
  10516. exports.onScopeDispose = onScopeDispose;
  10517. exports.onServerPrefetch = onServerPrefetch;
  10518. exports.onUnmounted = onUnmounted;
  10519. exports.onUpdated = onUpdated;
  10520. exports.openBlock = openBlock;
  10521. exports.popScopeId = popScopeId;
  10522. exports.provide = provide;
  10523. exports.proxyRefs = proxyRefs;
  10524. exports.pushScopeId = pushScopeId;
  10525. exports.queuePostFlushCb = queuePostFlushCb;
  10526. exports.reactive = reactive;
  10527. exports.readonly = readonly;
  10528. exports.ref = ref;
  10529. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  10530. exports.render = render;
  10531. exports.renderList = renderList;
  10532. exports.renderSlot = renderSlot;
  10533. exports.resolveComponent = resolveComponent;
  10534. exports.resolveDirective = resolveDirective;
  10535. exports.resolveDynamicComponent = resolveDynamicComponent;
  10536. exports.resolveFilter = resolveFilter;
  10537. exports.resolveTransitionHooks = resolveTransitionHooks;
  10538. exports.setBlockTracking = setBlockTracking;
  10539. exports.setDevtoolsHook = setDevtoolsHook;
  10540. exports.setTransitionHooks = setTransitionHooks;
  10541. exports.shallowReactive = shallowReactive;
  10542. exports.shallowReadonly = shallowReadonly;
  10543. exports.shallowRef = shallowRef;
  10544. exports.ssrContextKey = ssrContextKey;
  10545. exports.ssrUtils = ssrUtils;
  10546. exports.stop = stop;
  10547. exports.toDisplayString = toDisplayString;
  10548. exports.toHandlerKey = toHandlerKey;
  10549. exports.toHandlers = toHandlers;
  10550. exports.toRaw = toRaw;
  10551. exports.toRef = toRef;
  10552. exports.toRefs = toRefs;
  10553. exports.toValue = toValue;
  10554. exports.transformVNodeArgs = transformVNodeArgs;
  10555. exports.triggerRef = triggerRef;
  10556. exports.unref = unref;
  10557. exports.useAttrs = useAttrs;
  10558. exports.useCssModule = useCssModule;
  10559. exports.useCssVars = useCssVars;
  10560. exports.useModel = useModel;
  10561. exports.useSSRContext = useSSRContext;
  10562. exports.useSlots = useSlots;
  10563. exports.useTransitionState = useTransitionState;
  10564. exports.vModelCheckbox = vModelCheckbox;
  10565. exports.vModelDynamic = vModelDynamic;
  10566. exports.vModelRadio = vModelRadio;
  10567. exports.vModelSelect = vModelSelect;
  10568. exports.vModelText = vModelText;
  10569. exports.vShow = vShow;
  10570. exports.version = version;
  10571. exports.warn = warn;
  10572. exports.watch = watch;
  10573. exports.watchEffect = watchEffect;
  10574. exports.watchPostEffect = watchPostEffect;
  10575. exports.watchSyncEffect = watchSyncEffect;
  10576. exports.withAsyncContext = withAsyncContext;
  10577. exports.withCtx = withCtx;
  10578. exports.withDefaults = withDefaults;
  10579. exports.withDirectives = withDirectives;
  10580. exports.withKeys = withKeys;
  10581. exports.withMemo = withMemo;
  10582. exports.withModifiers = withModifiers;
  10583. exports.withScopeId = withScopeId;
  10584. return exports;
  10585. })({});