vendor.js 219 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885
  1. "use strict";
  2. /**
  3. * @vue/shared v3.4.21
  4. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  5. * @license MIT
  6. **/
  7. function makeMap(str, expectsLowerCase) {
  8. const set2 = new Set(str.split(","));
  9. return expectsLowerCase ? (val) => set2.has(val.toLowerCase()) : (val) => set2.has(val);
  10. }
  11. const EMPTY_OBJ = Object.freeze({});
  12. const EMPTY_ARR = Object.freeze([]);
  13. const NOOP = () => {
  14. };
  15. const NO = () => false;
  16. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  17. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  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 isFunction = (val) => typeof val === "function";
  32. const isString = (val) => typeof val === "string";
  33. const isSymbol = (val) => typeof val === "symbol";
  34. const isObject = (val) => val !== null && typeof val === "object";
  35. const isPromise = (val) => {
  36. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  37. };
  38. const objectToString = Object.prototype.toString;
  39. const toTypeString = (value) => objectToString.call(value);
  40. const toRawType = (value) => {
  41. return toTypeString(value).slice(8, -1);
  42. };
  43. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  44. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  45. const isReservedProp = /* @__PURE__ */ makeMap(
  46. // the leading comma is intentional so empty string "" is also included
  47. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  48. );
  49. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  50. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  51. );
  52. const cacheStringFunction = (fn) => {
  53. const cache = /* @__PURE__ */ Object.create(null);
  54. return (str) => {
  55. const hit = cache[str];
  56. return hit || (cache[str] = fn(str));
  57. };
  58. };
  59. const camelizeRE = /-(\w)/g;
  60. const camelize = cacheStringFunction((str) => {
  61. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  62. });
  63. const hyphenateRE = /\B([A-Z])/g;
  64. const hyphenate = cacheStringFunction(
  65. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  66. );
  67. const capitalize = cacheStringFunction((str) => {
  68. return str.charAt(0).toUpperCase() + str.slice(1);
  69. });
  70. const toHandlerKey = cacheStringFunction((str) => {
  71. const s = str ? `on${capitalize(str)}` : ``;
  72. return s;
  73. });
  74. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  75. const invokeArrayFns$1 = (fns, arg) => {
  76. for (let i = 0; i < fns.length; i++) {
  77. fns[i](arg);
  78. }
  79. };
  80. const def = (obj, key, value) => {
  81. Object.defineProperty(obj, key, {
  82. configurable: true,
  83. enumerable: false,
  84. value
  85. });
  86. };
  87. const looseToNumber = (val) => {
  88. const n2 = parseFloat(val);
  89. return isNaN(n2) ? val : n2;
  90. };
  91. function normalizeClass(value) {
  92. let res = "";
  93. if (isString(value)) {
  94. res = value;
  95. } else if (isArray(value)) {
  96. for (let i = 0; i < value.length; i++) {
  97. const normalized = normalizeClass(value[i]);
  98. if (normalized) {
  99. res += normalized + " ";
  100. }
  101. }
  102. } else if (isObject(value)) {
  103. for (const name in value) {
  104. if (value[name]) {
  105. res += name + " ";
  106. }
  107. }
  108. }
  109. return res.trim();
  110. }
  111. const toDisplayString = (val) => {
  112. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  113. };
  114. const replacer = (_key, val) => {
  115. if (val && val.__v_isRef) {
  116. return replacer(_key, val.value);
  117. } else if (isMap(val)) {
  118. return {
  119. [`Map(${val.size})`]: [...val.entries()].reduce(
  120. (entries, [key, val2], i) => {
  121. entries[stringifySymbol(key, i) + " =>"] = val2;
  122. return entries;
  123. },
  124. {}
  125. )
  126. };
  127. } else if (isSet(val)) {
  128. return {
  129. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  130. };
  131. } else if (isSymbol(val)) {
  132. return stringifySymbol(val);
  133. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  134. return String(val);
  135. }
  136. return val;
  137. };
  138. const stringifySymbol = (v, i = "") => {
  139. var _a;
  140. return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
  141. };
  142. const LOCALE_ZH_HANS = "zh-Hans";
  143. const LOCALE_ZH_HANT = "zh-Hant";
  144. const LOCALE_EN = "en";
  145. const LOCALE_FR = "fr";
  146. const LOCALE_ES = "es";
  147. function include(str, parts) {
  148. return !!parts.find((part) => str.indexOf(part) !== -1);
  149. }
  150. function startsWith(str, parts) {
  151. return parts.find((part) => str.indexOf(part) === 0);
  152. }
  153. function normalizeLocale(locale, messages) {
  154. if (!locale) {
  155. return;
  156. }
  157. locale = locale.trim().replace(/_/g, "-");
  158. if (messages && messages[locale]) {
  159. return locale;
  160. }
  161. locale = locale.toLowerCase();
  162. if (locale === "chinese") {
  163. return LOCALE_ZH_HANS;
  164. }
  165. if (locale.indexOf("zh") === 0) {
  166. if (locale.indexOf("-hans") > -1) {
  167. return LOCALE_ZH_HANS;
  168. }
  169. if (locale.indexOf("-hant") > -1) {
  170. return LOCALE_ZH_HANT;
  171. }
  172. if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
  173. return LOCALE_ZH_HANT;
  174. }
  175. return LOCALE_ZH_HANS;
  176. }
  177. let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  178. if (messages && Object.keys(messages).length > 0) {
  179. locales = Object.keys(messages);
  180. }
  181. const lang = startsWith(locale, locales);
  182. if (lang) {
  183. return lang;
  184. }
  185. }
  186. const SLOT_DEFAULT_NAME = "d";
  187. const ON_SHOW = "onShow";
  188. const ON_HIDE = "onHide";
  189. const ON_LAUNCH = "onLaunch";
  190. const ON_ERROR = "onError";
  191. const ON_THEME_CHANGE = "onThemeChange";
  192. const ON_PAGE_NOT_FOUND = "onPageNotFound";
  193. const ON_UNHANDLE_REJECTION = "onUnhandledRejection";
  194. const ON_EXIT = "onExit";
  195. const ON_LOAD = "onLoad";
  196. const ON_READY = "onReady";
  197. const ON_UNLOAD = "onUnload";
  198. const ON_INIT = "onInit";
  199. const ON_SAVE_EXIT_STATE = "onSaveExitState";
  200. const ON_RESIZE = "onResize";
  201. const ON_BACK_PRESS = "onBackPress";
  202. const ON_PAGE_SCROLL = "onPageScroll";
  203. const ON_TAB_ITEM_TAP = "onTabItemTap";
  204. const ON_REACH_BOTTOM = "onReachBottom";
  205. const ON_PULL_DOWN_REFRESH = "onPullDownRefresh";
  206. const ON_SHARE_TIMELINE = "onShareTimeline";
  207. const ON_SHARE_CHAT = "onShareChat";
  208. const ON_ADD_TO_FAVORITES = "onAddToFavorites";
  209. const ON_SHARE_APP_MESSAGE = "onShareAppMessage";
  210. const ON_NAVIGATION_BAR_BUTTON_TAP = "onNavigationBarButtonTap";
  211. const ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = "onNavigationBarSearchInputClicked";
  212. const ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = "onNavigationBarSearchInputChanged";
  213. const ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = "onNavigationBarSearchInputConfirmed";
  214. const ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = "onNavigationBarSearchInputFocusChanged";
  215. const VIRTUAL_HOST_STYLE = "virtualHostStyle";
  216. const VIRTUAL_HOST_CLASS = "virtualHostClass";
  217. const VIRTUAL_HOST_HIDDEN = "virtualHostHidden";
  218. const VIRTUAL_HOST_ID = "virtualHostId";
  219. function hasLeadingSlash(str) {
  220. return str.indexOf("/") === 0;
  221. }
  222. function addLeadingSlash(str) {
  223. return hasLeadingSlash(str) ? str : "/" + str;
  224. }
  225. const invokeArrayFns = (fns, arg) => {
  226. let ret;
  227. for (let i = 0; i < fns.length; i++) {
  228. ret = fns[i](arg);
  229. }
  230. return ret;
  231. };
  232. function once(fn, ctx = null) {
  233. let res;
  234. return (...args) => {
  235. if (fn) {
  236. res = fn.apply(ctx, args);
  237. fn = null;
  238. }
  239. return res;
  240. };
  241. }
  242. function getValueByDataPath(obj, path) {
  243. if (!isString(path)) {
  244. return;
  245. }
  246. path = path.replace(/\[(\d+)\]/g, ".$1");
  247. const parts = path.split(".");
  248. let key = parts[0];
  249. if (!obj) {
  250. obj = {};
  251. }
  252. if (parts.length === 1) {
  253. return obj[key];
  254. }
  255. return getValueByDataPath(obj[key], parts.slice(1).join("."));
  256. }
  257. function sortObject(obj) {
  258. let sortObj = {};
  259. if (isPlainObject(obj)) {
  260. Object.keys(obj).sort().forEach((key) => {
  261. const _key = key;
  262. sortObj[_key] = obj[_key];
  263. });
  264. }
  265. return !Object.keys(sortObj) ? obj : sortObj;
  266. }
  267. const customizeRE = /:/g;
  268. function customizeEvent(str) {
  269. return camelize(str.replace(customizeRE, "-"));
  270. }
  271. const encode = encodeURIComponent;
  272. function stringifyQuery(obj, encodeStr = encode) {
  273. const res = obj ? Object.keys(obj).map((key) => {
  274. let val = obj[key];
  275. if (typeof val === void 0 || val === null) {
  276. val = "";
  277. } else if (isPlainObject(val)) {
  278. val = JSON.stringify(val);
  279. }
  280. return encodeStr(key) + "=" + encodeStr(val);
  281. }).filter((x) => x.length > 0).join("&") : null;
  282. return res ? `?${res}` : "";
  283. }
  284. const PAGE_HOOKS = [
  285. ON_INIT,
  286. ON_LOAD,
  287. ON_SHOW,
  288. ON_HIDE,
  289. ON_UNLOAD,
  290. ON_BACK_PRESS,
  291. ON_PAGE_SCROLL,
  292. ON_TAB_ITEM_TAP,
  293. ON_REACH_BOTTOM,
  294. ON_PULL_DOWN_REFRESH,
  295. ON_SHARE_TIMELINE,
  296. ON_SHARE_APP_MESSAGE,
  297. ON_SHARE_CHAT,
  298. ON_ADD_TO_FAVORITES,
  299. ON_SAVE_EXIT_STATE,
  300. ON_NAVIGATION_BAR_BUTTON_TAP,
  301. ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
  302. ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
  303. ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
  304. ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
  305. ];
  306. function isRootHook(name) {
  307. return PAGE_HOOKS.indexOf(name) > -1;
  308. }
  309. const UniLifecycleHooks = [
  310. ON_SHOW,
  311. ON_HIDE,
  312. ON_LAUNCH,
  313. ON_ERROR,
  314. ON_THEME_CHANGE,
  315. ON_PAGE_NOT_FOUND,
  316. ON_UNHANDLE_REJECTION,
  317. ON_EXIT,
  318. ON_INIT,
  319. ON_LOAD,
  320. ON_READY,
  321. ON_UNLOAD,
  322. ON_RESIZE,
  323. ON_BACK_PRESS,
  324. ON_PAGE_SCROLL,
  325. ON_TAB_ITEM_TAP,
  326. ON_REACH_BOTTOM,
  327. ON_PULL_DOWN_REFRESH,
  328. ON_SHARE_TIMELINE,
  329. ON_ADD_TO_FAVORITES,
  330. ON_SHARE_APP_MESSAGE,
  331. ON_SHARE_CHAT,
  332. ON_SAVE_EXIT_STATE,
  333. ON_NAVIGATION_BAR_BUTTON_TAP,
  334. ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
  335. ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
  336. ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
  337. ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
  338. ];
  339. const MINI_PROGRAM_PAGE_RUNTIME_HOOKS = /* @__PURE__ */ (() => {
  340. return {
  341. onPageScroll: 1,
  342. onShareAppMessage: 1 << 1,
  343. onShareTimeline: 1 << 2
  344. };
  345. })();
  346. function isUniLifecycleHook(name, value, checkType = true) {
  347. if (checkType && !isFunction(value)) {
  348. return false;
  349. }
  350. if (UniLifecycleHooks.indexOf(name) > -1) {
  351. return true;
  352. } else if (name.indexOf("on") === 0) {
  353. return true;
  354. }
  355. return false;
  356. }
  357. let vueApp;
  358. const createVueAppHooks = [];
  359. function onCreateVueApp(hook) {
  360. if (vueApp) {
  361. return hook(vueApp);
  362. }
  363. createVueAppHooks.push(hook);
  364. }
  365. function invokeCreateVueAppHook(app) {
  366. vueApp = app;
  367. createVueAppHooks.forEach((hook) => hook(app));
  368. }
  369. const invokeCreateErrorHandler = once((app, createErrorHandler2) => {
  370. return createErrorHandler2(app);
  371. });
  372. const E = function() {
  373. };
  374. E.prototype = {
  375. _id: 1,
  376. on: function(name, callback, ctx) {
  377. var e2 = this.e || (this.e = {});
  378. (e2[name] || (e2[name] = [])).push({
  379. fn: callback,
  380. ctx,
  381. _id: this._id
  382. });
  383. return this._id++;
  384. },
  385. once: function(name, callback, ctx) {
  386. var self2 = this;
  387. function listener() {
  388. self2.off(name, listener);
  389. callback.apply(ctx, arguments);
  390. }
  391. listener._ = callback;
  392. return this.on(name, listener, ctx);
  393. },
  394. emit: function(name) {
  395. var data = [].slice.call(arguments, 1);
  396. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  397. var i = 0;
  398. var len = evtArr.length;
  399. for (i; i < len; i++) {
  400. evtArr[i].fn.apply(evtArr[i].ctx, data);
  401. }
  402. return this;
  403. },
  404. off: function(name, event) {
  405. var e2 = this.e || (this.e = {});
  406. var evts = e2[name];
  407. var liveEvents = [];
  408. if (evts && event) {
  409. for (var i = evts.length - 1; i >= 0; i--) {
  410. if (evts[i].fn === event || evts[i].fn._ === event || evts[i]._id === event) {
  411. evts.splice(i, 1);
  412. break;
  413. }
  414. }
  415. liveEvents = evts;
  416. }
  417. liveEvents.length ? e2[name] = liveEvents : delete e2[name];
  418. return this;
  419. }
  420. };
  421. var E$1 = E;
  422. /**
  423. * @dcloudio/uni-mp-vue v3.4.21
  424. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  425. * @license MIT
  426. **/
  427. function warn$2(msg, ...args) {
  428. console.warn(`[Vue warn] ${msg}`, ...args);
  429. }
  430. let activeEffectScope;
  431. class EffectScope {
  432. constructor(detached = false) {
  433. this.detached = detached;
  434. this._active = true;
  435. this.effects = [];
  436. this.cleanups = [];
  437. this.parent = activeEffectScope;
  438. if (!detached && activeEffectScope) {
  439. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  440. this
  441. ) - 1;
  442. }
  443. }
  444. get active() {
  445. return this._active;
  446. }
  447. run(fn) {
  448. if (this._active) {
  449. const currentEffectScope = activeEffectScope;
  450. try {
  451. activeEffectScope = this;
  452. return fn();
  453. } finally {
  454. activeEffectScope = currentEffectScope;
  455. }
  456. } else {
  457. warn$2(`cannot run an inactive effect scope.`);
  458. }
  459. }
  460. /**
  461. * This should only be called on non-detached scopes
  462. * @internal
  463. */
  464. on() {
  465. activeEffectScope = this;
  466. }
  467. /**
  468. * This should only be called on non-detached scopes
  469. * @internal
  470. */
  471. off() {
  472. activeEffectScope = this.parent;
  473. }
  474. stop(fromParent) {
  475. if (this._active) {
  476. let i, l;
  477. for (i = 0, l = this.effects.length; i < l; i++) {
  478. this.effects[i].stop();
  479. }
  480. for (i = 0, l = this.cleanups.length; i < l; i++) {
  481. this.cleanups[i]();
  482. }
  483. if (this.scopes) {
  484. for (i = 0, l = this.scopes.length; i < l; i++) {
  485. this.scopes[i].stop(true);
  486. }
  487. }
  488. if (!this.detached && this.parent && !fromParent) {
  489. const last = this.parent.scopes.pop();
  490. if (last && last !== this) {
  491. this.parent.scopes[this.index] = last;
  492. last.index = this.index;
  493. }
  494. }
  495. this.parent = void 0;
  496. this._active = false;
  497. }
  498. }
  499. }
  500. function recordEffectScope(effect2, scope = activeEffectScope) {
  501. if (scope && scope.active) {
  502. scope.effects.push(effect2);
  503. }
  504. }
  505. function getCurrentScope() {
  506. return activeEffectScope;
  507. }
  508. let activeEffect;
  509. class ReactiveEffect {
  510. constructor(fn, trigger2, scheduler, scope) {
  511. this.fn = fn;
  512. this.trigger = trigger2;
  513. this.scheduler = scheduler;
  514. this.active = true;
  515. this.deps = [];
  516. this._dirtyLevel = 4;
  517. this._trackId = 0;
  518. this._runnings = 0;
  519. this._shouldSchedule = false;
  520. this._depsLength = 0;
  521. recordEffectScope(this, scope);
  522. }
  523. get dirty() {
  524. if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
  525. this._dirtyLevel = 1;
  526. pauseTracking();
  527. for (let i = 0; i < this._depsLength; i++) {
  528. const dep = this.deps[i];
  529. if (dep.computed) {
  530. triggerComputed(dep.computed);
  531. if (this._dirtyLevel >= 4) {
  532. break;
  533. }
  534. }
  535. }
  536. if (this._dirtyLevel === 1) {
  537. this._dirtyLevel = 0;
  538. }
  539. resetTracking();
  540. }
  541. return this._dirtyLevel >= 4;
  542. }
  543. set dirty(v) {
  544. this._dirtyLevel = v ? 4 : 0;
  545. }
  546. run() {
  547. this._dirtyLevel = 0;
  548. if (!this.active) {
  549. return this.fn();
  550. }
  551. let lastShouldTrack = shouldTrack;
  552. let lastEffect = activeEffect;
  553. try {
  554. shouldTrack = true;
  555. activeEffect = this;
  556. this._runnings++;
  557. preCleanupEffect(this);
  558. return this.fn();
  559. } finally {
  560. postCleanupEffect(this);
  561. this._runnings--;
  562. activeEffect = lastEffect;
  563. shouldTrack = lastShouldTrack;
  564. }
  565. }
  566. stop() {
  567. var _a;
  568. if (this.active) {
  569. preCleanupEffect(this);
  570. postCleanupEffect(this);
  571. (_a = this.onStop) == null ? void 0 : _a.call(this);
  572. this.active = false;
  573. }
  574. }
  575. }
  576. function triggerComputed(computed2) {
  577. return computed2.value;
  578. }
  579. function preCleanupEffect(effect2) {
  580. effect2._trackId++;
  581. effect2._depsLength = 0;
  582. }
  583. function postCleanupEffect(effect2) {
  584. if (effect2.deps.length > effect2._depsLength) {
  585. for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
  586. cleanupDepEffect(effect2.deps[i], effect2);
  587. }
  588. effect2.deps.length = effect2._depsLength;
  589. }
  590. }
  591. function cleanupDepEffect(dep, effect2) {
  592. const trackId = dep.get(effect2);
  593. if (trackId !== void 0 && effect2._trackId !== trackId) {
  594. dep.delete(effect2);
  595. if (dep.size === 0) {
  596. dep.cleanup();
  597. }
  598. }
  599. }
  600. let shouldTrack = true;
  601. let pauseScheduleStack = 0;
  602. const trackStack = [];
  603. function pauseTracking() {
  604. trackStack.push(shouldTrack);
  605. shouldTrack = false;
  606. }
  607. function resetTracking() {
  608. const last = trackStack.pop();
  609. shouldTrack = last === void 0 ? true : last;
  610. }
  611. function pauseScheduling() {
  612. pauseScheduleStack++;
  613. }
  614. function resetScheduling() {
  615. pauseScheduleStack--;
  616. while (!pauseScheduleStack && queueEffectSchedulers.length) {
  617. queueEffectSchedulers.shift()();
  618. }
  619. }
  620. function trackEffect(effect2, dep, debuggerEventExtraInfo) {
  621. var _a;
  622. if (dep.get(effect2) !== effect2._trackId) {
  623. dep.set(effect2, effect2._trackId);
  624. const oldDep = effect2.deps[effect2._depsLength];
  625. if (oldDep !== dep) {
  626. if (oldDep) {
  627. cleanupDepEffect(oldDep, effect2);
  628. }
  629. effect2.deps[effect2._depsLength++] = dep;
  630. } else {
  631. effect2._depsLength++;
  632. }
  633. {
  634. (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  635. }
  636. }
  637. }
  638. const queueEffectSchedulers = [];
  639. function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
  640. var _a;
  641. pauseScheduling();
  642. for (const effect2 of dep.keys()) {
  643. let tracking;
  644. if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  645. effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
  646. effect2._dirtyLevel = dirtyLevel;
  647. }
  648. if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  649. {
  650. (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  651. }
  652. effect2.trigger();
  653. if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
  654. effect2._shouldSchedule = false;
  655. if (effect2.scheduler) {
  656. queueEffectSchedulers.push(effect2.scheduler);
  657. }
  658. }
  659. }
  660. }
  661. resetScheduling();
  662. }
  663. const createDep = (cleanup, computed2) => {
  664. const dep = /* @__PURE__ */ new Map();
  665. dep.cleanup = cleanup;
  666. dep.computed = computed2;
  667. return dep;
  668. };
  669. const targetMap = /* @__PURE__ */ new WeakMap();
  670. const ITERATE_KEY = Symbol("iterate");
  671. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
  672. function track(target, type, key) {
  673. if (shouldTrack && activeEffect) {
  674. let depsMap = targetMap.get(target);
  675. if (!depsMap) {
  676. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  677. }
  678. let dep = depsMap.get(key);
  679. if (!dep) {
  680. depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
  681. }
  682. trackEffect(
  683. activeEffect,
  684. dep,
  685. {
  686. target,
  687. type,
  688. key
  689. }
  690. );
  691. }
  692. }
  693. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  694. const depsMap = targetMap.get(target);
  695. if (!depsMap) {
  696. return;
  697. }
  698. let deps = [];
  699. if (type === "clear") {
  700. deps = [...depsMap.values()];
  701. } else if (key === "length" && isArray(target)) {
  702. const newLength = Number(newValue);
  703. depsMap.forEach((dep, key2) => {
  704. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  705. deps.push(dep);
  706. }
  707. });
  708. } else {
  709. if (key !== void 0) {
  710. deps.push(depsMap.get(key));
  711. }
  712. switch (type) {
  713. case "add":
  714. if (!isArray(target)) {
  715. deps.push(depsMap.get(ITERATE_KEY));
  716. if (isMap(target)) {
  717. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  718. }
  719. } else if (isIntegerKey(key)) {
  720. deps.push(depsMap.get("length"));
  721. }
  722. break;
  723. case "delete":
  724. if (!isArray(target)) {
  725. deps.push(depsMap.get(ITERATE_KEY));
  726. if (isMap(target)) {
  727. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  728. }
  729. }
  730. break;
  731. case "set":
  732. if (isMap(target)) {
  733. deps.push(depsMap.get(ITERATE_KEY));
  734. }
  735. break;
  736. }
  737. }
  738. pauseScheduling();
  739. for (const dep of deps) {
  740. if (dep) {
  741. triggerEffects(
  742. dep,
  743. 4,
  744. {
  745. target,
  746. type,
  747. key,
  748. newValue,
  749. oldValue,
  750. oldTarget
  751. }
  752. );
  753. }
  754. }
  755. resetScheduling();
  756. }
  757. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  758. const builtInSymbols = new Set(
  759. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  760. );
  761. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  762. function createArrayInstrumentations() {
  763. const instrumentations = {};
  764. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  765. instrumentations[key] = function(...args) {
  766. const arr = toRaw(this);
  767. for (let i = 0, l = this.length; i < l; i++) {
  768. track(arr, "get", i + "");
  769. }
  770. const res = arr[key](...args);
  771. if (res === -1 || res === false) {
  772. return arr[key](...args.map(toRaw));
  773. } else {
  774. return res;
  775. }
  776. };
  777. });
  778. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  779. instrumentations[key] = function(...args) {
  780. pauseTracking();
  781. pauseScheduling();
  782. const res = toRaw(this)[key].apply(this, args);
  783. resetScheduling();
  784. resetTracking();
  785. return res;
  786. };
  787. });
  788. return instrumentations;
  789. }
  790. function hasOwnProperty(key) {
  791. const obj = toRaw(this);
  792. track(obj, "has", key);
  793. return obj.hasOwnProperty(key);
  794. }
  795. class BaseReactiveHandler {
  796. constructor(_isReadonly = false, _isShallow = false) {
  797. this._isReadonly = _isReadonly;
  798. this._isShallow = _isShallow;
  799. }
  800. get(target, key, receiver) {
  801. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  802. if (key === "__v_isReactive") {
  803. return !isReadonly2;
  804. } else if (key === "__v_isReadonly") {
  805. return isReadonly2;
  806. } else if (key === "__v_isShallow") {
  807. return isShallow2;
  808. } else if (key === "__v_raw") {
  809. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  810. // this means the reciever is a user proxy of the reactive proxy
  811. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  812. return target;
  813. }
  814. return;
  815. }
  816. const targetIsArray = isArray(target);
  817. if (!isReadonly2) {
  818. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  819. return Reflect.get(arrayInstrumentations, key, receiver);
  820. }
  821. if (key === "hasOwnProperty") {
  822. return hasOwnProperty;
  823. }
  824. }
  825. const res = Reflect.get(target, key, receiver);
  826. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  827. return res;
  828. }
  829. if (!isReadonly2) {
  830. track(target, "get", key);
  831. }
  832. if (isShallow2) {
  833. return res;
  834. }
  835. if (isRef(res)) {
  836. return targetIsArray && isIntegerKey(key) ? res : res.value;
  837. }
  838. if (isObject(res)) {
  839. return isReadonly2 ? readonly(res) : reactive(res);
  840. }
  841. return res;
  842. }
  843. }
  844. class MutableReactiveHandler extends BaseReactiveHandler {
  845. constructor(isShallow2 = false) {
  846. super(false, isShallow2);
  847. }
  848. set(target, key, value, receiver) {
  849. let oldValue = target[key];
  850. if (!this._isShallow) {
  851. const isOldValueReadonly = isReadonly(oldValue);
  852. if (!isShallow(value) && !isReadonly(value)) {
  853. oldValue = toRaw(oldValue);
  854. value = toRaw(value);
  855. }
  856. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  857. if (isOldValueReadonly) {
  858. return false;
  859. } else {
  860. oldValue.value = value;
  861. return true;
  862. }
  863. }
  864. }
  865. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  866. const result = Reflect.set(target, key, value, receiver);
  867. if (target === toRaw(receiver)) {
  868. if (!hadKey) {
  869. trigger(target, "add", key, value);
  870. } else if (hasChanged(value, oldValue)) {
  871. trigger(target, "set", key, value, oldValue);
  872. }
  873. }
  874. return result;
  875. }
  876. deleteProperty(target, key) {
  877. const hadKey = hasOwn(target, key);
  878. const oldValue = target[key];
  879. const result = Reflect.deleteProperty(target, key);
  880. if (result && hadKey) {
  881. trigger(target, "delete", key, void 0, oldValue);
  882. }
  883. return result;
  884. }
  885. has(target, key) {
  886. const result = Reflect.has(target, key);
  887. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  888. track(target, "has", key);
  889. }
  890. return result;
  891. }
  892. ownKeys(target) {
  893. track(
  894. target,
  895. "iterate",
  896. isArray(target) ? "length" : ITERATE_KEY
  897. );
  898. return Reflect.ownKeys(target);
  899. }
  900. }
  901. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  902. constructor(isShallow2 = false) {
  903. super(true, isShallow2);
  904. }
  905. set(target, key) {
  906. {
  907. warn$2(
  908. `Set operation on key "${String(key)}" failed: target is readonly.`,
  909. target
  910. );
  911. }
  912. return true;
  913. }
  914. deleteProperty(target, key) {
  915. {
  916. warn$2(
  917. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  918. target
  919. );
  920. }
  921. return true;
  922. }
  923. }
  924. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  925. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  926. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
  927. true
  928. );
  929. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  930. const toShallow = (value) => value;
  931. const getProto = (v) => Reflect.getPrototypeOf(v);
  932. function get(target, key, isReadonly2 = false, isShallow2 = false) {
  933. target = target["__v_raw"];
  934. const rawTarget = toRaw(target);
  935. const rawKey = toRaw(key);
  936. if (!isReadonly2) {
  937. if (hasChanged(key, rawKey)) {
  938. track(rawTarget, "get", key);
  939. }
  940. track(rawTarget, "get", rawKey);
  941. }
  942. const { has: has2 } = getProto(rawTarget);
  943. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  944. if (has2.call(rawTarget, key)) {
  945. return wrap(target.get(key));
  946. } else if (has2.call(rawTarget, rawKey)) {
  947. return wrap(target.get(rawKey));
  948. } else if (target !== rawTarget) {
  949. target.get(key);
  950. }
  951. }
  952. function has$1(key, isReadonly2 = false) {
  953. const target = this["__v_raw"];
  954. const rawTarget = toRaw(target);
  955. const rawKey = toRaw(key);
  956. if (!isReadonly2) {
  957. if (hasChanged(key, rawKey)) {
  958. track(rawTarget, "has", key);
  959. }
  960. track(rawTarget, "has", rawKey);
  961. }
  962. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  963. }
  964. function size(target, isReadonly2 = false) {
  965. target = target["__v_raw"];
  966. !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
  967. return Reflect.get(target, "size", target);
  968. }
  969. function add(value) {
  970. value = toRaw(value);
  971. const target = toRaw(this);
  972. const proto = getProto(target);
  973. const hadKey = proto.has.call(target, value);
  974. if (!hadKey) {
  975. target.add(value);
  976. trigger(target, "add", value, value);
  977. }
  978. return this;
  979. }
  980. function set$1(key, value) {
  981. value = toRaw(value);
  982. const target = toRaw(this);
  983. const { has: has2, get: get2 } = getProto(target);
  984. let hadKey = has2.call(target, key);
  985. if (!hadKey) {
  986. key = toRaw(key);
  987. hadKey = has2.call(target, key);
  988. } else {
  989. checkIdentityKeys(target, has2, key);
  990. }
  991. const oldValue = get2.call(target, key);
  992. target.set(key, value);
  993. if (!hadKey) {
  994. trigger(target, "add", key, value);
  995. } else if (hasChanged(value, oldValue)) {
  996. trigger(target, "set", key, value, oldValue);
  997. }
  998. return this;
  999. }
  1000. function deleteEntry(key) {
  1001. const target = toRaw(this);
  1002. const { has: has2, get: get2 } = getProto(target);
  1003. let hadKey = has2.call(target, key);
  1004. if (!hadKey) {
  1005. key = toRaw(key);
  1006. hadKey = has2.call(target, key);
  1007. } else {
  1008. checkIdentityKeys(target, has2, key);
  1009. }
  1010. const oldValue = get2 ? get2.call(target, key) : void 0;
  1011. const result = target.delete(key);
  1012. if (hadKey) {
  1013. trigger(target, "delete", key, void 0, oldValue);
  1014. }
  1015. return result;
  1016. }
  1017. function clear() {
  1018. const target = toRaw(this);
  1019. const hadItems = target.size !== 0;
  1020. const oldTarget = isMap(target) ? new Map(target) : new Set(target);
  1021. const result = target.clear();
  1022. if (hadItems) {
  1023. trigger(target, "clear", void 0, void 0, oldTarget);
  1024. }
  1025. return result;
  1026. }
  1027. function createForEach(isReadonly2, isShallow2) {
  1028. return function forEach(callback, thisArg) {
  1029. const observed = this;
  1030. const target = observed["__v_raw"];
  1031. const rawTarget = toRaw(target);
  1032. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1033. !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
  1034. return target.forEach((value, key) => {
  1035. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1036. });
  1037. };
  1038. }
  1039. function createIterableMethod(method, isReadonly2, isShallow2) {
  1040. return function(...args) {
  1041. const target = this["__v_raw"];
  1042. const rawTarget = toRaw(target);
  1043. const targetIsMap = isMap(rawTarget);
  1044. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1045. const isKeyOnly = method === "keys" && targetIsMap;
  1046. const innerIterator = target[method](...args);
  1047. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1048. !isReadonly2 && track(
  1049. rawTarget,
  1050. "iterate",
  1051. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1052. );
  1053. return {
  1054. // iterator protocol
  1055. next() {
  1056. const { value, done } = innerIterator.next();
  1057. return done ? { value, done } : {
  1058. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1059. done
  1060. };
  1061. },
  1062. // iterable protocol
  1063. [Symbol.iterator]() {
  1064. return this;
  1065. }
  1066. };
  1067. };
  1068. }
  1069. function createReadonlyMethod(type) {
  1070. return function(...args) {
  1071. {
  1072. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1073. warn$2(
  1074. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1075. toRaw(this)
  1076. );
  1077. }
  1078. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1079. };
  1080. }
  1081. function createInstrumentations() {
  1082. const mutableInstrumentations2 = {
  1083. get(key) {
  1084. return get(this, key);
  1085. },
  1086. get size() {
  1087. return size(this);
  1088. },
  1089. has: has$1,
  1090. add,
  1091. set: set$1,
  1092. delete: deleteEntry,
  1093. clear,
  1094. forEach: createForEach(false, false)
  1095. };
  1096. const shallowInstrumentations2 = {
  1097. get(key) {
  1098. return get(this, key, false, true);
  1099. },
  1100. get size() {
  1101. return size(this);
  1102. },
  1103. has: has$1,
  1104. add,
  1105. set: set$1,
  1106. delete: deleteEntry,
  1107. clear,
  1108. forEach: createForEach(false, true)
  1109. };
  1110. const readonlyInstrumentations2 = {
  1111. get(key) {
  1112. return get(this, key, true);
  1113. },
  1114. get size() {
  1115. return size(this, true);
  1116. },
  1117. has(key) {
  1118. return has$1.call(this, key, true);
  1119. },
  1120. add: createReadonlyMethod("add"),
  1121. set: createReadonlyMethod("set"),
  1122. delete: createReadonlyMethod("delete"),
  1123. clear: createReadonlyMethod("clear"),
  1124. forEach: createForEach(true, false)
  1125. };
  1126. const shallowReadonlyInstrumentations2 = {
  1127. get(key) {
  1128. return get(this, key, true, true);
  1129. },
  1130. get size() {
  1131. return size(this, true);
  1132. },
  1133. has(key) {
  1134. return has$1.call(this, key, true);
  1135. },
  1136. add: createReadonlyMethod("add"),
  1137. set: createReadonlyMethod("set"),
  1138. delete: createReadonlyMethod("delete"),
  1139. clear: createReadonlyMethod("clear"),
  1140. forEach: createForEach(true, true)
  1141. };
  1142. const iteratorMethods = [
  1143. "keys",
  1144. "values",
  1145. "entries",
  1146. Symbol.iterator
  1147. ];
  1148. iteratorMethods.forEach((method) => {
  1149. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  1150. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  1151. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  1152. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1153. method,
  1154. true,
  1155. true
  1156. );
  1157. });
  1158. return [
  1159. mutableInstrumentations2,
  1160. readonlyInstrumentations2,
  1161. shallowInstrumentations2,
  1162. shallowReadonlyInstrumentations2
  1163. ];
  1164. }
  1165. const [
  1166. mutableInstrumentations,
  1167. readonlyInstrumentations,
  1168. shallowInstrumentations,
  1169. shallowReadonlyInstrumentations
  1170. ] = /* @__PURE__ */ createInstrumentations();
  1171. function createInstrumentationGetter(isReadonly2, shallow) {
  1172. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  1173. return (target, key, receiver) => {
  1174. if (key === "__v_isReactive") {
  1175. return !isReadonly2;
  1176. } else if (key === "__v_isReadonly") {
  1177. return isReadonly2;
  1178. } else if (key === "__v_raw") {
  1179. return target;
  1180. }
  1181. return Reflect.get(
  1182. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1183. key,
  1184. receiver
  1185. );
  1186. };
  1187. }
  1188. const mutableCollectionHandlers = {
  1189. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1190. };
  1191. const shallowCollectionHandlers = {
  1192. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1193. };
  1194. const readonlyCollectionHandlers = {
  1195. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1196. };
  1197. const shallowReadonlyCollectionHandlers = {
  1198. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1199. };
  1200. function checkIdentityKeys(target, has2, key) {
  1201. const rawKey = toRaw(key);
  1202. if (rawKey !== key && has2.call(target, rawKey)) {
  1203. const type = toRawType(target);
  1204. warn$2(
  1205. `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.`
  1206. );
  1207. }
  1208. }
  1209. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1210. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1211. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1212. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1213. function targetTypeMap(rawType) {
  1214. switch (rawType) {
  1215. case "Object":
  1216. case "Array":
  1217. return 1;
  1218. case "Map":
  1219. case "Set":
  1220. case "WeakMap":
  1221. case "WeakSet":
  1222. return 2;
  1223. default:
  1224. return 0;
  1225. }
  1226. }
  1227. function getTargetType(value) {
  1228. return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
  1229. }
  1230. function reactive(target) {
  1231. if (isReadonly(target)) {
  1232. return target;
  1233. }
  1234. return createReactiveObject(
  1235. target,
  1236. false,
  1237. mutableHandlers,
  1238. mutableCollectionHandlers,
  1239. reactiveMap
  1240. );
  1241. }
  1242. function shallowReactive(target) {
  1243. return createReactiveObject(
  1244. target,
  1245. false,
  1246. shallowReactiveHandlers,
  1247. shallowCollectionHandlers,
  1248. shallowReactiveMap
  1249. );
  1250. }
  1251. function readonly(target) {
  1252. return createReactiveObject(
  1253. target,
  1254. true,
  1255. readonlyHandlers,
  1256. readonlyCollectionHandlers,
  1257. readonlyMap
  1258. );
  1259. }
  1260. function shallowReadonly(target) {
  1261. return createReactiveObject(
  1262. target,
  1263. true,
  1264. shallowReadonlyHandlers,
  1265. shallowReadonlyCollectionHandlers,
  1266. shallowReadonlyMap
  1267. );
  1268. }
  1269. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1270. if (!isObject(target)) {
  1271. {
  1272. warn$2(`value cannot be made reactive: ${String(target)}`);
  1273. }
  1274. return target;
  1275. }
  1276. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1277. return target;
  1278. }
  1279. const existingProxy = proxyMap.get(target);
  1280. if (existingProxy) {
  1281. return existingProxy;
  1282. }
  1283. const targetType = getTargetType(target);
  1284. if (targetType === 0) {
  1285. return target;
  1286. }
  1287. const proxy = new Proxy(
  1288. target,
  1289. targetType === 2 ? collectionHandlers : baseHandlers
  1290. );
  1291. proxyMap.set(target, proxy);
  1292. return proxy;
  1293. }
  1294. function isReactive(value) {
  1295. if (isReadonly(value)) {
  1296. return isReactive(value["__v_raw"]);
  1297. }
  1298. return !!(value && value["__v_isReactive"]);
  1299. }
  1300. function isReadonly(value) {
  1301. return !!(value && value["__v_isReadonly"]);
  1302. }
  1303. function isShallow(value) {
  1304. return !!(value && value["__v_isShallow"]);
  1305. }
  1306. function isProxy(value) {
  1307. return isReactive(value) || isReadonly(value);
  1308. }
  1309. function toRaw(observed) {
  1310. const raw = observed && observed["__v_raw"];
  1311. return raw ? toRaw(raw) : observed;
  1312. }
  1313. function markRaw(value) {
  1314. if (Object.isExtensible(value)) {
  1315. def(value, "__v_skip", true);
  1316. }
  1317. return value;
  1318. }
  1319. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1320. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1321. const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
  1322. class ComputedRefImpl {
  1323. constructor(getter, _setter, isReadonly2, isSSR) {
  1324. this.getter = getter;
  1325. this._setter = _setter;
  1326. this.dep = void 0;
  1327. this.__v_isRef = true;
  1328. this["__v_isReadonly"] = false;
  1329. this.effect = new ReactiveEffect(
  1330. () => getter(this._value),
  1331. () => triggerRefValue(
  1332. this,
  1333. this.effect._dirtyLevel === 2 ? 2 : 3
  1334. )
  1335. );
  1336. this.effect.computed = this;
  1337. this.effect.active = this._cacheable = !isSSR;
  1338. this["__v_isReadonly"] = isReadonly2;
  1339. }
  1340. get value() {
  1341. const self = toRaw(this);
  1342. if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
  1343. triggerRefValue(self, 4);
  1344. }
  1345. trackRefValue(self);
  1346. if (self.effect._dirtyLevel >= 2) {
  1347. if (this._warnRecursive) {
  1348. warn$2(COMPUTED_SIDE_EFFECT_WARN, `
  1349. getter: `, this.getter);
  1350. }
  1351. triggerRefValue(self, 2);
  1352. }
  1353. return self._value;
  1354. }
  1355. set value(newValue) {
  1356. this._setter(newValue);
  1357. }
  1358. // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
  1359. get _dirty() {
  1360. return this.effect.dirty;
  1361. }
  1362. set _dirty(v) {
  1363. this.effect.dirty = v;
  1364. }
  1365. // #endregion
  1366. }
  1367. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1368. let getter;
  1369. let setter;
  1370. const onlyGetter = isFunction(getterOrOptions);
  1371. if (onlyGetter) {
  1372. getter = getterOrOptions;
  1373. setter = () => {
  1374. warn$2("Write operation failed: computed value is readonly");
  1375. };
  1376. } else {
  1377. getter = getterOrOptions.get;
  1378. setter = getterOrOptions.set;
  1379. }
  1380. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1381. if (debugOptions && !isSSR) {
  1382. cRef.effect.onTrack = debugOptions.onTrack;
  1383. cRef.effect.onTrigger = debugOptions.onTrigger;
  1384. }
  1385. return cRef;
  1386. }
  1387. function trackRefValue(ref2) {
  1388. var _a;
  1389. if (shouldTrack && activeEffect) {
  1390. ref2 = toRaw(ref2);
  1391. trackEffect(
  1392. activeEffect,
  1393. (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
  1394. () => ref2.dep = void 0,
  1395. ref2 instanceof ComputedRefImpl ? ref2 : void 0
  1396. ),
  1397. {
  1398. target: ref2,
  1399. type: "get",
  1400. key: "value"
  1401. }
  1402. );
  1403. }
  1404. }
  1405. function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
  1406. ref2 = toRaw(ref2);
  1407. const dep = ref2.dep;
  1408. if (dep) {
  1409. triggerEffects(
  1410. dep,
  1411. dirtyLevel,
  1412. {
  1413. target: ref2,
  1414. type: "set",
  1415. key: "value",
  1416. newValue: newVal
  1417. }
  1418. );
  1419. }
  1420. }
  1421. function isRef(r2) {
  1422. return !!(r2 && r2.__v_isRef === true);
  1423. }
  1424. function ref(value) {
  1425. return createRef(value, false);
  1426. }
  1427. function createRef(rawValue, shallow) {
  1428. if (isRef(rawValue)) {
  1429. return rawValue;
  1430. }
  1431. return new RefImpl(rawValue, shallow);
  1432. }
  1433. class RefImpl {
  1434. constructor(value, __v_isShallow) {
  1435. this.__v_isShallow = __v_isShallow;
  1436. this.dep = void 0;
  1437. this.__v_isRef = true;
  1438. this._rawValue = __v_isShallow ? value : toRaw(value);
  1439. this._value = __v_isShallow ? value : toReactive(value);
  1440. }
  1441. get value() {
  1442. trackRefValue(this);
  1443. return this._value;
  1444. }
  1445. set value(newVal) {
  1446. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1447. newVal = useDirectValue ? newVal : toRaw(newVal);
  1448. if (hasChanged(newVal, this._rawValue)) {
  1449. this._rawValue = newVal;
  1450. this._value = useDirectValue ? newVal : toReactive(newVal);
  1451. triggerRefValue(this, 4, newVal);
  1452. }
  1453. }
  1454. }
  1455. function unref(ref2) {
  1456. return isRef(ref2) ? ref2.value : ref2;
  1457. }
  1458. const shallowUnwrapHandlers = {
  1459. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1460. set: (target, key, value, receiver) => {
  1461. const oldValue = target[key];
  1462. if (isRef(oldValue) && !isRef(value)) {
  1463. oldValue.value = value;
  1464. return true;
  1465. } else {
  1466. return Reflect.set(target, key, value, receiver);
  1467. }
  1468. }
  1469. };
  1470. function proxyRefs(objectWithRefs) {
  1471. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1472. }
  1473. const stack = [];
  1474. function pushWarningContext(vnode) {
  1475. stack.push(vnode);
  1476. }
  1477. function popWarningContext() {
  1478. stack.pop();
  1479. }
  1480. function warn$1(msg, ...args) {
  1481. pauseTracking();
  1482. const instance = stack.length ? stack[stack.length - 1].component : null;
  1483. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1484. const trace = getComponentTrace();
  1485. if (appWarnHandler) {
  1486. callWithErrorHandling(
  1487. appWarnHandler,
  1488. instance,
  1489. 11,
  1490. [
  1491. msg + args.map((a) => {
  1492. var _a, _b;
  1493. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  1494. }).join(""),
  1495. instance && instance.proxy,
  1496. trace.map(
  1497. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1498. ).join("\n"),
  1499. trace
  1500. ]
  1501. );
  1502. } else {
  1503. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1504. if (trace.length && // avoid spamming console during tests
  1505. true) {
  1506. warnArgs.push(`
  1507. `, ...formatTrace(trace));
  1508. }
  1509. console.warn(...warnArgs);
  1510. }
  1511. resetTracking();
  1512. }
  1513. function getComponentTrace() {
  1514. let currentVNode = stack[stack.length - 1];
  1515. if (!currentVNode) {
  1516. return [];
  1517. }
  1518. const normalizedStack = [];
  1519. while (currentVNode) {
  1520. const last = normalizedStack[0];
  1521. if (last && last.vnode === currentVNode) {
  1522. last.recurseCount++;
  1523. } else {
  1524. normalizedStack.push({
  1525. vnode: currentVNode,
  1526. recurseCount: 0
  1527. });
  1528. }
  1529. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1530. currentVNode = parentInstance && parentInstance.vnode;
  1531. }
  1532. return normalizedStack;
  1533. }
  1534. function formatTrace(trace) {
  1535. const logs = [];
  1536. trace.forEach((entry, i) => {
  1537. logs.push(...i === 0 ? [] : [`
  1538. `], ...formatTraceEntry(entry));
  1539. });
  1540. return logs;
  1541. }
  1542. function formatTraceEntry({ vnode, recurseCount }) {
  1543. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1544. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1545. const open = ` at <${formatComponentName(
  1546. vnode.component,
  1547. vnode.type,
  1548. isRoot
  1549. )}`;
  1550. const close = `>` + postfix;
  1551. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1552. }
  1553. function formatProps(props) {
  1554. const res = [];
  1555. const keys = Object.keys(props);
  1556. keys.slice(0, 3).forEach((key) => {
  1557. res.push(...formatProp(key, props[key]));
  1558. });
  1559. if (keys.length > 3) {
  1560. res.push(` ...`);
  1561. }
  1562. return res;
  1563. }
  1564. function formatProp(key, value, raw) {
  1565. if (isString(value)) {
  1566. value = JSON.stringify(value);
  1567. return raw ? value : [`${key}=${value}`];
  1568. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1569. return raw ? value : [`${key}=${value}`];
  1570. } else if (isRef(value)) {
  1571. value = formatProp(key, toRaw(value.value), true);
  1572. return raw ? value : [`${key}=Ref<`, value, `>`];
  1573. } else if (isFunction(value)) {
  1574. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1575. } else {
  1576. value = toRaw(value);
  1577. return raw ? value : [`${key}=`, value];
  1578. }
  1579. }
  1580. const ErrorTypeStrings = {
  1581. ["sp"]: "serverPrefetch hook",
  1582. ["bc"]: "beforeCreate hook",
  1583. ["c"]: "created hook",
  1584. ["bm"]: "beforeMount hook",
  1585. ["m"]: "mounted hook",
  1586. ["bu"]: "beforeUpdate hook",
  1587. ["u"]: "updated",
  1588. ["bum"]: "beforeUnmount hook",
  1589. ["um"]: "unmounted hook",
  1590. ["a"]: "activated hook",
  1591. ["da"]: "deactivated hook",
  1592. ["ec"]: "errorCaptured hook",
  1593. ["rtc"]: "renderTracked hook",
  1594. ["rtg"]: "renderTriggered hook",
  1595. [0]: "setup function",
  1596. [1]: "render function",
  1597. [2]: "watcher getter",
  1598. [3]: "watcher callback",
  1599. [4]: "watcher cleanup function",
  1600. [5]: "native event handler",
  1601. [6]: "component event handler",
  1602. [7]: "vnode hook",
  1603. [8]: "directive hook",
  1604. [9]: "transition hook",
  1605. [10]: "app errorHandler",
  1606. [11]: "app warnHandler",
  1607. [12]: "ref function",
  1608. [13]: "async component loader",
  1609. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
  1610. };
  1611. function callWithErrorHandling(fn, instance, type, args) {
  1612. try {
  1613. return args ? fn(...args) : fn();
  1614. } catch (err) {
  1615. handleError(err, instance, type);
  1616. }
  1617. }
  1618. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1619. if (isFunction(fn)) {
  1620. const res = callWithErrorHandling(fn, instance, type, args);
  1621. if (res && isPromise(res)) {
  1622. res.catch((err) => {
  1623. handleError(err, instance, type);
  1624. });
  1625. }
  1626. return res;
  1627. }
  1628. const values = [];
  1629. for (let i = 0; i < fn.length; i++) {
  1630. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1631. }
  1632. return values;
  1633. }
  1634. function handleError(err, instance, type, throwInDev = true) {
  1635. const contextVNode = instance ? instance.vnode : null;
  1636. if (instance) {
  1637. let cur = instance.parent;
  1638. const exposedInstance = instance.proxy;
  1639. const errorInfo = ErrorTypeStrings[type] || type;
  1640. while (cur) {
  1641. const errorCapturedHooks = cur.ec;
  1642. if (errorCapturedHooks) {
  1643. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1644. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1645. return;
  1646. }
  1647. }
  1648. }
  1649. cur = cur.parent;
  1650. }
  1651. const appErrorHandler = instance.appContext.config.errorHandler;
  1652. if (appErrorHandler) {
  1653. callWithErrorHandling(
  1654. appErrorHandler,
  1655. null,
  1656. 10,
  1657. [err, exposedInstance, errorInfo]
  1658. );
  1659. return;
  1660. }
  1661. }
  1662. logError(err, type, contextVNode, throwInDev);
  1663. }
  1664. function logError(err, type, contextVNode, throwInDev = true) {
  1665. {
  1666. const info = ErrorTypeStrings[type] || type;
  1667. if (contextVNode) {
  1668. pushWarningContext(contextVNode);
  1669. }
  1670. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1671. if (contextVNode) {
  1672. popWarningContext();
  1673. }
  1674. if (throwInDev) {
  1675. console.error(err);
  1676. } else {
  1677. console.error(err);
  1678. }
  1679. }
  1680. }
  1681. let isFlushing = false;
  1682. let isFlushPending = false;
  1683. const queue$1 = [];
  1684. let flushIndex = 0;
  1685. const pendingPostFlushCbs = [];
  1686. let activePostFlushCbs = null;
  1687. let postFlushIndex = 0;
  1688. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1689. let currentFlushPromise = null;
  1690. const RECURSION_LIMIT = 100;
  1691. function nextTick$1(fn) {
  1692. const p2 = currentFlushPromise || resolvedPromise;
  1693. return fn ? p2.then(this ? fn.bind(this) : fn) : p2;
  1694. }
  1695. function findInsertionIndex(id) {
  1696. let start = flushIndex + 1;
  1697. let end = queue$1.length;
  1698. while (start < end) {
  1699. const middle = start + end >>> 1;
  1700. const middleJob = queue$1[middle];
  1701. const middleJobId = getId(middleJob);
  1702. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  1703. start = middle + 1;
  1704. } else {
  1705. end = middle;
  1706. }
  1707. }
  1708. return start;
  1709. }
  1710. function queueJob(job) {
  1711. if (!queue$1.length || !queue$1.includes(
  1712. job,
  1713. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1714. )) {
  1715. if (job.id == null) {
  1716. queue$1.push(job);
  1717. } else {
  1718. queue$1.splice(findInsertionIndex(job.id), 0, job);
  1719. }
  1720. queueFlush();
  1721. }
  1722. }
  1723. function queueFlush() {
  1724. if (!isFlushing && !isFlushPending) {
  1725. isFlushPending = true;
  1726. currentFlushPromise = resolvedPromise.then(flushJobs);
  1727. }
  1728. }
  1729. function hasQueueJob(job) {
  1730. return queue$1.indexOf(job) > -1;
  1731. }
  1732. function invalidateJob(job) {
  1733. const i = queue$1.indexOf(job);
  1734. if (i > flushIndex) {
  1735. queue$1.splice(i, 1);
  1736. }
  1737. }
  1738. function queuePostFlushCb(cb) {
  1739. if (!isArray(cb)) {
  1740. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1741. cb,
  1742. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1743. )) {
  1744. pendingPostFlushCbs.push(cb);
  1745. }
  1746. } else {
  1747. pendingPostFlushCbs.push(...cb);
  1748. }
  1749. queueFlush();
  1750. }
  1751. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  1752. {
  1753. seen = seen || /* @__PURE__ */ new Map();
  1754. }
  1755. for (; i < queue$1.length; i++) {
  1756. const cb = queue$1[i];
  1757. if (cb && cb.pre) {
  1758. if (checkRecursiveUpdates(seen, cb)) {
  1759. continue;
  1760. }
  1761. queue$1.splice(i, 1);
  1762. i--;
  1763. cb();
  1764. }
  1765. }
  1766. }
  1767. function flushPostFlushCbs(seen) {
  1768. if (pendingPostFlushCbs.length) {
  1769. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  1770. (a, b) => getId(a) - getId(b)
  1771. );
  1772. pendingPostFlushCbs.length = 0;
  1773. if (activePostFlushCbs) {
  1774. activePostFlushCbs.push(...deduped);
  1775. return;
  1776. }
  1777. activePostFlushCbs = deduped;
  1778. {
  1779. seen = seen || /* @__PURE__ */ new Map();
  1780. }
  1781. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1782. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  1783. continue;
  1784. }
  1785. activePostFlushCbs[postFlushIndex]();
  1786. }
  1787. activePostFlushCbs = null;
  1788. postFlushIndex = 0;
  1789. }
  1790. }
  1791. const getId = (job) => job.id == null ? Infinity : job.id;
  1792. const comparator = (a, b) => {
  1793. const diff2 = getId(a) - getId(b);
  1794. if (diff2 === 0) {
  1795. if (a.pre && !b.pre)
  1796. return -1;
  1797. if (b.pre && !a.pre)
  1798. return 1;
  1799. }
  1800. return diff2;
  1801. };
  1802. function flushJobs(seen) {
  1803. isFlushPending = false;
  1804. isFlushing = true;
  1805. {
  1806. seen = seen || /* @__PURE__ */ new Map();
  1807. }
  1808. queue$1.sort(comparator);
  1809. const check = (job) => checkRecursiveUpdates(seen, job);
  1810. try {
  1811. for (flushIndex = 0; flushIndex < queue$1.length; flushIndex++) {
  1812. const job = queue$1[flushIndex];
  1813. if (job && job.active !== false) {
  1814. if (check(job)) {
  1815. continue;
  1816. }
  1817. callWithErrorHandling(job, null, 14);
  1818. }
  1819. }
  1820. } finally {
  1821. flushIndex = 0;
  1822. queue$1.length = 0;
  1823. flushPostFlushCbs(seen);
  1824. isFlushing = false;
  1825. currentFlushPromise = null;
  1826. if (queue$1.length || pendingPostFlushCbs.length) {
  1827. flushJobs(seen);
  1828. }
  1829. }
  1830. }
  1831. function checkRecursiveUpdates(seen, fn) {
  1832. if (!seen.has(fn)) {
  1833. seen.set(fn, 1);
  1834. } else {
  1835. const count = seen.get(fn);
  1836. if (count > RECURSION_LIMIT) {
  1837. const instance = fn.ownerInstance;
  1838. const componentName = instance && getComponentName(instance.type);
  1839. handleError(
  1840. `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.`,
  1841. null,
  1842. 10
  1843. );
  1844. return true;
  1845. } else {
  1846. seen.set(fn, count + 1);
  1847. }
  1848. }
  1849. }
  1850. let devtools;
  1851. let buffer = [];
  1852. let devtoolsNotInstalled = false;
  1853. function emit$1(event, ...args) {
  1854. if (devtools) {
  1855. devtools.emit(event, ...args);
  1856. } else if (!devtoolsNotInstalled) {
  1857. buffer.push({ event, args });
  1858. }
  1859. }
  1860. function setDevtoolsHook(hook, target) {
  1861. var _a, _b;
  1862. devtools = hook;
  1863. if (devtools) {
  1864. devtools.enabled = true;
  1865. buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
  1866. buffer = [];
  1867. } else if (
  1868. // handle late devtools injection - only do this if we are in an actual
  1869. // browser environment to avoid the timer handle stalling test runner exit
  1870. // (#4815)
  1871. typeof window !== "undefined" && // some envs mock window but not fully
  1872. window.HTMLElement && // also exclude jsdom
  1873. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  1874. ) {
  1875. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  1876. replay.push((newHook) => {
  1877. setDevtoolsHook(newHook, target);
  1878. });
  1879. setTimeout(() => {
  1880. if (!devtools) {
  1881. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  1882. devtoolsNotInstalled = true;
  1883. buffer = [];
  1884. }
  1885. }, 3e3);
  1886. } else {
  1887. devtoolsNotInstalled = true;
  1888. buffer = [];
  1889. }
  1890. }
  1891. function devtoolsInitApp(app, version2) {
  1892. emit$1("app:init", app, version2, {
  1893. Fragment,
  1894. Text,
  1895. Comment,
  1896. Static
  1897. });
  1898. }
  1899. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  1900. "component:added"
  1901. /* COMPONENT_ADDED */
  1902. );
  1903. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook(
  1904. "component:updated"
  1905. /* COMPONENT_UPDATED */
  1906. );
  1907. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  1908. "component:removed"
  1909. /* COMPONENT_REMOVED */
  1910. );
  1911. const devtoolsComponentRemoved = (component) => {
  1912. if (devtools && typeof devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  1913. !devtools.cleanupBuffer(component)) {
  1914. _devtoolsComponentRemoved(component);
  1915. }
  1916. };
  1917. /*! #__NO_SIDE_EFFECTS__ */
  1918. // @__NO_SIDE_EFFECTS__
  1919. function createDevtoolsComponentHook(hook) {
  1920. return (component) => {
  1921. emit$1(
  1922. hook,
  1923. component.appContext.app,
  1924. component.uid,
  1925. // fixed by xxxxxx
  1926. // 为 0 是 App,无 parent 是 Page 指向 App
  1927. component.uid === 0 ? void 0 : component.parent ? component.parent.uid : 0,
  1928. component
  1929. );
  1930. };
  1931. }
  1932. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  1933. "perf:start"
  1934. /* PERFORMANCE_START */
  1935. );
  1936. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  1937. "perf:end"
  1938. /* PERFORMANCE_END */
  1939. );
  1940. function createDevtoolsPerformanceHook(hook) {
  1941. return (component, type, time) => {
  1942. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  1943. };
  1944. }
  1945. function devtoolsComponentEmit(component, event, params) {
  1946. emit$1(
  1947. "component:emit",
  1948. component.appContext.app,
  1949. component,
  1950. event,
  1951. params
  1952. );
  1953. }
  1954. function emit(instance, event, ...rawArgs) {
  1955. if (instance.isUnmounted)
  1956. return;
  1957. const props = instance.vnode.props || EMPTY_OBJ;
  1958. {
  1959. const {
  1960. emitsOptions,
  1961. propsOptions: [propsOptions]
  1962. } = instance;
  1963. if (emitsOptions) {
  1964. if (!(event in emitsOptions) && true) {
  1965. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  1966. warn$1(
  1967. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  1968. );
  1969. }
  1970. } else {
  1971. const validator = emitsOptions[event];
  1972. if (isFunction(validator)) {
  1973. const isValid = validator(...rawArgs);
  1974. if (!isValid) {
  1975. warn$1(
  1976. `Invalid event arguments: event validation failed for event "${event}".`
  1977. );
  1978. }
  1979. }
  1980. }
  1981. }
  1982. }
  1983. let args = rawArgs;
  1984. const isModelListener2 = event.startsWith("update:");
  1985. const modelArg = isModelListener2 && event.slice(7);
  1986. if (modelArg && modelArg in props) {
  1987. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  1988. const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
  1989. if (trim) {
  1990. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  1991. }
  1992. if (number) {
  1993. args = rawArgs.map(looseToNumber);
  1994. }
  1995. }
  1996. {
  1997. devtoolsComponentEmit(instance, event, args);
  1998. }
  1999. {
  2000. const lowerCaseEvent = event.toLowerCase();
  2001. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  2002. warn$1(
  2003. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  2004. instance,
  2005. instance.type
  2006. )} 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(
  2007. event
  2008. )}" instead of "${event}".`
  2009. );
  2010. }
  2011. }
  2012. let handlerName;
  2013. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  2014. props[handlerName = toHandlerKey(camelize(event))];
  2015. if (!handler && isModelListener2) {
  2016. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  2017. }
  2018. if (handler) {
  2019. callWithAsyncErrorHandling(
  2020. handler,
  2021. instance,
  2022. 6,
  2023. args
  2024. );
  2025. }
  2026. const onceHandler = props[handlerName + `Once`];
  2027. if (onceHandler) {
  2028. if (!instance.emitted) {
  2029. instance.emitted = {};
  2030. } else if (instance.emitted[handlerName]) {
  2031. return;
  2032. }
  2033. instance.emitted[handlerName] = true;
  2034. callWithAsyncErrorHandling(
  2035. onceHandler,
  2036. instance,
  2037. 6,
  2038. args
  2039. );
  2040. }
  2041. }
  2042. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  2043. const cache = appContext.emitsCache;
  2044. const cached = cache.get(comp);
  2045. if (cached !== void 0) {
  2046. return cached;
  2047. }
  2048. const raw = comp.emits;
  2049. let normalized = {};
  2050. let hasExtends = false;
  2051. if (!isFunction(comp)) {
  2052. const extendEmits = (raw2) => {
  2053. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  2054. if (normalizedFromExtend) {
  2055. hasExtends = true;
  2056. extend(normalized, normalizedFromExtend);
  2057. }
  2058. };
  2059. if (!asMixin && appContext.mixins.length) {
  2060. appContext.mixins.forEach(extendEmits);
  2061. }
  2062. if (comp.extends) {
  2063. extendEmits(comp.extends);
  2064. }
  2065. if (comp.mixins) {
  2066. comp.mixins.forEach(extendEmits);
  2067. }
  2068. }
  2069. if (!raw && !hasExtends) {
  2070. if (isObject(comp)) {
  2071. cache.set(comp, null);
  2072. }
  2073. return null;
  2074. }
  2075. if (isArray(raw)) {
  2076. raw.forEach((key) => normalized[key] = null);
  2077. } else {
  2078. extend(normalized, raw);
  2079. }
  2080. if (isObject(comp)) {
  2081. cache.set(comp, normalized);
  2082. }
  2083. return normalized;
  2084. }
  2085. function isEmitListener(options, key) {
  2086. if (!options || !isOn(key)) {
  2087. return false;
  2088. }
  2089. key = key.slice(2).replace(/Once$/, "");
  2090. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  2091. }
  2092. let currentRenderingInstance = null;
  2093. function setCurrentRenderingInstance(instance) {
  2094. const prev = currentRenderingInstance;
  2095. currentRenderingInstance = instance;
  2096. instance && instance.type.__scopeId || null;
  2097. return prev;
  2098. }
  2099. const COMPONENTS = "components";
  2100. function resolveComponent(name, maybeSelfReference) {
  2101. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  2102. }
  2103. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  2104. const instance = currentRenderingInstance || currentInstance;
  2105. if (instance) {
  2106. const Component2 = instance.type;
  2107. if (type === COMPONENTS) {
  2108. const selfName = getComponentName(
  2109. Component2,
  2110. false
  2111. );
  2112. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  2113. return Component2;
  2114. }
  2115. }
  2116. const res = (
  2117. // local registration
  2118. // check instance[type] first which is resolved for options API
  2119. resolve(instance[type] || Component2[type], name) || // global registration
  2120. resolve(instance.appContext[type], name)
  2121. );
  2122. if (!res && maybeSelfReference) {
  2123. return Component2;
  2124. }
  2125. if (warnMissing && !res) {
  2126. const extra = type === COMPONENTS ? `
  2127. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  2128. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  2129. }
  2130. return res;
  2131. } else {
  2132. warn$1(
  2133. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  2134. );
  2135. }
  2136. }
  2137. function resolve(registry, name) {
  2138. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  2139. }
  2140. const INITIAL_WATCHER_VALUE = {};
  2141. function watch(source, cb, options) {
  2142. if (!isFunction(cb)) {
  2143. warn$1(
  2144. `\`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.`
  2145. );
  2146. }
  2147. return doWatch(source, cb, options);
  2148. }
  2149. function doWatch(source, cb, {
  2150. immediate,
  2151. deep,
  2152. flush,
  2153. once: once2,
  2154. onTrack,
  2155. onTrigger
  2156. } = EMPTY_OBJ) {
  2157. if (cb && once2) {
  2158. const _cb = cb;
  2159. cb = (...args) => {
  2160. _cb(...args);
  2161. unwatch();
  2162. };
  2163. }
  2164. if (deep !== void 0 && typeof deep === "number") {
  2165. warn$1(
  2166. `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
  2167. );
  2168. }
  2169. if (!cb) {
  2170. if (immediate !== void 0) {
  2171. warn$1(
  2172. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  2173. );
  2174. }
  2175. if (deep !== void 0) {
  2176. warn$1(
  2177. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  2178. );
  2179. }
  2180. if (once2 !== void 0) {
  2181. warn$1(
  2182. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  2183. );
  2184. }
  2185. }
  2186. const warnInvalidSource = (s2) => {
  2187. warn$1(
  2188. `Invalid watch source: `,
  2189. s2,
  2190. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2191. );
  2192. };
  2193. const instance = currentInstance;
  2194. const reactiveGetter = (source2) => deep === true ? source2 : (
  2195. // for deep: false, only traverse root-level properties
  2196. traverse(source2, deep === false ? 1 : void 0)
  2197. );
  2198. let getter;
  2199. let forceTrigger = false;
  2200. let isMultiSource = false;
  2201. if (isRef(source)) {
  2202. getter = () => source.value;
  2203. forceTrigger = isShallow(source);
  2204. } else if (isReactive(source)) {
  2205. getter = () => reactiveGetter(source);
  2206. forceTrigger = true;
  2207. } else if (isArray(source)) {
  2208. isMultiSource = true;
  2209. forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2));
  2210. getter = () => source.map((s2) => {
  2211. if (isRef(s2)) {
  2212. return s2.value;
  2213. } else if (isReactive(s2)) {
  2214. return reactiveGetter(s2);
  2215. } else if (isFunction(s2)) {
  2216. return callWithErrorHandling(s2, instance, 2);
  2217. } else {
  2218. warnInvalidSource(s2);
  2219. }
  2220. });
  2221. } else if (isFunction(source)) {
  2222. if (cb) {
  2223. getter = () => callWithErrorHandling(source, instance, 2);
  2224. } else {
  2225. getter = () => {
  2226. if (cleanup) {
  2227. cleanup();
  2228. }
  2229. return callWithAsyncErrorHandling(
  2230. source,
  2231. instance,
  2232. 3,
  2233. [onCleanup]
  2234. );
  2235. };
  2236. }
  2237. } else {
  2238. getter = NOOP;
  2239. warnInvalidSource(source);
  2240. }
  2241. if (cb && deep) {
  2242. const baseGetter = getter;
  2243. getter = () => traverse(baseGetter());
  2244. }
  2245. let cleanup;
  2246. let onCleanup = (fn) => {
  2247. cleanup = effect2.onStop = () => {
  2248. callWithErrorHandling(fn, instance, 4);
  2249. cleanup = effect2.onStop = void 0;
  2250. };
  2251. };
  2252. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2253. const job = () => {
  2254. if (!effect2.active || !effect2.dirty) {
  2255. return;
  2256. }
  2257. if (cb) {
  2258. const newValue = effect2.run();
  2259. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  2260. if (cleanup) {
  2261. cleanup();
  2262. }
  2263. callWithAsyncErrorHandling(cb, instance, 3, [
  2264. newValue,
  2265. // pass undefined as the old value when it's changed for the first time
  2266. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2267. onCleanup
  2268. ]);
  2269. oldValue = newValue;
  2270. }
  2271. } else {
  2272. effect2.run();
  2273. }
  2274. };
  2275. job.allowRecurse = !!cb;
  2276. let scheduler;
  2277. if (flush === "sync") {
  2278. scheduler = job;
  2279. } else if (flush === "post") {
  2280. scheduler = () => queuePostRenderEffect$1(job, instance && instance.suspense);
  2281. } else {
  2282. job.pre = true;
  2283. if (instance)
  2284. job.id = instance.uid;
  2285. scheduler = () => queueJob(job);
  2286. }
  2287. const effect2 = new ReactiveEffect(getter, NOOP, scheduler);
  2288. const scope = getCurrentScope();
  2289. const unwatch = () => {
  2290. effect2.stop();
  2291. if (scope) {
  2292. remove(scope.effects, effect2);
  2293. }
  2294. };
  2295. {
  2296. effect2.onTrack = onTrack;
  2297. effect2.onTrigger = onTrigger;
  2298. }
  2299. if (cb) {
  2300. if (immediate) {
  2301. job();
  2302. } else {
  2303. oldValue = effect2.run();
  2304. }
  2305. } else if (flush === "post") {
  2306. queuePostRenderEffect$1(
  2307. effect2.run.bind(effect2),
  2308. instance && instance.suspense
  2309. );
  2310. } else {
  2311. effect2.run();
  2312. }
  2313. return unwatch;
  2314. }
  2315. function instanceWatch(source, value, options) {
  2316. const publicThis = this.proxy;
  2317. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  2318. let cb;
  2319. if (isFunction(value)) {
  2320. cb = value;
  2321. } else {
  2322. cb = value.handler;
  2323. options = value;
  2324. }
  2325. const reset = setCurrentInstance(this);
  2326. const res = doWatch(getter, cb.bind(publicThis), options);
  2327. reset();
  2328. return res;
  2329. }
  2330. function createPathGetter(ctx, path) {
  2331. const segments = path.split(".");
  2332. return () => {
  2333. let cur = ctx;
  2334. for (let i = 0; i < segments.length && cur; i++) {
  2335. cur = cur[segments[i]];
  2336. }
  2337. return cur;
  2338. };
  2339. }
  2340. function traverse(value, depth, currentDepth = 0, seen) {
  2341. if (!isObject(value) || value["__v_skip"]) {
  2342. return value;
  2343. }
  2344. if (depth && depth > 0) {
  2345. if (currentDepth >= depth) {
  2346. return value;
  2347. }
  2348. currentDepth++;
  2349. }
  2350. seen = seen || /* @__PURE__ */ new Set();
  2351. if (seen.has(value)) {
  2352. return value;
  2353. }
  2354. seen.add(value);
  2355. if (isRef(value)) {
  2356. traverse(value.value, depth, currentDepth, seen);
  2357. } else if (isArray(value)) {
  2358. for (let i = 0; i < value.length; i++) {
  2359. traverse(value[i], depth, currentDepth, seen);
  2360. }
  2361. } else if (isSet(value) || isMap(value)) {
  2362. value.forEach((v) => {
  2363. traverse(v, depth, currentDepth, seen);
  2364. });
  2365. } else if (isPlainObject(value)) {
  2366. for (const key in value) {
  2367. traverse(value[key], depth, currentDepth, seen);
  2368. }
  2369. }
  2370. return value;
  2371. }
  2372. function validateDirectiveName(name) {
  2373. if (isBuiltInDirective(name)) {
  2374. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2375. }
  2376. }
  2377. function createAppContext() {
  2378. return {
  2379. app: null,
  2380. config: {
  2381. isNativeTag: NO,
  2382. performance: false,
  2383. globalProperties: {},
  2384. optionMergeStrategies: {},
  2385. errorHandler: void 0,
  2386. warnHandler: void 0,
  2387. compilerOptions: {}
  2388. },
  2389. mixins: [],
  2390. components: {},
  2391. directives: {},
  2392. provides: /* @__PURE__ */ Object.create(null),
  2393. optionsCache: /* @__PURE__ */ new WeakMap(),
  2394. propsCache: /* @__PURE__ */ new WeakMap(),
  2395. emitsCache: /* @__PURE__ */ new WeakMap()
  2396. };
  2397. }
  2398. let uid$1 = 0;
  2399. function createAppAPI(render, hydrate) {
  2400. return function createApp2(rootComponent, rootProps = null) {
  2401. if (!isFunction(rootComponent)) {
  2402. rootComponent = extend({}, rootComponent);
  2403. }
  2404. if (rootProps != null && !isObject(rootProps)) {
  2405. warn$1(`root props passed to app.mount() must be an object.`);
  2406. rootProps = null;
  2407. }
  2408. const context = createAppContext();
  2409. const installedPlugins = /* @__PURE__ */ new WeakSet();
  2410. const app = context.app = {
  2411. _uid: uid$1++,
  2412. _component: rootComponent,
  2413. _props: rootProps,
  2414. _container: null,
  2415. _context: context,
  2416. _instance: null,
  2417. version,
  2418. get config() {
  2419. return context.config;
  2420. },
  2421. set config(v) {
  2422. {
  2423. warn$1(
  2424. `app.config cannot be replaced. Modify individual options instead.`
  2425. );
  2426. }
  2427. },
  2428. use(plugin2, ...options) {
  2429. if (installedPlugins.has(plugin2)) {
  2430. warn$1(`Plugin has already been applied to target app.`);
  2431. } else if (plugin2 && isFunction(plugin2.install)) {
  2432. installedPlugins.add(plugin2);
  2433. plugin2.install(app, ...options);
  2434. } else if (isFunction(plugin2)) {
  2435. installedPlugins.add(plugin2);
  2436. plugin2(app, ...options);
  2437. } else {
  2438. warn$1(
  2439. `A plugin must either be a function or an object with an "install" function.`
  2440. );
  2441. }
  2442. return app;
  2443. },
  2444. mixin(mixin) {
  2445. {
  2446. if (!context.mixins.includes(mixin)) {
  2447. context.mixins.push(mixin);
  2448. } else {
  2449. warn$1(
  2450. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  2451. );
  2452. }
  2453. }
  2454. return app;
  2455. },
  2456. component(name, component) {
  2457. {
  2458. validateComponentName(name, context.config);
  2459. }
  2460. if (!component) {
  2461. return context.components[name];
  2462. }
  2463. if (context.components[name]) {
  2464. warn$1(`Component "${name}" has already been registered in target app.`);
  2465. }
  2466. context.components[name] = component;
  2467. return app;
  2468. },
  2469. directive(name, directive) {
  2470. {
  2471. validateDirectiveName(name);
  2472. }
  2473. if (!directive) {
  2474. return context.directives[name];
  2475. }
  2476. if (context.directives[name]) {
  2477. warn$1(`Directive "${name}" has already been registered in target app.`);
  2478. }
  2479. context.directives[name] = directive;
  2480. return app;
  2481. },
  2482. // fixed by xxxxxx
  2483. mount() {
  2484. },
  2485. // fixed by xxxxxx
  2486. unmount() {
  2487. },
  2488. provide(key, value) {
  2489. if (key in context.provides) {
  2490. warn$1(
  2491. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  2492. );
  2493. }
  2494. context.provides[key] = value;
  2495. return app;
  2496. },
  2497. runWithContext(fn) {
  2498. const lastApp = currentApp;
  2499. currentApp = app;
  2500. try {
  2501. return fn();
  2502. } finally {
  2503. currentApp = lastApp;
  2504. }
  2505. }
  2506. };
  2507. return app;
  2508. };
  2509. }
  2510. let currentApp = null;
  2511. function provide(key, value) {
  2512. if (!currentInstance) {
  2513. {
  2514. warn$1(`provide() can only be used inside setup().`);
  2515. }
  2516. } else {
  2517. let provides = currentInstance.provides;
  2518. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  2519. if (parentProvides === provides) {
  2520. provides = currentInstance.provides = Object.create(parentProvides);
  2521. }
  2522. provides[key] = value;
  2523. if (currentInstance.type.mpType === "app") {
  2524. currentInstance.appContext.app.provide(key, value);
  2525. }
  2526. }
  2527. }
  2528. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  2529. const instance = currentInstance || currentRenderingInstance;
  2530. if (instance || currentApp) {
  2531. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  2532. if (provides && key in provides) {
  2533. return provides[key];
  2534. } else if (arguments.length > 1) {
  2535. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  2536. } else {
  2537. warn$1(`injection "${String(key)}" not found.`);
  2538. }
  2539. } else {
  2540. warn$1(`inject() can only be used inside setup() or functional components.`);
  2541. }
  2542. }
  2543. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  2544. function onActivated(hook, target) {
  2545. registerKeepAliveHook(hook, "a", target);
  2546. }
  2547. function onDeactivated(hook, target) {
  2548. registerKeepAliveHook(hook, "da", target);
  2549. }
  2550. function registerKeepAliveHook(hook, type, target = currentInstance) {
  2551. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  2552. let current = target;
  2553. while (current) {
  2554. if (current.isDeactivated) {
  2555. return;
  2556. }
  2557. current = current.parent;
  2558. }
  2559. return hook();
  2560. });
  2561. injectHook(type, wrappedHook, target);
  2562. if (target) {
  2563. let current = target.parent;
  2564. while (current && current.parent) {
  2565. if (isKeepAlive(current.parent.vnode)) {
  2566. injectToKeepAliveRoot(wrappedHook, type, target, current);
  2567. }
  2568. current = current.parent;
  2569. }
  2570. }
  2571. }
  2572. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  2573. const injected = injectHook(
  2574. type,
  2575. hook,
  2576. keepAliveRoot,
  2577. true
  2578. /* prepend */
  2579. );
  2580. onUnmounted(() => {
  2581. remove(keepAliveRoot[type], injected);
  2582. }, target);
  2583. }
  2584. function injectHook(type, hook, target = currentInstance, prepend = false) {
  2585. if (target) {
  2586. if (isRootHook(type)) {
  2587. target = target.root;
  2588. }
  2589. const hooks = target[type] || (target[type] = []);
  2590. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  2591. if (target.isUnmounted) {
  2592. return;
  2593. }
  2594. pauseTracking();
  2595. const reset = setCurrentInstance(target);
  2596. const res = callWithAsyncErrorHandling(hook, target, type, args);
  2597. reset();
  2598. resetTracking();
  2599. return res;
  2600. });
  2601. if (prepend) {
  2602. hooks.unshift(wrappedHook);
  2603. } else {
  2604. hooks.push(wrappedHook);
  2605. }
  2606. return wrappedHook;
  2607. } else {
  2608. const apiName = toHandlerKey(
  2609. (ErrorTypeStrings[type] || type.replace(/^on/, "")).replace(/ hook$/, "")
  2610. );
  2611. warn$1(
  2612. `${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().`
  2613. );
  2614. }
  2615. }
  2616. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  2617. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  2618. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  2619. );
  2620. const onBeforeMount = createHook("bm");
  2621. const onMounted = createHook("m");
  2622. const onBeforeUpdate = createHook("bu");
  2623. const onUpdated = createHook("u");
  2624. const onBeforeUnmount = createHook("bum");
  2625. const onUnmounted = createHook("um");
  2626. const onServerPrefetch = createHook("sp");
  2627. const onRenderTriggered = createHook(
  2628. "rtg"
  2629. );
  2630. const onRenderTracked = createHook(
  2631. "rtc"
  2632. );
  2633. function onErrorCaptured(hook, target = currentInstance) {
  2634. injectHook("ec", hook, target);
  2635. }
  2636. const getPublicInstance = (i) => {
  2637. if (!i)
  2638. return null;
  2639. if (isStatefulComponent(i))
  2640. return getExposeProxy(i) || i.proxy;
  2641. return getPublicInstance(i.parent);
  2642. };
  2643. const publicPropertiesMap = (
  2644. // Move PURE marker to new line to workaround compiler discarding it
  2645. // due to type annotation
  2646. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  2647. $: (i) => i,
  2648. // fixed by xxxxxx vue-i18n 在 dev 模式,访问了 $el,故模拟一个假的
  2649. // $el: i => i.vnode.el,
  2650. $el: (i) => i.__$el || (i.__$el = {}),
  2651. $data: (i) => i.data,
  2652. $props: (i) => shallowReadonly(i.props),
  2653. $attrs: (i) => shallowReadonly(i.attrs),
  2654. $slots: (i) => shallowReadonly(i.slots),
  2655. $refs: (i) => shallowReadonly(i.refs),
  2656. $parent: (i) => getPublicInstance(i.parent),
  2657. $root: (i) => getPublicInstance(i.root),
  2658. $emit: (i) => i.emit,
  2659. $options: (i) => resolveMergedOptions(i),
  2660. $forceUpdate: (i) => i.f || (i.f = () => {
  2661. i.effect.dirty = true;
  2662. queueJob(i.update);
  2663. }),
  2664. // $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy!)),// fixed by xxxxxx
  2665. $watch: (i) => instanceWatch.bind(i)
  2666. })
  2667. );
  2668. const isReservedPrefix = (key) => key === "_" || key === "$";
  2669. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  2670. const PublicInstanceProxyHandlers = {
  2671. get({ _: instance }, key) {
  2672. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  2673. if (key === "__isVue") {
  2674. return true;
  2675. }
  2676. let normalizedProps;
  2677. if (key[0] !== "$") {
  2678. const n2 = accessCache[key];
  2679. if (n2 !== void 0) {
  2680. switch (n2) {
  2681. case 1:
  2682. return setupState[key];
  2683. case 2:
  2684. return data[key];
  2685. case 4:
  2686. return ctx[key];
  2687. case 3:
  2688. return props[key];
  2689. }
  2690. } else if (hasSetupBinding(setupState, key)) {
  2691. accessCache[key] = 1;
  2692. return setupState[key];
  2693. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  2694. accessCache[key] = 2;
  2695. return data[key];
  2696. } else if (
  2697. // only cache other properties when instance has declared (thus stable)
  2698. // props
  2699. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  2700. ) {
  2701. accessCache[key] = 3;
  2702. return props[key];
  2703. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  2704. accessCache[key] = 4;
  2705. return ctx[key];
  2706. } else if (shouldCacheAccess) {
  2707. accessCache[key] = 0;
  2708. }
  2709. }
  2710. const publicGetter = publicPropertiesMap[key];
  2711. let cssModule, globalProperties;
  2712. if (publicGetter) {
  2713. if (key === "$attrs") {
  2714. track(instance, "get", key);
  2715. } else if (key === "$slots") {
  2716. track(instance, "get", key);
  2717. }
  2718. return publicGetter(instance);
  2719. } else if (
  2720. // css module (injected by vue-loader)
  2721. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  2722. ) {
  2723. return cssModule;
  2724. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  2725. accessCache[key] = 4;
  2726. return ctx[key];
  2727. } else if (
  2728. // global properties
  2729. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  2730. ) {
  2731. {
  2732. return globalProperties[key];
  2733. }
  2734. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  2735. // to infinite warning loop
  2736. key.indexOf("__v") !== 0)) {
  2737. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  2738. warn$1(
  2739. `Property ${JSON.stringify(
  2740. key
  2741. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  2742. );
  2743. } else if (instance === currentRenderingInstance) {
  2744. warn$1(
  2745. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  2746. );
  2747. }
  2748. }
  2749. },
  2750. set({ _: instance }, key, value) {
  2751. const { data, setupState, ctx } = instance;
  2752. if (hasSetupBinding(setupState, key)) {
  2753. setupState[key] = value;
  2754. return true;
  2755. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  2756. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  2757. return false;
  2758. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  2759. data[key] = value;
  2760. return true;
  2761. } else if (hasOwn(instance.props, key)) {
  2762. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  2763. return false;
  2764. }
  2765. if (key[0] === "$" && key.slice(1) in instance) {
  2766. warn$1(
  2767. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  2768. );
  2769. return false;
  2770. } else {
  2771. if (key in instance.appContext.config.globalProperties) {
  2772. Object.defineProperty(ctx, key, {
  2773. enumerable: true,
  2774. configurable: true,
  2775. value
  2776. });
  2777. } else {
  2778. ctx[key] = value;
  2779. }
  2780. }
  2781. return true;
  2782. },
  2783. has({
  2784. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  2785. }, key) {
  2786. let normalizedProps;
  2787. 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);
  2788. },
  2789. defineProperty(target, key, descriptor) {
  2790. if (descriptor.get != null) {
  2791. target._.accessCache[key] = 0;
  2792. } else if (hasOwn(descriptor, "value")) {
  2793. this.set(target, key, descriptor.value, null);
  2794. }
  2795. return Reflect.defineProperty(target, key, descriptor);
  2796. }
  2797. };
  2798. {
  2799. PublicInstanceProxyHandlers.ownKeys = (target) => {
  2800. warn$1(
  2801. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  2802. );
  2803. return Reflect.ownKeys(target);
  2804. };
  2805. }
  2806. function createDevRenderContext(instance) {
  2807. const target = {};
  2808. Object.defineProperty(target, `_`, {
  2809. configurable: true,
  2810. enumerable: false,
  2811. get: () => instance
  2812. });
  2813. Object.keys(publicPropertiesMap).forEach((key) => {
  2814. Object.defineProperty(target, key, {
  2815. configurable: true,
  2816. enumerable: false,
  2817. get: () => publicPropertiesMap[key](instance),
  2818. // intercepted by the proxy so no need for implementation,
  2819. // but needed to prevent set errors
  2820. set: NOOP
  2821. });
  2822. });
  2823. return target;
  2824. }
  2825. function exposePropsOnRenderContext(instance) {
  2826. const {
  2827. ctx,
  2828. propsOptions: [propsOptions]
  2829. } = instance;
  2830. if (propsOptions) {
  2831. Object.keys(propsOptions).forEach((key) => {
  2832. Object.defineProperty(ctx, key, {
  2833. enumerable: true,
  2834. configurable: true,
  2835. get: () => instance.props[key],
  2836. set: NOOP
  2837. });
  2838. });
  2839. }
  2840. }
  2841. function exposeSetupStateOnRenderContext(instance) {
  2842. const { ctx, setupState } = instance;
  2843. Object.keys(toRaw(setupState)).forEach((key) => {
  2844. if (!setupState.__isScriptSetup) {
  2845. if (isReservedPrefix(key[0])) {
  2846. warn$1(
  2847. `setup() return property ${JSON.stringify(
  2848. key
  2849. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  2850. );
  2851. return;
  2852. }
  2853. Object.defineProperty(ctx, key, {
  2854. enumerable: true,
  2855. configurable: true,
  2856. get: () => setupState[key],
  2857. set: NOOP
  2858. });
  2859. }
  2860. });
  2861. }
  2862. function normalizePropsOrEmits(props) {
  2863. return isArray(props) ? props.reduce(
  2864. (normalized, p2) => (normalized[p2] = null, normalized),
  2865. {}
  2866. ) : props;
  2867. }
  2868. function createDuplicateChecker() {
  2869. const cache = /* @__PURE__ */ Object.create(null);
  2870. return (type, key) => {
  2871. if (cache[key]) {
  2872. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  2873. } else {
  2874. cache[key] = type;
  2875. }
  2876. };
  2877. }
  2878. let shouldCacheAccess = true;
  2879. function applyOptions$1(instance) {
  2880. const options = resolveMergedOptions(instance);
  2881. const publicThis = instance.proxy;
  2882. const ctx = instance.ctx;
  2883. shouldCacheAccess = false;
  2884. if (options.beforeCreate) {
  2885. callHook$1(options.beforeCreate, instance, "bc");
  2886. }
  2887. const {
  2888. // state
  2889. data: dataOptions,
  2890. computed: computedOptions,
  2891. methods,
  2892. watch: watchOptions,
  2893. provide: provideOptions,
  2894. inject: injectOptions,
  2895. // lifecycle
  2896. created,
  2897. beforeMount,
  2898. mounted,
  2899. beforeUpdate,
  2900. updated,
  2901. activated,
  2902. deactivated,
  2903. beforeDestroy,
  2904. beforeUnmount,
  2905. destroyed,
  2906. unmounted,
  2907. render,
  2908. renderTracked,
  2909. renderTriggered,
  2910. errorCaptured,
  2911. serverPrefetch,
  2912. // public API
  2913. expose,
  2914. inheritAttrs,
  2915. // assets
  2916. components,
  2917. directives,
  2918. filters
  2919. } = options;
  2920. const checkDuplicateProperties = createDuplicateChecker();
  2921. {
  2922. const [propsOptions] = instance.propsOptions;
  2923. if (propsOptions) {
  2924. for (const key in propsOptions) {
  2925. checkDuplicateProperties("Props", key);
  2926. }
  2927. }
  2928. }
  2929. function initInjections() {
  2930. if (injectOptions) {
  2931. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  2932. }
  2933. }
  2934. {
  2935. initInjections();
  2936. }
  2937. if (methods) {
  2938. for (const key in methods) {
  2939. const methodHandler = methods[key];
  2940. if (isFunction(methodHandler)) {
  2941. {
  2942. Object.defineProperty(ctx, key, {
  2943. value: methodHandler.bind(publicThis),
  2944. configurable: true,
  2945. enumerable: true,
  2946. writable: true
  2947. });
  2948. }
  2949. {
  2950. checkDuplicateProperties("Methods", key);
  2951. }
  2952. } else {
  2953. warn$1(
  2954. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  2955. );
  2956. }
  2957. }
  2958. }
  2959. if (dataOptions) {
  2960. if (!isFunction(dataOptions)) {
  2961. warn$1(
  2962. `The data option must be a function. Plain object usage is no longer supported.`
  2963. );
  2964. }
  2965. const data = dataOptions.call(publicThis, publicThis);
  2966. if (isPromise(data)) {
  2967. warn$1(
  2968. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  2969. );
  2970. }
  2971. if (!isObject(data)) {
  2972. warn$1(`data() should return an object.`);
  2973. } else {
  2974. instance.data = reactive(data);
  2975. {
  2976. for (const key in data) {
  2977. checkDuplicateProperties("Data", key);
  2978. if (!isReservedPrefix(key[0])) {
  2979. Object.defineProperty(ctx, key, {
  2980. configurable: true,
  2981. enumerable: true,
  2982. get: () => data[key],
  2983. set: NOOP
  2984. });
  2985. }
  2986. }
  2987. }
  2988. }
  2989. }
  2990. shouldCacheAccess = true;
  2991. if (computedOptions) {
  2992. for (const key in computedOptions) {
  2993. const opt = computedOptions[key];
  2994. const get2 = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  2995. if (get2 === NOOP) {
  2996. warn$1(`Computed property "${key}" has no getter.`);
  2997. }
  2998. const set2 = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  2999. warn$1(
  3000. `Write operation failed: computed property "${key}" is readonly.`
  3001. );
  3002. };
  3003. const c2 = computed({
  3004. get: get2,
  3005. set: set2
  3006. });
  3007. Object.defineProperty(ctx, key, {
  3008. enumerable: true,
  3009. configurable: true,
  3010. get: () => c2.value,
  3011. set: (v) => c2.value = v
  3012. });
  3013. {
  3014. checkDuplicateProperties("Computed", key);
  3015. }
  3016. }
  3017. }
  3018. if (watchOptions) {
  3019. for (const key in watchOptions) {
  3020. createWatcher(watchOptions[key], ctx, publicThis, key);
  3021. }
  3022. }
  3023. function initProvides() {
  3024. if (provideOptions) {
  3025. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  3026. Reflect.ownKeys(provides).forEach((key) => {
  3027. provide(key, provides[key]);
  3028. });
  3029. }
  3030. }
  3031. {
  3032. initProvides();
  3033. }
  3034. {
  3035. if (created) {
  3036. callHook$1(created, instance, "c");
  3037. }
  3038. }
  3039. function registerLifecycleHook(register, hook) {
  3040. if (isArray(hook)) {
  3041. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  3042. } else if (hook) {
  3043. register(hook.bind(publicThis));
  3044. }
  3045. }
  3046. registerLifecycleHook(onBeforeMount, beforeMount);
  3047. registerLifecycleHook(onMounted, mounted);
  3048. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  3049. registerLifecycleHook(onUpdated, updated);
  3050. registerLifecycleHook(onActivated, activated);
  3051. registerLifecycleHook(onDeactivated, deactivated);
  3052. registerLifecycleHook(onErrorCaptured, errorCaptured);
  3053. registerLifecycleHook(onRenderTracked, renderTracked);
  3054. registerLifecycleHook(onRenderTriggered, renderTriggered);
  3055. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  3056. registerLifecycleHook(onUnmounted, unmounted);
  3057. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  3058. if (isArray(expose)) {
  3059. if (expose.length) {
  3060. const exposed = instance.exposed || (instance.exposed = {});
  3061. expose.forEach((key) => {
  3062. Object.defineProperty(exposed, key, {
  3063. get: () => publicThis[key],
  3064. set: (val) => publicThis[key] = val
  3065. });
  3066. });
  3067. } else if (!instance.exposed) {
  3068. instance.exposed = {};
  3069. }
  3070. }
  3071. if (render && instance.render === NOOP) {
  3072. instance.render = render;
  3073. }
  3074. if (inheritAttrs != null) {
  3075. instance.inheritAttrs = inheritAttrs;
  3076. }
  3077. if (components)
  3078. instance.components = components;
  3079. if (directives)
  3080. instance.directives = directives;
  3081. if (instance.ctx.$onApplyOptions) {
  3082. instance.ctx.$onApplyOptions(options, instance, publicThis);
  3083. }
  3084. }
  3085. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  3086. if (isArray(injectOptions)) {
  3087. injectOptions = normalizeInject(injectOptions);
  3088. }
  3089. for (const key in injectOptions) {
  3090. const opt = injectOptions[key];
  3091. let injected;
  3092. if (isObject(opt)) {
  3093. if ("default" in opt) {
  3094. injected = inject(
  3095. opt.from || key,
  3096. opt.default,
  3097. true
  3098. );
  3099. } else {
  3100. injected = inject(opt.from || key);
  3101. }
  3102. } else {
  3103. injected = inject(opt);
  3104. }
  3105. if (isRef(injected)) {
  3106. Object.defineProperty(ctx, key, {
  3107. enumerable: true,
  3108. configurable: true,
  3109. get: () => injected.value,
  3110. set: (v) => injected.value = v
  3111. });
  3112. } else {
  3113. ctx[key] = injected;
  3114. }
  3115. {
  3116. checkDuplicateProperties("Inject", key);
  3117. }
  3118. }
  3119. }
  3120. function callHook$1(hook, instance, type) {
  3121. callWithAsyncErrorHandling(
  3122. isArray(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy),
  3123. instance,
  3124. type
  3125. );
  3126. }
  3127. function createWatcher(raw, ctx, publicThis, key) {
  3128. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  3129. if (isString(raw)) {
  3130. const handler = ctx[raw];
  3131. if (isFunction(handler)) {
  3132. watch(getter, handler);
  3133. } else {
  3134. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  3135. }
  3136. } else if (isFunction(raw)) {
  3137. watch(getter, raw.bind(publicThis));
  3138. } else if (isObject(raw)) {
  3139. if (isArray(raw)) {
  3140. raw.forEach((r2) => createWatcher(r2, ctx, publicThis, key));
  3141. } else {
  3142. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  3143. if (isFunction(handler)) {
  3144. watch(getter, handler, raw);
  3145. } else {
  3146. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  3147. }
  3148. }
  3149. } else {
  3150. warn$1(`Invalid watch option: "${key}"`, raw);
  3151. }
  3152. }
  3153. function resolveMergedOptions(instance) {
  3154. const base = instance.type;
  3155. const { mixins, extends: extendsOptions } = base;
  3156. const {
  3157. mixins: globalMixins,
  3158. optionsCache: cache,
  3159. config: { optionMergeStrategies }
  3160. } = instance.appContext;
  3161. const cached = cache.get(base);
  3162. let resolved;
  3163. if (cached) {
  3164. resolved = cached;
  3165. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  3166. {
  3167. resolved = base;
  3168. }
  3169. } else {
  3170. resolved = {};
  3171. if (globalMixins.length) {
  3172. globalMixins.forEach(
  3173. (m2) => mergeOptions(resolved, m2, optionMergeStrategies, true)
  3174. );
  3175. }
  3176. mergeOptions(resolved, base, optionMergeStrategies);
  3177. }
  3178. if (isObject(base)) {
  3179. cache.set(base, resolved);
  3180. }
  3181. return resolved;
  3182. }
  3183. function mergeOptions(to, from, strats, asMixin = false) {
  3184. const { mixins, extends: extendsOptions } = from;
  3185. if (extendsOptions) {
  3186. mergeOptions(to, extendsOptions, strats, true);
  3187. }
  3188. if (mixins) {
  3189. mixins.forEach(
  3190. (m2) => mergeOptions(to, m2, strats, true)
  3191. );
  3192. }
  3193. for (const key in from) {
  3194. if (asMixin && key === "expose") {
  3195. warn$1(
  3196. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  3197. );
  3198. } else {
  3199. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  3200. to[key] = strat ? strat(to[key], from[key]) : from[key];
  3201. }
  3202. }
  3203. return to;
  3204. }
  3205. const internalOptionMergeStrats = {
  3206. data: mergeDataFn,
  3207. props: mergeEmitsOrPropsOptions,
  3208. emits: mergeEmitsOrPropsOptions,
  3209. // objects
  3210. methods: mergeObjectOptions,
  3211. computed: mergeObjectOptions,
  3212. // lifecycle
  3213. beforeCreate: mergeAsArray$1,
  3214. created: mergeAsArray$1,
  3215. beforeMount: mergeAsArray$1,
  3216. mounted: mergeAsArray$1,
  3217. beforeUpdate: mergeAsArray$1,
  3218. updated: mergeAsArray$1,
  3219. beforeDestroy: mergeAsArray$1,
  3220. beforeUnmount: mergeAsArray$1,
  3221. destroyed: mergeAsArray$1,
  3222. unmounted: mergeAsArray$1,
  3223. activated: mergeAsArray$1,
  3224. deactivated: mergeAsArray$1,
  3225. errorCaptured: mergeAsArray$1,
  3226. serverPrefetch: mergeAsArray$1,
  3227. // assets
  3228. components: mergeObjectOptions,
  3229. directives: mergeObjectOptions,
  3230. // watch
  3231. watch: mergeWatchOptions,
  3232. // provide / inject
  3233. provide: mergeDataFn,
  3234. inject: mergeInject
  3235. };
  3236. function mergeDataFn(to, from) {
  3237. if (!from) {
  3238. return to;
  3239. }
  3240. if (!to) {
  3241. return from;
  3242. }
  3243. return function mergedDataFn() {
  3244. return extend(
  3245. isFunction(to) ? to.call(this, this) : to,
  3246. isFunction(from) ? from.call(this, this) : from
  3247. );
  3248. };
  3249. }
  3250. function mergeInject(to, from) {
  3251. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  3252. }
  3253. function normalizeInject(raw) {
  3254. if (isArray(raw)) {
  3255. const res = {};
  3256. for (let i = 0; i < raw.length; i++) {
  3257. res[raw[i]] = raw[i];
  3258. }
  3259. return res;
  3260. }
  3261. return raw;
  3262. }
  3263. function mergeAsArray$1(to, from) {
  3264. return to ? [...new Set([].concat(to, from))] : from;
  3265. }
  3266. function mergeObjectOptions(to, from) {
  3267. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  3268. }
  3269. function mergeEmitsOrPropsOptions(to, from) {
  3270. if (to) {
  3271. if (isArray(to) && isArray(from)) {
  3272. return [.../* @__PURE__ */ new Set([...to, ...from])];
  3273. }
  3274. return extend(
  3275. /* @__PURE__ */ Object.create(null),
  3276. normalizePropsOrEmits(to),
  3277. normalizePropsOrEmits(from != null ? from : {})
  3278. );
  3279. } else {
  3280. return from;
  3281. }
  3282. }
  3283. function mergeWatchOptions(to, from) {
  3284. if (!to)
  3285. return from;
  3286. if (!from)
  3287. return to;
  3288. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  3289. for (const key in from) {
  3290. merged[key] = mergeAsArray$1(to[key], from[key]);
  3291. }
  3292. return merged;
  3293. }
  3294. function initProps$1(instance, rawProps, isStateful, isSSR = false) {
  3295. const props = {};
  3296. const attrs = {};
  3297. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  3298. setFullProps(instance, rawProps, props, attrs);
  3299. for (const key in instance.propsOptions[0]) {
  3300. if (!(key in props)) {
  3301. props[key] = void 0;
  3302. }
  3303. }
  3304. {
  3305. validateProps(rawProps || {}, props, instance);
  3306. }
  3307. if (isStateful) {
  3308. instance.props = isSSR ? props : shallowReactive(props);
  3309. } else {
  3310. if (!instance.type.props) {
  3311. instance.props = attrs;
  3312. } else {
  3313. instance.props = props;
  3314. }
  3315. }
  3316. instance.attrs = attrs;
  3317. }
  3318. function isInHmrContext(instance) {
  3319. }
  3320. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  3321. const {
  3322. props,
  3323. attrs,
  3324. vnode: { patchFlag }
  3325. } = instance;
  3326. const rawCurrentProps = toRaw(props);
  3327. const [options] = instance.propsOptions;
  3328. let hasAttrsChanged = false;
  3329. if (
  3330. // always force full diff in dev
  3331. // - #1942 if hmr is enabled with sfc component
  3332. // - vite#872 non-sfc component used by sfc component
  3333. !isInHmrContext() && (optimized || patchFlag > 0) && !(patchFlag & 16)
  3334. ) {
  3335. if (patchFlag & 8) {
  3336. const propsToUpdate = instance.vnode.dynamicProps;
  3337. for (let i = 0; i < propsToUpdate.length; i++) {
  3338. let key = propsToUpdate[i];
  3339. if (isEmitListener(instance.emitsOptions, key)) {
  3340. continue;
  3341. }
  3342. const value = rawProps[key];
  3343. if (options) {
  3344. if (hasOwn(attrs, key)) {
  3345. if (value !== attrs[key]) {
  3346. attrs[key] = value;
  3347. hasAttrsChanged = true;
  3348. }
  3349. } else {
  3350. const camelizedKey = camelize(key);
  3351. props[camelizedKey] = resolvePropValue$1(
  3352. options,
  3353. rawCurrentProps,
  3354. camelizedKey,
  3355. value,
  3356. instance,
  3357. false
  3358. );
  3359. }
  3360. } else {
  3361. if (value !== attrs[key]) {
  3362. attrs[key] = value;
  3363. hasAttrsChanged = true;
  3364. }
  3365. }
  3366. }
  3367. }
  3368. } else {
  3369. if (setFullProps(instance, rawProps, props, attrs)) {
  3370. hasAttrsChanged = true;
  3371. }
  3372. let kebabKey;
  3373. for (const key in rawCurrentProps) {
  3374. if (!rawProps || // for camelCase
  3375. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  3376. // and converted to camelCase (#955)
  3377. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  3378. if (options) {
  3379. if (rawPrevProps && // for camelCase
  3380. (rawPrevProps[key] !== void 0 || // for kebab-case
  3381. rawPrevProps[kebabKey] !== void 0)) {
  3382. props[key] = resolvePropValue$1(
  3383. options,
  3384. rawCurrentProps,
  3385. key,
  3386. void 0,
  3387. instance,
  3388. true
  3389. );
  3390. }
  3391. } else {
  3392. delete props[key];
  3393. }
  3394. }
  3395. }
  3396. if (attrs !== rawCurrentProps) {
  3397. for (const key in attrs) {
  3398. if (!rawProps || !hasOwn(rawProps, key) && true) {
  3399. delete attrs[key];
  3400. hasAttrsChanged = true;
  3401. }
  3402. }
  3403. }
  3404. }
  3405. if (hasAttrsChanged) {
  3406. trigger(instance, "set", "$attrs");
  3407. }
  3408. {
  3409. validateProps(rawProps || {}, props, instance);
  3410. }
  3411. }
  3412. function setFullProps(instance, rawProps, props, attrs) {
  3413. const [options, needCastKeys] = instance.propsOptions;
  3414. let hasAttrsChanged = false;
  3415. let rawCastValues;
  3416. if (rawProps) {
  3417. for (let key in rawProps) {
  3418. if (isReservedProp(key)) {
  3419. continue;
  3420. }
  3421. const value = rawProps[key];
  3422. let camelKey;
  3423. if (options && hasOwn(options, camelKey = camelize(key))) {
  3424. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  3425. props[camelKey] = value;
  3426. } else {
  3427. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  3428. }
  3429. } else if (!isEmitListener(instance.emitsOptions, key)) {
  3430. if (!(key in attrs) || value !== attrs[key]) {
  3431. attrs[key] = value;
  3432. hasAttrsChanged = true;
  3433. }
  3434. }
  3435. }
  3436. }
  3437. if (needCastKeys) {
  3438. const rawCurrentProps = toRaw(props);
  3439. const castValues = rawCastValues || EMPTY_OBJ;
  3440. for (let i = 0; i < needCastKeys.length; i++) {
  3441. const key = needCastKeys[i];
  3442. props[key] = resolvePropValue$1(
  3443. options,
  3444. rawCurrentProps,
  3445. key,
  3446. castValues[key],
  3447. instance,
  3448. !hasOwn(castValues, key)
  3449. );
  3450. }
  3451. }
  3452. return hasAttrsChanged;
  3453. }
  3454. function resolvePropValue$1(options, props, key, value, instance, isAbsent) {
  3455. const opt = options[key];
  3456. if (opt != null) {
  3457. const hasDefault = hasOwn(opt, "default");
  3458. if (hasDefault && value === void 0) {
  3459. const defaultValue = opt.default;
  3460. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  3461. const { propsDefaults } = instance;
  3462. if (key in propsDefaults) {
  3463. value = propsDefaults[key];
  3464. } else {
  3465. const reset = setCurrentInstance(instance);
  3466. value = propsDefaults[key] = defaultValue.call(
  3467. null,
  3468. props
  3469. );
  3470. reset();
  3471. }
  3472. } else {
  3473. value = defaultValue;
  3474. }
  3475. }
  3476. if (opt[
  3477. 0
  3478. /* shouldCast */
  3479. ]) {
  3480. if (isAbsent && !hasDefault) {
  3481. value = false;
  3482. } else if (opt[
  3483. 1
  3484. /* shouldCastTrue */
  3485. ] && (value === "" || value === hyphenate(key))) {
  3486. value = true;
  3487. }
  3488. }
  3489. }
  3490. return value;
  3491. }
  3492. function normalizePropsOptions(comp, appContext, asMixin = false) {
  3493. const cache = appContext.propsCache;
  3494. const cached = cache.get(comp);
  3495. if (cached) {
  3496. return cached;
  3497. }
  3498. const raw = comp.props;
  3499. const normalized = {};
  3500. const needCastKeys = [];
  3501. let hasExtends = false;
  3502. if (!isFunction(comp)) {
  3503. const extendProps = (raw2) => {
  3504. hasExtends = true;
  3505. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  3506. extend(normalized, props);
  3507. if (keys)
  3508. needCastKeys.push(...keys);
  3509. };
  3510. if (!asMixin && appContext.mixins.length) {
  3511. appContext.mixins.forEach(extendProps);
  3512. }
  3513. if (comp.extends) {
  3514. extendProps(comp.extends);
  3515. }
  3516. if (comp.mixins) {
  3517. comp.mixins.forEach(extendProps);
  3518. }
  3519. }
  3520. if (!raw && !hasExtends) {
  3521. if (isObject(comp)) {
  3522. cache.set(comp, EMPTY_ARR);
  3523. }
  3524. return EMPTY_ARR;
  3525. }
  3526. if (isArray(raw)) {
  3527. for (let i = 0; i < raw.length; i++) {
  3528. if (!isString(raw[i])) {
  3529. warn$1(`props must be strings when using array syntax.`, raw[i]);
  3530. }
  3531. const normalizedKey = camelize(raw[i]);
  3532. if (validatePropName(normalizedKey)) {
  3533. normalized[normalizedKey] = EMPTY_OBJ;
  3534. }
  3535. }
  3536. } else if (raw) {
  3537. if (!isObject(raw)) {
  3538. warn$1(`invalid props options`, raw);
  3539. }
  3540. for (const key in raw) {
  3541. const normalizedKey = camelize(key);
  3542. if (validatePropName(normalizedKey)) {
  3543. const opt = raw[key];
  3544. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  3545. if (prop) {
  3546. const booleanIndex = getTypeIndex(Boolean, prop.type);
  3547. const stringIndex = getTypeIndex(String, prop.type);
  3548. prop[
  3549. 0
  3550. /* shouldCast */
  3551. ] = booleanIndex > -1;
  3552. prop[
  3553. 1
  3554. /* shouldCastTrue */
  3555. ] = stringIndex < 0 || booleanIndex < stringIndex;
  3556. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  3557. needCastKeys.push(normalizedKey);
  3558. }
  3559. }
  3560. }
  3561. }
  3562. }
  3563. const res = [normalized, needCastKeys];
  3564. if (isObject(comp)) {
  3565. cache.set(comp, res);
  3566. }
  3567. return res;
  3568. }
  3569. function validatePropName(key) {
  3570. if (key[0] !== "$" && !isReservedProp(key)) {
  3571. return true;
  3572. } else {
  3573. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  3574. }
  3575. return false;
  3576. }
  3577. function getType$1(ctor) {
  3578. if (ctor === null) {
  3579. return "null";
  3580. }
  3581. if (typeof ctor === "function") {
  3582. return ctor.name || "";
  3583. } else if (typeof ctor === "object") {
  3584. const name = ctor.constructor && ctor.constructor.name;
  3585. return name || "";
  3586. }
  3587. return "";
  3588. }
  3589. function isSameType(a, b) {
  3590. return getType$1(a) === getType$1(b);
  3591. }
  3592. function getTypeIndex(type, expectedTypes) {
  3593. if (isArray(expectedTypes)) {
  3594. return expectedTypes.findIndex((t2) => isSameType(t2, type));
  3595. } else if (isFunction(expectedTypes)) {
  3596. return isSameType(expectedTypes, type) ? 0 : -1;
  3597. }
  3598. return -1;
  3599. }
  3600. function validateProps(rawProps, props, instance) {
  3601. const resolvedValues = toRaw(props);
  3602. const options = instance.propsOptions[0];
  3603. for (const key in options) {
  3604. let opt = options[key];
  3605. if (opt == null)
  3606. continue;
  3607. validateProp$1(
  3608. key,
  3609. resolvedValues[key],
  3610. opt,
  3611. shallowReadonly(resolvedValues),
  3612. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  3613. );
  3614. }
  3615. }
  3616. function validateProp$1(name, value, prop, props, isAbsent) {
  3617. const { type, required, validator, skipCheck } = prop;
  3618. if (required && isAbsent) {
  3619. warn$1('Missing required prop: "' + name + '"');
  3620. return;
  3621. }
  3622. if (value == null && !required) {
  3623. return;
  3624. }
  3625. if (type != null && type !== true && !skipCheck) {
  3626. let isValid = false;
  3627. const types = isArray(type) ? type : [type];
  3628. const expectedTypes = [];
  3629. for (let i = 0; i < types.length && !isValid; i++) {
  3630. const { valid, expectedType } = assertType$1(value, types[i]);
  3631. expectedTypes.push(expectedType || "");
  3632. isValid = valid;
  3633. }
  3634. if (!isValid) {
  3635. warn$1(getInvalidTypeMessage$1(name, value, expectedTypes));
  3636. return;
  3637. }
  3638. }
  3639. if (validator && !validator(value, props)) {
  3640. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  3641. }
  3642. }
  3643. const isSimpleType$1 = /* @__PURE__ */ makeMap(
  3644. "String,Number,Boolean,Function,Symbol,BigInt"
  3645. );
  3646. function assertType$1(value, type) {
  3647. let valid;
  3648. const expectedType = getType$1(type);
  3649. if (isSimpleType$1(expectedType)) {
  3650. const t2 = typeof value;
  3651. valid = t2 === expectedType.toLowerCase();
  3652. if (!valid && t2 === "object") {
  3653. valid = value instanceof type;
  3654. }
  3655. } else if (expectedType === "Object") {
  3656. valid = isObject(value);
  3657. } else if (expectedType === "Array") {
  3658. valid = isArray(value);
  3659. } else if (expectedType === "null") {
  3660. valid = value === null;
  3661. } else {
  3662. valid = value instanceof type;
  3663. }
  3664. return {
  3665. valid,
  3666. expectedType
  3667. };
  3668. }
  3669. function getInvalidTypeMessage$1(name, value, expectedTypes) {
  3670. if (expectedTypes.length === 0) {
  3671. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  3672. }
  3673. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  3674. const expectedType = expectedTypes[0];
  3675. const receivedType = toRawType(value);
  3676. const expectedValue = styleValue$1(value, expectedType);
  3677. const receivedValue = styleValue$1(value, receivedType);
  3678. if (expectedTypes.length === 1 && isExplicable$1(expectedType) && !isBoolean$1(expectedType, receivedType)) {
  3679. message += ` with value ${expectedValue}`;
  3680. }
  3681. message += `, got ${receivedType} `;
  3682. if (isExplicable$1(receivedType)) {
  3683. message += `with value ${receivedValue}.`;
  3684. }
  3685. return message;
  3686. }
  3687. function styleValue$1(value, type) {
  3688. if (type === "String") {
  3689. return `"${value}"`;
  3690. } else if (type === "Number") {
  3691. return `${Number(value)}`;
  3692. } else {
  3693. return `${value}`;
  3694. }
  3695. }
  3696. function isExplicable$1(type) {
  3697. const explicitTypes = ["string", "number", "boolean"];
  3698. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  3699. }
  3700. function isBoolean$1(...args) {
  3701. return args.some((elem) => elem.toLowerCase() === "boolean");
  3702. }
  3703. let supported;
  3704. let perf;
  3705. function startMeasure(instance, type) {
  3706. if (instance.appContext.config.performance && isSupported()) {
  3707. perf.mark(`vue-${type}-${instance.uid}`);
  3708. }
  3709. {
  3710. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  3711. }
  3712. }
  3713. function endMeasure(instance, type) {
  3714. if (instance.appContext.config.performance && isSupported()) {
  3715. const startTag = `vue-${type}-${instance.uid}`;
  3716. const endTag = startTag + `:end`;
  3717. perf.mark(endTag);
  3718. perf.measure(
  3719. `<${formatComponentName(instance, instance.type)}> ${type}`,
  3720. startTag,
  3721. endTag
  3722. );
  3723. perf.clearMarks(startTag);
  3724. perf.clearMarks(endTag);
  3725. }
  3726. {
  3727. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  3728. }
  3729. }
  3730. function isSupported() {
  3731. if (supported !== void 0) {
  3732. return supported;
  3733. }
  3734. if (typeof window !== "undefined" && window.performance) {
  3735. supported = true;
  3736. perf = window.performance;
  3737. } else {
  3738. supported = false;
  3739. }
  3740. return supported;
  3741. }
  3742. const queuePostRenderEffect$1 = queuePostFlushCb;
  3743. const Fragment = Symbol.for("v-fgt");
  3744. const Text = Symbol.for("v-txt");
  3745. const Comment = Symbol.for("v-cmt");
  3746. const Static = Symbol.for("v-stc");
  3747. function isVNode(value) {
  3748. return value ? value.__v_isVNode === true : false;
  3749. }
  3750. const InternalObjectKey = `__vInternal`;
  3751. function guardReactiveProps(props) {
  3752. if (!props)
  3753. return null;
  3754. return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
  3755. }
  3756. const emptyAppContext = createAppContext();
  3757. let uid = 0;
  3758. function createComponentInstance(vnode, parent, suspense) {
  3759. const type = vnode.type;
  3760. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  3761. const instance = {
  3762. uid: uid++,
  3763. vnode,
  3764. type,
  3765. parent,
  3766. appContext,
  3767. root: null,
  3768. // to be immediately set
  3769. next: null,
  3770. subTree: null,
  3771. // will be set synchronously right after creation
  3772. effect: null,
  3773. update: null,
  3774. // will be set synchronously right after creation
  3775. scope: new EffectScope(
  3776. true
  3777. /* detached */
  3778. ),
  3779. render: null,
  3780. proxy: null,
  3781. exposed: null,
  3782. exposeProxy: null,
  3783. withProxy: null,
  3784. provides: parent ? parent.provides : Object.create(appContext.provides),
  3785. accessCache: null,
  3786. renderCache: [],
  3787. // local resolved assets
  3788. components: null,
  3789. directives: null,
  3790. // resolved props and emits options
  3791. propsOptions: normalizePropsOptions(type, appContext),
  3792. emitsOptions: normalizeEmitsOptions(type, appContext),
  3793. // emit
  3794. emit: null,
  3795. // to be set immediately
  3796. emitted: null,
  3797. // props default value
  3798. propsDefaults: EMPTY_OBJ,
  3799. // inheritAttrs
  3800. inheritAttrs: type.inheritAttrs,
  3801. // state
  3802. ctx: EMPTY_OBJ,
  3803. data: EMPTY_OBJ,
  3804. props: EMPTY_OBJ,
  3805. attrs: EMPTY_OBJ,
  3806. slots: EMPTY_OBJ,
  3807. refs: EMPTY_OBJ,
  3808. setupState: EMPTY_OBJ,
  3809. setupContext: null,
  3810. attrsProxy: null,
  3811. slotsProxy: null,
  3812. // suspense related
  3813. suspense,
  3814. suspenseId: suspense ? suspense.pendingId : 0,
  3815. asyncDep: null,
  3816. asyncResolved: false,
  3817. // lifecycle hooks
  3818. // not using enums here because it results in computed properties
  3819. isMounted: false,
  3820. isUnmounted: false,
  3821. isDeactivated: false,
  3822. bc: null,
  3823. c: null,
  3824. bm: null,
  3825. m: null,
  3826. bu: null,
  3827. u: null,
  3828. um: null,
  3829. bum: null,
  3830. da: null,
  3831. a: null,
  3832. rtg: null,
  3833. rtc: null,
  3834. ec: null,
  3835. sp: null,
  3836. // fixed by xxxxxx 用于存储uni-app的元素缓存
  3837. $uniElements: /* @__PURE__ */ new Map(),
  3838. $templateUniElementRefs: [],
  3839. $templateUniElementStyles: {},
  3840. $eS: {},
  3841. $eA: {}
  3842. };
  3843. {
  3844. instance.ctx = createDevRenderContext(instance);
  3845. }
  3846. instance.root = parent ? parent.root : instance;
  3847. instance.emit = emit.bind(null, instance);
  3848. if (vnode.ce) {
  3849. vnode.ce(instance);
  3850. }
  3851. return instance;
  3852. }
  3853. let currentInstance = null;
  3854. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  3855. let internalSetCurrentInstance;
  3856. let setInSSRSetupState;
  3857. {
  3858. internalSetCurrentInstance = (i) => {
  3859. currentInstance = i;
  3860. };
  3861. setInSSRSetupState = (v) => {
  3862. isInSSRComponentSetup = v;
  3863. };
  3864. }
  3865. const setCurrentInstance = (instance) => {
  3866. const prev = currentInstance;
  3867. internalSetCurrentInstance(instance);
  3868. instance.scope.on();
  3869. return () => {
  3870. instance.scope.off();
  3871. internalSetCurrentInstance(prev);
  3872. };
  3873. };
  3874. const unsetCurrentInstance = () => {
  3875. currentInstance && currentInstance.scope.off();
  3876. internalSetCurrentInstance(null);
  3877. };
  3878. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  3879. function validateComponentName(name, { isNativeTag }) {
  3880. if (isBuiltInTag(name) || isNativeTag(name)) {
  3881. warn$1(
  3882. "Do not use built-in or reserved HTML elements as component id: " + name
  3883. );
  3884. }
  3885. }
  3886. function isStatefulComponent(instance) {
  3887. return instance.vnode.shapeFlag & 4;
  3888. }
  3889. let isInSSRComponentSetup = false;
  3890. function setupComponent(instance, isSSR = false) {
  3891. isSSR && setInSSRSetupState(isSSR);
  3892. const {
  3893. props
  3894. /*, children*/
  3895. } = instance.vnode;
  3896. const isStateful = isStatefulComponent(instance);
  3897. initProps$1(instance, props, isStateful, isSSR);
  3898. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  3899. isSSR && setInSSRSetupState(false);
  3900. return setupResult;
  3901. }
  3902. function setupStatefulComponent(instance, isSSR) {
  3903. const Component2 = instance.type;
  3904. {
  3905. if (Component2.name) {
  3906. validateComponentName(Component2.name, instance.appContext.config);
  3907. }
  3908. if (Component2.components) {
  3909. const names = Object.keys(Component2.components);
  3910. for (let i = 0; i < names.length; i++) {
  3911. validateComponentName(names[i], instance.appContext.config);
  3912. }
  3913. }
  3914. if (Component2.directives) {
  3915. const names = Object.keys(Component2.directives);
  3916. for (let i = 0; i < names.length; i++) {
  3917. validateDirectiveName(names[i]);
  3918. }
  3919. }
  3920. if (Component2.compilerOptions && isRuntimeOnly()) {
  3921. warn$1(
  3922. `"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.`
  3923. );
  3924. }
  3925. }
  3926. instance.accessCache = /* @__PURE__ */ Object.create(null);
  3927. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  3928. {
  3929. exposePropsOnRenderContext(instance);
  3930. }
  3931. const { setup } = Component2;
  3932. if (setup) {
  3933. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  3934. const reset = setCurrentInstance(instance);
  3935. pauseTracking();
  3936. const setupResult = callWithErrorHandling(
  3937. setup,
  3938. instance,
  3939. 0,
  3940. [
  3941. shallowReadonly(instance.props),
  3942. setupContext
  3943. ]
  3944. );
  3945. resetTracking();
  3946. reset();
  3947. if (isPromise(setupResult)) {
  3948. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  3949. {
  3950. warn$1(
  3951. `setup() returned a Promise, but the version of Vue you are using does not support it yet.`
  3952. );
  3953. }
  3954. } else {
  3955. handleSetupResult(instance, setupResult, isSSR);
  3956. }
  3957. } else {
  3958. finishComponentSetup(instance, isSSR);
  3959. }
  3960. }
  3961. function handleSetupResult(instance, setupResult, isSSR) {
  3962. if (isFunction(setupResult)) {
  3963. {
  3964. instance.render = setupResult;
  3965. }
  3966. } else if (isObject(setupResult)) {
  3967. if (isVNode(setupResult)) {
  3968. warn$1(
  3969. `setup() should not return VNodes directly - return a render function instead.`
  3970. );
  3971. }
  3972. {
  3973. instance.devtoolsRawSetupState = setupResult;
  3974. }
  3975. instance.setupState = proxyRefs(setupResult);
  3976. {
  3977. exposeSetupStateOnRenderContext(instance);
  3978. }
  3979. } else if (setupResult !== void 0) {
  3980. warn$1(
  3981. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  3982. );
  3983. }
  3984. finishComponentSetup(instance, isSSR);
  3985. }
  3986. let compile;
  3987. const isRuntimeOnly = () => !compile;
  3988. function finishComponentSetup(instance, isSSR, skipOptions) {
  3989. const Component2 = instance.type;
  3990. if (!instance.render) {
  3991. instance.render = Component2.render || NOOP;
  3992. }
  3993. {
  3994. const reset = setCurrentInstance(instance);
  3995. pauseTracking();
  3996. try {
  3997. applyOptions$1(instance);
  3998. } finally {
  3999. resetTracking();
  4000. reset();
  4001. }
  4002. }
  4003. if (!Component2.render && instance.render === NOOP && !isSSR) {
  4004. if (Component2.template) {
  4005. warn$1(
  4006. `Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".`
  4007. );
  4008. } else {
  4009. warn$1(`Component is missing template or render function.`);
  4010. }
  4011. }
  4012. }
  4013. function getAttrsProxy(instance) {
  4014. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  4015. instance.attrs,
  4016. {
  4017. get(target, key) {
  4018. track(instance, "get", "$attrs");
  4019. return target[key];
  4020. },
  4021. set() {
  4022. warn$1(`setupContext.attrs is readonly.`);
  4023. return false;
  4024. },
  4025. deleteProperty() {
  4026. warn$1(`setupContext.attrs is readonly.`);
  4027. return false;
  4028. }
  4029. }
  4030. ));
  4031. }
  4032. function getSlotsProxy(instance) {
  4033. return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
  4034. get(target, key) {
  4035. track(instance, "get", "$slots");
  4036. return target[key];
  4037. }
  4038. }));
  4039. }
  4040. function createSetupContext(instance) {
  4041. const expose = (exposed) => {
  4042. {
  4043. if (instance.exposed) {
  4044. warn$1(`expose() should be called only once per setup().`);
  4045. }
  4046. if (exposed != null) {
  4047. let exposedType = typeof exposed;
  4048. if (exposedType === "object") {
  4049. if (isArray(exposed)) {
  4050. exposedType = "array";
  4051. } else if (isRef(exposed)) {
  4052. exposedType = "ref";
  4053. }
  4054. }
  4055. if (exposedType !== "object") {
  4056. warn$1(
  4057. `expose() should be passed a plain object, received ${exposedType}.`
  4058. );
  4059. }
  4060. }
  4061. }
  4062. instance.exposed = exposed || {};
  4063. };
  4064. {
  4065. return Object.freeze({
  4066. get attrs() {
  4067. return getAttrsProxy(instance);
  4068. },
  4069. get slots() {
  4070. return getSlotsProxy(instance);
  4071. },
  4072. get emit() {
  4073. return (event, ...args) => instance.emit(event, ...args);
  4074. },
  4075. expose
  4076. });
  4077. }
  4078. }
  4079. function getExposeProxy(instance) {
  4080. if (instance.exposed) {
  4081. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  4082. get(target, key) {
  4083. if (key in target) {
  4084. return target[key];
  4085. }
  4086. return instance.proxy[key];
  4087. },
  4088. has(target, key) {
  4089. return key in target || key in publicPropertiesMap;
  4090. }
  4091. }));
  4092. }
  4093. }
  4094. const classifyRE = /(?:^|[-_])(\w)/g;
  4095. const classify = (str) => str.replace(classifyRE, (c2) => c2.toUpperCase()).replace(/[-_]/g, "");
  4096. function getComponentName(Component2, includeInferred = true) {
  4097. return isFunction(Component2) ? Component2.displayName || Component2.name : Component2.name || includeInferred && Component2.__name;
  4098. }
  4099. function formatComponentName(instance, Component2, isRoot = false) {
  4100. let name = getComponentName(Component2);
  4101. if (!name && Component2.__file) {
  4102. const match = Component2.__file.match(/([^/\\]+)\.\w+$/);
  4103. if (match) {
  4104. name = match[1];
  4105. }
  4106. }
  4107. if (!name && instance && instance.parent) {
  4108. const inferFromRegistry = (registry) => {
  4109. for (const key in registry) {
  4110. if (registry[key] === Component2) {
  4111. return key;
  4112. }
  4113. }
  4114. };
  4115. name = inferFromRegistry(
  4116. instance.components || instance.parent.type.components
  4117. ) || inferFromRegistry(instance.appContext.components);
  4118. }
  4119. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  4120. }
  4121. const computed = (getterOrOptions, debugOptions) => {
  4122. const c2 = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  4123. {
  4124. const i = getCurrentInstance();
  4125. if (i && i.appContext.config.warnRecursiveComputed) {
  4126. c2._warnRecursive = true;
  4127. }
  4128. }
  4129. return c2;
  4130. };
  4131. const version = "3.4.21";
  4132. const warn = warn$1;
  4133. function unwrapper(target) {
  4134. return unref(target);
  4135. }
  4136. const ARRAYTYPE = "[object Array]";
  4137. const OBJECTTYPE = "[object Object]";
  4138. function diff(current, pre) {
  4139. const result = {};
  4140. syncKeys(current, pre);
  4141. _diff(current, pre, "", result);
  4142. return result;
  4143. }
  4144. function syncKeys(current, pre) {
  4145. current = unwrapper(current);
  4146. if (current === pre)
  4147. return;
  4148. const rootCurrentType = toTypeString(current);
  4149. const rootPreType = toTypeString(pre);
  4150. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  4151. for (let key in pre) {
  4152. const currentValue = current[key];
  4153. if (currentValue === void 0) {
  4154. current[key] = null;
  4155. } else {
  4156. syncKeys(currentValue, pre[key]);
  4157. }
  4158. }
  4159. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  4160. if (current.length >= pre.length) {
  4161. pre.forEach((item, index2) => {
  4162. syncKeys(current[index2], item);
  4163. });
  4164. }
  4165. }
  4166. }
  4167. function _diff(current, pre, path, result) {
  4168. current = unwrapper(current);
  4169. if (current === pre)
  4170. return;
  4171. const rootCurrentType = toTypeString(current);
  4172. const rootPreType = toTypeString(pre);
  4173. if (rootCurrentType == OBJECTTYPE) {
  4174. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  4175. setResult(result, path, current);
  4176. } else {
  4177. for (let key in current) {
  4178. const currentValue = unwrapper(current[key]);
  4179. const preValue = pre[key];
  4180. const currentType = toTypeString(currentValue);
  4181. const preType = toTypeString(preValue);
  4182. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  4183. if (currentValue != preValue) {
  4184. setResult(
  4185. result,
  4186. (path == "" ? "" : path + ".") + key,
  4187. currentValue
  4188. );
  4189. }
  4190. } else if (currentType == ARRAYTYPE) {
  4191. if (preType != ARRAYTYPE) {
  4192. setResult(
  4193. result,
  4194. (path == "" ? "" : path + ".") + key,
  4195. currentValue
  4196. );
  4197. } else {
  4198. if (currentValue.length < preValue.length) {
  4199. setResult(
  4200. result,
  4201. (path == "" ? "" : path + ".") + key,
  4202. currentValue
  4203. );
  4204. } else {
  4205. currentValue.forEach((item, index2) => {
  4206. _diff(
  4207. item,
  4208. preValue[index2],
  4209. (path == "" ? "" : path + ".") + key + "[" + index2 + "]",
  4210. result
  4211. );
  4212. });
  4213. }
  4214. }
  4215. } else if (currentType == OBJECTTYPE) {
  4216. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  4217. setResult(
  4218. result,
  4219. (path == "" ? "" : path + ".") + key,
  4220. currentValue
  4221. );
  4222. } else {
  4223. for (let subKey in currentValue) {
  4224. _diff(
  4225. currentValue[subKey],
  4226. preValue[subKey],
  4227. (path == "" ? "" : path + ".") + key + "." + subKey,
  4228. result
  4229. );
  4230. }
  4231. }
  4232. }
  4233. }
  4234. }
  4235. } else if (rootCurrentType == ARRAYTYPE) {
  4236. if (rootPreType != ARRAYTYPE) {
  4237. setResult(result, path, current);
  4238. } else {
  4239. if (current.length < pre.length) {
  4240. setResult(result, path, current);
  4241. } else {
  4242. current.forEach((item, index2) => {
  4243. _diff(item, pre[index2], path + "[" + index2 + "]", result);
  4244. });
  4245. }
  4246. }
  4247. } else {
  4248. setResult(result, path, current);
  4249. }
  4250. }
  4251. function setResult(result, k, v) {
  4252. result[k] = v;
  4253. }
  4254. function hasComponentEffect(instance) {
  4255. return queue$1.includes(instance.update);
  4256. }
  4257. function flushCallbacks(instance) {
  4258. const ctx = instance.ctx;
  4259. const callbacks = ctx.__next_tick_callbacks;
  4260. if (callbacks && callbacks.length) {
  4261. const copies = callbacks.slice(0);
  4262. callbacks.length = 0;
  4263. for (let i = 0; i < copies.length; i++) {
  4264. copies[i]();
  4265. }
  4266. }
  4267. }
  4268. function nextTick(instance, fn) {
  4269. const ctx = instance.ctx;
  4270. if (!ctx.__next_tick_pending && !hasComponentEffect(instance)) {
  4271. return nextTick$1(fn && fn.bind(instance.proxy));
  4272. }
  4273. let _resolve;
  4274. if (!ctx.__next_tick_callbacks) {
  4275. ctx.__next_tick_callbacks = [];
  4276. }
  4277. ctx.__next_tick_callbacks.push(() => {
  4278. if (fn) {
  4279. callWithErrorHandling(
  4280. fn.bind(instance.proxy),
  4281. instance,
  4282. 14
  4283. );
  4284. } else if (_resolve) {
  4285. _resolve(instance.proxy);
  4286. }
  4287. });
  4288. return new Promise((resolve2) => {
  4289. _resolve = resolve2;
  4290. });
  4291. }
  4292. function clone(src, seen) {
  4293. src = unwrapper(src);
  4294. const type = typeof src;
  4295. if (type === "object" && src !== null) {
  4296. let copy = seen.get(src);
  4297. if (typeof copy !== "undefined") {
  4298. return copy;
  4299. }
  4300. if (isArray(src)) {
  4301. const len = src.length;
  4302. copy = new Array(len);
  4303. seen.set(src, copy);
  4304. for (let i = 0; i < len; i++) {
  4305. copy[i] = clone(src[i], seen);
  4306. }
  4307. } else {
  4308. copy = {};
  4309. seen.set(src, copy);
  4310. for (const name in src) {
  4311. if (hasOwn(src, name)) {
  4312. copy[name] = clone(src[name], seen);
  4313. }
  4314. }
  4315. }
  4316. return copy;
  4317. }
  4318. if (type !== "symbol") {
  4319. return src;
  4320. }
  4321. }
  4322. function deepCopy(src) {
  4323. return clone(src, typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : /* @__PURE__ */ new Map());
  4324. }
  4325. function getMPInstanceData(instance, keys) {
  4326. const data = instance.data;
  4327. const ret = /* @__PURE__ */ Object.create(null);
  4328. keys.forEach((key) => {
  4329. ret[key] = data[key];
  4330. });
  4331. return ret;
  4332. }
  4333. function patch(instance, data, oldData) {
  4334. if (!data) {
  4335. return;
  4336. }
  4337. data = deepCopy(data);
  4338. data.$eS = instance.$eS || {};
  4339. data.$eA = instance.$eA || {};
  4340. const ctx = instance.ctx;
  4341. const mpType = ctx.mpType;
  4342. if (mpType === "page" || mpType === "component") {
  4343. data.r0 = 1;
  4344. const mpInstance = ctx.$scope;
  4345. const keys = Object.keys(data);
  4346. const diffData = diff(data, oldData || getMPInstanceData(mpInstance, keys));
  4347. if (Object.keys(diffData).length) {
  4348. ctx.__next_tick_pending = true;
  4349. mpInstance.setData(diffData, () => {
  4350. ctx.__next_tick_pending = false;
  4351. flushCallbacks(instance);
  4352. });
  4353. flushPreFlushCbs();
  4354. } else {
  4355. flushCallbacks(instance);
  4356. }
  4357. }
  4358. }
  4359. function initAppConfig(appConfig) {
  4360. appConfig.globalProperties.$nextTick = function $nextTick(fn) {
  4361. return nextTick(this.$, fn);
  4362. };
  4363. }
  4364. function onApplyOptions(options, instance, publicThis) {
  4365. instance.appContext.config.globalProperties.$applyOptions(
  4366. options,
  4367. instance,
  4368. publicThis
  4369. );
  4370. const computedOptions = options.computed;
  4371. if (computedOptions) {
  4372. const keys = Object.keys(computedOptions);
  4373. if (keys.length) {
  4374. const ctx = instance.ctx;
  4375. if (!ctx.$computedKeys) {
  4376. ctx.$computedKeys = [];
  4377. }
  4378. ctx.$computedKeys.push(...keys);
  4379. }
  4380. }
  4381. delete instance.ctx.$onApplyOptions;
  4382. }
  4383. function setRef$1(instance, isUnmount = false) {
  4384. const {
  4385. setupState,
  4386. $templateRefs,
  4387. $templateUniElementRefs,
  4388. ctx: { $scope, $mpPlatform }
  4389. } = instance;
  4390. if ($mpPlatform === "mp-alipay") {
  4391. return;
  4392. }
  4393. if (!$scope || !$templateRefs && !$templateUniElementRefs) {
  4394. return;
  4395. }
  4396. if (isUnmount) {
  4397. $templateRefs && $templateRefs.forEach(
  4398. (templateRef) => setTemplateRef(templateRef, null, setupState)
  4399. );
  4400. $templateUniElementRefs && $templateUniElementRefs.forEach(
  4401. (templateRef) => setTemplateRef(templateRef, null, setupState)
  4402. );
  4403. return;
  4404. }
  4405. const check = $mpPlatform === "mp-baidu" || $mpPlatform === "mp-toutiao";
  4406. const doSetByRefs = (refs) => {
  4407. if (refs.length === 0) {
  4408. return [];
  4409. }
  4410. const mpComponents = (
  4411. // 字节小程序 selectAllComponents 可能返回 null
  4412. // https://github.com/dcloudio/uni-app/issues/3954
  4413. ($scope.selectAllComponents(".r") || []).concat(
  4414. $scope.selectAllComponents(".r-i-f") || []
  4415. )
  4416. );
  4417. return refs.filter((templateRef) => {
  4418. const refValue = findComponentPublicInstance(mpComponents, templateRef.i);
  4419. if (check && refValue === null) {
  4420. return true;
  4421. }
  4422. setTemplateRef(templateRef, refValue, setupState);
  4423. return false;
  4424. });
  4425. };
  4426. const doSet = () => {
  4427. if ($templateRefs) {
  4428. const refs = doSetByRefs($templateRefs);
  4429. if (refs.length && instance.proxy && instance.proxy.$scope) {
  4430. instance.proxy.$scope.setData({ r1: 1 }, () => {
  4431. doSetByRefs(refs);
  4432. });
  4433. }
  4434. }
  4435. };
  4436. if ($templateUniElementRefs && $templateUniElementRefs.length) {
  4437. nextTick(instance, () => {
  4438. $templateUniElementRefs.forEach((templateRef) => {
  4439. if (isArray(templateRef.v)) {
  4440. templateRef.v.forEach((v) => {
  4441. setTemplateRef(templateRef, v, setupState);
  4442. });
  4443. } else {
  4444. setTemplateRef(templateRef, templateRef.v, setupState);
  4445. }
  4446. });
  4447. });
  4448. }
  4449. if ($scope._$setRef) {
  4450. $scope._$setRef(doSet);
  4451. } else {
  4452. nextTick(instance, doSet);
  4453. }
  4454. }
  4455. function toSkip(value) {
  4456. if (isObject(value)) {
  4457. markRaw(value);
  4458. }
  4459. return value;
  4460. }
  4461. function findComponentPublicInstance(mpComponents, id) {
  4462. const mpInstance = mpComponents.find(
  4463. (com) => com && (com.properties || com.props).uI === id
  4464. );
  4465. if (mpInstance) {
  4466. const vm = mpInstance.$vm;
  4467. if (vm) {
  4468. return getExposeProxy(vm.$) || vm;
  4469. }
  4470. return toSkip(mpInstance);
  4471. }
  4472. return null;
  4473. }
  4474. function setTemplateRef({ r: r2, f: f2 }, refValue, setupState) {
  4475. if (isFunction(r2)) {
  4476. r2(refValue, {});
  4477. } else {
  4478. const _isString = isString(r2);
  4479. const _isRef = isRef(r2);
  4480. if (_isString || _isRef) {
  4481. if (f2) {
  4482. if (!_isRef) {
  4483. return;
  4484. }
  4485. if (!isArray(r2.value)) {
  4486. r2.value = [];
  4487. }
  4488. const existing = r2.value;
  4489. if (existing.indexOf(refValue) === -1) {
  4490. existing.push(refValue);
  4491. if (!refValue) {
  4492. return;
  4493. }
  4494. if (refValue.$) {
  4495. onBeforeUnmount(() => remove(existing, refValue), refValue.$);
  4496. }
  4497. }
  4498. } else if (_isString) {
  4499. if (hasOwn(setupState, r2)) {
  4500. setupState[r2] = refValue;
  4501. }
  4502. } else if (isRef(r2)) {
  4503. r2.value = refValue;
  4504. } else {
  4505. warnRef(r2);
  4506. }
  4507. } else {
  4508. warnRef(r2);
  4509. }
  4510. }
  4511. }
  4512. function warnRef(ref2) {
  4513. warn("Invalid template ref type:", ref2, `(${typeof ref2})`);
  4514. }
  4515. const queuePostRenderEffect = queuePostFlushCb;
  4516. function mountComponent(initialVNode, options) {
  4517. const instance = initialVNode.component = createComponentInstance(initialVNode, options.parentComponent, null);
  4518. {
  4519. instance.ctx.$onApplyOptions = onApplyOptions;
  4520. instance.ctx.$children = [];
  4521. }
  4522. if (options.mpType === "app") {
  4523. instance.render = NOOP;
  4524. }
  4525. if (options.onBeforeSetup) {
  4526. options.onBeforeSetup(instance, options);
  4527. }
  4528. {
  4529. pushWarningContext(initialVNode);
  4530. startMeasure(instance, `mount`);
  4531. }
  4532. {
  4533. startMeasure(instance, `init`);
  4534. }
  4535. setupComponent(instance);
  4536. {
  4537. endMeasure(instance, `init`);
  4538. }
  4539. {
  4540. if (options.parentComponent && instance.proxy) {
  4541. options.parentComponent.ctx.$children.push(getExposeProxy(instance) || instance.proxy);
  4542. }
  4543. }
  4544. setupRenderEffect(instance);
  4545. {
  4546. popWarningContext();
  4547. endMeasure(instance, `mount`);
  4548. }
  4549. return instance.proxy;
  4550. }
  4551. const getFunctionalFallthrough = (attrs) => {
  4552. let res;
  4553. for (const key in attrs) {
  4554. if (key === "class" || key === "style" || isOn(key)) {
  4555. (res || (res = {}))[key] = attrs[key];
  4556. }
  4557. }
  4558. return res;
  4559. };
  4560. function renderComponentRoot(instance) {
  4561. const {
  4562. type: Component2,
  4563. vnode,
  4564. proxy,
  4565. withProxy,
  4566. props,
  4567. propsOptions: [propsOptions],
  4568. slots,
  4569. attrs,
  4570. emit: emit2,
  4571. render,
  4572. renderCache,
  4573. data,
  4574. setupState,
  4575. ctx,
  4576. uid: uid2,
  4577. appContext: {
  4578. app: {
  4579. config: {
  4580. globalProperties: { pruneComponentPropsCache: pruneComponentPropsCache2 }
  4581. }
  4582. }
  4583. },
  4584. inheritAttrs
  4585. } = instance;
  4586. instance.$uniElementIds = /* @__PURE__ */ new Map();
  4587. instance.$templateRefs = [];
  4588. instance.$templateUniElementRefs = [];
  4589. instance.$templateUniElementStyles = {};
  4590. instance.$ei = 0;
  4591. pruneComponentPropsCache2(uid2);
  4592. instance.__counter = instance.__counter === 0 ? 1 : 0;
  4593. let result;
  4594. const prev = setCurrentRenderingInstance(instance);
  4595. try {
  4596. if (vnode.shapeFlag & 4) {
  4597. fallthroughAttrs(inheritAttrs, props, propsOptions, attrs);
  4598. const proxyToUse = withProxy || proxy;
  4599. result = render.call(
  4600. proxyToUse,
  4601. proxyToUse,
  4602. renderCache,
  4603. props,
  4604. setupState,
  4605. data,
  4606. ctx
  4607. );
  4608. } else {
  4609. fallthroughAttrs(
  4610. inheritAttrs,
  4611. props,
  4612. propsOptions,
  4613. Component2.props ? attrs : getFunctionalFallthrough(attrs)
  4614. );
  4615. const render2 = Component2;
  4616. result = render2.length > 1 ? render2(props, { attrs, slots, emit: emit2 }) : render2(
  4617. props,
  4618. null
  4619. /* we know it doesn't need it */
  4620. );
  4621. }
  4622. } catch (err) {
  4623. handleError(err, instance, 1);
  4624. result = false;
  4625. }
  4626. setRef$1(instance);
  4627. setCurrentRenderingInstance(prev);
  4628. return result;
  4629. }
  4630. function fallthroughAttrs(inheritAttrs, props, propsOptions, fallthroughAttrs2) {
  4631. if (props && fallthroughAttrs2 && inheritAttrs !== false) {
  4632. const keys = Object.keys(fallthroughAttrs2).filter(
  4633. (key) => key !== "class" && key !== "style"
  4634. );
  4635. if (!keys.length) {
  4636. return;
  4637. }
  4638. if (propsOptions && keys.some(isModelListener)) {
  4639. keys.forEach((key) => {
  4640. if (!isModelListener(key) || !(key.slice(9) in propsOptions)) {
  4641. props[key] = fallthroughAttrs2[key];
  4642. }
  4643. });
  4644. } else {
  4645. keys.forEach((key) => props[key] = fallthroughAttrs2[key]);
  4646. }
  4647. }
  4648. }
  4649. const updateComponentPreRender = (instance) => {
  4650. pauseTracking();
  4651. flushPreFlushCbs();
  4652. resetTracking();
  4653. };
  4654. function componentUpdateScopedSlotsFn() {
  4655. const scopedSlotsData = this.$scopedSlotsData;
  4656. if (!scopedSlotsData || scopedSlotsData.length === 0) {
  4657. return;
  4658. }
  4659. const mpInstance = this.ctx.$scope;
  4660. const oldData = mpInstance.data;
  4661. const diffData = /* @__PURE__ */ Object.create(null);
  4662. scopedSlotsData.forEach(({ path, index: index2, data }) => {
  4663. const oldScopedSlotData = getValueByDataPath(oldData, path);
  4664. const diffPath = isString(index2) ? `${path}.${index2}` : `${path}[${index2}]`;
  4665. if (typeof oldScopedSlotData === "undefined" || typeof oldScopedSlotData[index2] === "undefined") {
  4666. diffData[diffPath] = data;
  4667. } else {
  4668. const diffScopedSlotData = diff(
  4669. data,
  4670. oldScopedSlotData[index2]
  4671. );
  4672. Object.keys(diffScopedSlotData).forEach((name) => {
  4673. diffData[diffPath + "." + name] = diffScopedSlotData[name];
  4674. });
  4675. }
  4676. });
  4677. scopedSlotsData.length = 0;
  4678. if (Object.keys(diffData).length) {
  4679. mpInstance.setData(diffData);
  4680. }
  4681. }
  4682. function toggleRecurse({ effect: effect2, update }, allowed) {
  4683. effect2.allowRecurse = update.allowRecurse = allowed;
  4684. }
  4685. function setupRenderEffect(instance) {
  4686. const updateScopedSlots = componentUpdateScopedSlotsFn.bind(
  4687. instance
  4688. );
  4689. instance.$updateScopedSlots = () => nextTick$1(() => queueJob(updateScopedSlots));
  4690. const componentUpdateFn = () => {
  4691. if (!instance.isMounted) {
  4692. onBeforeUnmount(() => {
  4693. setRef$1(instance, true);
  4694. }, instance);
  4695. {
  4696. startMeasure(instance, `patch`);
  4697. }
  4698. patch(instance, renderComponentRoot(instance));
  4699. {
  4700. endMeasure(instance, `patch`);
  4701. }
  4702. {
  4703. devtoolsComponentAdded(instance);
  4704. }
  4705. } else {
  4706. const { next, bu, u } = instance;
  4707. {
  4708. pushWarningContext(next || instance.vnode);
  4709. }
  4710. toggleRecurse(instance, false);
  4711. updateComponentPreRender();
  4712. if (bu) {
  4713. invokeArrayFns$1(bu);
  4714. }
  4715. toggleRecurse(instance, true);
  4716. {
  4717. startMeasure(instance, `patch`);
  4718. }
  4719. patch(instance, renderComponentRoot(instance));
  4720. {
  4721. endMeasure(instance, `patch`);
  4722. }
  4723. if (u) {
  4724. queuePostRenderEffect(u);
  4725. }
  4726. {
  4727. devtoolsComponentUpdated(instance);
  4728. }
  4729. {
  4730. popWarningContext();
  4731. }
  4732. }
  4733. };
  4734. const effect2 = instance.effect = new ReactiveEffect(
  4735. componentUpdateFn,
  4736. NOOP,
  4737. () => queueJob(update),
  4738. instance.scope
  4739. // track it in component's effect scope
  4740. );
  4741. const update = instance.update = () => {
  4742. if (effect2.dirty) {
  4743. effect2.run();
  4744. }
  4745. };
  4746. update.id = instance.uid;
  4747. toggleRecurse(instance, true);
  4748. {
  4749. effect2.onTrack = instance.rtc ? (e2) => invokeArrayFns$1(instance.rtc, e2) : void 0;
  4750. effect2.onTrigger = instance.rtg ? (e2) => invokeArrayFns$1(instance.rtg, e2) : void 0;
  4751. update.ownerInstance = instance;
  4752. }
  4753. {
  4754. update();
  4755. }
  4756. }
  4757. function unmountComponent(instance) {
  4758. const { bum, scope, update, um } = instance;
  4759. if (bum) {
  4760. invokeArrayFns$1(bum);
  4761. }
  4762. {
  4763. const parentInstance = instance.parent;
  4764. if (parentInstance) {
  4765. const $children = parentInstance.ctx.$children;
  4766. const target = getExposeProxy(instance) || instance.proxy;
  4767. const index2 = $children.indexOf(target);
  4768. if (index2 > -1) {
  4769. $children.splice(index2, 1);
  4770. }
  4771. }
  4772. }
  4773. scope.stop();
  4774. if (update) {
  4775. update.active = false;
  4776. }
  4777. if (um) {
  4778. queuePostRenderEffect(um);
  4779. }
  4780. queuePostRenderEffect(() => {
  4781. instance.isUnmounted = true;
  4782. });
  4783. {
  4784. devtoolsComponentRemoved(instance);
  4785. }
  4786. }
  4787. const oldCreateApp = createAppAPI();
  4788. function getTarget() {
  4789. if (typeof window !== "undefined") {
  4790. return window;
  4791. }
  4792. if (typeof globalThis !== "undefined") {
  4793. return globalThis;
  4794. }
  4795. if (typeof global !== "undefined") {
  4796. return global;
  4797. }
  4798. if (typeof my !== "undefined") {
  4799. return my;
  4800. }
  4801. }
  4802. function createVueApp(rootComponent, rootProps = null) {
  4803. const target = getTarget();
  4804. target.__VUE__ = true;
  4805. {
  4806. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  4807. }
  4808. const app = oldCreateApp(rootComponent, rootProps);
  4809. const appContext = app._context;
  4810. initAppConfig(appContext.config);
  4811. const createVNode2 = (initialVNode) => {
  4812. initialVNode.appContext = appContext;
  4813. initialVNode.shapeFlag = 6;
  4814. return initialVNode;
  4815. };
  4816. const createComponent2 = function createComponent22(initialVNode, options) {
  4817. return mountComponent(createVNode2(initialVNode), options);
  4818. };
  4819. const destroyComponent = function destroyComponent2(component) {
  4820. return component && unmountComponent(component.$);
  4821. };
  4822. app.mount = function mount() {
  4823. rootComponent.render = NOOP;
  4824. const instance = mountComponent(
  4825. createVNode2({ type: rootComponent }),
  4826. {
  4827. mpType: "app",
  4828. mpInstance: null,
  4829. parentComponent: null,
  4830. slots: [],
  4831. props: null
  4832. }
  4833. );
  4834. app._instance = instance.$;
  4835. {
  4836. devtoolsInitApp(app, version);
  4837. }
  4838. instance.$app = app;
  4839. instance.$createComponent = createComponent2;
  4840. instance.$destroyComponent = destroyComponent;
  4841. appContext.$appInstance = instance;
  4842. return instance;
  4843. };
  4844. app.unmount = function unmount() {
  4845. warn(`Cannot unmount an app.`);
  4846. };
  4847. return app;
  4848. }
  4849. function injectLifecycleHook(name, hook, publicThis, instance) {
  4850. if (isFunction(hook)) {
  4851. injectHook(name, hook.bind(publicThis), instance);
  4852. }
  4853. }
  4854. function initHooks$1(options, instance, publicThis) {
  4855. const mpType = options.mpType || publicThis.$mpType;
  4856. if (!mpType || mpType === "component") {
  4857. return;
  4858. }
  4859. Object.keys(options).forEach((name) => {
  4860. if (isUniLifecycleHook(name, options[name], false)) {
  4861. const hooks = options[name];
  4862. if (isArray(hooks)) {
  4863. hooks.forEach((hook) => injectLifecycleHook(name, hook, publicThis, instance));
  4864. } else {
  4865. injectLifecycleHook(name, hooks, publicThis, instance);
  4866. }
  4867. }
  4868. });
  4869. }
  4870. function applyOptions$2(options, instance, publicThis) {
  4871. initHooks$1(options, instance, publicThis);
  4872. }
  4873. function set(target, key, val) {
  4874. return target[key] = val;
  4875. }
  4876. function $callMethod(method, ...args) {
  4877. const fn = this[method];
  4878. if (fn) {
  4879. return fn(...args);
  4880. }
  4881. console.error(`method ${method} not found`);
  4882. return null;
  4883. }
  4884. function createErrorHandler(app) {
  4885. const userErrorHandler = app.config.errorHandler;
  4886. return function errorHandler(err, instance, info) {
  4887. if (userErrorHandler) {
  4888. userErrorHandler(err, instance, info);
  4889. }
  4890. const appInstance = app._instance;
  4891. if (!appInstance || !appInstance.proxy) {
  4892. throw err;
  4893. }
  4894. if (appInstance[ON_ERROR]) {
  4895. {
  4896. appInstance.proxy.$callHook(ON_ERROR, err);
  4897. }
  4898. } else {
  4899. logError(err, info, instance ? instance.$.vnode : null, false);
  4900. }
  4901. };
  4902. }
  4903. function mergeAsArray(to, from) {
  4904. return to ? [...new Set([].concat(to, from))] : from;
  4905. }
  4906. function initOptionMergeStrategies(optionMergeStrategies) {
  4907. UniLifecycleHooks.forEach((name) => {
  4908. optionMergeStrategies[name] = mergeAsArray;
  4909. });
  4910. }
  4911. let realAtob;
  4912. const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  4913. const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  4914. if (typeof atob !== "function") {
  4915. realAtob = function(str) {
  4916. str = String(str).replace(/[\t\n\f\r ]+/g, "");
  4917. if (!b64re.test(str)) {
  4918. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  4919. }
  4920. str += "==".slice(2 - (str.length & 3));
  4921. var bitmap;
  4922. var result = "";
  4923. var r1;
  4924. var r2;
  4925. var i = 0;
  4926. for (; i < str.length; ) {
  4927. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  4928. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  4929. }
  4930. return result;
  4931. };
  4932. } else {
  4933. realAtob = atob;
  4934. }
  4935. function b64DecodeUnicode(str) {
  4936. return decodeURIComponent(realAtob(str).split("").map(function(c2) {
  4937. return "%" + ("00" + c2.charCodeAt(0).toString(16)).slice(-2);
  4938. }).join(""));
  4939. }
  4940. function getCurrentUserInfo() {
  4941. const token = index.getStorageSync("uni_id_token") || "";
  4942. const tokenArr = token.split(".");
  4943. if (!token || tokenArr.length !== 3) {
  4944. return {
  4945. uid: null,
  4946. role: [],
  4947. permission: [],
  4948. tokenExpired: 0
  4949. };
  4950. }
  4951. let userInfo;
  4952. try {
  4953. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  4954. } catch (error) {
  4955. throw new Error("获取当前用户信息出错,详细错误信息为:" + error.message);
  4956. }
  4957. userInfo.tokenExpired = userInfo.exp * 1e3;
  4958. delete userInfo.exp;
  4959. delete userInfo.iat;
  4960. return userInfo;
  4961. }
  4962. function uniIdMixin(globalProperties) {
  4963. globalProperties.uniIDHasRole = function(roleId) {
  4964. const { role } = getCurrentUserInfo();
  4965. return role.indexOf(roleId) > -1;
  4966. };
  4967. globalProperties.uniIDHasPermission = function(permissionId) {
  4968. const { permission } = getCurrentUserInfo();
  4969. return this.uniIDHasRole("admin") || permission.indexOf(permissionId) > -1;
  4970. };
  4971. globalProperties.uniIDTokenValid = function() {
  4972. const { tokenExpired } = getCurrentUserInfo();
  4973. return tokenExpired > Date.now();
  4974. };
  4975. }
  4976. function initApp(app) {
  4977. const appConfig = app.config;
  4978. appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler);
  4979. initOptionMergeStrategies(appConfig.optionMergeStrategies);
  4980. const globalProperties = appConfig.globalProperties;
  4981. {
  4982. uniIdMixin(globalProperties);
  4983. }
  4984. {
  4985. globalProperties.$set = set;
  4986. globalProperties.$applyOptions = applyOptions$2;
  4987. globalProperties.$callMethod = $callMethod;
  4988. }
  4989. {
  4990. index.invokeCreateVueAppHook(app);
  4991. }
  4992. }
  4993. const propsCaches = /* @__PURE__ */ Object.create(null);
  4994. function renderProps(props) {
  4995. const { uid: uid2, __counter } = getCurrentInstance();
  4996. const propsId = (propsCaches[uid2] || (propsCaches[uid2] = [])).push(guardReactiveProps(props)) - 1;
  4997. return uid2 + "," + propsId + "," + __counter;
  4998. }
  4999. function pruneComponentPropsCache(uid2) {
  5000. delete propsCaches[uid2];
  5001. }
  5002. function findComponentPropsData(up) {
  5003. if (!up) {
  5004. return;
  5005. }
  5006. const [uid2, propsId] = up.split(",");
  5007. if (!propsCaches[uid2]) {
  5008. return;
  5009. }
  5010. return propsCaches[uid2][parseInt(propsId)];
  5011. }
  5012. var plugin = {
  5013. install(app) {
  5014. initApp(app);
  5015. app.config.globalProperties.pruneComponentPropsCache = pruneComponentPropsCache;
  5016. const oldMount = app.mount;
  5017. app.mount = function mount(rootContainer) {
  5018. const instance = oldMount.call(app, rootContainer);
  5019. const createApp2 = getCreateApp();
  5020. if (createApp2) {
  5021. createApp2(instance);
  5022. } else {
  5023. if (typeof createMiniProgramApp !== "undefined") {
  5024. createMiniProgramApp(instance);
  5025. }
  5026. }
  5027. return instance;
  5028. };
  5029. }
  5030. };
  5031. function getCreateApp() {
  5032. const method = "createApp";
  5033. if (typeof global !== "undefined" && typeof global[method] !== "undefined") {
  5034. return global[method];
  5035. } else if (typeof my !== "undefined") {
  5036. return my[method];
  5037. }
  5038. }
  5039. function vOn(value, key) {
  5040. const instance = getCurrentInstance();
  5041. const ctx = instance.ctx;
  5042. const extraKey = typeof key !== "undefined" && (ctx.$mpPlatform === "mp-weixin" || ctx.$mpPlatform === "mp-qq" || ctx.$mpPlatform === "mp-xhs") && (isString(key) || typeof key === "number") ? "_" + key : "";
  5043. const name = "e" + instance.$ei++ + extraKey;
  5044. const mpInstance = ctx.$scope;
  5045. if (!value) {
  5046. delete mpInstance[name];
  5047. return name;
  5048. }
  5049. const existingInvoker = mpInstance[name];
  5050. if (existingInvoker) {
  5051. existingInvoker.value = value;
  5052. } else {
  5053. mpInstance[name] = createInvoker(value, instance);
  5054. }
  5055. return name;
  5056. }
  5057. function createInvoker(initialValue, instance) {
  5058. const invoker = (e2) => {
  5059. patchMPEvent(e2);
  5060. let args = [e2];
  5061. if (instance && instance.ctx.$getTriggerEventDetail) {
  5062. if (typeof e2.detail === "number") {
  5063. e2.detail = instance.ctx.$getTriggerEventDetail(e2.detail);
  5064. }
  5065. }
  5066. if (e2.detail && e2.detail.__args__) {
  5067. args = e2.detail.__args__;
  5068. }
  5069. const eventValue = invoker.value;
  5070. const invoke = () => callWithAsyncErrorHandling(patchStopImmediatePropagation(e2, eventValue), instance, 5, args);
  5071. const eventTarget = e2.target;
  5072. const eventSync = eventTarget ? eventTarget.dataset ? String(eventTarget.dataset.eventsync) === "true" : false : false;
  5073. if (bubbles.includes(e2.type) && !eventSync) {
  5074. setTimeout(invoke);
  5075. } else {
  5076. const res = invoke();
  5077. if (e2.type === "input" && (isArray(res) || isPromise(res))) {
  5078. return;
  5079. }
  5080. return res;
  5081. }
  5082. };
  5083. invoker.value = initialValue;
  5084. return invoker;
  5085. }
  5086. const bubbles = [
  5087. // touch事件暂不做延迟,否则在 Android 上会影响性能,比如一些拖拽跟手手势等
  5088. // 'touchstart',
  5089. // 'touchmove',
  5090. // 'touchcancel',
  5091. // 'touchend',
  5092. "tap",
  5093. "longpress",
  5094. "longtap",
  5095. "transitionend",
  5096. "animationstart",
  5097. "animationiteration",
  5098. "animationend",
  5099. "touchforcechange"
  5100. ];
  5101. function patchMPEvent(event, instance) {
  5102. if (event.type && event.target) {
  5103. event.preventDefault = NOOP;
  5104. event.stopPropagation = NOOP;
  5105. event.stopImmediatePropagation = NOOP;
  5106. if (!hasOwn(event, "detail")) {
  5107. event.detail = {};
  5108. }
  5109. if (hasOwn(event, "markerId")) {
  5110. event.detail = typeof event.detail === "object" ? event.detail : {};
  5111. event.detail.markerId = event.markerId;
  5112. }
  5113. if (isPlainObject(event.detail) && hasOwn(event.detail, "checked") && !hasOwn(event.detail, "value")) {
  5114. event.detail.value = event.detail.checked;
  5115. }
  5116. if (isPlainObject(event.detail)) {
  5117. event.target = extend({}, event.target, event.detail);
  5118. }
  5119. }
  5120. }
  5121. function patchStopImmediatePropagation(e2, value) {
  5122. if (isArray(value)) {
  5123. const originalStop = e2.stopImmediatePropagation;
  5124. e2.stopImmediatePropagation = () => {
  5125. originalStop && originalStop.call(e2);
  5126. e2._stopped = true;
  5127. };
  5128. return value.map((fn) => (e3) => !e3._stopped && fn(e3));
  5129. } else {
  5130. return value;
  5131. }
  5132. }
  5133. function vFor(source, renderItem) {
  5134. let ret;
  5135. if (isArray(source) || isString(source)) {
  5136. ret = new Array(source.length);
  5137. for (let i = 0, l = source.length; i < l; i++) {
  5138. ret[i] = renderItem(source[i], i, i);
  5139. }
  5140. } else if (typeof source === "number") {
  5141. if (!Number.isInteger(source)) {
  5142. warn(`The v-for range expect an integer value but got ${source}.`);
  5143. return [];
  5144. }
  5145. ret = new Array(source);
  5146. for (let i = 0; i < source; i++) {
  5147. ret[i] = renderItem(i + 1, i, i);
  5148. }
  5149. } else if (isObject(source)) {
  5150. if (source[Symbol.iterator]) {
  5151. ret = Array.from(source, (item, i) => renderItem(item, i, i));
  5152. } else {
  5153. const keys = Object.keys(source);
  5154. ret = new Array(keys.length);
  5155. for (let i = 0, l = keys.length; i < l; i++) {
  5156. const key = keys[i];
  5157. ret[i] = renderItem(source[key], key, i);
  5158. }
  5159. }
  5160. } else {
  5161. ret = [];
  5162. }
  5163. return ret;
  5164. }
  5165. const o = (value, key) => vOn(value, key);
  5166. const f = (source, renderItem) => vFor(source, renderItem);
  5167. const e = (target, ...sources) => extend(target, ...sources);
  5168. const n = (value) => normalizeClass(value);
  5169. const t = (val) => toDisplayString(val);
  5170. const p = (props) => renderProps(props);
  5171. function createApp$1(rootComponent, rootProps = null) {
  5172. rootComponent && (rootComponent.mpType = "app");
  5173. return createVueApp(rootComponent, rootProps).use(plugin);
  5174. }
  5175. const createSSRApp = createApp$1;
  5176. function getLocaleLanguage$1() {
  5177. let localeLanguage = "";
  5178. {
  5179. const appBaseInfo = wx.getAppBaseInfo();
  5180. const language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
  5181. localeLanguage = normalizeLocale(language) || LOCALE_EN;
  5182. }
  5183. return localeLanguage;
  5184. }
  5185. function validateProtocolFail(name, msg) {
  5186. console.warn(`${name}: ${msg}`);
  5187. }
  5188. function validateProtocol(name, data, protocol, onFail) {
  5189. if (!onFail) {
  5190. onFail = validateProtocolFail;
  5191. }
  5192. for (const key in protocol) {
  5193. const errMsg = validateProp(key, data[key], protocol[key], !hasOwn(data, key));
  5194. if (isString(errMsg)) {
  5195. onFail(name, errMsg);
  5196. }
  5197. }
  5198. }
  5199. function validateProtocols(name, args, protocol, onFail) {
  5200. if (!protocol) {
  5201. return;
  5202. }
  5203. if (!isArray(protocol)) {
  5204. return validateProtocol(name, args[0] || /* @__PURE__ */ Object.create(null), protocol, onFail);
  5205. }
  5206. const len = protocol.length;
  5207. const argsLen = args.length;
  5208. for (let i = 0; i < len; i++) {
  5209. const opts = protocol[i];
  5210. const data = /* @__PURE__ */ Object.create(null);
  5211. if (argsLen > i) {
  5212. data[opts.name] = args[i];
  5213. }
  5214. validateProtocol(name, data, { [opts.name]: opts }, onFail);
  5215. }
  5216. }
  5217. function validateProp(name, value, prop, isAbsent) {
  5218. if (!isPlainObject(prop)) {
  5219. prop = { type: prop };
  5220. }
  5221. const { type, required, validator } = prop;
  5222. if (required && isAbsent) {
  5223. return 'Missing required args: "' + name + '"';
  5224. }
  5225. if (value == null && !required) {
  5226. return;
  5227. }
  5228. if (type != null) {
  5229. let isValid = false;
  5230. const types = isArray(type) ? type : [type];
  5231. const expectedTypes = [];
  5232. for (let i = 0; i < types.length && !isValid; i++) {
  5233. const { valid, expectedType } = assertType(value, types[i]);
  5234. expectedTypes.push(expectedType || "");
  5235. isValid = valid;
  5236. }
  5237. if (!isValid) {
  5238. return getInvalidTypeMessage(name, value, expectedTypes);
  5239. }
  5240. }
  5241. if (validator) {
  5242. return validator(value);
  5243. }
  5244. }
  5245. const isSimpleType = /* @__PURE__ */ makeMap("String,Number,Boolean,Function,Symbol");
  5246. function assertType(value, type) {
  5247. let valid;
  5248. const expectedType = getType(type);
  5249. if (isSimpleType(expectedType)) {
  5250. const t2 = typeof value;
  5251. valid = t2 === expectedType.toLowerCase();
  5252. if (!valid && t2 === "object") {
  5253. valid = value instanceof type;
  5254. }
  5255. } else if (expectedType === "Object") {
  5256. valid = isObject(value);
  5257. } else if (expectedType === "Array") {
  5258. valid = isArray(value);
  5259. } else {
  5260. {
  5261. valid = value instanceof type;
  5262. }
  5263. }
  5264. return {
  5265. valid,
  5266. expectedType
  5267. };
  5268. }
  5269. function getInvalidTypeMessage(name, value, expectedTypes) {
  5270. let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(capitalize).join(", ")}`;
  5271. const expectedType = expectedTypes[0];
  5272. const receivedType = toRawType(value);
  5273. const expectedValue = styleValue(value, expectedType);
  5274. const receivedValue = styleValue(value, receivedType);
  5275. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  5276. message += ` with value ${expectedValue}`;
  5277. }
  5278. message += `, got ${receivedType} `;
  5279. if (isExplicable(receivedType)) {
  5280. message += `with value ${receivedValue}.`;
  5281. }
  5282. return message;
  5283. }
  5284. function getType(ctor) {
  5285. const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
  5286. return match ? match[1] : "";
  5287. }
  5288. function styleValue(value, type) {
  5289. if (type === "String") {
  5290. return `"${value}"`;
  5291. } else if (type === "Number") {
  5292. return `${Number(value)}`;
  5293. } else {
  5294. return `${value}`;
  5295. }
  5296. }
  5297. function isExplicable(type) {
  5298. const explicitTypes = ["string", "number", "boolean"];
  5299. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  5300. }
  5301. function isBoolean(...args) {
  5302. return args.some((elem) => elem.toLowerCase() === "boolean");
  5303. }
  5304. function tryCatch(fn) {
  5305. return function() {
  5306. try {
  5307. return fn.apply(fn, arguments);
  5308. } catch (e2) {
  5309. console.error(e2);
  5310. }
  5311. };
  5312. }
  5313. let invokeCallbackId = 1;
  5314. const invokeCallbacks = {};
  5315. function addInvokeCallback(id, name, callback, keepAlive = false) {
  5316. invokeCallbacks[id] = {
  5317. name,
  5318. keepAlive,
  5319. callback
  5320. };
  5321. return id;
  5322. }
  5323. function invokeCallback(id, res, extras) {
  5324. if (typeof id === "number") {
  5325. const opts = invokeCallbacks[id];
  5326. if (opts) {
  5327. if (!opts.keepAlive) {
  5328. delete invokeCallbacks[id];
  5329. }
  5330. return opts.callback(res, extras);
  5331. }
  5332. }
  5333. return res;
  5334. }
  5335. const API_SUCCESS = "success";
  5336. const API_FAIL = "fail";
  5337. const API_COMPLETE = "complete";
  5338. function getApiCallbacks(args) {
  5339. const apiCallbacks = {};
  5340. for (const name in args) {
  5341. const fn = args[name];
  5342. if (isFunction(fn)) {
  5343. apiCallbacks[name] = tryCatch(fn);
  5344. delete args[name];
  5345. }
  5346. }
  5347. return apiCallbacks;
  5348. }
  5349. function normalizeErrMsg(errMsg, name) {
  5350. if (!errMsg || errMsg.indexOf(":fail") === -1) {
  5351. return name + ":ok";
  5352. }
  5353. return name + errMsg.substring(errMsg.indexOf(":fail"));
  5354. }
  5355. function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
  5356. if (!isPlainObject(args)) {
  5357. args = {};
  5358. }
  5359. const { success, fail, complete } = getApiCallbacks(args);
  5360. const hasSuccess = isFunction(success);
  5361. const hasFail = isFunction(fail);
  5362. const hasComplete = isFunction(complete);
  5363. const callbackId = invokeCallbackId++;
  5364. addInvokeCallback(callbackId, name, (res) => {
  5365. res = res || {};
  5366. res.errMsg = normalizeErrMsg(res.errMsg, name);
  5367. isFunction(beforeAll) && beforeAll(res);
  5368. if (res.errMsg === name + ":ok") {
  5369. isFunction(beforeSuccess) && beforeSuccess(res, args);
  5370. hasSuccess && success(res);
  5371. } else {
  5372. hasFail && fail(res);
  5373. }
  5374. hasComplete && complete(res);
  5375. });
  5376. return callbackId;
  5377. }
  5378. const HOOK_SUCCESS = "success";
  5379. const HOOK_FAIL = "fail";
  5380. const HOOK_COMPLETE = "complete";
  5381. const globalInterceptors = {};
  5382. const scopedInterceptors = {};
  5383. function wrapperHook(hook, params) {
  5384. return function(data) {
  5385. return hook(data, params) || data;
  5386. };
  5387. }
  5388. function queue(hooks, data, params) {
  5389. let promise = false;
  5390. for (let i = 0; i < hooks.length; i++) {
  5391. const hook = hooks[i];
  5392. if (promise) {
  5393. promise = Promise.resolve(wrapperHook(hook, params));
  5394. } else {
  5395. const res = hook(data, params);
  5396. if (isPromise(res)) {
  5397. promise = Promise.resolve(res);
  5398. }
  5399. if (res === false) {
  5400. return {
  5401. then() {
  5402. },
  5403. catch() {
  5404. }
  5405. };
  5406. }
  5407. }
  5408. }
  5409. return promise || {
  5410. then(callback) {
  5411. return callback(data);
  5412. },
  5413. catch() {
  5414. }
  5415. };
  5416. }
  5417. function wrapperOptions(interceptors2, options = {}) {
  5418. [HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name) => {
  5419. const hooks = interceptors2[name];
  5420. if (!isArray(hooks)) {
  5421. return;
  5422. }
  5423. const oldCallback = options[name];
  5424. options[name] = function callbackInterceptor(res) {
  5425. queue(hooks, res, options).then((res2) => {
  5426. return isFunction(oldCallback) && oldCallback(res2) || res2;
  5427. });
  5428. };
  5429. });
  5430. return options;
  5431. }
  5432. function wrapperReturnValue(method, returnValue) {
  5433. const returnValueHooks = [];
  5434. if (isArray(globalInterceptors.returnValue)) {
  5435. returnValueHooks.push(...globalInterceptors.returnValue);
  5436. }
  5437. const interceptor = scopedInterceptors[method];
  5438. if (interceptor && isArray(interceptor.returnValue)) {
  5439. returnValueHooks.push(...interceptor.returnValue);
  5440. }
  5441. returnValueHooks.forEach((hook) => {
  5442. returnValue = hook(returnValue) || returnValue;
  5443. });
  5444. return returnValue;
  5445. }
  5446. function getApiInterceptorHooks(method) {
  5447. const interceptor = /* @__PURE__ */ Object.create(null);
  5448. Object.keys(globalInterceptors).forEach((hook) => {
  5449. if (hook !== "returnValue") {
  5450. interceptor[hook] = globalInterceptors[hook].slice();
  5451. }
  5452. });
  5453. const scopedInterceptor = scopedInterceptors[method];
  5454. if (scopedInterceptor) {
  5455. Object.keys(scopedInterceptor).forEach((hook) => {
  5456. if (hook !== "returnValue") {
  5457. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  5458. }
  5459. });
  5460. }
  5461. return interceptor;
  5462. }
  5463. function invokeApi(method, api, options, params) {
  5464. const interceptor = getApiInterceptorHooks(method);
  5465. if (interceptor && Object.keys(interceptor).length) {
  5466. if (isArray(interceptor.invoke)) {
  5467. const res = queue(interceptor.invoke, options);
  5468. return res.then((options2) => {
  5469. return api(wrapperOptions(getApiInterceptorHooks(method), options2), ...params);
  5470. });
  5471. } else {
  5472. return api(wrapperOptions(interceptor, options), ...params);
  5473. }
  5474. }
  5475. return api(options, ...params);
  5476. }
  5477. function hasCallback(args) {
  5478. if (isPlainObject(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
  5479. return true;
  5480. }
  5481. return false;
  5482. }
  5483. function handlePromise(promise) {
  5484. return promise;
  5485. }
  5486. function promisify$1(name, fn) {
  5487. return (args = {}, ...rest) => {
  5488. if (hasCallback(args)) {
  5489. return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
  5490. }
  5491. return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => {
  5492. invokeApi(name, fn, extend(args, { success: resolve2, fail: reject }), rest);
  5493. })));
  5494. };
  5495. }
  5496. function formatApiArgs(args, options) {
  5497. args[0];
  5498. {
  5499. return;
  5500. }
  5501. }
  5502. function invokeSuccess(id, name, res) {
  5503. const result = {
  5504. errMsg: name + ":ok"
  5505. };
  5506. return invokeCallback(id, extend(res || {}, result));
  5507. }
  5508. function invokeFail(id, name, errMsg, errRes = {}) {
  5509. const errMsgPrefix = name + ":fail";
  5510. let apiErrMsg = "";
  5511. if (!errMsg) {
  5512. apiErrMsg = errMsgPrefix;
  5513. } else if (errMsg.indexOf(errMsgPrefix) === 0) {
  5514. apiErrMsg = errMsg;
  5515. } else {
  5516. apiErrMsg = errMsgPrefix + " " + errMsg;
  5517. }
  5518. {
  5519. delete errRes.errCode;
  5520. }
  5521. let res = extend({ errMsg: apiErrMsg }, errRes);
  5522. return invokeCallback(id, res);
  5523. }
  5524. function beforeInvokeApi(name, args, protocol, options) {
  5525. {
  5526. validateProtocols(name, args, protocol);
  5527. }
  5528. const errMsg = formatApiArgs(args);
  5529. if (errMsg) {
  5530. return errMsg;
  5531. }
  5532. }
  5533. function parseErrMsg(errMsg) {
  5534. if (!errMsg || isString(errMsg)) {
  5535. return errMsg;
  5536. }
  5537. if (errMsg.stack) {
  5538. if (typeof globalThis === "undefined" || !globalThis.harmonyChannel) {
  5539. console.error(errMsg.message + "\n" + errMsg.stack);
  5540. }
  5541. return errMsg.message;
  5542. }
  5543. return errMsg;
  5544. }
  5545. function wrapperTaskApi(name, fn, protocol, options) {
  5546. return (args) => {
  5547. const id = createAsyncApiCallback(name, args, options);
  5548. const errMsg = beforeInvokeApi(name, [args], protocol);
  5549. if (errMsg) {
  5550. return invokeFail(id, name, errMsg);
  5551. }
  5552. return fn(args, {
  5553. resolve: (res) => invokeSuccess(id, name, res),
  5554. reject: (errMsg2, errRes) => invokeFail(id, name, parseErrMsg(errMsg2), errRes)
  5555. });
  5556. };
  5557. }
  5558. function wrapperSyncApi(name, fn, protocol, options) {
  5559. return (...args) => {
  5560. const errMsg = beforeInvokeApi(name, args, protocol);
  5561. if (errMsg) {
  5562. throw new Error(errMsg);
  5563. }
  5564. return fn.apply(null, args);
  5565. };
  5566. }
  5567. function wrapperAsyncApi(name, fn, protocol, options) {
  5568. return wrapperTaskApi(name, fn, protocol, options);
  5569. }
  5570. function defineSyncApi(name, fn, protocol, options) {
  5571. return wrapperSyncApi(name, fn, protocol);
  5572. }
  5573. function defineAsyncApi(name, fn, protocol, options) {
  5574. return promisify$1(name, wrapperAsyncApi(name, fn, protocol, options));
  5575. }
  5576. const API_UPX2PX = "upx2px";
  5577. const Upx2pxProtocol = [
  5578. {
  5579. name: "upx",
  5580. type: [Number, String],
  5581. required: true
  5582. }
  5583. ];
  5584. const EPS = 1e-4;
  5585. const BASE_DEVICE_WIDTH = 750;
  5586. let isIOS = false;
  5587. let deviceWidth = 0;
  5588. let deviceDPR = 0;
  5589. function checkDeviceWidth() {
  5590. const { windowWidth, pixelRatio, platform } = Object.assign({}, wx.getWindowInfo(), {
  5591. platform: wx.getDeviceInfo().platform
  5592. });
  5593. deviceWidth = windowWidth;
  5594. deviceDPR = pixelRatio;
  5595. isIOS = platform === "ios";
  5596. }
  5597. const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
  5598. if (deviceWidth === 0) {
  5599. checkDeviceWidth();
  5600. }
  5601. number = Number(number);
  5602. if (number === 0) {
  5603. return 0;
  5604. }
  5605. let width = newDeviceWidth || deviceWidth;
  5606. let result = number / BASE_DEVICE_WIDTH * width;
  5607. if (result < 0) {
  5608. result = -result;
  5609. }
  5610. result = Math.floor(result + EPS);
  5611. if (result === 0) {
  5612. if (deviceDPR === 1 || !isIOS) {
  5613. result = 1;
  5614. } else {
  5615. result = 0.5;
  5616. }
  5617. }
  5618. return number < 0 ? -result : result;
  5619. }, Upx2pxProtocol);
  5620. function __f__(type, filename, ...args) {
  5621. if (filename) {
  5622. args.push(filename);
  5623. }
  5624. console[type].apply(console, args);
  5625. }
  5626. const API_ADD_INTERCEPTOR = "addInterceptor";
  5627. const API_REMOVE_INTERCEPTOR = "removeInterceptor";
  5628. const AddInterceptorProtocol = [
  5629. {
  5630. name: "method",
  5631. type: [String, Object],
  5632. required: true
  5633. }
  5634. ];
  5635. const RemoveInterceptorProtocol = AddInterceptorProtocol;
  5636. function mergeInterceptorHook(interceptors2, interceptor) {
  5637. Object.keys(interceptor).forEach((hook) => {
  5638. if (isFunction(interceptor[hook])) {
  5639. interceptors2[hook] = mergeHook(interceptors2[hook], interceptor[hook]);
  5640. }
  5641. });
  5642. }
  5643. function removeInterceptorHook(interceptors2, interceptor) {
  5644. if (!interceptors2 || !interceptor) {
  5645. return;
  5646. }
  5647. Object.keys(interceptor).forEach((name) => {
  5648. const hooks = interceptors2[name];
  5649. const hook = interceptor[name];
  5650. if (isArray(hooks) && isFunction(hook)) {
  5651. remove(hooks, hook);
  5652. }
  5653. });
  5654. }
  5655. function mergeHook(parentVal, childVal) {
  5656. const res = childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
  5657. return res ? dedupeHooks(res) : res;
  5658. }
  5659. function dedupeHooks(hooks) {
  5660. const res = [];
  5661. for (let i = 0; i < hooks.length; i++) {
  5662. if (res.indexOf(hooks[i]) === -1) {
  5663. res.push(hooks[i]);
  5664. }
  5665. }
  5666. return res;
  5667. }
  5668. const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor) => {
  5669. if (isString(method) && isPlainObject(interceptor)) {
  5670. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor);
  5671. } else if (isPlainObject(method)) {
  5672. mergeInterceptorHook(globalInterceptors, method);
  5673. }
  5674. }, AddInterceptorProtocol);
  5675. const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interceptor) => {
  5676. if (isString(method)) {
  5677. if (isPlainObject(interceptor)) {
  5678. removeInterceptorHook(scopedInterceptors[method], interceptor);
  5679. } else {
  5680. delete scopedInterceptors[method];
  5681. }
  5682. } else if (isPlainObject(method)) {
  5683. removeInterceptorHook(globalInterceptors, method);
  5684. }
  5685. }, RemoveInterceptorProtocol);
  5686. const interceptors = {};
  5687. const API_ON = "$on";
  5688. const OnProtocol = [
  5689. {
  5690. name: "event",
  5691. type: String,
  5692. required: true
  5693. },
  5694. {
  5695. name: "callback",
  5696. type: Function,
  5697. required: true
  5698. }
  5699. ];
  5700. const API_ONCE = "$once";
  5701. const OnceProtocol = OnProtocol;
  5702. const API_OFF = "$off";
  5703. const OffProtocol = [
  5704. {
  5705. name: "event",
  5706. type: [String, Array]
  5707. },
  5708. {
  5709. name: "callback",
  5710. type: [Function, Number]
  5711. }
  5712. ];
  5713. const API_EMIT = "$emit";
  5714. const EmitProtocol = [
  5715. {
  5716. name: "event",
  5717. type: String,
  5718. required: true
  5719. }
  5720. ];
  5721. class EventBus {
  5722. constructor() {
  5723. this.$emitter = new E$1();
  5724. }
  5725. on(name, callback) {
  5726. return this.$emitter.on(name, callback);
  5727. }
  5728. once(name, callback) {
  5729. return this.$emitter.once(name, callback);
  5730. }
  5731. off(name, callback) {
  5732. if (!name) {
  5733. this.$emitter.e = {};
  5734. return;
  5735. }
  5736. this.$emitter.off(name, callback);
  5737. }
  5738. emit(name, ...args) {
  5739. this.$emitter.emit(name, ...args);
  5740. }
  5741. }
  5742. const eventBus = new EventBus();
  5743. const $on = defineSyncApi(API_ON, (name, callback) => {
  5744. eventBus.on(name, callback);
  5745. return () => eventBus.off(name, callback);
  5746. }, OnProtocol);
  5747. const $once = defineSyncApi(API_ONCE, (name, callback) => {
  5748. eventBus.once(name, callback);
  5749. return () => eventBus.off(name, callback);
  5750. }, OnceProtocol);
  5751. const $off = defineSyncApi(API_OFF, (name, callback) => {
  5752. if (!isArray(name))
  5753. name = name ? [name] : [];
  5754. name.forEach((n2) => {
  5755. eventBus.off(n2, callback);
  5756. });
  5757. }, OffProtocol);
  5758. const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
  5759. eventBus.emit(name, ...args);
  5760. }, EmitProtocol);
  5761. let cid;
  5762. let cidErrMsg;
  5763. let enabled;
  5764. function normalizePushMessage(message) {
  5765. try {
  5766. return JSON.parse(message);
  5767. } catch (e2) {
  5768. }
  5769. return message;
  5770. }
  5771. function invokePushCallback(args) {
  5772. if (args.type === "enabled") {
  5773. enabled = true;
  5774. } else if (args.type === "clientId") {
  5775. cid = args.cid;
  5776. cidErrMsg = args.errMsg;
  5777. invokeGetPushCidCallbacks(cid, args.errMsg);
  5778. } else if (args.type === "pushMsg") {
  5779. const message = {
  5780. type: "receive",
  5781. data: normalizePushMessage(args.message)
  5782. };
  5783. for (let i = 0; i < onPushMessageCallbacks.length; i++) {
  5784. const callback = onPushMessageCallbacks[i];
  5785. callback(message);
  5786. if (message.stopped) {
  5787. break;
  5788. }
  5789. }
  5790. } else if (args.type === "click") {
  5791. onPushMessageCallbacks.forEach((callback) => {
  5792. callback({
  5793. type: "click",
  5794. data: normalizePushMessage(args.message)
  5795. });
  5796. });
  5797. }
  5798. }
  5799. const getPushCidCallbacks = [];
  5800. function invokeGetPushCidCallbacks(cid2, errMsg) {
  5801. getPushCidCallbacks.forEach((callback) => {
  5802. callback(cid2, errMsg);
  5803. });
  5804. getPushCidCallbacks.length = 0;
  5805. }
  5806. const API_GET_PUSH_CLIENT_ID = "getPushClientId";
  5807. const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve: resolve2, reject }) => {
  5808. Promise.resolve().then(() => {
  5809. if (typeof enabled === "undefined") {
  5810. enabled = false;
  5811. cid = "";
  5812. cidErrMsg = "uniPush is not enabled";
  5813. }
  5814. getPushCidCallbacks.push((cid2, errMsg) => {
  5815. if (cid2) {
  5816. resolve2({ cid: cid2 });
  5817. } else {
  5818. reject(errMsg);
  5819. }
  5820. });
  5821. if (typeof cid !== "undefined") {
  5822. invokeGetPushCidCallbacks(cid, cidErrMsg);
  5823. }
  5824. });
  5825. });
  5826. const onPushMessageCallbacks = [];
  5827. const onPushMessage = (fn) => {
  5828. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  5829. onPushMessageCallbacks.push(fn);
  5830. }
  5831. };
  5832. const offPushMessage = (fn) => {
  5833. if (!fn) {
  5834. onPushMessageCallbacks.length = 0;
  5835. } else {
  5836. const index2 = onPushMessageCallbacks.indexOf(fn);
  5837. if (index2 > -1) {
  5838. onPushMessageCallbacks.splice(index2, 1);
  5839. }
  5840. }
  5841. };
  5842. const SYNC_API_RE = /^\$|__f__|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|rpx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/;
  5843. const CONTEXT_API_RE = /^create|Manager$/;
  5844. const CONTEXT_API_RE_EXC = ["createBLEConnection"];
  5845. const TASK_APIS = ["request", "downloadFile", "uploadFile", "connectSocket"];
  5846. const ASYNC_API = ["createBLEConnection"];
  5847. const CALLBACK_API_RE = /^on|^off/;
  5848. function isContextApi(name) {
  5849. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  5850. }
  5851. function isSyncApi(name) {
  5852. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  5853. }
  5854. function isCallbackApi(name) {
  5855. return CALLBACK_API_RE.test(name) && name !== "onPush";
  5856. }
  5857. function isTaskApi(name) {
  5858. return TASK_APIS.indexOf(name) !== -1;
  5859. }
  5860. function shouldPromise(name) {
  5861. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  5862. return false;
  5863. }
  5864. return true;
  5865. }
  5866. if (!Promise.prototype.finally) {
  5867. Promise.prototype.finally = function(onfinally) {
  5868. const promise = this.constructor;
  5869. return this.then((value) => promise.resolve(onfinally && onfinally()).then(() => value), (reason) => promise.resolve(onfinally && onfinally()).then(() => {
  5870. throw reason;
  5871. }));
  5872. };
  5873. }
  5874. function promisify(name, api) {
  5875. if (!shouldPromise(name)) {
  5876. return api;
  5877. }
  5878. if (!isFunction(api)) {
  5879. return api;
  5880. }
  5881. return function promiseApi(options = {}, ...rest) {
  5882. if (isFunction(options.success) || isFunction(options.fail) || isFunction(options.complete)) {
  5883. return wrapperReturnValue(name, invokeApi(name, api, options, rest));
  5884. }
  5885. return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => {
  5886. invokeApi(name, api, extend({}, options, {
  5887. success: resolve2,
  5888. fail: reject
  5889. }), rest);
  5890. })));
  5891. };
  5892. }
  5893. const CALLBACKS = ["success", "fail", "cancel", "complete"];
  5894. function initWrapper(protocols2) {
  5895. function processCallback(methodName, method, returnValue) {
  5896. return function(res) {
  5897. return method(processReturnValue(methodName, res, returnValue));
  5898. };
  5899. }
  5900. function processArgs(methodName, fromArgs, argsOption = {}, returnValue = {}, keepFromArgs = false) {
  5901. if (isPlainObject(fromArgs)) {
  5902. const toArgs = keepFromArgs === true ? fromArgs : {};
  5903. if (isFunction(argsOption)) {
  5904. argsOption = argsOption(fromArgs, toArgs) || {};
  5905. }
  5906. for (const key in fromArgs) {
  5907. if (hasOwn(argsOption, key)) {
  5908. let keyOption = argsOption[key];
  5909. if (isFunction(keyOption)) {
  5910. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  5911. }
  5912. if (!keyOption) {
  5913. console.warn(`微信小程序 ${methodName} 暂不支持 ${key}`);
  5914. } else if (isString(keyOption)) {
  5915. toArgs[keyOption] = fromArgs[key];
  5916. } else if (isPlainObject(keyOption)) {
  5917. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  5918. }
  5919. } else if (CALLBACKS.indexOf(key) !== -1) {
  5920. const callback = fromArgs[key];
  5921. if (isFunction(callback)) {
  5922. toArgs[key] = processCallback(methodName, callback, returnValue);
  5923. }
  5924. } else {
  5925. if (!keepFromArgs && !hasOwn(toArgs, key)) {
  5926. toArgs[key] = fromArgs[key];
  5927. }
  5928. }
  5929. }
  5930. return toArgs;
  5931. } else if (isFunction(fromArgs)) {
  5932. if (isFunction(argsOption)) {
  5933. argsOption(fromArgs, {});
  5934. }
  5935. fromArgs = processCallback(methodName, fromArgs, returnValue);
  5936. }
  5937. return fromArgs;
  5938. }
  5939. function processReturnValue(methodName, res, returnValue, keepReturnValue = false) {
  5940. if (isFunction(protocols2.returnValue)) {
  5941. res = protocols2.returnValue(methodName, res);
  5942. }
  5943. const realKeepReturnValue = keepReturnValue || false;
  5944. return processArgs(methodName, res, returnValue, {}, realKeepReturnValue);
  5945. }
  5946. return function wrapper(methodName, method) {
  5947. const hasProtocol = hasOwn(protocols2, methodName);
  5948. if (!hasProtocol && typeof wx[methodName] !== "function") {
  5949. return method;
  5950. }
  5951. const needWrapper = hasProtocol || isFunction(protocols2.returnValue) || isContextApi(methodName) || isTaskApi(methodName);
  5952. const hasMethod = hasProtocol || isFunction(method);
  5953. if (!hasProtocol && !method) {
  5954. return function() {
  5955. console.error(`微信小程序 暂不支持${methodName}`);
  5956. };
  5957. }
  5958. if (!needWrapper || !hasMethod) {
  5959. return method;
  5960. }
  5961. const protocol = protocols2[methodName];
  5962. return function(arg1, arg2) {
  5963. let options = protocol || {};
  5964. if (isFunction(protocol)) {
  5965. options = protocol(arg1);
  5966. }
  5967. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  5968. const args = [arg1];
  5969. if (typeof arg2 !== "undefined") {
  5970. args.push(arg2);
  5971. }
  5972. const returnValue = wx[options.name || methodName].apply(wx, args);
  5973. if (isContextApi(methodName) || isTaskApi(methodName)) {
  5974. if (returnValue && !returnValue.__v_skip) {
  5975. returnValue.__v_skip = true;
  5976. }
  5977. }
  5978. if (isSyncApi(methodName)) {
  5979. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  5980. }
  5981. return returnValue;
  5982. };
  5983. };
  5984. }
  5985. const getLocale = () => {
  5986. const app = isFunction(getApp) && getApp({ allowDefault: true });
  5987. if (app && app.$vm) {
  5988. return app.$vm.$locale;
  5989. }
  5990. return getLocaleLanguage$1();
  5991. };
  5992. const setLocale = (locale) => {
  5993. const app = isFunction(getApp) && getApp();
  5994. if (!app) {
  5995. return false;
  5996. }
  5997. const oldLocale = app.$vm.$locale;
  5998. if (oldLocale !== locale) {
  5999. app.$vm.$locale = locale;
  6000. onLocaleChangeCallbacks.forEach((fn) => fn({ locale }));
  6001. return true;
  6002. }
  6003. return false;
  6004. };
  6005. const onLocaleChangeCallbacks = [];
  6006. const onLocaleChange = (fn) => {
  6007. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  6008. onLocaleChangeCallbacks.push(fn);
  6009. }
  6010. };
  6011. if (typeof global !== "undefined") {
  6012. global.getLocale = getLocale;
  6013. }
  6014. const UUID_KEY = "__DC_STAT_UUID";
  6015. let deviceId;
  6016. function useDeviceId(global2 = wx) {
  6017. return function addDeviceId(_, toRes) {
  6018. deviceId = deviceId || global2.getStorageSync(UUID_KEY);
  6019. if (!deviceId) {
  6020. deviceId = Date.now() + "" + Math.floor(Math.random() * 1e7);
  6021. wx.setStorage({
  6022. key: UUID_KEY,
  6023. data: deviceId
  6024. });
  6025. }
  6026. toRes.deviceId = deviceId;
  6027. };
  6028. }
  6029. function addSafeAreaInsets(fromRes, toRes) {
  6030. if (fromRes.safeArea) {
  6031. const safeArea = fromRes.safeArea;
  6032. toRes.safeAreaInsets = {
  6033. top: safeArea.top,
  6034. left: safeArea.left,
  6035. right: fromRes.windowWidth - safeArea.right,
  6036. bottom: fromRes.screenHeight - safeArea.bottom
  6037. };
  6038. }
  6039. }
  6040. function getOSInfo(system, platform) {
  6041. let osName = "";
  6042. let osVersion = "";
  6043. if (platform && false) {
  6044. osName = platform;
  6045. osVersion = system;
  6046. } else {
  6047. osName = system.split(" ")[0] || "";
  6048. osVersion = system.split(" ")[1] || "";
  6049. }
  6050. return {
  6051. osName: osName.toLocaleLowerCase(),
  6052. osVersion
  6053. };
  6054. }
  6055. function populateParameters(fromRes, toRes) {
  6056. const { brand = "", model = "", system = "", language = "", theme, version: version2, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation } = fromRes;
  6057. const { osName, osVersion } = getOSInfo(system, platform);
  6058. let hostVersion = version2;
  6059. let deviceType = getGetDeviceType(fromRes, model);
  6060. let deviceBrand = getDeviceBrand(brand);
  6061. let _hostName = getHostName(fromRes);
  6062. let _deviceOrientation = deviceOrientation;
  6063. let _devicePixelRatio = pixelRatio;
  6064. let _SDKVersion = SDKVersion;
  6065. const hostLanguage = (language || "").replace(/_/g, "-");
  6066. const parameters = {
  6067. appId: "",
  6068. appName: "small_goose_vue",
  6069. appVersion: "1.0.0",
  6070. appVersionCode: "100",
  6071. appLanguage: getAppLanguage(hostLanguage),
  6072. uniCompileVersion: "4.55",
  6073. uniCompilerVersion: "4.55",
  6074. uniRuntimeVersion: "4.55",
  6075. uniPlatform: "mp-weixin",
  6076. deviceBrand,
  6077. deviceModel: model,
  6078. deviceType,
  6079. devicePixelRatio: _devicePixelRatio,
  6080. deviceOrientation: _deviceOrientation,
  6081. osName,
  6082. osVersion,
  6083. hostTheme: theme,
  6084. hostVersion,
  6085. hostLanguage,
  6086. hostName: _hostName,
  6087. hostSDKVersion: _SDKVersion,
  6088. hostFontSizeSetting: fontSizeSetting,
  6089. windowTop: 0,
  6090. windowBottom: 0,
  6091. // TODO
  6092. osLanguage: void 0,
  6093. osTheme: void 0,
  6094. ua: void 0,
  6095. hostPackageName: void 0,
  6096. browserName: void 0,
  6097. browserVersion: void 0,
  6098. isUniAppX: false
  6099. };
  6100. extend(toRes, parameters);
  6101. }
  6102. function getGetDeviceType(fromRes, model) {
  6103. let deviceType = fromRes.deviceType || "phone";
  6104. {
  6105. const deviceTypeMaps = {
  6106. ipad: "pad",
  6107. windows: "pc",
  6108. mac: "pc"
  6109. };
  6110. const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  6111. const _model = model.toLocaleLowerCase();
  6112. for (let index2 = 0; index2 < deviceTypeMapsKeys.length; index2++) {
  6113. const _m = deviceTypeMapsKeys[index2];
  6114. if (_model.indexOf(_m) !== -1) {
  6115. deviceType = deviceTypeMaps[_m];
  6116. break;
  6117. }
  6118. }
  6119. }
  6120. return deviceType;
  6121. }
  6122. function getDeviceBrand(brand) {
  6123. let deviceBrand = brand;
  6124. if (deviceBrand) {
  6125. deviceBrand = deviceBrand.toLocaleLowerCase();
  6126. }
  6127. return deviceBrand;
  6128. }
  6129. function getAppLanguage(defaultLanguage) {
  6130. return getLocale ? getLocale() : defaultLanguage;
  6131. }
  6132. function getHostName(fromRes) {
  6133. const _platform = "WeChat";
  6134. let _hostName = fromRes.hostName || _platform;
  6135. {
  6136. if (fromRes.environment) {
  6137. _hostName = fromRes.environment;
  6138. } else if (fromRes.host && fromRes.host.env) {
  6139. _hostName = fromRes.host.env;
  6140. }
  6141. }
  6142. return _hostName;
  6143. }
  6144. const getSystemInfo = {
  6145. returnValue: (fromRes, toRes) => {
  6146. addSafeAreaInsets(fromRes, toRes);
  6147. useDeviceId()(fromRes, toRes);
  6148. populateParameters(fromRes, toRes);
  6149. }
  6150. };
  6151. const getSystemInfoSync = getSystemInfo;
  6152. const redirectTo = {};
  6153. const previewImage = {
  6154. args(fromArgs, toArgs) {
  6155. let currentIndex = parseInt(fromArgs.current);
  6156. if (isNaN(currentIndex)) {
  6157. return;
  6158. }
  6159. const urls = fromArgs.urls;
  6160. if (!isArray(urls)) {
  6161. return;
  6162. }
  6163. const len = urls.length;
  6164. if (!len) {
  6165. return;
  6166. }
  6167. if (currentIndex < 0) {
  6168. currentIndex = 0;
  6169. } else if (currentIndex >= len) {
  6170. currentIndex = len - 1;
  6171. }
  6172. if (currentIndex > 0) {
  6173. toArgs.current = urls[currentIndex];
  6174. toArgs.urls = urls.filter((item, index2) => index2 < currentIndex ? item !== urls[currentIndex] : true);
  6175. } else {
  6176. toArgs.current = urls[0];
  6177. }
  6178. return {
  6179. indicator: false,
  6180. loop: false
  6181. };
  6182. }
  6183. };
  6184. const showActionSheet = {
  6185. args(fromArgs, toArgs) {
  6186. toArgs.alertText = fromArgs.title;
  6187. }
  6188. };
  6189. const getDeviceInfo = {
  6190. returnValue: (fromRes, toRes) => {
  6191. const { brand, model, system = "", platform = "" } = fromRes;
  6192. let deviceType = getGetDeviceType(fromRes, model);
  6193. let deviceBrand = getDeviceBrand(brand);
  6194. useDeviceId()(fromRes, toRes);
  6195. const { osName, osVersion } = getOSInfo(system, platform);
  6196. toRes = sortObject(extend(toRes, {
  6197. deviceType,
  6198. deviceBrand,
  6199. deviceModel: model,
  6200. osName,
  6201. osVersion
  6202. }));
  6203. }
  6204. };
  6205. const getAppBaseInfo = {
  6206. returnValue: (fromRes, toRes) => {
  6207. const { version: version2, language, SDKVersion, theme } = fromRes;
  6208. let _hostName = getHostName(fromRes);
  6209. let hostLanguage = (language || "").replace(/_/g, "-");
  6210. const parameters = {
  6211. hostVersion: version2,
  6212. hostLanguage,
  6213. hostName: _hostName,
  6214. hostSDKVersion: SDKVersion,
  6215. hostTheme: theme,
  6216. appId: "",
  6217. appName: "small_goose_vue",
  6218. appVersion: "1.0.0",
  6219. appVersionCode: "100",
  6220. appLanguage: getAppLanguage(hostLanguage),
  6221. isUniAppX: false,
  6222. uniPlatform: "mp-weixin",
  6223. uniCompileVersion: "4.55",
  6224. uniCompilerVersion: "4.55",
  6225. uniRuntimeVersion: "4.55"
  6226. };
  6227. extend(toRes, parameters);
  6228. }
  6229. };
  6230. const getWindowInfo = {
  6231. returnValue: (fromRes, toRes) => {
  6232. addSafeAreaInsets(fromRes, toRes);
  6233. toRes = sortObject(extend(toRes, {
  6234. windowTop: 0,
  6235. windowBottom: 0
  6236. }));
  6237. }
  6238. };
  6239. const getAppAuthorizeSetting = {
  6240. returnValue: function(fromRes, toRes) {
  6241. const { locationReducedAccuracy } = fromRes;
  6242. toRes.locationAccuracy = "unsupported";
  6243. if (locationReducedAccuracy === true) {
  6244. toRes.locationAccuracy = "reduced";
  6245. } else if (locationReducedAccuracy === false) {
  6246. toRes.locationAccuracy = "full";
  6247. }
  6248. }
  6249. };
  6250. const onError = {
  6251. args(fromArgs) {
  6252. const app = getApp({ allowDefault: true }) || {};
  6253. if (!app.$vm) {
  6254. if (!wx.$onErrorHandlers) {
  6255. wx.$onErrorHandlers = [];
  6256. }
  6257. wx.$onErrorHandlers.push(fromArgs);
  6258. } else {
  6259. injectHook(ON_ERROR, fromArgs, app.$vm.$);
  6260. }
  6261. }
  6262. };
  6263. const offError = {
  6264. args(fromArgs) {
  6265. const app = getApp({ allowDefault: true }) || {};
  6266. if (!app.$vm) {
  6267. if (!wx.$onErrorHandlers) {
  6268. return;
  6269. }
  6270. const index2 = wx.$onErrorHandlers.findIndex((fn) => fn === fromArgs);
  6271. if (index2 !== -1) {
  6272. wx.$onErrorHandlers.splice(index2, 1);
  6273. }
  6274. } else if (fromArgs.__weh) {
  6275. const onErrors = app.$vm.$[ON_ERROR];
  6276. if (onErrors) {
  6277. const index2 = onErrors.indexOf(fromArgs.__weh);
  6278. if (index2 > -1) {
  6279. onErrors.splice(index2, 1);
  6280. }
  6281. }
  6282. }
  6283. }
  6284. };
  6285. const onSocketOpen = {
  6286. args() {
  6287. if (wx.__uni_console__) {
  6288. if (wx.__uni_console_warned__) {
  6289. return;
  6290. }
  6291. wx.__uni_console_warned__ = true;
  6292. console.warn(`开发模式下小程序日志回显会使用 socket 连接,为了避免冲突,建议使用 SocketTask 的方式去管理 WebSocket 或手动关闭日志回显功能。[详情](https://uniapp.dcloud.net.cn/tutorial/run/mp-log.html)`);
  6293. }
  6294. }
  6295. };
  6296. const onSocketMessage = onSocketOpen;
  6297. const baseApis = {
  6298. $on,
  6299. $off,
  6300. $once,
  6301. $emit,
  6302. upx2px,
  6303. rpx2px: upx2px,
  6304. interceptors,
  6305. addInterceptor,
  6306. removeInterceptor,
  6307. onCreateVueApp,
  6308. invokeCreateVueAppHook,
  6309. getLocale,
  6310. setLocale,
  6311. onLocaleChange,
  6312. getPushClientId,
  6313. onPushMessage,
  6314. offPushMessage,
  6315. invokePushCallback,
  6316. __f__
  6317. };
  6318. function initUni(api, protocols2, platform = wx) {
  6319. const wrapper = initWrapper(protocols2);
  6320. const UniProxyHandlers = {
  6321. get(target, key) {
  6322. if (hasOwn(target, key)) {
  6323. return target[key];
  6324. }
  6325. if (hasOwn(api, key)) {
  6326. return promisify(key, api[key]);
  6327. }
  6328. if (hasOwn(baseApis, key)) {
  6329. return promisify(key, baseApis[key]);
  6330. }
  6331. return promisify(key, wrapper(key, platform[key]));
  6332. }
  6333. };
  6334. return new Proxy({}, UniProxyHandlers);
  6335. }
  6336. function initGetProvider(providers) {
  6337. return function getProvider2({ service, success, fail, complete }) {
  6338. let res;
  6339. if (providers[service]) {
  6340. res = {
  6341. errMsg: "getProvider:ok",
  6342. service,
  6343. provider: providers[service]
  6344. };
  6345. isFunction(success) && success(res);
  6346. } else {
  6347. res = {
  6348. errMsg: "getProvider:fail:服务[" + service + "]不存在"
  6349. };
  6350. isFunction(fail) && fail(res);
  6351. }
  6352. isFunction(complete) && complete(res);
  6353. };
  6354. }
  6355. const objectKeys = [
  6356. "qy",
  6357. "env",
  6358. "error",
  6359. "version",
  6360. "lanDebug",
  6361. "cloud",
  6362. "serviceMarket",
  6363. "router",
  6364. "worklet",
  6365. "__webpack_require_UNI_MP_PLUGIN__"
  6366. ];
  6367. const singlePageDisableKey = ["lanDebug", "router", "worklet"];
  6368. const launchOption = wx.getLaunchOptionsSync ? wx.getLaunchOptionsSync() : null;
  6369. function isWxKey(key) {
  6370. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  6371. return false;
  6372. }
  6373. return objectKeys.indexOf(key) > -1 || typeof wx[key] === "function";
  6374. }
  6375. function initWx() {
  6376. const newWx = {};
  6377. for (const key in wx) {
  6378. if (isWxKey(key)) {
  6379. newWx[key] = wx[key];
  6380. }
  6381. }
  6382. if (typeof globalThis !== "undefined" && typeof requireMiniProgram === "undefined") {
  6383. globalThis.wx = newWx;
  6384. }
  6385. return newWx;
  6386. }
  6387. const mocks$1 = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];
  6388. const getProvider = initGetProvider({
  6389. oauth: ["weixin"],
  6390. share: ["weixin"],
  6391. payment: ["wxpay"],
  6392. push: ["weixin"]
  6393. });
  6394. function initComponentMocks(component) {
  6395. const res = /* @__PURE__ */ Object.create(null);
  6396. mocks$1.forEach((name) => {
  6397. res[name] = component[name];
  6398. });
  6399. return res;
  6400. }
  6401. function createSelectorQuery() {
  6402. const query = wx$2.createSelectorQuery();
  6403. const oldIn = query.in;
  6404. query.in = function newIn(component) {
  6405. if (component.$scope) {
  6406. return oldIn.call(this, component.$scope);
  6407. }
  6408. return oldIn.call(this, initComponentMocks(component));
  6409. };
  6410. return query;
  6411. }
  6412. const wx$2 = initWx();
  6413. if (!wx$2.canIUse("getAppBaseInfo")) {
  6414. wx$2.getAppBaseInfo = wx$2.getSystemInfoSync;
  6415. }
  6416. if (!wx$2.canIUse("getWindowInfo")) {
  6417. wx$2.getWindowInfo = wx$2.getSystemInfoSync;
  6418. }
  6419. if (!wx$2.canIUse("getDeviceInfo")) {
  6420. wx$2.getDeviceInfo = wx$2.getSystemInfoSync;
  6421. }
  6422. let baseInfo = wx$2.getAppBaseInfo && wx$2.getAppBaseInfo();
  6423. if (!baseInfo) {
  6424. baseInfo = wx$2.getSystemInfoSync();
  6425. }
  6426. const host = baseInfo ? baseInfo.host : null;
  6427. const shareVideoMessage = host && host.env === "SAAASDK" ? wx$2.miniapp.shareVideoMessage : wx$2.shareVideoMessage;
  6428. var shims = /* @__PURE__ */ Object.freeze({
  6429. __proto__: null,
  6430. createSelectorQuery,
  6431. getProvider,
  6432. shareVideoMessage
  6433. });
  6434. const compressImage = {
  6435. args(fromArgs, toArgs) {
  6436. if (fromArgs.compressedHeight && !toArgs.compressHeight) {
  6437. toArgs.compressHeight = fromArgs.compressedHeight;
  6438. }
  6439. if (fromArgs.compressedWidth && !toArgs.compressWidth) {
  6440. toArgs.compressWidth = fromArgs.compressedWidth;
  6441. }
  6442. }
  6443. };
  6444. var protocols = /* @__PURE__ */ Object.freeze({
  6445. __proto__: null,
  6446. compressImage,
  6447. getAppAuthorizeSetting,
  6448. getAppBaseInfo,
  6449. getDeviceInfo,
  6450. getSystemInfo,
  6451. getSystemInfoSync,
  6452. getWindowInfo,
  6453. offError,
  6454. onError,
  6455. onSocketMessage,
  6456. onSocketOpen,
  6457. previewImage,
  6458. redirectTo,
  6459. showActionSheet
  6460. });
  6461. const wx$1 = initWx();
  6462. var index = initUni(shims, protocols, wx$1);
  6463. function initRuntimeSocket(hosts, port, id) {
  6464. if (hosts == "" || port == "" || id == "")
  6465. return Promise.resolve(null);
  6466. return hosts.split(",").reduce((promise, host2) => {
  6467. return promise.then((socket) => {
  6468. if (socket != null)
  6469. return Promise.resolve(socket);
  6470. return tryConnectSocket(host2, port, id);
  6471. });
  6472. }, Promise.resolve(null));
  6473. }
  6474. const SOCKET_TIMEOUT = 500;
  6475. function tryConnectSocket(host2, port, id) {
  6476. return new Promise((resolve2, reject) => {
  6477. const socket = index.connectSocket({
  6478. url: `ws://${host2}:${port}/${id}`,
  6479. multiple: true,
  6480. // 支付宝小程序 是否开启多实例
  6481. fail() {
  6482. resolve2(null);
  6483. }
  6484. });
  6485. const timer = setTimeout(() => {
  6486. socket.close({
  6487. code: 1006,
  6488. reason: "connect timeout"
  6489. });
  6490. resolve2(null);
  6491. }, SOCKET_TIMEOUT);
  6492. socket.onOpen((e2) => {
  6493. clearTimeout(timer);
  6494. resolve2(socket);
  6495. });
  6496. socket.onClose((e2) => {
  6497. clearTimeout(timer);
  6498. resolve2(null);
  6499. });
  6500. socket.onError((e2) => {
  6501. clearTimeout(timer);
  6502. resolve2(null);
  6503. });
  6504. });
  6505. }
  6506. function formatMessage(type, args) {
  6507. try {
  6508. return {
  6509. type,
  6510. args: formatArgs(args)
  6511. };
  6512. } catch (e2) {
  6513. }
  6514. return {
  6515. type,
  6516. args: []
  6517. };
  6518. }
  6519. function formatArgs(args) {
  6520. return args.map((arg) => formatArg(arg));
  6521. }
  6522. function formatArg(arg, depth = 0) {
  6523. if (depth >= 7) {
  6524. return {
  6525. type: "object",
  6526. value: "[Maximum depth reached]"
  6527. };
  6528. }
  6529. const type = typeof arg;
  6530. switch (type) {
  6531. case "string":
  6532. return formatString(arg);
  6533. case "number":
  6534. return formatNumber(arg);
  6535. case "boolean":
  6536. return formatBoolean(arg);
  6537. case "object":
  6538. return formatObject(arg, depth);
  6539. case "undefined":
  6540. return formatUndefined();
  6541. case "function":
  6542. return formatFunction(arg);
  6543. case "symbol": {
  6544. return formatSymbol(arg);
  6545. }
  6546. case "bigint":
  6547. return formatBigInt(arg);
  6548. }
  6549. }
  6550. function formatFunction(value) {
  6551. return {
  6552. type: "function",
  6553. value: `function ${value.name}() {}`
  6554. };
  6555. }
  6556. function formatUndefined() {
  6557. return {
  6558. type: "undefined"
  6559. };
  6560. }
  6561. function formatBoolean(value) {
  6562. return {
  6563. type: "boolean",
  6564. value: String(value)
  6565. };
  6566. }
  6567. function formatNumber(value) {
  6568. return {
  6569. type: "number",
  6570. value: String(value)
  6571. };
  6572. }
  6573. function formatBigInt(value) {
  6574. return {
  6575. type: "bigint",
  6576. value: String(value)
  6577. };
  6578. }
  6579. function formatString(value) {
  6580. return {
  6581. type: "string",
  6582. value
  6583. };
  6584. }
  6585. function formatSymbol(value) {
  6586. return {
  6587. type: "symbol",
  6588. value: value.description
  6589. };
  6590. }
  6591. function formatObject(value, depth) {
  6592. if (value === null) {
  6593. return {
  6594. type: "null"
  6595. };
  6596. }
  6597. {
  6598. if (isComponentPublicInstance(value)) {
  6599. return formatComponentPublicInstance(value, depth);
  6600. }
  6601. if (isComponentInternalInstance(value)) {
  6602. return formatComponentInternalInstance(value, depth);
  6603. }
  6604. if (isUniElement(value)) {
  6605. return formatUniElement(value, depth);
  6606. }
  6607. if (isCSSStyleDeclaration(value)) {
  6608. return formatCSSStyleDeclaration(value, depth);
  6609. }
  6610. }
  6611. if (Array.isArray(value)) {
  6612. return {
  6613. type: "object",
  6614. subType: "array",
  6615. value: {
  6616. properties: value.map((v, i) => formatArrayElement(v, i, depth + 1))
  6617. }
  6618. };
  6619. }
  6620. if (value instanceof Set) {
  6621. return {
  6622. type: "object",
  6623. subType: "set",
  6624. className: "Set",
  6625. description: `Set(${value.size})`,
  6626. value: {
  6627. entries: Array.from(value).map((v) => formatSetEntry(v, depth + 1))
  6628. }
  6629. };
  6630. }
  6631. if (value instanceof Map) {
  6632. return {
  6633. type: "object",
  6634. subType: "map",
  6635. className: "Map",
  6636. description: `Map(${value.size})`,
  6637. value: {
  6638. entries: Array.from(value.entries()).map((v) => formatMapEntry(v, depth + 1))
  6639. }
  6640. };
  6641. }
  6642. if (value instanceof Promise) {
  6643. return {
  6644. type: "object",
  6645. subType: "promise",
  6646. value: {
  6647. properties: []
  6648. }
  6649. };
  6650. }
  6651. if (value instanceof RegExp) {
  6652. return {
  6653. type: "object",
  6654. subType: "regexp",
  6655. value: String(value),
  6656. className: "Regexp"
  6657. };
  6658. }
  6659. if (value instanceof Date) {
  6660. return {
  6661. type: "object",
  6662. subType: "date",
  6663. value: String(value),
  6664. className: "Date"
  6665. };
  6666. }
  6667. if (value instanceof Error) {
  6668. return {
  6669. type: "object",
  6670. subType: "error",
  6671. value: value.message || String(value),
  6672. className: value.name || "Error"
  6673. };
  6674. }
  6675. let className = void 0;
  6676. {
  6677. const constructor = value.constructor;
  6678. if (constructor) {
  6679. if (constructor.get$UTSMetadata$) {
  6680. className = constructor.get$UTSMetadata$().name;
  6681. }
  6682. }
  6683. }
  6684. return {
  6685. type: "object",
  6686. className,
  6687. value: {
  6688. properties: Object.entries(value).map((entry) => formatObjectProperty(entry[0], entry[1], depth + 1))
  6689. }
  6690. };
  6691. }
  6692. function isComponentPublicInstance(value) {
  6693. return value.$ && isComponentInternalInstance(value.$);
  6694. }
  6695. function isComponentInternalInstance(value) {
  6696. return value.type && value.uid != null && value.appContext;
  6697. }
  6698. function formatComponentPublicInstance(value, depth) {
  6699. return {
  6700. type: "object",
  6701. className: "ComponentPublicInstance",
  6702. value: {
  6703. properties: Object.entries(value.$.type).map(([name, value2]) => formatObjectProperty(name, value2, depth + 1))
  6704. }
  6705. };
  6706. }
  6707. function formatComponentInternalInstance(value, depth) {
  6708. return {
  6709. type: "object",
  6710. className: "ComponentInternalInstance",
  6711. value: {
  6712. properties: Object.entries(value.type).map(([name, value2]) => formatObjectProperty(name, value2, depth + 1))
  6713. }
  6714. };
  6715. }
  6716. function isUniElement(value) {
  6717. return value.style && value.tagName != null && value.nodeName != null;
  6718. }
  6719. function formatUniElement(value, depth) {
  6720. return {
  6721. type: "object",
  6722. // 非 x 没有 UniElement 的概念
  6723. // className: 'UniElement',
  6724. value: {
  6725. properties: Object.entries(value).filter(([name]) => [
  6726. "id",
  6727. "tagName",
  6728. "nodeName",
  6729. "dataset",
  6730. "offsetTop",
  6731. "offsetLeft",
  6732. "style"
  6733. ].includes(name)).map(([name, value2]) => formatObjectProperty(name, value2, depth + 1))
  6734. }
  6735. };
  6736. }
  6737. function isCSSStyleDeclaration(value) {
  6738. return typeof value.getPropertyValue === "function" && typeof value.setProperty === "function" && value.$styles;
  6739. }
  6740. function formatCSSStyleDeclaration(style, depth) {
  6741. return {
  6742. type: "object",
  6743. value: {
  6744. properties: Object.entries(style.$styles).map(([name, value]) => formatObjectProperty(name, value, depth + 1))
  6745. }
  6746. };
  6747. }
  6748. function formatObjectProperty(name, value, depth) {
  6749. const result = formatArg(value, depth);
  6750. result.name = name;
  6751. return result;
  6752. }
  6753. function formatArrayElement(value, index2, depth) {
  6754. const result = formatArg(value, depth);
  6755. result.name = `${index2}`;
  6756. return result;
  6757. }
  6758. function formatSetEntry(value, depth) {
  6759. return {
  6760. value: formatArg(value, depth)
  6761. };
  6762. }
  6763. function formatMapEntry(value, depth) {
  6764. return {
  6765. key: formatArg(value[0], depth),
  6766. value: formatArg(value[1], depth)
  6767. };
  6768. }
  6769. const CONSOLE_TYPES = ["log", "warn", "error", "info", "debug"];
  6770. let sendConsole = null;
  6771. const messageQueue = [];
  6772. const messageExtra = {};
  6773. function sendConsoleMessages(messages) {
  6774. if (sendConsole == null) {
  6775. messageQueue.push(...messages);
  6776. return;
  6777. }
  6778. sendConsole(JSON.stringify(Object.assign({
  6779. type: "console",
  6780. data: messages
  6781. }, messageExtra)));
  6782. }
  6783. function setSendConsole(value, extra = {}) {
  6784. sendConsole = value;
  6785. Object.assign(messageExtra, extra);
  6786. if (value != null && messageQueue.length > 0) {
  6787. const messages = messageQueue.slice();
  6788. messageQueue.length = 0;
  6789. sendConsoleMessages(messages);
  6790. }
  6791. }
  6792. const originalConsole = /* @__PURE__ */ CONSOLE_TYPES.reduce((methods, type) => {
  6793. methods[type] = console[type].bind(console);
  6794. return methods;
  6795. }, {});
  6796. const atFileRegex = /^\s*at\s+[\w/./-]+:\d+$/;
  6797. function rewriteConsole() {
  6798. function wrapConsole(type) {
  6799. return function(...args) {
  6800. const originalArgs = [...args];
  6801. if (originalArgs.length) {
  6802. const maybeAtFile = originalArgs[originalArgs.length - 1];
  6803. if (typeof maybeAtFile === "string" && atFileRegex.test(maybeAtFile)) {
  6804. originalArgs.pop();
  6805. }
  6806. }
  6807. {
  6808. originalConsole[type](...originalArgs);
  6809. }
  6810. sendConsoleMessages([formatMessage(type, args)]);
  6811. };
  6812. }
  6813. if (isConsoleWritable()) {
  6814. CONSOLE_TYPES.forEach((type) => {
  6815. console[type] = wrapConsole(type);
  6816. });
  6817. return function restoreConsole() {
  6818. CONSOLE_TYPES.forEach((type) => {
  6819. console[type] = originalConsole[type];
  6820. });
  6821. };
  6822. } else {
  6823. {
  6824. if (typeof index !== "undefined" && index.__f__) {
  6825. const oldLog = index.__f__;
  6826. if (oldLog) {
  6827. index.__f__ = function(...args) {
  6828. const [type, filename, ...rest] = args;
  6829. oldLog(type, "", ...rest);
  6830. sendConsoleMessages([formatMessage(type, [...rest, filename])]);
  6831. };
  6832. return function restoreConsole() {
  6833. index.__f__ = oldLog;
  6834. };
  6835. }
  6836. }
  6837. }
  6838. }
  6839. return function restoreConsole() {
  6840. };
  6841. }
  6842. function isConsoleWritable() {
  6843. const value = console.log;
  6844. const sym = Symbol();
  6845. try {
  6846. console.log = sym;
  6847. } catch (ex) {
  6848. return false;
  6849. }
  6850. const isWritable = console.log === sym;
  6851. console.log = value;
  6852. return isWritable;
  6853. }
  6854. let sendError = null;
  6855. const errorQueue = /* @__PURE__ */ new Set();
  6856. const errorExtra = {};
  6857. function sendErrorMessages(errors) {
  6858. if (sendError == null) {
  6859. errors.forEach((error) => {
  6860. errorQueue.add(error);
  6861. });
  6862. return;
  6863. }
  6864. const data = errors.map((err) => {
  6865. const isPromiseRejection = err && "promise" in err && "reason" in err;
  6866. const prefix = isPromiseRejection ? "UnhandledPromiseRejection: " : "";
  6867. if (isPromiseRejection) {
  6868. err = err.reason;
  6869. }
  6870. if (err instanceof Error && err.stack) {
  6871. if (err.message && !err.stack.includes(err.message)) {
  6872. return `${prefix}${err.message}
  6873. ${err.stack}`;
  6874. }
  6875. return `${prefix}${err.stack}`;
  6876. }
  6877. if (typeof err === "object" && err !== null) {
  6878. try {
  6879. return prefix + JSON.stringify(err);
  6880. } catch (err2) {
  6881. return prefix + String(err2);
  6882. }
  6883. }
  6884. return prefix + String(err);
  6885. }).filter(Boolean);
  6886. if (data.length > 0) {
  6887. sendError(JSON.stringify(Object.assign({
  6888. type: "error",
  6889. data
  6890. }, errorExtra)));
  6891. }
  6892. }
  6893. function setSendError(value, extra = {}) {
  6894. sendError = value;
  6895. Object.assign(errorExtra, extra);
  6896. if (value != null && errorQueue.size > 0) {
  6897. const errors = Array.from(errorQueue);
  6898. errorQueue.clear();
  6899. sendErrorMessages(errors);
  6900. }
  6901. }
  6902. function initOnError() {
  6903. function onError2(error) {
  6904. try {
  6905. if (typeof PromiseRejectionEvent !== "undefined" && error instanceof PromiseRejectionEvent && error.reason instanceof Error && error.reason.message && error.reason.message.includes(`Cannot create property 'errMsg' on string 'taskId`)) {
  6906. return;
  6907. }
  6908. if (true) {
  6909. originalConsole.error(error);
  6910. }
  6911. sendErrorMessages([error]);
  6912. } catch (err) {
  6913. originalConsole.error(err);
  6914. }
  6915. }
  6916. if (typeof index.onError === "function") {
  6917. index.onError(onError2);
  6918. }
  6919. if (typeof index.onUnhandledRejection === "function") {
  6920. index.onUnhandledRejection(onError2);
  6921. }
  6922. return function offError2() {
  6923. if (typeof index.offError === "function") {
  6924. index.offError(onError2);
  6925. }
  6926. if (typeof index.offUnhandledRejection === "function") {
  6927. index.offUnhandledRejection(onError2);
  6928. }
  6929. };
  6930. }
  6931. function initRuntimeSocketService() {
  6932. const hosts = "192.168.225.1,192.168.189.1,192.168.171.80,127.0.0.1";
  6933. const port = "8090";
  6934. const id = "mp-weixin_UhCft6";
  6935. const lazy = typeof swan !== "undefined";
  6936. let restoreError = lazy ? () => {
  6937. } : initOnError();
  6938. let restoreConsole = lazy ? () => {
  6939. } : rewriteConsole();
  6940. return Promise.resolve().then(() => {
  6941. if (lazy) {
  6942. restoreError = initOnError();
  6943. restoreConsole = rewriteConsole();
  6944. }
  6945. return initRuntimeSocket(hosts, port, id).then((socket) => {
  6946. if (!socket) {
  6947. restoreError();
  6948. restoreConsole();
  6949. originalConsole.error(wrapError("开发模式下日志通道建立 socket 连接失败。"));
  6950. originalConsole.error(wrapError("如果是小程序平台,请勾选不校验合法域名配置。"));
  6951. originalConsole.error(wrapError("如果是运行到真机,请确认手机与电脑处于同一网络。"));
  6952. return false;
  6953. }
  6954. initMiniProgramGlobalFlag();
  6955. socket.onClose(() => {
  6956. originalConsole.error(wrapError("开发模式下日志通道 socket 连接关闭,请在 HBuilderX 中重新运行。"));
  6957. restoreError();
  6958. restoreConsole();
  6959. });
  6960. setSendConsole((data) => {
  6961. socket.send({
  6962. data
  6963. });
  6964. });
  6965. setSendError((data) => {
  6966. socket.send({
  6967. data
  6968. });
  6969. });
  6970. return true;
  6971. });
  6972. });
  6973. }
  6974. const ERROR_CHAR = "‌";
  6975. function wrapError(error) {
  6976. return `${ERROR_CHAR}${error}${ERROR_CHAR}`;
  6977. }
  6978. function initMiniProgramGlobalFlag() {
  6979. if (typeof wx$1 !== "undefined") {
  6980. wx$1.__uni_console__ = true;
  6981. } else if (typeof my !== "undefined") {
  6982. my.__uni_console__ = true;
  6983. } else if (typeof tt !== "undefined") {
  6984. tt.__uni_console__ = true;
  6985. } else if (typeof swan !== "undefined") {
  6986. swan.__uni_console__ = true;
  6987. } else if (typeof qq !== "undefined") {
  6988. qq.__uni_console__ = true;
  6989. } else if (typeof ks !== "undefined") {
  6990. ks.__uni_console__ = true;
  6991. } else if (typeof jd !== "undefined") {
  6992. jd.__uni_console__ = true;
  6993. } else if (typeof xhs !== "undefined") {
  6994. xhs.__uni_console__ = true;
  6995. } else if (typeof has !== "undefined") {
  6996. has.__uni_console__ = true;
  6997. } else if (typeof qa !== "undefined") {
  6998. qa.__uni_console__ = true;
  6999. }
  7000. }
  7001. initRuntimeSocketService();
  7002. const _export_sfc = (sfc, props) => {
  7003. const target = sfc.__vccOpts || sfc;
  7004. for (const [key, val] of props) {
  7005. target[key] = val;
  7006. }
  7007. return target;
  7008. };
  7009. function initVueIds(vueIds, mpInstance) {
  7010. if (!vueIds) {
  7011. return;
  7012. }
  7013. const ids = vueIds.split(",");
  7014. const len = ids.length;
  7015. if (len === 1) {
  7016. mpInstance._$vueId = ids[0];
  7017. } else if (len === 2) {
  7018. mpInstance._$vueId = ids[0];
  7019. mpInstance._$vuePid = ids[1];
  7020. }
  7021. }
  7022. const EXTRAS = ["externalClasses"];
  7023. function initExtraOptions(miniProgramComponentOptions, vueOptions) {
  7024. EXTRAS.forEach((name) => {
  7025. if (hasOwn(vueOptions, name)) {
  7026. miniProgramComponentOptions[name] = vueOptions[name];
  7027. }
  7028. });
  7029. }
  7030. const WORKLET_RE = /_(.*)_worklet_factory_/;
  7031. function initWorkletMethods(mpMethods, vueMethods) {
  7032. if (vueMethods) {
  7033. Object.keys(vueMethods).forEach((name) => {
  7034. const matches = name.match(WORKLET_RE);
  7035. if (matches) {
  7036. const workletName = matches[1];
  7037. mpMethods[name] = vueMethods[name];
  7038. mpMethods[workletName] = vueMethods[workletName];
  7039. }
  7040. });
  7041. }
  7042. }
  7043. function initWxsCallMethods(methods, wxsCallMethods) {
  7044. if (!isArray(wxsCallMethods)) {
  7045. return;
  7046. }
  7047. wxsCallMethods.forEach((callMethod) => {
  7048. methods[callMethod] = function(args) {
  7049. return this.$vm[callMethod](args);
  7050. };
  7051. });
  7052. }
  7053. function selectAllComponents(mpInstance, selector, $refs) {
  7054. const components = mpInstance.selectAllComponents(selector);
  7055. components.forEach((component) => {
  7056. const ref2 = component.properties.uR;
  7057. $refs[ref2] = component.$vm || component;
  7058. });
  7059. }
  7060. function initRefs(instance, mpInstance) {
  7061. Object.defineProperty(instance, "refs", {
  7062. get() {
  7063. const $refs = {};
  7064. selectAllComponents(mpInstance, ".r", $refs);
  7065. const forComponents = mpInstance.selectAllComponents(".r-i-f");
  7066. forComponents.forEach((component) => {
  7067. const ref2 = component.properties.uR;
  7068. if (!ref2) {
  7069. return;
  7070. }
  7071. if (!$refs[ref2]) {
  7072. $refs[ref2] = [];
  7073. }
  7074. $refs[ref2].push(component.$vm || component);
  7075. });
  7076. return $refs;
  7077. }
  7078. });
  7079. }
  7080. function findVmByVueId(instance, vuePid) {
  7081. const $children = instance.$children;
  7082. for (let i = $children.length - 1; i >= 0; i--) {
  7083. const childVm = $children[i];
  7084. if (childVm.$scope._$vueId === vuePid) {
  7085. return childVm;
  7086. }
  7087. }
  7088. let parentVm;
  7089. for (let i = $children.length - 1; i >= 0; i--) {
  7090. parentVm = findVmByVueId($children[i], vuePid);
  7091. if (parentVm) {
  7092. return parentVm;
  7093. }
  7094. }
  7095. }
  7096. function getLocaleLanguage() {
  7097. let localeLanguage = "";
  7098. {
  7099. const appBaseInfo = wx.getAppBaseInfo();
  7100. const language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
  7101. localeLanguage = normalizeLocale(language) || LOCALE_EN;
  7102. }
  7103. return localeLanguage;
  7104. }
  7105. const MP_METHODS = [
  7106. "createSelectorQuery",
  7107. "createIntersectionObserver",
  7108. "selectAllComponents",
  7109. "selectComponent"
  7110. ];
  7111. function createEmitFn(oldEmit, ctx) {
  7112. return function emit2(event, ...args) {
  7113. const scope = ctx.$scope;
  7114. if (scope && event) {
  7115. const detail = { __args__: args };
  7116. {
  7117. scope.triggerEvent(event, detail);
  7118. }
  7119. }
  7120. return oldEmit.apply(this, [event, ...args]);
  7121. };
  7122. }
  7123. function initBaseInstance(instance, options) {
  7124. const ctx = instance.ctx;
  7125. ctx.mpType = options.mpType;
  7126. ctx.$mpType = options.mpType;
  7127. ctx.$mpPlatform = "mp-weixin";
  7128. ctx.$scope = options.mpInstance;
  7129. {
  7130. Object.defineProperties(ctx, {
  7131. // only id
  7132. [VIRTUAL_HOST_ID]: {
  7133. get() {
  7134. const id = this.$scope.data[VIRTUAL_HOST_ID];
  7135. return id === void 0 ? "" : id;
  7136. }
  7137. }
  7138. });
  7139. }
  7140. ctx.$mp = {};
  7141. {
  7142. ctx._self = {};
  7143. }
  7144. instance.slots = {};
  7145. if (isArray(options.slots) && options.slots.length) {
  7146. options.slots.forEach((name) => {
  7147. instance.slots[name] = true;
  7148. });
  7149. if (instance.slots[SLOT_DEFAULT_NAME]) {
  7150. instance.slots.default = true;
  7151. }
  7152. }
  7153. ctx.getOpenerEventChannel = function() {
  7154. {
  7155. return options.mpInstance.getOpenerEventChannel();
  7156. }
  7157. };
  7158. ctx.$hasHook = hasHook;
  7159. ctx.$callHook = callHook;
  7160. instance.emit = createEmitFn(instance.emit, ctx);
  7161. }
  7162. function initComponentInstance(instance, options) {
  7163. initBaseInstance(instance, options);
  7164. const ctx = instance.ctx;
  7165. MP_METHODS.forEach((method) => {
  7166. ctx[method] = function(...args) {
  7167. const mpInstance = ctx.$scope;
  7168. if (mpInstance && mpInstance[method]) {
  7169. return mpInstance[method].apply(mpInstance, args);
  7170. }
  7171. };
  7172. });
  7173. }
  7174. function initMocks(instance, mpInstance, mocks2) {
  7175. const ctx = instance.ctx;
  7176. mocks2.forEach((mock) => {
  7177. if (hasOwn(mpInstance, mock)) {
  7178. instance[mock] = ctx[mock] = mpInstance[mock];
  7179. }
  7180. });
  7181. }
  7182. function hasHook(name) {
  7183. const hooks = this.$[name];
  7184. if (hooks && hooks.length) {
  7185. return true;
  7186. }
  7187. return false;
  7188. }
  7189. function callHook(name, args) {
  7190. if (name === "mounted") {
  7191. callHook.call(this, "bm");
  7192. this.$.isMounted = true;
  7193. name = "m";
  7194. }
  7195. const hooks = this.$[name];
  7196. return hooks && invokeArrayFns(hooks, args);
  7197. }
  7198. const PAGE_INIT_HOOKS = [
  7199. ON_LOAD,
  7200. ON_SHOW,
  7201. ON_HIDE,
  7202. ON_UNLOAD,
  7203. ON_RESIZE,
  7204. ON_TAB_ITEM_TAP,
  7205. ON_REACH_BOTTOM,
  7206. ON_PULL_DOWN_REFRESH,
  7207. ON_ADD_TO_FAVORITES
  7208. // 'onReady', // lifetimes.ready
  7209. // 'onPageScroll', // 影响性能,开发者手动注册
  7210. // 'onShareTimeline', // 右上角菜单,开发者手动注册
  7211. // 'onShareAppMessage' // 右上角菜单,开发者手动注册
  7212. ];
  7213. function findHooks(vueOptions, hooks = /* @__PURE__ */ new Set()) {
  7214. if (vueOptions) {
  7215. Object.keys(vueOptions).forEach((name) => {
  7216. if (isUniLifecycleHook(name, vueOptions[name])) {
  7217. hooks.add(name);
  7218. }
  7219. });
  7220. {
  7221. const { extends: extendsOptions, mixins } = vueOptions;
  7222. if (mixins) {
  7223. mixins.forEach((mixin) => findHooks(mixin, hooks));
  7224. }
  7225. if (extendsOptions) {
  7226. findHooks(extendsOptions, hooks);
  7227. }
  7228. }
  7229. }
  7230. return hooks;
  7231. }
  7232. function initHook(mpOptions, hook, excludes) {
  7233. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  7234. mpOptions[hook] = function(args) {
  7235. return this.$vm && this.$vm.$callHook(hook, args);
  7236. };
  7237. }
  7238. }
  7239. const EXCLUDE_HOOKS = [ON_READY];
  7240. function initHooks(mpOptions, hooks, excludes = EXCLUDE_HOOKS) {
  7241. hooks.forEach((hook) => initHook(mpOptions, hook, excludes));
  7242. }
  7243. function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
  7244. findHooks(vueOptions).forEach((hook) => initHook(mpOptions, hook, excludes));
  7245. }
  7246. function initRuntimeHooks(mpOptions, runtimeHooks) {
  7247. if (!runtimeHooks) {
  7248. return;
  7249. }
  7250. const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
  7251. hooks.forEach((hook) => {
  7252. if (runtimeHooks & MINI_PROGRAM_PAGE_RUNTIME_HOOKS[hook]) {
  7253. initHook(mpOptions, hook, []);
  7254. }
  7255. });
  7256. }
  7257. const findMixinRuntimeHooks = /* @__PURE__ */ once(() => {
  7258. const runtimeHooks = [];
  7259. const app = isFunction(getApp) && getApp({ allowDefault: true });
  7260. if (app && app.$vm && app.$vm.$) {
  7261. const mixins = app.$vm.$.appContext.mixins;
  7262. if (isArray(mixins)) {
  7263. const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
  7264. mixins.forEach((mixin) => {
  7265. hooks.forEach((hook) => {
  7266. if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
  7267. runtimeHooks.push(hook);
  7268. }
  7269. });
  7270. });
  7271. }
  7272. }
  7273. return runtimeHooks;
  7274. });
  7275. function initMixinRuntimeHooks(mpOptions) {
  7276. initHooks(mpOptions, findMixinRuntimeHooks());
  7277. }
  7278. const HOOKS = [
  7279. ON_SHOW,
  7280. ON_HIDE,
  7281. ON_ERROR,
  7282. ON_THEME_CHANGE,
  7283. ON_PAGE_NOT_FOUND,
  7284. ON_UNHANDLE_REJECTION
  7285. ];
  7286. function parseApp(instance, parseAppOptions) {
  7287. const internalInstance = instance.$;
  7288. const appOptions = {
  7289. globalData: instance.$options && instance.$options.globalData || {},
  7290. $vm: instance,
  7291. // mp-alipay 组件 data 初始化比 onLaunch 早,提前挂载
  7292. onLaunch(options) {
  7293. this.$vm = instance;
  7294. const ctx = internalInstance.ctx;
  7295. if (this.$vm && ctx.$scope && ctx.$callHook) {
  7296. return;
  7297. }
  7298. initBaseInstance(internalInstance, {
  7299. mpType: "app",
  7300. mpInstance: this,
  7301. slots: []
  7302. });
  7303. ctx.globalData = this.globalData;
  7304. instance.$callHook(ON_LAUNCH, options);
  7305. }
  7306. };
  7307. const onErrorHandlers = wx.$onErrorHandlers;
  7308. if (onErrorHandlers) {
  7309. onErrorHandlers.forEach((fn) => {
  7310. injectHook(ON_ERROR, fn, internalInstance);
  7311. });
  7312. onErrorHandlers.length = 0;
  7313. }
  7314. initLocale(instance);
  7315. const vueOptions = instance.$.type;
  7316. initHooks(appOptions, HOOKS);
  7317. initUnknownHooks(appOptions, vueOptions);
  7318. {
  7319. const methods = vueOptions.methods;
  7320. methods && extend(appOptions, methods);
  7321. }
  7322. return appOptions;
  7323. }
  7324. function initCreateApp(parseAppOptions) {
  7325. return function createApp2(vm) {
  7326. return App(parseApp(vm));
  7327. };
  7328. }
  7329. function initCreateSubpackageApp(parseAppOptions) {
  7330. return function createApp2(vm) {
  7331. const appOptions = parseApp(vm);
  7332. const app = isFunction(getApp) && getApp({
  7333. allowDefault: true
  7334. });
  7335. if (!app)
  7336. return;
  7337. vm.$.ctx.$scope = app;
  7338. const globalData = app.globalData;
  7339. if (globalData) {
  7340. Object.keys(appOptions.globalData).forEach((name) => {
  7341. if (!hasOwn(globalData, name)) {
  7342. globalData[name] = appOptions.globalData[name];
  7343. }
  7344. });
  7345. }
  7346. Object.keys(appOptions).forEach((name) => {
  7347. if (!hasOwn(app, name)) {
  7348. app[name] = appOptions[name];
  7349. }
  7350. });
  7351. initAppLifecycle(appOptions, vm);
  7352. };
  7353. }
  7354. function initAppLifecycle(appOptions, vm) {
  7355. if (isFunction(appOptions.onLaunch)) {
  7356. const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  7357. appOptions.onLaunch(args);
  7358. }
  7359. if (isFunction(appOptions.onShow) && wx.onAppShow) {
  7360. wx.onAppShow((args) => {
  7361. vm.$callHook("onShow", args);
  7362. });
  7363. }
  7364. if (isFunction(appOptions.onHide) && wx.onAppHide) {
  7365. wx.onAppHide((args) => {
  7366. vm.$callHook("onHide", args);
  7367. });
  7368. }
  7369. }
  7370. function initLocale(appVm) {
  7371. const locale = ref(getLocaleLanguage());
  7372. Object.defineProperty(appVm, "$locale", {
  7373. get() {
  7374. return locale.value;
  7375. },
  7376. set(v) {
  7377. locale.value = v;
  7378. }
  7379. });
  7380. }
  7381. const builtInProps = [
  7382. // 百度小程序,快手小程序自定义组件不支持绑定动态事件,动态dataset,故通过props传递事件信息
  7383. // event-opts
  7384. "eO",
  7385. // 组件 ref
  7386. "uR",
  7387. // 组件 ref-in-for
  7388. "uRIF",
  7389. // 组件 id
  7390. "uI",
  7391. // 组件类型 m: 小程序组件
  7392. "uT",
  7393. // 组件 props
  7394. "uP",
  7395. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  7396. "uS"
  7397. ];
  7398. function initDefaultProps(options, isBehavior = false) {
  7399. const properties = {};
  7400. if (!isBehavior) {
  7401. let observerSlots = function(newVal) {
  7402. const $slots = /* @__PURE__ */ Object.create(null);
  7403. newVal && newVal.forEach((slotName) => {
  7404. $slots[slotName] = true;
  7405. });
  7406. this.setData({
  7407. $slots
  7408. });
  7409. };
  7410. builtInProps.forEach((name) => {
  7411. properties[name] = {
  7412. type: null,
  7413. value: ""
  7414. };
  7415. });
  7416. properties.uS = {
  7417. type: null,
  7418. value: []
  7419. };
  7420. {
  7421. properties.uS.observer = observerSlots;
  7422. }
  7423. }
  7424. if (options.behaviors) {
  7425. if (options.behaviors.includes("wx://form-field")) {
  7426. if (!options.properties || !options.properties.name) {
  7427. properties.name = {
  7428. type: null,
  7429. value: ""
  7430. };
  7431. }
  7432. if (!options.properties || !options.properties.value) {
  7433. properties.value = {
  7434. type: null,
  7435. value: ""
  7436. };
  7437. }
  7438. }
  7439. }
  7440. return properties;
  7441. }
  7442. function initVirtualHostProps(options) {
  7443. const properties = {};
  7444. {
  7445. if (options && options.virtualHost) {
  7446. properties[VIRTUAL_HOST_STYLE] = {
  7447. type: null,
  7448. value: ""
  7449. };
  7450. properties[VIRTUAL_HOST_CLASS] = {
  7451. type: null,
  7452. value: ""
  7453. };
  7454. properties[VIRTUAL_HOST_HIDDEN] = {
  7455. type: null,
  7456. value: ""
  7457. };
  7458. properties[VIRTUAL_HOST_ID] = {
  7459. type: null,
  7460. value: ""
  7461. };
  7462. }
  7463. }
  7464. return properties;
  7465. }
  7466. function initProps(mpComponentOptions) {
  7467. if (!mpComponentOptions.properties) {
  7468. mpComponentOptions.properties = {};
  7469. }
  7470. extend(mpComponentOptions.properties, initDefaultProps(mpComponentOptions), initVirtualHostProps(mpComponentOptions.options));
  7471. }
  7472. const PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  7473. function parsePropType(type, defaultValue) {
  7474. if (isArray(type) && type.length === 1) {
  7475. return type[0];
  7476. }
  7477. return type;
  7478. }
  7479. function normalizePropType(type, defaultValue) {
  7480. const res = parsePropType(type);
  7481. return PROP_TYPES.indexOf(res) !== -1 ? res : null;
  7482. }
  7483. function initPageProps({ properties }, rawProps) {
  7484. if (isArray(rawProps)) {
  7485. rawProps.forEach((key) => {
  7486. properties[key] = {
  7487. type: String,
  7488. value: ""
  7489. };
  7490. });
  7491. } else if (isPlainObject(rawProps)) {
  7492. Object.keys(rawProps).forEach((key) => {
  7493. const opts = rawProps[key];
  7494. if (isPlainObject(opts)) {
  7495. let value = opts.default;
  7496. if (isFunction(value)) {
  7497. value = value();
  7498. }
  7499. const type = opts.type;
  7500. opts.type = normalizePropType(type);
  7501. properties[key] = {
  7502. type: opts.type,
  7503. value
  7504. };
  7505. } else {
  7506. properties[key] = {
  7507. type: normalizePropType(opts)
  7508. };
  7509. }
  7510. });
  7511. }
  7512. }
  7513. function findPropsData(properties, isPage2) {
  7514. return (isPage2 ? findPagePropsData(properties) : findComponentPropsData(resolvePropValue(properties.uP))) || {};
  7515. }
  7516. function findPagePropsData(properties) {
  7517. const propsData = {};
  7518. if (isPlainObject(properties)) {
  7519. Object.keys(properties).forEach((name) => {
  7520. if (builtInProps.indexOf(name) === -1) {
  7521. propsData[name] = resolvePropValue(properties[name]);
  7522. }
  7523. });
  7524. }
  7525. return propsData;
  7526. }
  7527. function initFormField(vm) {
  7528. const vueOptions = vm.$options;
  7529. if (isArray(vueOptions.behaviors) && vueOptions.behaviors.includes("uni://form-field")) {
  7530. vm.$watch("modelValue", () => {
  7531. vm.$scope && vm.$scope.setData({
  7532. name: vm.name,
  7533. value: vm.modelValue
  7534. });
  7535. }, {
  7536. immediate: true
  7537. });
  7538. }
  7539. }
  7540. function resolvePropValue(prop) {
  7541. return prop;
  7542. }
  7543. function initData(_) {
  7544. return {};
  7545. }
  7546. function initPropsObserver(componentOptions) {
  7547. const observe = function observe2() {
  7548. const up = this.properties.uP;
  7549. if (!up) {
  7550. return;
  7551. }
  7552. if (this.$vm) {
  7553. updateComponentProps(resolvePropValue(up), this.$vm.$);
  7554. } else if (resolvePropValue(this.properties.uT) === "m") {
  7555. updateMiniProgramComponentProperties(resolvePropValue(up), this);
  7556. }
  7557. };
  7558. {
  7559. if (!componentOptions.observers) {
  7560. componentOptions.observers = {};
  7561. }
  7562. componentOptions.observers.uP = observe;
  7563. }
  7564. }
  7565. function updateMiniProgramComponentProperties(up, mpInstance) {
  7566. const prevProps = mpInstance.properties;
  7567. const nextProps = findComponentPropsData(up) || {};
  7568. if (hasPropsChanged(prevProps, nextProps, false)) {
  7569. mpInstance.setData(nextProps);
  7570. }
  7571. }
  7572. function updateComponentProps(up, instance) {
  7573. const prevProps = toRaw(instance.props);
  7574. const nextProps = findComponentPropsData(up) || {};
  7575. if (hasPropsChanged(prevProps, nextProps)) {
  7576. updateProps(instance, nextProps, prevProps, false);
  7577. if (hasQueueJob(instance.update)) {
  7578. invalidateJob(instance.update);
  7579. }
  7580. {
  7581. instance.update();
  7582. }
  7583. }
  7584. }
  7585. function hasPropsChanged(prevProps, nextProps, checkLen = true) {
  7586. const nextKeys = Object.keys(nextProps);
  7587. if (checkLen && nextKeys.length !== Object.keys(prevProps).length) {
  7588. return true;
  7589. }
  7590. for (let i = 0; i < nextKeys.length; i++) {
  7591. const key = nextKeys[i];
  7592. if (nextProps[key] !== prevProps[key]) {
  7593. return true;
  7594. }
  7595. }
  7596. return false;
  7597. }
  7598. function initBehaviors(vueOptions) {
  7599. const vueBehaviors = vueOptions.behaviors;
  7600. let vueProps = vueOptions.props;
  7601. if (!vueProps) {
  7602. vueOptions.props = vueProps = [];
  7603. }
  7604. const behaviors = [];
  7605. if (isArray(vueBehaviors)) {
  7606. vueBehaviors.forEach((behavior) => {
  7607. behaviors.push(behavior.replace("uni://", "wx://"));
  7608. if (behavior === "uni://form-field") {
  7609. if (isArray(vueProps)) {
  7610. vueProps.push("name");
  7611. vueProps.push("modelValue");
  7612. } else {
  7613. vueProps.name = {
  7614. type: String,
  7615. default: ""
  7616. };
  7617. vueProps.modelValue = {
  7618. type: [String, Number, Boolean, Array, Object, Date],
  7619. default: ""
  7620. };
  7621. }
  7622. }
  7623. });
  7624. }
  7625. return behaviors;
  7626. }
  7627. function applyOptions(componentOptions, vueOptions) {
  7628. componentOptions.data = initData();
  7629. componentOptions.behaviors = initBehaviors(vueOptions);
  7630. }
  7631. function parseComponent(vueOptions, { parse, mocks: mocks2, isPage: isPage2, isPageInProject, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 }) {
  7632. vueOptions = vueOptions.default || vueOptions;
  7633. const options = {
  7634. multipleSlots: true,
  7635. // styleIsolation: 'apply-shared',
  7636. addGlobalClass: true,
  7637. pureDataPattern: /^uP$/
  7638. };
  7639. if (isArray(vueOptions.mixins)) {
  7640. vueOptions.mixins.forEach((item) => {
  7641. if (isObject(item.options)) {
  7642. extend(options, item.options);
  7643. }
  7644. });
  7645. }
  7646. if (vueOptions.options) {
  7647. extend(options, vueOptions.options);
  7648. }
  7649. const mpComponentOptions = {
  7650. options,
  7651. lifetimes: initLifetimes2({ mocks: mocks2, isPage: isPage2, initRelation: initRelation2, vueOptions }),
  7652. pageLifetimes: {
  7653. show() {
  7654. this.$vm && this.$vm.$callHook("onPageShow");
  7655. },
  7656. hide() {
  7657. this.$vm && this.$vm.$callHook("onPageHide");
  7658. },
  7659. resize(size2) {
  7660. this.$vm && this.$vm.$callHook("onPageResize", size2);
  7661. }
  7662. },
  7663. methods: {
  7664. __l: handleLink2
  7665. }
  7666. };
  7667. {
  7668. applyOptions(mpComponentOptions, vueOptions);
  7669. }
  7670. initProps(mpComponentOptions);
  7671. initPropsObserver(mpComponentOptions);
  7672. initExtraOptions(mpComponentOptions, vueOptions);
  7673. initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
  7674. {
  7675. initWorkletMethods(mpComponentOptions.methods, vueOptions.methods);
  7676. }
  7677. if (parse) {
  7678. parse(mpComponentOptions, { handleLink: handleLink2 });
  7679. }
  7680. return mpComponentOptions;
  7681. }
  7682. function initCreateComponent(parseOptions2) {
  7683. return function createComponent2(vueComponentOptions) {
  7684. return Component(parseComponent(vueComponentOptions, parseOptions2));
  7685. };
  7686. }
  7687. let $createComponentFn;
  7688. let $destroyComponentFn;
  7689. function getAppVm() {
  7690. return getApp().$vm;
  7691. }
  7692. function $createComponent(initialVNode, options) {
  7693. if (!$createComponentFn) {
  7694. $createComponentFn = getAppVm().$createComponent;
  7695. }
  7696. const proxy = $createComponentFn(initialVNode, options);
  7697. return getExposeProxy(proxy.$) || proxy;
  7698. }
  7699. function $destroyComponent(instance) {
  7700. if (!$destroyComponentFn) {
  7701. $destroyComponentFn = getAppVm().$destroyComponent;
  7702. }
  7703. return $destroyComponentFn(instance);
  7704. }
  7705. function parsePage(vueOptions, parseOptions2) {
  7706. const { parse, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 } = parseOptions2;
  7707. const miniProgramPageOptions = parseComponent(vueOptions, {
  7708. mocks: mocks2,
  7709. isPage: isPage2,
  7710. isPageInProject: true,
  7711. initRelation: initRelation2,
  7712. handleLink: handleLink2,
  7713. initLifetimes: initLifetimes2
  7714. });
  7715. initPageProps(miniProgramPageOptions, (vueOptions.default || vueOptions).props);
  7716. const methods = miniProgramPageOptions.methods;
  7717. methods.onLoad = function(query) {
  7718. {
  7719. this.options = query;
  7720. }
  7721. this.$page = {
  7722. fullPath: addLeadingSlash(this.route + stringifyQuery(query))
  7723. };
  7724. return this.$vm && this.$vm.$callHook(ON_LOAD, query);
  7725. };
  7726. initHooks(methods, PAGE_INIT_HOOKS);
  7727. {
  7728. initUnknownHooks(methods, vueOptions);
  7729. }
  7730. initRuntimeHooks(methods, vueOptions.__runtimeHooks);
  7731. initMixinRuntimeHooks(methods);
  7732. parse && parse(miniProgramPageOptions, { handleLink: handleLink2 });
  7733. return miniProgramPageOptions;
  7734. }
  7735. function initCreatePage(parseOptions2) {
  7736. return function createPage2(vuePageOptions) {
  7737. return Component(parsePage(vuePageOptions, parseOptions2));
  7738. };
  7739. }
  7740. function initCreatePluginApp(parseAppOptions) {
  7741. return function createApp2(vm) {
  7742. initAppLifecycle(parseApp(vm), vm);
  7743. };
  7744. }
  7745. const MPPage = Page;
  7746. const MPComponent = Component;
  7747. function initTriggerEvent(mpInstance) {
  7748. const oldTriggerEvent = mpInstance.triggerEvent;
  7749. const newTriggerEvent = function(event, ...args) {
  7750. return oldTriggerEvent.apply(mpInstance, [
  7751. customizeEvent(event),
  7752. ...args
  7753. ]);
  7754. };
  7755. try {
  7756. mpInstance.triggerEvent = newTriggerEvent;
  7757. } catch (error) {
  7758. mpInstance._triggerEvent = newTriggerEvent;
  7759. }
  7760. }
  7761. function initMiniProgramHook(name, options, isComponent) {
  7762. const oldHook = options[name];
  7763. if (!oldHook) {
  7764. options[name] = function() {
  7765. initTriggerEvent(this);
  7766. };
  7767. } else {
  7768. options[name] = function(...args) {
  7769. initTriggerEvent(this);
  7770. return oldHook.apply(this, args);
  7771. };
  7772. }
  7773. }
  7774. Page = function(options) {
  7775. initMiniProgramHook(ON_LOAD, options);
  7776. return MPPage(options);
  7777. };
  7778. Component = function(options) {
  7779. initMiniProgramHook("created", options);
  7780. const isVueComponent = options.properties && options.properties.uP;
  7781. if (!isVueComponent) {
  7782. initProps(options);
  7783. initPropsObserver(options);
  7784. }
  7785. return MPComponent(options);
  7786. };
  7787. function initLifetimes({ mocks: mocks2, isPage: isPage2, initRelation: initRelation2, vueOptions }) {
  7788. return {
  7789. attached() {
  7790. let properties = this.properties;
  7791. initVueIds(properties.uI, this);
  7792. const relationOptions = {
  7793. vuePid: this._$vuePid
  7794. };
  7795. initRelation2(this, relationOptions);
  7796. const mpInstance = this;
  7797. const isMiniProgramPage = isPage2(mpInstance);
  7798. let propsData = properties;
  7799. this.$vm = $createComponent({
  7800. type: vueOptions,
  7801. props: findPropsData(propsData, isMiniProgramPage)
  7802. }, {
  7803. mpType: isMiniProgramPage ? "page" : "component",
  7804. mpInstance,
  7805. slots: properties.uS || {},
  7806. // vueSlots
  7807. parentComponent: relationOptions.parent && relationOptions.parent.$,
  7808. onBeforeSetup(instance, options) {
  7809. initRefs(instance, mpInstance);
  7810. initMocks(instance, mpInstance, mocks2);
  7811. initComponentInstance(instance, options);
  7812. }
  7813. });
  7814. if (!isMiniProgramPage) {
  7815. initFormField(this.$vm);
  7816. }
  7817. },
  7818. ready() {
  7819. if (this.$vm) {
  7820. {
  7821. this.$vm.$callHook("mounted");
  7822. this.$vm.$callHook(ON_READY);
  7823. }
  7824. }
  7825. },
  7826. detached() {
  7827. if (this.$vm) {
  7828. pruneComponentPropsCache(this.$vm.$.uid);
  7829. $destroyComponent(this.$vm);
  7830. }
  7831. }
  7832. };
  7833. }
  7834. const mocks = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];
  7835. function isPage(mpInstance) {
  7836. return !!mpInstance.route;
  7837. }
  7838. function initRelation(mpInstance, detail) {
  7839. mpInstance.triggerEvent("__l", detail);
  7840. }
  7841. function handleLink(event) {
  7842. const detail = event.detail || event.value;
  7843. const vuePid = detail.vuePid;
  7844. let parentVm;
  7845. if (vuePid) {
  7846. parentVm = findVmByVueId(this.$vm, vuePid);
  7847. }
  7848. if (!parentVm) {
  7849. parentVm = this.$vm;
  7850. }
  7851. detail.parent = parentVm;
  7852. }
  7853. var parseOptions = /* @__PURE__ */ Object.freeze({
  7854. __proto__: null,
  7855. handleLink,
  7856. initLifetimes,
  7857. initRelation,
  7858. isPage,
  7859. mocks
  7860. });
  7861. const createApp = initCreateApp();
  7862. const createPage = initCreatePage(parseOptions);
  7863. const createComponent = initCreateComponent(parseOptions);
  7864. const createPluginApp = initCreatePluginApp();
  7865. const createSubpackageApp = initCreateSubpackageApp();
  7866. {
  7867. wx.createApp = global.createApp = createApp;
  7868. wx.createPage = createPage;
  7869. wx.createComponent = createComponent;
  7870. wx.createPluginApp = global.createPluginApp = createPluginApp;
  7871. wx.createSubpackageApp = global.createSubpackageApp = createSubpackageApp;
  7872. }
  7873. exports._export_sfc = _export_sfc;
  7874. exports.createSSRApp = createSSRApp;
  7875. exports.e = e;
  7876. exports.f = f;
  7877. exports.index = index;
  7878. exports.n = n;
  7879. exports.o = o;
  7880. exports.p = p;
  7881. exports.resolveComponent = resolveComponent;
  7882. exports.t = t;
  7883. exports.wx$1 = wx$1;
  7884. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map