vendor.js 302 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!************************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  6. \************************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. /* WEBPACK VAR INJECTION */(function(global) {Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.createPlugin = createPlugin;exports.createSubpackageApp = createSubpackageApp;exports.default = void 0;var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 3);
  11. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 4));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}
  12. var realAtob;
  13. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  14. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  15. if (typeof atob !== 'function') {
  16. realAtob = function realAtob(str) {
  17. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  18. if (!b64re.test(str)) {throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");}
  19. // Adding the padding if missing, for semplicity
  20. str += '=='.slice(2 - (str.length & 3));
  21. var bitmap;var result = '';var r1;var r2;var i = 0;
  22. for (; i < str.length;) {
  23. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 |
  24. (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  25. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) :
  26. r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) :
  27. String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  28. }
  29. return result;
  30. };
  31. } else {
  32. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  33. realAtob = atob;
  34. }
  35. function b64DecodeUnicode(str) {
  36. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  37. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  38. }).join(''));
  39. }
  40. function getCurrentUserInfo() {
  41. var token = wx.getStorageSync('uni_id_token') || '';
  42. var tokenArr = token.split('.');
  43. if (!token || tokenArr.length !== 3) {
  44. return {
  45. uid: null,
  46. role: [],
  47. permission: [],
  48. tokenExpired: 0 };
  49. }
  50. var userInfo;
  51. try {
  52. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  53. } catch (error) {
  54. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  55. }
  56. userInfo.tokenExpired = userInfo.exp * 1000;
  57. delete userInfo.exp;
  58. delete userInfo.iat;
  59. return userInfo;
  60. }
  61. function uniIdMixin(Vue) {
  62. Vue.prototype.uniIDHasRole = function (roleId) {var _getCurrentUserInfo =
  63. getCurrentUserInfo(),role = _getCurrentUserInfo.role;
  64. return role.indexOf(roleId) > -1;
  65. };
  66. Vue.prototype.uniIDHasPermission = function (permissionId) {var _getCurrentUserInfo2 =
  67. getCurrentUserInfo(),permission = _getCurrentUserInfo2.permission;
  68. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  69. };
  70. Vue.prototype.uniIDTokenValid = function () {var _getCurrentUserInfo3 =
  71. getCurrentUserInfo(),tokenExpired = _getCurrentUserInfo3.tokenExpired;
  72. return tokenExpired > Date.now();
  73. };
  74. }
  75. var _toString = Object.prototype.toString;
  76. var hasOwnProperty = Object.prototype.hasOwnProperty;
  77. function isFn(fn) {
  78. return typeof fn === 'function';
  79. }
  80. function isStr(str) {
  81. return typeof str === 'string';
  82. }
  83. function isPlainObject(obj) {
  84. return _toString.call(obj) === '[object Object]';
  85. }
  86. function hasOwn(obj, key) {
  87. return hasOwnProperty.call(obj, key);
  88. }
  89. function noop() {}
  90. /**
  91. * Create a cached version of a pure function.
  92. */
  93. function cached(fn) {
  94. var cache = Object.create(null);
  95. return function cachedFn(str) {
  96. var hit = cache[str];
  97. return hit || (cache[str] = fn(str));
  98. };
  99. }
  100. /**
  101. * Camelize a hyphen-delimited string.
  102. */
  103. var camelizeRE = /-(\w)/g;
  104. var camelize = cached(function (str) {
  105. return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';});
  106. });
  107. function sortObject(obj) {
  108. var sortObj = {};
  109. if (isPlainObject(obj)) {
  110. Object.keys(obj).sort().forEach(function (key) {
  111. sortObj[key] = obj[key];
  112. });
  113. }
  114. return !Object.keys(sortObj) ? obj : sortObj;
  115. }
  116. var HOOKS = [
  117. 'invoke',
  118. 'success',
  119. 'fail',
  120. 'complete',
  121. 'returnValue'];
  122. var globalInterceptors = {};
  123. var scopedInterceptors = {};
  124. function mergeHook(parentVal, childVal) {
  125. var res = childVal ?
  126. parentVal ?
  127. parentVal.concat(childVal) :
  128. Array.isArray(childVal) ?
  129. childVal : [childVal] :
  130. parentVal;
  131. return res ?
  132. dedupeHooks(res) :
  133. res;
  134. }
  135. function dedupeHooks(hooks) {
  136. var res = [];
  137. for (var i = 0; i < hooks.length; i++) {
  138. if (res.indexOf(hooks[i]) === -1) {
  139. res.push(hooks[i]);
  140. }
  141. }
  142. return res;
  143. }
  144. function removeHook(hooks, hook) {
  145. var index = hooks.indexOf(hook);
  146. if (index !== -1) {
  147. hooks.splice(index, 1);
  148. }
  149. }
  150. function mergeInterceptorHook(interceptor, option) {
  151. Object.keys(option).forEach(function (hook) {
  152. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  153. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  154. }
  155. });
  156. }
  157. function removeInterceptorHook(interceptor, option) {
  158. if (!interceptor || !option) {
  159. return;
  160. }
  161. Object.keys(option).forEach(function (hook) {
  162. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  163. removeHook(interceptor[hook], option[hook]);
  164. }
  165. });
  166. }
  167. function addInterceptor(method, option) {
  168. if (typeof method === 'string' && isPlainObject(option)) {
  169. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  170. } else if (isPlainObject(method)) {
  171. mergeInterceptorHook(globalInterceptors, method);
  172. }
  173. }
  174. function removeInterceptor(method, option) {
  175. if (typeof method === 'string') {
  176. if (isPlainObject(option)) {
  177. removeInterceptorHook(scopedInterceptors[method], option);
  178. } else {
  179. delete scopedInterceptors[method];
  180. }
  181. } else if (isPlainObject(method)) {
  182. removeInterceptorHook(globalInterceptors, method);
  183. }
  184. }
  185. function wrapperHook(hook) {
  186. return function (data) {
  187. return hook(data) || data;
  188. };
  189. }
  190. function isPromise(obj) {
  191. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  192. }
  193. function queue(hooks, data) {
  194. var promise = false;
  195. for (var i = 0; i < hooks.length; i++) {
  196. var hook = hooks[i];
  197. if (promise) {
  198. promise = Promise.resolve(wrapperHook(hook));
  199. } else {
  200. var res = hook(data);
  201. if (isPromise(res)) {
  202. promise = Promise.resolve(res);
  203. }
  204. if (res === false) {
  205. return {
  206. then: function then() {} };
  207. }
  208. }
  209. }
  210. return promise || {
  211. then: function then(callback) {
  212. return callback(data);
  213. } };
  214. }
  215. function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  216. ['success', 'fail', 'complete'].forEach(function (name) {
  217. if (Array.isArray(interceptor[name])) {
  218. var oldCallback = options[name];
  219. options[name] = function callbackInterceptor(res) {
  220. queue(interceptor[name], res).then(function (res) {
  221. /* eslint-disable no-mixed-operators */
  222. return isFn(oldCallback) && oldCallback(res) || res;
  223. });
  224. };
  225. }
  226. });
  227. return options;
  228. }
  229. function wrapperReturnValue(method, returnValue) {
  230. var returnValueHooks = [];
  231. if (Array.isArray(globalInterceptors.returnValue)) {
  232. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  233. }
  234. var interceptor = scopedInterceptors[method];
  235. if (interceptor && Array.isArray(interceptor.returnValue)) {
  236. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  237. }
  238. returnValueHooks.forEach(function (hook) {
  239. returnValue = hook(returnValue) || returnValue;
  240. });
  241. return returnValue;
  242. }
  243. function getApiInterceptorHooks(method) {
  244. var interceptor = Object.create(null);
  245. Object.keys(globalInterceptors).forEach(function (hook) {
  246. if (hook !== 'returnValue') {
  247. interceptor[hook] = globalInterceptors[hook].slice();
  248. }
  249. });
  250. var scopedInterceptor = scopedInterceptors[method];
  251. if (scopedInterceptor) {
  252. Object.keys(scopedInterceptor).forEach(function (hook) {
  253. if (hook !== 'returnValue') {
  254. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  255. }
  256. });
  257. }
  258. return interceptor;
  259. }
  260. function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];}
  261. var interceptor = getApiInterceptorHooks(method);
  262. if (interceptor && Object.keys(interceptor).length) {
  263. if (Array.isArray(interceptor.invoke)) {
  264. var res = queue(interceptor.invoke, options);
  265. return res.then(function (options) {
  266. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  267. });
  268. } else {
  269. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  270. }
  271. }
  272. return api.apply(void 0, [options].concat(params));
  273. }
  274. var promiseInterceptor = {
  275. returnValue: function returnValue(res) {
  276. if (!isPromise(res)) {
  277. return res;
  278. }
  279. return new Promise(function (resolve, reject) {
  280. res.then(function (res) {
  281. if (res[0]) {
  282. reject(res[0]);
  283. } else {
  284. resolve(res[1]);
  285. }
  286. });
  287. });
  288. } };
  289. var SYNC_API_RE =
  290. /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting/;
  291. var CONTEXT_API_RE = /^create|Manager$/;
  292. // Context例外情况
  293. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  294. // 同步例外情况
  295. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  296. var CALLBACK_API_RE = /^on|^off/;
  297. function isContextApi(name) {
  298. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  299. }
  300. function isSyncApi(name) {
  301. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  302. }
  303. function isCallbackApi(name) {
  304. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  305. }
  306. function handlePromise(promise) {
  307. return promise.then(function (data) {
  308. return [null, data];
  309. }).
  310. catch(function (err) {return [err];});
  311. }
  312. function shouldPromise(name) {
  313. if (
  314. isContextApi(name) ||
  315. isSyncApi(name) ||
  316. isCallbackApi(name))
  317. {
  318. return false;
  319. }
  320. return true;
  321. }
  322. /* eslint-disable no-extend-native */
  323. if (!Promise.prototype.finally) {
  324. Promise.prototype.finally = function (callback) {
  325. var promise = this.constructor;
  326. return this.then(
  327. function (value) {return promise.resolve(callback()).then(function () {return value;});},
  328. function (reason) {return promise.resolve(callback()).then(function () {
  329. throw reason;
  330. });});
  331. };
  332. }
  333. function promisify(name, api) {
  334. if (!shouldPromise(name)) {
  335. return api;
  336. }
  337. return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];}
  338. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  339. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  340. }
  341. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  342. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  343. success: resolve,
  344. fail: reject })].concat(
  345. params));
  346. })));
  347. };
  348. }
  349. var EPS = 1e-4;
  350. var BASE_DEVICE_WIDTH = 750;
  351. var isIOS = false;
  352. var deviceWidth = 0;
  353. var deviceDPR = 0;
  354. function checkDeviceWidth() {var _wx$getSystemInfoSync =
  355. wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  356. deviceWidth = windowWidth;
  357. deviceDPR = pixelRatio;
  358. isIOS = platform === 'ios';
  359. }
  360. function upx2px(number, newDeviceWidth) {
  361. if (deviceWidth === 0) {
  362. checkDeviceWidth();
  363. }
  364. number = Number(number);
  365. if (number === 0) {
  366. return 0;
  367. }
  368. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  369. if (result < 0) {
  370. result = -result;
  371. }
  372. result = Math.floor(result + EPS);
  373. if (result === 0) {
  374. if (deviceDPR === 1 || !isIOS) {
  375. result = 1;
  376. } else {
  377. result = 0.5;
  378. }
  379. }
  380. return number < 0 ? -result : result;
  381. }
  382. var LOCALE_ZH_HANS = 'zh-Hans';
  383. var LOCALE_ZH_HANT = 'zh-Hant';
  384. var LOCALE_EN = 'en';
  385. var LOCALE_FR = 'fr';
  386. var LOCALE_ES = 'es';
  387. var messages = {};
  388. var locale;
  389. {
  390. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  391. }
  392. function initI18nMessages() {
  393. if (!isEnableLocale()) {
  394. return;
  395. }
  396. var localeKeys = Object.keys(__uniConfig.locales);
  397. if (localeKeys.length) {
  398. localeKeys.forEach(function (locale) {
  399. var curMessages = messages[locale];
  400. var userMessages = __uniConfig.locales[locale];
  401. if (curMessages) {
  402. Object.assign(curMessages, userMessages);
  403. } else {
  404. messages[locale] = userMessages;
  405. }
  406. });
  407. }
  408. }
  409. initI18nMessages();
  410. var i18n = (0, _uniI18n.initVueI18n)(
  411. locale,
  412. {});
  413. var t = i18n.t;
  414. var i18nMixin = i18n.mixin = {
  415. beforeCreate: function beforeCreate() {var _this = this;
  416. var unwatch = i18n.i18n.watchLocale(function () {
  417. _this.$forceUpdate();
  418. });
  419. this.$once('hook:beforeDestroy', function () {
  420. unwatch();
  421. });
  422. },
  423. methods: {
  424. $$t: function $$t(key, values) {
  425. return t(key, values);
  426. } } };
  427. var setLocale = i18n.setLocale;
  428. var getLocale = i18n.getLocale;
  429. function initAppLocale(Vue, appVm, locale) {
  430. var state = Vue.observable({
  431. locale: locale || i18n.getLocale() });
  432. var localeWatchers = [];
  433. appVm.$watchLocale = function (fn) {
  434. localeWatchers.push(fn);
  435. };
  436. Object.defineProperty(appVm, '$locale', {
  437. get: function get() {
  438. return state.locale;
  439. },
  440. set: function set(v) {
  441. state.locale = v;
  442. localeWatchers.forEach(function (watch) {return watch(v);});
  443. } });
  444. }
  445. function isEnableLocale() {
  446. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  447. }
  448. function include(str, parts) {
  449. return !!parts.find(function (part) {return str.indexOf(part) !== -1;});
  450. }
  451. function startsWith(str, parts) {
  452. return parts.find(function (part) {return str.indexOf(part) === 0;});
  453. }
  454. function normalizeLocale(locale, messages) {
  455. if (!locale) {
  456. return;
  457. }
  458. locale = locale.trim().replace(/_/g, '-');
  459. if (messages && messages[locale]) {
  460. return locale;
  461. }
  462. locale = locale.toLowerCase();
  463. if (locale === 'chinese') {
  464. // 支付宝
  465. return LOCALE_ZH_HANS;
  466. }
  467. if (locale.indexOf('zh') === 0) {
  468. if (locale.indexOf('-hans') > -1) {
  469. return LOCALE_ZH_HANS;
  470. }
  471. if (locale.indexOf('-hant') > -1) {
  472. return LOCALE_ZH_HANT;
  473. }
  474. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  475. return LOCALE_ZH_HANT;
  476. }
  477. return LOCALE_ZH_HANS;
  478. }
  479. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  480. if (lang) {
  481. return lang;
  482. }
  483. }
  484. // export function initI18n() {
  485. // const localeKeys = Object.keys(__uniConfig.locales || {})
  486. // if (localeKeys.length) {
  487. // localeKeys.forEach((locale) =>
  488. // i18n.add(locale, __uniConfig.locales[locale])
  489. // )
  490. // }
  491. // }
  492. function getLocale$1() {
  493. // 优先使用 $locale
  494. var app = getApp({
  495. allowDefault: true });
  496. if (app && app.$vm) {
  497. return app.$vm.$locale;
  498. }
  499. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  500. }
  501. function setLocale$1(locale) {
  502. var app = getApp();
  503. if (!app) {
  504. return false;
  505. }
  506. var oldLocale = app.$vm.$locale;
  507. if (oldLocale !== locale) {
  508. app.$vm.$locale = locale;
  509. onLocaleChangeCallbacks.forEach(function (fn) {return fn({
  510. locale: locale });});
  511. return true;
  512. }
  513. return false;
  514. }
  515. var onLocaleChangeCallbacks = [];
  516. function onLocaleChange(fn) {
  517. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  518. onLocaleChangeCallbacks.push(fn);
  519. }
  520. }
  521. if (typeof global !== 'undefined') {
  522. global.getLocale = getLocale$1;
  523. }
  524. var interceptors = {
  525. promiseInterceptor: promiseInterceptor };
  526. var baseApi = /*#__PURE__*/Object.freeze({
  527. __proto__: null,
  528. upx2px: upx2px,
  529. getLocale: getLocale$1,
  530. setLocale: setLocale$1,
  531. onLocaleChange: onLocaleChange,
  532. addInterceptor: addInterceptor,
  533. removeInterceptor: removeInterceptor,
  534. interceptors: interceptors });
  535. function findExistsPageIndex(url) {
  536. var pages = getCurrentPages();
  537. var len = pages.length;
  538. while (len--) {
  539. var page = pages[len];
  540. if (page.$page && page.$page.fullPath === url) {
  541. return len;
  542. }
  543. }
  544. return -1;
  545. }
  546. var redirectTo = {
  547. name: function name(fromArgs) {
  548. if (fromArgs.exists === 'back' && fromArgs.delta) {
  549. return 'navigateBack';
  550. }
  551. return 'redirectTo';
  552. },
  553. args: function args(fromArgs) {
  554. if (fromArgs.exists === 'back' && fromArgs.url) {
  555. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  556. if (existsPageIndex !== -1) {
  557. var delta = getCurrentPages().length - 1 - existsPageIndex;
  558. if (delta > 0) {
  559. fromArgs.delta = delta;
  560. }
  561. }
  562. }
  563. } };
  564. var previewImage = {
  565. args: function args(fromArgs) {
  566. var currentIndex = parseInt(fromArgs.current);
  567. if (isNaN(currentIndex)) {
  568. return;
  569. }
  570. var urls = fromArgs.urls;
  571. if (!Array.isArray(urls)) {
  572. return;
  573. }
  574. var len = urls.length;
  575. if (!len) {
  576. return;
  577. }
  578. if (currentIndex < 0) {
  579. currentIndex = 0;
  580. } else if (currentIndex >= len) {
  581. currentIndex = len - 1;
  582. }
  583. if (currentIndex > 0) {
  584. fromArgs.current = urls[currentIndex];
  585. fromArgs.urls = urls.filter(
  586. function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;});
  587. } else {
  588. fromArgs.current = urls[0];
  589. }
  590. return {
  591. indicator: false,
  592. loop: false };
  593. } };
  594. var UUID_KEY = '__DC_STAT_UUID';
  595. var deviceId;
  596. function useDeviceId(result) {
  597. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  598. if (!deviceId) {
  599. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  600. wx.setStorage({
  601. key: UUID_KEY,
  602. data: deviceId });
  603. }
  604. result.deviceId = deviceId;
  605. }
  606. function addSafeAreaInsets(result) {
  607. if (result.safeArea) {
  608. var safeArea = result.safeArea;
  609. result.safeAreaInsets = {
  610. top: safeArea.top,
  611. left: safeArea.left,
  612. right: result.windowWidth - safeArea.right,
  613. bottom: result.screenHeight - safeArea.bottom };
  614. }
  615. }
  616. function populateParameters(result) {var _result$brand =
  617. result.brand,brand = _result$brand === void 0 ? '' : _result$brand,_result$model = result.model,model = _result$model === void 0 ? '' : _result$model,_result$system = result.system,system = _result$system === void 0 ? '' : _result$system,_result$language = result.language,language = _result$language === void 0 ? '' : _result$language,theme = result.theme,version = result.version,platform = result.platform,fontSizeSetting = result.fontSizeSetting,SDKVersion = result.SDKVersion,pixelRatio = result.pixelRatio,deviceOrientation = result.deviceOrientation;
  618. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  619. // osName osVersion
  620. var osName = '';
  621. var osVersion = '';
  622. {
  623. osName = system.split(' ')[0] || '';
  624. osVersion = system.split(' ')[1] || '';
  625. }
  626. var hostVersion = version;
  627. // deviceType
  628. var deviceType = getGetDeviceType(result, model);
  629. // deviceModel
  630. var deviceBrand = getDeviceBrand(brand);
  631. // hostName
  632. var _hostName = getHostName(result);
  633. // deviceOrientation
  634. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  635. // devicePixelRatio
  636. var _devicePixelRatio = pixelRatio;
  637. // SDKVersion
  638. var _SDKVersion = SDKVersion;
  639. // hostLanguage
  640. var hostLanguage = language.replace(/_/g, '-');
  641. // wx.getAccountInfoSync
  642. var parameters = {
  643. appId: "__UNI__B8A04E2",
  644. appName: "aaa",
  645. appVersion: "1.0.0",
  646. appVersionCode: "100",
  647. appLanguage: getAppLanguage(hostLanguage),
  648. uniCompileVersion: "3.6.4",
  649. uniRuntimeVersion: "3.6.4",
  650. uniPlatform: undefined || "mp-weixin",
  651. deviceBrand: deviceBrand,
  652. deviceModel: model,
  653. deviceType: deviceType,
  654. devicePixelRatio: _devicePixelRatio,
  655. deviceOrientation: _deviceOrientation,
  656. osName: osName.toLocaleLowerCase(),
  657. osVersion: osVersion,
  658. hostTheme: theme,
  659. hostVersion: hostVersion,
  660. hostLanguage: hostLanguage,
  661. hostName: _hostName,
  662. hostSDKVersion: _SDKVersion,
  663. hostFontSizeSetting: fontSizeSetting,
  664. windowTop: 0,
  665. windowBottom: 0,
  666. // TODO
  667. osLanguage: undefined,
  668. osTheme: undefined,
  669. ua: undefined,
  670. hostPackageName: undefined,
  671. browserName: undefined,
  672. browserVersion: undefined };
  673. Object.assign(result, parameters);
  674. }
  675. function getGetDeviceType(result, model) {
  676. var deviceType = result.deviceType || 'phone';
  677. {
  678. var deviceTypeMaps = {
  679. ipad: 'pad',
  680. windows: 'pc',
  681. mac: 'pc' };
  682. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  683. var _model = model.toLocaleLowerCase();
  684. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  685. var _m = deviceTypeMapsKeys[index];
  686. if (_model.indexOf(_m) !== -1) {
  687. deviceType = deviceTypeMaps[_m];
  688. break;
  689. }
  690. }
  691. }
  692. return deviceType;
  693. }
  694. function getDeviceBrand(brand) {
  695. var deviceBrand = brand;
  696. if (deviceBrand) {
  697. deviceBrand = brand.toLocaleLowerCase();
  698. }
  699. return deviceBrand;
  700. }
  701. function getAppLanguage(defaultLanguage) {
  702. return getLocale$1 ?
  703. getLocale$1() :
  704. defaultLanguage;
  705. }
  706. function getHostName(result) {
  707. var _platform = 'WeChat';
  708. var _hostName = result.hostName || _platform; // mp-jd
  709. {
  710. if (result.environment) {
  711. _hostName = result.environment;
  712. } else if (result.host && result.host.env) {
  713. _hostName = result.host.env;
  714. }
  715. }
  716. return _hostName;
  717. }
  718. var getSystemInfo = {
  719. returnValue: function returnValue(result) {
  720. useDeviceId(result);
  721. addSafeAreaInsets(result);
  722. populateParameters(result);
  723. } };
  724. var showActionSheet = {
  725. args: function args(fromArgs) {
  726. if (typeof fromArgs === 'object') {
  727. fromArgs.alertText = fromArgs.title;
  728. }
  729. } };
  730. var getAppBaseInfo = {
  731. returnValue: function returnValue(result) {var _result =
  732. result,version = _result.version,language = _result.language,SDKVersion = _result.SDKVersion,theme = _result.theme;
  733. var _hostName = getHostName(result);
  734. var hostLanguage = language.replace('_', '-');
  735. result = sortObject(Object.assign(result, {
  736. appId: "__UNI__B8A04E2",
  737. appName: "aaa",
  738. appVersion: "1.0.0",
  739. appVersionCode: "100",
  740. appLanguage: getAppLanguage(hostLanguage),
  741. hostVersion: version,
  742. hostLanguage: hostLanguage,
  743. hostName: _hostName,
  744. hostSDKVersion: SDKVersion,
  745. hostTheme: theme }));
  746. } };
  747. var getDeviceInfo = {
  748. returnValue: function returnValue(result) {var _result2 =
  749. result,brand = _result2.brand,model = _result2.model;
  750. var deviceType = getGetDeviceType(result, model);
  751. var deviceBrand = getDeviceBrand(brand);
  752. useDeviceId(result);
  753. result = sortObject(Object.assign(result, {
  754. deviceType: deviceType,
  755. deviceBrand: deviceBrand,
  756. deviceModel: model }));
  757. } };
  758. var getWindowInfo = {
  759. returnValue: function returnValue(result) {
  760. addSafeAreaInsets(result);
  761. result = sortObject(Object.assign(result, {
  762. windowTop: 0,
  763. windowBottom: 0 }));
  764. } };
  765. var getAppAuthorizeSetting = {
  766. returnValue: function returnValue(result) {var
  767. locationReducedAccuracy = result.locationReducedAccuracy;
  768. result.locationAccuracy = 'unsupported';
  769. if (locationReducedAccuracy === true) {
  770. result.locationAccuracy = 'reduced';
  771. } else if (locationReducedAccuracy === false) {
  772. result.locationAccuracy = 'full';
  773. }
  774. } };
  775. // import navigateTo from 'uni-helpers/navigate-to'
  776. var protocols = {
  777. redirectTo: redirectTo,
  778. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  779. previewImage: previewImage,
  780. getSystemInfo: getSystemInfo,
  781. getSystemInfoSync: getSystemInfo,
  782. showActionSheet: showActionSheet,
  783. getAppBaseInfo: getAppBaseInfo,
  784. getDeviceInfo: getDeviceInfo,
  785. getWindowInfo: getWindowInfo,
  786. getAppAuthorizeSetting: getAppAuthorizeSetting };
  787. var todos = [
  788. 'vibrate',
  789. 'preloadPage',
  790. 'unPreloadPage',
  791. 'loadSubPackage'];
  792. var canIUses = [];
  793. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  794. function processCallback(methodName, method, returnValue) {
  795. return function (res) {
  796. return method(processReturnValue(methodName, res, returnValue));
  797. };
  798. }
  799. function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  800. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  801. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  802. if (isFn(argsOption)) {
  803. argsOption = argsOption(fromArgs, toArgs) || {};
  804. }
  805. for (var key in fromArgs) {
  806. if (hasOwn(argsOption, key)) {
  807. var keyOption = argsOption[key];
  808. if (isFn(keyOption)) {
  809. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  810. }
  811. if (!keyOption) {// 不支持的参数
  812. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  813. } else if (isStr(keyOption)) {// 重写参数 key
  814. toArgs[keyOption] = fromArgs[key];
  815. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  816. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  817. }
  818. } else if (CALLBACKS.indexOf(key) !== -1) {
  819. if (isFn(fromArgs[key])) {
  820. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  821. }
  822. } else {
  823. if (!keepFromArgs) {
  824. toArgs[key] = fromArgs[key];
  825. }
  826. }
  827. }
  828. return toArgs;
  829. } else if (isFn(fromArgs)) {
  830. fromArgs = processCallback(methodName, fromArgs, returnValue);
  831. }
  832. return fromArgs;
  833. }
  834. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  835. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  836. res = protocols.returnValue(methodName, res);
  837. }
  838. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  839. }
  840. function wrapper(methodName, method) {
  841. if (hasOwn(protocols, methodName)) {
  842. var protocol = protocols[methodName];
  843. if (!protocol) {// 暂不支持的 api
  844. return function () {
  845. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  846. };
  847. }
  848. return function (arg1, arg2) {// 目前 api 最多两个参数
  849. var options = protocol;
  850. if (isFn(protocol)) {
  851. options = protocol(arg1);
  852. }
  853. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  854. var args = [arg1];
  855. if (typeof arg2 !== 'undefined') {
  856. args.push(arg2);
  857. }
  858. if (isFn(options.name)) {
  859. methodName = options.name(arg1);
  860. } else if (isStr(options.name)) {
  861. methodName = options.name;
  862. }
  863. var returnValue = wx[methodName].apply(wx, args);
  864. if (isSyncApi(methodName)) {// 同步 api
  865. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  866. }
  867. return returnValue;
  868. };
  869. }
  870. return method;
  871. }
  872. var todoApis = Object.create(null);
  873. var TODOS = [
  874. 'onTabBarMidButtonTap',
  875. 'subscribePush',
  876. 'unsubscribePush',
  877. 'onPush',
  878. 'offPush',
  879. 'share'];
  880. function createTodoApi(name) {
  881. return function todoApi(_ref)
  882. {var fail = _ref.fail,complete = _ref.complete;
  883. var res = {
  884. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported") };
  885. isFn(fail) && fail(res);
  886. isFn(complete) && complete(res);
  887. };
  888. }
  889. TODOS.forEach(function (name) {
  890. todoApis[name] = createTodoApi(name);
  891. });
  892. var providers = {
  893. oauth: ['weixin'],
  894. share: ['weixin'],
  895. payment: ['wxpay'],
  896. push: ['weixin'] };
  897. function getProvider(_ref2)
  898. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  899. var res = false;
  900. if (providers[service]) {
  901. res = {
  902. errMsg: 'getProvider:ok',
  903. service: service,
  904. provider: providers[service] };
  905. isFn(success) && success(res);
  906. } else {
  907. res = {
  908. errMsg: 'getProvider:fail service not found' };
  909. isFn(fail) && fail(res);
  910. }
  911. isFn(complete) && complete(res);
  912. }
  913. var extraApi = /*#__PURE__*/Object.freeze({
  914. __proto__: null,
  915. getProvider: getProvider });
  916. var getEmitter = function () {
  917. var Emitter;
  918. return function getUniEmitter() {
  919. if (!Emitter) {
  920. Emitter = new _vue.default();
  921. }
  922. return Emitter;
  923. };
  924. }();
  925. function apply(ctx, method, args) {
  926. return ctx[method].apply(ctx, args);
  927. }
  928. function $on() {
  929. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  930. }
  931. function $off() {
  932. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  933. }
  934. function $once() {
  935. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  936. }
  937. function $emit() {
  938. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  939. }
  940. var eventApi = /*#__PURE__*/Object.freeze({
  941. __proto__: null,
  942. $on: $on,
  943. $off: $off,
  944. $once: $once,
  945. $emit: $emit });
  946. /**
  947. * 框架内 try-catch
  948. */
  949. /**
  950. * 开发者 try-catch
  951. */
  952. function tryCatch(fn) {
  953. return function () {
  954. try {
  955. return fn.apply(fn, arguments);
  956. } catch (e) {
  957. // TODO
  958. console.error(e);
  959. }
  960. };
  961. }
  962. function getApiCallbacks(params) {
  963. var apiCallbacks = {};
  964. for (var name in params) {
  965. var param = params[name];
  966. if (isFn(param)) {
  967. apiCallbacks[name] = tryCatch(param);
  968. delete params[name];
  969. }
  970. }
  971. return apiCallbacks;
  972. }
  973. var cid;
  974. var cidErrMsg;
  975. var enabled;
  976. function normalizePushMessage(message) {
  977. try {
  978. return JSON.parse(message);
  979. } catch (e) {}
  980. return message;
  981. }
  982. function invokePushCallback(
  983. args)
  984. {
  985. if (args.type === 'enabled') {
  986. enabled = true;
  987. } else if (args.type === 'clientId') {
  988. cid = args.cid;
  989. cidErrMsg = args.errMsg;
  990. invokeGetPushCidCallbacks(cid, args.errMsg);
  991. } else if (args.type === 'pushMsg') {
  992. var message = {
  993. type: 'receive',
  994. data: normalizePushMessage(args.message) };
  995. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  996. var callback = onPushMessageCallbacks[i];
  997. callback(message);
  998. // 该消息已被阻止
  999. if (message.stopped) {
  1000. break;
  1001. }
  1002. }
  1003. } else if (args.type === 'click') {
  1004. onPushMessageCallbacks.forEach(function (callback) {
  1005. callback({
  1006. type: 'click',
  1007. data: normalizePushMessage(args.message) });
  1008. });
  1009. }
  1010. }
  1011. var getPushCidCallbacks = [];
  1012. function invokeGetPushCidCallbacks(cid, errMsg) {
  1013. getPushCidCallbacks.forEach(function (callback) {
  1014. callback(cid, errMsg);
  1015. });
  1016. getPushCidCallbacks.length = 0;
  1017. }
  1018. function getPushClientId(args) {
  1019. if (!isPlainObject(args)) {
  1020. args = {};
  1021. }var _getApiCallbacks =
  1022. getApiCallbacks(args),success = _getApiCallbacks.success,fail = _getApiCallbacks.fail,complete = _getApiCallbacks.complete;
  1023. var hasSuccess = isFn(success);
  1024. var hasFail = isFn(fail);
  1025. var hasComplete = isFn(complete);
  1026. Promise.resolve().then(function () {
  1027. if (typeof enabled === 'undefined') {
  1028. enabled = false;
  1029. cid = '';
  1030. cidErrMsg = 'uniPush is not enabled';
  1031. }
  1032. getPushCidCallbacks.push(function (cid, errMsg) {
  1033. var res;
  1034. if (cid) {
  1035. res = {
  1036. errMsg: 'getPushClientId:ok',
  1037. cid: cid };
  1038. hasSuccess && success(res);
  1039. } else {
  1040. res = {
  1041. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
  1042. hasFail && fail(res);
  1043. }
  1044. hasComplete && complete(res);
  1045. });
  1046. if (typeof cid !== 'undefined') {
  1047. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1048. }
  1049. });
  1050. }
  1051. var onPushMessageCallbacks = [];
  1052. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1053. var onPushMessage = function onPushMessage(fn) {
  1054. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1055. onPushMessageCallbacks.push(fn);
  1056. }
  1057. };
  1058. var offPushMessage = function offPushMessage(fn) {
  1059. if (!fn) {
  1060. onPushMessageCallbacks.length = 0;
  1061. } else {
  1062. var index = onPushMessageCallbacks.indexOf(fn);
  1063. if (index > -1) {
  1064. onPushMessageCallbacks.splice(index, 1);
  1065. }
  1066. }
  1067. };
  1068. var api = /*#__PURE__*/Object.freeze({
  1069. __proto__: null,
  1070. getPushClientId: getPushClientId,
  1071. onPushMessage: onPushMessage,
  1072. offPushMessage: offPushMessage,
  1073. invokePushCallback: invokePushCallback });
  1074. var MPPage = Page;
  1075. var MPComponent = Component;
  1076. var customizeRE = /:/g;
  1077. var customize = cached(function (str) {
  1078. return camelize(str.replace(customizeRE, '-'));
  1079. });
  1080. function initTriggerEvent(mpInstance) {
  1081. var oldTriggerEvent = mpInstance.triggerEvent;
  1082. var newTriggerEvent = function newTriggerEvent(event) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}
  1083. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  1084. if (this.$vm || this.dataset && this.dataset.comType) {
  1085. event = customize(event);
  1086. } else {
  1087. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  1088. var newEvent = customize(event);
  1089. if (newEvent !== event) {
  1090. oldTriggerEvent.apply(this, [newEvent].concat(args));
  1091. }
  1092. }
  1093. return oldTriggerEvent.apply(this, [event].concat(args));
  1094. };
  1095. try {
  1096. // 京东小程序 triggerEvent 为只读
  1097. mpInstance.triggerEvent = newTriggerEvent;
  1098. } catch (error) {
  1099. mpInstance._triggerEvent = newTriggerEvent;
  1100. }
  1101. }
  1102. function initHook(name, options, isComponent) {
  1103. var oldHook = options[name];
  1104. if (!oldHook) {
  1105. options[name] = function () {
  1106. initTriggerEvent(this);
  1107. };
  1108. } else {
  1109. options[name] = function () {
  1110. initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}
  1111. return oldHook.apply(this, args);
  1112. };
  1113. }
  1114. }
  1115. if (!MPPage.__$wrappered) {
  1116. MPPage.__$wrappered = true;
  1117. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1118. initHook('onLoad', options);
  1119. return MPPage(options);
  1120. };
  1121. Page.after = MPPage.after;
  1122. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1123. initHook('created', options);
  1124. return MPComponent(options);
  1125. };
  1126. }
  1127. var PAGE_EVENT_HOOKS = [
  1128. 'onPullDownRefresh',
  1129. 'onReachBottom',
  1130. 'onAddToFavorites',
  1131. 'onShareTimeline',
  1132. 'onShareAppMessage',
  1133. 'onPageScroll',
  1134. 'onResize',
  1135. 'onTabItemTap'];
  1136. function initMocks(vm, mocks) {
  1137. var mpInstance = vm.$mp[vm.mpType];
  1138. mocks.forEach(function (mock) {
  1139. if (hasOwn(mpInstance, mock)) {
  1140. vm[mock] = mpInstance[mock];
  1141. }
  1142. });
  1143. }
  1144. function hasHook(hook, vueOptions) {
  1145. if (!vueOptions) {
  1146. return true;
  1147. }
  1148. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1149. return true;
  1150. }
  1151. vueOptions = vueOptions.default || vueOptions;
  1152. if (isFn(vueOptions)) {
  1153. if (isFn(vueOptions.extendOptions[hook])) {
  1154. return true;
  1155. }
  1156. if (vueOptions.super &&
  1157. vueOptions.super.options &&
  1158. Array.isArray(vueOptions.super.options[hook])) {
  1159. return true;
  1160. }
  1161. return false;
  1162. }
  1163. if (isFn(vueOptions[hook])) {
  1164. return true;
  1165. }
  1166. var mixins = vueOptions.mixins;
  1167. if (Array.isArray(mixins)) {
  1168. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  1169. }
  1170. }
  1171. function initHooks(mpOptions, hooks, vueOptions) {
  1172. hooks.forEach(function (hook) {
  1173. if (hasHook(hook, vueOptions)) {
  1174. mpOptions[hook] = function (args) {
  1175. return this.$vm && this.$vm.__call_hook(hook, args);
  1176. };
  1177. }
  1178. });
  1179. }
  1180. function initUnknownHooks(mpOptions, vueOptions) {var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1181. findHooks(vueOptions).forEach(function (hook) {return initHook$1(mpOptions, hook, excludes);});
  1182. }
  1183. function findHooks(vueOptions) {var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  1184. if (vueOptions) {
  1185. Object.keys(vueOptions).forEach(function (name) {
  1186. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  1187. hooks.push(name);
  1188. }
  1189. });
  1190. }
  1191. return hooks;
  1192. }
  1193. function initHook$1(mpOptions, hook, excludes) {
  1194. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  1195. mpOptions[hook] = function (args) {
  1196. return this.$vm && this.$vm.__call_hook(hook, args);
  1197. };
  1198. }
  1199. }
  1200. function initVueComponent(Vue, vueOptions) {
  1201. vueOptions = vueOptions.default || vueOptions;
  1202. var VueComponent;
  1203. if (isFn(vueOptions)) {
  1204. VueComponent = vueOptions;
  1205. } else {
  1206. VueComponent = Vue.extend(vueOptions);
  1207. }
  1208. vueOptions = VueComponent.options;
  1209. return [VueComponent, vueOptions];
  1210. }
  1211. function initSlots(vm, vueSlots) {
  1212. if (Array.isArray(vueSlots) && vueSlots.length) {
  1213. var $slots = Object.create(null);
  1214. vueSlots.forEach(function (slotName) {
  1215. $slots[slotName] = true;
  1216. });
  1217. vm.$scopedSlots = vm.$slots = $slots;
  1218. }
  1219. }
  1220. function initVueIds(vueIds, mpInstance) {
  1221. vueIds = (vueIds || '').split(',');
  1222. var len = vueIds.length;
  1223. if (len === 1) {
  1224. mpInstance._$vueId = vueIds[0];
  1225. } else if (len === 2) {
  1226. mpInstance._$vueId = vueIds[0];
  1227. mpInstance._$vuePid = vueIds[1];
  1228. }
  1229. }
  1230. function initData(vueOptions, context) {
  1231. var data = vueOptions.data || {};
  1232. var methods = vueOptions.methods || {};
  1233. if (typeof data === 'function') {
  1234. try {
  1235. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1236. } catch (e) {
  1237. if (Object({"VUE_APP_NAME":"aaa","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1238. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1239. }
  1240. }
  1241. } else {
  1242. try {
  1243. // 对 data 格式化
  1244. data = JSON.parse(JSON.stringify(data));
  1245. } catch (e) {}
  1246. }
  1247. if (!isPlainObject(data)) {
  1248. data = {};
  1249. }
  1250. Object.keys(methods).forEach(function (methodName) {
  1251. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1252. data[methodName] = methods[methodName];
  1253. }
  1254. });
  1255. return data;
  1256. }
  1257. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1258. function createObserver(name) {
  1259. return function observer(newVal, oldVal) {
  1260. if (this.$vm) {
  1261. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1262. }
  1263. };
  1264. }
  1265. function initBehaviors(vueOptions, initBehavior) {
  1266. var vueBehaviors = vueOptions.behaviors;
  1267. var vueExtends = vueOptions.extends;
  1268. var vueMixins = vueOptions.mixins;
  1269. var vueProps = vueOptions.props;
  1270. if (!vueProps) {
  1271. vueOptions.props = vueProps = [];
  1272. }
  1273. var behaviors = [];
  1274. if (Array.isArray(vueBehaviors)) {
  1275. vueBehaviors.forEach(function (behavior) {
  1276. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1277. if (behavior === 'uni://form-field') {
  1278. if (Array.isArray(vueProps)) {
  1279. vueProps.push('name');
  1280. vueProps.push('value');
  1281. } else {
  1282. vueProps.name = {
  1283. type: String,
  1284. default: '' };
  1285. vueProps.value = {
  1286. type: [String, Number, Boolean, Array, Object, Date],
  1287. default: '' };
  1288. }
  1289. }
  1290. });
  1291. }
  1292. if (isPlainObject(vueExtends) && vueExtends.props) {
  1293. behaviors.push(
  1294. initBehavior({
  1295. properties: initProperties(vueExtends.props, true) }));
  1296. }
  1297. if (Array.isArray(vueMixins)) {
  1298. vueMixins.forEach(function (vueMixin) {
  1299. if (isPlainObject(vueMixin) && vueMixin.props) {
  1300. behaviors.push(
  1301. initBehavior({
  1302. properties: initProperties(vueMixin.props, true) }));
  1303. }
  1304. });
  1305. }
  1306. return behaviors;
  1307. }
  1308. function parsePropType(key, type, defaultValue, file) {
  1309. // [String]=>String
  1310. if (Array.isArray(type) && type.length === 1) {
  1311. return type[0];
  1312. }
  1313. return type;
  1314. }
  1315. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';var options = arguments.length > 3 ? arguments[3] : undefined;
  1316. var properties = {};
  1317. if (!isBehavior) {
  1318. properties.vueId = {
  1319. type: String,
  1320. value: '' };
  1321. {
  1322. if (options.virtualHost) {
  1323. properties.virtualHostStyle = {
  1324. type: null,
  1325. value: '' };
  1326. properties.virtualHostClass = {
  1327. type: null,
  1328. value: '' };
  1329. }
  1330. }
  1331. // scopedSlotsCompiler auto
  1332. properties.scopedSlotsCompiler = {
  1333. type: String,
  1334. value: '' };
  1335. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1336. type: null,
  1337. value: [],
  1338. observer: function observer(newVal, oldVal) {
  1339. var $slots = Object.create(null);
  1340. newVal.forEach(function (slotName) {
  1341. $slots[slotName] = true;
  1342. });
  1343. this.setData({
  1344. $slots: $slots });
  1345. } };
  1346. }
  1347. if (Array.isArray(props)) {// ['title']
  1348. props.forEach(function (key) {
  1349. properties[key] = {
  1350. type: null,
  1351. observer: createObserver(key) };
  1352. });
  1353. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  1354. Object.keys(props).forEach(function (key) {
  1355. var opts = props[key];
  1356. if (isPlainObject(opts)) {// title:{type:String,default:''}
  1357. var value = opts.default;
  1358. if (isFn(value)) {
  1359. value = value();
  1360. }
  1361. opts.type = parsePropType(key, opts.type);
  1362. properties[key] = {
  1363. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1364. value: value,
  1365. observer: createObserver(key) };
  1366. } else {// content:String
  1367. var type = parsePropType(key, opts);
  1368. properties[key] = {
  1369. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1370. observer: createObserver(key) };
  1371. }
  1372. });
  1373. }
  1374. return properties;
  1375. }
  1376. function wrapper$1(event) {
  1377. // TODO 又得兼容 mpvue 的 mp 对象
  1378. try {
  1379. event.mp = JSON.parse(JSON.stringify(event));
  1380. } catch (e) {}
  1381. event.stopPropagation = noop;
  1382. event.preventDefault = noop;
  1383. event.target = event.target || {};
  1384. if (!hasOwn(event, 'detail')) {
  1385. event.detail = {};
  1386. }
  1387. if (hasOwn(event, 'markerId')) {
  1388. event.detail = typeof event.detail === 'object' ? event.detail : {};
  1389. event.detail.markerId = event.markerId;
  1390. }
  1391. if (isPlainObject(event.detail)) {
  1392. event.target = Object.assign({}, event.target, event.detail);
  1393. }
  1394. return event;
  1395. }
  1396. function getExtraValue(vm, dataPathsArray) {
  1397. var context = vm;
  1398. dataPathsArray.forEach(function (dataPathArray) {
  1399. var dataPath = dataPathArray[0];
  1400. var value = dataPathArray[2];
  1401. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  1402. var propPath = dataPathArray[1];
  1403. var valuePath = dataPathArray[3];
  1404. var vFor;
  1405. if (Number.isInteger(dataPath)) {
  1406. vFor = dataPath;
  1407. } else if (!dataPath) {
  1408. vFor = context;
  1409. } else if (typeof dataPath === 'string' && dataPath) {
  1410. if (dataPath.indexOf('#s#') === 0) {
  1411. vFor = dataPath.substr(3);
  1412. } else {
  1413. vFor = vm.__get_value(dataPath, context);
  1414. }
  1415. }
  1416. if (Number.isInteger(vFor)) {
  1417. context = value;
  1418. } else if (!propPath) {
  1419. context = vFor[value];
  1420. } else {
  1421. if (Array.isArray(vFor)) {
  1422. context = vFor.find(function (vForItem) {
  1423. return vm.__get_value(propPath, vForItem) === value;
  1424. });
  1425. } else if (isPlainObject(vFor)) {
  1426. context = Object.keys(vFor).find(function (vForKey) {
  1427. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1428. });
  1429. } else {
  1430. console.error('v-for 暂不支持循环数据:', vFor);
  1431. }
  1432. }
  1433. if (valuePath) {
  1434. context = vm.__get_value(valuePath, context);
  1435. }
  1436. }
  1437. });
  1438. return context;
  1439. }
  1440. function processEventExtra(vm, extra, event, __args__) {
  1441. var extraObj = {};
  1442. if (Array.isArray(extra) && extra.length) {
  1443. /**
  1444. *[
  1445. * ['data.items', 'data.id', item.data.id],
  1446. * ['metas', 'id', meta.id]
  1447. *],
  1448. *[
  1449. * ['data.items', 'data.id', item.data.id],
  1450. * ['metas', 'id', meta.id]
  1451. *],
  1452. *'test'
  1453. */
  1454. extra.forEach(function (dataPath, index) {
  1455. if (typeof dataPath === 'string') {
  1456. if (!dataPath) {// model,prop.sync
  1457. extraObj['$' + index] = vm;
  1458. } else {
  1459. if (dataPath === '$event') {// $event
  1460. extraObj['$' + index] = event;
  1461. } else if (dataPath === 'arguments') {
  1462. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  1463. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  1464. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1465. } else {
  1466. extraObj['$' + index] = vm.__get_value(dataPath);
  1467. }
  1468. }
  1469. } else {
  1470. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1471. }
  1472. });
  1473. }
  1474. return extraObj;
  1475. }
  1476. function getObjByArray(arr) {
  1477. var obj = {};
  1478. for (var i = 1; i < arr.length; i++) {
  1479. var element = arr[i];
  1480. obj[element[0]] = element[1];
  1481. }
  1482. return obj;
  1483. }
  1484. function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1485. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1486. // fixed 用户直接触发 mpInstance.triggerEvent
  1487. var __args__ = isPlainObject(event.detail) ?
  1488. event.detail.__args__ || [event.detail] :
  1489. [event.detail];
  1490. if (isCustom) {// 自定义事件
  1491. isCustomMPEvent = event.currentTarget &&
  1492. event.currentTarget.dataset &&
  1493. event.currentTarget.dataset.comType === 'wx';
  1494. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  1495. if (isCustomMPEvent) {
  1496. return [event];
  1497. }
  1498. return __args__;
  1499. }
  1500. }
  1501. var extraObj = processEventExtra(vm, extra, event, __args__);
  1502. var ret = [];
  1503. args.forEach(function (arg) {
  1504. if (arg === '$event') {
  1505. if (methodName === '__set_model' && !isCustom) {// input v-model value
  1506. ret.push(event.target.value);
  1507. } else {
  1508. if (isCustom && !isCustomMPEvent) {
  1509. ret.push(__args__[0]);
  1510. } else {// wxcomponent 组件或内置组件
  1511. ret.push(event);
  1512. }
  1513. }
  1514. } else {
  1515. if (Array.isArray(arg) && arg[0] === 'o') {
  1516. ret.push(getObjByArray(arg));
  1517. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1518. ret.push(extraObj[arg]);
  1519. } else {
  1520. ret.push(arg);
  1521. }
  1522. }
  1523. });
  1524. return ret;
  1525. }
  1526. var ONCE = '~';
  1527. var CUSTOM = '^';
  1528. function isMatchEventType(eventType, optType) {
  1529. return eventType === optType ||
  1530. optType === 'regionchange' && (
  1531. eventType === 'begin' ||
  1532. eventType === 'end');
  1533. }
  1534. function getContextVm(vm) {
  1535. var $parent = vm.$parent;
  1536. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1537. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1538. $parent = $parent.$parent;
  1539. }
  1540. return $parent && $parent.$parent;
  1541. }
  1542. function handleEvent(event) {var _this2 = this;
  1543. event = wrapper$1(event);
  1544. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1545. var dataset = (event.currentTarget || event.target).dataset;
  1546. if (!dataset) {
  1547. return console.warn('事件信息不存在');
  1548. }
  1549. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1550. if (!eventOpts) {
  1551. return console.warn('事件信息不存在');
  1552. }
  1553. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1554. var eventType = event.type;
  1555. var ret = [];
  1556. eventOpts.forEach(function (eventOpt) {
  1557. var type = eventOpt[0];
  1558. var eventsArray = eventOpt[1];
  1559. var isCustom = type.charAt(0) === CUSTOM;
  1560. type = isCustom ? type.slice(1) : type;
  1561. var isOnce = type.charAt(0) === ONCE;
  1562. type = isOnce ? type.slice(1) : type;
  1563. if (eventsArray && isMatchEventType(eventType, type)) {
  1564. eventsArray.forEach(function (eventArray) {
  1565. var methodName = eventArray[0];
  1566. if (methodName) {
  1567. var handlerCtx = _this2.$vm;
  1568. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1569. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1570. }
  1571. if (methodName === '$emit') {
  1572. handlerCtx.$emit.apply(handlerCtx,
  1573. processEventArgs(
  1574. _this2.$vm,
  1575. event,
  1576. eventArray[1],
  1577. eventArray[2],
  1578. isCustom,
  1579. methodName));
  1580. return;
  1581. }
  1582. var handler = handlerCtx[methodName];
  1583. if (!isFn(handler)) {
  1584. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  1585. var path = _this2.route || _this2.is;
  1586. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  1587. }
  1588. if (isOnce) {
  1589. if (handler.once) {
  1590. return;
  1591. }
  1592. handler.once = true;
  1593. }
  1594. var params = processEventArgs(
  1595. _this2.$vm,
  1596. event,
  1597. eventArray[1],
  1598. eventArray[2],
  1599. isCustom,
  1600. methodName);
  1601. params = Array.isArray(params) ? params : [];
  1602. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1603. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1604. // eslint-disable-next-line no-sparse-arrays
  1605. params = params.concat([,,,,,,,,,, event]);
  1606. }
  1607. ret.push(handler.apply(handlerCtx, params));
  1608. }
  1609. });
  1610. }
  1611. });
  1612. if (
  1613. eventType === 'input' &&
  1614. ret.length === 1 &&
  1615. typeof ret[0] !== 'undefined')
  1616. {
  1617. return ret[0];
  1618. }
  1619. }
  1620. var eventChannels = {};
  1621. var eventChannelStack = [];
  1622. function getEventChannel(id) {
  1623. if (id) {
  1624. var eventChannel = eventChannels[id];
  1625. delete eventChannels[id];
  1626. return eventChannel;
  1627. }
  1628. return eventChannelStack.shift();
  1629. }
  1630. var hooks = [
  1631. 'onShow',
  1632. 'onHide',
  1633. 'onError',
  1634. 'onPageNotFound',
  1635. 'onThemeChange',
  1636. 'onUnhandledRejection'];
  1637. function initEventChannel() {
  1638. _vue.default.prototype.getOpenerEventChannel = function () {
  1639. // 微信小程序使用自身getOpenerEventChannel
  1640. {
  1641. return this.$scope.getOpenerEventChannel();
  1642. }
  1643. };
  1644. var callHook = _vue.default.prototype.__call_hook;
  1645. _vue.default.prototype.__call_hook = function (hook, args) {
  1646. if (hook === 'onLoad' && args && args.__id__) {
  1647. this.__eventChannel__ = getEventChannel(args.__id__);
  1648. delete args.__id__;
  1649. }
  1650. return callHook.call(this, hook, args);
  1651. };
  1652. }
  1653. function initScopedSlotsParams() {
  1654. var center = {};
  1655. var parents = {};
  1656. _vue.default.prototype.$hasScopedSlotsParams = function (vueId) {
  1657. var has = center[vueId];
  1658. if (!has) {
  1659. parents[vueId] = this;
  1660. this.$on('hook:destroyed', function () {
  1661. delete parents[vueId];
  1662. });
  1663. }
  1664. return has;
  1665. };
  1666. _vue.default.prototype.$getScopedSlotsParams = function (vueId, name, key) {
  1667. var data = center[vueId];
  1668. if (data) {
  1669. var object = data[name] || {};
  1670. return key ? object[key] : object;
  1671. } else {
  1672. parents[vueId] = this;
  1673. this.$on('hook:destroyed', function () {
  1674. delete parents[vueId];
  1675. });
  1676. }
  1677. };
  1678. _vue.default.prototype.$setScopedSlotsParams = function (name, value) {
  1679. var vueIds = this.$options.propsData.vueId;
  1680. if (vueIds) {
  1681. var vueId = vueIds.split(',')[0];
  1682. var object = center[vueId] = center[vueId] || {};
  1683. object[name] = value;
  1684. if (parents[vueId]) {
  1685. parents[vueId].$forceUpdate();
  1686. }
  1687. }
  1688. };
  1689. _vue.default.mixin({
  1690. destroyed: function destroyed() {
  1691. var propsData = this.$options.propsData;
  1692. var vueId = propsData && propsData.vueId;
  1693. if (vueId) {
  1694. delete center[vueId];
  1695. delete parents[vueId];
  1696. }
  1697. } });
  1698. }
  1699. function parseBaseApp(vm, _ref3)
  1700. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1701. initEventChannel();
  1702. {
  1703. initScopedSlotsParams();
  1704. }
  1705. if (vm.$options.store) {
  1706. _vue.default.prototype.$store = vm.$options.store;
  1707. }
  1708. uniIdMixin(_vue.default);
  1709. _vue.default.prototype.mpHost = "mp-weixin";
  1710. _vue.default.mixin({
  1711. beforeCreate: function beforeCreate() {
  1712. if (!this.$options.mpType) {
  1713. return;
  1714. }
  1715. this.mpType = this.$options.mpType;
  1716. this.$mp = _defineProperty({
  1717. data: {} },
  1718. this.mpType, this.$options.mpInstance);
  1719. this.$scope = this.$options.mpInstance;
  1720. delete this.$options.mpType;
  1721. delete this.$options.mpInstance;
  1722. if (this.mpType === 'page' && typeof getApp === 'function') {// hack vue-i18n
  1723. var app = getApp();
  1724. if (app.$vm && app.$vm.$i18n) {
  1725. this._i18n = app.$vm.$i18n;
  1726. }
  1727. }
  1728. if (this.mpType !== 'app') {
  1729. initRefs(this);
  1730. initMocks(this, mocks);
  1731. }
  1732. } });
  1733. var appOptions = {
  1734. onLaunch: function onLaunch(args) {
  1735. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1736. return;
  1737. }
  1738. {
  1739. if (wx.canIUse && !wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1740. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1741. }
  1742. }
  1743. this.$vm = vm;
  1744. this.$vm.$mp = {
  1745. app: this };
  1746. this.$vm.$scope = this;
  1747. // vm 上也挂载 globalData
  1748. this.$vm.globalData = this.globalData;
  1749. this.$vm._isMounted = true;
  1750. this.$vm.__call_hook('mounted', args);
  1751. this.$vm.__call_hook('onLaunch', args);
  1752. } };
  1753. // 兼容旧版本 globalData
  1754. appOptions.globalData = vm.$options.globalData || {};
  1755. // 将 methods 中的方法挂在 getApp() 中
  1756. var methods = vm.$options.methods;
  1757. if (methods) {
  1758. Object.keys(methods).forEach(function (name) {
  1759. appOptions[name] = methods[name];
  1760. });
  1761. }
  1762. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  1763. initHooks(appOptions, hooks);
  1764. initUnknownHooks(appOptions, vm.$options);
  1765. return appOptions;
  1766. }
  1767. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1768. function findVmByVueId(vm, vuePid) {
  1769. var $children = vm.$children;
  1770. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1771. for (var i = $children.length - 1; i >= 0; i--) {
  1772. var childVm = $children[i];
  1773. if (childVm.$scope._$vueId === vuePid) {
  1774. return childVm;
  1775. }
  1776. }
  1777. // 反向递归查找
  1778. var parentVm;
  1779. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1780. parentVm = findVmByVueId($children[_i], vuePid);
  1781. if (parentVm) {
  1782. return parentVm;
  1783. }
  1784. }
  1785. }
  1786. function initBehavior(options) {
  1787. return Behavior(options);
  1788. }
  1789. function isPage() {
  1790. return !!this.route;
  1791. }
  1792. function initRelation(detail) {
  1793. this.triggerEvent('__l', detail);
  1794. }
  1795. function selectAllComponents(mpInstance, selector, $refs) {
  1796. var components = mpInstance.selectAllComponents(selector);
  1797. components.forEach(function (component) {
  1798. var ref = component.dataset.ref;
  1799. $refs[ref] = component.$vm || component;
  1800. {
  1801. if (component.dataset.vueGeneric === 'scoped') {
  1802. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1803. selectAllComponents(scopedComponent, selector, $refs);
  1804. });
  1805. }
  1806. }
  1807. });
  1808. }
  1809. function initRefs(vm) {
  1810. var mpInstance = vm.$scope;
  1811. Object.defineProperty(vm, '$refs', {
  1812. get: function get() {
  1813. var $refs = {};
  1814. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1815. // TODO 暂不考虑 for 中的 scoped
  1816. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1817. forComponents.forEach(function (component) {
  1818. var ref = component.dataset.ref;
  1819. if (!$refs[ref]) {
  1820. $refs[ref] = [];
  1821. }
  1822. $refs[ref].push(component.$vm || component);
  1823. });
  1824. return $refs;
  1825. } });
  1826. }
  1827. function handleLink(event) {var _ref4 =
  1828. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1829. var parentVm;
  1830. if (vuePid) {
  1831. parentVm = findVmByVueId(this.$vm, vuePid);
  1832. }
  1833. if (!parentVm) {
  1834. parentVm = this.$vm;
  1835. }
  1836. vueOptions.parent = parentVm;
  1837. }
  1838. function parseApp(vm) {
  1839. return parseBaseApp(vm, {
  1840. mocks: mocks,
  1841. initRefs: initRefs });
  1842. }
  1843. function createApp(vm) {
  1844. App(parseApp(vm));
  1845. return vm;
  1846. }
  1847. var encodeReserveRE = /[!'()*]/g;
  1848. var encodeReserveReplacer = function encodeReserveReplacer(c) {return '%' + c.charCodeAt(0).toString(16);};
  1849. var commaRE = /%2C/g;
  1850. // fixed encodeURIComponent which is more conformant to RFC3986:
  1851. // - escapes [!'()*]
  1852. // - preserve commas
  1853. var encode = function encode(str) {return encodeURIComponent(str).
  1854. replace(encodeReserveRE, encodeReserveReplacer).
  1855. replace(commaRE, ',');};
  1856. function stringifyQuery(obj) {var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  1857. var res = obj ? Object.keys(obj).map(function (key) {
  1858. var val = obj[key];
  1859. if (val === undefined) {
  1860. return '';
  1861. }
  1862. if (val === null) {
  1863. return encodeStr(key);
  1864. }
  1865. if (Array.isArray(val)) {
  1866. var result = [];
  1867. val.forEach(function (val2) {
  1868. if (val2 === undefined) {
  1869. return;
  1870. }
  1871. if (val2 === null) {
  1872. result.push(encodeStr(key));
  1873. } else {
  1874. result.push(encodeStr(key) + '=' + encodeStr(val2));
  1875. }
  1876. });
  1877. return result.join('&');
  1878. }
  1879. return encodeStr(key) + '=' + encodeStr(val);
  1880. }).filter(function (x) {return x.length > 0;}).join('&') : null;
  1881. return res ? "?".concat(res) : '';
  1882. }
  1883. function parseBaseComponent(vueComponentOptions)
  1884. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1885. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1886. var options = _objectSpread({
  1887. multipleSlots: true,
  1888. addGlobalClass: true },
  1889. vueOptions.options || {});
  1890. {
  1891. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1892. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1893. Object.assign(options, vueOptions['mp-weixin'].options);
  1894. }
  1895. }
  1896. var componentOptions = {
  1897. options: options,
  1898. data: initData(vueOptions, _vue.default.prototype),
  1899. behaviors: initBehaviors(vueOptions, initBehavior),
  1900. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  1901. lifetimes: {
  1902. attached: function attached() {
  1903. var properties = this.properties;
  1904. var options = {
  1905. mpType: isPage.call(this) ? 'page' : 'component',
  1906. mpInstance: this,
  1907. propsData: properties };
  1908. initVueIds(properties.vueId, this);
  1909. // 处理父子关系
  1910. initRelation.call(this, {
  1911. vuePid: this._$vuePid,
  1912. vueOptions: options });
  1913. // 初始化 vue 实例
  1914. this.$vm = new VueComponent(options);
  1915. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1916. initSlots(this.$vm, properties.vueSlots);
  1917. // 触发首次 setData
  1918. this.$vm.$mount();
  1919. },
  1920. ready: function ready() {
  1921. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1922. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1923. if (this.$vm) {
  1924. this.$vm._isMounted = true;
  1925. this.$vm.__call_hook('mounted');
  1926. this.$vm.__call_hook('onReady');
  1927. }
  1928. },
  1929. detached: function detached() {
  1930. this.$vm && this.$vm.$destroy();
  1931. } },
  1932. pageLifetimes: {
  1933. show: function show(args) {
  1934. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1935. },
  1936. hide: function hide() {
  1937. this.$vm && this.$vm.__call_hook('onPageHide');
  1938. },
  1939. resize: function resize(size) {
  1940. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1941. } },
  1942. methods: {
  1943. __l: handleLink,
  1944. __e: handleEvent } };
  1945. // externalClasses
  1946. if (vueOptions.externalClasses) {
  1947. componentOptions.externalClasses = vueOptions.externalClasses;
  1948. }
  1949. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1950. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1951. componentOptions.methods[callMethod] = function (args) {
  1952. return this.$vm[callMethod](args);
  1953. };
  1954. });
  1955. }
  1956. if (isPage) {
  1957. return componentOptions;
  1958. }
  1959. return [componentOptions, VueComponent];
  1960. }
  1961. function parseComponent(vueComponentOptions) {
  1962. return parseBaseComponent(vueComponentOptions, {
  1963. isPage: isPage,
  1964. initRelation: initRelation });
  1965. }
  1966. var hooks$1 = [
  1967. 'onShow',
  1968. 'onHide',
  1969. 'onUnload'];
  1970. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1971. function parseBasePage(vuePageOptions, _ref6)
  1972. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1973. var pageOptions = parseComponent(vuePageOptions);
  1974. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1975. pageOptions.methods.onLoad = function (query) {
  1976. this.options = query;
  1977. var copyQuery = Object.assign({}, query);
  1978. delete copyQuery.__id__;
  1979. this.$page = {
  1980. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery) };
  1981. this.$vm.$mp.query = query; // 兼容 mpvue
  1982. this.$vm.__call_hook('onLoad', query);
  1983. };
  1984. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  1985. return pageOptions;
  1986. }
  1987. function parsePage(vuePageOptions) {
  1988. return parseBasePage(vuePageOptions, {
  1989. isPage: isPage,
  1990. initRelation: initRelation });
  1991. }
  1992. function createPage(vuePageOptions) {
  1993. {
  1994. return Component(parsePage(vuePageOptions));
  1995. }
  1996. }
  1997. function createComponent(vueOptions) {
  1998. {
  1999. return Component(parseComponent(vueOptions));
  2000. }
  2001. }
  2002. function createSubpackageApp(vm) {
  2003. var appOptions = parseApp(vm);
  2004. var app = getApp({
  2005. allowDefault: true });
  2006. vm.$scope = app;
  2007. var globalData = app.globalData;
  2008. if (globalData) {
  2009. Object.keys(appOptions.globalData).forEach(function (name) {
  2010. if (!hasOwn(globalData, name)) {
  2011. globalData[name] = appOptions.globalData[name];
  2012. }
  2013. });
  2014. }
  2015. Object.keys(appOptions).forEach(function (name) {
  2016. if (!hasOwn(app, name)) {
  2017. app[name] = appOptions[name];
  2018. }
  2019. });
  2020. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2021. wx.onAppShow(function () {for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}
  2022. vm.__call_hook('onShow', args);
  2023. });
  2024. }
  2025. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2026. wx.onAppHide(function () {for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}
  2027. vm.__call_hook('onHide', args);
  2028. });
  2029. }
  2030. if (isFn(appOptions.onLaunch)) {
  2031. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2032. vm.__call_hook('onLaunch', args);
  2033. }
  2034. return vm;
  2035. }
  2036. function createPlugin(vm) {
  2037. var appOptions = parseApp(vm);
  2038. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2039. wx.onAppShow(function () {for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {args[_key7] = arguments[_key7];}
  2040. vm.__call_hook('onShow', args);
  2041. });
  2042. }
  2043. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2044. wx.onAppHide(function () {for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {args[_key8] = arguments[_key8];}
  2045. vm.__call_hook('onHide', args);
  2046. });
  2047. }
  2048. if (isFn(appOptions.onLaunch)) {
  2049. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2050. vm.__call_hook('onLaunch', args);
  2051. }
  2052. return vm;
  2053. }
  2054. todos.forEach(function (todoApi) {
  2055. protocols[todoApi] = false;
  2056. });
  2057. canIUses.forEach(function (canIUseApi) {
  2058. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  2059. canIUseApi;
  2060. if (!wx.canIUse(apiName)) {
  2061. protocols[canIUseApi] = false;
  2062. }
  2063. });
  2064. var uni = {};
  2065. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2066. uni = new Proxy({}, {
  2067. get: function get(target, name) {
  2068. if (hasOwn(target, name)) {
  2069. return target[name];
  2070. }
  2071. if (baseApi[name]) {
  2072. return baseApi[name];
  2073. }
  2074. if (api[name]) {
  2075. return promisify(name, api[name]);
  2076. }
  2077. {
  2078. if (extraApi[name]) {
  2079. return promisify(name, extraApi[name]);
  2080. }
  2081. if (todoApis[name]) {
  2082. return promisify(name, todoApis[name]);
  2083. }
  2084. }
  2085. if (eventApi[name]) {
  2086. return eventApi[name];
  2087. }
  2088. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  2089. return;
  2090. }
  2091. return promisify(name, wrapper(name, wx[name]));
  2092. },
  2093. set: function set(target, name, value) {
  2094. target[name] = value;
  2095. return true;
  2096. } });
  2097. } else {
  2098. Object.keys(baseApi).forEach(function (name) {
  2099. uni[name] = baseApi[name];
  2100. });
  2101. {
  2102. Object.keys(todoApis).forEach(function (name) {
  2103. uni[name] = promisify(name, todoApis[name]);
  2104. });
  2105. Object.keys(extraApi).forEach(function (name) {
  2106. uni[name] = promisify(name, todoApis[name]);
  2107. });
  2108. }
  2109. Object.keys(eventApi).forEach(function (name) {
  2110. uni[name] = eventApi[name];
  2111. });
  2112. Object.keys(api).forEach(function (name) {
  2113. uni[name] = promisify(name, api[name]);
  2114. });
  2115. Object.keys(wx).forEach(function (name) {
  2116. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2117. uni[name] = promisify(name, wrapper(name, wx[name]));
  2118. }
  2119. });
  2120. }
  2121. wx.createApp = createApp;
  2122. wx.createPage = createPage;
  2123. wx.createComponent = createComponent;
  2124. wx.createSubpackageApp = createSubpackageApp;
  2125. wx.createPlugin = createPlugin;
  2126. var uni$1 = uni;var _default =
  2127. uni$1;exports.default = _default;
  2128. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 2)))
  2129. /***/ }),
  2130. /* 2 */
  2131. /*!***********************************!*\
  2132. !*** (webpack)/buildin/global.js ***!
  2133. \***********************************/
  2134. /*! no static exports found */
  2135. /***/ (function(module, exports) {
  2136. var g;
  2137. // This works in non-strict mode
  2138. g = (function() {
  2139. return this;
  2140. })();
  2141. try {
  2142. // This works if eval is allowed (see CSP)
  2143. g = g || new Function("return this")();
  2144. } catch (e) {
  2145. // This works if the window reference is available
  2146. if (typeof window === "object") g = window;
  2147. }
  2148. // g can still be undefined, but nothing to do about it...
  2149. // We return undefined, instead of nothing here, so it's
  2150. // easier to handle this case. if(!global) { ...}
  2151. module.exports = g;
  2152. /***/ }),
  2153. /* 3 */
  2154. /*!*************************************************************!*\
  2155. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  2156. \*************************************************************/
  2157. /*! no static exports found */
  2158. /***/ (function(module, exports, __webpack_require__) {
  2159. "use strict";
  2160. /* WEBPACK VAR INJECTION */(function(uni, global) {Object.defineProperty(exports, "__esModule", { value: true });exports.compileI18nJsonStr = compileI18nJsonStr;exports.hasI18nJson = hasI18nJson;exports.initVueI18n = initVueI18n;exports.isI18nStr = isI18nStr;exports.normalizeLocale = normalizeLocale;exports.parseI18nJson = parseI18nJson;exports.resolveLocale = resolveLocale;exports.isString = exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}var isArray = Array.isArray;
  2161. var isObject = function isObject(val) {return val !== null && typeof val === 'object';};
  2162. var defaultDelimiters = ['{', '}'];var
  2163. BaseFormatter = /*#__PURE__*/function () {
  2164. function BaseFormatter() {_classCallCheck(this, BaseFormatter);
  2165. this._caches = Object.create(null);
  2166. }_createClass(BaseFormatter, [{ key: "interpolate", value: function interpolate(
  2167. message, values) {var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  2168. if (!values) {
  2169. return [message];
  2170. }
  2171. var tokens = this._caches[message];
  2172. if (!tokens) {
  2173. tokens = parse(message, delimiters);
  2174. this._caches[message] = tokens;
  2175. }
  2176. return compile(tokens, values);
  2177. } }]);return BaseFormatter;}();exports.Formatter = BaseFormatter;
  2178. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  2179. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  2180. function parse(format, _ref) {var _ref2 = _slicedToArray(_ref, 2),startDelimiter = _ref2[0],endDelimiter = _ref2[1];
  2181. var tokens = [];
  2182. var position = 0;
  2183. var text = '';
  2184. while (position < format.length) {
  2185. var char = format[position++];
  2186. if (char === startDelimiter) {
  2187. if (text) {
  2188. tokens.push({ type: 'text', value: text });
  2189. }
  2190. text = '';
  2191. var sub = '';
  2192. char = format[position++];
  2193. while (char !== undefined && char !== endDelimiter) {
  2194. sub += char;
  2195. char = format[position++];
  2196. }
  2197. var isClosed = char === endDelimiter;
  2198. var type = RE_TOKEN_LIST_VALUE.test(sub) ?
  2199. 'list' :
  2200. isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ?
  2201. 'named' :
  2202. 'unknown';
  2203. tokens.push({ value: sub, type: type });
  2204. }
  2205. // else if (char === '%') {
  2206. // // when found rails i18n syntax, skip text capture
  2207. // if (format[position] !== '{') {
  2208. // text += char
  2209. // }
  2210. // }
  2211. else {
  2212. text += char;
  2213. }
  2214. }
  2215. text && tokens.push({ type: 'text', value: text });
  2216. return tokens;
  2217. }
  2218. function compile(tokens, values) {
  2219. var compiled = [];
  2220. var index = 0;
  2221. var mode = isArray(values) ?
  2222. 'list' :
  2223. isObject(values) ?
  2224. 'named' :
  2225. 'unknown';
  2226. if (mode === 'unknown') {
  2227. return compiled;
  2228. }
  2229. while (index < tokens.length) {
  2230. var token = tokens[index];
  2231. switch (token.type) {
  2232. case 'text':
  2233. compiled.push(token.value);
  2234. break;
  2235. case 'list':
  2236. compiled.push(values[parseInt(token.value, 10)]);
  2237. break;
  2238. case 'named':
  2239. if (mode === 'named') {
  2240. compiled.push(values[token.value]);
  2241. } else
  2242. {
  2243. if (true) {
  2244. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  2245. }
  2246. }
  2247. break;
  2248. case 'unknown':
  2249. if (true) {
  2250. console.warn("Detect 'unknown' type of token!");
  2251. }
  2252. break;}
  2253. index++;
  2254. }
  2255. return compiled;
  2256. }
  2257. var LOCALE_ZH_HANS = 'zh-Hans';exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  2258. var LOCALE_ZH_HANT = 'zh-Hant';exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  2259. var LOCALE_EN = 'en';exports.LOCALE_EN = LOCALE_EN;
  2260. var LOCALE_FR = 'fr';exports.LOCALE_FR = LOCALE_FR;
  2261. var LOCALE_ES = 'es';exports.LOCALE_ES = LOCALE_ES;
  2262. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2263. var hasOwn = function hasOwn(val, key) {return hasOwnProperty.call(val, key);};
  2264. var defaultFormatter = new BaseFormatter();
  2265. function include(str, parts) {
  2266. return !!parts.find(function (part) {return str.indexOf(part) !== -1;});
  2267. }
  2268. function startsWith(str, parts) {
  2269. return parts.find(function (part) {return str.indexOf(part) === 0;});
  2270. }
  2271. function normalizeLocale(locale, messages) {
  2272. if (!locale) {
  2273. return;
  2274. }
  2275. locale = locale.trim().replace(/_/g, '-');
  2276. if (messages && messages[locale]) {
  2277. return locale;
  2278. }
  2279. locale = locale.toLowerCase();
  2280. if (locale.indexOf('zh') === 0) {
  2281. if (locale.indexOf('-hans') > -1) {
  2282. return LOCALE_ZH_HANS;
  2283. }
  2284. if (locale.indexOf('-hant') > -1) {
  2285. return LOCALE_ZH_HANT;
  2286. }
  2287. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  2288. return LOCALE_ZH_HANT;
  2289. }
  2290. return LOCALE_ZH_HANS;
  2291. }
  2292. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  2293. if (lang) {
  2294. return lang;
  2295. }
  2296. }var
  2297. I18n = /*#__PURE__*/function () {
  2298. function I18n(_ref3) {var locale = _ref3.locale,fallbackLocale = _ref3.fallbackLocale,messages = _ref3.messages,watcher = _ref3.watcher,formater = _ref3.formater;_classCallCheck(this, I18n);
  2299. this.locale = LOCALE_EN;
  2300. this.fallbackLocale = LOCALE_EN;
  2301. this.message = {};
  2302. this.messages = {};
  2303. this.watchers = [];
  2304. if (fallbackLocale) {
  2305. this.fallbackLocale = fallbackLocale;
  2306. }
  2307. this.formater = formater || defaultFormatter;
  2308. this.messages = messages || {};
  2309. this.setLocale(locale || LOCALE_EN);
  2310. if (watcher) {
  2311. this.watchLocale(watcher);
  2312. }
  2313. }_createClass(I18n, [{ key: "setLocale", value: function setLocale(
  2314. locale) {var _this = this;
  2315. var oldLocale = this.locale;
  2316. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  2317. if (!this.messages[this.locale]) {
  2318. // 可能初始化时不存在
  2319. this.messages[this.locale] = {};
  2320. }
  2321. this.message = this.messages[this.locale];
  2322. // 仅发生变化时,通知
  2323. if (oldLocale !== this.locale) {
  2324. this.watchers.forEach(function (watcher) {
  2325. watcher(_this.locale, oldLocale);
  2326. });
  2327. }
  2328. } }, { key: "getLocale", value: function getLocale()
  2329. {
  2330. return this.locale;
  2331. } }, { key: "watchLocale", value: function watchLocale(
  2332. fn) {var _this2 = this;
  2333. var index = this.watchers.push(fn) - 1;
  2334. return function () {
  2335. _this2.watchers.splice(index, 1);
  2336. };
  2337. } }, { key: "add", value: function add(
  2338. locale, message) {var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  2339. var curMessages = this.messages[locale];
  2340. if (curMessages) {
  2341. if (override) {
  2342. Object.assign(curMessages, message);
  2343. } else
  2344. {
  2345. Object.keys(message).forEach(function (key) {
  2346. if (!hasOwn(curMessages, key)) {
  2347. curMessages[key] = message[key];
  2348. }
  2349. });
  2350. }
  2351. } else
  2352. {
  2353. this.messages[locale] = message;
  2354. }
  2355. } }, { key: "f", value: function f(
  2356. message, values, delimiters) {
  2357. return this.formater.interpolate(message, values, delimiters).join('');
  2358. } }, { key: "t", value: function t(
  2359. key, locale, values) {
  2360. var message = this.message;
  2361. if (typeof locale === 'string') {
  2362. locale = normalizeLocale(locale, this.messages);
  2363. locale && (message = this.messages[locale]);
  2364. } else
  2365. {
  2366. values = locale;
  2367. }
  2368. if (!hasOwn(message, key)) {
  2369. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  2370. return key;
  2371. }
  2372. return this.formater.interpolate(message[key], values).join('');
  2373. } }]);return I18n;}();exports.I18n = I18n;
  2374. function watchAppLocale(appVm, i18n) {
  2375. // 需要保证 watch 的触发在组件渲染之前
  2376. if (appVm.$watchLocale) {
  2377. // vue2
  2378. appVm.$watchLocale(function (newLocale) {
  2379. i18n.setLocale(newLocale);
  2380. });
  2381. } else
  2382. {
  2383. appVm.$watch(function () {return appVm.$locale;}, function (newLocale) {
  2384. i18n.setLocale(newLocale);
  2385. });
  2386. }
  2387. }
  2388. function getDefaultLocale() {
  2389. if (typeof uni !== 'undefined' && uni.getLocale) {
  2390. return uni.getLocale();
  2391. }
  2392. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  2393. if (typeof global !== 'undefined' && global.getLocale) {
  2394. return global.getLocale();
  2395. }
  2396. return LOCALE_EN;
  2397. }
  2398. function initVueI18n(locale) {var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;var watcher = arguments.length > 3 ? arguments[3] : undefined;
  2399. // 兼容旧版本入参
  2400. if (typeof locale !== 'string') {var _ref4 =
  2401. [
  2402. messages,
  2403. locale];locale = _ref4[0];messages = _ref4[1];
  2404. }
  2405. if (typeof locale !== 'string') {
  2406. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  2407. locale = getDefaultLocale();
  2408. }
  2409. if (typeof fallbackLocale !== 'string') {
  2410. fallbackLocale =
  2411. typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale ||
  2412. LOCALE_EN;
  2413. }
  2414. var i18n = new I18n({
  2415. locale: locale,
  2416. fallbackLocale: fallbackLocale,
  2417. messages: messages,
  2418. watcher: watcher });
  2419. var _t = function t(key, values) {
  2420. if (typeof getApp !== 'function') {
  2421. // app view
  2422. /* eslint-disable no-func-assign */
  2423. _t = function t(key, values) {
  2424. return i18n.t(key, values);
  2425. };
  2426. } else
  2427. {
  2428. var isWatchedAppLocale = false;
  2429. _t = function t(key, values) {
  2430. var appVm = getApp().$vm;
  2431. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  2432. // options: {
  2433. // type: Array,
  2434. // default () {
  2435. // return [{
  2436. // icon: 'shop',
  2437. // text: t("uni-goods-nav.options.shop"),
  2438. // }, {
  2439. // icon: 'cart',
  2440. // text: t("uni-goods-nav.options.cart")
  2441. // }]
  2442. // }
  2443. // },
  2444. if (appVm) {
  2445. // 触发响应式
  2446. appVm.$locale;
  2447. if (!isWatchedAppLocale) {
  2448. isWatchedAppLocale = true;
  2449. watchAppLocale(appVm, i18n);
  2450. }
  2451. }
  2452. return i18n.t(key, values);
  2453. };
  2454. }
  2455. return _t(key, values);
  2456. };
  2457. return {
  2458. i18n: i18n,
  2459. f: function f(message, values, delimiters) {
  2460. return i18n.f(message, values, delimiters);
  2461. },
  2462. t: function t(key, values) {
  2463. return _t(key, values);
  2464. },
  2465. add: function add(locale, message) {var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  2466. return i18n.add(locale, message, override);
  2467. },
  2468. watch: function watch(fn) {
  2469. return i18n.watchLocale(fn);
  2470. },
  2471. getLocale: function getLocale() {
  2472. return i18n.getLocale();
  2473. },
  2474. setLocale: function setLocale(newLocale) {
  2475. return i18n.setLocale(newLocale);
  2476. } };
  2477. }
  2478. var isString = function isString(val) {return typeof val === 'string';};exports.isString = isString;
  2479. var formater;
  2480. function hasI18nJson(jsonObj, delimiters) {
  2481. if (!formater) {
  2482. formater = new BaseFormatter();
  2483. }
  2484. return walkJsonObj(jsonObj, function (jsonObj, key) {
  2485. var value = jsonObj[key];
  2486. if (isString(value)) {
  2487. if (isI18nStr(value, delimiters)) {
  2488. return true;
  2489. }
  2490. } else
  2491. {
  2492. return hasI18nJson(value, delimiters);
  2493. }
  2494. });
  2495. }
  2496. function parseI18nJson(jsonObj, values, delimiters) {
  2497. if (!formater) {
  2498. formater = new BaseFormatter();
  2499. }
  2500. walkJsonObj(jsonObj, function (jsonObj, key) {
  2501. var value = jsonObj[key];
  2502. if (isString(value)) {
  2503. if (isI18nStr(value, delimiters)) {
  2504. jsonObj[key] = compileStr(value, values, delimiters);
  2505. }
  2506. } else
  2507. {
  2508. parseI18nJson(value, values, delimiters);
  2509. }
  2510. });
  2511. return jsonObj;
  2512. }
  2513. function compileI18nJsonStr(jsonStr, _ref5) {var locale = _ref5.locale,locales = _ref5.locales,delimiters = _ref5.delimiters;
  2514. if (!isI18nStr(jsonStr, delimiters)) {
  2515. return jsonStr;
  2516. }
  2517. if (!formater) {
  2518. formater = new BaseFormatter();
  2519. }
  2520. var localeValues = [];
  2521. Object.keys(locales).forEach(function (name) {
  2522. if (name !== locale) {
  2523. localeValues.push({
  2524. locale: name,
  2525. values: locales[name] });
  2526. }
  2527. });
  2528. localeValues.unshift({ locale: locale, values: locales[locale] });
  2529. try {
  2530. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  2531. }
  2532. catch (e) {}
  2533. return jsonStr;
  2534. }
  2535. function isI18nStr(value, delimiters) {
  2536. return value.indexOf(delimiters[0]) > -1;
  2537. }
  2538. function compileStr(value, values, delimiters) {
  2539. return formater.interpolate(value, values, delimiters).join('');
  2540. }
  2541. function compileValue(jsonObj, key, localeValues, delimiters) {
  2542. var value = jsonObj[key];
  2543. if (isString(value)) {
  2544. // 存在国际化
  2545. if (isI18nStr(value, delimiters)) {
  2546. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  2547. if (localeValues.length > 1) {
  2548. // 格式化国际化语言
  2549. var valueLocales = jsonObj[key + 'Locales'] = {};
  2550. localeValues.forEach(function (localValue) {
  2551. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  2552. });
  2553. }
  2554. }
  2555. } else
  2556. {
  2557. compileJsonObj(value, localeValues, delimiters);
  2558. }
  2559. }
  2560. function compileJsonObj(jsonObj, localeValues, delimiters) {
  2561. walkJsonObj(jsonObj, function (jsonObj, key) {
  2562. compileValue(jsonObj, key, localeValues, delimiters);
  2563. });
  2564. return jsonObj;
  2565. }
  2566. function walkJsonObj(jsonObj, walk) {
  2567. if (isArray(jsonObj)) {
  2568. for (var i = 0; i < jsonObj.length; i++) {
  2569. if (walk(jsonObj, i)) {
  2570. return true;
  2571. }
  2572. }
  2573. } else
  2574. if (isObject(jsonObj)) {
  2575. for (var key in jsonObj) {
  2576. if (walk(jsonObj, key)) {
  2577. return true;
  2578. }
  2579. }
  2580. }
  2581. return false;
  2582. }
  2583. function resolveLocale(locales) {
  2584. return function (locale) {
  2585. if (!locale) {
  2586. return locale;
  2587. }
  2588. locale = normalizeLocale(locale) || locale;
  2589. return resolveLocaleChain(locale).find(function (locale) {return locales.indexOf(locale) > -1;});
  2590. };
  2591. }
  2592. function resolveLocaleChain(locale) {
  2593. var chain = [];
  2594. var tokens = locale.split('-');
  2595. while (tokens.length) {
  2596. chain.push(tokens.join('-'));
  2597. tokens.pop();
  2598. }
  2599. return chain;
  2600. }
  2601. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 2)))
  2602. /***/ }),
  2603. /* 4 */
  2604. /*!******************************************************************************************!*\
  2605. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  2606. \******************************************************************************************/
  2607. /*! exports provided: default */
  2608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2609. "use strict";
  2610. __webpack_require__.r(__webpack_exports__);
  2611. /* WEBPACK VAR INJECTION */(function(global) {/*!
  2612. * Vue.js v2.6.11
  2613. * (c) 2014-2022 Evan You
  2614. * Released under the MIT License.
  2615. */
  2616. /* */
  2617. var emptyObject = Object.freeze({});
  2618. // These helpers produce better VM code in JS engines due to their
  2619. // explicitness and function inlining.
  2620. function isUndef (v) {
  2621. return v === undefined || v === null
  2622. }
  2623. function isDef (v) {
  2624. return v !== undefined && v !== null
  2625. }
  2626. function isTrue (v) {
  2627. return v === true
  2628. }
  2629. function isFalse (v) {
  2630. return v === false
  2631. }
  2632. /**
  2633. * Check if value is primitive.
  2634. */
  2635. function isPrimitive (value) {
  2636. return (
  2637. typeof value === 'string' ||
  2638. typeof value === 'number' ||
  2639. // $flow-disable-line
  2640. typeof value === 'symbol' ||
  2641. typeof value === 'boolean'
  2642. )
  2643. }
  2644. /**
  2645. * Quick object check - this is primarily used to tell
  2646. * Objects from primitive values when we know the value
  2647. * is a JSON-compliant type.
  2648. */
  2649. function isObject (obj) {
  2650. return obj !== null && typeof obj === 'object'
  2651. }
  2652. /**
  2653. * Get the raw type string of a value, e.g., [object Object].
  2654. */
  2655. var _toString = Object.prototype.toString;
  2656. function toRawType (value) {
  2657. return _toString.call(value).slice(8, -1)
  2658. }
  2659. /**
  2660. * Strict object type check. Only returns true
  2661. * for plain JavaScript objects.
  2662. */
  2663. function isPlainObject (obj) {
  2664. return _toString.call(obj) === '[object Object]'
  2665. }
  2666. function isRegExp (v) {
  2667. return _toString.call(v) === '[object RegExp]'
  2668. }
  2669. /**
  2670. * Check if val is a valid array index.
  2671. */
  2672. function isValidArrayIndex (val) {
  2673. var n = parseFloat(String(val));
  2674. return n >= 0 && Math.floor(n) === n && isFinite(val)
  2675. }
  2676. function isPromise (val) {
  2677. return (
  2678. isDef(val) &&
  2679. typeof val.then === 'function' &&
  2680. typeof val.catch === 'function'
  2681. )
  2682. }
  2683. /**
  2684. * Convert a value to a string that is actually rendered.
  2685. */
  2686. function toString (val) {
  2687. return val == null
  2688. ? ''
  2689. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  2690. ? JSON.stringify(val, null, 2)
  2691. : String(val)
  2692. }
  2693. /**
  2694. * Convert an input value to a number for persistence.
  2695. * If the conversion fails, return original string.
  2696. */
  2697. function toNumber (val) {
  2698. var n = parseFloat(val);
  2699. return isNaN(n) ? val : n
  2700. }
  2701. /**
  2702. * Make a map and return a function for checking if a key
  2703. * is in that map.
  2704. */
  2705. function makeMap (
  2706. str,
  2707. expectsLowerCase
  2708. ) {
  2709. var map = Object.create(null);
  2710. var list = str.split(',');
  2711. for (var i = 0; i < list.length; i++) {
  2712. map[list[i]] = true;
  2713. }
  2714. return expectsLowerCase
  2715. ? function (val) { return map[val.toLowerCase()]; }
  2716. : function (val) { return map[val]; }
  2717. }
  2718. /**
  2719. * Check if a tag is a built-in tag.
  2720. */
  2721. var isBuiltInTag = makeMap('slot,component', true);
  2722. /**
  2723. * Check if an attribute is a reserved attribute.
  2724. */
  2725. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  2726. /**
  2727. * Remove an item from an array.
  2728. */
  2729. function remove (arr, item) {
  2730. if (arr.length) {
  2731. var index = arr.indexOf(item);
  2732. if (index > -1) {
  2733. return arr.splice(index, 1)
  2734. }
  2735. }
  2736. }
  2737. /**
  2738. * Check whether an object has the property.
  2739. */
  2740. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2741. function hasOwn (obj, key) {
  2742. return hasOwnProperty.call(obj, key)
  2743. }
  2744. /**
  2745. * Create a cached version of a pure function.
  2746. */
  2747. function cached (fn) {
  2748. var cache = Object.create(null);
  2749. return (function cachedFn (str) {
  2750. var hit = cache[str];
  2751. return hit || (cache[str] = fn(str))
  2752. })
  2753. }
  2754. /**
  2755. * Camelize a hyphen-delimited string.
  2756. */
  2757. var camelizeRE = /-(\w)/g;
  2758. var camelize = cached(function (str) {
  2759. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  2760. });
  2761. /**
  2762. * Capitalize a string.
  2763. */
  2764. var capitalize = cached(function (str) {
  2765. return str.charAt(0).toUpperCase() + str.slice(1)
  2766. });
  2767. /**
  2768. * Hyphenate a camelCase string.
  2769. */
  2770. var hyphenateRE = /\B([A-Z])/g;
  2771. var hyphenate = cached(function (str) {
  2772. return str.replace(hyphenateRE, '-$1').toLowerCase()
  2773. });
  2774. /**
  2775. * Simple bind polyfill for environments that do not support it,
  2776. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  2777. * since native bind is now performant enough in most browsers.
  2778. * But removing it would mean breaking code that was able to run in
  2779. * PhantomJS 1.x, so this must be kept for backward compatibility.
  2780. */
  2781. /* istanbul ignore next */
  2782. function polyfillBind (fn, ctx) {
  2783. function boundFn (a) {
  2784. var l = arguments.length;
  2785. return l
  2786. ? l > 1
  2787. ? fn.apply(ctx, arguments)
  2788. : fn.call(ctx, a)
  2789. : fn.call(ctx)
  2790. }
  2791. boundFn._length = fn.length;
  2792. return boundFn
  2793. }
  2794. function nativeBind (fn, ctx) {
  2795. return fn.bind(ctx)
  2796. }
  2797. var bind = Function.prototype.bind
  2798. ? nativeBind
  2799. : polyfillBind;
  2800. /**
  2801. * Convert an Array-like object to a real Array.
  2802. */
  2803. function toArray (list, start) {
  2804. start = start || 0;
  2805. var i = list.length - start;
  2806. var ret = new Array(i);
  2807. while (i--) {
  2808. ret[i] = list[i + start];
  2809. }
  2810. return ret
  2811. }
  2812. /**
  2813. * Mix properties into target object.
  2814. */
  2815. function extend (to, _from) {
  2816. for (var key in _from) {
  2817. to[key] = _from[key];
  2818. }
  2819. return to
  2820. }
  2821. /**
  2822. * Merge an Array of Objects into a single Object.
  2823. */
  2824. function toObject (arr) {
  2825. var res = {};
  2826. for (var i = 0; i < arr.length; i++) {
  2827. if (arr[i]) {
  2828. extend(res, arr[i]);
  2829. }
  2830. }
  2831. return res
  2832. }
  2833. /* eslint-disable no-unused-vars */
  2834. /**
  2835. * Perform no operation.
  2836. * Stubbing args to make Flow happy without leaving useless transpiled code
  2837. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  2838. */
  2839. function noop (a, b, c) {}
  2840. /**
  2841. * Always return false.
  2842. */
  2843. var no = function (a, b, c) { return false; };
  2844. /* eslint-enable no-unused-vars */
  2845. /**
  2846. * Return the same value.
  2847. */
  2848. var identity = function (_) { return _; };
  2849. /**
  2850. * Check if two values are loosely equal - that is,
  2851. * if they are plain objects, do they have the same shape?
  2852. */
  2853. function looseEqual (a, b) {
  2854. if (a === b) { return true }
  2855. var isObjectA = isObject(a);
  2856. var isObjectB = isObject(b);
  2857. if (isObjectA && isObjectB) {
  2858. try {
  2859. var isArrayA = Array.isArray(a);
  2860. var isArrayB = Array.isArray(b);
  2861. if (isArrayA && isArrayB) {
  2862. return a.length === b.length && a.every(function (e, i) {
  2863. return looseEqual(e, b[i])
  2864. })
  2865. } else if (a instanceof Date && b instanceof Date) {
  2866. return a.getTime() === b.getTime()
  2867. } else if (!isArrayA && !isArrayB) {
  2868. var keysA = Object.keys(a);
  2869. var keysB = Object.keys(b);
  2870. return keysA.length === keysB.length && keysA.every(function (key) {
  2871. return looseEqual(a[key], b[key])
  2872. })
  2873. } else {
  2874. /* istanbul ignore next */
  2875. return false
  2876. }
  2877. } catch (e) {
  2878. /* istanbul ignore next */
  2879. return false
  2880. }
  2881. } else if (!isObjectA && !isObjectB) {
  2882. return String(a) === String(b)
  2883. } else {
  2884. return false
  2885. }
  2886. }
  2887. /**
  2888. * Return the first index at which a loosely equal value can be
  2889. * found in the array (if value is a plain object, the array must
  2890. * contain an object of the same shape), or -1 if it is not present.
  2891. */
  2892. function looseIndexOf (arr, val) {
  2893. for (var i = 0; i < arr.length; i++) {
  2894. if (looseEqual(arr[i], val)) { return i }
  2895. }
  2896. return -1
  2897. }
  2898. /**
  2899. * Ensure a function is called only once.
  2900. */
  2901. function once (fn) {
  2902. var called = false;
  2903. return function () {
  2904. if (!called) {
  2905. called = true;
  2906. fn.apply(this, arguments);
  2907. }
  2908. }
  2909. }
  2910. var ASSET_TYPES = [
  2911. 'component',
  2912. 'directive',
  2913. 'filter'
  2914. ];
  2915. var LIFECYCLE_HOOKS = [
  2916. 'beforeCreate',
  2917. 'created',
  2918. 'beforeMount',
  2919. 'mounted',
  2920. 'beforeUpdate',
  2921. 'updated',
  2922. 'beforeDestroy',
  2923. 'destroyed',
  2924. 'activated',
  2925. 'deactivated',
  2926. 'errorCaptured',
  2927. 'serverPrefetch'
  2928. ];
  2929. /* */
  2930. var config = ({
  2931. /**
  2932. * Option merge strategies (used in core/util/options)
  2933. */
  2934. // $flow-disable-line
  2935. optionMergeStrategies: Object.create(null),
  2936. /**
  2937. * Whether to suppress warnings.
  2938. */
  2939. silent: false,
  2940. /**
  2941. * Show production mode tip message on boot?
  2942. */
  2943. productionTip: "development" !== 'production',
  2944. /**
  2945. * Whether to enable devtools
  2946. */
  2947. devtools: "development" !== 'production',
  2948. /**
  2949. * Whether to record perf
  2950. */
  2951. performance: false,
  2952. /**
  2953. * Error handler for watcher errors
  2954. */
  2955. errorHandler: null,
  2956. /**
  2957. * Warn handler for watcher warns
  2958. */
  2959. warnHandler: null,
  2960. /**
  2961. * Ignore certain custom elements
  2962. */
  2963. ignoredElements: [],
  2964. /**
  2965. * Custom user key aliases for v-on
  2966. */
  2967. // $flow-disable-line
  2968. keyCodes: Object.create(null),
  2969. /**
  2970. * Check if a tag is reserved so that it cannot be registered as a
  2971. * component. This is platform-dependent and may be overwritten.
  2972. */
  2973. isReservedTag: no,
  2974. /**
  2975. * Check if an attribute is reserved so that it cannot be used as a component
  2976. * prop. This is platform-dependent and may be overwritten.
  2977. */
  2978. isReservedAttr: no,
  2979. /**
  2980. * Check if a tag is an unknown element.
  2981. * Platform-dependent.
  2982. */
  2983. isUnknownElement: no,
  2984. /**
  2985. * Get the namespace of an element
  2986. */
  2987. getTagNamespace: noop,
  2988. /**
  2989. * Parse the real tag name for the specific platform.
  2990. */
  2991. parsePlatformTagName: identity,
  2992. /**
  2993. * Check if an attribute must be bound using property, e.g. value
  2994. * Platform-dependent.
  2995. */
  2996. mustUseProp: no,
  2997. /**
  2998. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  2999. * This will significantly reduce performance if set to false.
  3000. */
  3001. async: true,
  3002. /**
  3003. * Exposed for legacy reasons
  3004. */
  3005. _lifecycleHooks: LIFECYCLE_HOOKS
  3006. });
  3007. /* */
  3008. /**
  3009. * unicode letters used for parsing html tags, component names and property paths.
  3010. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  3011. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  3012. */
  3013. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  3014. /**
  3015. * Check if a string starts with $ or _
  3016. */
  3017. function isReserved (str) {
  3018. var c = (str + '').charCodeAt(0);
  3019. return c === 0x24 || c === 0x5F
  3020. }
  3021. /**
  3022. * Define a property.
  3023. */
  3024. function def (obj, key, val, enumerable) {
  3025. Object.defineProperty(obj, key, {
  3026. value: val,
  3027. enumerable: !!enumerable,
  3028. writable: true,
  3029. configurable: true
  3030. });
  3031. }
  3032. /**
  3033. * Parse simple path.
  3034. */
  3035. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  3036. function parsePath (path) {
  3037. if (bailRE.test(path)) {
  3038. return
  3039. }
  3040. var segments = path.split('.');
  3041. return function (obj) {
  3042. for (var i = 0; i < segments.length; i++) {
  3043. if (!obj) { return }
  3044. obj = obj[segments[i]];
  3045. }
  3046. return obj
  3047. }
  3048. }
  3049. /* */
  3050. // can we use __proto__?
  3051. var hasProto = '__proto__' in {};
  3052. // Browser environment sniffing
  3053. var inBrowser = typeof window !== 'undefined';
  3054. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  3055. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  3056. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  3057. var isIE = UA && /msie|trident/.test(UA);
  3058. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  3059. var isEdge = UA && UA.indexOf('edge/') > 0;
  3060. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  3061. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  3062. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  3063. var isPhantomJS = UA && /phantomjs/.test(UA);
  3064. var isFF = UA && UA.match(/firefox\/(\d+)/);
  3065. // Firefox has a "watch" function on Object.prototype...
  3066. var nativeWatch = ({}).watch;
  3067. if (inBrowser) {
  3068. try {
  3069. var opts = {};
  3070. Object.defineProperty(opts, 'passive', ({
  3071. get: function get () {
  3072. }
  3073. })); // https://github.com/facebook/flow/issues/285
  3074. window.addEventListener('test-passive', null, opts);
  3075. } catch (e) {}
  3076. }
  3077. // this needs to be lazy-evaled because vue may be required before
  3078. // vue-server-renderer can set VUE_ENV
  3079. var _isServer;
  3080. var isServerRendering = function () {
  3081. if (_isServer === undefined) {
  3082. /* istanbul ignore if */
  3083. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  3084. // detect presence of vue-server-renderer and avoid
  3085. // Webpack shimming the process
  3086. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  3087. } else {
  3088. _isServer = false;
  3089. }
  3090. }
  3091. return _isServer
  3092. };
  3093. // detect devtools
  3094. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  3095. /* istanbul ignore next */
  3096. function isNative (Ctor) {
  3097. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  3098. }
  3099. var hasSymbol =
  3100. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  3101. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  3102. var _Set;
  3103. /* istanbul ignore if */ // $flow-disable-line
  3104. if (typeof Set !== 'undefined' && isNative(Set)) {
  3105. // use native Set when available.
  3106. _Set = Set;
  3107. } else {
  3108. // a non-standard Set polyfill that only works with primitive keys.
  3109. _Set = /*@__PURE__*/(function () {
  3110. function Set () {
  3111. this.set = Object.create(null);
  3112. }
  3113. Set.prototype.has = function has (key) {
  3114. return this.set[key] === true
  3115. };
  3116. Set.prototype.add = function add (key) {
  3117. this.set[key] = true;
  3118. };
  3119. Set.prototype.clear = function clear () {
  3120. this.set = Object.create(null);
  3121. };
  3122. return Set;
  3123. }());
  3124. }
  3125. /* */
  3126. var warn = noop;
  3127. var tip = noop;
  3128. var generateComponentTrace = (noop); // work around flow check
  3129. var formatComponentName = (noop);
  3130. if (true) {
  3131. var hasConsole = typeof console !== 'undefined';
  3132. var classifyRE = /(?:^|[-_])(\w)/g;
  3133. var classify = function (str) { return str
  3134. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  3135. .replace(/[-_]/g, ''); };
  3136. warn = function (msg, vm) {
  3137. var trace = vm ? generateComponentTrace(vm) : '';
  3138. if (config.warnHandler) {
  3139. config.warnHandler.call(null, msg, vm, trace);
  3140. } else if (hasConsole && (!config.silent)) {
  3141. console.error(("[Vue warn]: " + msg + trace));
  3142. }
  3143. };
  3144. tip = function (msg, vm) {
  3145. if (hasConsole && (!config.silent)) {
  3146. console.warn("[Vue tip]: " + msg + (
  3147. vm ? generateComponentTrace(vm) : ''
  3148. ));
  3149. }
  3150. };
  3151. formatComponentName = function (vm, includeFile) {
  3152. if (vm.$root === vm) {
  3153. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  3154. return ('') + vm.$options.__file
  3155. }
  3156. return '<Root>'
  3157. }
  3158. var options = typeof vm === 'function' && vm.cid != null
  3159. ? vm.options
  3160. : vm._isVue
  3161. ? vm.$options || vm.constructor.options
  3162. : vm;
  3163. var name = options.name || options._componentTag;
  3164. var file = options.__file;
  3165. if (!name && file) {
  3166. var match = file.match(/([^/\\]+)\.vue$/);
  3167. name = match && match[1];
  3168. }
  3169. return (
  3170. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  3171. (file && includeFile !== false ? (" at " + file) : '')
  3172. )
  3173. };
  3174. var repeat = function (str, n) {
  3175. var res = '';
  3176. while (n) {
  3177. if (n % 2 === 1) { res += str; }
  3178. if (n > 1) { str += str; }
  3179. n >>= 1;
  3180. }
  3181. return res
  3182. };
  3183. generateComponentTrace = function (vm) {
  3184. if (vm._isVue && vm.$parent) {
  3185. var tree = [];
  3186. var currentRecursiveSequence = 0;
  3187. while (vm && vm.$options.name !== 'PageBody') {
  3188. if (tree.length > 0) {
  3189. var last = tree[tree.length - 1];
  3190. if (last.constructor === vm.constructor) {
  3191. currentRecursiveSequence++;
  3192. vm = vm.$parent;
  3193. continue
  3194. } else if (currentRecursiveSequence > 0) {
  3195. tree[tree.length - 1] = [last, currentRecursiveSequence];
  3196. currentRecursiveSequence = 0;
  3197. }
  3198. }
  3199. !vm.$options.isReserved && tree.push(vm);
  3200. vm = vm.$parent;
  3201. }
  3202. return '\n\nfound in\n\n' + tree
  3203. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  3204. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  3205. : formatComponentName(vm))); })
  3206. .join('\n')
  3207. } else {
  3208. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  3209. }
  3210. };
  3211. }
  3212. /* */
  3213. var uid = 0;
  3214. /**
  3215. * A dep is an observable that can have multiple
  3216. * directives subscribing to it.
  3217. */
  3218. var Dep = function Dep () {
  3219. this.id = uid++;
  3220. this.subs = [];
  3221. };
  3222. Dep.prototype.addSub = function addSub (sub) {
  3223. this.subs.push(sub);
  3224. };
  3225. Dep.prototype.removeSub = function removeSub (sub) {
  3226. remove(this.subs, sub);
  3227. };
  3228. Dep.prototype.depend = function depend () {
  3229. if (Dep.SharedObject.target) {
  3230. Dep.SharedObject.target.addDep(this);
  3231. }
  3232. };
  3233. Dep.prototype.notify = function notify () {
  3234. // stabilize the subscriber list first
  3235. var subs = this.subs.slice();
  3236. if ( true && !config.async) {
  3237. // subs aren't sorted in scheduler if not running async
  3238. // we need to sort them now to make sure they fire in correct
  3239. // order
  3240. subs.sort(function (a, b) { return a.id - b.id; });
  3241. }
  3242. for (var i = 0, l = subs.length; i < l; i++) {
  3243. subs[i].update();
  3244. }
  3245. };
  3246. // The current target watcher being evaluated.
  3247. // This is globally unique because only one watcher
  3248. // can be evaluated at a time.
  3249. // fixed by xxxxxx (nvue shared vuex)
  3250. /* eslint-disable no-undef */
  3251. Dep.SharedObject = {};
  3252. Dep.SharedObject.target = null;
  3253. Dep.SharedObject.targetStack = [];
  3254. function pushTarget (target) {
  3255. Dep.SharedObject.targetStack.push(target);
  3256. Dep.SharedObject.target = target;
  3257. Dep.target = target;
  3258. }
  3259. function popTarget () {
  3260. Dep.SharedObject.targetStack.pop();
  3261. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  3262. Dep.target = Dep.SharedObject.target;
  3263. }
  3264. /* */
  3265. var VNode = function VNode (
  3266. tag,
  3267. data,
  3268. children,
  3269. text,
  3270. elm,
  3271. context,
  3272. componentOptions,
  3273. asyncFactory
  3274. ) {
  3275. this.tag = tag;
  3276. this.data = data;
  3277. this.children = children;
  3278. this.text = text;
  3279. this.elm = elm;
  3280. this.ns = undefined;
  3281. this.context = context;
  3282. this.fnContext = undefined;
  3283. this.fnOptions = undefined;
  3284. this.fnScopeId = undefined;
  3285. this.key = data && data.key;
  3286. this.componentOptions = componentOptions;
  3287. this.componentInstance = undefined;
  3288. this.parent = undefined;
  3289. this.raw = false;
  3290. this.isStatic = false;
  3291. this.isRootInsert = true;
  3292. this.isComment = false;
  3293. this.isCloned = false;
  3294. this.isOnce = false;
  3295. this.asyncFactory = asyncFactory;
  3296. this.asyncMeta = undefined;
  3297. this.isAsyncPlaceholder = false;
  3298. };
  3299. var prototypeAccessors = { child: { configurable: true } };
  3300. // DEPRECATED: alias for componentInstance for backwards compat.
  3301. /* istanbul ignore next */
  3302. prototypeAccessors.child.get = function () {
  3303. return this.componentInstance
  3304. };
  3305. Object.defineProperties( VNode.prototype, prototypeAccessors );
  3306. var createEmptyVNode = function (text) {
  3307. if ( text === void 0 ) text = '';
  3308. var node = new VNode();
  3309. node.text = text;
  3310. node.isComment = true;
  3311. return node
  3312. };
  3313. function createTextVNode (val) {
  3314. return new VNode(undefined, undefined, undefined, String(val))
  3315. }
  3316. // optimized shallow clone
  3317. // used for static nodes and slot nodes because they may be reused across
  3318. // multiple renders, cloning them avoids errors when DOM manipulations rely
  3319. // on their elm reference.
  3320. function cloneVNode (vnode) {
  3321. var cloned = new VNode(
  3322. vnode.tag,
  3323. vnode.data,
  3324. // #7975
  3325. // clone children array to avoid mutating original in case of cloning
  3326. // a child.
  3327. vnode.children && vnode.children.slice(),
  3328. vnode.text,
  3329. vnode.elm,
  3330. vnode.context,
  3331. vnode.componentOptions,
  3332. vnode.asyncFactory
  3333. );
  3334. cloned.ns = vnode.ns;
  3335. cloned.isStatic = vnode.isStatic;
  3336. cloned.key = vnode.key;
  3337. cloned.isComment = vnode.isComment;
  3338. cloned.fnContext = vnode.fnContext;
  3339. cloned.fnOptions = vnode.fnOptions;
  3340. cloned.fnScopeId = vnode.fnScopeId;
  3341. cloned.asyncMeta = vnode.asyncMeta;
  3342. cloned.isCloned = true;
  3343. return cloned
  3344. }
  3345. /*
  3346. * not type checking this file because flow doesn't play well with
  3347. * dynamically accessing methods on Array prototype
  3348. */
  3349. var arrayProto = Array.prototype;
  3350. var arrayMethods = Object.create(arrayProto);
  3351. var methodsToPatch = [
  3352. 'push',
  3353. 'pop',
  3354. 'shift',
  3355. 'unshift',
  3356. 'splice',
  3357. 'sort',
  3358. 'reverse'
  3359. ];
  3360. /**
  3361. * Intercept mutating methods and emit events
  3362. */
  3363. methodsToPatch.forEach(function (method) {
  3364. // cache original method
  3365. var original = arrayProto[method];
  3366. def(arrayMethods, method, function mutator () {
  3367. var args = [], len = arguments.length;
  3368. while ( len-- ) args[ len ] = arguments[ len ];
  3369. var result = original.apply(this, args);
  3370. var ob = this.__ob__;
  3371. var inserted;
  3372. switch (method) {
  3373. case 'push':
  3374. case 'unshift':
  3375. inserted = args;
  3376. break
  3377. case 'splice':
  3378. inserted = args.slice(2);
  3379. break
  3380. }
  3381. if (inserted) { ob.observeArray(inserted); }
  3382. // notify change
  3383. ob.dep.notify();
  3384. return result
  3385. });
  3386. });
  3387. /* */
  3388. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  3389. /**
  3390. * In some cases we may want to disable observation inside a component's
  3391. * update computation.
  3392. */
  3393. var shouldObserve = true;
  3394. function toggleObserving (value) {
  3395. shouldObserve = value;
  3396. }
  3397. /**
  3398. * Observer class that is attached to each observed
  3399. * object. Once attached, the observer converts the target
  3400. * object's property keys into getter/setters that
  3401. * collect dependencies and dispatch updates.
  3402. */
  3403. var Observer = function Observer (value) {
  3404. this.value = value;
  3405. this.dep = new Dep();
  3406. this.vmCount = 0;
  3407. def(value, '__ob__', this);
  3408. if (Array.isArray(value)) {
  3409. if (hasProto) {
  3410. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  3411. if(value.push !== value.__proto__.push){
  3412. copyAugment(value, arrayMethods, arrayKeys);
  3413. } else {
  3414. protoAugment(value, arrayMethods);
  3415. }
  3416. }
  3417. } else {
  3418. copyAugment(value, arrayMethods, arrayKeys);
  3419. }
  3420. this.observeArray(value);
  3421. } else {
  3422. this.walk(value);
  3423. }
  3424. };
  3425. /**
  3426. * Walk through all properties and convert them into
  3427. * getter/setters. This method should only be called when
  3428. * value type is Object.
  3429. */
  3430. Observer.prototype.walk = function walk (obj) {
  3431. var keys = Object.keys(obj);
  3432. for (var i = 0; i < keys.length; i++) {
  3433. defineReactive$$1(obj, keys[i]);
  3434. }
  3435. };
  3436. /**
  3437. * Observe a list of Array items.
  3438. */
  3439. Observer.prototype.observeArray = function observeArray (items) {
  3440. for (var i = 0, l = items.length; i < l; i++) {
  3441. observe(items[i]);
  3442. }
  3443. };
  3444. // helpers
  3445. /**
  3446. * Augment a target Object or Array by intercepting
  3447. * the prototype chain using __proto__
  3448. */
  3449. function protoAugment (target, src) {
  3450. /* eslint-disable no-proto */
  3451. target.__proto__ = src;
  3452. /* eslint-enable no-proto */
  3453. }
  3454. /**
  3455. * Augment a target Object or Array by defining
  3456. * hidden properties.
  3457. */
  3458. /* istanbul ignore next */
  3459. function copyAugment (target, src, keys) {
  3460. for (var i = 0, l = keys.length; i < l; i++) {
  3461. var key = keys[i];
  3462. def(target, key, src[key]);
  3463. }
  3464. }
  3465. /**
  3466. * Attempt to create an observer instance for a value,
  3467. * returns the new observer if successfully observed,
  3468. * or the existing observer if the value already has one.
  3469. */
  3470. function observe (value, asRootData) {
  3471. if (!isObject(value) || value instanceof VNode) {
  3472. return
  3473. }
  3474. var ob;
  3475. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  3476. ob = value.__ob__;
  3477. } else if (
  3478. shouldObserve &&
  3479. !isServerRendering() &&
  3480. (Array.isArray(value) || isPlainObject(value)) &&
  3481. Object.isExtensible(value) &&
  3482. !value._isVue
  3483. ) {
  3484. ob = new Observer(value);
  3485. }
  3486. if (asRootData && ob) {
  3487. ob.vmCount++;
  3488. }
  3489. return ob
  3490. }
  3491. /**
  3492. * Define a reactive property on an Object.
  3493. */
  3494. function defineReactive$$1 (
  3495. obj,
  3496. key,
  3497. val,
  3498. customSetter,
  3499. shallow
  3500. ) {
  3501. var dep = new Dep();
  3502. var property = Object.getOwnPropertyDescriptor(obj, key);
  3503. if (property && property.configurable === false) {
  3504. return
  3505. }
  3506. // cater for pre-defined getter/setters
  3507. var getter = property && property.get;
  3508. var setter = property && property.set;
  3509. if ((!getter || setter) && arguments.length === 2) {
  3510. val = obj[key];
  3511. }
  3512. var childOb = !shallow && observe(val);
  3513. Object.defineProperty(obj, key, {
  3514. enumerable: true,
  3515. configurable: true,
  3516. get: function reactiveGetter () {
  3517. var value = getter ? getter.call(obj) : val;
  3518. if (Dep.SharedObject.target) { // fixed by xxxxxx
  3519. dep.depend();
  3520. if (childOb) {
  3521. childOb.dep.depend();
  3522. if (Array.isArray(value)) {
  3523. dependArray(value);
  3524. }
  3525. }
  3526. }
  3527. return value
  3528. },
  3529. set: function reactiveSetter (newVal) {
  3530. var value = getter ? getter.call(obj) : val;
  3531. /* eslint-disable no-self-compare */
  3532. if (newVal === value || (newVal !== newVal && value !== value)) {
  3533. return
  3534. }
  3535. /* eslint-enable no-self-compare */
  3536. if ( true && customSetter) {
  3537. customSetter();
  3538. }
  3539. // #7981: for accessor properties without setter
  3540. if (getter && !setter) { return }
  3541. if (setter) {
  3542. setter.call(obj, newVal);
  3543. } else {
  3544. val = newVal;
  3545. }
  3546. childOb = !shallow && observe(newVal);
  3547. dep.notify();
  3548. }
  3549. });
  3550. }
  3551. /**
  3552. * Set a property on an object. Adds the new property and
  3553. * triggers change notification if the property doesn't
  3554. * already exist.
  3555. */
  3556. function set (target, key, val) {
  3557. if ( true &&
  3558. (isUndef(target) || isPrimitive(target))
  3559. ) {
  3560. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  3561. }
  3562. if (Array.isArray(target) && isValidArrayIndex(key)) {
  3563. target.length = Math.max(target.length, key);
  3564. target.splice(key, 1, val);
  3565. return val
  3566. }
  3567. if (key in target && !(key in Object.prototype)) {
  3568. target[key] = val;
  3569. return val
  3570. }
  3571. var ob = (target).__ob__;
  3572. if (target._isVue || (ob && ob.vmCount)) {
  3573. true && warn(
  3574. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  3575. 'at runtime - declare it upfront in the data option.'
  3576. );
  3577. return val
  3578. }
  3579. if (!ob) {
  3580. target[key] = val;
  3581. return val
  3582. }
  3583. defineReactive$$1(ob.value, key, val);
  3584. ob.dep.notify();
  3585. return val
  3586. }
  3587. /**
  3588. * Delete a property and trigger change if necessary.
  3589. */
  3590. function del (target, key) {
  3591. if ( true &&
  3592. (isUndef(target) || isPrimitive(target))
  3593. ) {
  3594. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  3595. }
  3596. if (Array.isArray(target) && isValidArrayIndex(key)) {
  3597. target.splice(key, 1);
  3598. return
  3599. }
  3600. var ob = (target).__ob__;
  3601. if (target._isVue || (ob && ob.vmCount)) {
  3602. true && warn(
  3603. 'Avoid deleting properties on a Vue instance or its root $data ' +
  3604. '- just set it to null.'
  3605. );
  3606. return
  3607. }
  3608. if (!hasOwn(target, key)) {
  3609. return
  3610. }
  3611. delete target[key];
  3612. if (!ob) {
  3613. return
  3614. }
  3615. ob.dep.notify();
  3616. }
  3617. /**
  3618. * Collect dependencies on array elements when the array is touched, since
  3619. * we cannot intercept array element access like property getters.
  3620. */
  3621. function dependArray (value) {
  3622. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  3623. e = value[i];
  3624. e && e.__ob__ && e.__ob__.dep.depend();
  3625. if (Array.isArray(e)) {
  3626. dependArray(e);
  3627. }
  3628. }
  3629. }
  3630. /* */
  3631. /**
  3632. * Option overwriting strategies are functions that handle
  3633. * how to merge a parent option value and a child option
  3634. * value into the final value.
  3635. */
  3636. var strats = config.optionMergeStrategies;
  3637. /**
  3638. * Options with restrictions
  3639. */
  3640. if (true) {
  3641. strats.el = strats.propsData = function (parent, child, vm, key) {
  3642. if (!vm) {
  3643. warn(
  3644. "option \"" + key + "\" can only be used during instance " +
  3645. 'creation with the `new` keyword.'
  3646. );
  3647. }
  3648. return defaultStrat(parent, child)
  3649. };
  3650. }
  3651. /**
  3652. * Helper that recursively merges two data objects together.
  3653. */
  3654. function mergeData (to, from) {
  3655. if (!from) { return to }
  3656. var key, toVal, fromVal;
  3657. var keys = hasSymbol
  3658. ? Reflect.ownKeys(from)
  3659. : Object.keys(from);
  3660. for (var i = 0; i < keys.length; i++) {
  3661. key = keys[i];
  3662. // in case the object is already observed...
  3663. if (key === '__ob__') { continue }
  3664. toVal = to[key];
  3665. fromVal = from[key];
  3666. if (!hasOwn(to, key)) {
  3667. set(to, key, fromVal);
  3668. } else if (
  3669. toVal !== fromVal &&
  3670. isPlainObject(toVal) &&
  3671. isPlainObject(fromVal)
  3672. ) {
  3673. mergeData(toVal, fromVal);
  3674. }
  3675. }
  3676. return to
  3677. }
  3678. /**
  3679. * Data
  3680. */
  3681. function mergeDataOrFn (
  3682. parentVal,
  3683. childVal,
  3684. vm
  3685. ) {
  3686. if (!vm) {
  3687. // in a Vue.extend merge, both should be functions
  3688. if (!childVal) {
  3689. return parentVal
  3690. }
  3691. if (!parentVal) {
  3692. return childVal
  3693. }
  3694. // when parentVal & childVal are both present,
  3695. // we need to return a function that returns the
  3696. // merged result of both functions... no need to
  3697. // check if parentVal is a function here because
  3698. // it has to be a function to pass previous merges.
  3699. return function mergedDataFn () {
  3700. return mergeData(
  3701. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  3702. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  3703. )
  3704. }
  3705. } else {
  3706. return function mergedInstanceDataFn () {
  3707. // instance merge
  3708. var instanceData = typeof childVal === 'function'
  3709. ? childVal.call(vm, vm)
  3710. : childVal;
  3711. var defaultData = typeof parentVal === 'function'
  3712. ? parentVal.call(vm, vm)
  3713. : parentVal;
  3714. if (instanceData) {
  3715. return mergeData(instanceData, defaultData)
  3716. } else {
  3717. return defaultData
  3718. }
  3719. }
  3720. }
  3721. }
  3722. strats.data = function (
  3723. parentVal,
  3724. childVal,
  3725. vm
  3726. ) {
  3727. if (!vm) {
  3728. if (childVal && typeof childVal !== 'function') {
  3729. true && warn(
  3730. 'The "data" option should be a function ' +
  3731. 'that returns a per-instance value in component ' +
  3732. 'definitions.',
  3733. vm
  3734. );
  3735. return parentVal
  3736. }
  3737. return mergeDataOrFn(parentVal, childVal)
  3738. }
  3739. return mergeDataOrFn(parentVal, childVal, vm)
  3740. };
  3741. /**
  3742. * Hooks and props are merged as arrays.
  3743. */
  3744. function mergeHook (
  3745. parentVal,
  3746. childVal
  3747. ) {
  3748. var res = childVal
  3749. ? parentVal
  3750. ? parentVal.concat(childVal)
  3751. : Array.isArray(childVal)
  3752. ? childVal
  3753. : [childVal]
  3754. : parentVal;
  3755. return res
  3756. ? dedupeHooks(res)
  3757. : res
  3758. }
  3759. function dedupeHooks (hooks) {
  3760. var res = [];
  3761. for (var i = 0; i < hooks.length; i++) {
  3762. if (res.indexOf(hooks[i]) === -1) {
  3763. res.push(hooks[i]);
  3764. }
  3765. }
  3766. return res
  3767. }
  3768. LIFECYCLE_HOOKS.forEach(function (hook) {
  3769. strats[hook] = mergeHook;
  3770. });
  3771. /**
  3772. * Assets
  3773. *
  3774. * When a vm is present (instance creation), we need to do
  3775. * a three-way merge between constructor options, instance
  3776. * options and parent options.
  3777. */
  3778. function mergeAssets (
  3779. parentVal,
  3780. childVal,
  3781. vm,
  3782. key
  3783. ) {
  3784. var res = Object.create(parentVal || null);
  3785. if (childVal) {
  3786. true && assertObjectType(key, childVal, vm);
  3787. return extend(res, childVal)
  3788. } else {
  3789. return res
  3790. }
  3791. }
  3792. ASSET_TYPES.forEach(function (type) {
  3793. strats[type + 's'] = mergeAssets;
  3794. });
  3795. /**
  3796. * Watchers.
  3797. *
  3798. * Watchers hashes should not overwrite one
  3799. * another, so we merge them as arrays.
  3800. */
  3801. strats.watch = function (
  3802. parentVal,
  3803. childVal,
  3804. vm,
  3805. key
  3806. ) {
  3807. // work around Firefox's Object.prototype.watch...
  3808. if (parentVal === nativeWatch) { parentVal = undefined; }
  3809. if (childVal === nativeWatch) { childVal = undefined; }
  3810. /* istanbul ignore if */
  3811. if (!childVal) { return Object.create(parentVal || null) }
  3812. if (true) {
  3813. assertObjectType(key, childVal, vm);
  3814. }
  3815. if (!parentVal) { return childVal }
  3816. var ret = {};
  3817. extend(ret, parentVal);
  3818. for (var key$1 in childVal) {
  3819. var parent = ret[key$1];
  3820. var child = childVal[key$1];
  3821. if (parent && !Array.isArray(parent)) {
  3822. parent = [parent];
  3823. }
  3824. ret[key$1] = parent
  3825. ? parent.concat(child)
  3826. : Array.isArray(child) ? child : [child];
  3827. }
  3828. return ret
  3829. };
  3830. /**
  3831. * Other object hashes.
  3832. */
  3833. strats.props =
  3834. strats.methods =
  3835. strats.inject =
  3836. strats.computed = function (
  3837. parentVal,
  3838. childVal,
  3839. vm,
  3840. key
  3841. ) {
  3842. if (childVal && "development" !== 'production') {
  3843. assertObjectType(key, childVal, vm);
  3844. }
  3845. if (!parentVal) { return childVal }
  3846. var ret = Object.create(null);
  3847. extend(ret, parentVal);
  3848. if (childVal) { extend(ret, childVal); }
  3849. return ret
  3850. };
  3851. strats.provide = mergeDataOrFn;
  3852. /**
  3853. * Default strategy.
  3854. */
  3855. var defaultStrat = function (parentVal, childVal) {
  3856. return childVal === undefined
  3857. ? parentVal
  3858. : childVal
  3859. };
  3860. /**
  3861. * Validate component names
  3862. */
  3863. function checkComponents (options) {
  3864. for (var key in options.components) {
  3865. validateComponentName(key);
  3866. }
  3867. }
  3868. function validateComponentName (name) {
  3869. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  3870. warn(
  3871. 'Invalid component name: "' + name + '". Component names ' +
  3872. 'should conform to valid custom element name in html5 specification.'
  3873. );
  3874. }
  3875. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  3876. warn(
  3877. 'Do not use built-in or reserved HTML elements as component ' +
  3878. 'id: ' + name
  3879. );
  3880. }
  3881. }
  3882. /**
  3883. * Ensure all props option syntax are normalized into the
  3884. * Object-based format.
  3885. */
  3886. function normalizeProps (options, vm) {
  3887. var props = options.props;
  3888. if (!props) { return }
  3889. var res = {};
  3890. var i, val, name;
  3891. if (Array.isArray(props)) {
  3892. i = props.length;
  3893. while (i--) {
  3894. val = props[i];
  3895. if (typeof val === 'string') {
  3896. name = camelize(val);
  3897. res[name] = { type: null };
  3898. } else if (true) {
  3899. warn('props must be strings when using array syntax.');
  3900. }
  3901. }
  3902. } else if (isPlainObject(props)) {
  3903. for (var key in props) {
  3904. val = props[key];
  3905. name = camelize(key);
  3906. res[name] = isPlainObject(val)
  3907. ? val
  3908. : { type: val };
  3909. }
  3910. } else if (true) {
  3911. warn(
  3912. "Invalid value for option \"props\": expected an Array or an Object, " +
  3913. "but got " + (toRawType(props)) + ".",
  3914. vm
  3915. );
  3916. }
  3917. options.props = res;
  3918. }
  3919. /**
  3920. * Normalize all injections into Object-based format
  3921. */
  3922. function normalizeInject (options, vm) {
  3923. var inject = options.inject;
  3924. if (!inject) { return }
  3925. var normalized = options.inject = {};
  3926. if (Array.isArray(inject)) {
  3927. for (var i = 0; i < inject.length; i++) {
  3928. normalized[inject[i]] = { from: inject[i] };
  3929. }
  3930. } else if (isPlainObject(inject)) {
  3931. for (var key in inject) {
  3932. var val = inject[key];
  3933. normalized[key] = isPlainObject(val)
  3934. ? extend({ from: key }, val)
  3935. : { from: val };
  3936. }
  3937. } else if (true) {
  3938. warn(
  3939. "Invalid value for option \"inject\": expected an Array or an Object, " +
  3940. "but got " + (toRawType(inject)) + ".",
  3941. vm
  3942. );
  3943. }
  3944. }
  3945. /**
  3946. * Normalize raw function directives into object format.
  3947. */
  3948. function normalizeDirectives (options) {
  3949. var dirs = options.directives;
  3950. if (dirs) {
  3951. for (var key in dirs) {
  3952. var def$$1 = dirs[key];
  3953. if (typeof def$$1 === 'function') {
  3954. dirs[key] = { bind: def$$1, update: def$$1 };
  3955. }
  3956. }
  3957. }
  3958. }
  3959. function assertObjectType (name, value, vm) {
  3960. if (!isPlainObject(value)) {
  3961. warn(
  3962. "Invalid value for option \"" + name + "\": expected an Object, " +
  3963. "but got " + (toRawType(value)) + ".",
  3964. vm
  3965. );
  3966. }
  3967. }
  3968. /**
  3969. * Merge two option objects into a new one.
  3970. * Core utility used in both instantiation and inheritance.
  3971. */
  3972. function mergeOptions (
  3973. parent,
  3974. child,
  3975. vm
  3976. ) {
  3977. if (true) {
  3978. checkComponents(child);
  3979. }
  3980. if (typeof child === 'function') {
  3981. child = child.options;
  3982. }
  3983. normalizeProps(child, vm);
  3984. normalizeInject(child, vm);
  3985. normalizeDirectives(child);
  3986. // Apply extends and mixins on the child options,
  3987. // but only if it is a raw options object that isn't
  3988. // the result of another mergeOptions call.
  3989. // Only merged options has the _base property.
  3990. if (!child._base) {
  3991. if (child.extends) {
  3992. parent = mergeOptions(parent, child.extends, vm);
  3993. }
  3994. if (child.mixins) {
  3995. for (var i = 0, l = child.mixins.length; i < l; i++) {
  3996. parent = mergeOptions(parent, child.mixins[i], vm);
  3997. }
  3998. }
  3999. }
  4000. var options = {};
  4001. var key;
  4002. for (key in parent) {
  4003. mergeField(key);
  4004. }
  4005. for (key in child) {
  4006. if (!hasOwn(parent, key)) {
  4007. mergeField(key);
  4008. }
  4009. }
  4010. function mergeField (key) {
  4011. var strat = strats[key] || defaultStrat;
  4012. options[key] = strat(parent[key], child[key], vm, key);
  4013. }
  4014. return options
  4015. }
  4016. /**
  4017. * Resolve an asset.
  4018. * This function is used because child instances need access
  4019. * to assets defined in its ancestor chain.
  4020. */
  4021. function resolveAsset (
  4022. options,
  4023. type,
  4024. id,
  4025. warnMissing
  4026. ) {
  4027. /* istanbul ignore if */
  4028. if (typeof id !== 'string') {
  4029. return
  4030. }
  4031. var assets = options[type];
  4032. // check local registration variations first
  4033. if (hasOwn(assets, id)) { return assets[id] }
  4034. var camelizedId = camelize(id);
  4035. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  4036. var PascalCaseId = capitalize(camelizedId);
  4037. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  4038. // fallback to prototype chain
  4039. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  4040. if ( true && warnMissing && !res) {
  4041. warn(
  4042. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  4043. options
  4044. );
  4045. }
  4046. return res
  4047. }
  4048. /* */
  4049. function validateProp (
  4050. key,
  4051. propOptions,
  4052. propsData,
  4053. vm
  4054. ) {
  4055. var prop = propOptions[key];
  4056. var absent = !hasOwn(propsData, key);
  4057. var value = propsData[key];
  4058. // boolean casting
  4059. var booleanIndex = getTypeIndex(Boolean, prop.type);
  4060. if (booleanIndex > -1) {
  4061. if (absent && !hasOwn(prop, 'default')) {
  4062. value = false;
  4063. } else if (value === '' || value === hyphenate(key)) {
  4064. // only cast empty string / same name to boolean if
  4065. // boolean has higher priority
  4066. var stringIndex = getTypeIndex(String, prop.type);
  4067. if (stringIndex < 0 || booleanIndex < stringIndex) {
  4068. value = true;
  4069. }
  4070. }
  4071. }
  4072. // check default value
  4073. if (value === undefined) {
  4074. value = getPropDefaultValue(vm, prop, key);
  4075. // since the default value is a fresh copy,
  4076. // make sure to observe it.
  4077. var prevShouldObserve = shouldObserve;
  4078. toggleObserving(true);
  4079. observe(value);
  4080. toggleObserving(prevShouldObserve);
  4081. }
  4082. if (
  4083. true
  4084. ) {
  4085. assertProp(prop, key, value, vm, absent);
  4086. }
  4087. return value
  4088. }
  4089. /**
  4090. * Get the default value of a prop.
  4091. */
  4092. function getPropDefaultValue (vm, prop, key) {
  4093. // no default, return undefined
  4094. if (!hasOwn(prop, 'default')) {
  4095. return undefined
  4096. }
  4097. var def = prop.default;
  4098. // warn against non-factory defaults for Object & Array
  4099. if ( true && isObject(def)) {
  4100. warn(
  4101. 'Invalid default value for prop "' + key + '": ' +
  4102. 'Props with type Object/Array must use a factory function ' +
  4103. 'to return the default value.',
  4104. vm
  4105. );
  4106. }
  4107. // the raw prop value was also undefined from previous render,
  4108. // return previous default value to avoid unnecessary watcher trigger
  4109. if (vm && vm.$options.propsData &&
  4110. vm.$options.propsData[key] === undefined &&
  4111. vm._props[key] !== undefined
  4112. ) {
  4113. return vm._props[key]
  4114. }
  4115. // call factory function for non-Function types
  4116. // a value is Function if its prototype is function even across different execution context
  4117. return typeof def === 'function' && getType(prop.type) !== 'Function'
  4118. ? def.call(vm)
  4119. : def
  4120. }
  4121. /**
  4122. * Assert whether a prop is valid.
  4123. */
  4124. function assertProp (
  4125. prop,
  4126. name,
  4127. value,
  4128. vm,
  4129. absent
  4130. ) {
  4131. if (prop.required && absent) {
  4132. warn(
  4133. 'Missing required prop: "' + name + '"',
  4134. vm
  4135. );
  4136. return
  4137. }
  4138. if (value == null && !prop.required) {
  4139. return
  4140. }
  4141. var type = prop.type;
  4142. var valid = !type || type === true;
  4143. var expectedTypes = [];
  4144. if (type) {
  4145. if (!Array.isArray(type)) {
  4146. type = [type];
  4147. }
  4148. for (var i = 0; i < type.length && !valid; i++) {
  4149. var assertedType = assertType(value, type[i]);
  4150. expectedTypes.push(assertedType.expectedType || '');
  4151. valid = assertedType.valid;
  4152. }
  4153. }
  4154. if (!valid) {
  4155. warn(
  4156. getInvalidTypeMessage(name, value, expectedTypes),
  4157. vm
  4158. );
  4159. return
  4160. }
  4161. var validator = prop.validator;
  4162. if (validator) {
  4163. if (!validator(value)) {
  4164. warn(
  4165. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  4166. vm
  4167. );
  4168. }
  4169. }
  4170. }
  4171. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  4172. function assertType (value, type) {
  4173. var valid;
  4174. var expectedType = getType(type);
  4175. if (simpleCheckRE.test(expectedType)) {
  4176. var t = typeof value;
  4177. valid = t === expectedType.toLowerCase();
  4178. // for primitive wrapper objects
  4179. if (!valid && t === 'object') {
  4180. valid = value instanceof type;
  4181. }
  4182. } else if (expectedType === 'Object') {
  4183. valid = isPlainObject(value);
  4184. } else if (expectedType === 'Array') {
  4185. valid = Array.isArray(value);
  4186. } else {
  4187. valid = value instanceof type;
  4188. }
  4189. return {
  4190. valid: valid,
  4191. expectedType: expectedType
  4192. }
  4193. }
  4194. /**
  4195. * Use function string name to check built-in types,
  4196. * because a simple equality check will fail when running
  4197. * across different vms / iframes.
  4198. */
  4199. function getType (fn) {
  4200. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  4201. return match ? match[1] : ''
  4202. }
  4203. function isSameType (a, b) {
  4204. return getType(a) === getType(b)
  4205. }
  4206. function getTypeIndex (type, expectedTypes) {
  4207. if (!Array.isArray(expectedTypes)) {
  4208. return isSameType(expectedTypes, type) ? 0 : -1
  4209. }
  4210. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  4211. if (isSameType(expectedTypes[i], type)) {
  4212. return i
  4213. }
  4214. }
  4215. return -1
  4216. }
  4217. function getInvalidTypeMessage (name, value, expectedTypes) {
  4218. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  4219. " Expected " + (expectedTypes.map(capitalize).join(', '));
  4220. var expectedType = expectedTypes[0];
  4221. var receivedType = toRawType(value);
  4222. var expectedValue = styleValue(value, expectedType);
  4223. var receivedValue = styleValue(value, receivedType);
  4224. // check if we need to specify expected value
  4225. if (expectedTypes.length === 1 &&
  4226. isExplicable(expectedType) &&
  4227. !isBoolean(expectedType, receivedType)) {
  4228. message += " with value " + expectedValue;
  4229. }
  4230. message += ", got " + receivedType + " ";
  4231. // check if we need to specify received value
  4232. if (isExplicable(receivedType)) {
  4233. message += "with value " + receivedValue + ".";
  4234. }
  4235. return message
  4236. }
  4237. function styleValue (value, type) {
  4238. if (type === 'String') {
  4239. return ("\"" + value + "\"")
  4240. } else if (type === 'Number') {
  4241. return ("" + (Number(value)))
  4242. } else {
  4243. return ("" + value)
  4244. }
  4245. }
  4246. function isExplicable (value) {
  4247. var explicitTypes = ['string', 'number', 'boolean'];
  4248. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  4249. }
  4250. function isBoolean () {
  4251. var args = [], len = arguments.length;
  4252. while ( len-- ) args[ len ] = arguments[ len ];
  4253. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  4254. }
  4255. /* */
  4256. function handleError (err, vm, info) {
  4257. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  4258. // See: https://github.com/vuejs/vuex/issues/1505
  4259. pushTarget();
  4260. try {
  4261. if (vm) {
  4262. var cur = vm;
  4263. while ((cur = cur.$parent)) {
  4264. var hooks = cur.$options.errorCaptured;
  4265. if (hooks) {
  4266. for (var i = 0; i < hooks.length; i++) {
  4267. try {
  4268. var capture = hooks[i].call(cur, err, vm, info) === false;
  4269. if (capture) { return }
  4270. } catch (e) {
  4271. globalHandleError(e, cur, 'errorCaptured hook');
  4272. }
  4273. }
  4274. }
  4275. }
  4276. }
  4277. globalHandleError(err, vm, info);
  4278. } finally {
  4279. popTarget();
  4280. }
  4281. }
  4282. function invokeWithErrorHandling (
  4283. handler,
  4284. context,
  4285. args,
  4286. vm,
  4287. info
  4288. ) {
  4289. var res;
  4290. try {
  4291. res = args ? handler.apply(context, args) : handler.call(context);
  4292. if (res && !res._isVue && isPromise(res) && !res._handled) {
  4293. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  4294. // issue #9511
  4295. // avoid catch triggering multiple times when nested calls
  4296. res._handled = true;
  4297. }
  4298. } catch (e) {
  4299. handleError(e, vm, info);
  4300. }
  4301. return res
  4302. }
  4303. function globalHandleError (err, vm, info) {
  4304. if (config.errorHandler) {
  4305. try {
  4306. return config.errorHandler.call(null, err, vm, info)
  4307. } catch (e) {
  4308. // if the user intentionally throws the original error in the handler,
  4309. // do not log it twice
  4310. if (e !== err) {
  4311. logError(e, null, 'config.errorHandler');
  4312. }
  4313. }
  4314. }
  4315. logError(err, vm, info);
  4316. }
  4317. function logError (err, vm, info) {
  4318. if (true) {
  4319. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  4320. }
  4321. /* istanbul ignore else */
  4322. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  4323. console.error(err);
  4324. } else {
  4325. throw err
  4326. }
  4327. }
  4328. /* */
  4329. var callbacks = [];
  4330. var pending = false;
  4331. function flushCallbacks () {
  4332. pending = false;
  4333. var copies = callbacks.slice(0);
  4334. callbacks.length = 0;
  4335. for (var i = 0; i < copies.length; i++) {
  4336. copies[i]();
  4337. }
  4338. }
  4339. // Here we have async deferring wrappers using microtasks.
  4340. // In 2.5 we used (macro) tasks (in combination with microtasks).
  4341. // However, it has subtle problems when state is changed right before repaint
  4342. // (e.g. #6813, out-in transitions).
  4343. // Also, using (macro) tasks in event handler would cause some weird behaviors
  4344. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  4345. // So we now use microtasks everywhere, again.
  4346. // A major drawback of this tradeoff is that there are some scenarios
  4347. // where microtasks have too high a priority and fire in between supposedly
  4348. // sequential events (e.g. #4521, #6690, which have workarounds)
  4349. // or even between bubbling of the same event (#6566).
  4350. var timerFunc;
  4351. // The nextTick behavior leverages the microtask queue, which can be accessed
  4352. // via either native Promise.then or MutationObserver.
  4353. // MutationObserver has wider support, however it is seriously bugged in
  4354. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  4355. // completely stops working after triggering a few times... so, if native
  4356. // Promise is available, we will use it:
  4357. /* istanbul ignore next, $flow-disable-line */
  4358. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  4359. var p = Promise.resolve();
  4360. timerFunc = function () {
  4361. p.then(flushCallbacks);
  4362. // In problematic UIWebViews, Promise.then doesn't completely break, but
  4363. // it can get stuck in a weird state where callbacks are pushed into the
  4364. // microtask queue but the queue isn't being flushed, until the browser
  4365. // needs to do some other work, e.g. handle a timer. Therefore we can
  4366. // "force" the microtask queue to be flushed by adding an empty timer.
  4367. if (isIOS) { setTimeout(noop); }
  4368. };
  4369. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  4370. isNative(MutationObserver) ||
  4371. // PhantomJS and iOS 7.x
  4372. MutationObserver.toString() === '[object MutationObserverConstructor]'
  4373. )) {
  4374. // Use MutationObserver where native Promise is not available,
  4375. // e.g. PhantomJS, iOS7, Android 4.4
  4376. // (#6466 MutationObserver is unreliable in IE11)
  4377. var counter = 1;
  4378. var observer = new MutationObserver(flushCallbacks);
  4379. var textNode = document.createTextNode(String(counter));
  4380. observer.observe(textNode, {
  4381. characterData: true
  4382. });
  4383. timerFunc = function () {
  4384. counter = (counter + 1) % 2;
  4385. textNode.data = String(counter);
  4386. };
  4387. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  4388. // Fallback to setImmediate.
  4389. // Technically it leverages the (macro) task queue,
  4390. // but it is still a better choice than setTimeout.
  4391. timerFunc = function () {
  4392. setImmediate(flushCallbacks);
  4393. };
  4394. } else {
  4395. // Fallback to setTimeout.
  4396. timerFunc = function () {
  4397. setTimeout(flushCallbacks, 0);
  4398. };
  4399. }
  4400. function nextTick (cb, ctx) {
  4401. var _resolve;
  4402. callbacks.push(function () {
  4403. if (cb) {
  4404. try {
  4405. cb.call(ctx);
  4406. } catch (e) {
  4407. handleError(e, ctx, 'nextTick');
  4408. }
  4409. } else if (_resolve) {
  4410. _resolve(ctx);
  4411. }
  4412. });
  4413. if (!pending) {
  4414. pending = true;
  4415. timerFunc();
  4416. }
  4417. // $flow-disable-line
  4418. if (!cb && typeof Promise !== 'undefined') {
  4419. return new Promise(function (resolve) {
  4420. _resolve = resolve;
  4421. })
  4422. }
  4423. }
  4424. /* */
  4425. /* not type checking this file because flow doesn't play well with Proxy */
  4426. var initProxy;
  4427. if (true) {
  4428. var allowedGlobals = makeMap(
  4429. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  4430. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  4431. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  4432. 'require' // for Webpack/Browserify
  4433. );
  4434. var warnNonPresent = function (target, key) {
  4435. warn(
  4436. "Property or method \"" + key + "\" is not defined on the instance but " +
  4437. 'referenced during render. Make sure that this property is reactive, ' +
  4438. 'either in the data option, or for class-based components, by ' +
  4439. 'initializing the property. ' +
  4440. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  4441. target
  4442. );
  4443. };
  4444. var warnReservedPrefix = function (target, key) {
  4445. warn(
  4446. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  4447. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  4448. 'prevent conflicts with Vue internals. ' +
  4449. 'See: https://vuejs.org/v2/api/#data',
  4450. target
  4451. );
  4452. };
  4453. var hasProxy =
  4454. typeof Proxy !== 'undefined' && isNative(Proxy);
  4455. if (hasProxy) {
  4456. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  4457. config.keyCodes = new Proxy(config.keyCodes, {
  4458. set: function set (target, key, value) {
  4459. if (isBuiltInModifier(key)) {
  4460. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  4461. return false
  4462. } else {
  4463. target[key] = value;
  4464. return true
  4465. }
  4466. }
  4467. });
  4468. }
  4469. var hasHandler = {
  4470. has: function has (target, key) {
  4471. var has = key in target;
  4472. var isAllowed = allowedGlobals(key) ||
  4473. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  4474. if (!has && !isAllowed) {
  4475. if (key in target.$data) { warnReservedPrefix(target, key); }
  4476. else { warnNonPresent(target, key); }
  4477. }
  4478. return has || !isAllowed
  4479. }
  4480. };
  4481. var getHandler = {
  4482. get: function get (target, key) {
  4483. if (typeof key === 'string' && !(key in target)) {
  4484. if (key in target.$data) { warnReservedPrefix(target, key); }
  4485. else { warnNonPresent(target, key); }
  4486. }
  4487. return target[key]
  4488. }
  4489. };
  4490. initProxy = function initProxy (vm) {
  4491. if (hasProxy) {
  4492. // determine which proxy handler to use
  4493. var options = vm.$options;
  4494. var handlers = options.render && options.render._withStripped
  4495. ? getHandler
  4496. : hasHandler;
  4497. vm._renderProxy = new Proxy(vm, handlers);
  4498. } else {
  4499. vm._renderProxy = vm;
  4500. }
  4501. };
  4502. }
  4503. /* */
  4504. var seenObjects = new _Set();
  4505. /**
  4506. * Recursively traverse an object to evoke all converted
  4507. * getters, so that every nested property inside the object
  4508. * is collected as a "deep" dependency.
  4509. */
  4510. function traverse (val) {
  4511. _traverse(val, seenObjects);
  4512. seenObjects.clear();
  4513. }
  4514. function _traverse (val, seen) {
  4515. var i, keys;
  4516. var isA = Array.isArray(val);
  4517. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  4518. return
  4519. }
  4520. if (val.__ob__) {
  4521. var depId = val.__ob__.dep.id;
  4522. if (seen.has(depId)) {
  4523. return
  4524. }
  4525. seen.add(depId);
  4526. }
  4527. if (isA) {
  4528. i = val.length;
  4529. while (i--) { _traverse(val[i], seen); }
  4530. } else {
  4531. keys = Object.keys(val);
  4532. i = keys.length;
  4533. while (i--) { _traverse(val[keys[i]], seen); }
  4534. }
  4535. }
  4536. var mark;
  4537. var measure;
  4538. if (true) {
  4539. var perf = inBrowser && window.performance;
  4540. /* istanbul ignore if */
  4541. if (
  4542. perf &&
  4543. perf.mark &&
  4544. perf.measure &&
  4545. perf.clearMarks &&
  4546. perf.clearMeasures
  4547. ) {
  4548. mark = function (tag) { return perf.mark(tag); };
  4549. measure = function (name, startTag, endTag) {
  4550. perf.measure(name, startTag, endTag);
  4551. perf.clearMarks(startTag);
  4552. perf.clearMarks(endTag);
  4553. // perf.clearMeasures(name)
  4554. };
  4555. }
  4556. }
  4557. /* */
  4558. var normalizeEvent = cached(function (name) {
  4559. var passive = name.charAt(0) === '&';
  4560. name = passive ? name.slice(1) : name;
  4561. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  4562. name = once$$1 ? name.slice(1) : name;
  4563. var capture = name.charAt(0) === '!';
  4564. name = capture ? name.slice(1) : name;
  4565. return {
  4566. name: name,
  4567. once: once$$1,
  4568. capture: capture,
  4569. passive: passive
  4570. }
  4571. });
  4572. function createFnInvoker (fns, vm) {
  4573. function invoker () {
  4574. var arguments$1 = arguments;
  4575. var fns = invoker.fns;
  4576. if (Array.isArray(fns)) {
  4577. var cloned = fns.slice();
  4578. for (var i = 0; i < cloned.length; i++) {
  4579. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  4580. }
  4581. } else {
  4582. // return handler return value for single handlers
  4583. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  4584. }
  4585. }
  4586. invoker.fns = fns;
  4587. return invoker
  4588. }
  4589. function updateListeners (
  4590. on,
  4591. oldOn,
  4592. add,
  4593. remove$$1,
  4594. createOnceHandler,
  4595. vm
  4596. ) {
  4597. var name, def$$1, cur, old, event;
  4598. for (name in on) {
  4599. def$$1 = cur = on[name];
  4600. old = oldOn[name];
  4601. event = normalizeEvent(name);
  4602. if (isUndef(cur)) {
  4603. true && warn(
  4604. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  4605. vm
  4606. );
  4607. } else if (isUndef(old)) {
  4608. if (isUndef(cur.fns)) {
  4609. cur = on[name] = createFnInvoker(cur, vm);
  4610. }
  4611. if (isTrue(event.once)) {
  4612. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  4613. }
  4614. add(event.name, cur, event.capture, event.passive, event.params);
  4615. } else if (cur !== old) {
  4616. old.fns = cur;
  4617. on[name] = old;
  4618. }
  4619. }
  4620. for (name in oldOn) {
  4621. if (isUndef(on[name])) {
  4622. event = normalizeEvent(name);
  4623. remove$$1(event.name, oldOn[name], event.capture);
  4624. }
  4625. }
  4626. }
  4627. /* */
  4628. /* */
  4629. // fixed by xxxxxx (mp properties)
  4630. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  4631. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  4632. if (isUndef(propOptions)) {
  4633. return res
  4634. }
  4635. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  4636. var attrs = data.attrs;
  4637. var props = data.props;
  4638. if (isDef(attrs) || isDef(props)) {
  4639. for (var key in propOptions) {
  4640. var altKey = hyphenate(key);
  4641. var result = checkProp(res, props, key, altKey, true) ||
  4642. checkProp(res, attrs, key, altKey, false);
  4643. // externalClass
  4644. if (
  4645. result &&
  4646. res[key] &&
  4647. externalClasses.indexOf(altKey) !== -1 &&
  4648. context[camelize(res[key])]
  4649. ) {
  4650. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  4651. res[key] = context[camelize(res[key])];
  4652. }
  4653. }
  4654. }
  4655. return res
  4656. }
  4657. function extractPropsFromVNodeData (
  4658. data,
  4659. Ctor,
  4660. tag,
  4661. context// fixed by xxxxxx
  4662. ) {
  4663. // we are only extracting raw values here.
  4664. // validation and default values are handled in the child
  4665. // component itself.
  4666. var propOptions = Ctor.options.props;
  4667. if (isUndef(propOptions)) {
  4668. // fixed by xxxxxx
  4669. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  4670. }
  4671. var res = {};
  4672. var attrs = data.attrs;
  4673. var props = data.props;
  4674. if (isDef(attrs) || isDef(props)) {
  4675. for (var key in propOptions) {
  4676. var altKey = hyphenate(key);
  4677. if (true) {
  4678. var keyInLowerCase = key.toLowerCase();
  4679. if (
  4680. key !== keyInLowerCase &&
  4681. attrs && hasOwn(attrs, keyInLowerCase)
  4682. ) {
  4683. tip(
  4684. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  4685. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  4686. " \"" + key + "\". " +
  4687. "Note that HTML attributes are case-insensitive and camelCased " +
  4688. "props need to use their kebab-case equivalents when using in-DOM " +
  4689. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  4690. );
  4691. }
  4692. }
  4693. checkProp(res, props, key, altKey, true) ||
  4694. checkProp(res, attrs, key, altKey, false);
  4695. }
  4696. }
  4697. // fixed by xxxxxx
  4698. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  4699. }
  4700. function checkProp (
  4701. res,
  4702. hash,
  4703. key,
  4704. altKey,
  4705. preserve
  4706. ) {
  4707. if (isDef(hash)) {
  4708. if (hasOwn(hash, key)) {
  4709. res[key] = hash[key];
  4710. if (!preserve) {
  4711. delete hash[key];
  4712. }
  4713. return true
  4714. } else if (hasOwn(hash, altKey)) {
  4715. res[key] = hash[altKey];
  4716. if (!preserve) {
  4717. delete hash[altKey];
  4718. }
  4719. return true
  4720. }
  4721. }
  4722. return false
  4723. }
  4724. /* */
  4725. // The template compiler attempts to minimize the need for normalization by
  4726. // statically analyzing the template at compile time.
  4727. //
  4728. // For plain HTML markup, normalization can be completely skipped because the
  4729. // generated render function is guaranteed to return Array<VNode>. There are
  4730. // two cases where extra normalization is needed:
  4731. // 1. When the children contains components - because a functional component
  4732. // may return an Array instead of a single root. In this case, just a simple
  4733. // normalization is needed - if any child is an Array, we flatten the whole
  4734. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  4735. // because functional components already normalize their own children.
  4736. function simpleNormalizeChildren (children) {
  4737. for (var i = 0; i < children.length; i++) {
  4738. if (Array.isArray(children[i])) {
  4739. return Array.prototype.concat.apply([], children)
  4740. }
  4741. }
  4742. return children
  4743. }
  4744. // 2. When the children contains constructs that always generated nested Arrays,
  4745. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  4746. // with hand-written render functions / JSX. In such cases a full normalization
  4747. // is needed to cater to all possible types of children values.
  4748. function normalizeChildren (children) {
  4749. return isPrimitive(children)
  4750. ? [createTextVNode(children)]
  4751. : Array.isArray(children)
  4752. ? normalizeArrayChildren(children)
  4753. : undefined
  4754. }
  4755. function isTextNode (node) {
  4756. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  4757. }
  4758. function normalizeArrayChildren (children, nestedIndex) {
  4759. var res = [];
  4760. var i, c, lastIndex, last;
  4761. for (i = 0; i < children.length; i++) {
  4762. c = children[i];
  4763. if (isUndef(c) || typeof c === 'boolean') { continue }
  4764. lastIndex = res.length - 1;
  4765. last = res[lastIndex];
  4766. // nested
  4767. if (Array.isArray(c)) {
  4768. if (c.length > 0) {
  4769. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  4770. // merge adjacent text nodes
  4771. if (isTextNode(c[0]) && isTextNode(last)) {
  4772. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  4773. c.shift();
  4774. }
  4775. res.push.apply(res, c);
  4776. }
  4777. } else if (isPrimitive(c)) {
  4778. if (isTextNode(last)) {
  4779. // merge adjacent text nodes
  4780. // this is necessary for SSR hydration because text nodes are
  4781. // essentially merged when rendered to HTML strings
  4782. res[lastIndex] = createTextVNode(last.text + c);
  4783. } else if (c !== '') {
  4784. // convert primitive to vnode
  4785. res.push(createTextVNode(c));
  4786. }
  4787. } else {
  4788. if (isTextNode(c) && isTextNode(last)) {
  4789. // merge adjacent text nodes
  4790. res[lastIndex] = createTextVNode(last.text + c.text);
  4791. } else {
  4792. // default key for nested array children (likely generated by v-for)
  4793. if (isTrue(children._isVList) &&
  4794. isDef(c.tag) &&
  4795. isUndef(c.key) &&
  4796. isDef(nestedIndex)) {
  4797. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  4798. }
  4799. res.push(c);
  4800. }
  4801. }
  4802. }
  4803. return res
  4804. }
  4805. /* */
  4806. function initProvide (vm) {
  4807. var provide = vm.$options.provide;
  4808. if (provide) {
  4809. vm._provided = typeof provide === 'function'
  4810. ? provide.call(vm)
  4811. : provide;
  4812. }
  4813. }
  4814. function initInjections (vm) {
  4815. var result = resolveInject(vm.$options.inject, vm);
  4816. if (result) {
  4817. toggleObserving(false);
  4818. Object.keys(result).forEach(function (key) {
  4819. /* istanbul ignore else */
  4820. if (true) {
  4821. defineReactive$$1(vm, key, result[key], function () {
  4822. warn(
  4823. "Avoid mutating an injected value directly since the changes will be " +
  4824. "overwritten whenever the provided component re-renders. " +
  4825. "injection being mutated: \"" + key + "\"",
  4826. vm
  4827. );
  4828. });
  4829. } else {}
  4830. });
  4831. toggleObserving(true);
  4832. }
  4833. }
  4834. function resolveInject (inject, vm) {
  4835. if (inject) {
  4836. // inject is :any because flow is not smart enough to figure out cached
  4837. var result = Object.create(null);
  4838. var keys = hasSymbol
  4839. ? Reflect.ownKeys(inject)
  4840. : Object.keys(inject);
  4841. for (var i = 0; i < keys.length; i++) {
  4842. var key = keys[i];
  4843. // #6574 in case the inject object is observed...
  4844. if (key === '__ob__') { continue }
  4845. var provideKey = inject[key].from;
  4846. var source = vm;
  4847. while (source) {
  4848. if (source._provided && hasOwn(source._provided, provideKey)) {
  4849. result[key] = source._provided[provideKey];
  4850. break
  4851. }
  4852. source = source.$parent;
  4853. }
  4854. if (!source) {
  4855. if ('default' in inject[key]) {
  4856. var provideDefault = inject[key].default;
  4857. result[key] = typeof provideDefault === 'function'
  4858. ? provideDefault.call(vm)
  4859. : provideDefault;
  4860. } else if (true) {
  4861. warn(("Injection \"" + key + "\" not found"), vm);
  4862. }
  4863. }
  4864. }
  4865. return result
  4866. }
  4867. }
  4868. /* */
  4869. /**
  4870. * Runtime helper for resolving raw children VNodes into a slot object.
  4871. */
  4872. function resolveSlots (
  4873. children,
  4874. context
  4875. ) {
  4876. if (!children || !children.length) {
  4877. return {}
  4878. }
  4879. var slots = {};
  4880. for (var i = 0, l = children.length; i < l; i++) {
  4881. var child = children[i];
  4882. var data = child.data;
  4883. // remove slot attribute if the node is resolved as a Vue slot node
  4884. if (data && data.attrs && data.attrs.slot) {
  4885. delete data.attrs.slot;
  4886. }
  4887. // named slots should only be respected if the vnode was rendered in the
  4888. // same context.
  4889. if ((child.context === context || child.fnContext === context) &&
  4890. data && data.slot != null
  4891. ) {
  4892. var name = data.slot;
  4893. var slot = (slots[name] || (slots[name] = []));
  4894. if (child.tag === 'template') {
  4895. slot.push.apply(slot, child.children || []);
  4896. } else {
  4897. slot.push(child);
  4898. }
  4899. } else {
  4900. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  4901. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  4902. (slots['page'] || (slots['page'] = [])).push(child);
  4903. }else{
  4904. (slots.default || (slots.default = [])).push(child);
  4905. }
  4906. }
  4907. }
  4908. // ignore slots that contains only whitespace
  4909. for (var name$1 in slots) {
  4910. if (slots[name$1].every(isWhitespace)) {
  4911. delete slots[name$1];
  4912. }
  4913. }
  4914. return slots
  4915. }
  4916. function isWhitespace (node) {
  4917. return (node.isComment && !node.asyncFactory) || node.text === ' '
  4918. }
  4919. /* */
  4920. function normalizeScopedSlots (
  4921. slots,
  4922. normalSlots,
  4923. prevSlots
  4924. ) {
  4925. var res;
  4926. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  4927. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  4928. var key = slots && slots.$key;
  4929. if (!slots) {
  4930. res = {};
  4931. } else if (slots._normalized) {
  4932. // fast path 1: child component re-render only, parent did not change
  4933. return slots._normalized
  4934. } else if (
  4935. isStable &&
  4936. prevSlots &&
  4937. prevSlots !== emptyObject &&
  4938. key === prevSlots.$key &&
  4939. !hasNormalSlots &&
  4940. !prevSlots.$hasNormal
  4941. ) {
  4942. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  4943. // only need to normalize once
  4944. return prevSlots
  4945. } else {
  4946. res = {};
  4947. for (var key$1 in slots) {
  4948. if (slots[key$1] && key$1[0] !== '$') {
  4949. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  4950. }
  4951. }
  4952. }
  4953. // expose normal slots on scopedSlots
  4954. for (var key$2 in normalSlots) {
  4955. if (!(key$2 in res)) {
  4956. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  4957. }
  4958. }
  4959. // avoriaz seems to mock a non-extensible $scopedSlots object
  4960. // and when that is passed down this would cause an error
  4961. if (slots && Object.isExtensible(slots)) {
  4962. (slots)._normalized = res;
  4963. }
  4964. def(res, '$stable', isStable);
  4965. def(res, '$key', key);
  4966. def(res, '$hasNormal', hasNormalSlots);
  4967. return res
  4968. }
  4969. function normalizeScopedSlot(normalSlots, key, fn) {
  4970. var normalized = function () {
  4971. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  4972. res = res && typeof res === 'object' && !Array.isArray(res)
  4973. ? [res] // single vnode
  4974. : normalizeChildren(res);
  4975. return res && (
  4976. res.length === 0 ||
  4977. (res.length === 1 && res[0].isComment) // #9658
  4978. ) ? undefined
  4979. : res
  4980. };
  4981. // this is a slot using the new v-slot syntax without scope. although it is
  4982. // compiled as a scoped slot, render fn users would expect it to be present
  4983. // on this.$slots because the usage is semantically a normal slot.
  4984. if (fn.proxy) {
  4985. Object.defineProperty(normalSlots, key, {
  4986. get: normalized,
  4987. enumerable: true,
  4988. configurable: true
  4989. });
  4990. }
  4991. return normalized
  4992. }
  4993. function proxyNormalSlot(slots, key) {
  4994. return function () { return slots[key]; }
  4995. }
  4996. /* */
  4997. /**
  4998. * Runtime helper for rendering v-for lists.
  4999. */
  5000. function renderList (
  5001. val,
  5002. render
  5003. ) {
  5004. var ret, i, l, keys, key;
  5005. if (Array.isArray(val) || typeof val === 'string') {
  5006. ret = new Array(val.length);
  5007. for (i = 0, l = val.length; i < l; i++) {
  5008. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  5009. }
  5010. } else if (typeof val === 'number') {
  5011. ret = new Array(val);
  5012. for (i = 0; i < val; i++) {
  5013. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  5014. }
  5015. } else if (isObject(val)) {
  5016. if (hasSymbol && val[Symbol.iterator]) {
  5017. ret = [];
  5018. var iterator = val[Symbol.iterator]();
  5019. var result = iterator.next();
  5020. while (!result.done) {
  5021. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  5022. result = iterator.next();
  5023. }
  5024. } else {
  5025. keys = Object.keys(val);
  5026. ret = new Array(keys.length);
  5027. for (i = 0, l = keys.length; i < l; i++) {
  5028. key = keys[i];
  5029. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  5030. }
  5031. }
  5032. }
  5033. if (!isDef(ret)) {
  5034. ret = [];
  5035. }
  5036. (ret)._isVList = true;
  5037. return ret
  5038. }
  5039. /* */
  5040. /**
  5041. * Runtime helper for rendering <slot>
  5042. */
  5043. function renderSlot (
  5044. name,
  5045. fallback,
  5046. props,
  5047. bindObject
  5048. ) {
  5049. var scopedSlotFn = this.$scopedSlots[name];
  5050. var nodes;
  5051. if (scopedSlotFn) { // scoped slot
  5052. props = props || {};
  5053. if (bindObject) {
  5054. if ( true && !isObject(bindObject)) {
  5055. warn(
  5056. 'slot v-bind without argument expects an Object',
  5057. this
  5058. );
  5059. }
  5060. props = extend(extend({}, bindObject), props);
  5061. }
  5062. // fixed by xxxxxx app-plus scopedSlot
  5063. nodes = scopedSlotFn(props, this, props._i) || fallback;
  5064. } else {
  5065. nodes = this.$slots[name] || fallback;
  5066. }
  5067. var target = props && props.slot;
  5068. if (target) {
  5069. return this.$createElement('template', { slot: target }, nodes)
  5070. } else {
  5071. return nodes
  5072. }
  5073. }
  5074. /* */
  5075. /**
  5076. * Runtime helper for resolving filters
  5077. */
  5078. function resolveFilter (id) {
  5079. return resolveAsset(this.$options, 'filters', id, true) || identity
  5080. }
  5081. /* */
  5082. function isKeyNotMatch (expect, actual) {
  5083. if (Array.isArray(expect)) {
  5084. return expect.indexOf(actual) === -1
  5085. } else {
  5086. return expect !== actual
  5087. }
  5088. }
  5089. /**
  5090. * Runtime helper for checking keyCodes from config.
  5091. * exposed as Vue.prototype._k
  5092. * passing in eventKeyName as last argument separately for backwards compat
  5093. */
  5094. function checkKeyCodes (
  5095. eventKeyCode,
  5096. key,
  5097. builtInKeyCode,
  5098. eventKeyName,
  5099. builtInKeyName
  5100. ) {
  5101. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  5102. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  5103. return isKeyNotMatch(builtInKeyName, eventKeyName)
  5104. } else if (mappedKeyCode) {
  5105. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  5106. } else if (eventKeyName) {
  5107. return hyphenate(eventKeyName) !== key
  5108. }
  5109. }
  5110. /* */
  5111. /**
  5112. * Runtime helper for merging v-bind="object" into a VNode's data.
  5113. */
  5114. function bindObjectProps (
  5115. data,
  5116. tag,
  5117. value,
  5118. asProp,
  5119. isSync
  5120. ) {
  5121. if (value) {
  5122. if (!isObject(value)) {
  5123. true && warn(
  5124. 'v-bind without argument expects an Object or Array value',
  5125. this
  5126. );
  5127. } else {
  5128. if (Array.isArray(value)) {
  5129. value = toObject(value);
  5130. }
  5131. var hash;
  5132. var loop = function ( key ) {
  5133. if (
  5134. key === 'class' ||
  5135. key === 'style' ||
  5136. isReservedAttribute(key)
  5137. ) {
  5138. hash = data;
  5139. } else {
  5140. var type = data.attrs && data.attrs.type;
  5141. hash = asProp || config.mustUseProp(tag, type, key)
  5142. ? data.domProps || (data.domProps = {})
  5143. : data.attrs || (data.attrs = {});
  5144. }
  5145. var camelizedKey = camelize(key);
  5146. var hyphenatedKey = hyphenate(key);
  5147. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  5148. hash[key] = value[key];
  5149. if (isSync) {
  5150. var on = data.on || (data.on = {});
  5151. on[("update:" + key)] = function ($event) {
  5152. value[key] = $event;
  5153. };
  5154. }
  5155. }
  5156. };
  5157. for (var key in value) loop( key );
  5158. }
  5159. }
  5160. return data
  5161. }
  5162. /* */
  5163. /**
  5164. * Runtime helper for rendering static trees.
  5165. */
  5166. function renderStatic (
  5167. index,
  5168. isInFor
  5169. ) {
  5170. var cached = this._staticTrees || (this._staticTrees = []);
  5171. var tree = cached[index];
  5172. // if has already-rendered static tree and not inside v-for,
  5173. // we can reuse the same tree.
  5174. if (tree && !isInFor) {
  5175. return tree
  5176. }
  5177. // otherwise, render a fresh tree.
  5178. tree = cached[index] = this.$options.staticRenderFns[index].call(
  5179. this._renderProxy,
  5180. null,
  5181. this // for render fns generated for functional component templates
  5182. );
  5183. markStatic(tree, ("__static__" + index), false);
  5184. return tree
  5185. }
  5186. /**
  5187. * Runtime helper for v-once.
  5188. * Effectively it means marking the node as static with a unique key.
  5189. */
  5190. function markOnce (
  5191. tree,
  5192. index,
  5193. key
  5194. ) {
  5195. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  5196. return tree
  5197. }
  5198. function markStatic (
  5199. tree,
  5200. key,
  5201. isOnce
  5202. ) {
  5203. if (Array.isArray(tree)) {
  5204. for (var i = 0; i < tree.length; i++) {
  5205. if (tree[i] && typeof tree[i] !== 'string') {
  5206. markStaticNode(tree[i], (key + "_" + i), isOnce);
  5207. }
  5208. }
  5209. } else {
  5210. markStaticNode(tree, key, isOnce);
  5211. }
  5212. }
  5213. function markStaticNode (node, key, isOnce) {
  5214. node.isStatic = true;
  5215. node.key = key;
  5216. node.isOnce = isOnce;
  5217. }
  5218. /* */
  5219. function bindObjectListeners (data, value) {
  5220. if (value) {
  5221. if (!isPlainObject(value)) {
  5222. true && warn(
  5223. 'v-on without argument expects an Object value',
  5224. this
  5225. );
  5226. } else {
  5227. var on = data.on = data.on ? extend({}, data.on) : {};
  5228. for (var key in value) {
  5229. var existing = on[key];
  5230. var ours = value[key];
  5231. on[key] = existing ? [].concat(existing, ours) : ours;
  5232. }
  5233. }
  5234. }
  5235. return data
  5236. }
  5237. /* */
  5238. function resolveScopedSlots (
  5239. fns, // see flow/vnode
  5240. res,
  5241. // the following are added in 2.6
  5242. hasDynamicKeys,
  5243. contentHashKey
  5244. ) {
  5245. res = res || { $stable: !hasDynamicKeys };
  5246. for (var i = 0; i < fns.length; i++) {
  5247. var slot = fns[i];
  5248. if (Array.isArray(slot)) {
  5249. resolveScopedSlots(slot, res, hasDynamicKeys);
  5250. } else if (slot) {
  5251. // marker for reverse proxying v-slot without scope on this.$slots
  5252. if (slot.proxy) {
  5253. slot.fn.proxy = true;
  5254. }
  5255. res[slot.key] = slot.fn;
  5256. }
  5257. }
  5258. if (contentHashKey) {
  5259. (res).$key = contentHashKey;
  5260. }
  5261. return res
  5262. }
  5263. /* */
  5264. function bindDynamicKeys (baseObj, values) {
  5265. for (var i = 0; i < values.length; i += 2) {
  5266. var key = values[i];
  5267. if (typeof key === 'string' && key) {
  5268. baseObj[values[i]] = values[i + 1];
  5269. } else if ( true && key !== '' && key !== null) {
  5270. // null is a special value for explicitly removing a binding
  5271. warn(
  5272. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  5273. this
  5274. );
  5275. }
  5276. }
  5277. return baseObj
  5278. }
  5279. // helper to dynamically append modifier runtime markers to event names.
  5280. // ensure only append when value is already string, otherwise it will be cast
  5281. // to string and cause the type check to miss.
  5282. function prependModifier (value, symbol) {
  5283. return typeof value === 'string' ? symbol + value : value
  5284. }
  5285. /* */
  5286. function installRenderHelpers (target) {
  5287. target._o = markOnce;
  5288. target._n = toNumber;
  5289. target._s = toString;
  5290. target._l = renderList;
  5291. target._t = renderSlot;
  5292. target._q = looseEqual;
  5293. target._i = looseIndexOf;
  5294. target._m = renderStatic;
  5295. target._f = resolveFilter;
  5296. target._k = checkKeyCodes;
  5297. target._b = bindObjectProps;
  5298. target._v = createTextVNode;
  5299. target._e = createEmptyVNode;
  5300. target._u = resolveScopedSlots;
  5301. target._g = bindObjectListeners;
  5302. target._d = bindDynamicKeys;
  5303. target._p = prependModifier;
  5304. }
  5305. /* */
  5306. function FunctionalRenderContext (
  5307. data,
  5308. props,
  5309. children,
  5310. parent,
  5311. Ctor
  5312. ) {
  5313. var this$1 = this;
  5314. var options = Ctor.options;
  5315. // ensure the createElement function in functional components
  5316. // gets a unique context - this is necessary for correct named slot check
  5317. var contextVm;
  5318. if (hasOwn(parent, '_uid')) {
  5319. contextVm = Object.create(parent);
  5320. // $flow-disable-line
  5321. contextVm._original = parent;
  5322. } else {
  5323. // the context vm passed in is a functional context as well.
  5324. // in this case we want to make sure we are able to get a hold to the
  5325. // real context instance.
  5326. contextVm = parent;
  5327. // $flow-disable-line
  5328. parent = parent._original;
  5329. }
  5330. var isCompiled = isTrue(options._compiled);
  5331. var needNormalization = !isCompiled;
  5332. this.data = data;
  5333. this.props = props;
  5334. this.children = children;
  5335. this.parent = parent;
  5336. this.listeners = data.on || emptyObject;
  5337. this.injections = resolveInject(options.inject, parent);
  5338. this.slots = function () {
  5339. if (!this$1.$slots) {
  5340. normalizeScopedSlots(
  5341. data.scopedSlots,
  5342. this$1.$slots = resolveSlots(children, parent)
  5343. );
  5344. }
  5345. return this$1.$slots
  5346. };
  5347. Object.defineProperty(this, 'scopedSlots', ({
  5348. enumerable: true,
  5349. get: function get () {
  5350. return normalizeScopedSlots(data.scopedSlots, this.slots())
  5351. }
  5352. }));
  5353. // support for compiled functional template
  5354. if (isCompiled) {
  5355. // exposing $options for renderStatic()
  5356. this.$options = options;
  5357. // pre-resolve slots for renderSlot()
  5358. this.$slots = this.slots();
  5359. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  5360. }
  5361. if (options._scopeId) {
  5362. this._c = function (a, b, c, d) {
  5363. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  5364. if (vnode && !Array.isArray(vnode)) {
  5365. vnode.fnScopeId = options._scopeId;
  5366. vnode.fnContext = parent;
  5367. }
  5368. return vnode
  5369. };
  5370. } else {
  5371. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  5372. }
  5373. }
  5374. installRenderHelpers(FunctionalRenderContext.prototype);
  5375. function createFunctionalComponent (
  5376. Ctor,
  5377. propsData,
  5378. data,
  5379. contextVm,
  5380. children
  5381. ) {
  5382. var options = Ctor.options;
  5383. var props = {};
  5384. var propOptions = options.props;
  5385. if (isDef(propOptions)) {
  5386. for (var key in propOptions) {
  5387. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  5388. }
  5389. } else {
  5390. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  5391. if (isDef(data.props)) { mergeProps(props, data.props); }
  5392. }
  5393. var renderContext = new FunctionalRenderContext(
  5394. data,
  5395. props,
  5396. children,
  5397. contextVm,
  5398. Ctor
  5399. );
  5400. var vnode = options.render.call(null, renderContext._c, renderContext);
  5401. if (vnode instanceof VNode) {
  5402. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  5403. } else if (Array.isArray(vnode)) {
  5404. var vnodes = normalizeChildren(vnode) || [];
  5405. var res = new Array(vnodes.length);
  5406. for (var i = 0; i < vnodes.length; i++) {
  5407. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  5408. }
  5409. return res
  5410. }
  5411. }
  5412. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  5413. // #7817 clone node before setting fnContext, otherwise if the node is reused
  5414. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  5415. // that should not be matched to match.
  5416. var clone = cloneVNode(vnode);
  5417. clone.fnContext = contextVm;
  5418. clone.fnOptions = options;
  5419. if (true) {
  5420. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  5421. }
  5422. if (data.slot) {
  5423. (clone.data || (clone.data = {})).slot = data.slot;
  5424. }
  5425. return clone
  5426. }
  5427. function mergeProps (to, from) {
  5428. for (var key in from) {
  5429. to[camelize(key)] = from[key];
  5430. }
  5431. }
  5432. /* */
  5433. /* */
  5434. /* */
  5435. /* */
  5436. // inline hooks to be invoked on component VNodes during patch
  5437. var componentVNodeHooks = {
  5438. init: function init (vnode, hydrating) {
  5439. if (
  5440. vnode.componentInstance &&
  5441. !vnode.componentInstance._isDestroyed &&
  5442. vnode.data.keepAlive
  5443. ) {
  5444. // kept-alive components, treat as a patch
  5445. var mountedNode = vnode; // work around flow
  5446. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  5447. } else {
  5448. var child = vnode.componentInstance = createComponentInstanceForVnode(
  5449. vnode,
  5450. activeInstance
  5451. );
  5452. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  5453. }
  5454. },
  5455. prepatch: function prepatch (oldVnode, vnode) {
  5456. var options = vnode.componentOptions;
  5457. var child = vnode.componentInstance = oldVnode.componentInstance;
  5458. updateChildComponent(
  5459. child,
  5460. options.propsData, // updated props
  5461. options.listeners, // updated listeners
  5462. vnode, // new parent vnode
  5463. options.children // new children
  5464. );
  5465. },
  5466. insert: function insert (vnode) {
  5467. var context = vnode.context;
  5468. var componentInstance = vnode.componentInstance;
  5469. if (!componentInstance._isMounted) {
  5470. callHook(componentInstance, 'onServiceCreated');
  5471. callHook(componentInstance, 'onServiceAttached');
  5472. componentInstance._isMounted = true;
  5473. callHook(componentInstance, 'mounted');
  5474. }
  5475. if (vnode.data.keepAlive) {
  5476. if (context._isMounted) {
  5477. // vue-router#1212
  5478. // During updates, a kept-alive component's child components may
  5479. // change, so directly walking the tree here may call activated hooks
  5480. // on incorrect children. Instead we push them into a queue which will
  5481. // be processed after the whole patch process ended.
  5482. queueActivatedComponent(componentInstance);
  5483. } else {
  5484. activateChildComponent(componentInstance, true /* direct */);
  5485. }
  5486. }
  5487. },
  5488. destroy: function destroy (vnode) {
  5489. var componentInstance = vnode.componentInstance;
  5490. if (!componentInstance._isDestroyed) {
  5491. if (!vnode.data.keepAlive) {
  5492. componentInstance.$destroy();
  5493. } else {
  5494. deactivateChildComponent(componentInstance, true /* direct */);
  5495. }
  5496. }
  5497. }
  5498. };
  5499. var hooksToMerge = Object.keys(componentVNodeHooks);
  5500. function createComponent (
  5501. Ctor,
  5502. data,
  5503. context,
  5504. children,
  5505. tag
  5506. ) {
  5507. if (isUndef(Ctor)) {
  5508. return
  5509. }
  5510. var baseCtor = context.$options._base;
  5511. // plain options object: turn it into a constructor
  5512. if (isObject(Ctor)) {
  5513. Ctor = baseCtor.extend(Ctor);
  5514. }
  5515. // if at this stage it's not a constructor or an async component factory,
  5516. // reject.
  5517. if (typeof Ctor !== 'function') {
  5518. if (true) {
  5519. warn(("Invalid Component definition: " + (String(Ctor))), context);
  5520. }
  5521. return
  5522. }
  5523. // async component
  5524. var asyncFactory;
  5525. if (isUndef(Ctor.cid)) {
  5526. asyncFactory = Ctor;
  5527. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  5528. if (Ctor === undefined) {
  5529. // return a placeholder node for async component, which is rendered
  5530. // as a comment node but preserves all the raw information for the node.
  5531. // the information will be used for async server-rendering and hydration.
  5532. return createAsyncPlaceholder(
  5533. asyncFactory,
  5534. data,
  5535. context,
  5536. children,
  5537. tag
  5538. )
  5539. }
  5540. }
  5541. data = data || {};
  5542. // resolve constructor options in case global mixins are applied after
  5543. // component constructor creation
  5544. resolveConstructorOptions(Ctor);
  5545. // transform component v-model data into props & events
  5546. if (isDef(data.model)) {
  5547. transformModel(Ctor.options, data);
  5548. }
  5549. // extract props
  5550. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  5551. // functional component
  5552. if (isTrue(Ctor.options.functional)) {
  5553. return createFunctionalComponent(Ctor, propsData, data, context, children)
  5554. }
  5555. // extract listeners, since these needs to be treated as
  5556. // child component listeners instead of DOM listeners
  5557. var listeners = data.on;
  5558. // replace with listeners with .native modifier
  5559. // so it gets processed during parent component patch.
  5560. data.on = data.nativeOn;
  5561. if (isTrue(Ctor.options.abstract)) {
  5562. // abstract components do not keep anything
  5563. // other than props & listeners & slot
  5564. // work around flow
  5565. var slot = data.slot;
  5566. data = {};
  5567. if (slot) {
  5568. data.slot = slot;
  5569. }
  5570. }
  5571. // install component management hooks onto the placeholder node
  5572. installComponentHooks(data);
  5573. // return a placeholder vnode
  5574. var name = Ctor.options.name || tag;
  5575. var vnode = new VNode(
  5576. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  5577. data, undefined, undefined, undefined, context,
  5578. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  5579. asyncFactory
  5580. );
  5581. return vnode
  5582. }
  5583. function createComponentInstanceForVnode (
  5584. vnode, // we know it's MountedComponentVNode but flow doesn't
  5585. parent // activeInstance in lifecycle state
  5586. ) {
  5587. var options = {
  5588. _isComponent: true,
  5589. _parentVnode: vnode,
  5590. parent: parent
  5591. };
  5592. // check inline-template render functions
  5593. var inlineTemplate = vnode.data.inlineTemplate;
  5594. if (isDef(inlineTemplate)) {
  5595. options.render = inlineTemplate.render;
  5596. options.staticRenderFns = inlineTemplate.staticRenderFns;
  5597. }
  5598. return new vnode.componentOptions.Ctor(options)
  5599. }
  5600. function installComponentHooks (data) {
  5601. var hooks = data.hook || (data.hook = {});
  5602. for (var i = 0; i < hooksToMerge.length; i++) {
  5603. var key = hooksToMerge[i];
  5604. var existing = hooks[key];
  5605. var toMerge = componentVNodeHooks[key];
  5606. if (existing !== toMerge && !(existing && existing._merged)) {
  5607. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  5608. }
  5609. }
  5610. }
  5611. function mergeHook$1 (f1, f2) {
  5612. var merged = function (a, b) {
  5613. // flow complains about extra args which is why we use any
  5614. f1(a, b);
  5615. f2(a, b);
  5616. };
  5617. merged._merged = true;
  5618. return merged
  5619. }
  5620. // transform component v-model info (value and callback) into
  5621. // prop and event handler respectively.
  5622. function transformModel (options, data) {
  5623. var prop = (options.model && options.model.prop) || 'value';
  5624. var event = (options.model && options.model.event) || 'input'
  5625. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  5626. var on = data.on || (data.on = {});
  5627. var existing = on[event];
  5628. var callback = data.model.callback;
  5629. if (isDef(existing)) {
  5630. if (
  5631. Array.isArray(existing)
  5632. ? existing.indexOf(callback) === -1
  5633. : existing !== callback
  5634. ) {
  5635. on[event] = [callback].concat(existing);
  5636. }
  5637. } else {
  5638. on[event] = callback;
  5639. }
  5640. }
  5641. /* */
  5642. var SIMPLE_NORMALIZE = 1;
  5643. var ALWAYS_NORMALIZE = 2;
  5644. // wrapper function for providing a more flexible interface
  5645. // without getting yelled at by flow
  5646. function createElement (
  5647. context,
  5648. tag,
  5649. data,
  5650. children,
  5651. normalizationType,
  5652. alwaysNormalize
  5653. ) {
  5654. if (Array.isArray(data) || isPrimitive(data)) {
  5655. normalizationType = children;
  5656. children = data;
  5657. data = undefined;
  5658. }
  5659. if (isTrue(alwaysNormalize)) {
  5660. normalizationType = ALWAYS_NORMALIZE;
  5661. }
  5662. return _createElement(context, tag, data, children, normalizationType)
  5663. }
  5664. function _createElement (
  5665. context,
  5666. tag,
  5667. data,
  5668. children,
  5669. normalizationType
  5670. ) {
  5671. if (isDef(data) && isDef((data).__ob__)) {
  5672. true && warn(
  5673. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  5674. 'Always create fresh vnode data objects in each render!',
  5675. context
  5676. );
  5677. return createEmptyVNode()
  5678. }
  5679. // object syntax in v-bind
  5680. if (isDef(data) && isDef(data.is)) {
  5681. tag = data.is;
  5682. }
  5683. if (!tag) {
  5684. // in case of component :is set to falsy value
  5685. return createEmptyVNode()
  5686. }
  5687. // warn against non-primitive key
  5688. if ( true &&
  5689. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  5690. ) {
  5691. {
  5692. warn(
  5693. 'Avoid using non-primitive value as key, ' +
  5694. 'use string/number value instead.',
  5695. context
  5696. );
  5697. }
  5698. }
  5699. // support single function children as default scoped slot
  5700. if (Array.isArray(children) &&
  5701. typeof children[0] === 'function'
  5702. ) {
  5703. data = data || {};
  5704. data.scopedSlots = { default: children[0] };
  5705. children.length = 0;
  5706. }
  5707. if (normalizationType === ALWAYS_NORMALIZE) {
  5708. children = normalizeChildren(children);
  5709. } else if (normalizationType === SIMPLE_NORMALIZE) {
  5710. children = simpleNormalizeChildren(children);
  5711. }
  5712. var vnode, ns;
  5713. if (typeof tag === 'string') {
  5714. var Ctor;
  5715. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  5716. if (config.isReservedTag(tag)) {
  5717. // platform built-in elements
  5718. if ( true && isDef(data) && isDef(data.nativeOn)) {
  5719. warn(
  5720. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  5721. context
  5722. );
  5723. }
  5724. vnode = new VNode(
  5725. config.parsePlatformTagName(tag), data, children,
  5726. undefined, undefined, context
  5727. );
  5728. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  5729. // component
  5730. vnode = createComponent(Ctor, data, context, children, tag);
  5731. } else {
  5732. // unknown or unlisted namespaced elements
  5733. // check at runtime because it may get assigned a namespace when its
  5734. // parent normalizes children
  5735. vnode = new VNode(
  5736. tag, data, children,
  5737. undefined, undefined, context
  5738. );
  5739. }
  5740. } else {
  5741. // direct component options / constructor
  5742. vnode = createComponent(tag, data, context, children);
  5743. }
  5744. if (Array.isArray(vnode)) {
  5745. return vnode
  5746. } else if (isDef(vnode)) {
  5747. if (isDef(ns)) { applyNS(vnode, ns); }
  5748. if (isDef(data)) { registerDeepBindings(data); }
  5749. return vnode
  5750. } else {
  5751. return createEmptyVNode()
  5752. }
  5753. }
  5754. function applyNS (vnode, ns, force) {
  5755. vnode.ns = ns;
  5756. if (vnode.tag === 'foreignObject') {
  5757. // use default namespace inside foreignObject
  5758. ns = undefined;
  5759. force = true;
  5760. }
  5761. if (isDef(vnode.children)) {
  5762. for (var i = 0, l = vnode.children.length; i < l; i++) {
  5763. var child = vnode.children[i];
  5764. if (isDef(child.tag) && (
  5765. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  5766. applyNS(child, ns, force);
  5767. }
  5768. }
  5769. }
  5770. }
  5771. // ref #5318
  5772. // necessary to ensure parent re-render when deep bindings like :style and
  5773. // :class are used on slot nodes
  5774. function registerDeepBindings (data) {
  5775. if (isObject(data.style)) {
  5776. traverse(data.style);
  5777. }
  5778. if (isObject(data.class)) {
  5779. traverse(data.class);
  5780. }
  5781. }
  5782. /* */
  5783. function initRender (vm) {
  5784. vm._vnode = null; // the root of the child tree
  5785. vm._staticTrees = null; // v-once cached trees
  5786. var options = vm.$options;
  5787. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  5788. var renderContext = parentVnode && parentVnode.context;
  5789. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  5790. vm.$scopedSlots = emptyObject;
  5791. // bind the createElement fn to this instance
  5792. // so that we get proper render context inside it.
  5793. // args order: tag, data, children, normalizationType, alwaysNormalize
  5794. // internal version is used by render functions compiled from templates
  5795. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  5796. // normalization is always applied for the public version, used in
  5797. // user-written render functions.
  5798. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  5799. // $attrs & $listeners are exposed for easier HOC creation.
  5800. // they need to be reactive so that HOCs using them are always updated
  5801. var parentData = parentVnode && parentVnode.data;
  5802. /* istanbul ignore else */
  5803. if (true) {
  5804. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  5805. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  5806. }, true);
  5807. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  5808. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  5809. }, true);
  5810. } else {}
  5811. }
  5812. var currentRenderingInstance = null;
  5813. function renderMixin (Vue) {
  5814. // install runtime convenience helpers
  5815. installRenderHelpers(Vue.prototype);
  5816. Vue.prototype.$nextTick = function (fn) {
  5817. return nextTick(fn, this)
  5818. };
  5819. Vue.prototype._render = function () {
  5820. var vm = this;
  5821. var ref = vm.$options;
  5822. var render = ref.render;
  5823. var _parentVnode = ref._parentVnode;
  5824. if (_parentVnode) {
  5825. vm.$scopedSlots = normalizeScopedSlots(
  5826. _parentVnode.data.scopedSlots,
  5827. vm.$slots,
  5828. vm.$scopedSlots
  5829. );
  5830. }
  5831. // set parent vnode. this allows render functions to have access
  5832. // to the data on the placeholder node.
  5833. vm.$vnode = _parentVnode;
  5834. // render self
  5835. var vnode;
  5836. try {
  5837. // There's no need to maintain a stack because all render fns are called
  5838. // separately from one another. Nested component's render fns are called
  5839. // when parent component is patched.
  5840. currentRenderingInstance = vm;
  5841. vnode = render.call(vm._renderProxy, vm.$createElement);
  5842. } catch (e) {
  5843. handleError(e, vm, "render");
  5844. // return error render result,
  5845. // or previous vnode to prevent render error causing blank component
  5846. /* istanbul ignore else */
  5847. if ( true && vm.$options.renderError) {
  5848. try {
  5849. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  5850. } catch (e) {
  5851. handleError(e, vm, "renderError");
  5852. vnode = vm._vnode;
  5853. }
  5854. } else {
  5855. vnode = vm._vnode;
  5856. }
  5857. } finally {
  5858. currentRenderingInstance = null;
  5859. }
  5860. // if the returned array contains only a single node, allow it
  5861. if (Array.isArray(vnode) && vnode.length === 1) {
  5862. vnode = vnode[0];
  5863. }
  5864. // return empty vnode in case the render function errored out
  5865. if (!(vnode instanceof VNode)) {
  5866. if ( true && Array.isArray(vnode)) {
  5867. warn(
  5868. 'Multiple root nodes returned from render function. Render function ' +
  5869. 'should return a single root node.',
  5870. vm
  5871. );
  5872. }
  5873. vnode = createEmptyVNode();
  5874. }
  5875. // set parent
  5876. vnode.parent = _parentVnode;
  5877. return vnode
  5878. };
  5879. }
  5880. /* */
  5881. function ensureCtor (comp, base) {
  5882. if (
  5883. comp.__esModule ||
  5884. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  5885. ) {
  5886. comp = comp.default;
  5887. }
  5888. return isObject(comp)
  5889. ? base.extend(comp)
  5890. : comp
  5891. }
  5892. function createAsyncPlaceholder (
  5893. factory,
  5894. data,
  5895. context,
  5896. children,
  5897. tag
  5898. ) {
  5899. var node = createEmptyVNode();
  5900. node.asyncFactory = factory;
  5901. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  5902. return node
  5903. }
  5904. function resolveAsyncComponent (
  5905. factory,
  5906. baseCtor
  5907. ) {
  5908. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  5909. return factory.errorComp
  5910. }
  5911. if (isDef(factory.resolved)) {
  5912. return factory.resolved
  5913. }
  5914. var owner = currentRenderingInstance;
  5915. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  5916. // already pending
  5917. factory.owners.push(owner);
  5918. }
  5919. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  5920. return factory.loadingComp
  5921. }
  5922. if (owner && !isDef(factory.owners)) {
  5923. var owners = factory.owners = [owner];
  5924. var sync = true;
  5925. var timerLoading = null;
  5926. var timerTimeout = null
  5927. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  5928. var forceRender = function (renderCompleted) {
  5929. for (var i = 0, l = owners.length; i < l; i++) {
  5930. (owners[i]).$forceUpdate();
  5931. }
  5932. if (renderCompleted) {
  5933. owners.length = 0;
  5934. if (timerLoading !== null) {
  5935. clearTimeout(timerLoading);
  5936. timerLoading = null;
  5937. }
  5938. if (timerTimeout !== null) {
  5939. clearTimeout(timerTimeout);
  5940. timerTimeout = null;
  5941. }
  5942. }
  5943. };
  5944. var resolve = once(function (res) {
  5945. // cache resolved
  5946. factory.resolved = ensureCtor(res, baseCtor);
  5947. // invoke callbacks only if this is not a synchronous resolve
  5948. // (async resolves are shimmed as synchronous during SSR)
  5949. if (!sync) {
  5950. forceRender(true);
  5951. } else {
  5952. owners.length = 0;
  5953. }
  5954. });
  5955. var reject = once(function (reason) {
  5956. true && warn(
  5957. "Failed to resolve async component: " + (String(factory)) +
  5958. (reason ? ("\nReason: " + reason) : '')
  5959. );
  5960. if (isDef(factory.errorComp)) {
  5961. factory.error = true;
  5962. forceRender(true);
  5963. }
  5964. });
  5965. var res = factory(resolve, reject);
  5966. if (isObject(res)) {
  5967. if (isPromise(res)) {
  5968. // () => Promise
  5969. if (isUndef(factory.resolved)) {
  5970. res.then(resolve, reject);
  5971. }
  5972. } else if (isPromise(res.component)) {
  5973. res.component.then(resolve, reject);
  5974. if (isDef(res.error)) {
  5975. factory.errorComp = ensureCtor(res.error, baseCtor);
  5976. }
  5977. if (isDef(res.loading)) {
  5978. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  5979. if (res.delay === 0) {
  5980. factory.loading = true;
  5981. } else {
  5982. timerLoading = setTimeout(function () {
  5983. timerLoading = null;
  5984. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  5985. factory.loading = true;
  5986. forceRender(false);
  5987. }
  5988. }, res.delay || 200);
  5989. }
  5990. }
  5991. if (isDef(res.timeout)) {
  5992. timerTimeout = setTimeout(function () {
  5993. timerTimeout = null;
  5994. if (isUndef(factory.resolved)) {
  5995. reject(
  5996. true
  5997. ? ("timeout (" + (res.timeout) + "ms)")
  5998. : undefined
  5999. );
  6000. }
  6001. }, res.timeout);
  6002. }
  6003. }
  6004. }
  6005. sync = false;
  6006. // return in case resolved synchronously
  6007. return factory.loading
  6008. ? factory.loadingComp
  6009. : factory.resolved
  6010. }
  6011. }
  6012. /* */
  6013. function isAsyncPlaceholder (node) {
  6014. return node.isComment && node.asyncFactory
  6015. }
  6016. /* */
  6017. function getFirstComponentChild (children) {
  6018. if (Array.isArray(children)) {
  6019. for (var i = 0; i < children.length; i++) {
  6020. var c = children[i];
  6021. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  6022. return c
  6023. }
  6024. }
  6025. }
  6026. }
  6027. /* */
  6028. /* */
  6029. function initEvents (vm) {
  6030. vm._events = Object.create(null);
  6031. vm._hasHookEvent = false;
  6032. // init parent attached events
  6033. var listeners = vm.$options._parentListeners;
  6034. if (listeners) {
  6035. updateComponentListeners(vm, listeners);
  6036. }
  6037. }
  6038. var target;
  6039. function add (event, fn) {
  6040. target.$on(event, fn);
  6041. }
  6042. function remove$1 (event, fn) {
  6043. target.$off(event, fn);
  6044. }
  6045. function createOnceHandler (event, fn) {
  6046. var _target = target;
  6047. return function onceHandler () {
  6048. var res = fn.apply(null, arguments);
  6049. if (res !== null) {
  6050. _target.$off(event, onceHandler);
  6051. }
  6052. }
  6053. }
  6054. function updateComponentListeners (
  6055. vm,
  6056. listeners,
  6057. oldListeners
  6058. ) {
  6059. target = vm;
  6060. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  6061. target = undefined;
  6062. }
  6063. function eventsMixin (Vue) {
  6064. var hookRE = /^hook:/;
  6065. Vue.prototype.$on = function (event, fn) {
  6066. var vm = this;
  6067. if (Array.isArray(event)) {
  6068. for (var i = 0, l = event.length; i < l; i++) {
  6069. vm.$on(event[i], fn);
  6070. }
  6071. } else {
  6072. (vm._events[event] || (vm._events[event] = [])).push(fn);
  6073. // optimize hook:event cost by using a boolean flag marked at registration
  6074. // instead of a hash lookup
  6075. if (hookRE.test(event)) {
  6076. vm._hasHookEvent = true;
  6077. }
  6078. }
  6079. return vm
  6080. };
  6081. Vue.prototype.$once = function (event, fn) {
  6082. var vm = this;
  6083. function on () {
  6084. vm.$off(event, on);
  6085. fn.apply(vm, arguments);
  6086. }
  6087. on.fn = fn;
  6088. vm.$on(event, on);
  6089. return vm
  6090. };
  6091. Vue.prototype.$off = function (event, fn) {
  6092. var vm = this;
  6093. // all
  6094. if (!arguments.length) {
  6095. vm._events = Object.create(null);
  6096. return vm
  6097. }
  6098. // array of events
  6099. if (Array.isArray(event)) {
  6100. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  6101. vm.$off(event[i$1], fn);
  6102. }
  6103. return vm
  6104. }
  6105. // specific event
  6106. var cbs = vm._events[event];
  6107. if (!cbs) {
  6108. return vm
  6109. }
  6110. if (!fn) {
  6111. vm._events[event] = null;
  6112. return vm
  6113. }
  6114. // specific handler
  6115. var cb;
  6116. var i = cbs.length;
  6117. while (i--) {
  6118. cb = cbs[i];
  6119. if (cb === fn || cb.fn === fn) {
  6120. cbs.splice(i, 1);
  6121. break
  6122. }
  6123. }
  6124. return vm
  6125. };
  6126. Vue.prototype.$emit = function (event) {
  6127. var vm = this;
  6128. if (true) {
  6129. var lowerCaseEvent = event.toLowerCase();
  6130. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  6131. tip(
  6132. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  6133. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  6134. "Note that HTML attributes are case-insensitive and you cannot use " +
  6135. "v-on to listen to camelCase events when using in-DOM templates. " +
  6136. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  6137. );
  6138. }
  6139. }
  6140. var cbs = vm._events[event];
  6141. if (cbs) {
  6142. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  6143. var args = toArray(arguments, 1);
  6144. var info = "event handler for \"" + event + "\"";
  6145. for (var i = 0, l = cbs.length; i < l; i++) {
  6146. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  6147. }
  6148. }
  6149. return vm
  6150. };
  6151. }
  6152. /* */
  6153. var activeInstance = null;
  6154. var isUpdatingChildComponent = false;
  6155. function setActiveInstance(vm) {
  6156. var prevActiveInstance = activeInstance;
  6157. activeInstance = vm;
  6158. return function () {
  6159. activeInstance = prevActiveInstance;
  6160. }
  6161. }
  6162. function initLifecycle (vm) {
  6163. var options = vm.$options;
  6164. // locate first non-abstract parent
  6165. var parent = options.parent;
  6166. if (parent && !options.abstract) {
  6167. while (parent.$options.abstract && parent.$parent) {
  6168. parent = parent.$parent;
  6169. }
  6170. parent.$children.push(vm);
  6171. }
  6172. vm.$parent = parent;
  6173. vm.$root = parent ? parent.$root : vm;
  6174. vm.$children = [];
  6175. vm.$refs = {};
  6176. vm._watcher = null;
  6177. vm._inactive = null;
  6178. vm._directInactive = false;
  6179. vm._isMounted = false;
  6180. vm._isDestroyed = false;
  6181. vm._isBeingDestroyed = false;
  6182. }
  6183. function lifecycleMixin (Vue) {
  6184. Vue.prototype._update = function (vnode, hydrating) {
  6185. var vm = this;
  6186. var prevEl = vm.$el;
  6187. var prevVnode = vm._vnode;
  6188. var restoreActiveInstance = setActiveInstance(vm);
  6189. vm._vnode = vnode;
  6190. // Vue.prototype.__patch__ is injected in entry points
  6191. // based on the rendering backend used.
  6192. if (!prevVnode) {
  6193. // initial render
  6194. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  6195. } else {
  6196. // updates
  6197. vm.$el = vm.__patch__(prevVnode, vnode);
  6198. }
  6199. restoreActiveInstance();
  6200. // update __vue__ reference
  6201. if (prevEl) {
  6202. prevEl.__vue__ = null;
  6203. }
  6204. if (vm.$el) {
  6205. vm.$el.__vue__ = vm;
  6206. }
  6207. // if parent is an HOC, update its $el as well
  6208. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  6209. vm.$parent.$el = vm.$el;
  6210. }
  6211. // updated hook is called by the scheduler to ensure that children are
  6212. // updated in a parent's updated hook.
  6213. };
  6214. Vue.prototype.$forceUpdate = function () {
  6215. var vm = this;
  6216. if (vm._watcher) {
  6217. vm._watcher.update();
  6218. }
  6219. };
  6220. Vue.prototype.$destroy = function () {
  6221. var vm = this;
  6222. if (vm._isBeingDestroyed) {
  6223. return
  6224. }
  6225. callHook(vm, 'beforeDestroy');
  6226. vm._isBeingDestroyed = true;
  6227. // remove self from parent
  6228. var parent = vm.$parent;
  6229. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  6230. remove(parent.$children, vm);
  6231. }
  6232. // teardown watchers
  6233. if (vm._watcher) {
  6234. vm._watcher.teardown();
  6235. }
  6236. var i = vm._watchers.length;
  6237. while (i--) {
  6238. vm._watchers[i].teardown();
  6239. }
  6240. // remove reference from data ob
  6241. // frozen object may not have observer.
  6242. if (vm._data.__ob__) {
  6243. vm._data.__ob__.vmCount--;
  6244. }
  6245. // call the last hook...
  6246. vm._isDestroyed = true;
  6247. // invoke destroy hooks on current rendered tree
  6248. vm.__patch__(vm._vnode, null);
  6249. // fire destroyed hook
  6250. callHook(vm, 'destroyed');
  6251. // turn off all instance listeners.
  6252. vm.$off();
  6253. // remove __vue__ reference
  6254. if (vm.$el) {
  6255. vm.$el.__vue__ = null;
  6256. }
  6257. // release circular reference (#6759)
  6258. if (vm.$vnode) {
  6259. vm.$vnode.parent = null;
  6260. }
  6261. };
  6262. }
  6263. function updateChildComponent (
  6264. vm,
  6265. propsData,
  6266. listeners,
  6267. parentVnode,
  6268. renderChildren
  6269. ) {
  6270. if (true) {
  6271. isUpdatingChildComponent = true;
  6272. }
  6273. // determine whether component has slot children
  6274. // we need to do this before overwriting $options._renderChildren.
  6275. // check if there are dynamic scopedSlots (hand-written or compiled but with
  6276. // dynamic slot names). Static scoped slots compiled from template has the
  6277. // "$stable" marker.
  6278. var newScopedSlots = parentVnode.data.scopedSlots;
  6279. var oldScopedSlots = vm.$scopedSlots;
  6280. var hasDynamicScopedSlot = !!(
  6281. (newScopedSlots && !newScopedSlots.$stable) ||
  6282. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  6283. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  6284. );
  6285. // Any static slot children from the parent may have changed during parent's
  6286. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  6287. // update is necessary to ensure correctness.
  6288. var needsForceUpdate = !!(
  6289. renderChildren || // has new static slots
  6290. vm.$options._renderChildren || // has old static slots
  6291. hasDynamicScopedSlot
  6292. );
  6293. vm.$options._parentVnode = parentVnode;
  6294. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  6295. if (vm._vnode) { // update child tree's parent
  6296. vm._vnode.parent = parentVnode;
  6297. }
  6298. vm.$options._renderChildren = renderChildren;
  6299. // update $attrs and $listeners hash
  6300. // these are also reactive so they may trigger child update if the child
  6301. // used them during render
  6302. vm.$attrs = parentVnode.data.attrs || emptyObject;
  6303. vm.$listeners = listeners || emptyObject;
  6304. // update props
  6305. if (propsData && vm.$options.props) {
  6306. toggleObserving(false);
  6307. var props = vm._props;
  6308. var propKeys = vm.$options._propKeys || [];
  6309. for (var i = 0; i < propKeys.length; i++) {
  6310. var key = propKeys[i];
  6311. var propOptions = vm.$options.props; // wtf flow?
  6312. props[key] = validateProp(key, propOptions, propsData, vm);
  6313. }
  6314. toggleObserving(true);
  6315. // keep a copy of raw propsData
  6316. vm.$options.propsData = propsData;
  6317. }
  6318. // fixed by xxxxxx update properties(mp runtime)
  6319. vm._$updateProperties && vm._$updateProperties(vm);
  6320. // update listeners
  6321. listeners = listeners || emptyObject;
  6322. var oldListeners = vm.$options._parentListeners;
  6323. vm.$options._parentListeners = listeners;
  6324. updateComponentListeners(vm, listeners, oldListeners);
  6325. // resolve slots + force update if has children
  6326. if (needsForceUpdate) {
  6327. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  6328. vm.$forceUpdate();
  6329. }
  6330. if (true) {
  6331. isUpdatingChildComponent = false;
  6332. }
  6333. }
  6334. function isInInactiveTree (vm) {
  6335. while (vm && (vm = vm.$parent)) {
  6336. if (vm._inactive) { return true }
  6337. }
  6338. return false
  6339. }
  6340. function activateChildComponent (vm, direct) {
  6341. if (direct) {
  6342. vm._directInactive = false;
  6343. if (isInInactiveTree(vm)) {
  6344. return
  6345. }
  6346. } else if (vm._directInactive) {
  6347. return
  6348. }
  6349. if (vm._inactive || vm._inactive === null) {
  6350. vm._inactive = false;
  6351. for (var i = 0; i < vm.$children.length; i++) {
  6352. activateChildComponent(vm.$children[i]);
  6353. }
  6354. callHook(vm, 'activated');
  6355. }
  6356. }
  6357. function deactivateChildComponent (vm, direct) {
  6358. if (direct) {
  6359. vm._directInactive = true;
  6360. if (isInInactiveTree(vm)) {
  6361. return
  6362. }
  6363. }
  6364. if (!vm._inactive) {
  6365. vm._inactive = true;
  6366. for (var i = 0; i < vm.$children.length; i++) {
  6367. deactivateChildComponent(vm.$children[i]);
  6368. }
  6369. callHook(vm, 'deactivated');
  6370. }
  6371. }
  6372. function callHook (vm, hook) {
  6373. // #7573 disable dep collection when invoking lifecycle hooks
  6374. pushTarget();
  6375. var handlers = vm.$options[hook];
  6376. var info = hook + " hook";
  6377. if (handlers) {
  6378. for (var i = 0, j = handlers.length; i < j; i++) {
  6379. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  6380. }
  6381. }
  6382. if (vm._hasHookEvent) {
  6383. vm.$emit('hook:' + hook);
  6384. }
  6385. popTarget();
  6386. }
  6387. /* */
  6388. var MAX_UPDATE_COUNT = 100;
  6389. var queue = [];
  6390. var activatedChildren = [];
  6391. var has = {};
  6392. var circular = {};
  6393. var waiting = false;
  6394. var flushing = false;
  6395. var index = 0;
  6396. /**
  6397. * Reset the scheduler's state.
  6398. */
  6399. function resetSchedulerState () {
  6400. index = queue.length = activatedChildren.length = 0;
  6401. has = {};
  6402. if (true) {
  6403. circular = {};
  6404. }
  6405. waiting = flushing = false;
  6406. }
  6407. // Async edge case #6566 requires saving the timestamp when event listeners are
  6408. // attached. However, calling performance.now() has a perf overhead especially
  6409. // if the page has thousands of event listeners. Instead, we take a timestamp
  6410. // every time the scheduler flushes and use that for all event listeners
  6411. // attached during that flush.
  6412. var currentFlushTimestamp = 0;
  6413. // Async edge case fix requires storing an event listener's attach timestamp.
  6414. var getNow = Date.now;
  6415. // Determine what event timestamp the browser is using. Annoyingly, the
  6416. // timestamp can either be hi-res (relative to page load) or low-res
  6417. // (relative to UNIX epoch), so in order to compare time we have to use the
  6418. // same timestamp type when saving the flush timestamp.
  6419. // All IE versions use low-res event timestamps, and have problematic clock
  6420. // implementations (#9632)
  6421. if (inBrowser && !isIE) {
  6422. var performance = window.performance;
  6423. if (
  6424. performance &&
  6425. typeof performance.now === 'function' &&
  6426. getNow() > document.createEvent('Event').timeStamp
  6427. ) {
  6428. // if the event timestamp, although evaluated AFTER the Date.now(), is
  6429. // smaller than it, it means the event is using a hi-res timestamp,
  6430. // and we need to use the hi-res version for event listener timestamps as
  6431. // well.
  6432. getNow = function () { return performance.now(); };
  6433. }
  6434. }
  6435. /**
  6436. * Flush both queues and run the watchers.
  6437. */
  6438. function flushSchedulerQueue () {
  6439. currentFlushTimestamp = getNow();
  6440. flushing = true;
  6441. var watcher, id;
  6442. // Sort queue before flush.
  6443. // This ensures that:
  6444. // 1. Components are updated from parent to child. (because parent is always
  6445. // created before the child)
  6446. // 2. A component's user watchers are run before its render watcher (because
  6447. // user watchers are created before the render watcher)
  6448. // 3. If a component is destroyed during a parent component's watcher run,
  6449. // its watchers can be skipped.
  6450. queue.sort(function (a, b) { return a.id - b.id; });
  6451. // do not cache length because more watchers might be pushed
  6452. // as we run existing watchers
  6453. for (index = 0; index < queue.length; index++) {
  6454. watcher = queue[index];
  6455. if (watcher.before) {
  6456. watcher.before();
  6457. }
  6458. id = watcher.id;
  6459. has[id] = null;
  6460. watcher.run();
  6461. // in dev build, check and stop circular updates.
  6462. if ( true && has[id] != null) {
  6463. circular[id] = (circular[id] || 0) + 1;
  6464. if (circular[id] > MAX_UPDATE_COUNT) {
  6465. warn(
  6466. 'You may have an infinite update loop ' + (
  6467. watcher.user
  6468. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  6469. : "in a component render function."
  6470. ),
  6471. watcher.vm
  6472. );
  6473. break
  6474. }
  6475. }
  6476. }
  6477. // keep copies of post queues before resetting state
  6478. var activatedQueue = activatedChildren.slice();
  6479. var updatedQueue = queue.slice();
  6480. resetSchedulerState();
  6481. // call component updated and activated hooks
  6482. callActivatedHooks(activatedQueue);
  6483. callUpdatedHooks(updatedQueue);
  6484. // devtool hook
  6485. /* istanbul ignore if */
  6486. if (devtools && config.devtools) {
  6487. devtools.emit('flush');
  6488. }
  6489. }
  6490. function callUpdatedHooks (queue) {
  6491. var i = queue.length;
  6492. while (i--) {
  6493. var watcher = queue[i];
  6494. var vm = watcher.vm;
  6495. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  6496. callHook(vm, 'updated');
  6497. }
  6498. }
  6499. }
  6500. /**
  6501. * Queue a kept-alive component that was activated during patch.
  6502. * The queue will be processed after the entire tree has been patched.
  6503. */
  6504. function queueActivatedComponent (vm) {
  6505. // setting _inactive to false here so that a render function can
  6506. // rely on checking whether it's in an inactive tree (e.g. router-view)
  6507. vm._inactive = false;
  6508. activatedChildren.push(vm);
  6509. }
  6510. function callActivatedHooks (queue) {
  6511. for (var i = 0; i < queue.length; i++) {
  6512. queue[i]._inactive = true;
  6513. activateChildComponent(queue[i], true /* true */);
  6514. }
  6515. }
  6516. /**
  6517. * Push a watcher into the watcher queue.
  6518. * Jobs with duplicate IDs will be skipped unless it's
  6519. * pushed when the queue is being flushed.
  6520. */
  6521. function queueWatcher (watcher) {
  6522. var id = watcher.id;
  6523. if (has[id] == null) {
  6524. has[id] = true;
  6525. if (!flushing) {
  6526. queue.push(watcher);
  6527. } else {
  6528. // if already flushing, splice the watcher based on its id
  6529. // if already past its id, it will be run next immediately.
  6530. var i = queue.length - 1;
  6531. while (i > index && queue[i].id > watcher.id) {
  6532. i--;
  6533. }
  6534. queue.splice(i + 1, 0, watcher);
  6535. }
  6536. // queue the flush
  6537. if (!waiting) {
  6538. waiting = true;
  6539. if ( true && !config.async) {
  6540. flushSchedulerQueue();
  6541. return
  6542. }
  6543. nextTick(flushSchedulerQueue);
  6544. }
  6545. }
  6546. }
  6547. /* */
  6548. var uid$2 = 0;
  6549. /**
  6550. * A watcher parses an expression, collects dependencies,
  6551. * and fires callback when the expression value changes.
  6552. * This is used for both the $watch() api and directives.
  6553. */
  6554. var Watcher = function Watcher (
  6555. vm,
  6556. expOrFn,
  6557. cb,
  6558. options,
  6559. isRenderWatcher
  6560. ) {
  6561. this.vm = vm;
  6562. if (isRenderWatcher) {
  6563. vm._watcher = this;
  6564. }
  6565. vm._watchers.push(this);
  6566. // options
  6567. if (options) {
  6568. this.deep = !!options.deep;
  6569. this.user = !!options.user;
  6570. this.lazy = !!options.lazy;
  6571. this.sync = !!options.sync;
  6572. this.before = options.before;
  6573. } else {
  6574. this.deep = this.user = this.lazy = this.sync = false;
  6575. }
  6576. this.cb = cb;
  6577. this.id = ++uid$2; // uid for batching
  6578. this.active = true;
  6579. this.dirty = this.lazy; // for lazy watchers
  6580. this.deps = [];
  6581. this.newDeps = [];
  6582. this.depIds = new _Set();
  6583. this.newDepIds = new _Set();
  6584. this.expression = true
  6585. ? expOrFn.toString()
  6586. : undefined;
  6587. // parse expression for getter
  6588. if (typeof expOrFn === 'function') {
  6589. this.getter = expOrFn;
  6590. } else {
  6591. this.getter = parsePath(expOrFn);
  6592. if (!this.getter) {
  6593. this.getter = noop;
  6594. true && warn(
  6595. "Failed watching path: \"" + expOrFn + "\" " +
  6596. 'Watcher only accepts simple dot-delimited paths. ' +
  6597. 'For full control, use a function instead.',
  6598. vm
  6599. );
  6600. }
  6601. }
  6602. this.value = this.lazy
  6603. ? undefined
  6604. : this.get();
  6605. };
  6606. /**
  6607. * Evaluate the getter, and re-collect dependencies.
  6608. */
  6609. Watcher.prototype.get = function get () {
  6610. pushTarget(this);
  6611. var value;
  6612. var vm = this.vm;
  6613. try {
  6614. value = this.getter.call(vm, vm);
  6615. } catch (e) {
  6616. if (this.user) {
  6617. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  6618. } else {
  6619. throw e
  6620. }
  6621. } finally {
  6622. // "touch" every property so they are all tracked as
  6623. // dependencies for deep watching
  6624. if (this.deep) {
  6625. traverse(value);
  6626. }
  6627. popTarget();
  6628. this.cleanupDeps();
  6629. }
  6630. return value
  6631. };
  6632. /**
  6633. * Add a dependency to this directive.
  6634. */
  6635. Watcher.prototype.addDep = function addDep (dep) {
  6636. var id = dep.id;
  6637. if (!this.newDepIds.has(id)) {
  6638. this.newDepIds.add(id);
  6639. this.newDeps.push(dep);
  6640. if (!this.depIds.has(id)) {
  6641. dep.addSub(this);
  6642. }
  6643. }
  6644. };
  6645. /**
  6646. * Clean up for dependency collection.
  6647. */
  6648. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  6649. var i = this.deps.length;
  6650. while (i--) {
  6651. var dep = this.deps[i];
  6652. if (!this.newDepIds.has(dep.id)) {
  6653. dep.removeSub(this);
  6654. }
  6655. }
  6656. var tmp = this.depIds;
  6657. this.depIds = this.newDepIds;
  6658. this.newDepIds = tmp;
  6659. this.newDepIds.clear();
  6660. tmp = this.deps;
  6661. this.deps = this.newDeps;
  6662. this.newDeps = tmp;
  6663. this.newDeps.length = 0;
  6664. };
  6665. /**
  6666. * Subscriber interface.
  6667. * Will be called when a dependency changes.
  6668. */
  6669. Watcher.prototype.update = function update () {
  6670. /* istanbul ignore else */
  6671. if (this.lazy) {
  6672. this.dirty = true;
  6673. } else if (this.sync) {
  6674. this.run();
  6675. } else {
  6676. queueWatcher(this);
  6677. }
  6678. };
  6679. /**
  6680. * Scheduler job interface.
  6681. * Will be called by the scheduler.
  6682. */
  6683. Watcher.prototype.run = function run () {
  6684. if (this.active) {
  6685. var value = this.get();
  6686. if (
  6687. value !== this.value ||
  6688. // Deep watchers and watchers on Object/Arrays should fire even
  6689. // when the value is the same, because the value may
  6690. // have mutated.
  6691. isObject(value) ||
  6692. this.deep
  6693. ) {
  6694. // set new value
  6695. var oldValue = this.value;
  6696. this.value = value;
  6697. if (this.user) {
  6698. try {
  6699. this.cb.call(this.vm, value, oldValue);
  6700. } catch (e) {
  6701. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  6702. }
  6703. } else {
  6704. this.cb.call(this.vm, value, oldValue);
  6705. }
  6706. }
  6707. }
  6708. };
  6709. /**
  6710. * Evaluate the value of the watcher.
  6711. * This only gets called for lazy watchers.
  6712. */
  6713. Watcher.prototype.evaluate = function evaluate () {
  6714. this.value = this.get();
  6715. this.dirty = false;
  6716. };
  6717. /**
  6718. * Depend on all deps collected by this watcher.
  6719. */
  6720. Watcher.prototype.depend = function depend () {
  6721. var i = this.deps.length;
  6722. while (i--) {
  6723. this.deps[i].depend();
  6724. }
  6725. };
  6726. /**
  6727. * Remove self from all dependencies' subscriber list.
  6728. */
  6729. Watcher.prototype.teardown = function teardown () {
  6730. if (this.active) {
  6731. // remove self from vm's watcher list
  6732. // this is a somewhat expensive operation so we skip it
  6733. // if the vm is being destroyed.
  6734. if (!this.vm._isBeingDestroyed) {
  6735. remove(this.vm._watchers, this);
  6736. }
  6737. var i = this.deps.length;
  6738. while (i--) {
  6739. this.deps[i].removeSub(this);
  6740. }
  6741. this.active = false;
  6742. }
  6743. };
  6744. /* */
  6745. var sharedPropertyDefinition = {
  6746. enumerable: true,
  6747. configurable: true,
  6748. get: noop,
  6749. set: noop
  6750. };
  6751. function proxy (target, sourceKey, key) {
  6752. sharedPropertyDefinition.get = function proxyGetter () {
  6753. return this[sourceKey][key]
  6754. };
  6755. sharedPropertyDefinition.set = function proxySetter (val) {
  6756. this[sourceKey][key] = val;
  6757. };
  6758. Object.defineProperty(target, key, sharedPropertyDefinition);
  6759. }
  6760. function initState (vm) {
  6761. vm._watchers = [];
  6762. var opts = vm.$options;
  6763. if (opts.props) { initProps(vm, opts.props); }
  6764. if (opts.methods) { initMethods(vm, opts.methods); }
  6765. if (opts.data) {
  6766. initData(vm);
  6767. } else {
  6768. observe(vm._data = {}, true /* asRootData */);
  6769. }
  6770. if (opts.computed) { initComputed(vm, opts.computed); }
  6771. if (opts.watch && opts.watch !== nativeWatch) {
  6772. initWatch(vm, opts.watch);
  6773. }
  6774. }
  6775. function initProps (vm, propsOptions) {
  6776. var propsData = vm.$options.propsData || {};
  6777. var props = vm._props = {};
  6778. // cache prop keys so that future props updates can iterate using Array
  6779. // instead of dynamic object key enumeration.
  6780. var keys = vm.$options._propKeys = [];
  6781. var isRoot = !vm.$parent;
  6782. // root instance props should be converted
  6783. if (!isRoot) {
  6784. toggleObserving(false);
  6785. }
  6786. var loop = function ( key ) {
  6787. keys.push(key);
  6788. var value = validateProp(key, propsOptions, propsData, vm);
  6789. /* istanbul ignore else */
  6790. if (true) {
  6791. var hyphenatedKey = hyphenate(key);
  6792. if (isReservedAttribute(hyphenatedKey) ||
  6793. config.isReservedAttr(hyphenatedKey)) {
  6794. warn(
  6795. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  6796. vm
  6797. );
  6798. }
  6799. defineReactive$$1(props, key, value, function () {
  6800. if (!isRoot && !isUpdatingChildComponent) {
  6801. {
  6802. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  6803. return
  6804. }
  6805. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  6806. if(
  6807. key === 'value' &&
  6808. Array.isArray(vm.$options.behaviors) &&
  6809. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  6810. ){
  6811. return
  6812. }
  6813. if(vm._getFormData){
  6814. return
  6815. }
  6816. var $parent = vm.$parent;
  6817. while($parent){
  6818. if($parent.__next_tick_pending){
  6819. return
  6820. }
  6821. $parent = $parent.$parent;
  6822. }
  6823. }
  6824. warn(
  6825. "Avoid mutating a prop directly since the value will be " +
  6826. "overwritten whenever the parent component re-renders. " +
  6827. "Instead, use a data or computed property based on the prop's " +
  6828. "value. Prop being mutated: \"" + key + "\"",
  6829. vm
  6830. );
  6831. }
  6832. });
  6833. } else {}
  6834. // static props are already proxied on the component's prototype
  6835. // during Vue.extend(). We only need to proxy props defined at
  6836. // instantiation here.
  6837. if (!(key in vm)) {
  6838. proxy(vm, "_props", key);
  6839. }
  6840. };
  6841. for (var key in propsOptions) loop( key );
  6842. toggleObserving(true);
  6843. }
  6844. function initData (vm) {
  6845. var data = vm.$options.data;
  6846. data = vm._data = typeof data === 'function'
  6847. ? getData(data, vm)
  6848. : data || {};
  6849. if (!isPlainObject(data)) {
  6850. data = {};
  6851. true && warn(
  6852. 'data functions should return an object:\n' +
  6853. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  6854. vm
  6855. );
  6856. }
  6857. // proxy data on instance
  6858. var keys = Object.keys(data);
  6859. var props = vm.$options.props;
  6860. var methods = vm.$options.methods;
  6861. var i = keys.length;
  6862. while (i--) {
  6863. var key = keys[i];
  6864. if (true) {
  6865. if (methods && hasOwn(methods, key)) {
  6866. warn(
  6867. ("Method \"" + key + "\" has already been defined as a data property."),
  6868. vm
  6869. );
  6870. }
  6871. }
  6872. if (props && hasOwn(props, key)) {
  6873. true && warn(
  6874. "The data property \"" + key + "\" is already declared as a prop. " +
  6875. "Use prop default value instead.",
  6876. vm
  6877. );
  6878. } else if (!isReserved(key)) {
  6879. proxy(vm, "_data", key);
  6880. }
  6881. }
  6882. // observe data
  6883. observe(data, true /* asRootData */);
  6884. }
  6885. function getData (data, vm) {
  6886. // #7573 disable dep collection when invoking data getters
  6887. pushTarget();
  6888. try {
  6889. return data.call(vm, vm)
  6890. } catch (e) {
  6891. handleError(e, vm, "data()");
  6892. return {}
  6893. } finally {
  6894. popTarget();
  6895. }
  6896. }
  6897. var computedWatcherOptions = { lazy: true };
  6898. function initComputed (vm, computed) {
  6899. // $flow-disable-line
  6900. var watchers = vm._computedWatchers = Object.create(null);
  6901. // computed properties are just getters during SSR
  6902. var isSSR = isServerRendering();
  6903. for (var key in computed) {
  6904. var userDef = computed[key];
  6905. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  6906. if ( true && getter == null) {
  6907. warn(
  6908. ("Getter is missing for computed property \"" + key + "\"."),
  6909. vm
  6910. );
  6911. }
  6912. if (!isSSR) {
  6913. // create internal watcher for the computed property.
  6914. watchers[key] = new Watcher(
  6915. vm,
  6916. getter || noop,
  6917. noop,
  6918. computedWatcherOptions
  6919. );
  6920. }
  6921. // component-defined computed properties are already defined on the
  6922. // component prototype. We only need to define computed properties defined
  6923. // at instantiation here.
  6924. if (!(key in vm)) {
  6925. defineComputed(vm, key, userDef);
  6926. } else if (true) {
  6927. if (key in vm.$data) {
  6928. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  6929. } else if (vm.$options.props && key in vm.$options.props) {
  6930. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  6931. }
  6932. }
  6933. }
  6934. }
  6935. function defineComputed (
  6936. target,
  6937. key,
  6938. userDef
  6939. ) {
  6940. var shouldCache = !isServerRendering();
  6941. if (typeof userDef === 'function') {
  6942. sharedPropertyDefinition.get = shouldCache
  6943. ? createComputedGetter(key)
  6944. : createGetterInvoker(userDef);
  6945. sharedPropertyDefinition.set = noop;
  6946. } else {
  6947. sharedPropertyDefinition.get = userDef.get
  6948. ? shouldCache && userDef.cache !== false
  6949. ? createComputedGetter(key)
  6950. : createGetterInvoker(userDef.get)
  6951. : noop;
  6952. sharedPropertyDefinition.set = userDef.set || noop;
  6953. }
  6954. if ( true &&
  6955. sharedPropertyDefinition.set === noop) {
  6956. sharedPropertyDefinition.set = function () {
  6957. warn(
  6958. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  6959. this
  6960. );
  6961. };
  6962. }
  6963. Object.defineProperty(target, key, sharedPropertyDefinition);
  6964. }
  6965. function createComputedGetter (key) {
  6966. return function computedGetter () {
  6967. var watcher = this._computedWatchers && this._computedWatchers[key];
  6968. if (watcher) {
  6969. if (watcher.dirty) {
  6970. watcher.evaluate();
  6971. }
  6972. if (Dep.SharedObject.target) {// fixed by xxxxxx
  6973. watcher.depend();
  6974. }
  6975. return watcher.value
  6976. }
  6977. }
  6978. }
  6979. function createGetterInvoker(fn) {
  6980. return function computedGetter () {
  6981. return fn.call(this, this)
  6982. }
  6983. }
  6984. function initMethods (vm, methods) {
  6985. var props = vm.$options.props;
  6986. for (var key in methods) {
  6987. if (true) {
  6988. if (typeof methods[key] !== 'function') {
  6989. warn(
  6990. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  6991. "Did you reference the function correctly?",
  6992. vm
  6993. );
  6994. }
  6995. if (props && hasOwn(props, key)) {
  6996. warn(
  6997. ("Method \"" + key + "\" has already been defined as a prop."),
  6998. vm
  6999. );
  7000. }
  7001. if ((key in vm) && isReserved(key)) {
  7002. warn(
  7003. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  7004. "Avoid defining component methods that start with _ or $."
  7005. );
  7006. }
  7007. }
  7008. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  7009. }
  7010. }
  7011. function initWatch (vm, watch) {
  7012. for (var key in watch) {
  7013. var handler = watch[key];
  7014. if (Array.isArray(handler)) {
  7015. for (var i = 0; i < handler.length; i++) {
  7016. createWatcher(vm, key, handler[i]);
  7017. }
  7018. } else {
  7019. createWatcher(vm, key, handler);
  7020. }
  7021. }
  7022. }
  7023. function createWatcher (
  7024. vm,
  7025. expOrFn,
  7026. handler,
  7027. options
  7028. ) {
  7029. if (isPlainObject(handler)) {
  7030. options = handler;
  7031. handler = handler.handler;
  7032. }
  7033. if (typeof handler === 'string') {
  7034. handler = vm[handler];
  7035. }
  7036. return vm.$watch(expOrFn, handler, options)
  7037. }
  7038. function stateMixin (Vue) {
  7039. // flow somehow has problems with directly declared definition object
  7040. // when using Object.defineProperty, so we have to procedurally build up
  7041. // the object here.
  7042. var dataDef = {};
  7043. dataDef.get = function () { return this._data };
  7044. var propsDef = {};
  7045. propsDef.get = function () { return this._props };
  7046. if (true) {
  7047. dataDef.set = function () {
  7048. warn(
  7049. 'Avoid replacing instance root $data. ' +
  7050. 'Use nested data properties instead.',
  7051. this
  7052. );
  7053. };
  7054. propsDef.set = function () {
  7055. warn("$props is readonly.", this);
  7056. };
  7057. }
  7058. Object.defineProperty(Vue.prototype, '$data', dataDef);
  7059. Object.defineProperty(Vue.prototype, '$props', propsDef);
  7060. Vue.prototype.$set = set;
  7061. Vue.prototype.$delete = del;
  7062. Vue.prototype.$watch = function (
  7063. expOrFn,
  7064. cb,
  7065. options
  7066. ) {
  7067. var vm = this;
  7068. if (isPlainObject(cb)) {
  7069. return createWatcher(vm, expOrFn, cb, options)
  7070. }
  7071. options = options || {};
  7072. options.user = true;
  7073. var watcher = new Watcher(vm, expOrFn, cb, options);
  7074. if (options.immediate) {
  7075. try {
  7076. cb.call(vm, watcher.value);
  7077. } catch (error) {
  7078. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  7079. }
  7080. }
  7081. return function unwatchFn () {
  7082. watcher.teardown();
  7083. }
  7084. };
  7085. }
  7086. /* */
  7087. var uid$3 = 0;
  7088. function initMixin (Vue) {
  7089. Vue.prototype._init = function (options) {
  7090. var vm = this;
  7091. // a uid
  7092. vm._uid = uid$3++;
  7093. var startTag, endTag;
  7094. /* istanbul ignore if */
  7095. if ( true && config.performance && mark) {
  7096. startTag = "vue-perf-start:" + (vm._uid);
  7097. endTag = "vue-perf-end:" + (vm._uid);
  7098. mark(startTag);
  7099. }
  7100. // a flag to avoid this being observed
  7101. vm._isVue = true;
  7102. // merge options
  7103. if (options && options._isComponent) {
  7104. // optimize internal component instantiation
  7105. // since dynamic options merging is pretty slow, and none of the
  7106. // internal component options needs special treatment.
  7107. initInternalComponent(vm, options);
  7108. } else {
  7109. vm.$options = mergeOptions(
  7110. resolveConstructorOptions(vm.constructor),
  7111. options || {},
  7112. vm
  7113. );
  7114. }
  7115. /* istanbul ignore else */
  7116. if (true) {
  7117. initProxy(vm);
  7118. } else {}
  7119. // expose real self
  7120. vm._self = vm;
  7121. initLifecycle(vm);
  7122. initEvents(vm);
  7123. initRender(vm);
  7124. callHook(vm, 'beforeCreate');
  7125. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  7126. initState(vm);
  7127. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  7128. !vm._$fallback && callHook(vm, 'created');
  7129. /* istanbul ignore if */
  7130. if ( true && config.performance && mark) {
  7131. vm._name = formatComponentName(vm, false);
  7132. mark(endTag);
  7133. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  7134. }
  7135. if (vm.$options.el) {
  7136. vm.$mount(vm.$options.el);
  7137. }
  7138. };
  7139. }
  7140. function initInternalComponent (vm, options) {
  7141. var opts = vm.$options = Object.create(vm.constructor.options);
  7142. // doing this because it's faster than dynamic enumeration.
  7143. var parentVnode = options._parentVnode;
  7144. opts.parent = options.parent;
  7145. opts._parentVnode = parentVnode;
  7146. var vnodeComponentOptions = parentVnode.componentOptions;
  7147. opts.propsData = vnodeComponentOptions.propsData;
  7148. opts._parentListeners = vnodeComponentOptions.listeners;
  7149. opts._renderChildren = vnodeComponentOptions.children;
  7150. opts._componentTag = vnodeComponentOptions.tag;
  7151. if (options.render) {
  7152. opts.render = options.render;
  7153. opts.staticRenderFns = options.staticRenderFns;
  7154. }
  7155. }
  7156. function resolveConstructorOptions (Ctor) {
  7157. var options = Ctor.options;
  7158. if (Ctor.super) {
  7159. var superOptions = resolveConstructorOptions(Ctor.super);
  7160. var cachedSuperOptions = Ctor.superOptions;
  7161. if (superOptions !== cachedSuperOptions) {
  7162. // super option changed,
  7163. // need to resolve new options.
  7164. Ctor.superOptions = superOptions;
  7165. // check if there are any late-modified/attached options (#4976)
  7166. var modifiedOptions = resolveModifiedOptions(Ctor);
  7167. // update base extend options
  7168. if (modifiedOptions) {
  7169. extend(Ctor.extendOptions, modifiedOptions);
  7170. }
  7171. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  7172. if (options.name) {
  7173. options.components[options.name] = Ctor;
  7174. }
  7175. }
  7176. }
  7177. return options
  7178. }
  7179. function resolveModifiedOptions (Ctor) {
  7180. var modified;
  7181. var latest = Ctor.options;
  7182. var sealed = Ctor.sealedOptions;
  7183. for (var key in latest) {
  7184. if (latest[key] !== sealed[key]) {
  7185. if (!modified) { modified = {}; }
  7186. modified[key] = latest[key];
  7187. }
  7188. }
  7189. return modified
  7190. }
  7191. function Vue (options) {
  7192. if ( true &&
  7193. !(this instanceof Vue)
  7194. ) {
  7195. warn('Vue is a constructor and should be called with the `new` keyword');
  7196. }
  7197. this._init(options);
  7198. }
  7199. initMixin(Vue);
  7200. stateMixin(Vue);
  7201. eventsMixin(Vue);
  7202. lifecycleMixin(Vue);
  7203. renderMixin(Vue);
  7204. /* */
  7205. function initUse (Vue) {
  7206. Vue.use = function (plugin) {
  7207. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  7208. if (installedPlugins.indexOf(plugin) > -1) {
  7209. return this
  7210. }
  7211. // additional parameters
  7212. var args = toArray(arguments, 1);
  7213. args.unshift(this);
  7214. if (typeof plugin.install === 'function') {
  7215. plugin.install.apply(plugin, args);
  7216. } else if (typeof plugin === 'function') {
  7217. plugin.apply(null, args);
  7218. }
  7219. installedPlugins.push(plugin);
  7220. return this
  7221. };
  7222. }
  7223. /* */
  7224. function initMixin$1 (Vue) {
  7225. Vue.mixin = function (mixin) {
  7226. this.options = mergeOptions(this.options, mixin);
  7227. return this
  7228. };
  7229. }
  7230. /* */
  7231. function initExtend (Vue) {
  7232. /**
  7233. * Each instance constructor, including Vue, has a unique
  7234. * cid. This enables us to create wrapped "child
  7235. * constructors" for prototypal inheritance and cache them.
  7236. */
  7237. Vue.cid = 0;
  7238. var cid = 1;
  7239. /**
  7240. * Class inheritance
  7241. */
  7242. Vue.extend = function (extendOptions) {
  7243. extendOptions = extendOptions || {};
  7244. var Super = this;
  7245. var SuperId = Super.cid;
  7246. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  7247. if (cachedCtors[SuperId]) {
  7248. return cachedCtors[SuperId]
  7249. }
  7250. var name = extendOptions.name || Super.options.name;
  7251. if ( true && name) {
  7252. validateComponentName(name);
  7253. }
  7254. var Sub = function VueComponent (options) {
  7255. this._init(options);
  7256. };
  7257. Sub.prototype = Object.create(Super.prototype);
  7258. Sub.prototype.constructor = Sub;
  7259. Sub.cid = cid++;
  7260. Sub.options = mergeOptions(
  7261. Super.options,
  7262. extendOptions
  7263. );
  7264. Sub['super'] = Super;
  7265. // For props and computed properties, we define the proxy getters on
  7266. // the Vue instances at extension time, on the extended prototype. This
  7267. // avoids Object.defineProperty calls for each instance created.
  7268. if (Sub.options.props) {
  7269. initProps$1(Sub);
  7270. }
  7271. if (Sub.options.computed) {
  7272. initComputed$1(Sub);
  7273. }
  7274. // allow further extension/mixin/plugin usage
  7275. Sub.extend = Super.extend;
  7276. Sub.mixin = Super.mixin;
  7277. Sub.use = Super.use;
  7278. // create asset registers, so extended classes
  7279. // can have their private assets too.
  7280. ASSET_TYPES.forEach(function (type) {
  7281. Sub[type] = Super[type];
  7282. });
  7283. // enable recursive self-lookup
  7284. if (name) {
  7285. Sub.options.components[name] = Sub;
  7286. }
  7287. // keep a reference to the super options at extension time.
  7288. // later at instantiation we can check if Super's options have
  7289. // been updated.
  7290. Sub.superOptions = Super.options;
  7291. Sub.extendOptions = extendOptions;
  7292. Sub.sealedOptions = extend({}, Sub.options);
  7293. // cache constructor
  7294. cachedCtors[SuperId] = Sub;
  7295. return Sub
  7296. };
  7297. }
  7298. function initProps$1 (Comp) {
  7299. var props = Comp.options.props;
  7300. for (var key in props) {
  7301. proxy(Comp.prototype, "_props", key);
  7302. }
  7303. }
  7304. function initComputed$1 (Comp) {
  7305. var computed = Comp.options.computed;
  7306. for (var key in computed) {
  7307. defineComputed(Comp.prototype, key, computed[key]);
  7308. }
  7309. }
  7310. /* */
  7311. function initAssetRegisters (Vue) {
  7312. /**
  7313. * Create asset registration methods.
  7314. */
  7315. ASSET_TYPES.forEach(function (type) {
  7316. Vue[type] = function (
  7317. id,
  7318. definition
  7319. ) {
  7320. if (!definition) {
  7321. return this.options[type + 's'][id]
  7322. } else {
  7323. /* istanbul ignore if */
  7324. if ( true && type === 'component') {
  7325. validateComponentName(id);
  7326. }
  7327. if (type === 'component' && isPlainObject(definition)) {
  7328. definition.name = definition.name || id;
  7329. definition = this.options._base.extend(definition);
  7330. }
  7331. if (type === 'directive' && typeof definition === 'function') {
  7332. definition = { bind: definition, update: definition };
  7333. }
  7334. this.options[type + 's'][id] = definition;
  7335. return definition
  7336. }
  7337. };
  7338. });
  7339. }
  7340. /* */
  7341. function getComponentName (opts) {
  7342. return opts && (opts.Ctor.options.name || opts.tag)
  7343. }
  7344. function matches (pattern, name) {
  7345. if (Array.isArray(pattern)) {
  7346. return pattern.indexOf(name) > -1
  7347. } else if (typeof pattern === 'string') {
  7348. return pattern.split(',').indexOf(name) > -1
  7349. } else if (isRegExp(pattern)) {
  7350. return pattern.test(name)
  7351. }
  7352. /* istanbul ignore next */
  7353. return false
  7354. }
  7355. function pruneCache (keepAliveInstance, filter) {
  7356. var cache = keepAliveInstance.cache;
  7357. var keys = keepAliveInstance.keys;
  7358. var _vnode = keepAliveInstance._vnode;
  7359. for (var key in cache) {
  7360. var cachedNode = cache[key];
  7361. if (cachedNode) {
  7362. var name = getComponentName(cachedNode.componentOptions);
  7363. if (name && !filter(name)) {
  7364. pruneCacheEntry(cache, key, keys, _vnode);
  7365. }
  7366. }
  7367. }
  7368. }
  7369. function pruneCacheEntry (
  7370. cache,
  7371. key,
  7372. keys,
  7373. current
  7374. ) {
  7375. var cached$$1 = cache[key];
  7376. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  7377. cached$$1.componentInstance.$destroy();
  7378. }
  7379. cache[key] = null;
  7380. remove(keys, key);
  7381. }
  7382. var patternTypes = [String, RegExp, Array];
  7383. var KeepAlive = {
  7384. name: 'keep-alive',
  7385. abstract: true,
  7386. props: {
  7387. include: patternTypes,
  7388. exclude: patternTypes,
  7389. max: [String, Number]
  7390. },
  7391. created: function created () {
  7392. this.cache = Object.create(null);
  7393. this.keys = [];
  7394. },
  7395. destroyed: function destroyed () {
  7396. for (var key in this.cache) {
  7397. pruneCacheEntry(this.cache, key, this.keys);
  7398. }
  7399. },
  7400. mounted: function mounted () {
  7401. var this$1 = this;
  7402. this.$watch('include', function (val) {
  7403. pruneCache(this$1, function (name) { return matches(val, name); });
  7404. });
  7405. this.$watch('exclude', function (val) {
  7406. pruneCache(this$1, function (name) { return !matches(val, name); });
  7407. });
  7408. },
  7409. render: function render () {
  7410. var slot = this.$slots.default;
  7411. var vnode = getFirstComponentChild(slot);
  7412. var componentOptions = vnode && vnode.componentOptions;
  7413. if (componentOptions) {
  7414. // check pattern
  7415. var name = getComponentName(componentOptions);
  7416. var ref = this;
  7417. var include = ref.include;
  7418. var exclude = ref.exclude;
  7419. if (
  7420. // not included
  7421. (include && (!name || !matches(include, name))) ||
  7422. // excluded
  7423. (exclude && name && matches(exclude, name))
  7424. ) {
  7425. return vnode
  7426. }
  7427. var ref$1 = this;
  7428. var cache = ref$1.cache;
  7429. var keys = ref$1.keys;
  7430. var key = vnode.key == null
  7431. // same constructor may get registered as different local components
  7432. // so cid alone is not enough (#3269)
  7433. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  7434. : vnode.key;
  7435. if (cache[key]) {
  7436. vnode.componentInstance = cache[key].componentInstance;
  7437. // make current key freshest
  7438. remove(keys, key);
  7439. keys.push(key);
  7440. } else {
  7441. cache[key] = vnode;
  7442. keys.push(key);
  7443. // prune oldest entry
  7444. if (this.max && keys.length > parseInt(this.max)) {
  7445. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  7446. }
  7447. }
  7448. vnode.data.keepAlive = true;
  7449. }
  7450. return vnode || (slot && slot[0])
  7451. }
  7452. };
  7453. var builtInComponents = {
  7454. KeepAlive: KeepAlive
  7455. };
  7456. /* */
  7457. function initGlobalAPI (Vue) {
  7458. // config
  7459. var configDef = {};
  7460. configDef.get = function () { return config; };
  7461. if (true) {
  7462. configDef.set = function () {
  7463. warn(
  7464. 'Do not replace the Vue.config object, set individual fields instead.'
  7465. );
  7466. };
  7467. }
  7468. Object.defineProperty(Vue, 'config', configDef);
  7469. // exposed util methods.
  7470. // NOTE: these are not considered part of the public API - avoid relying on
  7471. // them unless you are aware of the risk.
  7472. Vue.util = {
  7473. warn: warn,
  7474. extend: extend,
  7475. mergeOptions: mergeOptions,
  7476. defineReactive: defineReactive$$1
  7477. };
  7478. Vue.set = set;
  7479. Vue.delete = del;
  7480. Vue.nextTick = nextTick;
  7481. // 2.6 explicit observable API
  7482. Vue.observable = function (obj) {
  7483. observe(obj);
  7484. return obj
  7485. };
  7486. Vue.options = Object.create(null);
  7487. ASSET_TYPES.forEach(function (type) {
  7488. Vue.options[type + 's'] = Object.create(null);
  7489. });
  7490. // this is used to identify the "base" constructor to extend all plain-object
  7491. // components with in Weex's multi-instance scenarios.
  7492. Vue.options._base = Vue;
  7493. extend(Vue.options.components, builtInComponents);
  7494. initUse(Vue);
  7495. initMixin$1(Vue);
  7496. initExtend(Vue);
  7497. initAssetRegisters(Vue);
  7498. }
  7499. initGlobalAPI(Vue);
  7500. Object.defineProperty(Vue.prototype, '$isServer', {
  7501. get: isServerRendering
  7502. });
  7503. Object.defineProperty(Vue.prototype, '$ssrContext', {
  7504. get: function get () {
  7505. /* istanbul ignore next */
  7506. return this.$vnode && this.$vnode.ssrContext
  7507. }
  7508. });
  7509. // expose FunctionalRenderContext for ssr runtime helper installation
  7510. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  7511. value: FunctionalRenderContext
  7512. });
  7513. Vue.version = '2.6.11';
  7514. /**
  7515. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  7516. */
  7517. var ARRAYTYPE = '[object Array]';
  7518. var OBJECTTYPE = '[object Object]';
  7519. // const FUNCTIONTYPE = '[object Function]'
  7520. function diff(current, pre) {
  7521. var result = {};
  7522. syncKeys(current, pre);
  7523. _diff(current, pre, '', result);
  7524. return result
  7525. }
  7526. function syncKeys(current, pre) {
  7527. if (current === pre) { return }
  7528. var rootCurrentType = type(current);
  7529. var rootPreType = type(pre);
  7530. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  7531. if(Object.keys(current).length >= Object.keys(pre).length){
  7532. for (var key in pre) {
  7533. var currentValue = current[key];
  7534. if (currentValue === undefined) {
  7535. current[key] = null;
  7536. } else {
  7537. syncKeys(currentValue, pre[key]);
  7538. }
  7539. }
  7540. }
  7541. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  7542. if (current.length >= pre.length) {
  7543. pre.forEach(function (item, index) {
  7544. syncKeys(current[index], item);
  7545. });
  7546. }
  7547. }
  7548. }
  7549. function _diff(current, pre, path, result) {
  7550. if (current === pre) { return }
  7551. var rootCurrentType = type(current);
  7552. var rootPreType = type(pre);
  7553. if (rootCurrentType == OBJECTTYPE) {
  7554. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  7555. setResult(result, path, current);
  7556. } else {
  7557. var loop = function ( key ) {
  7558. var currentValue = current[key];
  7559. var preValue = pre[key];
  7560. var currentType = type(currentValue);
  7561. var preType = type(preValue);
  7562. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  7563. if (currentValue !== pre[key]) {
  7564. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  7565. }
  7566. } else if (currentType == ARRAYTYPE) {
  7567. if (preType != ARRAYTYPE) {
  7568. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  7569. } else {
  7570. if (currentValue.length < preValue.length) {
  7571. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  7572. } else {
  7573. currentValue.forEach(function (item, index) {
  7574. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  7575. });
  7576. }
  7577. }
  7578. } else if (currentType == OBJECTTYPE) {
  7579. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  7580. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  7581. } else {
  7582. for (var subKey in currentValue) {
  7583. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  7584. }
  7585. }
  7586. }
  7587. };
  7588. for (var key in current) loop( key );
  7589. }
  7590. } else if (rootCurrentType == ARRAYTYPE) {
  7591. if (rootPreType != ARRAYTYPE) {
  7592. setResult(result, path, current);
  7593. } else {
  7594. if (current.length < pre.length) {
  7595. setResult(result, path, current);
  7596. } else {
  7597. current.forEach(function (item, index) {
  7598. _diff(item, pre[index], path + '[' + index + ']', result);
  7599. });
  7600. }
  7601. }
  7602. } else {
  7603. setResult(result, path, current);
  7604. }
  7605. }
  7606. function setResult(result, k, v) {
  7607. // if (type(v) != FUNCTIONTYPE) {
  7608. result[k] = v;
  7609. // }
  7610. }
  7611. function type(obj) {
  7612. return Object.prototype.toString.call(obj)
  7613. }
  7614. /* */
  7615. function flushCallbacks$1(vm) {
  7616. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  7617. if (Object({"VUE_APP_NAME":"aaa","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  7618. var mpInstance = vm.$scope;
  7619. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  7620. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  7621. }
  7622. var copies = vm.__next_tick_callbacks.slice(0);
  7623. vm.__next_tick_callbacks.length = 0;
  7624. for (var i = 0; i < copies.length; i++) {
  7625. copies[i]();
  7626. }
  7627. }
  7628. }
  7629. function hasRenderWatcher(vm) {
  7630. return queue.find(function (watcher) { return vm._watcher === watcher; })
  7631. }
  7632. function nextTick$1(vm, cb) {
  7633. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  7634. //2.nextTick 之前存在 render watcher
  7635. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  7636. if(Object({"VUE_APP_NAME":"aaa","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  7637. var mpInstance = vm.$scope;
  7638. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  7639. ']:nextVueTick');
  7640. }
  7641. return nextTick(cb, vm)
  7642. }else{
  7643. if(Object({"VUE_APP_NAME":"aaa","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  7644. var mpInstance$1 = vm.$scope;
  7645. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  7646. ']:nextMPTick');
  7647. }
  7648. }
  7649. var _resolve;
  7650. if (!vm.__next_tick_callbacks) {
  7651. vm.__next_tick_callbacks = [];
  7652. }
  7653. vm.__next_tick_callbacks.push(function () {
  7654. if (cb) {
  7655. try {
  7656. cb.call(vm);
  7657. } catch (e) {
  7658. handleError(e, vm, 'nextTick');
  7659. }
  7660. } else if (_resolve) {
  7661. _resolve(vm);
  7662. }
  7663. });
  7664. // $flow-disable-line
  7665. if (!cb && typeof Promise !== 'undefined') {
  7666. return new Promise(function (resolve) {
  7667. _resolve = resolve;
  7668. })
  7669. }
  7670. }
  7671. /* */
  7672. function cloneWithData(vm) {
  7673. // 确保当前 vm 所有数据被同步
  7674. var ret = Object.create(null);
  7675. var dataKeys = [].concat(
  7676. Object.keys(vm._data || {}),
  7677. Object.keys(vm._computedWatchers || {}));
  7678. dataKeys.reduce(function(ret, key) {
  7679. ret[key] = vm[key];
  7680. return ret
  7681. }, ret);
  7682. // vue-composition-api
  7683. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  7684. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  7685. if (rawBindings) {
  7686. Object.keys(rawBindings).forEach(function (key) {
  7687. ret[key] = vm[key];
  7688. });
  7689. }
  7690. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  7691. Object.assign(ret, vm.$mp.data || {});
  7692. if (
  7693. Array.isArray(vm.$options.behaviors) &&
  7694. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  7695. ) { //form-field
  7696. ret['name'] = vm.name;
  7697. ret['value'] = vm.value;
  7698. }
  7699. return JSON.parse(JSON.stringify(ret))
  7700. }
  7701. var patch = function(oldVnode, vnode) {
  7702. var this$1 = this;
  7703. if (vnode === null) { //destroy
  7704. return
  7705. }
  7706. if (this.mpType === 'page' || this.mpType === 'component') {
  7707. var mpInstance = this.$scope;
  7708. var data = Object.create(null);
  7709. try {
  7710. data = cloneWithData(this);
  7711. } catch (err) {
  7712. console.error(err);
  7713. }
  7714. data.__webviewId__ = mpInstance.data.__webviewId__;
  7715. var mpData = Object.create(null);
  7716. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  7717. mpData[key] = mpInstance.data[key];
  7718. });
  7719. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  7720. if (Object.keys(diffData).length) {
  7721. if (Object({"VUE_APP_NAME":"aaa","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  7722. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  7723. ']差量更新',
  7724. JSON.stringify(diffData));
  7725. }
  7726. this.__next_tick_pending = true;
  7727. mpInstance.setData(diffData, function () {
  7728. this$1.__next_tick_pending = false;
  7729. flushCallbacks$1(this$1);
  7730. });
  7731. } else {
  7732. flushCallbacks$1(this);
  7733. }
  7734. }
  7735. };
  7736. /* */
  7737. function createEmptyRender() {
  7738. }
  7739. function mountComponent$1(
  7740. vm,
  7741. el,
  7742. hydrating
  7743. ) {
  7744. if (!vm.mpType) {//main.js 中的 new Vue
  7745. return vm
  7746. }
  7747. if (vm.mpType === 'app') {
  7748. vm.$options.render = createEmptyRender;
  7749. }
  7750. if (!vm.$options.render) {
  7751. vm.$options.render = createEmptyRender;
  7752. if (true) {
  7753. /* istanbul ignore if */
  7754. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  7755. vm.$options.el || el) {
  7756. warn(
  7757. 'You are using the runtime-only build of Vue where the template ' +
  7758. 'compiler is not available. Either pre-compile the templates into ' +
  7759. 'render functions, or use the compiler-included build.',
  7760. vm
  7761. );
  7762. } else {
  7763. warn(
  7764. 'Failed to mount component: template or render function not defined.',
  7765. vm
  7766. );
  7767. }
  7768. }
  7769. }
  7770. !vm._$fallback && callHook(vm, 'beforeMount');
  7771. var updateComponent = function () {
  7772. vm._update(vm._render(), hydrating);
  7773. };
  7774. // we set this to vm._watcher inside the watcher's constructor
  7775. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  7776. // component's mounted hook), which relies on vm._watcher being already defined
  7777. new Watcher(vm, updateComponent, noop, {
  7778. before: function before() {
  7779. if (vm._isMounted && !vm._isDestroyed) {
  7780. callHook(vm, 'beforeUpdate');
  7781. }
  7782. }
  7783. }, true /* isRenderWatcher */);
  7784. hydrating = false;
  7785. return vm
  7786. }
  7787. /* */
  7788. function renderClass (
  7789. staticClass,
  7790. dynamicClass
  7791. ) {
  7792. if (isDef(staticClass) || isDef(dynamicClass)) {
  7793. return concat(staticClass, stringifyClass(dynamicClass))
  7794. }
  7795. /* istanbul ignore next */
  7796. return ''
  7797. }
  7798. function concat (a, b) {
  7799. return a ? b ? (a + ' ' + b) : a : (b || '')
  7800. }
  7801. function stringifyClass (value) {
  7802. if (Array.isArray(value)) {
  7803. return stringifyArray(value)
  7804. }
  7805. if (isObject(value)) {
  7806. return stringifyObject(value)
  7807. }
  7808. if (typeof value === 'string') {
  7809. return value
  7810. }
  7811. /* istanbul ignore next */
  7812. return ''
  7813. }
  7814. function stringifyArray (value) {
  7815. var res = '';
  7816. var stringified;
  7817. for (var i = 0, l = value.length; i < l; i++) {
  7818. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  7819. if (res) { res += ' '; }
  7820. res += stringified;
  7821. }
  7822. }
  7823. return res
  7824. }
  7825. function stringifyObject (value) {
  7826. var res = '';
  7827. for (var key in value) {
  7828. if (value[key]) {
  7829. if (res) { res += ' '; }
  7830. res += key;
  7831. }
  7832. }
  7833. return res
  7834. }
  7835. /* */
  7836. var parseStyleText = cached(function (cssText) {
  7837. var res = {};
  7838. var listDelimiter = /;(?![^(]*\))/g;
  7839. var propertyDelimiter = /:(.+)/;
  7840. cssText.split(listDelimiter).forEach(function (item) {
  7841. if (item) {
  7842. var tmp = item.split(propertyDelimiter);
  7843. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  7844. }
  7845. });
  7846. return res
  7847. });
  7848. // normalize possible array / string values into Object
  7849. function normalizeStyleBinding (bindingStyle) {
  7850. if (Array.isArray(bindingStyle)) {
  7851. return toObject(bindingStyle)
  7852. }
  7853. if (typeof bindingStyle === 'string') {
  7854. return parseStyleText(bindingStyle)
  7855. }
  7856. return bindingStyle
  7857. }
  7858. /* */
  7859. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  7860. function getTarget(obj, path) {
  7861. var parts = path.split('.');
  7862. var key = parts[0];
  7863. if (key.indexOf('__$n') === 0) { //number index
  7864. key = parseInt(key.replace('__$n', ''));
  7865. }
  7866. if (parts.length === 1) {
  7867. return obj[key]
  7868. }
  7869. return getTarget(obj[key], parts.slice(1).join('.'))
  7870. }
  7871. function internalMixin(Vue) {
  7872. Vue.config.errorHandler = function(err, vm, info) {
  7873. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  7874. console.error(err);
  7875. /* eslint-disable no-undef */
  7876. var app = typeof getApp === 'function' && getApp();
  7877. if (app && app.onError) {
  7878. app.onError(err);
  7879. }
  7880. };
  7881. var oldEmit = Vue.prototype.$emit;
  7882. Vue.prototype.$emit = function(event) {
  7883. if (this.$scope && event) {
  7884. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  7885. if (triggerEvent) {
  7886. triggerEvent.call(this.$scope, event, {
  7887. __args__: toArray(arguments, 1)
  7888. });
  7889. }
  7890. }
  7891. return oldEmit.apply(this, arguments)
  7892. };
  7893. Vue.prototype.$nextTick = function(fn) {
  7894. return nextTick$1(this, fn)
  7895. };
  7896. MP_METHODS.forEach(function (method) {
  7897. Vue.prototype[method] = function(args) {
  7898. if (this.$scope && this.$scope[method]) {
  7899. return this.$scope[method](args)
  7900. }
  7901. // mp-alipay
  7902. if (typeof my === 'undefined') {
  7903. return
  7904. }
  7905. if (method === 'createSelectorQuery') {
  7906. /* eslint-disable no-undef */
  7907. return my.createSelectorQuery(args)
  7908. } else if (method === 'createIntersectionObserver') {
  7909. /* eslint-disable no-undef */
  7910. return my.createIntersectionObserver(args)
  7911. }
  7912. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  7913. };
  7914. });
  7915. Vue.prototype.__init_provide = initProvide;
  7916. Vue.prototype.__init_injections = initInjections;
  7917. Vue.prototype.__call_hook = function(hook, args) {
  7918. var vm = this;
  7919. // #7573 disable dep collection when invoking lifecycle hooks
  7920. pushTarget();
  7921. var handlers = vm.$options[hook];
  7922. var info = hook + " hook";
  7923. var ret;
  7924. if (handlers) {
  7925. for (var i = 0, j = handlers.length; i < j; i++) {
  7926. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  7927. }
  7928. }
  7929. if (vm._hasHookEvent) {
  7930. vm.$emit('hook:' + hook, args);
  7931. }
  7932. popTarget();
  7933. return ret
  7934. };
  7935. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  7936. if (Array.isArray(modifiers)) {
  7937. if (modifiers.indexOf('trim') !== -1) {
  7938. value = value.trim();
  7939. }
  7940. if (modifiers.indexOf('number') !== -1) {
  7941. value = this._n(value);
  7942. }
  7943. }
  7944. if (!target) {
  7945. target = this;
  7946. }
  7947. // 解决动态属性添加
  7948. Vue.set(target, key, value);
  7949. };
  7950. Vue.prototype.__set_sync = function(target, key, value) {
  7951. if (!target) {
  7952. target = this;
  7953. }
  7954. // 解决动态属性添加
  7955. Vue.set(target, key, value);
  7956. };
  7957. Vue.prototype.__get_orig = function(item) {
  7958. if (isPlainObject(item)) {
  7959. return item['$orig'] || item
  7960. }
  7961. return item
  7962. };
  7963. Vue.prototype.__get_value = function(dataPath, target) {
  7964. return getTarget(target || this, dataPath)
  7965. };
  7966. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  7967. return renderClass(staticClass, dynamicClass)
  7968. };
  7969. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  7970. if (!dynamicStyle && !staticStyle) {
  7971. return ''
  7972. }
  7973. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  7974. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  7975. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  7976. };
  7977. Vue.prototype.__map = function(val, iteratee) {
  7978. //TODO 暂不考虑 string
  7979. var ret, i, l, keys, key;
  7980. if (Array.isArray(val)) {
  7981. ret = new Array(val.length);
  7982. for (i = 0, l = val.length; i < l; i++) {
  7983. ret[i] = iteratee(val[i], i);
  7984. }
  7985. return ret
  7986. } else if (isObject(val)) {
  7987. keys = Object.keys(val);
  7988. ret = Object.create(null);
  7989. for (i = 0, l = keys.length; i < l; i++) {
  7990. key = keys[i];
  7991. ret[key] = iteratee(val[key], key, i);
  7992. }
  7993. return ret
  7994. } else if (typeof val === 'number') {
  7995. ret = new Array(val);
  7996. for (i = 0, l = val; i < l; i++) {
  7997. // 第一个参数暂时仍和小程序一致
  7998. ret[i] = iteratee(i, i);
  7999. }
  8000. return ret
  8001. }
  8002. return []
  8003. };
  8004. }
  8005. /* */
  8006. var LIFECYCLE_HOOKS$1 = [
  8007. //App
  8008. 'onLaunch',
  8009. 'onShow',
  8010. 'onHide',
  8011. 'onUniNViewMessage',
  8012. 'onPageNotFound',
  8013. 'onThemeChange',
  8014. 'onError',
  8015. 'onUnhandledRejection',
  8016. //Page
  8017. 'onInit',
  8018. 'onLoad',
  8019. // 'onShow',
  8020. 'onReady',
  8021. // 'onHide',
  8022. 'onUnload',
  8023. 'onPullDownRefresh',
  8024. 'onReachBottom',
  8025. 'onTabItemTap',
  8026. 'onAddToFavorites',
  8027. 'onShareTimeline',
  8028. 'onShareAppMessage',
  8029. 'onResize',
  8030. 'onPageScroll',
  8031. 'onNavigationBarButtonTap',
  8032. 'onBackPress',
  8033. 'onNavigationBarSearchInputChanged',
  8034. 'onNavigationBarSearchInputConfirmed',
  8035. 'onNavigationBarSearchInputClicked',
  8036. //Component
  8037. // 'onReady', // 兼容旧版本,应该移除该事件
  8038. 'onPageShow',
  8039. 'onPageHide',
  8040. 'onPageResize',
  8041. 'onUploadDouyinVideo'
  8042. ];
  8043. function lifecycleMixin$1(Vue) {
  8044. //fixed vue-class-component
  8045. var oldExtend = Vue.extend;
  8046. Vue.extend = function(extendOptions) {
  8047. extendOptions = extendOptions || {};
  8048. var methods = extendOptions.methods;
  8049. if (methods) {
  8050. Object.keys(methods).forEach(function (methodName) {
  8051. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  8052. extendOptions[methodName] = methods[methodName];
  8053. delete methods[methodName];
  8054. }
  8055. });
  8056. }
  8057. return oldExtend.call(this, extendOptions)
  8058. };
  8059. var strategies = Vue.config.optionMergeStrategies;
  8060. var mergeHook = strategies.created;
  8061. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  8062. strategies[hook] = mergeHook;
  8063. });
  8064. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  8065. }
  8066. /* */
  8067. // install platform patch function
  8068. Vue.prototype.__patch__ = patch;
  8069. // public mount method
  8070. Vue.prototype.$mount = function(
  8071. el ,
  8072. hydrating
  8073. ) {
  8074. return mountComponent$1(this, el, hydrating)
  8075. };
  8076. lifecycleMixin$1(Vue);
  8077. internalMixin(Vue);
  8078. /* */
  8079. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  8080. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 2)))
  8081. /***/ }),
  8082. /* 5 */
  8083. /*!****************************************************************!*\
  8084. !*** C:/Users/17688/Documents/HBuilderProjects/aaa/pages.json ***!
  8085. \****************************************************************/
  8086. /*! no static exports found */
  8087. /***/ (function(module, exports) {
  8088. /***/ }),
  8089. /* 6 */,
  8090. /* 7 */,
  8091. /* 8 */,
  8092. /* 9 */,
  8093. /* 10 */,
  8094. /* 11 */
  8095. /*!**********************************************************************************************************!*\
  8096. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  8097. \**********************************************************************************************************/
  8098. /*! exports provided: default */
  8099. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8100. "use strict";
  8101. __webpack_require__.r(__webpack_exports__);
  8102. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  8103. /* globals __VUE_SSR_CONTEXT__ */
  8104. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  8105. // This module is a runtime utility for cleaner component module output and will
  8106. // be included in the final webpack user bundle.
  8107. function normalizeComponent (
  8108. scriptExports,
  8109. render,
  8110. staticRenderFns,
  8111. functionalTemplate,
  8112. injectStyles,
  8113. scopeId,
  8114. moduleIdentifier, /* server only */
  8115. shadowMode, /* vue-cli only */
  8116. components, // fixed by xxxxxx auto components
  8117. renderjs // fixed by xxxxxx renderjs
  8118. ) {
  8119. // Vue.extend constructor export interop
  8120. var options = typeof scriptExports === 'function'
  8121. ? scriptExports.options
  8122. : scriptExports
  8123. // fixed by xxxxxx auto components
  8124. if (components) {
  8125. if (!options.components) {
  8126. options.components = {}
  8127. }
  8128. var hasOwn = Object.prototype.hasOwnProperty
  8129. for (var name in components) {
  8130. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  8131. options.components[name] = components[name]
  8132. }
  8133. }
  8134. }
  8135. // fixed by xxxxxx renderjs
  8136. if (renderjs) {
  8137. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  8138. this[renderjs.__module] = this
  8139. });
  8140. (options.mixins || (options.mixins = [])).push(renderjs)
  8141. }
  8142. // render functions
  8143. if (render) {
  8144. options.render = render
  8145. options.staticRenderFns = staticRenderFns
  8146. options._compiled = true
  8147. }
  8148. // functional template
  8149. if (functionalTemplate) {
  8150. options.functional = true
  8151. }
  8152. // scopedId
  8153. if (scopeId) {
  8154. options._scopeId = 'data-v-' + scopeId
  8155. }
  8156. var hook
  8157. if (moduleIdentifier) { // server build
  8158. hook = function (context) {
  8159. // 2.3 injection
  8160. context =
  8161. context || // cached call
  8162. (this.$vnode && this.$vnode.ssrContext) || // stateful
  8163. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  8164. // 2.2 with runInNewContext: true
  8165. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  8166. context = __VUE_SSR_CONTEXT__
  8167. }
  8168. // inject component styles
  8169. if (injectStyles) {
  8170. injectStyles.call(this, context)
  8171. }
  8172. // register component module identifier for async chunk inferrence
  8173. if (context && context._registeredComponents) {
  8174. context._registeredComponents.add(moduleIdentifier)
  8175. }
  8176. }
  8177. // used by ssr in case component is cached and beforeCreate
  8178. // never gets called
  8179. options._ssrRegister = hook
  8180. } else if (injectStyles) {
  8181. hook = shadowMode
  8182. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  8183. : injectStyles
  8184. }
  8185. if (hook) {
  8186. if (options.functional) {
  8187. // for template-only hot-reload because in that case the render fn doesn't
  8188. // go through the normalizer
  8189. options._injectStyles = hook
  8190. // register for functioal component in vue file
  8191. var originalRender = options.render
  8192. options.render = function renderWithStyleInjection (h, context) {
  8193. hook.call(context)
  8194. return originalRender(h, context)
  8195. }
  8196. } else {
  8197. // inject component registration as beforeCreate hook
  8198. var existing = options.beforeCreate
  8199. options.beforeCreate = existing
  8200. ? [].concat(existing, hook)
  8201. : [hook]
  8202. }
  8203. }
  8204. return {
  8205. exports: scriptExports,
  8206. options: options
  8207. }
  8208. }
  8209. /***/ }),
  8210. /* 12 */,
  8211. /* 13 */,
  8212. /* 14 */,
  8213. /* 15 */,
  8214. /* 16 */,
  8215. /* 17 */,
  8216. /* 18 */,
  8217. /* 19 */,
  8218. /* 20 */,
  8219. /* 21 */
  8220. /*!**************************************!*\
  8221. !*** ./node_modules/buffer/index.js ***!
  8222. \**************************************/
  8223. /*! no static exports found */
  8224. /***/ (function(module, exports, __webpack_require__) {
  8225. "use strict";
  8226. /* WEBPACK VAR INJECTION */(function(global) {/*!
  8227. * The buffer module from node.js, for the browser.
  8228. *
  8229. * @author Feross Aboukhadijeh <http://feross.org>
  8230. * @license MIT
  8231. */
  8232. /* eslint-disable no-proto */
  8233. var base64 = __webpack_require__(/*! base64-js */ 22)
  8234. var ieee754 = __webpack_require__(/*! ieee754 */ 23)
  8235. var isArray = __webpack_require__(/*! isarray */ 24)
  8236. exports.Buffer = Buffer
  8237. exports.SlowBuffer = SlowBuffer
  8238. exports.INSPECT_MAX_BYTES = 50
  8239. /**
  8240. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  8241. * === true Use Uint8Array implementation (fastest)
  8242. * === false Use Object implementation (most compatible, even IE6)
  8243. *
  8244. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  8245. * Opera 11.6+, iOS 4.2+.
  8246. *
  8247. * Due to various browser bugs, sometimes the Object implementation will be used even
  8248. * when the browser supports typed arrays.
  8249. *
  8250. * Note:
  8251. *
  8252. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  8253. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  8254. *
  8255. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  8256. *
  8257. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  8258. * incorrect length in some situations.
  8259. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  8260. * get the Object implementation, which is slower but behaves correctly.
  8261. */
  8262. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  8263. ? global.TYPED_ARRAY_SUPPORT
  8264. : typedArraySupport()
  8265. /*
  8266. * Export kMaxLength after typed array support is determined.
  8267. */
  8268. exports.kMaxLength = kMaxLength()
  8269. function typedArraySupport () {
  8270. try {
  8271. var arr = new Uint8Array(1)
  8272. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  8273. return arr.foo() === 42 && // typed array instances can be augmented
  8274. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  8275. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  8276. } catch (e) {
  8277. return false
  8278. }
  8279. }
  8280. function kMaxLength () {
  8281. return Buffer.TYPED_ARRAY_SUPPORT
  8282. ? 0x7fffffff
  8283. : 0x3fffffff
  8284. }
  8285. function createBuffer (that, length) {
  8286. if (kMaxLength() < length) {
  8287. throw new RangeError('Invalid typed array length')
  8288. }
  8289. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8290. // Return an augmented `Uint8Array` instance, for best performance
  8291. that = new Uint8Array(length)
  8292. that.__proto__ = Buffer.prototype
  8293. } else {
  8294. // Fallback: Return an object instance of the Buffer class
  8295. if (that === null) {
  8296. that = new Buffer(length)
  8297. }
  8298. that.length = length
  8299. }
  8300. return that
  8301. }
  8302. /**
  8303. * The Buffer constructor returns instances of `Uint8Array` that have their
  8304. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  8305. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  8306. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  8307. * returns a single octet.
  8308. *
  8309. * The `Uint8Array` prototype remains unmodified.
  8310. */
  8311. function Buffer (arg, encodingOrOffset, length) {
  8312. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  8313. return new Buffer(arg, encodingOrOffset, length)
  8314. }
  8315. // Common case.
  8316. if (typeof arg === 'number') {
  8317. if (typeof encodingOrOffset === 'string') {
  8318. throw new Error(
  8319. 'If encoding is specified then the first argument must be a string'
  8320. )
  8321. }
  8322. return allocUnsafe(this, arg)
  8323. }
  8324. return from(this, arg, encodingOrOffset, length)
  8325. }
  8326. Buffer.poolSize = 8192 // not used by this implementation
  8327. // TODO: Legacy, not needed anymore. Remove in next major version.
  8328. Buffer._augment = function (arr) {
  8329. arr.__proto__ = Buffer.prototype
  8330. return arr
  8331. }
  8332. function from (that, value, encodingOrOffset, length) {
  8333. if (typeof value === 'number') {
  8334. throw new TypeError('"value" argument must not be a number')
  8335. }
  8336. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  8337. return fromArrayBuffer(that, value, encodingOrOffset, length)
  8338. }
  8339. if (typeof value === 'string') {
  8340. return fromString(that, value, encodingOrOffset)
  8341. }
  8342. return fromObject(that, value)
  8343. }
  8344. /**
  8345. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  8346. * if value is a number.
  8347. * Buffer.from(str[, encoding])
  8348. * Buffer.from(array)
  8349. * Buffer.from(buffer)
  8350. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  8351. **/
  8352. Buffer.from = function (value, encodingOrOffset, length) {
  8353. return from(null, value, encodingOrOffset, length)
  8354. }
  8355. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8356. Buffer.prototype.__proto__ = Uint8Array.prototype
  8357. Buffer.__proto__ = Uint8Array
  8358. if (typeof Symbol !== 'undefined' && Symbol.species &&
  8359. Buffer[Symbol.species] === Buffer) {
  8360. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  8361. Object.defineProperty(Buffer, Symbol.species, {
  8362. value: null,
  8363. configurable: true
  8364. })
  8365. }
  8366. }
  8367. function assertSize (size) {
  8368. if (typeof size !== 'number') {
  8369. throw new TypeError('"size" argument must be a number')
  8370. } else if (size < 0) {
  8371. throw new RangeError('"size" argument must not be negative')
  8372. }
  8373. }
  8374. function alloc (that, size, fill, encoding) {
  8375. assertSize(size)
  8376. if (size <= 0) {
  8377. return createBuffer(that, size)
  8378. }
  8379. if (fill !== undefined) {
  8380. // Only pay attention to encoding if it's a string. This
  8381. // prevents accidentally sending in a number that would
  8382. // be interpretted as a start offset.
  8383. return typeof encoding === 'string'
  8384. ? createBuffer(that, size).fill(fill, encoding)
  8385. : createBuffer(that, size).fill(fill)
  8386. }
  8387. return createBuffer(that, size)
  8388. }
  8389. /**
  8390. * Creates a new filled Buffer instance.
  8391. * alloc(size[, fill[, encoding]])
  8392. **/
  8393. Buffer.alloc = function (size, fill, encoding) {
  8394. return alloc(null, size, fill, encoding)
  8395. }
  8396. function allocUnsafe (that, size) {
  8397. assertSize(size)
  8398. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  8399. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  8400. for (var i = 0; i < size; ++i) {
  8401. that[i] = 0
  8402. }
  8403. }
  8404. return that
  8405. }
  8406. /**
  8407. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  8408. * */
  8409. Buffer.allocUnsafe = function (size) {
  8410. return allocUnsafe(null, size)
  8411. }
  8412. /**
  8413. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  8414. */
  8415. Buffer.allocUnsafeSlow = function (size) {
  8416. return allocUnsafe(null, size)
  8417. }
  8418. function fromString (that, string, encoding) {
  8419. if (typeof encoding !== 'string' || encoding === '') {
  8420. encoding = 'utf8'
  8421. }
  8422. if (!Buffer.isEncoding(encoding)) {
  8423. throw new TypeError('"encoding" must be a valid string encoding')
  8424. }
  8425. var length = byteLength(string, encoding) | 0
  8426. that = createBuffer(that, length)
  8427. var actual = that.write(string, encoding)
  8428. if (actual !== length) {
  8429. // Writing a hex string, for example, that contains invalid characters will
  8430. // cause everything after the first invalid character to be ignored. (e.g.
  8431. // 'abxxcd' will be treated as 'ab')
  8432. that = that.slice(0, actual)
  8433. }
  8434. return that
  8435. }
  8436. function fromArrayLike (that, array) {
  8437. var length = array.length < 0 ? 0 : checked(array.length) | 0
  8438. that = createBuffer(that, length)
  8439. for (var i = 0; i < length; i += 1) {
  8440. that[i] = array[i] & 255
  8441. }
  8442. return that
  8443. }
  8444. function fromArrayBuffer (that, array, byteOffset, length) {
  8445. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  8446. if (byteOffset < 0 || array.byteLength < byteOffset) {
  8447. throw new RangeError('\'offset\' is out of bounds')
  8448. }
  8449. if (array.byteLength < byteOffset + (length || 0)) {
  8450. throw new RangeError('\'length\' is out of bounds')
  8451. }
  8452. if (byteOffset === undefined && length === undefined) {
  8453. array = new Uint8Array(array)
  8454. } else if (length === undefined) {
  8455. array = new Uint8Array(array, byteOffset)
  8456. } else {
  8457. array = new Uint8Array(array, byteOffset, length)
  8458. }
  8459. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8460. // Return an augmented `Uint8Array` instance, for best performance
  8461. that = array
  8462. that.__proto__ = Buffer.prototype
  8463. } else {
  8464. // Fallback: Return an object instance of the Buffer class
  8465. that = fromArrayLike(that, array)
  8466. }
  8467. return that
  8468. }
  8469. function fromObject (that, obj) {
  8470. if (Buffer.isBuffer(obj)) {
  8471. var len = checked(obj.length) | 0
  8472. that = createBuffer(that, len)
  8473. if (that.length === 0) {
  8474. return that
  8475. }
  8476. obj.copy(that, 0, 0, len)
  8477. return that
  8478. }
  8479. if (obj) {
  8480. if ((typeof ArrayBuffer !== 'undefined' &&
  8481. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  8482. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  8483. return createBuffer(that, 0)
  8484. }
  8485. return fromArrayLike(that, obj)
  8486. }
  8487. if (obj.type === 'Buffer' && isArray(obj.data)) {
  8488. return fromArrayLike(that, obj.data)
  8489. }
  8490. }
  8491. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  8492. }
  8493. function checked (length) {
  8494. // Note: cannot use `length < kMaxLength()` here because that fails when
  8495. // length is NaN (which is otherwise coerced to zero.)
  8496. if (length >= kMaxLength()) {
  8497. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  8498. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  8499. }
  8500. return length | 0
  8501. }
  8502. function SlowBuffer (length) {
  8503. if (+length != length) { // eslint-disable-line eqeqeq
  8504. length = 0
  8505. }
  8506. return Buffer.alloc(+length)
  8507. }
  8508. Buffer.isBuffer = function isBuffer (b) {
  8509. return !!(b != null && b._isBuffer)
  8510. }
  8511. Buffer.compare = function compare (a, b) {
  8512. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  8513. throw new TypeError('Arguments must be Buffers')
  8514. }
  8515. if (a === b) return 0
  8516. var x = a.length
  8517. var y = b.length
  8518. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  8519. if (a[i] !== b[i]) {
  8520. x = a[i]
  8521. y = b[i]
  8522. break
  8523. }
  8524. }
  8525. if (x < y) return -1
  8526. if (y < x) return 1
  8527. return 0
  8528. }
  8529. Buffer.isEncoding = function isEncoding (encoding) {
  8530. switch (String(encoding).toLowerCase()) {
  8531. case 'hex':
  8532. case 'utf8':
  8533. case 'utf-8':
  8534. case 'ascii':
  8535. case 'latin1':
  8536. case 'binary':
  8537. case 'base64':
  8538. case 'ucs2':
  8539. case 'ucs-2':
  8540. case 'utf16le':
  8541. case 'utf-16le':
  8542. return true
  8543. default:
  8544. return false
  8545. }
  8546. }
  8547. Buffer.concat = function concat (list, length) {
  8548. if (!isArray(list)) {
  8549. throw new TypeError('"list" argument must be an Array of Buffers')
  8550. }
  8551. if (list.length === 0) {
  8552. return Buffer.alloc(0)
  8553. }
  8554. var i
  8555. if (length === undefined) {
  8556. length = 0
  8557. for (i = 0; i < list.length; ++i) {
  8558. length += list[i].length
  8559. }
  8560. }
  8561. var buffer = Buffer.allocUnsafe(length)
  8562. var pos = 0
  8563. for (i = 0; i < list.length; ++i) {
  8564. var buf = list[i]
  8565. if (!Buffer.isBuffer(buf)) {
  8566. throw new TypeError('"list" argument must be an Array of Buffers')
  8567. }
  8568. buf.copy(buffer, pos)
  8569. pos += buf.length
  8570. }
  8571. return buffer
  8572. }
  8573. function byteLength (string, encoding) {
  8574. if (Buffer.isBuffer(string)) {
  8575. return string.length
  8576. }
  8577. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  8578. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  8579. return string.byteLength
  8580. }
  8581. if (typeof string !== 'string') {
  8582. string = '' + string
  8583. }
  8584. var len = string.length
  8585. if (len === 0) return 0
  8586. // Use a for loop to avoid recursion
  8587. var loweredCase = false
  8588. for (;;) {
  8589. switch (encoding) {
  8590. case 'ascii':
  8591. case 'latin1':
  8592. case 'binary':
  8593. return len
  8594. case 'utf8':
  8595. case 'utf-8':
  8596. case undefined:
  8597. return utf8ToBytes(string).length
  8598. case 'ucs2':
  8599. case 'ucs-2':
  8600. case 'utf16le':
  8601. case 'utf-16le':
  8602. return len * 2
  8603. case 'hex':
  8604. return len >>> 1
  8605. case 'base64':
  8606. return base64ToBytes(string).length
  8607. default:
  8608. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  8609. encoding = ('' + encoding).toLowerCase()
  8610. loweredCase = true
  8611. }
  8612. }
  8613. }
  8614. Buffer.byteLength = byteLength
  8615. function slowToString (encoding, start, end) {
  8616. var loweredCase = false
  8617. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  8618. // property of a typed array.
  8619. // This behaves neither like String nor Uint8Array in that we set start/end
  8620. // to their upper/lower bounds if the value passed is out of range.
  8621. // undefined is handled specially as per ECMA-262 6th Edition,
  8622. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  8623. if (start === undefined || start < 0) {
  8624. start = 0
  8625. }
  8626. // Return early if start > this.length. Done here to prevent potential uint32
  8627. // coercion fail below.
  8628. if (start > this.length) {
  8629. return ''
  8630. }
  8631. if (end === undefined || end > this.length) {
  8632. end = this.length
  8633. }
  8634. if (end <= 0) {
  8635. return ''
  8636. }
  8637. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  8638. end >>>= 0
  8639. start >>>= 0
  8640. if (end <= start) {
  8641. return ''
  8642. }
  8643. if (!encoding) encoding = 'utf8'
  8644. while (true) {
  8645. switch (encoding) {
  8646. case 'hex':
  8647. return hexSlice(this, start, end)
  8648. case 'utf8':
  8649. case 'utf-8':
  8650. return utf8Slice(this, start, end)
  8651. case 'ascii':
  8652. return asciiSlice(this, start, end)
  8653. case 'latin1':
  8654. case 'binary':
  8655. return latin1Slice(this, start, end)
  8656. case 'base64':
  8657. return base64Slice(this, start, end)
  8658. case 'ucs2':
  8659. case 'ucs-2':
  8660. case 'utf16le':
  8661. case 'utf-16le':
  8662. return utf16leSlice(this, start, end)
  8663. default:
  8664. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  8665. encoding = (encoding + '').toLowerCase()
  8666. loweredCase = true
  8667. }
  8668. }
  8669. }
  8670. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  8671. // Buffer instances.
  8672. Buffer.prototype._isBuffer = true
  8673. function swap (b, n, m) {
  8674. var i = b[n]
  8675. b[n] = b[m]
  8676. b[m] = i
  8677. }
  8678. Buffer.prototype.swap16 = function swap16 () {
  8679. var len = this.length
  8680. if (len % 2 !== 0) {
  8681. throw new RangeError('Buffer size must be a multiple of 16-bits')
  8682. }
  8683. for (var i = 0; i < len; i += 2) {
  8684. swap(this, i, i + 1)
  8685. }
  8686. return this
  8687. }
  8688. Buffer.prototype.swap32 = function swap32 () {
  8689. var len = this.length
  8690. if (len % 4 !== 0) {
  8691. throw new RangeError('Buffer size must be a multiple of 32-bits')
  8692. }
  8693. for (var i = 0; i < len; i += 4) {
  8694. swap(this, i, i + 3)
  8695. swap(this, i + 1, i + 2)
  8696. }
  8697. return this
  8698. }
  8699. Buffer.prototype.swap64 = function swap64 () {
  8700. var len = this.length
  8701. if (len % 8 !== 0) {
  8702. throw new RangeError('Buffer size must be a multiple of 64-bits')
  8703. }
  8704. for (var i = 0; i < len; i += 8) {
  8705. swap(this, i, i + 7)
  8706. swap(this, i + 1, i + 6)
  8707. swap(this, i + 2, i + 5)
  8708. swap(this, i + 3, i + 4)
  8709. }
  8710. return this
  8711. }
  8712. Buffer.prototype.toString = function toString () {
  8713. var length = this.length | 0
  8714. if (length === 0) return ''
  8715. if (arguments.length === 0) return utf8Slice(this, 0, length)
  8716. return slowToString.apply(this, arguments)
  8717. }
  8718. Buffer.prototype.equals = function equals (b) {
  8719. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  8720. if (this === b) return true
  8721. return Buffer.compare(this, b) === 0
  8722. }
  8723. Buffer.prototype.inspect = function inspect () {
  8724. var str = ''
  8725. var max = exports.INSPECT_MAX_BYTES
  8726. if (this.length > 0) {
  8727. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  8728. if (this.length > max) str += ' ... '
  8729. }
  8730. return '<Buffer ' + str + '>'
  8731. }
  8732. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  8733. if (!Buffer.isBuffer(target)) {
  8734. throw new TypeError('Argument must be a Buffer')
  8735. }
  8736. if (start === undefined) {
  8737. start = 0
  8738. }
  8739. if (end === undefined) {
  8740. end = target ? target.length : 0
  8741. }
  8742. if (thisStart === undefined) {
  8743. thisStart = 0
  8744. }
  8745. if (thisEnd === undefined) {
  8746. thisEnd = this.length
  8747. }
  8748. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  8749. throw new RangeError('out of range index')
  8750. }
  8751. if (thisStart >= thisEnd && start >= end) {
  8752. return 0
  8753. }
  8754. if (thisStart >= thisEnd) {
  8755. return -1
  8756. }
  8757. if (start >= end) {
  8758. return 1
  8759. }
  8760. start >>>= 0
  8761. end >>>= 0
  8762. thisStart >>>= 0
  8763. thisEnd >>>= 0
  8764. if (this === target) return 0
  8765. var x = thisEnd - thisStart
  8766. var y = end - start
  8767. var len = Math.min(x, y)
  8768. var thisCopy = this.slice(thisStart, thisEnd)
  8769. var targetCopy = target.slice(start, end)
  8770. for (var i = 0; i < len; ++i) {
  8771. if (thisCopy[i] !== targetCopy[i]) {
  8772. x = thisCopy[i]
  8773. y = targetCopy[i]
  8774. break
  8775. }
  8776. }
  8777. if (x < y) return -1
  8778. if (y < x) return 1
  8779. return 0
  8780. }
  8781. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  8782. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  8783. //
  8784. // Arguments:
  8785. // - buffer - a Buffer to search
  8786. // - val - a string, Buffer, or number
  8787. // - byteOffset - an index into `buffer`; will be clamped to an int32
  8788. // - encoding - an optional encoding, relevant is val is a string
  8789. // - dir - true for indexOf, false for lastIndexOf
  8790. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  8791. // Empty buffer means no match
  8792. if (buffer.length === 0) return -1
  8793. // Normalize byteOffset
  8794. if (typeof byteOffset === 'string') {
  8795. encoding = byteOffset
  8796. byteOffset = 0
  8797. } else if (byteOffset > 0x7fffffff) {
  8798. byteOffset = 0x7fffffff
  8799. } else if (byteOffset < -0x80000000) {
  8800. byteOffset = -0x80000000
  8801. }
  8802. byteOffset = +byteOffset // Coerce to Number.
  8803. if (isNaN(byteOffset)) {
  8804. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  8805. byteOffset = dir ? 0 : (buffer.length - 1)
  8806. }
  8807. // Normalize byteOffset: negative offsets start from the end of the buffer
  8808. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  8809. if (byteOffset >= buffer.length) {
  8810. if (dir) return -1
  8811. else byteOffset = buffer.length - 1
  8812. } else if (byteOffset < 0) {
  8813. if (dir) byteOffset = 0
  8814. else return -1
  8815. }
  8816. // Normalize val
  8817. if (typeof val === 'string') {
  8818. val = Buffer.from(val, encoding)
  8819. }
  8820. // Finally, search either indexOf (if dir is true) or lastIndexOf
  8821. if (Buffer.isBuffer(val)) {
  8822. // Special case: looking for empty string/buffer always fails
  8823. if (val.length === 0) {
  8824. return -1
  8825. }
  8826. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  8827. } else if (typeof val === 'number') {
  8828. val = val & 0xFF // Search for a byte value [0-255]
  8829. if (Buffer.TYPED_ARRAY_SUPPORT &&
  8830. typeof Uint8Array.prototype.indexOf === 'function') {
  8831. if (dir) {
  8832. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  8833. } else {
  8834. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  8835. }
  8836. }
  8837. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  8838. }
  8839. throw new TypeError('val must be string, number or Buffer')
  8840. }
  8841. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  8842. var indexSize = 1
  8843. var arrLength = arr.length
  8844. var valLength = val.length
  8845. if (encoding !== undefined) {
  8846. encoding = String(encoding).toLowerCase()
  8847. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  8848. encoding === 'utf16le' || encoding === 'utf-16le') {
  8849. if (arr.length < 2 || val.length < 2) {
  8850. return -1
  8851. }
  8852. indexSize = 2
  8853. arrLength /= 2
  8854. valLength /= 2
  8855. byteOffset /= 2
  8856. }
  8857. }
  8858. function read (buf, i) {
  8859. if (indexSize === 1) {
  8860. return buf[i]
  8861. } else {
  8862. return buf.readUInt16BE(i * indexSize)
  8863. }
  8864. }
  8865. var i
  8866. if (dir) {
  8867. var foundIndex = -1
  8868. for (i = byteOffset; i < arrLength; i++) {
  8869. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  8870. if (foundIndex === -1) foundIndex = i
  8871. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  8872. } else {
  8873. if (foundIndex !== -1) i -= i - foundIndex
  8874. foundIndex = -1
  8875. }
  8876. }
  8877. } else {
  8878. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  8879. for (i = byteOffset; i >= 0; i--) {
  8880. var found = true
  8881. for (var j = 0; j < valLength; j++) {
  8882. if (read(arr, i + j) !== read(val, j)) {
  8883. found = false
  8884. break
  8885. }
  8886. }
  8887. if (found) return i
  8888. }
  8889. }
  8890. return -1
  8891. }
  8892. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  8893. return this.indexOf(val, byteOffset, encoding) !== -1
  8894. }
  8895. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  8896. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  8897. }
  8898. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  8899. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  8900. }
  8901. function hexWrite (buf, string, offset, length) {
  8902. offset = Number(offset) || 0
  8903. var remaining = buf.length - offset
  8904. if (!length) {
  8905. length = remaining
  8906. } else {
  8907. length = Number(length)
  8908. if (length > remaining) {
  8909. length = remaining
  8910. }
  8911. }
  8912. // must be an even number of digits
  8913. var strLen = string.length
  8914. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  8915. if (length > strLen / 2) {
  8916. length = strLen / 2
  8917. }
  8918. for (var i = 0; i < length; ++i) {
  8919. var parsed = parseInt(string.substr(i * 2, 2), 16)
  8920. if (isNaN(parsed)) return i
  8921. buf[offset + i] = parsed
  8922. }
  8923. return i
  8924. }
  8925. function utf8Write (buf, string, offset, length) {
  8926. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  8927. }
  8928. function asciiWrite (buf, string, offset, length) {
  8929. return blitBuffer(asciiToBytes(string), buf, offset, length)
  8930. }
  8931. function latin1Write (buf, string, offset, length) {
  8932. return asciiWrite(buf, string, offset, length)
  8933. }
  8934. function base64Write (buf, string, offset, length) {
  8935. return blitBuffer(base64ToBytes(string), buf, offset, length)
  8936. }
  8937. function ucs2Write (buf, string, offset, length) {
  8938. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  8939. }
  8940. Buffer.prototype.write = function write (string, offset, length, encoding) {
  8941. // Buffer#write(string)
  8942. if (offset === undefined) {
  8943. encoding = 'utf8'
  8944. length = this.length
  8945. offset = 0
  8946. // Buffer#write(string, encoding)
  8947. } else if (length === undefined && typeof offset === 'string') {
  8948. encoding = offset
  8949. length = this.length
  8950. offset = 0
  8951. // Buffer#write(string, offset[, length][, encoding])
  8952. } else if (isFinite(offset)) {
  8953. offset = offset | 0
  8954. if (isFinite(length)) {
  8955. length = length | 0
  8956. if (encoding === undefined) encoding = 'utf8'
  8957. } else {
  8958. encoding = length
  8959. length = undefined
  8960. }
  8961. // legacy write(string, encoding, offset, length) - remove in v0.13
  8962. } else {
  8963. throw new Error(
  8964. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  8965. )
  8966. }
  8967. var remaining = this.length - offset
  8968. if (length === undefined || length > remaining) length = remaining
  8969. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  8970. throw new RangeError('Attempt to write outside buffer bounds')
  8971. }
  8972. if (!encoding) encoding = 'utf8'
  8973. var loweredCase = false
  8974. for (;;) {
  8975. switch (encoding) {
  8976. case 'hex':
  8977. return hexWrite(this, string, offset, length)
  8978. case 'utf8':
  8979. case 'utf-8':
  8980. return utf8Write(this, string, offset, length)
  8981. case 'ascii':
  8982. return asciiWrite(this, string, offset, length)
  8983. case 'latin1':
  8984. case 'binary':
  8985. return latin1Write(this, string, offset, length)
  8986. case 'base64':
  8987. // Warning: maxLength not taken into account in base64Write
  8988. return base64Write(this, string, offset, length)
  8989. case 'ucs2':
  8990. case 'ucs-2':
  8991. case 'utf16le':
  8992. case 'utf-16le':
  8993. return ucs2Write(this, string, offset, length)
  8994. default:
  8995. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  8996. encoding = ('' + encoding).toLowerCase()
  8997. loweredCase = true
  8998. }
  8999. }
  9000. }
  9001. Buffer.prototype.toJSON = function toJSON () {
  9002. return {
  9003. type: 'Buffer',
  9004. data: Array.prototype.slice.call(this._arr || this, 0)
  9005. }
  9006. }
  9007. function base64Slice (buf, start, end) {
  9008. if (start === 0 && end === buf.length) {
  9009. return base64.fromByteArray(buf)
  9010. } else {
  9011. return base64.fromByteArray(buf.slice(start, end))
  9012. }
  9013. }
  9014. function utf8Slice (buf, start, end) {
  9015. end = Math.min(buf.length, end)
  9016. var res = []
  9017. var i = start
  9018. while (i < end) {
  9019. var firstByte = buf[i]
  9020. var codePoint = null
  9021. var bytesPerSequence = (firstByte > 0xEF) ? 4
  9022. : (firstByte > 0xDF) ? 3
  9023. : (firstByte > 0xBF) ? 2
  9024. : 1
  9025. if (i + bytesPerSequence <= end) {
  9026. var secondByte, thirdByte, fourthByte, tempCodePoint
  9027. switch (bytesPerSequence) {
  9028. case 1:
  9029. if (firstByte < 0x80) {
  9030. codePoint = firstByte
  9031. }
  9032. break
  9033. case 2:
  9034. secondByte = buf[i + 1]
  9035. if ((secondByte & 0xC0) === 0x80) {
  9036. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  9037. if (tempCodePoint > 0x7F) {
  9038. codePoint = tempCodePoint
  9039. }
  9040. }
  9041. break
  9042. case 3:
  9043. secondByte = buf[i + 1]
  9044. thirdByte = buf[i + 2]
  9045. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  9046. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  9047. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  9048. codePoint = tempCodePoint
  9049. }
  9050. }
  9051. break
  9052. case 4:
  9053. secondByte = buf[i + 1]
  9054. thirdByte = buf[i + 2]
  9055. fourthByte = buf[i + 3]
  9056. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  9057. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  9058. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  9059. codePoint = tempCodePoint
  9060. }
  9061. }
  9062. }
  9063. }
  9064. if (codePoint === null) {
  9065. // we did not generate a valid codePoint so insert a
  9066. // replacement char (U+FFFD) and advance only 1 byte
  9067. codePoint = 0xFFFD
  9068. bytesPerSequence = 1
  9069. } else if (codePoint > 0xFFFF) {
  9070. // encode to utf16 (surrogate pair dance)
  9071. codePoint -= 0x10000
  9072. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  9073. codePoint = 0xDC00 | codePoint & 0x3FF
  9074. }
  9075. res.push(codePoint)
  9076. i += bytesPerSequence
  9077. }
  9078. return decodeCodePointsArray(res)
  9079. }
  9080. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  9081. // the lowest limit is Chrome, with 0x10000 args.
  9082. // We go 1 magnitude less, for safety
  9083. var MAX_ARGUMENTS_LENGTH = 0x1000
  9084. function decodeCodePointsArray (codePoints) {
  9085. var len = codePoints.length
  9086. if (len <= MAX_ARGUMENTS_LENGTH) {
  9087. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  9088. }
  9089. // Decode in chunks to avoid "call stack size exceeded".
  9090. var res = ''
  9091. var i = 0
  9092. while (i < len) {
  9093. res += String.fromCharCode.apply(
  9094. String,
  9095. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  9096. )
  9097. }
  9098. return res
  9099. }
  9100. function asciiSlice (buf, start, end) {
  9101. var ret = ''
  9102. end = Math.min(buf.length, end)
  9103. for (var i = start; i < end; ++i) {
  9104. ret += String.fromCharCode(buf[i] & 0x7F)
  9105. }
  9106. return ret
  9107. }
  9108. function latin1Slice (buf, start, end) {
  9109. var ret = ''
  9110. end = Math.min(buf.length, end)
  9111. for (var i = start; i < end; ++i) {
  9112. ret += String.fromCharCode(buf[i])
  9113. }
  9114. return ret
  9115. }
  9116. function hexSlice (buf, start, end) {
  9117. var len = buf.length
  9118. if (!start || start < 0) start = 0
  9119. if (!end || end < 0 || end > len) end = len
  9120. var out = ''
  9121. for (var i = start; i < end; ++i) {
  9122. out += toHex(buf[i])
  9123. }
  9124. return out
  9125. }
  9126. function utf16leSlice (buf, start, end) {
  9127. var bytes = buf.slice(start, end)
  9128. var res = ''
  9129. for (var i = 0; i < bytes.length; i += 2) {
  9130. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  9131. }
  9132. return res
  9133. }
  9134. Buffer.prototype.slice = function slice (start, end) {
  9135. var len = this.length
  9136. start = ~~start
  9137. end = end === undefined ? len : ~~end
  9138. if (start < 0) {
  9139. start += len
  9140. if (start < 0) start = 0
  9141. } else if (start > len) {
  9142. start = len
  9143. }
  9144. if (end < 0) {
  9145. end += len
  9146. if (end < 0) end = 0
  9147. } else if (end > len) {
  9148. end = len
  9149. }
  9150. if (end < start) end = start
  9151. var newBuf
  9152. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9153. newBuf = this.subarray(start, end)
  9154. newBuf.__proto__ = Buffer.prototype
  9155. } else {
  9156. var sliceLen = end - start
  9157. newBuf = new Buffer(sliceLen, undefined)
  9158. for (var i = 0; i < sliceLen; ++i) {
  9159. newBuf[i] = this[i + start]
  9160. }
  9161. }
  9162. return newBuf
  9163. }
  9164. /*
  9165. * Need to make sure that buffer isn't trying to write out of bounds.
  9166. */
  9167. function checkOffset (offset, ext, length) {
  9168. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  9169. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  9170. }
  9171. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  9172. offset = offset | 0
  9173. byteLength = byteLength | 0
  9174. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9175. var val = this[offset]
  9176. var mul = 1
  9177. var i = 0
  9178. while (++i < byteLength && (mul *= 0x100)) {
  9179. val += this[offset + i] * mul
  9180. }
  9181. return val
  9182. }
  9183. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  9184. offset = offset | 0
  9185. byteLength = byteLength | 0
  9186. if (!noAssert) {
  9187. checkOffset(offset, byteLength, this.length)
  9188. }
  9189. var val = this[offset + --byteLength]
  9190. var mul = 1
  9191. while (byteLength > 0 && (mul *= 0x100)) {
  9192. val += this[offset + --byteLength] * mul
  9193. }
  9194. return val
  9195. }
  9196. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  9197. if (!noAssert) checkOffset(offset, 1, this.length)
  9198. return this[offset]
  9199. }
  9200. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  9201. if (!noAssert) checkOffset(offset, 2, this.length)
  9202. return this[offset] | (this[offset + 1] << 8)
  9203. }
  9204. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  9205. if (!noAssert) checkOffset(offset, 2, this.length)
  9206. return (this[offset] << 8) | this[offset + 1]
  9207. }
  9208. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  9209. if (!noAssert) checkOffset(offset, 4, this.length)
  9210. return ((this[offset]) |
  9211. (this[offset + 1] << 8) |
  9212. (this[offset + 2] << 16)) +
  9213. (this[offset + 3] * 0x1000000)
  9214. }
  9215. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  9216. if (!noAssert) checkOffset(offset, 4, this.length)
  9217. return (this[offset] * 0x1000000) +
  9218. ((this[offset + 1] << 16) |
  9219. (this[offset + 2] << 8) |
  9220. this[offset + 3])
  9221. }
  9222. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  9223. offset = offset | 0
  9224. byteLength = byteLength | 0
  9225. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9226. var val = this[offset]
  9227. var mul = 1
  9228. var i = 0
  9229. while (++i < byteLength && (mul *= 0x100)) {
  9230. val += this[offset + i] * mul
  9231. }
  9232. mul *= 0x80
  9233. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  9234. return val
  9235. }
  9236. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  9237. offset = offset | 0
  9238. byteLength = byteLength | 0
  9239. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9240. var i = byteLength
  9241. var mul = 1
  9242. var val = this[offset + --i]
  9243. while (i > 0 && (mul *= 0x100)) {
  9244. val += this[offset + --i] * mul
  9245. }
  9246. mul *= 0x80
  9247. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  9248. return val
  9249. }
  9250. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  9251. if (!noAssert) checkOffset(offset, 1, this.length)
  9252. if (!(this[offset] & 0x80)) return (this[offset])
  9253. return ((0xff - this[offset] + 1) * -1)
  9254. }
  9255. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  9256. if (!noAssert) checkOffset(offset, 2, this.length)
  9257. var val = this[offset] | (this[offset + 1] << 8)
  9258. return (val & 0x8000) ? val | 0xFFFF0000 : val
  9259. }
  9260. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  9261. if (!noAssert) checkOffset(offset, 2, this.length)
  9262. var val = this[offset + 1] | (this[offset] << 8)
  9263. return (val & 0x8000) ? val | 0xFFFF0000 : val
  9264. }
  9265. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  9266. if (!noAssert) checkOffset(offset, 4, this.length)
  9267. return (this[offset]) |
  9268. (this[offset + 1] << 8) |
  9269. (this[offset + 2] << 16) |
  9270. (this[offset + 3] << 24)
  9271. }
  9272. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  9273. if (!noAssert) checkOffset(offset, 4, this.length)
  9274. return (this[offset] << 24) |
  9275. (this[offset + 1] << 16) |
  9276. (this[offset + 2] << 8) |
  9277. (this[offset + 3])
  9278. }
  9279. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  9280. if (!noAssert) checkOffset(offset, 4, this.length)
  9281. return ieee754.read(this, offset, true, 23, 4)
  9282. }
  9283. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  9284. if (!noAssert) checkOffset(offset, 4, this.length)
  9285. return ieee754.read(this, offset, false, 23, 4)
  9286. }
  9287. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  9288. if (!noAssert) checkOffset(offset, 8, this.length)
  9289. return ieee754.read(this, offset, true, 52, 8)
  9290. }
  9291. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  9292. if (!noAssert) checkOffset(offset, 8, this.length)
  9293. return ieee754.read(this, offset, false, 52, 8)
  9294. }
  9295. function checkInt (buf, value, offset, ext, max, min) {
  9296. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  9297. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  9298. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  9299. }
  9300. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  9301. value = +value
  9302. offset = offset | 0
  9303. byteLength = byteLength | 0
  9304. if (!noAssert) {
  9305. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  9306. checkInt(this, value, offset, byteLength, maxBytes, 0)
  9307. }
  9308. var mul = 1
  9309. var i = 0
  9310. this[offset] = value & 0xFF
  9311. while (++i < byteLength && (mul *= 0x100)) {
  9312. this[offset + i] = (value / mul) & 0xFF
  9313. }
  9314. return offset + byteLength
  9315. }
  9316. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  9317. value = +value
  9318. offset = offset | 0
  9319. byteLength = byteLength | 0
  9320. if (!noAssert) {
  9321. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  9322. checkInt(this, value, offset, byteLength, maxBytes, 0)
  9323. }
  9324. var i = byteLength - 1
  9325. var mul = 1
  9326. this[offset + i] = value & 0xFF
  9327. while (--i >= 0 && (mul *= 0x100)) {
  9328. this[offset + i] = (value / mul) & 0xFF
  9329. }
  9330. return offset + byteLength
  9331. }
  9332. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  9333. value = +value
  9334. offset = offset | 0
  9335. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  9336. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  9337. this[offset] = (value & 0xff)
  9338. return offset + 1
  9339. }
  9340. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  9341. if (value < 0) value = 0xffff + value + 1
  9342. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  9343. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  9344. (littleEndian ? i : 1 - i) * 8
  9345. }
  9346. }
  9347. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  9348. value = +value
  9349. offset = offset | 0
  9350. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  9351. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9352. this[offset] = (value & 0xff)
  9353. this[offset + 1] = (value >>> 8)
  9354. } else {
  9355. objectWriteUInt16(this, value, offset, true)
  9356. }
  9357. return offset + 2
  9358. }
  9359. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  9360. value = +value
  9361. offset = offset | 0
  9362. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  9363. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9364. this[offset] = (value >>> 8)
  9365. this[offset + 1] = (value & 0xff)
  9366. } else {
  9367. objectWriteUInt16(this, value, offset, false)
  9368. }
  9369. return offset + 2
  9370. }
  9371. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  9372. if (value < 0) value = 0xffffffff + value + 1
  9373. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  9374. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  9375. }
  9376. }
  9377. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  9378. value = +value
  9379. offset = offset | 0
  9380. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  9381. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9382. this[offset + 3] = (value >>> 24)
  9383. this[offset + 2] = (value >>> 16)
  9384. this[offset + 1] = (value >>> 8)
  9385. this[offset] = (value & 0xff)
  9386. } else {
  9387. objectWriteUInt32(this, value, offset, true)
  9388. }
  9389. return offset + 4
  9390. }
  9391. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  9392. value = +value
  9393. offset = offset | 0
  9394. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  9395. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9396. this[offset] = (value >>> 24)
  9397. this[offset + 1] = (value >>> 16)
  9398. this[offset + 2] = (value >>> 8)
  9399. this[offset + 3] = (value & 0xff)
  9400. } else {
  9401. objectWriteUInt32(this, value, offset, false)
  9402. }
  9403. return offset + 4
  9404. }
  9405. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  9406. value = +value
  9407. offset = offset | 0
  9408. if (!noAssert) {
  9409. var limit = Math.pow(2, 8 * byteLength - 1)
  9410. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  9411. }
  9412. var i = 0
  9413. var mul = 1
  9414. var sub = 0
  9415. this[offset] = value & 0xFF
  9416. while (++i < byteLength && (mul *= 0x100)) {
  9417. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  9418. sub = 1
  9419. }
  9420. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  9421. }
  9422. return offset + byteLength
  9423. }
  9424. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  9425. value = +value
  9426. offset = offset | 0
  9427. if (!noAssert) {
  9428. var limit = Math.pow(2, 8 * byteLength - 1)
  9429. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  9430. }
  9431. var i = byteLength - 1
  9432. var mul = 1
  9433. var sub = 0
  9434. this[offset + i] = value & 0xFF
  9435. while (--i >= 0 && (mul *= 0x100)) {
  9436. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  9437. sub = 1
  9438. }
  9439. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  9440. }
  9441. return offset + byteLength
  9442. }
  9443. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  9444. value = +value
  9445. offset = offset | 0
  9446. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  9447. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  9448. if (value < 0) value = 0xff + value + 1
  9449. this[offset] = (value & 0xff)
  9450. return offset + 1
  9451. }
  9452. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  9453. value = +value
  9454. offset = offset | 0
  9455. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  9456. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9457. this[offset] = (value & 0xff)
  9458. this[offset + 1] = (value >>> 8)
  9459. } else {
  9460. objectWriteUInt16(this, value, offset, true)
  9461. }
  9462. return offset + 2
  9463. }
  9464. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  9465. value = +value
  9466. offset = offset | 0
  9467. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  9468. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9469. this[offset] = (value >>> 8)
  9470. this[offset + 1] = (value & 0xff)
  9471. } else {
  9472. objectWriteUInt16(this, value, offset, false)
  9473. }
  9474. return offset + 2
  9475. }
  9476. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  9477. value = +value
  9478. offset = offset | 0
  9479. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  9480. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9481. this[offset] = (value & 0xff)
  9482. this[offset + 1] = (value >>> 8)
  9483. this[offset + 2] = (value >>> 16)
  9484. this[offset + 3] = (value >>> 24)
  9485. } else {
  9486. objectWriteUInt32(this, value, offset, true)
  9487. }
  9488. return offset + 4
  9489. }
  9490. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  9491. value = +value
  9492. offset = offset | 0
  9493. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  9494. if (value < 0) value = 0xffffffff + value + 1
  9495. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9496. this[offset] = (value >>> 24)
  9497. this[offset + 1] = (value >>> 16)
  9498. this[offset + 2] = (value >>> 8)
  9499. this[offset + 3] = (value & 0xff)
  9500. } else {
  9501. objectWriteUInt32(this, value, offset, false)
  9502. }
  9503. return offset + 4
  9504. }
  9505. function checkIEEE754 (buf, value, offset, ext, max, min) {
  9506. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  9507. if (offset < 0) throw new RangeError('Index out of range')
  9508. }
  9509. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  9510. if (!noAssert) {
  9511. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  9512. }
  9513. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  9514. return offset + 4
  9515. }
  9516. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  9517. return writeFloat(this, value, offset, true, noAssert)
  9518. }
  9519. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  9520. return writeFloat(this, value, offset, false, noAssert)
  9521. }
  9522. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  9523. if (!noAssert) {
  9524. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  9525. }
  9526. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  9527. return offset + 8
  9528. }
  9529. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  9530. return writeDouble(this, value, offset, true, noAssert)
  9531. }
  9532. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  9533. return writeDouble(this, value, offset, false, noAssert)
  9534. }
  9535. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  9536. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  9537. if (!start) start = 0
  9538. if (!end && end !== 0) end = this.length
  9539. if (targetStart >= target.length) targetStart = target.length
  9540. if (!targetStart) targetStart = 0
  9541. if (end > 0 && end < start) end = start
  9542. // Copy 0 bytes; we're done
  9543. if (end === start) return 0
  9544. if (target.length === 0 || this.length === 0) return 0
  9545. // Fatal error conditions
  9546. if (targetStart < 0) {
  9547. throw new RangeError('targetStart out of bounds')
  9548. }
  9549. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  9550. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  9551. // Are we oob?
  9552. if (end > this.length) end = this.length
  9553. if (target.length - targetStart < end - start) {
  9554. end = target.length - targetStart + start
  9555. }
  9556. var len = end - start
  9557. var i
  9558. if (this === target && start < targetStart && targetStart < end) {
  9559. // descending copy from end
  9560. for (i = len - 1; i >= 0; --i) {
  9561. target[i + targetStart] = this[i + start]
  9562. }
  9563. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  9564. // ascending copy from start
  9565. for (i = 0; i < len; ++i) {
  9566. target[i + targetStart] = this[i + start]
  9567. }
  9568. } else {
  9569. Uint8Array.prototype.set.call(
  9570. target,
  9571. this.subarray(start, start + len),
  9572. targetStart
  9573. )
  9574. }
  9575. return len
  9576. }
  9577. // Usage:
  9578. // buffer.fill(number[, offset[, end]])
  9579. // buffer.fill(buffer[, offset[, end]])
  9580. // buffer.fill(string[, offset[, end]][, encoding])
  9581. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  9582. // Handle string cases:
  9583. if (typeof val === 'string') {
  9584. if (typeof start === 'string') {
  9585. encoding = start
  9586. start = 0
  9587. end = this.length
  9588. } else if (typeof end === 'string') {
  9589. encoding = end
  9590. end = this.length
  9591. }
  9592. if (val.length === 1) {
  9593. var code = val.charCodeAt(0)
  9594. if (code < 256) {
  9595. val = code
  9596. }
  9597. }
  9598. if (encoding !== undefined && typeof encoding !== 'string') {
  9599. throw new TypeError('encoding must be a string')
  9600. }
  9601. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  9602. throw new TypeError('Unknown encoding: ' + encoding)
  9603. }
  9604. } else if (typeof val === 'number') {
  9605. val = val & 255
  9606. }
  9607. // Invalid ranges are not set to a default, so can range check early.
  9608. if (start < 0 || this.length < start || this.length < end) {
  9609. throw new RangeError('Out of range index')
  9610. }
  9611. if (end <= start) {
  9612. return this
  9613. }
  9614. start = start >>> 0
  9615. end = end === undefined ? this.length : end >>> 0
  9616. if (!val) val = 0
  9617. var i
  9618. if (typeof val === 'number') {
  9619. for (i = start; i < end; ++i) {
  9620. this[i] = val
  9621. }
  9622. } else {
  9623. var bytes = Buffer.isBuffer(val)
  9624. ? val
  9625. : utf8ToBytes(new Buffer(val, encoding).toString())
  9626. var len = bytes.length
  9627. for (i = 0; i < end - start; ++i) {
  9628. this[i + start] = bytes[i % len]
  9629. }
  9630. }
  9631. return this
  9632. }
  9633. // HELPER FUNCTIONS
  9634. // ================
  9635. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  9636. function base64clean (str) {
  9637. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  9638. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  9639. // Node converts strings with length < 2 to ''
  9640. if (str.length < 2) return ''
  9641. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  9642. while (str.length % 4 !== 0) {
  9643. str = str + '='
  9644. }
  9645. return str
  9646. }
  9647. function stringtrim (str) {
  9648. if (str.trim) return str.trim()
  9649. return str.replace(/^\s+|\s+$/g, '')
  9650. }
  9651. function toHex (n) {
  9652. if (n < 16) return '0' + n.toString(16)
  9653. return n.toString(16)
  9654. }
  9655. function utf8ToBytes (string, units) {
  9656. units = units || Infinity
  9657. var codePoint
  9658. var length = string.length
  9659. var leadSurrogate = null
  9660. var bytes = []
  9661. for (var i = 0; i < length; ++i) {
  9662. codePoint = string.charCodeAt(i)
  9663. // is surrogate component
  9664. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  9665. // last char was a lead
  9666. if (!leadSurrogate) {
  9667. // no lead yet
  9668. if (codePoint > 0xDBFF) {
  9669. // unexpected trail
  9670. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9671. continue
  9672. } else if (i + 1 === length) {
  9673. // unpaired lead
  9674. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9675. continue
  9676. }
  9677. // valid lead
  9678. leadSurrogate = codePoint
  9679. continue
  9680. }
  9681. // 2 leads in a row
  9682. if (codePoint < 0xDC00) {
  9683. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9684. leadSurrogate = codePoint
  9685. continue
  9686. }
  9687. // valid surrogate pair
  9688. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  9689. } else if (leadSurrogate) {
  9690. // valid bmp char, but last char was a lead
  9691. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9692. }
  9693. leadSurrogate = null
  9694. // encode utf8
  9695. if (codePoint < 0x80) {
  9696. if ((units -= 1) < 0) break
  9697. bytes.push(codePoint)
  9698. } else if (codePoint < 0x800) {
  9699. if ((units -= 2) < 0) break
  9700. bytes.push(
  9701. codePoint >> 0x6 | 0xC0,
  9702. codePoint & 0x3F | 0x80
  9703. )
  9704. } else if (codePoint < 0x10000) {
  9705. if ((units -= 3) < 0) break
  9706. bytes.push(
  9707. codePoint >> 0xC | 0xE0,
  9708. codePoint >> 0x6 & 0x3F | 0x80,
  9709. codePoint & 0x3F | 0x80
  9710. )
  9711. } else if (codePoint < 0x110000) {
  9712. if ((units -= 4) < 0) break
  9713. bytes.push(
  9714. codePoint >> 0x12 | 0xF0,
  9715. codePoint >> 0xC & 0x3F | 0x80,
  9716. codePoint >> 0x6 & 0x3F | 0x80,
  9717. codePoint & 0x3F | 0x80
  9718. )
  9719. } else {
  9720. throw new Error('Invalid code point')
  9721. }
  9722. }
  9723. return bytes
  9724. }
  9725. function asciiToBytes (str) {
  9726. var byteArray = []
  9727. for (var i = 0; i < str.length; ++i) {
  9728. // Node's code seems to be doing this and not & 0x7F..
  9729. byteArray.push(str.charCodeAt(i) & 0xFF)
  9730. }
  9731. return byteArray
  9732. }
  9733. function utf16leToBytes (str, units) {
  9734. var c, hi, lo
  9735. var byteArray = []
  9736. for (var i = 0; i < str.length; ++i) {
  9737. if ((units -= 2) < 0) break
  9738. c = str.charCodeAt(i)
  9739. hi = c >> 8
  9740. lo = c % 256
  9741. byteArray.push(lo)
  9742. byteArray.push(hi)
  9743. }
  9744. return byteArray
  9745. }
  9746. function base64ToBytes (str) {
  9747. return base64.toByteArray(base64clean(str))
  9748. }
  9749. function blitBuffer (src, dst, offset, length) {
  9750. for (var i = 0; i < length; ++i) {
  9751. if ((i + offset >= dst.length) || (i >= src.length)) break
  9752. dst[i + offset] = src[i]
  9753. }
  9754. return i
  9755. }
  9756. function isnan (val) {
  9757. return val !== val // eslint-disable-line no-self-compare
  9758. }
  9759. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 2)))
  9760. /***/ }),
  9761. /* 22 */
  9762. /*!*****************************************!*\
  9763. !*** ./node_modules/base64-js/index.js ***!
  9764. \*****************************************/
  9765. /*! no static exports found */
  9766. /***/ (function(module, exports, __webpack_require__) {
  9767. "use strict";
  9768. exports.byteLength = byteLength
  9769. exports.toByteArray = toByteArray
  9770. exports.fromByteArray = fromByteArray
  9771. var lookup = []
  9772. var revLookup = []
  9773. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  9774. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  9775. for (var i = 0, len = code.length; i < len; ++i) {
  9776. lookup[i] = code[i]
  9777. revLookup[code.charCodeAt(i)] = i
  9778. }
  9779. // Support decoding URL-safe base64 strings, as Node.js does.
  9780. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  9781. revLookup['-'.charCodeAt(0)] = 62
  9782. revLookup['_'.charCodeAt(0)] = 63
  9783. function getLens (b64) {
  9784. var len = b64.length
  9785. if (len % 4 > 0) {
  9786. throw new Error('Invalid string. Length must be a multiple of 4')
  9787. }
  9788. // Trim off extra bytes after placeholder bytes are found
  9789. // See: https://github.com/beatgammit/base64-js/issues/42
  9790. var validLen = b64.indexOf('=')
  9791. if (validLen === -1) validLen = len
  9792. var placeHoldersLen = validLen === len
  9793. ? 0
  9794. : 4 - (validLen % 4)
  9795. return [validLen, placeHoldersLen]
  9796. }
  9797. // base64 is 4/3 + up to two characters of the original data
  9798. function byteLength (b64) {
  9799. var lens = getLens(b64)
  9800. var validLen = lens[0]
  9801. var placeHoldersLen = lens[1]
  9802. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  9803. }
  9804. function _byteLength (b64, validLen, placeHoldersLen) {
  9805. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  9806. }
  9807. function toByteArray (b64) {
  9808. var tmp
  9809. var lens = getLens(b64)
  9810. var validLen = lens[0]
  9811. var placeHoldersLen = lens[1]
  9812. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  9813. var curByte = 0
  9814. // if there are placeholders, only get up to the last complete 4 chars
  9815. var len = placeHoldersLen > 0
  9816. ? validLen - 4
  9817. : validLen
  9818. var i
  9819. for (i = 0; i < len; i += 4) {
  9820. tmp =
  9821. (revLookup[b64.charCodeAt(i)] << 18) |
  9822. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  9823. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  9824. revLookup[b64.charCodeAt(i + 3)]
  9825. arr[curByte++] = (tmp >> 16) & 0xFF
  9826. arr[curByte++] = (tmp >> 8) & 0xFF
  9827. arr[curByte++] = tmp & 0xFF
  9828. }
  9829. if (placeHoldersLen === 2) {
  9830. tmp =
  9831. (revLookup[b64.charCodeAt(i)] << 2) |
  9832. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  9833. arr[curByte++] = tmp & 0xFF
  9834. }
  9835. if (placeHoldersLen === 1) {
  9836. tmp =
  9837. (revLookup[b64.charCodeAt(i)] << 10) |
  9838. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  9839. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  9840. arr[curByte++] = (tmp >> 8) & 0xFF
  9841. arr[curByte++] = tmp & 0xFF
  9842. }
  9843. return arr
  9844. }
  9845. function tripletToBase64 (num) {
  9846. return lookup[num >> 18 & 0x3F] +
  9847. lookup[num >> 12 & 0x3F] +
  9848. lookup[num >> 6 & 0x3F] +
  9849. lookup[num & 0x3F]
  9850. }
  9851. function encodeChunk (uint8, start, end) {
  9852. var tmp
  9853. var output = []
  9854. for (var i = start; i < end; i += 3) {
  9855. tmp =
  9856. ((uint8[i] << 16) & 0xFF0000) +
  9857. ((uint8[i + 1] << 8) & 0xFF00) +
  9858. (uint8[i + 2] & 0xFF)
  9859. output.push(tripletToBase64(tmp))
  9860. }
  9861. return output.join('')
  9862. }
  9863. function fromByteArray (uint8) {
  9864. var tmp
  9865. var len = uint8.length
  9866. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  9867. var parts = []
  9868. var maxChunkLength = 16383 // must be multiple of 3
  9869. // go through the array every three bytes, we'll deal with trailing stuff later
  9870. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  9871. parts.push(encodeChunk(
  9872. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  9873. ))
  9874. }
  9875. // pad the end with zeros, but make sure to not forget the extra bytes
  9876. if (extraBytes === 1) {
  9877. tmp = uint8[len - 1]
  9878. parts.push(
  9879. lookup[tmp >> 2] +
  9880. lookup[(tmp << 4) & 0x3F] +
  9881. '=='
  9882. )
  9883. } else if (extraBytes === 2) {
  9884. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  9885. parts.push(
  9886. lookup[tmp >> 10] +
  9887. lookup[(tmp >> 4) & 0x3F] +
  9888. lookup[(tmp << 2) & 0x3F] +
  9889. '='
  9890. )
  9891. }
  9892. return parts.join('')
  9893. }
  9894. /***/ }),
  9895. /* 23 */
  9896. /*!***************************************!*\
  9897. !*** ./node_modules/ieee754/index.js ***!
  9898. \***************************************/
  9899. /*! no static exports found */
  9900. /***/ (function(module, exports) {
  9901. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9902. var e, m
  9903. var eLen = (nBytes * 8) - mLen - 1
  9904. var eMax = (1 << eLen) - 1
  9905. var eBias = eMax >> 1
  9906. var nBits = -7
  9907. var i = isLE ? (nBytes - 1) : 0
  9908. var d = isLE ? -1 : 1
  9909. var s = buffer[offset + i]
  9910. i += d
  9911. e = s & ((1 << (-nBits)) - 1)
  9912. s >>= (-nBits)
  9913. nBits += eLen
  9914. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9915. m = e & ((1 << (-nBits)) - 1)
  9916. e >>= (-nBits)
  9917. nBits += mLen
  9918. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9919. if (e === 0) {
  9920. e = 1 - eBias
  9921. } else if (e === eMax) {
  9922. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9923. } else {
  9924. m = m + Math.pow(2, mLen)
  9925. e = e - eBias
  9926. }
  9927. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9928. }
  9929. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9930. var e, m, c
  9931. var eLen = (nBytes * 8) - mLen - 1
  9932. var eMax = (1 << eLen) - 1
  9933. var eBias = eMax >> 1
  9934. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9935. var i = isLE ? 0 : (nBytes - 1)
  9936. var d = isLE ? 1 : -1
  9937. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9938. value = Math.abs(value)
  9939. if (isNaN(value) || value === Infinity) {
  9940. m = isNaN(value) ? 1 : 0
  9941. e = eMax
  9942. } else {
  9943. e = Math.floor(Math.log(value) / Math.LN2)
  9944. if (value * (c = Math.pow(2, -e)) < 1) {
  9945. e--
  9946. c *= 2
  9947. }
  9948. if (e + eBias >= 1) {
  9949. value += rt / c
  9950. } else {
  9951. value += rt * Math.pow(2, 1 - eBias)
  9952. }
  9953. if (value * c >= 2) {
  9954. e++
  9955. c /= 2
  9956. }
  9957. if (e + eBias >= eMax) {
  9958. m = 0
  9959. e = eMax
  9960. } else if (e + eBias >= 1) {
  9961. m = ((value * c) - 1) * Math.pow(2, mLen)
  9962. e = e + eBias
  9963. } else {
  9964. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9965. e = 0
  9966. }
  9967. }
  9968. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9969. e = (e << mLen) | m
  9970. eLen += mLen
  9971. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9972. buffer[offset + i - d] |= s * 128
  9973. }
  9974. /***/ }),
  9975. /* 24 */
  9976. /*!***************************************!*\
  9977. !*** ./node_modules/isarray/index.js ***!
  9978. \***************************************/
  9979. /*! no static exports found */
  9980. /***/ (function(module, exports) {
  9981. var toString = {}.toString;
  9982. module.exports = Array.isArray || function (arr) {
  9983. return toString.call(arr) == '[object Array]';
  9984. };
  9985. /***/ })
  9986. ]]);
  9987. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map