vendor.js 386 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  2. ["common/vendor"],
  3. [
  4. /* 0 */
  5. ,
  6. /* 1 */
  7. /*!************************************************************!*\
  8. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  9. \************************************************************/
  10. /*! no static exports found */
  11. /***/
  12. (function (module, exports, __webpack_require__) {
  13. "use strict";
  14. /* WEBPACK VAR INJECTION */
  15. (function (global) {
  16. Object.defineProperty(exports, "__esModule", {
  17. value: true
  18. });
  19. exports.createApp = createApp;
  20. exports.createComponent = createComponent;
  21. exports.createPage = createPage;
  22. exports.createPlugin = createPlugin;
  23. exports.createSubpackageApp = createSubpackageApp;
  24. exports.default = void 0;
  25. var _uniI18n = __webpack_require__( /*! @dcloudio/uni-i18n */ 3);
  26. var _vue = _interopRequireDefault(__webpack_require__( /*! vue */ 4));
  27. function _interopRequireDefault(obj) {
  28. return obj && obj.__esModule ? obj : {
  29. default: obj
  30. };
  31. }
  32. function ownKeys(object, enumerableOnly) {
  33. var keys = Object.keys(object);
  34. if (Object.getOwnPropertySymbols) {
  35. var symbols = Object.getOwnPropertySymbols(object);
  36. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  37. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  38. });
  39. keys.push.apply(keys, symbols);
  40. }
  41. return keys;
  42. }
  43. function _objectSpread(target) {
  44. for (var i = 1; i < arguments.length; i++) {
  45. var source = arguments[i] != null ? arguments[i] : {};
  46. if (i % 2) {
  47. ownKeys(Object(source), true).forEach(function (key) {
  48. _defineProperty(target, key, source[key]);
  49. });
  50. } else if (Object.getOwnPropertyDescriptors) {
  51. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  52. } else {
  53. ownKeys(Object(source)).forEach(function (key) {
  54. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  55. });
  56. }
  57. }
  58. return target;
  59. }
  60. function _slicedToArray(arr, i) {
  61. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  62. }
  63. function _nonIterableRest() {
  64. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  65. }
  66. function _iterableToArrayLimit(arr, i) {
  67. if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  68. var _arr = [];
  69. var _n = true;
  70. var _d = false;
  71. var _e = undefined;
  72. try {
  73. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  74. _arr.push(_s.value);
  75. if (i && _arr.length === i) break;
  76. }
  77. } catch (err) {
  78. _d = true;
  79. _e = err;
  80. } finally {
  81. try {
  82. if (!_n && _i["return"] != null) _i["return"]();
  83. } finally {
  84. if (_d) throw _e;
  85. }
  86. }
  87. return _arr;
  88. }
  89. function _arrayWithHoles(arr) {
  90. if (Array.isArray(arr)) return arr;
  91. }
  92. function _defineProperty(obj, key, value) {
  93. if (key in obj) {
  94. Object.defineProperty(obj, key, {
  95. value: value,
  96. enumerable: true,
  97. configurable: true,
  98. writable: true
  99. });
  100. } else {
  101. obj[key] = value;
  102. }
  103. return obj;
  104. }
  105. function _toConsumableArray(arr) {
  106. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  107. }
  108. function _nonIterableSpread() {
  109. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  110. }
  111. function _unsupportedIterableToArray(o, minLen) {
  112. if (!o) return;
  113. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  114. var n = Object.prototype.toString.call(o).slice(8, -1);
  115. if (n === "Object" && o.constructor) n = o.constructor.name;
  116. if (n === "Map" || n === "Set") return Array.from(o);
  117. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  118. }
  119. function _iterableToArray(iter) {
  120. if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
  121. }
  122. function _arrayWithoutHoles(arr) {
  123. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  124. }
  125. function _arrayLikeToArray(arr, len) {
  126. if (len == null || len > arr.length) len = arr.length;
  127. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  128. arr2[i] = arr[i];
  129. }
  130. return arr2;
  131. }
  132. var realAtob;
  133. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  134. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  135. if (typeof atob !== 'function') {
  136. realAtob = function realAtob(str) {
  137. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  138. if (!b64re.test(str)) {
  139. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  140. }
  141. // Adding the padding if missing, for semplicity
  142. str += '=='.slice(2 - (str.length & 3));
  143. var bitmap;
  144. var result = '';
  145. var r1;
  146. var r2;
  147. var i = 0;
  148. for (; i < str.length;) {
  149. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 |
  150. (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  151. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) :
  152. r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) :
  153. String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  154. }
  155. return result;
  156. };
  157. } else {
  158. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  159. realAtob = atob;
  160. }
  161. function b64DecodeUnicode(str) {
  162. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  163. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  164. }).join(''));
  165. }
  166. function getCurrentUserInfo() {
  167. var token = wx.getStorageSync('uni_id_token') || '';
  168. var tokenArr = token.split('.');
  169. if (!token || tokenArr.length !== 3) {
  170. return {
  171. uid: null,
  172. role: [],
  173. permission: [],
  174. tokenExpired: 0
  175. };
  176. }
  177. var userInfo;
  178. try {
  179. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  180. } catch (error) {
  181. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  182. }
  183. userInfo.tokenExpired = userInfo.exp * 1000;
  184. delete userInfo.exp;
  185. delete userInfo.iat;
  186. return userInfo;
  187. }
  188. function uniIdMixin(Vue) {
  189. Vue.prototype.uniIDHasRole = function (roleId) {
  190. var _getCurrentUserInfo =
  191. getCurrentUserInfo(),
  192. role = _getCurrentUserInfo.role;
  193. return role.indexOf(roleId) > -1;
  194. };
  195. Vue.prototype.uniIDHasPermission = function (permissionId) {
  196. var _getCurrentUserInfo2 =
  197. getCurrentUserInfo(),
  198. permission = _getCurrentUserInfo2.permission;
  199. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  200. };
  201. Vue.prototype.uniIDTokenValid = function () {
  202. var _getCurrentUserInfo3 =
  203. getCurrentUserInfo(),
  204. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  205. return tokenExpired > Date.now();
  206. };
  207. }
  208. var _toString = Object.prototype.toString;
  209. var hasOwnProperty = Object.prototype.hasOwnProperty;
  210. function isFn(fn) {
  211. return typeof fn === 'function';
  212. }
  213. function isStr(str) {
  214. return typeof str === 'string';
  215. }
  216. function isPlainObject(obj) {
  217. return _toString.call(obj) === '[object Object]';
  218. }
  219. function hasOwn(obj, key) {
  220. return hasOwnProperty.call(obj, key);
  221. }
  222. function noop() {}
  223. /**
  224. * Create a cached version of a pure function.
  225. */
  226. function cached(fn) {
  227. var cache = Object.create(null);
  228. return function cachedFn(str) {
  229. var hit = cache[str];
  230. return hit || (cache[str] = fn(str));
  231. };
  232. }
  233. /**
  234. * Camelize a hyphen-delimited string.
  235. */
  236. var camelizeRE = /-(\w)/g;
  237. var camelize = cached(function (str) {
  238. return str.replace(camelizeRE, function (_, c) {
  239. return c ? c.toUpperCase() : '';
  240. });
  241. });
  242. function sortObject(obj) {
  243. var sortObj = {};
  244. if (isPlainObject(obj)) {
  245. Object.keys(obj).sort().forEach(function (key) {
  246. sortObj[key] = obj[key];
  247. });
  248. }
  249. return !Object.keys(sortObj) ? obj : sortObj;
  250. }
  251. var HOOKS = [
  252. 'invoke',
  253. 'success',
  254. 'fail',
  255. 'complete',
  256. 'returnValue'
  257. ];
  258. var globalInterceptors = {};
  259. var scopedInterceptors = {};
  260. function mergeHook(parentVal, childVal) {
  261. var res = childVal ?
  262. parentVal ?
  263. parentVal.concat(childVal) :
  264. Array.isArray(childVal) ?
  265. childVal : [childVal] :
  266. parentVal;
  267. return res ?
  268. dedupeHooks(res) :
  269. res;
  270. }
  271. function dedupeHooks(hooks) {
  272. var res = [];
  273. for (var i = 0; i < hooks.length; i++) {
  274. if (res.indexOf(hooks[i]) === -1) {
  275. res.push(hooks[i]);
  276. }
  277. }
  278. return res;
  279. }
  280. function removeHook(hooks, hook) {
  281. var index = hooks.indexOf(hook);
  282. if (index !== -1) {
  283. hooks.splice(index, 1);
  284. }
  285. }
  286. function mergeInterceptorHook(interceptor, option) {
  287. Object.keys(option).forEach(function (hook) {
  288. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  289. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  290. }
  291. });
  292. }
  293. function removeInterceptorHook(interceptor, option) {
  294. if (!interceptor || !option) {
  295. return;
  296. }
  297. Object.keys(option).forEach(function (hook) {
  298. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  299. removeHook(interceptor[hook], option[hook]);
  300. }
  301. });
  302. }
  303. function addInterceptor(method, option) {
  304. if (typeof method === 'string' && isPlainObject(option)) {
  305. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  306. } else if (isPlainObject(method)) {
  307. mergeInterceptorHook(globalInterceptors, method);
  308. }
  309. }
  310. function removeInterceptor(method, option) {
  311. if (typeof method === 'string') {
  312. if (isPlainObject(option)) {
  313. removeInterceptorHook(scopedInterceptors[method], option);
  314. } else {
  315. delete scopedInterceptors[method];
  316. }
  317. } else if (isPlainObject(method)) {
  318. removeInterceptorHook(globalInterceptors, method);
  319. }
  320. }
  321. function wrapperHook(hook) {
  322. return function (data) {
  323. return hook(data) || data;
  324. };
  325. }
  326. function isPromise(obj) {
  327. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  328. }
  329. function queue(hooks, data) {
  330. var promise = false;
  331. for (var i = 0; i < hooks.length; i++) {
  332. var hook = hooks[i];
  333. if (promise) {
  334. promise = Promise.resolve(wrapperHook(hook));
  335. } else {
  336. var res = hook(data);
  337. if (isPromise(res)) {
  338. promise = Promise.resolve(res);
  339. }
  340. if (res === false) {
  341. return {
  342. then: function then() {}
  343. };
  344. }
  345. }
  346. }
  347. return promise || {
  348. then: function then(callback) {
  349. return callback(data);
  350. }
  351. };
  352. }
  353. function wrapperOptions(interceptor) {
  354. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  355. ['success', 'fail', 'complete'].forEach(function (name) {
  356. if (Array.isArray(interceptor[name])) {
  357. var oldCallback = options[name];
  358. options[name] = function callbackInterceptor(res) {
  359. queue(interceptor[name], res).then(function (res) {
  360. /* eslint-disable no-mixed-operators */
  361. return isFn(oldCallback) && oldCallback(res) || res;
  362. });
  363. };
  364. }
  365. });
  366. return options;
  367. }
  368. function wrapperReturnValue(method, returnValue) {
  369. var returnValueHooks = [];
  370. if (Array.isArray(globalInterceptors.returnValue)) {
  371. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  372. }
  373. var interceptor = scopedInterceptors[method];
  374. if (interceptor && Array.isArray(interceptor.returnValue)) {
  375. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  376. }
  377. returnValueHooks.forEach(function (hook) {
  378. returnValue = hook(returnValue) || returnValue;
  379. });
  380. return returnValue;
  381. }
  382. function getApiInterceptorHooks(method) {
  383. var interceptor = Object.create(null);
  384. Object.keys(globalInterceptors).forEach(function (hook) {
  385. if (hook !== 'returnValue') {
  386. interceptor[hook] = globalInterceptors[hook].slice();
  387. }
  388. });
  389. var scopedInterceptor = scopedInterceptors[method];
  390. if (scopedInterceptor) {
  391. Object.keys(scopedInterceptor).forEach(function (hook) {
  392. if (hook !== 'returnValue') {
  393. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  394. }
  395. });
  396. }
  397. return interceptor;
  398. }
  399. function invokeApi(method, api, options) {
  400. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  401. params[_key - 3] = arguments[_key];
  402. }
  403. var interceptor = getApiInterceptorHooks(method);
  404. if (interceptor && Object.keys(interceptor).length) {
  405. if (Array.isArray(interceptor.invoke)) {
  406. var res = queue(interceptor.invoke, options);
  407. return res.then(function (options) {
  408. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  409. });
  410. } else {
  411. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  412. }
  413. }
  414. return api.apply(void 0, [options].concat(params));
  415. }
  416. var promiseInterceptor = {
  417. returnValue: function returnValue(res) {
  418. if (!isPromise(res)) {
  419. return res;
  420. }
  421. return new Promise(function (resolve, reject) {
  422. res.then(function (res) {
  423. if (res[0]) {
  424. reject(res[0]);
  425. } else {
  426. resolve(res[1]);
  427. }
  428. });
  429. });
  430. }
  431. };
  432. var SYNC_API_RE =
  433. /^\$|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/;
  434. var CONTEXT_API_RE = /^create|Manager$/;
  435. // Context例外情况
  436. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  437. // 同步例外情况
  438. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  439. var CALLBACK_API_RE = /^on|^off/;
  440. function isContextApi(name) {
  441. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  442. }
  443. function isSyncApi(name) {
  444. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  445. }
  446. function isCallbackApi(name) {
  447. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  448. }
  449. function handlePromise(promise) {
  450. return promise.then(function (data) {
  451. return [null, data];
  452. }).
  453. catch(function (err) {
  454. return [err];
  455. });
  456. }
  457. function shouldPromise(name) {
  458. if (
  459. isContextApi(name) ||
  460. isSyncApi(name) ||
  461. isCallbackApi(name)) {
  462. return false;
  463. }
  464. return true;
  465. }
  466. /* eslint-disable no-extend-native */
  467. if (!Promise.prototype.finally) {
  468. Promise.prototype.finally = function (callback) {
  469. var promise = this.constructor;
  470. return this.then(
  471. function (value) {
  472. return promise.resolve(callback()).then(function () {
  473. return value;
  474. });
  475. },
  476. function (reason) {
  477. return promise.resolve(callback()).then(function () {
  478. throw reason;
  479. });
  480. });
  481. };
  482. }
  483. function promisify(name, api) {
  484. if (!shouldPromise(name)) {
  485. return api;
  486. }
  487. return function promiseApi() {
  488. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  489. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  490. params[_key2 - 1] = arguments[_key2];
  491. }
  492. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  493. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  494. }
  495. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  496. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  497. success: resolve,
  498. fail: reject
  499. })].concat(
  500. params));
  501. })));
  502. };
  503. }
  504. var EPS = 1e-4;
  505. var BASE_DEVICE_WIDTH = 750;
  506. var isIOS = false;
  507. var deviceWidth = 0;
  508. var deviceDPR = 0;
  509. function checkDeviceWidth() {
  510. var _wx$getSystemInfoSync =
  511. wx.getSystemInfoSync(),
  512. platform = _wx$getSystemInfoSync.platform,
  513. pixelRatio = _wx$getSystemInfoSync.pixelRatio,
  514. windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  515. deviceWidth = windowWidth;
  516. deviceDPR = pixelRatio;
  517. isIOS = platform === 'ios';
  518. }
  519. function upx2px(number, newDeviceWidth) {
  520. if (deviceWidth === 0) {
  521. checkDeviceWidth();
  522. }
  523. number = Number(number);
  524. if (number === 0) {
  525. return 0;
  526. }
  527. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  528. if (result < 0) {
  529. result = -result;
  530. }
  531. result = Math.floor(result + EPS);
  532. if (result === 0) {
  533. if (deviceDPR === 1 || !isIOS) {
  534. result = 1;
  535. } else {
  536. result = 0.5;
  537. }
  538. }
  539. return number < 0 ? -result : result;
  540. }
  541. var LOCALE_ZH_HANS = 'zh-Hans';
  542. var LOCALE_ZH_HANT = 'zh-Hant';
  543. var LOCALE_EN = 'en';
  544. var LOCALE_FR = 'fr';
  545. var LOCALE_ES = 'es';
  546. var messages = {};
  547. var locale;
  548. {
  549. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  550. }
  551. function initI18nMessages() {
  552. if (!isEnableLocale()) {
  553. return;
  554. }
  555. var localeKeys = Object.keys(__uniConfig.locales);
  556. if (localeKeys.length) {
  557. localeKeys.forEach(function (locale) {
  558. var curMessages = messages[locale];
  559. var userMessages = __uniConfig.locales[locale];
  560. if (curMessages) {
  561. Object.assign(curMessages, userMessages);
  562. } else {
  563. messages[locale] = userMessages;
  564. }
  565. });
  566. }
  567. }
  568. initI18nMessages();
  569. var i18n = (0, _uniI18n.initVueI18n)(
  570. locale, {});
  571. var t = i18n.t;
  572. var i18nMixin = i18n.mixin = {
  573. beforeCreate: function beforeCreate() {
  574. var _this = this;
  575. var unwatch = i18n.i18n.watchLocale(function () {
  576. _this.$forceUpdate();
  577. });
  578. this.$once('hook:beforeDestroy', function () {
  579. unwatch();
  580. });
  581. },
  582. methods: {
  583. $$t: function $$t(key, values) {
  584. return t(key, values);
  585. }
  586. }
  587. };
  588. var setLocale = i18n.setLocale;
  589. var getLocale = i18n.getLocale;
  590. function initAppLocale(Vue, appVm, locale) {
  591. var state = Vue.observable({
  592. locale: locale || i18n.getLocale()
  593. });
  594. var localeWatchers = [];
  595. appVm.$watchLocale = function (fn) {
  596. localeWatchers.push(fn);
  597. };
  598. Object.defineProperty(appVm, '$locale', {
  599. get: function get() {
  600. return state.locale;
  601. },
  602. set: function set(v) {
  603. state.locale = v;
  604. localeWatchers.forEach(function (watch) {
  605. return watch(v);
  606. });
  607. }
  608. });
  609. }
  610. function isEnableLocale() {
  611. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  612. }
  613. function include(str, parts) {
  614. return !!parts.find(function (part) {
  615. return str.indexOf(part) !== -1;
  616. });
  617. }
  618. function startsWith(str, parts) {
  619. return parts.find(function (part) {
  620. return str.indexOf(part) === 0;
  621. });
  622. }
  623. function normalizeLocale(locale, messages) {
  624. if (!locale) {
  625. return;
  626. }
  627. locale = locale.trim().replace(/_/g, '-');
  628. if (messages && messages[locale]) {
  629. return locale;
  630. }
  631. locale = locale.toLowerCase();
  632. if (locale === 'chinese') {
  633. // 支付宝
  634. return LOCALE_ZH_HANS;
  635. }
  636. if (locale.indexOf('zh') === 0) {
  637. if (locale.indexOf('-hans') > -1) {
  638. return LOCALE_ZH_HANS;
  639. }
  640. if (locale.indexOf('-hant') > -1) {
  641. return LOCALE_ZH_HANT;
  642. }
  643. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  644. return LOCALE_ZH_HANT;
  645. }
  646. return LOCALE_ZH_HANS;
  647. }
  648. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  649. if (lang) {
  650. return lang;
  651. }
  652. }
  653. // export function initI18n() {
  654. // const localeKeys = Object.keys(__uniConfig.locales || {})
  655. // if (localeKeys.length) {
  656. // localeKeys.forEach((locale) =>
  657. // i18n.add(locale, __uniConfig.locales[locale])
  658. // )
  659. // }
  660. // }
  661. function getLocale$1() {
  662. // 优先使用 $locale
  663. var app = getApp({
  664. allowDefault: true
  665. });
  666. if (app && app.$vm) {
  667. return app.$vm.$locale;
  668. }
  669. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  670. }
  671. function setLocale$1(locale) {
  672. var app = getApp();
  673. if (!app) {
  674. return false;
  675. }
  676. var oldLocale = app.$vm.$locale;
  677. if (oldLocale !== locale) {
  678. app.$vm.$locale = locale;
  679. onLocaleChangeCallbacks.forEach(function (fn) {
  680. return fn({
  681. locale: locale
  682. });
  683. });
  684. return true;
  685. }
  686. return false;
  687. }
  688. var onLocaleChangeCallbacks = [];
  689. function onLocaleChange(fn) {
  690. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  691. onLocaleChangeCallbacks.push(fn);
  692. }
  693. }
  694. if (typeof global !== 'undefined') {
  695. global.getLocale = getLocale$1;
  696. }
  697. var interceptors = {
  698. promiseInterceptor: promiseInterceptor
  699. };
  700. var baseApi = /*#__PURE__*/ Object.freeze({
  701. __proto__: null,
  702. upx2px: upx2px,
  703. getLocale: getLocale$1,
  704. setLocale: setLocale$1,
  705. onLocaleChange: onLocaleChange,
  706. addInterceptor: addInterceptor,
  707. removeInterceptor: removeInterceptor,
  708. interceptors: interceptors
  709. });
  710. function findExistsPageIndex(url) {
  711. var pages = getCurrentPages();
  712. var len = pages.length;
  713. while (len--) {
  714. var page = pages[len];
  715. if (page.$page && page.$page.fullPath === url) {
  716. return len;
  717. }
  718. }
  719. return -1;
  720. }
  721. var redirectTo = {
  722. name: function name(fromArgs) {
  723. if (fromArgs.exists === 'back' && fromArgs.delta) {
  724. return 'navigateBack';
  725. }
  726. return 'redirectTo';
  727. },
  728. args: function args(fromArgs) {
  729. if (fromArgs.exists === 'back' && fromArgs.url) {
  730. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  731. if (existsPageIndex !== -1) {
  732. var delta = getCurrentPages().length - 1 - existsPageIndex;
  733. if (delta > 0) {
  734. fromArgs.delta = delta;
  735. }
  736. }
  737. }
  738. }
  739. };
  740. var previewImage = {
  741. args: function args(fromArgs) {
  742. var currentIndex = parseInt(fromArgs.current);
  743. if (isNaN(currentIndex)) {
  744. return;
  745. }
  746. var urls = fromArgs.urls;
  747. if (!Array.isArray(urls)) {
  748. return;
  749. }
  750. var len = urls.length;
  751. if (!len) {
  752. return;
  753. }
  754. if (currentIndex < 0) {
  755. currentIndex = 0;
  756. } else if (currentIndex >= len) {
  757. currentIndex = len - 1;
  758. }
  759. if (currentIndex > 0) {
  760. fromArgs.current = urls[currentIndex];
  761. fromArgs.urls = urls.filter(
  762. function (item, index) {
  763. return index < currentIndex ? item !== urls[currentIndex] : true;
  764. });
  765. } else {
  766. fromArgs.current = urls[0];
  767. }
  768. return {
  769. indicator: false,
  770. loop: false
  771. };
  772. }
  773. };
  774. var UUID_KEY = '__DC_STAT_UUID';
  775. var deviceId;
  776. function useDeviceId(result) {
  777. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  778. if (!deviceId) {
  779. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  780. wx.setStorage({
  781. key: UUID_KEY,
  782. data: deviceId
  783. });
  784. }
  785. result.deviceId = deviceId;
  786. }
  787. function addSafeAreaInsets(result) {
  788. if (result.safeArea) {
  789. var safeArea = result.safeArea;
  790. result.safeAreaInsets = {
  791. top: safeArea.top,
  792. left: safeArea.left,
  793. right: result.windowWidth - safeArea.right,
  794. bottom: result.screenHeight - safeArea.bottom
  795. };
  796. }
  797. }
  798. function populateParameters(result) {
  799. var _result$brand =
  800. result.brand,
  801. brand = _result$brand === void 0 ? '' : _result$brand,
  802. _result$model = result.model,
  803. model = _result$model === void 0 ? '' : _result$model,
  804. _result$system = result.system,
  805. system = _result$system === void 0 ? '' : _result$system,
  806. _result$language = result.language,
  807. language = _result$language === void 0 ? '' : _result$language,
  808. theme = result.theme,
  809. version = result.version,
  810. platform = result.platform,
  811. fontSizeSetting = result.fontSizeSetting,
  812. SDKVersion = result.SDKVersion,
  813. pixelRatio = result.pixelRatio,
  814. deviceOrientation = result.deviceOrientation;
  815. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  816. // osName osVersion
  817. var osName = '';
  818. var osVersion = ''; {
  819. osName = system.split(' ')[0] || '';
  820. osVersion = system.split(' ')[1] || '';
  821. }
  822. var hostVersion = version;
  823. // deviceType
  824. var deviceType = getGetDeviceType(result, model);
  825. // deviceModel
  826. var deviceBrand = getDeviceBrand(brand);
  827. // hostName
  828. var _hostName = getHostName(result);
  829. // deviceOrientation
  830. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  831. // devicePixelRatio
  832. var _devicePixelRatio = pixelRatio;
  833. // SDKVersion
  834. var _SDKVersion = SDKVersion;
  835. // hostLanguage
  836. var hostLanguage = language.replace(/_/g, '-');
  837. // wx.getAccountInfoSync
  838. var parameters = {
  839. appId: "__UNI__B8A04E2",
  840. appName: "aaa",
  841. appVersion: "1.0.0",
  842. appVersionCode: "100",
  843. appLanguage: getAppLanguage(hostLanguage),
  844. uniCompileVersion: "3.6.4",
  845. uniRuntimeVersion: "3.6.4",
  846. uniPlatform: undefined || "mp-weixin",
  847. deviceBrand: deviceBrand,
  848. deviceModel: model,
  849. deviceType: deviceType,
  850. devicePixelRatio: _devicePixelRatio,
  851. deviceOrientation: _deviceOrientation,
  852. osName: osName.toLocaleLowerCase(),
  853. osVersion: osVersion,
  854. hostTheme: theme,
  855. hostVersion: hostVersion,
  856. hostLanguage: hostLanguage,
  857. hostName: _hostName,
  858. hostSDKVersion: _SDKVersion,
  859. hostFontSizeSetting: fontSizeSetting,
  860. windowTop: 0,
  861. windowBottom: 0,
  862. // TODO
  863. osLanguage: undefined,
  864. osTheme: undefined,
  865. ua: undefined,
  866. hostPackageName: undefined,
  867. browserName: undefined,
  868. browserVersion: undefined
  869. };
  870. Object.assign(result, parameters);
  871. }
  872. function getGetDeviceType(result, model) {
  873. var deviceType = result.deviceType || 'phone'; {
  874. var deviceTypeMaps = {
  875. ipad: 'pad',
  876. windows: 'pc',
  877. mac: 'pc'
  878. };
  879. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  880. var _model = model.toLocaleLowerCase();
  881. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  882. var _m = deviceTypeMapsKeys[index];
  883. if (_model.indexOf(_m) !== -1) {
  884. deviceType = deviceTypeMaps[_m];
  885. break;
  886. }
  887. }
  888. }
  889. return deviceType;
  890. }
  891. function getDeviceBrand(brand) {
  892. var deviceBrand = brand;
  893. if (deviceBrand) {
  894. deviceBrand = brand.toLocaleLowerCase();
  895. }
  896. return deviceBrand;
  897. }
  898. function getAppLanguage(defaultLanguage) {
  899. return getLocale$1 ?
  900. getLocale$1() :
  901. defaultLanguage;
  902. }
  903. function getHostName(result) {
  904. var _platform = 'WeChat';
  905. var _hostName = result.hostName || _platform; // mp-jd
  906. {
  907. if (result.environment) {
  908. _hostName = result.environment;
  909. } else if (result.host && result.host.env) {
  910. _hostName = result.host.env;
  911. }
  912. }
  913. return _hostName;
  914. }
  915. var getSystemInfo = {
  916. returnValue: function returnValue(result) {
  917. useDeviceId(result);
  918. addSafeAreaInsets(result);
  919. populateParameters(result);
  920. }
  921. };
  922. var showActionSheet = {
  923. args: function args(fromArgs) {
  924. if (typeof fromArgs === 'object') {
  925. fromArgs.alertText = fromArgs.title;
  926. }
  927. }
  928. };
  929. var getAppBaseInfo = {
  930. returnValue: function returnValue(result) {
  931. var _result =
  932. result,
  933. version = _result.version,
  934. language = _result.language,
  935. SDKVersion = _result.SDKVersion,
  936. theme = _result.theme;
  937. var _hostName = getHostName(result);
  938. var hostLanguage = language.replace('_', '-');
  939. result = sortObject(Object.assign(result, {
  940. appId: "__UNI__B8A04E2",
  941. appName: "aaa",
  942. appVersion: "1.0.0",
  943. appVersionCode: "100",
  944. appLanguage: getAppLanguage(hostLanguage),
  945. hostVersion: version,
  946. hostLanguage: hostLanguage,
  947. hostName: _hostName,
  948. hostSDKVersion: SDKVersion,
  949. hostTheme: theme
  950. }));
  951. }
  952. };
  953. var getDeviceInfo = {
  954. returnValue: function returnValue(result) {
  955. var _result2 =
  956. result,
  957. brand = _result2.brand,
  958. model = _result2.model;
  959. var deviceType = getGetDeviceType(result, model);
  960. var deviceBrand = getDeviceBrand(brand);
  961. useDeviceId(result);
  962. result = sortObject(Object.assign(result, {
  963. deviceType: deviceType,
  964. deviceBrand: deviceBrand,
  965. deviceModel: model
  966. }));
  967. }
  968. };
  969. var getWindowInfo = {
  970. returnValue: function returnValue(result) {
  971. addSafeAreaInsets(result);
  972. result = sortObject(Object.assign(result, {
  973. windowTop: 0,
  974. windowBottom: 0
  975. }));
  976. }
  977. };
  978. var getAppAuthorizeSetting = {
  979. returnValue: function returnValue(result) {
  980. var
  981. locationReducedAccuracy = result.locationReducedAccuracy;
  982. result.locationAccuracy = 'unsupported';
  983. if (locationReducedAccuracy === true) {
  984. result.locationAccuracy = 'reduced';
  985. } else if (locationReducedAccuracy === false) {
  986. result.locationAccuracy = 'full';
  987. }
  988. }
  989. };
  990. // import navigateTo from 'uni-helpers/navigate-to'
  991. var protocols = {
  992. redirectTo: redirectTo,
  993. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  994. previewImage: previewImage,
  995. getSystemInfo: getSystemInfo,
  996. getSystemInfoSync: getSystemInfo,
  997. showActionSheet: showActionSheet,
  998. getAppBaseInfo: getAppBaseInfo,
  999. getDeviceInfo: getDeviceInfo,
  1000. getWindowInfo: getWindowInfo,
  1001. getAppAuthorizeSetting: getAppAuthorizeSetting
  1002. };
  1003. var todos = [
  1004. 'vibrate',
  1005. 'preloadPage',
  1006. 'unPreloadPage',
  1007. 'loadSubPackage'
  1008. ];
  1009. var canIUses = [];
  1010. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  1011. function processCallback(methodName, method, returnValue) {
  1012. return function (res) {
  1013. return method(processReturnValue(methodName, res, returnValue));
  1014. };
  1015. }
  1016. function processArgs(methodName, fromArgs) {
  1017. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  1018. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  1019. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  1020. if (isPlainObject(fromArgs)) { // 一般 api 的参数解析
  1021. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  1022. if (isFn(argsOption)) {
  1023. argsOption = argsOption(fromArgs, toArgs) || {};
  1024. }
  1025. for (var key in fromArgs) {
  1026. if (hasOwn(argsOption, key)) {
  1027. var keyOption = argsOption[key];
  1028. if (isFn(keyOption)) {
  1029. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  1030. }
  1031. if (!keyOption) { // 不支持的参数
  1032. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  1033. } else if (isStr(keyOption)) { // 重写参数 key
  1034. toArgs[keyOption] = fromArgs[key];
  1035. } else if (isPlainObject(keyOption)) { // {name:newName,value:value}可重新指定参数 key:value
  1036. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  1037. }
  1038. } else if (CALLBACKS.indexOf(key) !== -1) {
  1039. if (isFn(fromArgs[key])) {
  1040. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  1041. }
  1042. } else {
  1043. if (!keepFromArgs) {
  1044. toArgs[key] = fromArgs[key];
  1045. }
  1046. }
  1047. }
  1048. return toArgs;
  1049. } else if (isFn(fromArgs)) {
  1050. fromArgs = processCallback(methodName, fromArgs, returnValue);
  1051. }
  1052. return fromArgs;
  1053. }
  1054. function processReturnValue(methodName, res, returnValue) {
  1055. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  1056. if (isFn(protocols.returnValue)) { // 处理通用 returnValue
  1057. res = protocols.returnValue(methodName, res);
  1058. }
  1059. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  1060. }
  1061. function wrapper(methodName, method) {
  1062. if (hasOwn(protocols, methodName)) {
  1063. var protocol = protocols[methodName];
  1064. if (!protocol) { // 暂不支持的 api
  1065. return function () {
  1066. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  1067. };
  1068. }
  1069. return function (arg1, arg2) { // 目前 api 最多两个参数
  1070. var options = protocol;
  1071. if (isFn(protocol)) {
  1072. options = protocol(arg1);
  1073. }
  1074. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  1075. var args = [arg1];
  1076. if (typeof arg2 !== 'undefined') {
  1077. args.push(arg2);
  1078. }
  1079. if (isFn(options.name)) {
  1080. methodName = options.name(arg1);
  1081. } else if (isStr(options.name)) {
  1082. methodName = options.name;
  1083. }
  1084. var returnValue = wx[methodName].apply(wx, args);
  1085. if (isSyncApi(methodName)) { // 同步 api
  1086. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1087. }
  1088. return returnValue;
  1089. };
  1090. }
  1091. return method;
  1092. }
  1093. var todoApis = Object.create(null);
  1094. var TODOS = [
  1095. 'onTabBarMidButtonTap',
  1096. 'subscribePush',
  1097. 'unsubscribePush',
  1098. 'onPush',
  1099. 'offPush',
  1100. 'share'
  1101. ];
  1102. function createTodoApi(name) {
  1103. return function todoApi(_ref)
  1104. {
  1105. var fail = _ref.fail,
  1106. complete = _ref.complete;
  1107. var res = {
  1108. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  1109. };
  1110. isFn(fail) && fail(res);
  1111. isFn(complete) && complete(res);
  1112. };
  1113. }
  1114. TODOS.forEach(function (name) {
  1115. todoApis[name] = createTodoApi(name);
  1116. });
  1117. var providers = {
  1118. oauth: ['weixin'],
  1119. share: ['weixin'],
  1120. payment: ['wxpay'],
  1121. push: ['weixin']
  1122. };
  1123. function getProvider(_ref2)
  1124. {
  1125. var service = _ref2.service,
  1126. success = _ref2.success,
  1127. fail = _ref2.fail,
  1128. complete = _ref2.complete;
  1129. var res = false;
  1130. if (providers[service]) {
  1131. res = {
  1132. errMsg: 'getProvider:ok',
  1133. service: service,
  1134. provider: providers[service]
  1135. };
  1136. isFn(success) && success(res);
  1137. } else {
  1138. res = {
  1139. errMsg: 'getProvider:fail service not found'
  1140. };
  1141. isFn(fail) && fail(res);
  1142. }
  1143. isFn(complete) && complete(res);
  1144. }
  1145. var extraApi = /*#__PURE__*/ Object.freeze({
  1146. __proto__: null,
  1147. getProvider: getProvider
  1148. });
  1149. var getEmitter = function () {
  1150. var Emitter;
  1151. return function getUniEmitter() {
  1152. if (!Emitter) {
  1153. Emitter = new _vue.default();
  1154. }
  1155. return Emitter;
  1156. };
  1157. }();
  1158. function apply(ctx, method, args) {
  1159. return ctx[method].apply(ctx, args);
  1160. }
  1161. function $on() {
  1162. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  1163. }
  1164. function $off() {
  1165. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  1166. }
  1167. function $once() {
  1168. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  1169. }
  1170. function $emit() {
  1171. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  1172. }
  1173. var eventApi = /*#__PURE__*/ Object.freeze({
  1174. __proto__: null,
  1175. $on: $on,
  1176. $off: $off,
  1177. $once: $once,
  1178. $emit: $emit
  1179. });
  1180. /**
  1181. * 框架内 try-catch
  1182. */
  1183. /**
  1184. * 开发者 try-catch
  1185. */
  1186. function tryCatch(fn) {
  1187. return function () {
  1188. try {
  1189. return fn.apply(fn, arguments);
  1190. } catch (e) {
  1191. // TODO
  1192. console.error(e);
  1193. }
  1194. };
  1195. }
  1196. function getApiCallbacks(params) {
  1197. var apiCallbacks = {};
  1198. for (var name in params) {
  1199. var param = params[name];
  1200. if (isFn(param)) {
  1201. apiCallbacks[name] = tryCatch(param);
  1202. delete params[name];
  1203. }
  1204. }
  1205. return apiCallbacks;
  1206. }
  1207. var cid;
  1208. var cidErrMsg;
  1209. var enabled;
  1210. function normalizePushMessage(message) {
  1211. try {
  1212. return JSON.parse(message);
  1213. } catch (e) {}
  1214. return message;
  1215. }
  1216. function invokePushCallback(
  1217. args) {
  1218. if (args.type === 'enabled') {
  1219. enabled = true;
  1220. } else if (args.type === 'clientId') {
  1221. cid = args.cid;
  1222. cidErrMsg = args.errMsg;
  1223. invokeGetPushCidCallbacks(cid, args.errMsg);
  1224. } else if (args.type === 'pushMsg') {
  1225. var message = {
  1226. type: 'receive',
  1227. data: normalizePushMessage(args.message)
  1228. };
  1229. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  1230. var callback = onPushMessageCallbacks[i];
  1231. callback(message);
  1232. // 该消息已被阻止
  1233. if (message.stopped) {
  1234. break;
  1235. }
  1236. }
  1237. } else if (args.type === 'click') {
  1238. onPushMessageCallbacks.forEach(function (callback) {
  1239. callback({
  1240. type: 'click',
  1241. data: normalizePushMessage(args.message)
  1242. });
  1243. });
  1244. }
  1245. }
  1246. var getPushCidCallbacks = [];
  1247. function invokeGetPushCidCallbacks(cid, errMsg) {
  1248. getPushCidCallbacks.forEach(function (callback) {
  1249. callback(cid, errMsg);
  1250. });
  1251. getPushCidCallbacks.length = 0;
  1252. }
  1253. function getPushClientId(args) {
  1254. if (!isPlainObject(args)) {
  1255. args = {};
  1256. }
  1257. var _getApiCallbacks =
  1258. getApiCallbacks(args),
  1259. success = _getApiCallbacks.success,
  1260. fail = _getApiCallbacks.fail,
  1261. complete = _getApiCallbacks.complete;
  1262. var hasSuccess = isFn(success);
  1263. var hasFail = isFn(fail);
  1264. var hasComplete = isFn(complete);
  1265. Promise.resolve().then(function () {
  1266. if (typeof enabled === 'undefined') {
  1267. enabled = false;
  1268. cid = '';
  1269. cidErrMsg = 'uniPush is not enabled';
  1270. }
  1271. getPushCidCallbacks.push(function (cid, errMsg) {
  1272. var res;
  1273. if (cid) {
  1274. res = {
  1275. errMsg: 'getPushClientId:ok',
  1276. cid: cid
  1277. };
  1278. hasSuccess && success(res);
  1279. } else {
  1280. res = {
  1281. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  1282. };
  1283. hasFail && fail(res);
  1284. }
  1285. hasComplete && complete(res);
  1286. });
  1287. if (typeof cid !== 'undefined') {
  1288. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1289. }
  1290. });
  1291. }
  1292. var onPushMessageCallbacks = [];
  1293. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1294. var onPushMessage = function onPushMessage(fn) {
  1295. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1296. onPushMessageCallbacks.push(fn);
  1297. }
  1298. };
  1299. var offPushMessage = function offPushMessage(fn) {
  1300. if (!fn) {
  1301. onPushMessageCallbacks.length = 0;
  1302. } else {
  1303. var index = onPushMessageCallbacks.indexOf(fn);
  1304. if (index > -1) {
  1305. onPushMessageCallbacks.splice(index, 1);
  1306. }
  1307. }
  1308. };
  1309. var api = /*#__PURE__*/ Object.freeze({
  1310. __proto__: null,
  1311. getPushClientId: getPushClientId,
  1312. onPushMessage: onPushMessage,
  1313. offPushMessage: offPushMessage,
  1314. invokePushCallback: invokePushCallback
  1315. });
  1316. var MPPage = Page;
  1317. var MPComponent = Component;
  1318. var customizeRE = /:/g;
  1319. var customize = cached(function (str) {
  1320. return camelize(str.replace(customizeRE, '-'));
  1321. });
  1322. function initTriggerEvent(mpInstance) {
  1323. var oldTriggerEvent = mpInstance.triggerEvent;
  1324. var newTriggerEvent = function newTriggerEvent(event) {
  1325. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  1326. args[_key3 - 1] = arguments[_key3];
  1327. }
  1328. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  1329. if (this.$vm || this.dataset && this.dataset.comType) {
  1330. event = customize(event);
  1331. } else {
  1332. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  1333. var newEvent = customize(event);
  1334. if (newEvent !== event) {
  1335. oldTriggerEvent.apply(this, [newEvent].concat(args));
  1336. }
  1337. }
  1338. return oldTriggerEvent.apply(this, [event].concat(args));
  1339. };
  1340. try {
  1341. // 京东小程序 triggerEvent 为只读
  1342. mpInstance.triggerEvent = newTriggerEvent;
  1343. } catch (error) {
  1344. mpInstance._triggerEvent = newTriggerEvent;
  1345. }
  1346. }
  1347. function initHook(name, options, isComponent) {
  1348. var oldHook = options[name];
  1349. if (!oldHook) {
  1350. options[name] = function () {
  1351. initTriggerEvent(this);
  1352. };
  1353. } else {
  1354. options[name] = function () {
  1355. initTriggerEvent(this);
  1356. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  1357. args[_key4] = arguments[_key4];
  1358. }
  1359. return oldHook.apply(this, args);
  1360. };
  1361. }
  1362. }
  1363. if (!MPPage.__$wrappered) {
  1364. MPPage.__$wrappered = true;
  1365. Page = function Page() {
  1366. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1367. initHook('onLoad', options);
  1368. return MPPage(options);
  1369. };
  1370. Page.after = MPPage.after;
  1371. Component = function Component() {
  1372. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1373. initHook('created', options);
  1374. return MPComponent(options);
  1375. };
  1376. }
  1377. var PAGE_EVENT_HOOKS = [
  1378. 'onPullDownRefresh',
  1379. 'onReachBottom',
  1380. 'onAddToFavorites',
  1381. 'onShareTimeline',
  1382. 'onShareAppMessage',
  1383. 'onPageScroll',
  1384. 'onResize',
  1385. 'onTabItemTap'
  1386. ];
  1387. function initMocks(vm, mocks) {
  1388. var mpInstance = vm.$mp[vm.mpType];
  1389. mocks.forEach(function (mock) {
  1390. if (hasOwn(mpInstance, mock)) {
  1391. vm[mock] = mpInstance[mock];
  1392. }
  1393. });
  1394. }
  1395. function hasHook(hook, vueOptions) {
  1396. if (!vueOptions) {
  1397. return true;
  1398. }
  1399. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1400. return true;
  1401. }
  1402. vueOptions = vueOptions.default || vueOptions;
  1403. if (isFn(vueOptions)) {
  1404. if (isFn(vueOptions.extendOptions[hook])) {
  1405. return true;
  1406. }
  1407. if (vueOptions.super &&
  1408. vueOptions.super.options &&
  1409. Array.isArray(vueOptions.super.options[hook])) {
  1410. return true;
  1411. }
  1412. return false;
  1413. }
  1414. if (isFn(vueOptions[hook])) {
  1415. return true;
  1416. }
  1417. var mixins = vueOptions.mixins;
  1418. if (Array.isArray(mixins)) {
  1419. return !!mixins.find(function (mixin) {
  1420. return hasHook(hook, mixin);
  1421. });
  1422. }
  1423. }
  1424. function initHooks(mpOptions, hooks, vueOptions) {
  1425. hooks.forEach(function (hook) {
  1426. if (hasHook(hook, vueOptions)) {
  1427. mpOptions[hook] = function (args) {
  1428. return this.$vm && this.$vm.__call_hook(hook, args);
  1429. };
  1430. }
  1431. });
  1432. }
  1433. function initUnknownHooks(mpOptions, vueOptions) {
  1434. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1435. findHooks(vueOptions).forEach(function (hook) {
  1436. return initHook$1(mpOptions, hook, excludes);
  1437. });
  1438. }
  1439. function findHooks(vueOptions) {
  1440. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  1441. if (vueOptions) {
  1442. Object.keys(vueOptions).forEach(function (name) {
  1443. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  1444. hooks.push(name);
  1445. }
  1446. });
  1447. }
  1448. return hooks;
  1449. }
  1450. function initHook$1(mpOptions, hook, excludes) {
  1451. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  1452. mpOptions[hook] = function (args) {
  1453. return this.$vm && this.$vm.__call_hook(hook, args);
  1454. };
  1455. }
  1456. }
  1457. function initVueComponent(Vue, vueOptions) {
  1458. vueOptions = vueOptions.default || vueOptions;
  1459. var VueComponent;
  1460. if (isFn(vueOptions)) {
  1461. VueComponent = vueOptions;
  1462. } else {
  1463. VueComponent = Vue.extend(vueOptions);
  1464. }
  1465. vueOptions = VueComponent.options;
  1466. return [VueComponent, vueOptions];
  1467. }
  1468. function initSlots(vm, vueSlots) {
  1469. if (Array.isArray(vueSlots) && vueSlots.length) {
  1470. var $slots = Object.create(null);
  1471. vueSlots.forEach(function (slotName) {
  1472. $slots[slotName] = true;
  1473. });
  1474. vm.$scopedSlots = vm.$slots = $slots;
  1475. }
  1476. }
  1477. function initVueIds(vueIds, mpInstance) {
  1478. vueIds = (vueIds || '').split(',');
  1479. var len = vueIds.length;
  1480. if (len === 1) {
  1481. mpInstance._$vueId = vueIds[0];
  1482. } else if (len === 2) {
  1483. mpInstance._$vueId = vueIds[0];
  1484. mpInstance._$vuePid = vueIds[1];
  1485. }
  1486. }
  1487. function initData(vueOptions, context) {
  1488. var data = vueOptions.data || {};
  1489. var methods = vueOptions.methods || {};
  1490. if (typeof data === 'function') {
  1491. try {
  1492. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1493. } catch (e) {
  1494. if (Object({
  1495. "VUE_APP_NAME": "aaa",
  1496. "VUE_APP_PLATFORM": "mp-weixin",
  1497. "NODE_ENV": "development",
  1498. "BASE_URL": "/"
  1499. }).VUE_APP_DEBUG) {
  1500. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1501. }
  1502. }
  1503. } else {
  1504. try {
  1505. // 对 data 格式化
  1506. data = JSON.parse(JSON.stringify(data));
  1507. } catch (e) {}
  1508. }
  1509. if (!isPlainObject(data)) {
  1510. data = {};
  1511. }
  1512. Object.keys(methods).forEach(function (methodName) {
  1513. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1514. data[methodName] = methods[methodName];
  1515. }
  1516. });
  1517. return data;
  1518. }
  1519. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1520. function createObserver(name) {
  1521. return function observer(newVal, oldVal) {
  1522. if (this.$vm) {
  1523. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1524. }
  1525. };
  1526. }
  1527. function initBehaviors(vueOptions, initBehavior) {
  1528. var vueBehaviors = vueOptions.behaviors;
  1529. var vueExtends = vueOptions.extends;
  1530. var vueMixins = vueOptions.mixins;
  1531. var vueProps = vueOptions.props;
  1532. if (!vueProps) {
  1533. vueOptions.props = vueProps = [];
  1534. }
  1535. var behaviors = [];
  1536. if (Array.isArray(vueBehaviors)) {
  1537. vueBehaviors.forEach(function (behavior) {
  1538. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1539. if (behavior === 'uni://form-field') {
  1540. if (Array.isArray(vueProps)) {
  1541. vueProps.push('name');
  1542. vueProps.push('value');
  1543. } else {
  1544. vueProps.name = {
  1545. type: String,
  1546. default: ''
  1547. };
  1548. vueProps.value = {
  1549. type: [String, Number, Boolean, Array, Object, Date],
  1550. default: ''
  1551. };
  1552. }
  1553. }
  1554. });
  1555. }
  1556. if (isPlainObject(vueExtends) && vueExtends.props) {
  1557. behaviors.push(
  1558. initBehavior({
  1559. properties: initProperties(vueExtends.props, true)
  1560. }));
  1561. }
  1562. if (Array.isArray(vueMixins)) {
  1563. vueMixins.forEach(function (vueMixin) {
  1564. if (isPlainObject(vueMixin) && vueMixin.props) {
  1565. behaviors.push(
  1566. initBehavior({
  1567. properties: initProperties(vueMixin.props, true)
  1568. }));
  1569. }
  1570. });
  1571. }
  1572. return behaviors;
  1573. }
  1574. function parsePropType(key, type, defaultValue, file) {
  1575. // [String]=>String
  1576. if (Array.isArray(type) && type.length === 1) {
  1577. return type[0];
  1578. }
  1579. return type;
  1580. }
  1581. function initProperties(props) {
  1582. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1583. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  1584. var options = arguments.length > 3 ? arguments[3] : undefined;
  1585. var properties = {};
  1586. if (!isBehavior) {
  1587. properties.vueId = {
  1588. type: String,
  1589. value: ''
  1590. };
  1591. {
  1592. if (options.virtualHost) {
  1593. properties.virtualHostStyle = {
  1594. type: null,
  1595. value: ''
  1596. };
  1597. properties.virtualHostClass = {
  1598. type: null,
  1599. value: ''
  1600. };
  1601. }
  1602. }
  1603. // scopedSlotsCompiler auto
  1604. properties.scopedSlotsCompiler = {
  1605. type: String,
  1606. value: ''
  1607. };
  1608. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1609. type: null,
  1610. value: [],
  1611. observer: function observer(newVal, oldVal) {
  1612. var $slots = Object.create(null);
  1613. newVal.forEach(function (slotName) {
  1614. $slots[slotName] = true;
  1615. });
  1616. this.setData({
  1617. $slots: $slots
  1618. });
  1619. }
  1620. };
  1621. }
  1622. if (Array.isArray(props)) { // ['title']
  1623. props.forEach(function (key) {
  1624. properties[key] = {
  1625. type: null,
  1626. observer: createObserver(key)
  1627. };
  1628. });
  1629. } else if (isPlainObject(props)) { // {title:{type:String,default:''},content:String}
  1630. Object.keys(props).forEach(function (key) {
  1631. var opts = props[key];
  1632. if (isPlainObject(opts)) { // title:{type:String,default:''}
  1633. var value = opts.default;
  1634. if (isFn(value)) {
  1635. value = value();
  1636. }
  1637. opts.type = parsePropType(key, opts.type);
  1638. properties[key] = {
  1639. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1640. value: value,
  1641. observer: createObserver(key)
  1642. };
  1643. } else { // content:String
  1644. var type = parsePropType(key, opts);
  1645. properties[key] = {
  1646. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1647. observer: createObserver(key)
  1648. };
  1649. }
  1650. });
  1651. }
  1652. return properties;
  1653. }
  1654. function wrapper$1(event) {
  1655. // TODO 又得兼容 mpvue 的 mp 对象
  1656. try {
  1657. event.mp = JSON.parse(JSON.stringify(event));
  1658. } catch (e) {}
  1659. event.stopPropagation = noop;
  1660. event.preventDefault = noop;
  1661. event.target = event.target || {};
  1662. if (!hasOwn(event, 'detail')) {
  1663. event.detail = {};
  1664. }
  1665. if (hasOwn(event, 'markerId')) {
  1666. event.detail = typeof event.detail === 'object' ? event.detail : {};
  1667. event.detail.markerId = event.markerId;
  1668. }
  1669. if (isPlainObject(event.detail)) {
  1670. event.target = Object.assign({}, event.target, event.detail);
  1671. }
  1672. return event;
  1673. }
  1674. function getExtraValue(vm, dataPathsArray) {
  1675. var context = vm;
  1676. dataPathsArray.forEach(function (dataPathArray) {
  1677. var dataPath = dataPathArray[0];
  1678. var value = dataPathArray[2];
  1679. if (dataPath || typeof value !== 'undefined') { // ['','',index,'disable']
  1680. var propPath = dataPathArray[1];
  1681. var valuePath = dataPathArray[3];
  1682. var vFor;
  1683. if (Number.isInteger(dataPath)) {
  1684. vFor = dataPath;
  1685. } else if (!dataPath) {
  1686. vFor = context;
  1687. } else if (typeof dataPath === 'string' && dataPath) {
  1688. if (dataPath.indexOf('#s#') === 0) {
  1689. vFor = dataPath.substr(3);
  1690. } else {
  1691. vFor = vm.__get_value(dataPath, context);
  1692. }
  1693. }
  1694. if (Number.isInteger(vFor)) {
  1695. context = value;
  1696. } else if (!propPath) {
  1697. context = vFor[value];
  1698. } else {
  1699. if (Array.isArray(vFor)) {
  1700. context = vFor.find(function (vForItem) {
  1701. return vm.__get_value(propPath, vForItem) === value;
  1702. });
  1703. } else if (isPlainObject(vFor)) {
  1704. context = Object.keys(vFor).find(function (vForKey) {
  1705. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1706. });
  1707. } else {
  1708. console.error('v-for 暂不支持循环数据:', vFor);
  1709. }
  1710. }
  1711. if (valuePath) {
  1712. context = vm.__get_value(valuePath, context);
  1713. }
  1714. }
  1715. });
  1716. return context;
  1717. }
  1718. function processEventExtra(vm, extra, event, __args__) {
  1719. var extraObj = {};
  1720. if (Array.isArray(extra) && extra.length) {
  1721. /**
  1722. *[
  1723. * ['data.items', 'data.id', item.data.id],
  1724. * ['metas', 'id', meta.id]
  1725. *],
  1726. *[
  1727. * ['data.items', 'data.id', item.data.id],
  1728. * ['metas', 'id', meta.id]
  1729. *],
  1730. *'test'
  1731. */
  1732. extra.forEach(function (dataPath, index) {
  1733. if (typeof dataPath === 'string') {
  1734. if (!dataPath) { // model,prop.sync
  1735. extraObj['$' + index] = vm;
  1736. } else {
  1737. if (dataPath === '$event') { // $event
  1738. extraObj['$' + index] = event;
  1739. } else if (dataPath === 'arguments') {
  1740. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  1741. } else if (dataPath.indexOf('$event.') === 0) { // $event.target.value
  1742. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1743. } else {
  1744. extraObj['$' + index] = vm.__get_value(dataPath);
  1745. }
  1746. }
  1747. } else {
  1748. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1749. }
  1750. });
  1751. }
  1752. return extraObj;
  1753. }
  1754. function getObjByArray(arr) {
  1755. var obj = {};
  1756. for (var i = 1; i < arr.length; i++) {
  1757. var element = arr[i];
  1758. obj[element[0]] = element[1];
  1759. }
  1760. return obj;
  1761. }
  1762. function processEventArgs(vm, event) {
  1763. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1764. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  1765. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  1766. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1767. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1768. // fixed 用户直接触发 mpInstance.triggerEvent
  1769. var __args__ = isPlainObject(event.detail) ?
  1770. event.detail.__args__ || [event.detail] : [event.detail];
  1771. if (isCustom) { // 自定义事件
  1772. isCustomMPEvent = event.currentTarget &&
  1773. event.currentTarget.dataset &&
  1774. event.currentTarget.dataset.comType === 'wx';
  1775. if (!args.length) { // 无参数,直接传入 event 或 detail 数组
  1776. if (isCustomMPEvent) {
  1777. return [event];
  1778. }
  1779. return __args__;
  1780. }
  1781. }
  1782. var extraObj = processEventExtra(vm, extra, event, __args__);
  1783. var ret = [];
  1784. args.forEach(function (arg) {
  1785. if (arg === '$event') {
  1786. if (methodName === '__set_model' && !isCustom) { // input v-model value
  1787. ret.push(event.target.value);
  1788. } else {
  1789. if (isCustom && !isCustomMPEvent) {
  1790. ret.push(__args__[0]);
  1791. } else { // wxcomponent 组件或内置组件
  1792. ret.push(event);
  1793. }
  1794. }
  1795. } else {
  1796. if (Array.isArray(arg) && arg[0] === 'o') {
  1797. ret.push(getObjByArray(arg));
  1798. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1799. ret.push(extraObj[arg]);
  1800. } else {
  1801. ret.push(arg);
  1802. }
  1803. }
  1804. });
  1805. return ret;
  1806. }
  1807. var ONCE = '~';
  1808. var CUSTOM = '^';
  1809. function isMatchEventType(eventType, optType) {
  1810. return eventType === optType ||
  1811. optType === 'regionchange' && (
  1812. eventType === 'begin' ||
  1813. eventType === 'end');
  1814. }
  1815. function getContextVm(vm) {
  1816. var $parent = vm.$parent;
  1817. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1818. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1819. $parent = $parent.$parent;
  1820. }
  1821. return $parent && $parent.$parent;
  1822. }
  1823. function handleEvent(event) {
  1824. var _this2 = this;
  1825. event = wrapper$1(event);
  1826. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1827. var dataset = (event.currentTarget || event.target).dataset;
  1828. if (!dataset) {
  1829. return console.warn('事件信息不存在');
  1830. }
  1831. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1832. if (!eventOpts) {
  1833. return console.warn('事件信息不存在');
  1834. }
  1835. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1836. var eventType = event.type;
  1837. var ret = [];
  1838. eventOpts.forEach(function (eventOpt) {
  1839. var type = eventOpt[0];
  1840. var eventsArray = eventOpt[1];
  1841. var isCustom = type.charAt(0) === CUSTOM;
  1842. type = isCustom ? type.slice(1) : type;
  1843. var isOnce = type.charAt(0) === ONCE;
  1844. type = isOnce ? type.slice(1) : type;
  1845. if (eventsArray && isMatchEventType(eventType, type)) {
  1846. eventsArray.forEach(function (eventArray) {
  1847. var methodName = eventArray[0];
  1848. if (methodName) {
  1849. var handlerCtx = _this2.$vm;
  1850. if (handlerCtx.$options.generic) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1851. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1852. }
  1853. if (methodName === '$emit') {
  1854. handlerCtx.$emit.apply(handlerCtx,
  1855. processEventArgs(
  1856. _this2.$vm,
  1857. event,
  1858. eventArray[1],
  1859. eventArray[2],
  1860. isCustom,
  1861. methodName));
  1862. return;
  1863. }
  1864. var handler = handlerCtx[methodName];
  1865. if (!isFn(handler)) {
  1866. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  1867. var path = _this2.route || _this2.is;
  1868. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  1869. }
  1870. if (isOnce) {
  1871. if (handler.once) {
  1872. return;
  1873. }
  1874. handler.once = true;
  1875. }
  1876. var params = processEventArgs(
  1877. _this2.$vm,
  1878. event,
  1879. eventArray[1],
  1880. eventArray[2],
  1881. isCustom,
  1882. methodName);
  1883. params = Array.isArray(params) ? params : [];
  1884. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1885. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1886. // eslint-disable-next-line no-sparse-arrays
  1887. params = params.concat([, , , , , , , , , , event]);
  1888. }
  1889. ret.push(handler.apply(handlerCtx, params));
  1890. }
  1891. });
  1892. }
  1893. });
  1894. if (
  1895. eventType === 'input' &&
  1896. ret.length === 1 &&
  1897. typeof ret[0] !== 'undefined') {
  1898. return ret[0];
  1899. }
  1900. }
  1901. var eventChannels = {};
  1902. var eventChannelStack = [];
  1903. function getEventChannel(id) {
  1904. if (id) {
  1905. var eventChannel = eventChannels[id];
  1906. delete eventChannels[id];
  1907. return eventChannel;
  1908. }
  1909. return eventChannelStack.shift();
  1910. }
  1911. var hooks = [
  1912. 'onShow',
  1913. 'onHide',
  1914. 'onError',
  1915. 'onPageNotFound',
  1916. 'onThemeChange',
  1917. 'onUnhandledRejection'
  1918. ];
  1919. function initEventChannel() {
  1920. _vue.default.prototype.getOpenerEventChannel = function () {
  1921. // 微信小程序使用自身getOpenerEventChannel
  1922. {
  1923. return this.$scope.getOpenerEventChannel();
  1924. }
  1925. };
  1926. var callHook = _vue.default.prototype.__call_hook;
  1927. _vue.default.prototype.__call_hook = function (hook, args) {
  1928. if (hook === 'onLoad' && args && args.__id__) {
  1929. this.__eventChannel__ = getEventChannel(args.__id__);
  1930. delete args.__id__;
  1931. }
  1932. return callHook.call(this, hook, args);
  1933. };
  1934. }
  1935. function initScopedSlotsParams() {
  1936. var center = {};
  1937. var parents = {};
  1938. _vue.default.prototype.$hasScopedSlotsParams = function (vueId) {
  1939. var has = center[vueId];
  1940. if (!has) {
  1941. parents[vueId] = this;
  1942. this.$on('hook:destroyed', function () {
  1943. delete parents[vueId];
  1944. });
  1945. }
  1946. return has;
  1947. };
  1948. _vue.default.prototype.$getScopedSlotsParams = function (vueId, name, key) {
  1949. var data = center[vueId];
  1950. if (data) {
  1951. var object = data[name] || {};
  1952. return key ? object[key] : object;
  1953. } else {
  1954. parents[vueId] = this;
  1955. this.$on('hook:destroyed', function () {
  1956. delete parents[vueId];
  1957. });
  1958. }
  1959. };
  1960. _vue.default.prototype.$setScopedSlotsParams = function (name, value) {
  1961. var vueIds = this.$options.propsData.vueId;
  1962. if (vueIds) {
  1963. var vueId = vueIds.split(',')[0];
  1964. var object = center[vueId] = center[vueId] || {};
  1965. object[name] = value;
  1966. if (parents[vueId]) {
  1967. parents[vueId].$forceUpdate();
  1968. }
  1969. }
  1970. };
  1971. _vue.default.mixin({
  1972. destroyed: function destroyed() {
  1973. var propsData = this.$options.propsData;
  1974. var vueId = propsData && propsData.vueId;
  1975. if (vueId) {
  1976. delete center[vueId];
  1977. delete parents[vueId];
  1978. }
  1979. }
  1980. });
  1981. }
  1982. function parseBaseApp(vm, _ref3)
  1983. {
  1984. var mocks = _ref3.mocks,
  1985. initRefs = _ref3.initRefs;
  1986. initEventChannel(); {
  1987. initScopedSlotsParams();
  1988. }
  1989. if (vm.$options.store) {
  1990. _vue.default.prototype.$store = vm.$options.store;
  1991. }
  1992. uniIdMixin(_vue.default);
  1993. _vue.default.prototype.mpHost = "mp-weixin";
  1994. _vue.default.mixin({
  1995. beforeCreate: function beforeCreate() {
  1996. if (!this.$options.mpType) {
  1997. return;
  1998. }
  1999. this.mpType = this.$options.mpType;
  2000. this.$mp = _defineProperty({
  2001. data: {}
  2002. },
  2003. this.mpType, this.$options.mpInstance);
  2004. this.$scope = this.$options.mpInstance;
  2005. delete this.$options.mpType;
  2006. delete this.$options.mpInstance;
  2007. if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n
  2008. var app = getApp();
  2009. if (app.$vm && app.$vm.$i18n) {
  2010. this._i18n = app.$vm.$i18n;
  2011. }
  2012. }
  2013. if (this.mpType !== 'app') {
  2014. initRefs(this);
  2015. initMocks(this, mocks);
  2016. }
  2017. }
  2018. });
  2019. var appOptions = {
  2020. onLaunch: function onLaunch(args) {
  2021. if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  2022. return;
  2023. } {
  2024. if (wx.canIUse && !wx.canIUse('nextTick')) { // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  2025. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  2026. }
  2027. }
  2028. this.$vm = vm;
  2029. this.$vm.$mp = {
  2030. app: this
  2031. };
  2032. this.$vm.$scope = this;
  2033. // vm 上也挂载 globalData
  2034. this.$vm.globalData = this.globalData;
  2035. this.$vm._isMounted = true;
  2036. this.$vm.__call_hook('mounted', args);
  2037. this.$vm.__call_hook('onLaunch', args);
  2038. }
  2039. };
  2040. // 兼容旧版本 globalData
  2041. appOptions.globalData = vm.$options.globalData || {};
  2042. // 将 methods 中的方法挂在 getApp() 中
  2043. var methods = vm.$options.methods;
  2044. if (methods) {
  2045. Object.keys(methods).forEach(function (name) {
  2046. appOptions[name] = methods[name];
  2047. });
  2048. }
  2049. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  2050. initHooks(appOptions, hooks);
  2051. initUnknownHooks(appOptions, vm.$options);
  2052. return appOptions;
  2053. }
  2054. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  2055. function findVmByVueId(vm, vuePid) {
  2056. var $children = vm.$children;
  2057. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  2058. for (var i = $children.length - 1; i >= 0; i--) {
  2059. var childVm = $children[i];
  2060. if (childVm.$scope._$vueId === vuePid) {
  2061. return childVm;
  2062. }
  2063. }
  2064. // 反向递归查找
  2065. var parentVm;
  2066. for (var _i = $children.length - 1; _i >= 0; _i--) {
  2067. parentVm = findVmByVueId($children[_i], vuePid);
  2068. if (parentVm) {
  2069. return parentVm;
  2070. }
  2071. }
  2072. }
  2073. function initBehavior(options) {
  2074. return Behavior(options);
  2075. }
  2076. function isPage() {
  2077. return !!this.route;
  2078. }
  2079. function initRelation(detail) {
  2080. this.triggerEvent('__l', detail);
  2081. }
  2082. function selectAllComponents(mpInstance, selector, $refs) {
  2083. var components = mpInstance.selectAllComponents(selector);
  2084. components.forEach(function (component) {
  2085. var ref = component.dataset.ref;
  2086. $refs[ref] = component.$vm || component; {
  2087. if (component.dataset.vueGeneric === 'scoped') {
  2088. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  2089. selectAllComponents(scopedComponent, selector, $refs);
  2090. });
  2091. }
  2092. }
  2093. });
  2094. }
  2095. function initRefs(vm) {
  2096. var mpInstance = vm.$scope;
  2097. Object.defineProperty(vm, '$refs', {
  2098. get: function get() {
  2099. var $refs = {};
  2100. selectAllComponents(mpInstance, '.vue-ref', $refs);
  2101. // TODO 暂不考虑 for 中的 scoped
  2102. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  2103. forComponents.forEach(function (component) {
  2104. var ref = component.dataset.ref;
  2105. if (!$refs[ref]) {
  2106. $refs[ref] = [];
  2107. }
  2108. $refs[ref].push(component.$vm || component);
  2109. });
  2110. return $refs;
  2111. }
  2112. });
  2113. }
  2114. function handleLink(event) {
  2115. var _ref4 =
  2116. event.detail || event.value,
  2117. vuePid = _ref4.vuePid,
  2118. vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  2119. var parentVm;
  2120. if (vuePid) {
  2121. parentVm = findVmByVueId(this.$vm, vuePid);
  2122. }
  2123. if (!parentVm) {
  2124. parentVm = this.$vm;
  2125. }
  2126. vueOptions.parent = parentVm;
  2127. }
  2128. function parseApp(vm) {
  2129. return parseBaseApp(vm, {
  2130. mocks: mocks,
  2131. initRefs: initRefs
  2132. });
  2133. }
  2134. function createApp(vm) {
  2135. App(parseApp(vm));
  2136. return vm;
  2137. }
  2138. var encodeReserveRE = /[!'()*]/g;
  2139. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  2140. return '%' + c.charCodeAt(0).toString(16);
  2141. };
  2142. var commaRE = /%2C/g;
  2143. // fixed encodeURIComponent which is more conformant to RFC3986:
  2144. // - escapes [!'()*]
  2145. // - preserve commas
  2146. var encode = function encode(str) {
  2147. return encodeURIComponent(str).
  2148. replace(encodeReserveRE, encodeReserveReplacer).
  2149. replace(commaRE, ',');
  2150. };
  2151. function stringifyQuery(obj) {
  2152. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  2153. var res = obj ? Object.keys(obj).map(function (key) {
  2154. var val = obj[key];
  2155. if (val === undefined) {
  2156. return '';
  2157. }
  2158. if (val === null) {
  2159. return encodeStr(key);
  2160. }
  2161. if (Array.isArray(val)) {
  2162. var result = [];
  2163. val.forEach(function (val2) {
  2164. if (val2 === undefined) {
  2165. return;
  2166. }
  2167. if (val2 === null) {
  2168. result.push(encodeStr(key));
  2169. } else {
  2170. result.push(encodeStr(key) + '=' + encodeStr(val2));
  2171. }
  2172. });
  2173. return result.join('&');
  2174. }
  2175. return encodeStr(key) + '=' + encodeStr(val);
  2176. }).filter(function (x) {
  2177. return x.length > 0;
  2178. }).join('&') : null;
  2179. return res ? "?".concat(res) : '';
  2180. }
  2181. function parseBaseComponent(vueComponentOptions)
  2182. {
  2183. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  2184. isPage = _ref5.isPage,
  2185. initRelation = _ref5.initRelation;
  2186. var _initVueComponent =
  2187. initVueComponent(_vue.default, vueComponentOptions),
  2188. _initVueComponent2 = _slicedToArray(_initVueComponent, 2),
  2189. VueComponent = _initVueComponent2[0],
  2190. vueOptions = _initVueComponent2[1];
  2191. var options = _objectSpread({
  2192. multipleSlots: true,
  2193. addGlobalClass: true
  2194. },
  2195. vueOptions.options || {});
  2196. {
  2197. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  2198. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  2199. Object.assign(options, vueOptions['mp-weixin'].options);
  2200. }
  2201. }
  2202. var componentOptions = {
  2203. options: options,
  2204. data: initData(vueOptions, _vue.default.prototype),
  2205. behaviors: initBehaviors(vueOptions, initBehavior),
  2206. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  2207. lifetimes: {
  2208. attached: function attached() {
  2209. var properties = this.properties;
  2210. var options = {
  2211. mpType: isPage.call(this) ? 'page' : 'component',
  2212. mpInstance: this,
  2213. propsData: properties
  2214. };
  2215. initVueIds(properties.vueId, this);
  2216. // 处理父子关系
  2217. initRelation.call(this, {
  2218. vuePid: this._$vuePid,
  2219. vueOptions: options
  2220. });
  2221. // 初始化 vue 实例
  2222. this.$vm = new VueComponent(options);
  2223. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  2224. initSlots(this.$vm, properties.vueSlots);
  2225. // 触发首次 setData
  2226. this.$vm.$mount();
  2227. },
  2228. ready: function ready() {
  2229. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  2230. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  2231. if (this.$vm) {
  2232. this.$vm._isMounted = true;
  2233. this.$vm.__call_hook('mounted');
  2234. this.$vm.__call_hook('onReady');
  2235. }
  2236. },
  2237. detached: function detached() {
  2238. this.$vm && this.$vm.$destroy();
  2239. }
  2240. },
  2241. pageLifetimes: {
  2242. show: function show(args) {
  2243. this.$vm && this.$vm.__call_hook('onPageShow', args);
  2244. },
  2245. hide: function hide() {
  2246. this.$vm && this.$vm.__call_hook('onPageHide');
  2247. },
  2248. resize: function resize(size) {
  2249. this.$vm && this.$vm.__call_hook('onPageResize', size);
  2250. }
  2251. },
  2252. methods: {
  2253. __l: handleLink,
  2254. __e: handleEvent
  2255. }
  2256. };
  2257. // externalClasses
  2258. if (vueOptions.externalClasses) {
  2259. componentOptions.externalClasses = vueOptions.externalClasses;
  2260. }
  2261. if (Array.isArray(vueOptions.wxsCallMethods)) {
  2262. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  2263. componentOptions.methods[callMethod] = function (args) {
  2264. return this.$vm[callMethod](args);
  2265. };
  2266. });
  2267. }
  2268. if (isPage) {
  2269. return componentOptions;
  2270. }
  2271. return [componentOptions, VueComponent];
  2272. }
  2273. function parseComponent(vueComponentOptions) {
  2274. return parseBaseComponent(vueComponentOptions, {
  2275. isPage: isPage,
  2276. initRelation: initRelation
  2277. });
  2278. }
  2279. var hooks$1 = [
  2280. 'onShow',
  2281. 'onHide',
  2282. 'onUnload'
  2283. ];
  2284. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  2285. function parseBasePage(vuePageOptions, _ref6)
  2286. {
  2287. var isPage = _ref6.isPage,
  2288. initRelation = _ref6.initRelation;
  2289. var pageOptions = parseComponent(vuePageOptions);
  2290. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  2291. pageOptions.methods.onLoad = function (query) {
  2292. this.options = query;
  2293. var copyQuery = Object.assign({}, query);
  2294. delete copyQuery.__id__;
  2295. this.$page = {
  2296. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
  2297. };
  2298. this.$vm.$mp.query = query; // 兼容 mpvue
  2299. this.$vm.__call_hook('onLoad', query);
  2300. };
  2301. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  2302. return pageOptions;
  2303. }
  2304. function parsePage(vuePageOptions) {
  2305. return parseBasePage(vuePageOptions, {
  2306. isPage: isPage,
  2307. initRelation: initRelation
  2308. });
  2309. }
  2310. function createPage(vuePageOptions) {
  2311. {
  2312. return Component(parsePage(vuePageOptions));
  2313. }
  2314. }
  2315. function createComponent(vueOptions) {
  2316. {
  2317. return Component(parseComponent(vueOptions));
  2318. }
  2319. }
  2320. function createSubpackageApp(vm) {
  2321. var appOptions = parseApp(vm);
  2322. var app = getApp({
  2323. allowDefault: true
  2324. });
  2325. vm.$scope = app;
  2326. var globalData = app.globalData;
  2327. if (globalData) {
  2328. Object.keys(appOptions.globalData).forEach(function (name) {
  2329. if (!hasOwn(globalData, name)) {
  2330. globalData[name] = appOptions.globalData[name];
  2331. }
  2332. });
  2333. }
  2334. Object.keys(appOptions).forEach(function (name) {
  2335. if (!hasOwn(app, name)) {
  2336. app[name] = appOptions[name];
  2337. }
  2338. });
  2339. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2340. wx.onAppShow(function () {
  2341. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  2342. args[_key5] = arguments[_key5];
  2343. }
  2344. vm.__call_hook('onShow', args);
  2345. });
  2346. }
  2347. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2348. wx.onAppHide(function () {
  2349. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  2350. args[_key6] = arguments[_key6];
  2351. }
  2352. vm.__call_hook('onHide', args);
  2353. });
  2354. }
  2355. if (isFn(appOptions.onLaunch)) {
  2356. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2357. vm.__call_hook('onLaunch', args);
  2358. }
  2359. return vm;
  2360. }
  2361. function createPlugin(vm) {
  2362. var appOptions = parseApp(vm);
  2363. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2364. wx.onAppShow(function () {
  2365. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  2366. args[_key7] = arguments[_key7];
  2367. }
  2368. vm.__call_hook('onShow', args);
  2369. });
  2370. }
  2371. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2372. wx.onAppHide(function () {
  2373. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  2374. args[_key8] = arguments[_key8];
  2375. }
  2376. vm.__call_hook('onHide', args);
  2377. });
  2378. }
  2379. if (isFn(appOptions.onLaunch)) {
  2380. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2381. vm.__call_hook('onLaunch', args);
  2382. }
  2383. return vm;
  2384. }
  2385. todos.forEach(function (todoApi) {
  2386. protocols[todoApi] = false;
  2387. });
  2388. canIUses.forEach(function (canIUseApi) {
  2389. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  2390. canIUseApi;
  2391. if (!wx.canIUse(apiName)) {
  2392. protocols[canIUseApi] = false;
  2393. }
  2394. });
  2395. var uni = {};
  2396. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2397. uni = new Proxy({}, {
  2398. get: function get(target, name) {
  2399. if (hasOwn(target, name)) {
  2400. return target[name];
  2401. }
  2402. if (baseApi[name]) {
  2403. return baseApi[name];
  2404. }
  2405. if (api[name]) {
  2406. return promisify(name, api[name]);
  2407. } {
  2408. if (extraApi[name]) {
  2409. return promisify(name, extraApi[name]);
  2410. }
  2411. if (todoApis[name]) {
  2412. return promisify(name, todoApis[name]);
  2413. }
  2414. }
  2415. if (eventApi[name]) {
  2416. return eventApi[name];
  2417. }
  2418. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  2419. return;
  2420. }
  2421. return promisify(name, wrapper(name, wx[name]));
  2422. },
  2423. set: function set(target, name, value) {
  2424. target[name] = value;
  2425. return true;
  2426. }
  2427. });
  2428. } else {
  2429. Object.keys(baseApi).forEach(function (name) {
  2430. uni[name] = baseApi[name];
  2431. });
  2432. {
  2433. Object.keys(todoApis).forEach(function (name) {
  2434. uni[name] = promisify(name, todoApis[name]);
  2435. });
  2436. Object.keys(extraApi).forEach(function (name) {
  2437. uni[name] = promisify(name, todoApis[name]);
  2438. });
  2439. }
  2440. Object.keys(eventApi).forEach(function (name) {
  2441. uni[name] = eventApi[name];
  2442. });
  2443. Object.keys(api).forEach(function (name) {
  2444. uni[name] = promisify(name, api[name]);
  2445. });
  2446. Object.keys(wx).forEach(function (name) {
  2447. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2448. uni[name] = promisify(name, wrapper(name, wx[name]));
  2449. }
  2450. });
  2451. }
  2452. wx.createApp = createApp;
  2453. wx.createPage = createPage;
  2454. wx.createComponent = createComponent;
  2455. wx.createSubpackageApp = createSubpackageApp;
  2456. wx.createPlugin = createPlugin;
  2457. var uni$1 = uni;
  2458. var _default =
  2459. uni$1;
  2460. exports.default = _default;
  2461. /* WEBPACK VAR INJECTION */
  2462. }.call(this, __webpack_require__( /*! ./../../../webpack/buildin/global.js */ 2)))
  2463. /***/
  2464. }),
  2465. /* 2 */
  2466. /*!***********************************!*\
  2467. !*** (webpack)/buildin/global.js ***!
  2468. \***********************************/
  2469. /*! no static exports found */
  2470. /***/
  2471. (function (module, exports) {
  2472. var g;
  2473. // This works in non-strict mode
  2474. g = (function () {
  2475. return this;
  2476. })();
  2477. try {
  2478. // This works if eval is allowed (see CSP)
  2479. g = g || new Function("return this")();
  2480. } catch (e) {
  2481. // This works if the window reference is available
  2482. if (typeof window === "object") g = window;
  2483. }
  2484. // g can still be undefined, but nothing to do about it...
  2485. // We return undefined, instead of nothing here, so it's
  2486. // easier to handle this case. if(!global) { ...}
  2487. module.exports = g;
  2488. /***/
  2489. }),
  2490. /* 3 */
  2491. /*!*************************************************************!*\
  2492. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  2493. \*************************************************************/
  2494. /*! no static exports found */
  2495. /***/
  2496. (function (module, exports, __webpack_require__) {
  2497. "use strict";
  2498. /* WEBPACK VAR INJECTION */
  2499. (function (uni, global) {
  2500. Object.defineProperty(exports, "__esModule", {
  2501. value: true
  2502. });
  2503. exports.compileI18nJsonStr = compileI18nJsonStr;
  2504. exports.hasI18nJson = hasI18nJson;
  2505. exports.initVueI18n = initVueI18n;
  2506. exports.isI18nStr = isI18nStr;
  2507. exports.normalizeLocale = normalizeLocale;
  2508. exports.parseI18nJson = parseI18nJson;
  2509. exports.resolveLocale = resolveLocale;
  2510. 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;
  2511. function _slicedToArray(arr, i) {
  2512. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  2513. }
  2514. function _nonIterableRest() {
  2515. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2516. }
  2517. function _unsupportedIterableToArray(o, minLen) {
  2518. if (!o) return;
  2519. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  2520. var n = Object.prototype.toString.call(o).slice(8, -1);
  2521. if (n === "Object" && o.constructor) n = o.constructor.name;
  2522. if (n === "Map" || n === "Set") return Array.from(o);
  2523. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  2524. }
  2525. function _arrayLikeToArray(arr, len) {
  2526. if (len == null || len > arr.length) len = arr.length;
  2527. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  2528. arr2[i] = arr[i];
  2529. }
  2530. return arr2;
  2531. }
  2532. function _iterableToArrayLimit(arr, i) {
  2533. if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  2534. var _arr = [];
  2535. var _n = true;
  2536. var _d = false;
  2537. var _e = undefined;
  2538. try {
  2539. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  2540. _arr.push(_s.value);
  2541. if (i && _arr.length === i) break;
  2542. }
  2543. } catch (err) {
  2544. _d = true;
  2545. _e = err;
  2546. } finally {
  2547. try {
  2548. if (!_n && _i["return"] != null) _i["return"]();
  2549. } finally {
  2550. if (_d) throw _e;
  2551. }
  2552. }
  2553. return _arr;
  2554. }
  2555. function _arrayWithHoles(arr) {
  2556. if (Array.isArray(arr)) return arr;
  2557. }
  2558. function _classCallCheck(instance, Constructor) {
  2559. if (!(instance instanceof Constructor)) {
  2560. throw new TypeError("Cannot call a class as a function");
  2561. }
  2562. }
  2563. function _defineProperties(target, props) {
  2564. for (var i = 0; i < props.length; i++) {
  2565. var descriptor = props[i];
  2566. descriptor.enumerable = descriptor.enumerable || false;
  2567. descriptor.configurable = true;
  2568. if ("value" in descriptor) descriptor.writable = true;
  2569. Object.defineProperty(target, descriptor.key, descriptor);
  2570. }
  2571. }
  2572. function _createClass(Constructor, protoProps, staticProps) {
  2573. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2574. if (staticProps) _defineProperties(Constructor, staticProps);
  2575. return Constructor;
  2576. }
  2577. var isArray = Array.isArray;
  2578. var isObject = function isObject(val) {
  2579. return val !== null && typeof val === 'object';
  2580. };
  2581. var defaultDelimiters = ['{', '}'];
  2582. var
  2583. BaseFormatter = /*#__PURE__*/ function () {
  2584. function BaseFormatter() {
  2585. _classCallCheck(this, BaseFormatter);
  2586. this._caches = Object.create(null);
  2587. }
  2588. _createClass(BaseFormatter, [{
  2589. key: "interpolate",
  2590. value: function interpolate(
  2591. message, values) {
  2592. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  2593. if (!values) {
  2594. return [message];
  2595. }
  2596. var tokens = this._caches[message];
  2597. if (!tokens) {
  2598. tokens = parse(message, delimiters);
  2599. this._caches[message] = tokens;
  2600. }
  2601. return compile(tokens, values);
  2602. }
  2603. }]);
  2604. return BaseFormatter;
  2605. }();
  2606. exports.Formatter = BaseFormatter;
  2607. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  2608. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  2609. function parse(format, _ref) {
  2610. var _ref2 = _slicedToArray(_ref, 2),
  2611. startDelimiter = _ref2[0],
  2612. endDelimiter = _ref2[1];
  2613. var tokens = [];
  2614. var position = 0;
  2615. var text = '';
  2616. while (position < format.length) {
  2617. var char = format[position++];
  2618. if (char === startDelimiter) {
  2619. if (text) {
  2620. tokens.push({
  2621. type: 'text',
  2622. value: text
  2623. });
  2624. }
  2625. text = '';
  2626. var sub = '';
  2627. char = format[position++];
  2628. while (char !== undefined && char !== endDelimiter) {
  2629. sub += char;
  2630. char = format[position++];
  2631. }
  2632. var isClosed = char === endDelimiter;
  2633. var type = RE_TOKEN_LIST_VALUE.test(sub) ?
  2634. 'list' :
  2635. isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ?
  2636. 'named' :
  2637. 'unknown';
  2638. tokens.push({
  2639. value: sub,
  2640. type: type
  2641. });
  2642. }
  2643. // else if (char === '%') {
  2644. // // when found rails i18n syntax, skip text capture
  2645. // if (format[position] !== '{') {
  2646. // text += char
  2647. // }
  2648. // }
  2649. else {
  2650. text += char;
  2651. }
  2652. }
  2653. text && tokens.push({
  2654. type: 'text',
  2655. value: text
  2656. });
  2657. return tokens;
  2658. }
  2659. function compile(tokens, values) {
  2660. var compiled = [];
  2661. var index = 0;
  2662. var mode = isArray(values) ?
  2663. 'list' :
  2664. isObject(values) ?
  2665. 'named' :
  2666. 'unknown';
  2667. if (mode === 'unknown') {
  2668. return compiled;
  2669. }
  2670. while (index < tokens.length) {
  2671. var token = tokens[index];
  2672. switch (token.type) {
  2673. case 'text':
  2674. compiled.push(token.value);
  2675. break;
  2676. case 'list':
  2677. compiled.push(values[parseInt(token.value, 10)]);
  2678. break;
  2679. case 'named':
  2680. if (mode === 'named') {
  2681. compiled.push(values[token.value]);
  2682. } else {
  2683. if (true) {
  2684. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  2685. }
  2686. }
  2687. break;
  2688. case 'unknown':
  2689. if (true) {
  2690. console.warn("Detect 'unknown' type of token!");
  2691. }
  2692. break;
  2693. }
  2694. index++;
  2695. }
  2696. return compiled;
  2697. }
  2698. var LOCALE_ZH_HANS = 'zh-Hans';
  2699. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  2700. var LOCALE_ZH_HANT = 'zh-Hant';
  2701. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  2702. var LOCALE_EN = 'en';
  2703. exports.LOCALE_EN = LOCALE_EN;
  2704. var LOCALE_FR = 'fr';
  2705. exports.LOCALE_FR = LOCALE_FR;
  2706. var LOCALE_ES = 'es';
  2707. exports.LOCALE_ES = LOCALE_ES;
  2708. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2709. var hasOwn = function hasOwn(val, key) {
  2710. return hasOwnProperty.call(val, key);
  2711. };
  2712. var defaultFormatter = new BaseFormatter();
  2713. function include(str, parts) {
  2714. return !!parts.find(function (part) {
  2715. return str.indexOf(part) !== -1;
  2716. });
  2717. }
  2718. function startsWith(str, parts) {
  2719. return parts.find(function (part) {
  2720. return str.indexOf(part) === 0;
  2721. });
  2722. }
  2723. function normalizeLocale(locale, messages) {
  2724. if (!locale) {
  2725. return;
  2726. }
  2727. locale = locale.trim().replace(/_/g, '-');
  2728. if (messages && messages[locale]) {
  2729. return locale;
  2730. }
  2731. locale = locale.toLowerCase();
  2732. if (locale.indexOf('zh') === 0) {
  2733. if (locale.indexOf('-hans') > -1) {
  2734. return LOCALE_ZH_HANS;
  2735. }
  2736. if (locale.indexOf('-hant') > -1) {
  2737. return LOCALE_ZH_HANT;
  2738. }
  2739. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  2740. return LOCALE_ZH_HANT;
  2741. }
  2742. return LOCALE_ZH_HANS;
  2743. }
  2744. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  2745. if (lang) {
  2746. return lang;
  2747. }
  2748. }
  2749. var
  2750. I18n = /*#__PURE__*/ function () {
  2751. function I18n(_ref3) {
  2752. var locale = _ref3.locale,
  2753. fallbackLocale = _ref3.fallbackLocale,
  2754. messages = _ref3.messages,
  2755. watcher = _ref3.watcher,
  2756. formater = _ref3.formater;
  2757. _classCallCheck(this, I18n);
  2758. this.locale = LOCALE_EN;
  2759. this.fallbackLocale = LOCALE_EN;
  2760. this.message = {};
  2761. this.messages = {};
  2762. this.watchers = [];
  2763. if (fallbackLocale) {
  2764. this.fallbackLocale = fallbackLocale;
  2765. }
  2766. this.formater = formater || defaultFormatter;
  2767. this.messages = messages || {};
  2768. this.setLocale(locale || LOCALE_EN);
  2769. if (watcher) {
  2770. this.watchLocale(watcher);
  2771. }
  2772. }
  2773. _createClass(I18n, [{
  2774. key: "setLocale",
  2775. value: function setLocale(
  2776. locale) {
  2777. var _this = this;
  2778. var oldLocale = this.locale;
  2779. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  2780. if (!this.messages[this.locale]) {
  2781. // 可能初始化时不存在
  2782. this.messages[this.locale] = {};
  2783. }
  2784. this.message = this.messages[this.locale];
  2785. // 仅发生变化时,通知
  2786. if (oldLocale !== this.locale) {
  2787. this.watchers.forEach(function (watcher) {
  2788. watcher(_this.locale, oldLocale);
  2789. });
  2790. }
  2791. }
  2792. }, {
  2793. key: "getLocale",
  2794. value: function getLocale() {
  2795. return this.locale;
  2796. }
  2797. }, {
  2798. key: "watchLocale",
  2799. value: function watchLocale(
  2800. fn) {
  2801. var _this2 = this;
  2802. var index = this.watchers.push(fn) - 1;
  2803. return function () {
  2804. _this2.watchers.splice(index, 1);
  2805. };
  2806. }
  2807. }, {
  2808. key: "add",
  2809. value: function add(
  2810. locale, message) {
  2811. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  2812. var curMessages = this.messages[locale];
  2813. if (curMessages) {
  2814. if (override) {
  2815. Object.assign(curMessages, message);
  2816. } else {
  2817. Object.keys(message).forEach(function (key) {
  2818. if (!hasOwn(curMessages, key)) {
  2819. curMessages[key] = message[key];
  2820. }
  2821. });
  2822. }
  2823. } else {
  2824. this.messages[locale] = message;
  2825. }
  2826. }
  2827. }, {
  2828. key: "f",
  2829. value: function f(
  2830. message, values, delimiters) {
  2831. return this.formater.interpolate(message, values, delimiters).join('');
  2832. }
  2833. }, {
  2834. key: "t",
  2835. value: function t(
  2836. key, locale, values) {
  2837. var message = this.message;
  2838. if (typeof locale === 'string') {
  2839. locale = normalizeLocale(locale, this.messages);
  2840. locale && (message = this.messages[locale]);
  2841. } else {
  2842. values = locale;
  2843. }
  2844. if (!hasOwn(message, key)) {
  2845. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  2846. return key;
  2847. }
  2848. return this.formater.interpolate(message[key], values).join('');
  2849. }
  2850. }]);
  2851. return I18n;
  2852. }();
  2853. exports.I18n = I18n;
  2854. function watchAppLocale(appVm, i18n) {
  2855. // 需要保证 watch 的触发在组件渲染之前
  2856. if (appVm.$watchLocale) {
  2857. // vue2
  2858. appVm.$watchLocale(function (newLocale) {
  2859. i18n.setLocale(newLocale);
  2860. });
  2861. } else {
  2862. appVm.$watch(function () {
  2863. return appVm.$locale;
  2864. }, function (newLocale) {
  2865. i18n.setLocale(newLocale);
  2866. });
  2867. }
  2868. }
  2869. function getDefaultLocale() {
  2870. if (typeof uni !== 'undefined' && uni.getLocale) {
  2871. return uni.getLocale();
  2872. }
  2873. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  2874. if (typeof global !== 'undefined' && global.getLocale) {
  2875. return global.getLocale();
  2876. }
  2877. return LOCALE_EN;
  2878. }
  2879. function initVueI18n(locale) {
  2880. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2881. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  2882. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  2883. // 兼容旧版本入参
  2884. if (typeof locale !== 'string') {
  2885. var _ref4 = [
  2886. messages,
  2887. locale
  2888. ];
  2889. locale = _ref4[0];
  2890. messages = _ref4[1];
  2891. }
  2892. if (typeof locale !== 'string') {
  2893. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  2894. locale = getDefaultLocale();
  2895. }
  2896. if (typeof fallbackLocale !== 'string') {
  2897. fallbackLocale =
  2898. typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale ||
  2899. LOCALE_EN;
  2900. }
  2901. var i18n = new I18n({
  2902. locale: locale,
  2903. fallbackLocale: fallbackLocale,
  2904. messages: messages,
  2905. watcher: watcher
  2906. });
  2907. var _t = function t(key, values) {
  2908. if (typeof getApp !== 'function') {
  2909. // app view
  2910. /* eslint-disable no-func-assign */
  2911. _t = function t(key, values) {
  2912. return i18n.t(key, values);
  2913. };
  2914. } else {
  2915. var isWatchedAppLocale = false;
  2916. _t = function t(key, values) {
  2917. var appVm = getApp().$vm;
  2918. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  2919. // options: {
  2920. // type: Array,
  2921. // default () {
  2922. // return [{
  2923. // icon: 'shop',
  2924. // text: t("uni-goods-nav.options.shop"),
  2925. // }, {
  2926. // icon: 'cart',
  2927. // text: t("uni-goods-nav.options.cart")
  2928. // }]
  2929. // }
  2930. // },
  2931. if (appVm) {
  2932. // 触发响应式
  2933. appVm.$locale;
  2934. if (!isWatchedAppLocale) {
  2935. isWatchedAppLocale = true;
  2936. watchAppLocale(appVm, i18n);
  2937. }
  2938. }
  2939. return i18n.t(key, values);
  2940. };
  2941. }
  2942. return _t(key, values);
  2943. };
  2944. return {
  2945. i18n: i18n,
  2946. f: function f(message, values, delimiters) {
  2947. return i18n.f(message, values, delimiters);
  2948. },
  2949. t: function t(key, values) {
  2950. return _t(key, values);
  2951. },
  2952. add: function add(locale, message) {
  2953. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  2954. return i18n.add(locale, message, override);
  2955. },
  2956. watch: function watch(fn) {
  2957. return i18n.watchLocale(fn);
  2958. },
  2959. getLocale: function getLocale() {
  2960. return i18n.getLocale();
  2961. },
  2962. setLocale: function setLocale(newLocale) {
  2963. return i18n.setLocale(newLocale);
  2964. }
  2965. };
  2966. }
  2967. var isString = function isString(val) {
  2968. return typeof val === 'string';
  2969. };
  2970. exports.isString = isString;
  2971. var formater;
  2972. function hasI18nJson(jsonObj, delimiters) {
  2973. if (!formater) {
  2974. formater = new BaseFormatter();
  2975. }
  2976. return walkJsonObj(jsonObj, function (jsonObj, key) {
  2977. var value = jsonObj[key];
  2978. if (isString(value)) {
  2979. if (isI18nStr(value, delimiters)) {
  2980. return true;
  2981. }
  2982. } else {
  2983. return hasI18nJson(value, delimiters);
  2984. }
  2985. });
  2986. }
  2987. function parseI18nJson(jsonObj, values, delimiters) {
  2988. if (!formater) {
  2989. formater = new BaseFormatter();
  2990. }
  2991. walkJsonObj(jsonObj, function (jsonObj, key) {
  2992. var value = jsonObj[key];
  2993. if (isString(value)) {
  2994. if (isI18nStr(value, delimiters)) {
  2995. jsonObj[key] = compileStr(value, values, delimiters);
  2996. }
  2997. } else {
  2998. parseI18nJson(value, values, delimiters);
  2999. }
  3000. });
  3001. return jsonObj;
  3002. }
  3003. function compileI18nJsonStr(jsonStr, _ref5) {
  3004. var locale = _ref5.locale,
  3005. locales = _ref5.locales,
  3006. delimiters = _ref5.delimiters;
  3007. if (!isI18nStr(jsonStr, delimiters)) {
  3008. return jsonStr;
  3009. }
  3010. if (!formater) {
  3011. formater = new BaseFormatter();
  3012. }
  3013. var localeValues = [];
  3014. Object.keys(locales).forEach(function (name) {
  3015. if (name !== locale) {
  3016. localeValues.push({
  3017. locale: name,
  3018. values: locales[name]
  3019. });
  3020. }
  3021. });
  3022. localeValues.unshift({
  3023. locale: locale,
  3024. values: locales[locale]
  3025. });
  3026. try {
  3027. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  3028. } catch (e) {}
  3029. return jsonStr;
  3030. }
  3031. function isI18nStr(value, delimiters) {
  3032. return value.indexOf(delimiters[0]) > -1;
  3033. }
  3034. function compileStr(value, values, delimiters) {
  3035. return formater.interpolate(value, values, delimiters).join('');
  3036. }
  3037. function compileValue(jsonObj, key, localeValues, delimiters) {
  3038. var value = jsonObj[key];
  3039. if (isString(value)) {
  3040. // 存在国际化
  3041. if (isI18nStr(value, delimiters)) {
  3042. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  3043. if (localeValues.length > 1) {
  3044. // 格式化国际化语言
  3045. var valueLocales = jsonObj[key + 'Locales'] = {};
  3046. localeValues.forEach(function (localValue) {
  3047. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  3048. });
  3049. }
  3050. }
  3051. } else {
  3052. compileJsonObj(value, localeValues, delimiters);
  3053. }
  3054. }
  3055. function compileJsonObj(jsonObj, localeValues, delimiters) {
  3056. walkJsonObj(jsonObj, function (jsonObj, key) {
  3057. compileValue(jsonObj, key, localeValues, delimiters);
  3058. });
  3059. return jsonObj;
  3060. }
  3061. function walkJsonObj(jsonObj, walk) {
  3062. if (isArray(jsonObj)) {
  3063. for (var i = 0; i < jsonObj.length; i++) {
  3064. if (walk(jsonObj, i)) {
  3065. return true;
  3066. }
  3067. }
  3068. } else
  3069. if (isObject(jsonObj)) {
  3070. for (var key in jsonObj) {
  3071. if (walk(jsonObj, key)) {
  3072. return true;
  3073. }
  3074. }
  3075. }
  3076. return false;
  3077. }
  3078. function resolveLocale(locales) {
  3079. return function (locale) {
  3080. if (!locale) {
  3081. return locale;
  3082. }
  3083. locale = normalizeLocale(locale) || locale;
  3084. return resolveLocaleChain(locale).find(function (locale) {
  3085. return locales.indexOf(locale) > -1;
  3086. });
  3087. };
  3088. }
  3089. function resolveLocaleChain(locale) {
  3090. var chain = [];
  3091. var tokens = locale.split('-');
  3092. while (tokens.length) {
  3093. chain.push(tokens.join('-'));
  3094. tokens.pop();
  3095. }
  3096. return chain;
  3097. }
  3098. /* WEBPACK VAR INJECTION */
  3099. }.call(this, __webpack_require__( /*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"], __webpack_require__( /*! ./../../../webpack/buildin/global.js */ 2)))
  3100. /***/
  3101. }),
  3102. /* 4 */
  3103. /*!******************************************************************************************!*\
  3104. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  3105. \******************************************************************************************/
  3106. /*! exports provided: default */
  3107. /***/
  3108. (function (module, __webpack_exports__, __webpack_require__) {
  3109. "use strict";
  3110. __webpack_require__.r(__webpack_exports__);
  3111. /* WEBPACK VAR INJECTION */
  3112. (function (global) {
  3113. /*!
  3114. * Vue.js v2.6.11
  3115. * (c) 2014-2022 Evan You
  3116. * Released under the MIT License.
  3117. */
  3118. /* */
  3119. var emptyObject = Object.freeze({});
  3120. // These helpers produce better VM code in JS engines due to their
  3121. // explicitness and function inlining.
  3122. function isUndef(v) {
  3123. return v === undefined || v === null
  3124. }
  3125. function isDef(v) {
  3126. return v !== undefined && v !== null
  3127. }
  3128. function isTrue(v) {
  3129. return v === true
  3130. }
  3131. function isFalse(v) {
  3132. return v === false
  3133. }
  3134. /**
  3135. * Check if value is primitive.
  3136. */
  3137. function isPrimitive(value) {
  3138. return (
  3139. typeof value === 'string' ||
  3140. typeof value === 'number' ||
  3141. // $flow-disable-line
  3142. typeof value === 'symbol' ||
  3143. typeof value === 'boolean'
  3144. )
  3145. }
  3146. /**
  3147. * Quick object check - this is primarily used to tell
  3148. * Objects from primitive values when we know the value
  3149. * is a JSON-compliant type.
  3150. */
  3151. function isObject(obj) {
  3152. return obj !== null && typeof obj === 'object'
  3153. }
  3154. /**
  3155. * Get the raw type string of a value, e.g., [object Object].
  3156. */
  3157. var _toString = Object.prototype.toString;
  3158. function toRawType(value) {
  3159. return _toString.call(value).slice(8, -1)
  3160. }
  3161. /**
  3162. * Strict object type check. Only returns true
  3163. * for plain JavaScript objects.
  3164. */
  3165. function isPlainObject(obj) {
  3166. return _toString.call(obj) === '[object Object]'
  3167. }
  3168. function isRegExp(v) {
  3169. return _toString.call(v) === '[object RegExp]'
  3170. }
  3171. /**
  3172. * Check if val is a valid array index.
  3173. */
  3174. function isValidArrayIndex(val) {
  3175. var n = parseFloat(String(val));
  3176. return n >= 0 && Math.floor(n) === n && isFinite(val)
  3177. }
  3178. function isPromise(val) {
  3179. return (
  3180. isDef(val) &&
  3181. typeof val.then === 'function' &&
  3182. typeof val.catch === 'function'
  3183. )
  3184. }
  3185. /**
  3186. * Convert a value to a string that is actually rendered.
  3187. */
  3188. function toString(val) {
  3189. return val == null ?
  3190. '' :
  3191. Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) ?
  3192. JSON.stringify(val, null, 2) :
  3193. String(val)
  3194. }
  3195. /**
  3196. * Convert an input value to a number for persistence.
  3197. * If the conversion fails, return original string.
  3198. */
  3199. function toNumber(val) {
  3200. var n = parseFloat(val);
  3201. return isNaN(n) ? val : n
  3202. }
  3203. /**
  3204. * Make a map and return a function for checking if a key
  3205. * is in that map.
  3206. */
  3207. function makeMap(
  3208. str,
  3209. expectsLowerCase
  3210. ) {
  3211. var map = Object.create(null);
  3212. var list = str.split(',');
  3213. for (var i = 0; i < list.length; i++) {
  3214. map[list[i]] = true;
  3215. }
  3216. return expectsLowerCase ?
  3217. function (val) {
  3218. return map[val.toLowerCase()];
  3219. } :
  3220. function (val) {
  3221. return map[val];
  3222. }
  3223. }
  3224. /**
  3225. * Check if a tag is a built-in tag.
  3226. */
  3227. var isBuiltInTag = makeMap('slot,component', true);
  3228. /**
  3229. * Check if an attribute is a reserved attribute.
  3230. */
  3231. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  3232. /**
  3233. * Remove an item from an array.
  3234. */
  3235. function remove(arr, item) {
  3236. if (arr.length) {
  3237. var index = arr.indexOf(item);
  3238. if (index > -1) {
  3239. return arr.splice(index, 1)
  3240. }
  3241. }
  3242. }
  3243. /**
  3244. * Check whether an object has the property.
  3245. */
  3246. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3247. function hasOwn(obj, key) {
  3248. return hasOwnProperty.call(obj, key)
  3249. }
  3250. /**
  3251. * Create a cached version of a pure function.
  3252. */
  3253. function cached(fn) {
  3254. var cache = Object.create(null);
  3255. return (function cachedFn(str) {
  3256. var hit = cache[str];
  3257. return hit || (cache[str] = fn(str))
  3258. })
  3259. }
  3260. /**
  3261. * Camelize a hyphen-delimited string.
  3262. */
  3263. var camelizeRE = /-(\w)/g;
  3264. var camelize = cached(function (str) {
  3265. return str.replace(camelizeRE, function (_, c) {
  3266. return c ? c.toUpperCase() : '';
  3267. })
  3268. });
  3269. /**
  3270. * Capitalize a string.
  3271. */
  3272. var capitalize = cached(function (str) {
  3273. return str.charAt(0).toUpperCase() + str.slice(1)
  3274. });
  3275. /**
  3276. * Hyphenate a camelCase string.
  3277. */
  3278. var hyphenateRE = /\B([A-Z])/g;
  3279. var hyphenate = cached(function (str) {
  3280. return str.replace(hyphenateRE, '-$1').toLowerCase()
  3281. });
  3282. /**
  3283. * Simple bind polyfill for environments that do not support it,
  3284. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  3285. * since native bind is now performant enough in most browsers.
  3286. * But removing it would mean breaking code that was able to run in
  3287. * PhantomJS 1.x, so this must be kept for backward compatibility.
  3288. */
  3289. /* istanbul ignore next */
  3290. function polyfillBind(fn, ctx) {
  3291. function boundFn(a) {
  3292. var l = arguments.length;
  3293. return l ?
  3294. l > 1 ?
  3295. fn.apply(ctx, arguments) :
  3296. fn.call(ctx, a) :
  3297. fn.call(ctx)
  3298. }
  3299. boundFn._length = fn.length;
  3300. return boundFn
  3301. }
  3302. function nativeBind(fn, ctx) {
  3303. return fn.bind(ctx)
  3304. }
  3305. var bind = Function.prototype.bind ?
  3306. nativeBind :
  3307. polyfillBind;
  3308. /**
  3309. * Convert an Array-like object to a real Array.
  3310. */
  3311. function toArray(list, start) {
  3312. start = start || 0;
  3313. var i = list.length - start;
  3314. var ret = new Array(i);
  3315. while (i--) {
  3316. ret[i] = list[i + start];
  3317. }
  3318. return ret
  3319. }
  3320. /**
  3321. * Mix properties into target object.
  3322. */
  3323. function extend(to, _from) {
  3324. for (var key in _from) {
  3325. to[key] = _from[key];
  3326. }
  3327. return to
  3328. }
  3329. /**
  3330. * Merge an Array of Objects into a single Object.
  3331. */
  3332. function toObject(arr) {
  3333. var res = {};
  3334. for (var i = 0; i < arr.length; i++) {
  3335. if (arr[i]) {
  3336. extend(res, arr[i]);
  3337. }
  3338. }
  3339. return res
  3340. }
  3341. /* eslint-disable no-unused-vars */
  3342. /**
  3343. * Perform no operation.
  3344. * Stubbing args to make Flow happy without leaving useless transpiled code
  3345. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  3346. */
  3347. function noop(a, b, c) {}
  3348. /**
  3349. * Always return false.
  3350. */
  3351. var no = function (a, b, c) {
  3352. return false;
  3353. };
  3354. /* eslint-enable no-unused-vars */
  3355. /**
  3356. * Return the same value.
  3357. */
  3358. var identity = function (_) {
  3359. return _;
  3360. };
  3361. /**
  3362. * Check if two values are loosely equal - that is,
  3363. * if they are plain objects, do they have the same shape?
  3364. */
  3365. function looseEqual(a, b) {
  3366. if (a === b) {
  3367. return true
  3368. }
  3369. var isObjectA = isObject(a);
  3370. var isObjectB = isObject(b);
  3371. if (isObjectA && isObjectB) {
  3372. try {
  3373. var isArrayA = Array.isArray(a);
  3374. var isArrayB = Array.isArray(b);
  3375. if (isArrayA && isArrayB) {
  3376. return a.length === b.length && a.every(function (e, i) {
  3377. return looseEqual(e, b[i])
  3378. })
  3379. } else if (a instanceof Date && b instanceof Date) {
  3380. return a.getTime() === b.getTime()
  3381. } else if (!isArrayA && !isArrayB) {
  3382. var keysA = Object.keys(a);
  3383. var keysB = Object.keys(b);
  3384. return keysA.length === keysB.length && keysA.every(function (key) {
  3385. return looseEqual(a[key], b[key])
  3386. })
  3387. } else {
  3388. /* istanbul ignore next */
  3389. return false
  3390. }
  3391. } catch (e) {
  3392. /* istanbul ignore next */
  3393. return false
  3394. }
  3395. } else if (!isObjectA && !isObjectB) {
  3396. return String(a) === String(b)
  3397. } else {
  3398. return false
  3399. }
  3400. }
  3401. /**
  3402. * Return the first index at which a loosely equal value can be
  3403. * found in the array (if value is a plain object, the array must
  3404. * contain an object of the same shape), or -1 if it is not present.
  3405. */
  3406. function looseIndexOf(arr, val) {
  3407. for (var i = 0; i < arr.length; i++) {
  3408. if (looseEqual(arr[i], val)) {
  3409. return i
  3410. }
  3411. }
  3412. return -1
  3413. }
  3414. /**
  3415. * Ensure a function is called only once.
  3416. */
  3417. function once(fn) {
  3418. var called = false;
  3419. return function () {
  3420. if (!called) {
  3421. called = true;
  3422. fn.apply(this, arguments);
  3423. }
  3424. }
  3425. }
  3426. var ASSET_TYPES = [
  3427. 'component',
  3428. 'directive',
  3429. 'filter'
  3430. ];
  3431. var LIFECYCLE_HOOKS = [
  3432. 'beforeCreate',
  3433. 'created',
  3434. 'beforeMount',
  3435. 'mounted',
  3436. 'beforeUpdate',
  3437. 'updated',
  3438. 'beforeDestroy',
  3439. 'destroyed',
  3440. 'activated',
  3441. 'deactivated',
  3442. 'errorCaptured',
  3443. 'serverPrefetch'
  3444. ];
  3445. /* */
  3446. var config = ({
  3447. /**
  3448. * Option merge strategies (used in core/util/options)
  3449. */
  3450. // $flow-disable-line
  3451. optionMergeStrategies: Object.create(null),
  3452. /**
  3453. * Whether to suppress warnings.
  3454. */
  3455. silent: false,
  3456. /**
  3457. * Show production mode tip message on boot?
  3458. */
  3459. productionTip: "development" !== 'production',
  3460. /**
  3461. * Whether to enable devtools
  3462. */
  3463. devtools: "development" !== 'production',
  3464. /**
  3465. * Whether to record perf
  3466. */
  3467. performance: false,
  3468. /**
  3469. * Error handler for watcher errors
  3470. */
  3471. errorHandler: null,
  3472. /**
  3473. * Warn handler for watcher warns
  3474. */
  3475. warnHandler: null,
  3476. /**
  3477. * Ignore certain custom elements
  3478. */
  3479. ignoredElements: [],
  3480. /**
  3481. * Custom user key aliases for v-on
  3482. */
  3483. // $flow-disable-line
  3484. keyCodes: Object.create(null),
  3485. /**
  3486. * Check if a tag is reserved so that it cannot be registered as a
  3487. * component. This is platform-dependent and may be overwritten.
  3488. */
  3489. isReservedTag: no,
  3490. /**
  3491. * Check if an attribute is reserved so that it cannot be used as a component
  3492. * prop. This is platform-dependent and may be overwritten.
  3493. */
  3494. isReservedAttr: no,
  3495. /**
  3496. * Check if a tag is an unknown element.
  3497. * Platform-dependent.
  3498. */
  3499. isUnknownElement: no,
  3500. /**
  3501. * Get the namespace of an element
  3502. */
  3503. getTagNamespace: noop,
  3504. /**
  3505. * Parse the real tag name for the specific platform.
  3506. */
  3507. parsePlatformTagName: identity,
  3508. /**
  3509. * Check if an attribute must be bound using property, e.g. value
  3510. * Platform-dependent.
  3511. */
  3512. mustUseProp: no,
  3513. /**
  3514. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  3515. * This will significantly reduce performance if set to false.
  3516. */
  3517. async: true,
  3518. /**
  3519. * Exposed for legacy reasons
  3520. */
  3521. _lifecycleHooks: LIFECYCLE_HOOKS
  3522. });
  3523. /* */
  3524. /**
  3525. * unicode letters used for parsing html tags, component names and property paths.
  3526. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  3527. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  3528. */
  3529. 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/;
  3530. /**
  3531. * Check if a string starts with $ or _
  3532. */
  3533. function isReserved(str) {
  3534. var c = (str + '').charCodeAt(0);
  3535. return c === 0x24 || c === 0x5F
  3536. }
  3537. /**
  3538. * Define a property.
  3539. */
  3540. function def(obj, key, val, enumerable) {
  3541. Object.defineProperty(obj, key, {
  3542. value: val,
  3543. enumerable: !!enumerable,
  3544. writable: true,
  3545. configurable: true
  3546. });
  3547. }
  3548. /**
  3549. * Parse simple path.
  3550. */
  3551. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  3552. function parsePath(path) {
  3553. if (bailRE.test(path)) {
  3554. return
  3555. }
  3556. var segments = path.split('.');
  3557. return function (obj) {
  3558. for (var i = 0; i < segments.length; i++) {
  3559. if (!obj) {
  3560. return
  3561. }
  3562. obj = obj[segments[i]];
  3563. }
  3564. return obj
  3565. }
  3566. }
  3567. /* */
  3568. // can we use __proto__?
  3569. var hasProto = '__proto__' in {};
  3570. // Browser environment sniffing
  3571. var inBrowser = typeof window !== 'undefined';
  3572. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  3573. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  3574. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  3575. var isIE = UA && /msie|trident/.test(UA);
  3576. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  3577. var isEdge = UA && UA.indexOf('edge/') > 0;
  3578. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  3579. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  3580. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  3581. var isPhantomJS = UA && /phantomjs/.test(UA);
  3582. var isFF = UA && UA.match(/firefox\/(\d+)/);
  3583. // Firefox has a "watch" function on Object.prototype...
  3584. var nativeWatch = ({}).watch;
  3585. if (inBrowser) {
  3586. try {
  3587. var opts = {};
  3588. Object.defineProperty(opts, 'passive', ({
  3589. get: function get() {}
  3590. })); // https://github.com/facebook/flow/issues/285
  3591. window.addEventListener('test-passive', null, opts);
  3592. } catch (e) {}
  3593. }
  3594. // this needs to be lazy-evaled because vue may be required before
  3595. // vue-server-renderer can set VUE_ENV
  3596. var _isServer;
  3597. var isServerRendering = function () {
  3598. if (_isServer === undefined) {
  3599. /* istanbul ignore if */
  3600. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  3601. // detect presence of vue-server-renderer and avoid
  3602. // Webpack shimming the process
  3603. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  3604. } else {
  3605. _isServer = false;
  3606. }
  3607. }
  3608. return _isServer
  3609. };
  3610. // detect devtools
  3611. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  3612. /* istanbul ignore next */
  3613. function isNative(Ctor) {
  3614. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  3615. }
  3616. var hasSymbol =
  3617. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  3618. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  3619. var _Set;
  3620. /* istanbul ignore if */ // $flow-disable-line
  3621. if (typeof Set !== 'undefined' && isNative(Set)) {
  3622. // use native Set when available.
  3623. _Set = Set;
  3624. } else {
  3625. // a non-standard Set polyfill that only works with primitive keys.
  3626. _Set = /*@__PURE__*/ (function () {
  3627. function Set() {
  3628. this.set = Object.create(null);
  3629. }
  3630. Set.prototype.has = function has(key) {
  3631. return this.set[key] === true
  3632. };
  3633. Set.prototype.add = function add(key) {
  3634. this.set[key] = true;
  3635. };
  3636. Set.prototype.clear = function clear() {
  3637. this.set = Object.create(null);
  3638. };
  3639. return Set;
  3640. }());
  3641. }
  3642. /* */
  3643. var warn = noop;
  3644. var tip = noop;
  3645. var generateComponentTrace = (noop); // work around flow check
  3646. var formatComponentName = (noop);
  3647. if (true) {
  3648. var hasConsole = typeof console !== 'undefined';
  3649. var classifyRE = /(?:^|[-_])(\w)/g;
  3650. var classify = function (str) {
  3651. return str
  3652. .replace(classifyRE, function (c) {
  3653. return c.toUpperCase();
  3654. })
  3655. .replace(/[-_]/g, '');
  3656. };
  3657. warn = function (msg, vm) {
  3658. var trace = vm ? generateComponentTrace(vm) : '';
  3659. if (config.warnHandler) {
  3660. config.warnHandler.call(null, msg, vm, trace);
  3661. } else if (hasConsole && (!config.silent)) {
  3662. console.error(("[Vue warn]: " + msg + trace));
  3663. }
  3664. };
  3665. tip = function (msg, vm) {
  3666. if (hasConsole && (!config.silent)) {
  3667. console.warn("[Vue tip]: " + msg + (
  3668. vm ? generateComponentTrace(vm) : ''
  3669. ));
  3670. }
  3671. };
  3672. formatComponentName = function (vm, includeFile) {
  3673. if (vm.$root === vm) {
  3674. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  3675. return ('') + vm.$options.__file
  3676. }
  3677. return '<Root>'
  3678. }
  3679. var options = typeof vm === 'function' && vm.cid != null ?
  3680. vm.options :
  3681. vm._isVue ?
  3682. vm.$options || vm.constructor.options :
  3683. vm;
  3684. var name = options.name || options._componentTag;
  3685. var file = options.__file;
  3686. if (!name && file) {
  3687. var match = file.match(/([^/\\]+)\.vue$/);
  3688. name = match && match[1];
  3689. }
  3690. return (
  3691. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  3692. (file && includeFile !== false ? (" at " + file) : '')
  3693. )
  3694. };
  3695. var repeat = function (str, n) {
  3696. var res = '';
  3697. while (n) {
  3698. if (n % 2 === 1) {
  3699. res += str;
  3700. }
  3701. if (n > 1) {
  3702. str += str;
  3703. }
  3704. n >>= 1;
  3705. }
  3706. return res
  3707. };
  3708. generateComponentTrace = function (vm) {
  3709. if (vm._isVue && vm.$parent) {
  3710. var tree = [];
  3711. var currentRecursiveSequence = 0;
  3712. while (vm && vm.$options.name !== 'PageBody') {
  3713. if (tree.length > 0) {
  3714. var last = tree[tree.length - 1];
  3715. if (last.constructor === vm.constructor) {
  3716. currentRecursiveSequence++;
  3717. vm = vm.$parent;
  3718. continue
  3719. } else if (currentRecursiveSequence > 0) {
  3720. tree[tree.length - 1] = [last, currentRecursiveSequence];
  3721. currentRecursiveSequence = 0;
  3722. }
  3723. }!vm.$options.isReserved && tree.push(vm);
  3724. vm = vm.$parent;
  3725. }
  3726. return '\n\nfound in\n\n' + tree
  3727. .map(function (vm, i) {
  3728. return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm) ?
  3729. ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)") :
  3730. formatComponentName(vm)));
  3731. })
  3732. .join('\n')
  3733. } else {
  3734. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  3735. }
  3736. };
  3737. }
  3738. /* */
  3739. var uid = 0;
  3740. /**
  3741. * A dep is an observable that can have multiple
  3742. * directives subscribing to it.
  3743. */
  3744. var Dep = function Dep() {
  3745. this.id = uid++;
  3746. this.subs = [];
  3747. };
  3748. Dep.prototype.addSub = function addSub(sub) {
  3749. this.subs.push(sub);
  3750. };
  3751. Dep.prototype.removeSub = function removeSub(sub) {
  3752. remove(this.subs, sub);
  3753. };
  3754. Dep.prototype.depend = function depend() {
  3755. if (Dep.SharedObject.target) {
  3756. Dep.SharedObject.target.addDep(this);
  3757. }
  3758. };
  3759. Dep.prototype.notify = function notify() {
  3760. // stabilize the subscriber list first
  3761. var subs = this.subs.slice();
  3762. if (true && !config.async) {
  3763. // subs aren't sorted in scheduler if not running async
  3764. // we need to sort them now to make sure they fire in correct
  3765. // order
  3766. subs.sort(function (a, b) {
  3767. return a.id - b.id;
  3768. });
  3769. }
  3770. for (var i = 0, l = subs.length; i < l; i++) {
  3771. subs[i].update();
  3772. }
  3773. };
  3774. // The current target watcher being evaluated.
  3775. // This is globally unique because only one watcher
  3776. // can be evaluated at a time.
  3777. // fixed by xxxxxx (nvue shared vuex)
  3778. /* eslint-disable no-undef */
  3779. Dep.SharedObject = {};
  3780. Dep.SharedObject.target = null;
  3781. Dep.SharedObject.targetStack = [];
  3782. function pushTarget(target) {
  3783. Dep.SharedObject.targetStack.push(target);
  3784. Dep.SharedObject.target = target;
  3785. Dep.target = target;
  3786. }
  3787. function popTarget() {
  3788. Dep.SharedObject.targetStack.pop();
  3789. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  3790. Dep.target = Dep.SharedObject.target;
  3791. }
  3792. /* */
  3793. var VNode = function VNode(
  3794. tag,
  3795. data,
  3796. children,
  3797. text,
  3798. elm,
  3799. context,
  3800. componentOptions,
  3801. asyncFactory
  3802. ) {
  3803. this.tag = tag;
  3804. this.data = data;
  3805. this.children = children;
  3806. this.text = text;
  3807. this.elm = elm;
  3808. this.ns = undefined;
  3809. this.context = context;
  3810. this.fnContext = undefined;
  3811. this.fnOptions = undefined;
  3812. this.fnScopeId = undefined;
  3813. this.key = data && data.key;
  3814. this.componentOptions = componentOptions;
  3815. this.componentInstance = undefined;
  3816. this.parent = undefined;
  3817. this.raw = false;
  3818. this.isStatic = false;
  3819. this.isRootInsert = true;
  3820. this.isComment = false;
  3821. this.isCloned = false;
  3822. this.isOnce = false;
  3823. this.asyncFactory = asyncFactory;
  3824. this.asyncMeta = undefined;
  3825. this.isAsyncPlaceholder = false;
  3826. };
  3827. var prototypeAccessors = {
  3828. child: {
  3829. configurable: true
  3830. }
  3831. };
  3832. // DEPRECATED: alias for componentInstance for backwards compat.
  3833. /* istanbul ignore next */
  3834. prototypeAccessors.child.get = function () {
  3835. return this.componentInstance
  3836. };
  3837. Object.defineProperties(VNode.prototype, prototypeAccessors);
  3838. var createEmptyVNode = function (text) {
  3839. if (text === void 0) text = '';
  3840. var node = new VNode();
  3841. node.text = text;
  3842. node.isComment = true;
  3843. return node
  3844. };
  3845. function createTextVNode(val) {
  3846. return new VNode(undefined, undefined, undefined, String(val))
  3847. }
  3848. // optimized shallow clone
  3849. // used for static nodes and slot nodes because they may be reused across
  3850. // multiple renders, cloning them avoids errors when DOM manipulations rely
  3851. // on their elm reference.
  3852. function cloneVNode(vnode) {
  3853. var cloned = new VNode(
  3854. vnode.tag,
  3855. vnode.data,
  3856. // #7975
  3857. // clone children array to avoid mutating original in case of cloning
  3858. // a child.
  3859. vnode.children && vnode.children.slice(),
  3860. vnode.text,
  3861. vnode.elm,
  3862. vnode.context,
  3863. vnode.componentOptions,
  3864. vnode.asyncFactory
  3865. );
  3866. cloned.ns = vnode.ns;
  3867. cloned.isStatic = vnode.isStatic;
  3868. cloned.key = vnode.key;
  3869. cloned.isComment = vnode.isComment;
  3870. cloned.fnContext = vnode.fnContext;
  3871. cloned.fnOptions = vnode.fnOptions;
  3872. cloned.fnScopeId = vnode.fnScopeId;
  3873. cloned.asyncMeta = vnode.asyncMeta;
  3874. cloned.isCloned = true;
  3875. return cloned
  3876. }
  3877. /*
  3878. * not type checking this file because flow doesn't play well with
  3879. * dynamically accessing methods on Array prototype
  3880. */
  3881. var arrayProto = Array.prototype;
  3882. var arrayMethods = Object.create(arrayProto);
  3883. var methodsToPatch = [
  3884. 'push',
  3885. 'pop',
  3886. 'shift',
  3887. 'unshift',
  3888. 'splice',
  3889. 'sort',
  3890. 'reverse'
  3891. ];
  3892. /**
  3893. * Intercept mutating methods and emit events
  3894. */
  3895. methodsToPatch.forEach(function (method) {
  3896. // cache original method
  3897. var original = arrayProto[method];
  3898. def(arrayMethods, method, function mutator() {
  3899. var args = [],
  3900. len = arguments.length;
  3901. while (len--) args[len] = arguments[len];
  3902. var result = original.apply(this, args);
  3903. var ob = this.__ob__;
  3904. var inserted;
  3905. switch (method) {
  3906. case 'push':
  3907. case 'unshift':
  3908. inserted = args;
  3909. break
  3910. case 'splice':
  3911. inserted = args.slice(2);
  3912. break
  3913. }
  3914. if (inserted) {
  3915. ob.observeArray(inserted);
  3916. }
  3917. // notify change
  3918. ob.dep.notify();
  3919. return result
  3920. });
  3921. });
  3922. /* */
  3923. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  3924. /**
  3925. * In some cases we may want to disable observation inside a component's
  3926. * update computation.
  3927. */
  3928. var shouldObserve = true;
  3929. function toggleObserving(value) {
  3930. shouldObserve = value;
  3931. }
  3932. /**
  3933. * Observer class that is attached to each observed
  3934. * object. Once attached, the observer converts the target
  3935. * object's property keys into getter/setters that
  3936. * collect dependencies and dispatch updates.
  3937. */
  3938. var Observer = function Observer(value) {
  3939. this.value = value;
  3940. this.dep = new Dep();
  3941. this.vmCount = 0;
  3942. def(value, '__ob__', this);
  3943. if (Array.isArray(value)) {
  3944. if (hasProto) {
  3945. { // fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  3946. if (value.push !== value.__proto__.push) {
  3947. copyAugment(value, arrayMethods, arrayKeys);
  3948. } else {
  3949. protoAugment(value, arrayMethods);
  3950. }
  3951. }
  3952. } else {
  3953. copyAugment(value, arrayMethods, arrayKeys);
  3954. }
  3955. this.observeArray(value);
  3956. } else {
  3957. this.walk(value);
  3958. }
  3959. };
  3960. /**
  3961. * Walk through all properties and convert them into
  3962. * getter/setters. This method should only be called when
  3963. * value type is Object.
  3964. */
  3965. Observer.prototype.walk = function walk(obj) {
  3966. var keys = Object.keys(obj);
  3967. for (var i = 0; i < keys.length; i++) {
  3968. defineReactive$$1(obj, keys[i]);
  3969. }
  3970. };
  3971. /**
  3972. * Observe a list of Array items.
  3973. */
  3974. Observer.prototype.observeArray = function observeArray(items) {
  3975. for (var i = 0, l = items.length; i < l; i++) {
  3976. observe(items[i]);
  3977. }
  3978. };
  3979. // helpers
  3980. /**
  3981. * Augment a target Object or Array by intercepting
  3982. * the prototype chain using __proto__
  3983. */
  3984. function protoAugment(target, src) {
  3985. /* eslint-disable no-proto */
  3986. target.__proto__ = src;
  3987. /* eslint-enable no-proto */
  3988. }
  3989. /**
  3990. * Augment a target Object or Array by defining
  3991. * hidden properties.
  3992. */
  3993. /* istanbul ignore next */
  3994. function copyAugment(target, src, keys) {
  3995. for (var i = 0, l = keys.length; i < l; i++) {
  3996. var key = keys[i];
  3997. def(target, key, src[key]);
  3998. }
  3999. }
  4000. /**
  4001. * Attempt to create an observer instance for a value,
  4002. * returns the new observer if successfully observed,
  4003. * or the existing observer if the value already has one.
  4004. */
  4005. function observe(value, asRootData) {
  4006. if (!isObject(value) || value instanceof VNode) {
  4007. return
  4008. }
  4009. var ob;
  4010. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  4011. ob = value.__ob__;
  4012. } else if (
  4013. shouldObserve &&
  4014. !isServerRendering() &&
  4015. (Array.isArray(value) || isPlainObject(value)) &&
  4016. Object.isExtensible(value) &&
  4017. !value._isVue
  4018. ) {
  4019. ob = new Observer(value);
  4020. }
  4021. if (asRootData && ob) {
  4022. ob.vmCount++;
  4023. }
  4024. return ob
  4025. }
  4026. /**
  4027. * Define a reactive property on an Object.
  4028. */
  4029. function defineReactive$$1(
  4030. obj,
  4031. key,
  4032. val,
  4033. customSetter,
  4034. shallow
  4035. ) {
  4036. var dep = new Dep();
  4037. var property = Object.getOwnPropertyDescriptor(obj, key);
  4038. if (property && property.configurable === false) {
  4039. return
  4040. }
  4041. // cater for pre-defined getter/setters
  4042. var getter = property && property.get;
  4043. var setter = property && property.set;
  4044. if ((!getter || setter) && arguments.length === 2) {
  4045. val = obj[key];
  4046. }
  4047. var childOb = !shallow && observe(val);
  4048. Object.defineProperty(obj, key, {
  4049. enumerable: true,
  4050. configurable: true,
  4051. get: function reactiveGetter() {
  4052. var value = getter ? getter.call(obj) : val;
  4053. if (Dep.SharedObject.target) { // fixed by xxxxxx
  4054. dep.depend();
  4055. if (childOb) {
  4056. childOb.dep.depend();
  4057. if (Array.isArray(value)) {
  4058. dependArray(value);
  4059. }
  4060. }
  4061. }
  4062. return value
  4063. },
  4064. set: function reactiveSetter(newVal) {
  4065. var value = getter ? getter.call(obj) : val;
  4066. /* eslint-disable no-self-compare */
  4067. if (newVal === value || (newVal !== newVal && value !== value)) {
  4068. return
  4069. }
  4070. /* eslint-enable no-self-compare */
  4071. if (true && customSetter) {
  4072. customSetter();
  4073. }
  4074. // #7981: for accessor properties without setter
  4075. if (getter && !setter) {
  4076. return
  4077. }
  4078. if (setter) {
  4079. setter.call(obj, newVal);
  4080. } else {
  4081. val = newVal;
  4082. }
  4083. childOb = !shallow && observe(newVal);
  4084. dep.notify();
  4085. }
  4086. });
  4087. }
  4088. /**
  4089. * Set a property on an object. Adds the new property and
  4090. * triggers change notification if the property doesn't
  4091. * already exist.
  4092. */
  4093. function set(target, key, val) {
  4094. if (true &&
  4095. (isUndef(target) || isPrimitive(target))
  4096. ) {
  4097. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  4098. }
  4099. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4100. target.length = Math.max(target.length, key);
  4101. target.splice(key, 1, val);
  4102. return val
  4103. }
  4104. if (key in target && !(key in Object.prototype)) {
  4105. target[key] = val;
  4106. return val
  4107. }
  4108. var ob = (target).__ob__;
  4109. if (target._isVue || (ob && ob.vmCount)) {
  4110. true && warn(
  4111. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  4112. 'at runtime - declare it upfront in the data option.'
  4113. );
  4114. return val
  4115. }
  4116. if (!ob) {
  4117. target[key] = val;
  4118. return val
  4119. }
  4120. defineReactive$$1(ob.value, key, val);
  4121. ob.dep.notify();
  4122. return val
  4123. }
  4124. /**
  4125. * Delete a property and trigger change if necessary.
  4126. */
  4127. function del(target, key) {
  4128. if (true &&
  4129. (isUndef(target) || isPrimitive(target))
  4130. ) {
  4131. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  4132. }
  4133. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4134. target.splice(key, 1);
  4135. return
  4136. }
  4137. var ob = (target).__ob__;
  4138. if (target._isVue || (ob && ob.vmCount)) {
  4139. true && warn(
  4140. 'Avoid deleting properties on a Vue instance or its root $data ' +
  4141. '- just set it to null.'
  4142. );
  4143. return
  4144. }
  4145. if (!hasOwn(target, key)) {
  4146. return
  4147. }
  4148. delete target[key];
  4149. if (!ob) {
  4150. return
  4151. }
  4152. ob.dep.notify();
  4153. }
  4154. /**
  4155. * Collect dependencies on array elements when the array is touched, since
  4156. * we cannot intercept array element access like property getters.
  4157. */
  4158. function dependArray(value) {
  4159. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  4160. e = value[i];
  4161. e && e.__ob__ && e.__ob__.dep.depend();
  4162. if (Array.isArray(e)) {
  4163. dependArray(e);
  4164. }
  4165. }
  4166. }
  4167. /* */
  4168. /**
  4169. * Option overwriting strategies are functions that handle
  4170. * how to merge a parent option value and a child option
  4171. * value into the final value.
  4172. */
  4173. var strats = config.optionMergeStrategies;
  4174. /**
  4175. * Options with restrictions
  4176. */
  4177. if (true) {
  4178. strats.el = strats.propsData = function (parent, child, vm, key) {
  4179. if (!vm) {
  4180. warn(
  4181. "option \"" + key + "\" can only be used during instance " +
  4182. 'creation with the `new` keyword.'
  4183. );
  4184. }
  4185. return defaultStrat(parent, child)
  4186. };
  4187. }
  4188. /**
  4189. * Helper that recursively merges two data objects together.
  4190. */
  4191. function mergeData(to, from) {
  4192. if (!from) {
  4193. return to
  4194. }
  4195. var key, toVal, fromVal;
  4196. var keys = hasSymbol ?
  4197. Reflect.ownKeys(from) :
  4198. Object.keys(from);
  4199. for (var i = 0; i < keys.length; i++) {
  4200. key = keys[i];
  4201. // in case the object is already observed...
  4202. if (key === '__ob__') {
  4203. continue
  4204. }
  4205. toVal = to[key];
  4206. fromVal = from[key];
  4207. if (!hasOwn(to, key)) {
  4208. set(to, key, fromVal);
  4209. } else if (
  4210. toVal !== fromVal &&
  4211. isPlainObject(toVal) &&
  4212. isPlainObject(fromVal)
  4213. ) {
  4214. mergeData(toVal, fromVal);
  4215. }
  4216. }
  4217. return to
  4218. }
  4219. /**
  4220. * Data
  4221. */
  4222. function mergeDataOrFn(
  4223. parentVal,
  4224. childVal,
  4225. vm
  4226. ) {
  4227. if (!vm) {
  4228. // in a Vue.extend merge, both should be functions
  4229. if (!childVal) {
  4230. return parentVal
  4231. }
  4232. if (!parentVal) {
  4233. return childVal
  4234. }
  4235. // when parentVal & childVal are both present,
  4236. // we need to return a function that returns the
  4237. // merged result of both functions... no need to
  4238. // check if parentVal is a function here because
  4239. // it has to be a function to pass previous merges.
  4240. return function mergedDataFn() {
  4241. return mergeData(
  4242. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  4243. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  4244. )
  4245. }
  4246. } else {
  4247. return function mergedInstanceDataFn() {
  4248. // instance merge
  4249. var instanceData = typeof childVal === 'function' ?
  4250. childVal.call(vm, vm) :
  4251. childVal;
  4252. var defaultData = typeof parentVal === 'function' ?
  4253. parentVal.call(vm, vm) :
  4254. parentVal;
  4255. if (instanceData) {
  4256. return mergeData(instanceData, defaultData)
  4257. } else {
  4258. return defaultData
  4259. }
  4260. }
  4261. }
  4262. }
  4263. strats.data = function (
  4264. parentVal,
  4265. childVal,
  4266. vm
  4267. ) {
  4268. if (!vm) {
  4269. if (childVal && typeof childVal !== 'function') {
  4270. true && warn(
  4271. 'The "data" option should be a function ' +
  4272. 'that returns a per-instance value in component ' +
  4273. 'definitions.',
  4274. vm
  4275. );
  4276. return parentVal
  4277. }
  4278. return mergeDataOrFn(parentVal, childVal)
  4279. }
  4280. return mergeDataOrFn(parentVal, childVal, vm)
  4281. };
  4282. /**
  4283. * Hooks and props are merged as arrays.
  4284. */
  4285. function mergeHook(
  4286. parentVal,
  4287. childVal
  4288. ) {
  4289. var res = childVal ?
  4290. parentVal ?
  4291. parentVal.concat(childVal) :
  4292. Array.isArray(childVal) ?
  4293. childVal :
  4294. [childVal] :
  4295. parentVal;
  4296. return res ?
  4297. dedupeHooks(res) :
  4298. res
  4299. }
  4300. function dedupeHooks(hooks) {
  4301. var res = [];
  4302. for (var i = 0; i < hooks.length; i++) {
  4303. if (res.indexOf(hooks[i]) === -1) {
  4304. res.push(hooks[i]);
  4305. }
  4306. }
  4307. return res
  4308. }
  4309. LIFECYCLE_HOOKS.forEach(function (hook) {
  4310. strats[hook] = mergeHook;
  4311. });
  4312. /**
  4313. * Assets
  4314. *
  4315. * When a vm is present (instance creation), we need to do
  4316. * a three-way merge between constructor options, instance
  4317. * options and parent options.
  4318. */
  4319. function mergeAssets(
  4320. parentVal,
  4321. childVal,
  4322. vm,
  4323. key
  4324. ) {
  4325. var res = Object.create(parentVal || null);
  4326. if (childVal) {
  4327. true && assertObjectType(key, childVal, vm);
  4328. return extend(res, childVal)
  4329. } else {
  4330. return res
  4331. }
  4332. }
  4333. ASSET_TYPES.forEach(function (type) {
  4334. strats[type + 's'] = mergeAssets;
  4335. });
  4336. /**
  4337. * Watchers.
  4338. *
  4339. * Watchers hashes should not overwrite one
  4340. * another, so we merge them as arrays.
  4341. */
  4342. strats.watch = function (
  4343. parentVal,
  4344. childVal,
  4345. vm,
  4346. key
  4347. ) {
  4348. // work around Firefox's Object.prototype.watch...
  4349. if (parentVal === nativeWatch) {
  4350. parentVal = undefined;
  4351. }
  4352. if (childVal === nativeWatch) {
  4353. childVal = undefined;
  4354. }
  4355. /* istanbul ignore if */
  4356. if (!childVal) {
  4357. return Object.create(parentVal || null)
  4358. }
  4359. if (true) {
  4360. assertObjectType(key, childVal, vm);
  4361. }
  4362. if (!parentVal) {
  4363. return childVal
  4364. }
  4365. var ret = {};
  4366. extend(ret, parentVal);
  4367. for (var key$1 in childVal) {
  4368. var parent = ret[key$1];
  4369. var child = childVal[key$1];
  4370. if (parent && !Array.isArray(parent)) {
  4371. parent = [parent];
  4372. }
  4373. ret[key$1] = parent ?
  4374. parent.concat(child) :
  4375. Array.isArray(child) ? child : [child];
  4376. }
  4377. return ret
  4378. };
  4379. /**
  4380. * Other object hashes.
  4381. */
  4382. strats.props =
  4383. strats.methods =
  4384. strats.inject =
  4385. strats.computed = function (
  4386. parentVal,
  4387. childVal,
  4388. vm,
  4389. key
  4390. ) {
  4391. if (childVal && "development" !== 'production') {
  4392. assertObjectType(key, childVal, vm);
  4393. }
  4394. if (!parentVal) {
  4395. return childVal
  4396. }
  4397. var ret = Object.create(null);
  4398. extend(ret, parentVal);
  4399. if (childVal) {
  4400. extend(ret, childVal);
  4401. }
  4402. return ret
  4403. };
  4404. strats.provide = mergeDataOrFn;
  4405. /**
  4406. * Default strategy.
  4407. */
  4408. var defaultStrat = function (parentVal, childVal) {
  4409. return childVal === undefined ?
  4410. parentVal :
  4411. childVal
  4412. };
  4413. /**
  4414. * Validate component names
  4415. */
  4416. function checkComponents(options) {
  4417. for (var key in options.components) {
  4418. validateComponentName(key);
  4419. }
  4420. }
  4421. function validateComponentName(name) {
  4422. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  4423. warn(
  4424. 'Invalid component name: "' + name + '". Component names ' +
  4425. 'should conform to valid custom element name in html5 specification.'
  4426. );
  4427. }
  4428. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  4429. warn(
  4430. 'Do not use built-in or reserved HTML elements as component ' +
  4431. 'id: ' + name
  4432. );
  4433. }
  4434. }
  4435. /**
  4436. * Ensure all props option syntax are normalized into the
  4437. * Object-based format.
  4438. */
  4439. function normalizeProps(options, vm) {
  4440. var props = options.props;
  4441. if (!props) {
  4442. return
  4443. }
  4444. var res = {};
  4445. var i, val, name;
  4446. if (Array.isArray(props)) {
  4447. i = props.length;
  4448. while (i--) {
  4449. val = props[i];
  4450. if (typeof val === 'string') {
  4451. name = camelize(val);
  4452. res[name] = {
  4453. type: null
  4454. };
  4455. } else if (true) {
  4456. warn('props must be strings when using array syntax.');
  4457. }
  4458. }
  4459. } else if (isPlainObject(props)) {
  4460. for (var key in props) {
  4461. val = props[key];
  4462. name = camelize(key);
  4463. res[name] = isPlainObject(val) ?
  4464. val :
  4465. {
  4466. type: val
  4467. };
  4468. }
  4469. } else if (true) {
  4470. warn(
  4471. "Invalid value for option \"props\": expected an Array or an Object, " +
  4472. "but got " + (toRawType(props)) + ".",
  4473. vm
  4474. );
  4475. }
  4476. options.props = res;
  4477. }
  4478. /**
  4479. * Normalize all injections into Object-based format
  4480. */
  4481. function normalizeInject(options, vm) {
  4482. var inject = options.inject;
  4483. if (!inject) {
  4484. return
  4485. }
  4486. var normalized = options.inject = {};
  4487. if (Array.isArray(inject)) {
  4488. for (var i = 0; i < inject.length; i++) {
  4489. normalized[inject[i]] = {
  4490. from: inject[i]
  4491. };
  4492. }
  4493. } else if (isPlainObject(inject)) {
  4494. for (var key in inject) {
  4495. var val = inject[key];
  4496. normalized[key] = isPlainObject(val) ?
  4497. extend({
  4498. from: key
  4499. }, val) :
  4500. {
  4501. from: val
  4502. };
  4503. }
  4504. } else if (true) {
  4505. warn(
  4506. "Invalid value for option \"inject\": expected an Array or an Object, " +
  4507. "but got " + (toRawType(inject)) + ".",
  4508. vm
  4509. );
  4510. }
  4511. }
  4512. /**
  4513. * Normalize raw function directives into object format.
  4514. */
  4515. function normalizeDirectives(options) {
  4516. var dirs = options.directives;
  4517. if (dirs) {
  4518. for (var key in dirs) {
  4519. var def$$1 = dirs[key];
  4520. if (typeof def$$1 === 'function') {
  4521. dirs[key] = {
  4522. bind: def$$1,
  4523. update: def$$1
  4524. };
  4525. }
  4526. }
  4527. }
  4528. }
  4529. function assertObjectType(name, value, vm) {
  4530. if (!isPlainObject(value)) {
  4531. warn(
  4532. "Invalid value for option \"" + name + "\": expected an Object, " +
  4533. "but got " + (toRawType(value)) + ".",
  4534. vm
  4535. );
  4536. }
  4537. }
  4538. /**
  4539. * Merge two option objects into a new one.
  4540. * Core utility used in both instantiation and inheritance.
  4541. */
  4542. function mergeOptions(
  4543. parent,
  4544. child,
  4545. vm
  4546. ) {
  4547. if (true) {
  4548. checkComponents(child);
  4549. }
  4550. if (typeof child === 'function') {
  4551. child = child.options;
  4552. }
  4553. normalizeProps(child, vm);
  4554. normalizeInject(child, vm);
  4555. normalizeDirectives(child);
  4556. // Apply extends and mixins on the child options,
  4557. // but only if it is a raw options object that isn't
  4558. // the result of another mergeOptions call.
  4559. // Only merged options has the _base property.
  4560. if (!child._base) {
  4561. if (child.extends) {
  4562. parent = mergeOptions(parent, child.extends, vm);
  4563. }
  4564. if (child.mixins) {
  4565. for (var i = 0, l = child.mixins.length; i < l; i++) {
  4566. parent = mergeOptions(parent, child.mixins[i], vm);
  4567. }
  4568. }
  4569. }
  4570. var options = {};
  4571. var key;
  4572. for (key in parent) {
  4573. mergeField(key);
  4574. }
  4575. for (key in child) {
  4576. if (!hasOwn(parent, key)) {
  4577. mergeField(key);
  4578. }
  4579. }
  4580. function mergeField(key) {
  4581. var strat = strats[key] || defaultStrat;
  4582. options[key] = strat(parent[key], child[key], vm, key);
  4583. }
  4584. return options
  4585. }
  4586. /**
  4587. * Resolve an asset.
  4588. * This function is used because child instances need access
  4589. * to assets defined in its ancestor chain.
  4590. */
  4591. function resolveAsset(
  4592. options,
  4593. type,
  4594. id,
  4595. warnMissing
  4596. ) {
  4597. /* istanbul ignore if */
  4598. if (typeof id !== 'string') {
  4599. return
  4600. }
  4601. var assets = options[type];
  4602. // check local registration variations first
  4603. if (hasOwn(assets, id)) {
  4604. return assets[id]
  4605. }
  4606. var camelizedId = camelize(id);
  4607. if (hasOwn(assets, camelizedId)) {
  4608. return assets[camelizedId]
  4609. }
  4610. var PascalCaseId = capitalize(camelizedId);
  4611. if (hasOwn(assets, PascalCaseId)) {
  4612. return assets[PascalCaseId]
  4613. }
  4614. // fallback to prototype chain
  4615. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  4616. if (true && warnMissing && !res) {
  4617. warn(
  4618. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  4619. options
  4620. );
  4621. }
  4622. return res
  4623. }
  4624. /* */
  4625. function validateProp(
  4626. key,
  4627. propOptions,
  4628. propsData,
  4629. vm
  4630. ) {
  4631. var prop = propOptions[key];
  4632. var absent = !hasOwn(propsData, key);
  4633. var value = propsData[key];
  4634. // boolean casting
  4635. var booleanIndex = getTypeIndex(Boolean, prop.type);
  4636. if (booleanIndex > -1) {
  4637. if (absent && !hasOwn(prop, 'default')) {
  4638. value = false;
  4639. } else if (value === '' || value === hyphenate(key)) {
  4640. // only cast empty string / same name to boolean if
  4641. // boolean has higher priority
  4642. var stringIndex = getTypeIndex(String, prop.type);
  4643. if (stringIndex < 0 || booleanIndex < stringIndex) {
  4644. value = true;
  4645. }
  4646. }
  4647. }
  4648. // check default value
  4649. if (value === undefined) {
  4650. value = getPropDefaultValue(vm, prop, key);
  4651. // since the default value is a fresh copy,
  4652. // make sure to observe it.
  4653. var prevShouldObserve = shouldObserve;
  4654. toggleObserving(true);
  4655. observe(value);
  4656. toggleObserving(prevShouldObserve);
  4657. }
  4658. if (
  4659. true
  4660. ) {
  4661. assertProp(prop, key, value, vm, absent);
  4662. }
  4663. return value
  4664. }
  4665. /**
  4666. * Get the default value of a prop.
  4667. */
  4668. function getPropDefaultValue(vm, prop, key) {
  4669. // no default, return undefined
  4670. if (!hasOwn(prop, 'default')) {
  4671. return undefined
  4672. }
  4673. var def = prop.default;
  4674. // warn against non-factory defaults for Object & Array
  4675. if (true && isObject(def)) {
  4676. warn(
  4677. 'Invalid default value for prop "' + key + '": ' +
  4678. 'Props with type Object/Array must use a factory function ' +
  4679. 'to return the default value.',
  4680. vm
  4681. );
  4682. }
  4683. // the raw prop value was also undefined from previous render,
  4684. // return previous default value to avoid unnecessary watcher trigger
  4685. if (vm && vm.$options.propsData &&
  4686. vm.$options.propsData[key] === undefined &&
  4687. vm._props[key] !== undefined
  4688. ) {
  4689. return vm._props[key]
  4690. }
  4691. // call factory function for non-Function types
  4692. // a value is Function if its prototype is function even across different execution context
  4693. return typeof def === 'function' && getType(prop.type) !== 'Function' ?
  4694. def.call(vm) :
  4695. def
  4696. }
  4697. /**
  4698. * Assert whether a prop is valid.
  4699. */
  4700. function assertProp(
  4701. prop,
  4702. name,
  4703. value,
  4704. vm,
  4705. absent
  4706. ) {
  4707. if (prop.required && absent) {
  4708. warn(
  4709. 'Missing required prop: "' + name + '"',
  4710. vm
  4711. );
  4712. return
  4713. }
  4714. if (value == null && !prop.required) {
  4715. return
  4716. }
  4717. var type = prop.type;
  4718. var valid = !type || type === true;
  4719. var expectedTypes = [];
  4720. if (type) {
  4721. if (!Array.isArray(type)) {
  4722. type = [type];
  4723. }
  4724. for (var i = 0; i < type.length && !valid; i++) {
  4725. var assertedType = assertType(value, type[i]);
  4726. expectedTypes.push(assertedType.expectedType || '');
  4727. valid = assertedType.valid;
  4728. }
  4729. }
  4730. if (!valid) {
  4731. warn(
  4732. getInvalidTypeMessage(name, value, expectedTypes),
  4733. vm
  4734. );
  4735. return
  4736. }
  4737. var validator = prop.validator;
  4738. if (validator) {
  4739. if (!validator(value)) {
  4740. warn(
  4741. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  4742. vm
  4743. );
  4744. }
  4745. }
  4746. }
  4747. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  4748. function assertType(value, type) {
  4749. var valid;
  4750. var expectedType = getType(type);
  4751. if (simpleCheckRE.test(expectedType)) {
  4752. var t = typeof value;
  4753. valid = t === expectedType.toLowerCase();
  4754. // for primitive wrapper objects
  4755. if (!valid && t === 'object') {
  4756. valid = value instanceof type;
  4757. }
  4758. } else if (expectedType === 'Object') {
  4759. valid = isPlainObject(value);
  4760. } else if (expectedType === 'Array') {
  4761. valid = Array.isArray(value);
  4762. } else {
  4763. valid = value instanceof type;
  4764. }
  4765. return {
  4766. valid: valid,
  4767. expectedType: expectedType
  4768. }
  4769. }
  4770. /**
  4771. * Use function string name to check built-in types,
  4772. * because a simple equality check will fail when running
  4773. * across different vms / iframes.
  4774. */
  4775. function getType(fn) {
  4776. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  4777. return match ? match[1] : ''
  4778. }
  4779. function isSameType(a, b) {
  4780. return getType(a) === getType(b)
  4781. }
  4782. function getTypeIndex(type, expectedTypes) {
  4783. if (!Array.isArray(expectedTypes)) {
  4784. return isSameType(expectedTypes, type) ? 0 : -1
  4785. }
  4786. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  4787. if (isSameType(expectedTypes[i], type)) {
  4788. return i
  4789. }
  4790. }
  4791. return -1
  4792. }
  4793. function getInvalidTypeMessage(name, value, expectedTypes) {
  4794. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  4795. " Expected " + (expectedTypes.map(capitalize).join(', '));
  4796. var expectedType = expectedTypes[0];
  4797. var receivedType = toRawType(value);
  4798. var expectedValue = styleValue(value, expectedType);
  4799. var receivedValue = styleValue(value, receivedType);
  4800. // check if we need to specify expected value
  4801. if (expectedTypes.length === 1 &&
  4802. isExplicable(expectedType) &&
  4803. !isBoolean(expectedType, receivedType)) {
  4804. message += " with value " + expectedValue;
  4805. }
  4806. message += ", got " + receivedType + " ";
  4807. // check if we need to specify received value
  4808. if (isExplicable(receivedType)) {
  4809. message += "with value " + receivedValue + ".";
  4810. }
  4811. return message
  4812. }
  4813. function styleValue(value, type) {
  4814. if (type === 'String') {
  4815. return ("\"" + value + "\"")
  4816. } else if (type === 'Number') {
  4817. return ("" + (Number(value)))
  4818. } else {
  4819. return ("" + value)
  4820. }
  4821. }
  4822. function isExplicable(value) {
  4823. var explicitTypes = ['string', 'number', 'boolean'];
  4824. return explicitTypes.some(function (elem) {
  4825. return value.toLowerCase() === elem;
  4826. })
  4827. }
  4828. function isBoolean() {
  4829. var args = [],
  4830. len = arguments.length;
  4831. while (len--) args[len] = arguments[len];
  4832. return args.some(function (elem) {
  4833. return elem.toLowerCase() === 'boolean';
  4834. })
  4835. }
  4836. /* */
  4837. function handleError(err, vm, info) {
  4838. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  4839. // See: https://github.com/vuejs/vuex/issues/1505
  4840. pushTarget();
  4841. try {
  4842. if (vm) {
  4843. var cur = vm;
  4844. while ((cur = cur.$parent)) {
  4845. var hooks = cur.$options.errorCaptured;
  4846. if (hooks) {
  4847. for (var i = 0; i < hooks.length; i++) {
  4848. try {
  4849. var capture = hooks[i].call(cur, err, vm, info) === false;
  4850. if (capture) {
  4851. return
  4852. }
  4853. } catch (e) {
  4854. globalHandleError(e, cur, 'errorCaptured hook');
  4855. }
  4856. }
  4857. }
  4858. }
  4859. }
  4860. globalHandleError(err, vm, info);
  4861. } finally {
  4862. popTarget();
  4863. }
  4864. }
  4865. function invokeWithErrorHandling(
  4866. handler,
  4867. context,
  4868. args,
  4869. vm,
  4870. info
  4871. ) {
  4872. var res;
  4873. try {
  4874. res = args ? handler.apply(context, args) : handler.call(context);
  4875. if (res && !res._isVue && isPromise(res) && !res._handled) {
  4876. res.catch(function (e) {
  4877. return handleError(e, vm, info + " (Promise/async)");
  4878. });
  4879. // issue #9511
  4880. // avoid catch triggering multiple times when nested calls
  4881. res._handled = true;
  4882. }
  4883. } catch (e) {
  4884. handleError(e, vm, info);
  4885. }
  4886. return res
  4887. }
  4888. function globalHandleError(err, vm, info) {
  4889. if (config.errorHandler) {
  4890. try {
  4891. return config.errorHandler.call(null, err, vm, info)
  4892. } catch (e) {
  4893. // if the user intentionally throws the original error in the handler,
  4894. // do not log it twice
  4895. if (e !== err) {
  4896. logError(e, null, 'config.errorHandler');
  4897. }
  4898. }
  4899. }
  4900. logError(err, vm, info);
  4901. }
  4902. function logError(err, vm, info) {
  4903. if (true) {
  4904. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  4905. }
  4906. /* istanbul ignore else */
  4907. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  4908. console.error(err);
  4909. } else {
  4910. throw err
  4911. }
  4912. }
  4913. /* */
  4914. var callbacks = [];
  4915. var pending = false;
  4916. function flushCallbacks() {
  4917. pending = false;
  4918. var copies = callbacks.slice(0);
  4919. callbacks.length = 0;
  4920. for (var i = 0; i < copies.length; i++) {
  4921. copies[i]();
  4922. }
  4923. }
  4924. // Here we have async deferring wrappers using microtasks.
  4925. // In 2.5 we used (macro) tasks (in combination with microtasks).
  4926. // However, it has subtle problems when state is changed right before repaint
  4927. // (e.g. #6813, out-in transitions).
  4928. // Also, using (macro) tasks in event handler would cause some weird behaviors
  4929. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  4930. // So we now use microtasks everywhere, again.
  4931. // A major drawback of this tradeoff is that there are some scenarios
  4932. // where microtasks have too high a priority and fire in between supposedly
  4933. // sequential events (e.g. #4521, #6690, which have workarounds)
  4934. // or even between bubbling of the same event (#6566).
  4935. var timerFunc;
  4936. // The nextTick behavior leverages the microtask queue, which can be accessed
  4937. // via either native Promise.then or MutationObserver.
  4938. // MutationObserver has wider support, however it is seriously bugged in
  4939. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  4940. // completely stops working after triggering a few times... so, if native
  4941. // Promise is available, we will use it:
  4942. /* istanbul ignore next, $flow-disable-line */
  4943. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  4944. var p = Promise.resolve();
  4945. timerFunc = function () {
  4946. p.then(flushCallbacks);
  4947. // In problematic UIWebViews, Promise.then doesn't completely break, but
  4948. // it can get stuck in a weird state where callbacks are pushed into the
  4949. // microtask queue but the queue isn't being flushed, until the browser
  4950. // needs to do some other work, e.g. handle a timer. Therefore we can
  4951. // "force" the microtask queue to be flushed by adding an empty timer.
  4952. if (isIOS) {
  4953. setTimeout(noop);
  4954. }
  4955. };
  4956. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  4957. isNative(MutationObserver) ||
  4958. // PhantomJS and iOS 7.x
  4959. MutationObserver.toString() === '[object MutationObserverConstructor]'
  4960. )) {
  4961. // Use MutationObserver where native Promise is not available,
  4962. // e.g. PhantomJS, iOS7, Android 4.4
  4963. // (#6466 MutationObserver is unreliable in IE11)
  4964. var counter = 1;
  4965. var observer = new MutationObserver(flushCallbacks);
  4966. var textNode = document.createTextNode(String(counter));
  4967. observer.observe(textNode, {
  4968. characterData: true
  4969. });
  4970. timerFunc = function () {
  4971. counter = (counter + 1) % 2;
  4972. textNode.data = String(counter);
  4973. };
  4974. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  4975. // Fallback to setImmediate.
  4976. // Technically it leverages the (macro) task queue,
  4977. // but it is still a better choice than setTimeout.
  4978. timerFunc = function () {
  4979. setImmediate(flushCallbacks);
  4980. };
  4981. } else {
  4982. // Fallback to setTimeout.
  4983. timerFunc = function () {
  4984. setTimeout(flushCallbacks, 0);
  4985. };
  4986. }
  4987. function nextTick(cb, ctx) {
  4988. var _resolve;
  4989. callbacks.push(function () {
  4990. if (cb) {
  4991. try {
  4992. cb.call(ctx);
  4993. } catch (e) {
  4994. handleError(e, ctx, 'nextTick');
  4995. }
  4996. } else if (_resolve) {
  4997. _resolve(ctx);
  4998. }
  4999. });
  5000. if (!pending) {
  5001. pending = true;
  5002. timerFunc();
  5003. }
  5004. // $flow-disable-line
  5005. if (!cb && typeof Promise !== 'undefined') {
  5006. return new Promise(function (resolve) {
  5007. _resolve = resolve;
  5008. })
  5009. }
  5010. }
  5011. /* */
  5012. /* not type checking this file because flow doesn't play well with Proxy */
  5013. var initProxy;
  5014. if (true) {
  5015. var allowedGlobals = makeMap(
  5016. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  5017. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  5018. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  5019. 'require' // for Webpack/Browserify
  5020. );
  5021. var warnNonPresent = function (target, key) {
  5022. warn(
  5023. "Property or method \"" + key + "\" is not defined on the instance but " +
  5024. 'referenced during render. Make sure that this property is reactive, ' +
  5025. 'either in the data option, or for class-based components, by ' +
  5026. 'initializing the property. ' +
  5027. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  5028. target
  5029. );
  5030. };
  5031. var warnReservedPrefix = function (target, key) {
  5032. warn(
  5033. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  5034. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  5035. 'prevent conflicts with Vue internals. ' +
  5036. 'See: https://vuejs.org/v2/api/#data',
  5037. target
  5038. );
  5039. };
  5040. var hasProxy =
  5041. typeof Proxy !== 'undefined' && isNative(Proxy);
  5042. if (hasProxy) {
  5043. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  5044. config.keyCodes = new Proxy(config.keyCodes, {
  5045. set: function set(target, key, value) {
  5046. if (isBuiltInModifier(key)) {
  5047. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  5048. return false
  5049. } else {
  5050. target[key] = value;
  5051. return true
  5052. }
  5053. }
  5054. });
  5055. }
  5056. var hasHandler = {
  5057. has: function has(target, key) {
  5058. var has = key in target;
  5059. var isAllowed = allowedGlobals(key) ||
  5060. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  5061. if (!has && !isAllowed) {
  5062. if (key in target.$data) {
  5063. warnReservedPrefix(target, key);
  5064. } else {
  5065. warnNonPresent(target, key);
  5066. }
  5067. }
  5068. return has || !isAllowed
  5069. }
  5070. };
  5071. var getHandler = {
  5072. get: function get(target, key) {
  5073. if (typeof key === 'string' && !(key in target)) {
  5074. if (key in target.$data) {
  5075. warnReservedPrefix(target, key);
  5076. } else {
  5077. warnNonPresent(target, key);
  5078. }
  5079. }
  5080. return target[key]
  5081. }
  5082. };
  5083. initProxy = function initProxy(vm) {
  5084. if (hasProxy) {
  5085. // determine which proxy handler to use
  5086. var options = vm.$options;
  5087. var handlers = options.render && options.render._withStripped ?
  5088. getHandler :
  5089. hasHandler;
  5090. vm._renderProxy = new Proxy(vm, handlers);
  5091. } else {
  5092. vm._renderProxy = vm;
  5093. }
  5094. };
  5095. }
  5096. /* */
  5097. var seenObjects = new _Set();
  5098. /**
  5099. * Recursively traverse an object to evoke all converted
  5100. * getters, so that every nested property inside the object
  5101. * is collected as a "deep" dependency.
  5102. */
  5103. function traverse(val) {
  5104. _traverse(val, seenObjects);
  5105. seenObjects.clear();
  5106. }
  5107. function _traverse(val, seen) {
  5108. var i, keys;
  5109. var isA = Array.isArray(val);
  5110. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  5111. return
  5112. }
  5113. if (val.__ob__) {
  5114. var depId = val.__ob__.dep.id;
  5115. if (seen.has(depId)) {
  5116. return
  5117. }
  5118. seen.add(depId);
  5119. }
  5120. if (isA) {
  5121. i = val.length;
  5122. while (i--) {
  5123. _traverse(val[i], seen);
  5124. }
  5125. } else {
  5126. keys = Object.keys(val);
  5127. i = keys.length;
  5128. while (i--) {
  5129. _traverse(val[keys[i]], seen);
  5130. }
  5131. }
  5132. }
  5133. var mark;
  5134. var measure;
  5135. if (true) {
  5136. var perf = inBrowser && window.performance;
  5137. /* istanbul ignore if */
  5138. if (
  5139. perf &&
  5140. perf.mark &&
  5141. perf.measure &&
  5142. perf.clearMarks &&
  5143. perf.clearMeasures
  5144. ) {
  5145. mark = function (tag) {
  5146. return perf.mark(tag);
  5147. };
  5148. measure = function (name, startTag, endTag) {
  5149. perf.measure(name, startTag, endTag);
  5150. perf.clearMarks(startTag);
  5151. perf.clearMarks(endTag);
  5152. // perf.clearMeasures(name)
  5153. };
  5154. }
  5155. }
  5156. /* */
  5157. var normalizeEvent = cached(function (name) {
  5158. var passive = name.charAt(0) === '&';
  5159. name = passive ? name.slice(1) : name;
  5160. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  5161. name = once$$1 ? name.slice(1) : name;
  5162. var capture = name.charAt(0) === '!';
  5163. name = capture ? name.slice(1) : name;
  5164. return {
  5165. name: name,
  5166. once: once$$1,
  5167. capture: capture,
  5168. passive: passive
  5169. }
  5170. });
  5171. function createFnInvoker(fns, vm) {
  5172. function invoker() {
  5173. var arguments$1 = arguments;
  5174. var fns = invoker.fns;
  5175. if (Array.isArray(fns)) {
  5176. var cloned = fns.slice();
  5177. for (var i = 0; i < cloned.length; i++) {
  5178. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  5179. }
  5180. } else {
  5181. // return handler return value for single handlers
  5182. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  5183. }
  5184. }
  5185. invoker.fns = fns;
  5186. return invoker
  5187. }
  5188. function updateListeners(
  5189. on,
  5190. oldOn,
  5191. add,
  5192. remove$$1,
  5193. createOnceHandler,
  5194. vm
  5195. ) {
  5196. var name, def$$1, cur, old, event;
  5197. for (name in on) {
  5198. def$$1 = cur = on[name];
  5199. old = oldOn[name];
  5200. event = normalizeEvent(name);
  5201. if (isUndef(cur)) {
  5202. true && warn(
  5203. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  5204. vm
  5205. );
  5206. } else if (isUndef(old)) {
  5207. if (isUndef(cur.fns)) {
  5208. cur = on[name] = createFnInvoker(cur, vm);
  5209. }
  5210. if (isTrue(event.once)) {
  5211. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  5212. }
  5213. add(event.name, cur, event.capture, event.passive, event.params);
  5214. } else if (cur !== old) {
  5215. old.fns = cur;
  5216. on[name] = old;
  5217. }
  5218. }
  5219. for (name in oldOn) {
  5220. if (isUndef(on[name])) {
  5221. event = normalizeEvent(name);
  5222. remove$$1(event.name, oldOn[name], event.capture);
  5223. }
  5224. }
  5225. }
  5226. /* */
  5227. /* */
  5228. // fixed by xxxxxx (mp properties)
  5229. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  5230. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  5231. if (isUndef(propOptions)) {
  5232. return res
  5233. }
  5234. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  5235. var attrs = data.attrs;
  5236. var props = data.props;
  5237. if (isDef(attrs) || isDef(props)) {
  5238. for (var key in propOptions) {
  5239. var altKey = hyphenate(key);
  5240. var result = checkProp(res, props, key, altKey, true) ||
  5241. checkProp(res, attrs, key, altKey, false);
  5242. // externalClass
  5243. if (
  5244. result &&
  5245. res[key] &&
  5246. externalClasses.indexOf(altKey) !== -1 &&
  5247. context[camelize(res[key])]
  5248. ) {
  5249. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  5250. res[key] = context[camelize(res[key])];
  5251. }
  5252. }
  5253. }
  5254. return res
  5255. }
  5256. function extractPropsFromVNodeData(
  5257. data,
  5258. Ctor,
  5259. tag,
  5260. context // fixed by xxxxxx
  5261. ) {
  5262. // we are only extracting raw values here.
  5263. // validation and default values are handled in the child
  5264. // component itself.
  5265. var propOptions = Ctor.options.props;
  5266. if (isUndef(propOptions)) {
  5267. // fixed by xxxxxx
  5268. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  5269. }
  5270. var res = {};
  5271. var attrs = data.attrs;
  5272. var props = data.props;
  5273. if (isDef(attrs) || isDef(props)) {
  5274. for (var key in propOptions) {
  5275. var altKey = hyphenate(key);
  5276. if (true) {
  5277. var keyInLowerCase = key.toLowerCase();
  5278. if (
  5279. key !== keyInLowerCase &&
  5280. attrs && hasOwn(attrs, keyInLowerCase)
  5281. ) {
  5282. tip(
  5283. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  5284. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  5285. " \"" + key + "\". " +
  5286. "Note that HTML attributes are case-insensitive and camelCased " +
  5287. "props need to use their kebab-case equivalents when using in-DOM " +
  5288. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  5289. );
  5290. }
  5291. }
  5292. checkProp(res, props, key, altKey, true) ||
  5293. checkProp(res, attrs, key, altKey, false);
  5294. }
  5295. }
  5296. // fixed by xxxxxx
  5297. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  5298. }
  5299. function checkProp(
  5300. res,
  5301. hash,
  5302. key,
  5303. altKey,
  5304. preserve
  5305. ) {
  5306. if (isDef(hash)) {
  5307. if (hasOwn(hash, key)) {
  5308. res[key] = hash[key];
  5309. if (!preserve) {
  5310. delete hash[key];
  5311. }
  5312. return true
  5313. } else if (hasOwn(hash, altKey)) {
  5314. res[key] = hash[altKey];
  5315. if (!preserve) {
  5316. delete hash[altKey];
  5317. }
  5318. return true
  5319. }
  5320. }
  5321. return false
  5322. }
  5323. /* */
  5324. // The template compiler attempts to minimize the need for normalization by
  5325. // statically analyzing the template at compile time.
  5326. //
  5327. // For plain HTML markup, normalization can be completely skipped because the
  5328. // generated render function is guaranteed to return Array<VNode>. There are
  5329. // two cases where extra normalization is needed:
  5330. // 1. When the children contains components - because a functional component
  5331. // may return an Array instead of a single root. In this case, just a simple
  5332. // normalization is needed - if any child is an Array, we flatten the whole
  5333. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  5334. // because functional components already normalize their own children.
  5335. function simpleNormalizeChildren(children) {
  5336. for (var i = 0; i < children.length; i++) {
  5337. if (Array.isArray(children[i])) {
  5338. return Array.prototype.concat.apply([], children)
  5339. }
  5340. }
  5341. return children
  5342. }
  5343. // 2. When the children contains constructs that always generated nested Arrays,
  5344. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  5345. // with hand-written render functions / JSX. In such cases a full normalization
  5346. // is needed to cater to all possible types of children values.
  5347. function normalizeChildren(children) {
  5348. return isPrimitive(children) ?
  5349. [createTextVNode(children)] :
  5350. Array.isArray(children) ?
  5351. normalizeArrayChildren(children) :
  5352. undefined
  5353. }
  5354. function isTextNode(node) {
  5355. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  5356. }
  5357. function normalizeArrayChildren(children, nestedIndex) {
  5358. var res = [];
  5359. var i, c, lastIndex, last;
  5360. for (i = 0; i < children.length; i++) {
  5361. c = children[i];
  5362. if (isUndef(c) || typeof c === 'boolean') {
  5363. continue
  5364. }
  5365. lastIndex = res.length - 1;
  5366. last = res[lastIndex];
  5367. // nested
  5368. if (Array.isArray(c)) {
  5369. if (c.length > 0) {
  5370. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  5371. // merge adjacent text nodes
  5372. if (isTextNode(c[0]) && isTextNode(last)) {
  5373. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  5374. c.shift();
  5375. }
  5376. res.push.apply(res, c);
  5377. }
  5378. } else if (isPrimitive(c)) {
  5379. if (isTextNode(last)) {
  5380. // merge adjacent text nodes
  5381. // this is necessary for SSR hydration because text nodes are
  5382. // essentially merged when rendered to HTML strings
  5383. res[lastIndex] = createTextVNode(last.text + c);
  5384. } else if (c !== '') {
  5385. // convert primitive to vnode
  5386. res.push(createTextVNode(c));
  5387. }
  5388. } else {
  5389. if (isTextNode(c) && isTextNode(last)) {
  5390. // merge adjacent text nodes
  5391. res[lastIndex] = createTextVNode(last.text + c.text);
  5392. } else {
  5393. // default key for nested array children (likely generated by v-for)
  5394. if (isTrue(children._isVList) &&
  5395. isDef(c.tag) &&
  5396. isUndef(c.key) &&
  5397. isDef(nestedIndex)) {
  5398. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  5399. }
  5400. res.push(c);
  5401. }
  5402. }
  5403. }
  5404. return res
  5405. }
  5406. /* */
  5407. function initProvide(vm) {
  5408. var provide = vm.$options.provide;
  5409. if (provide) {
  5410. vm._provided = typeof provide === 'function' ?
  5411. provide.call(vm) :
  5412. provide;
  5413. }
  5414. }
  5415. function initInjections(vm) {
  5416. var result = resolveInject(vm.$options.inject, vm);
  5417. if (result) {
  5418. toggleObserving(false);
  5419. Object.keys(result).forEach(function (key) {
  5420. /* istanbul ignore else */
  5421. if (true) {
  5422. defineReactive$$1(vm, key, result[key], function () {
  5423. warn(
  5424. "Avoid mutating an injected value directly since the changes will be " +
  5425. "overwritten whenever the provided component re-renders. " +
  5426. "injection being mutated: \"" + key + "\"",
  5427. vm
  5428. );
  5429. });
  5430. } else {}
  5431. });
  5432. toggleObserving(true);
  5433. }
  5434. }
  5435. function resolveInject(inject, vm) {
  5436. if (inject) {
  5437. // inject is :any because flow is not smart enough to figure out cached
  5438. var result = Object.create(null);
  5439. var keys = hasSymbol ?
  5440. Reflect.ownKeys(inject) :
  5441. Object.keys(inject);
  5442. for (var i = 0; i < keys.length; i++) {
  5443. var key = keys[i];
  5444. // #6574 in case the inject object is observed...
  5445. if (key === '__ob__') {
  5446. continue
  5447. }
  5448. var provideKey = inject[key].from;
  5449. var source = vm;
  5450. while (source) {
  5451. if (source._provided && hasOwn(source._provided, provideKey)) {
  5452. result[key] = source._provided[provideKey];
  5453. break
  5454. }
  5455. source = source.$parent;
  5456. }
  5457. if (!source) {
  5458. if ('default' in inject[key]) {
  5459. var provideDefault = inject[key].default;
  5460. result[key] = typeof provideDefault === 'function' ?
  5461. provideDefault.call(vm) :
  5462. provideDefault;
  5463. } else if (true) {
  5464. warn(("Injection \"" + key + "\" not found"), vm);
  5465. }
  5466. }
  5467. }
  5468. return result
  5469. }
  5470. }
  5471. /* */
  5472. /**
  5473. * Runtime helper for resolving raw children VNodes into a slot object.
  5474. */
  5475. function resolveSlots(
  5476. children,
  5477. context
  5478. ) {
  5479. if (!children || !children.length) {
  5480. return {}
  5481. }
  5482. var slots = {};
  5483. for (var i = 0, l = children.length; i < l; i++) {
  5484. var child = children[i];
  5485. var data = child.data;
  5486. // remove slot attribute if the node is resolved as a Vue slot node
  5487. if (data && data.attrs && data.attrs.slot) {
  5488. delete data.attrs.slot;
  5489. }
  5490. // named slots should only be respected if the vnode was rendered in the
  5491. // same context.
  5492. if ((child.context === context || child.fnContext === context) &&
  5493. data && data.slot != null
  5494. ) {
  5495. var name = data.slot;
  5496. var slot = (slots[name] || (slots[name] = []));
  5497. if (child.tag === 'template') {
  5498. slot.push.apply(slot, child.children || []);
  5499. } else {
  5500. slot.push(child);
  5501. }
  5502. } else {
  5503. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  5504. if (child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page') {
  5505. (slots['page'] || (slots['page'] = [])).push(child);
  5506. } else {
  5507. (slots.default || (slots.default = [])).push(child);
  5508. }
  5509. }
  5510. }
  5511. // ignore slots that contains only whitespace
  5512. for (var name$1 in slots) {
  5513. if (slots[name$1].every(isWhitespace)) {
  5514. delete slots[name$1];
  5515. }
  5516. }
  5517. return slots
  5518. }
  5519. function isWhitespace(node) {
  5520. return (node.isComment && !node.asyncFactory) || node.text === ' '
  5521. }
  5522. /* */
  5523. function normalizeScopedSlots(
  5524. slots,
  5525. normalSlots,
  5526. prevSlots
  5527. ) {
  5528. var res;
  5529. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  5530. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  5531. var key = slots && slots.$key;
  5532. if (!slots) {
  5533. res = {};
  5534. } else if (slots._normalized) {
  5535. // fast path 1: child component re-render only, parent did not change
  5536. return slots._normalized
  5537. } else if (
  5538. isStable &&
  5539. prevSlots &&
  5540. prevSlots !== emptyObject &&
  5541. key === prevSlots.$key &&
  5542. !hasNormalSlots &&
  5543. !prevSlots.$hasNormal
  5544. ) {
  5545. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  5546. // only need to normalize once
  5547. return prevSlots
  5548. } else {
  5549. res = {};
  5550. for (var key$1 in slots) {
  5551. if (slots[key$1] && key$1[0] !== '$') {
  5552. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  5553. }
  5554. }
  5555. }
  5556. // expose normal slots on scopedSlots
  5557. for (var key$2 in normalSlots) {
  5558. if (!(key$2 in res)) {
  5559. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  5560. }
  5561. }
  5562. // avoriaz seems to mock a non-extensible $scopedSlots object
  5563. // and when that is passed down this would cause an error
  5564. if (slots && Object.isExtensible(slots)) {
  5565. (slots)._normalized = res;
  5566. }
  5567. def(res, '$stable', isStable);
  5568. def(res, '$key', key);
  5569. def(res, '$hasNormal', hasNormalSlots);
  5570. return res
  5571. }
  5572. function normalizeScopedSlot(normalSlots, key, fn) {
  5573. var normalized = function () {
  5574. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  5575. res = res && typeof res === 'object' && !Array.isArray(res) ?
  5576. [res] // single vnode
  5577. :
  5578. normalizeChildren(res);
  5579. return res && (
  5580. res.length === 0 ||
  5581. (res.length === 1 && res[0].isComment) // #9658
  5582. ) ? undefined :
  5583. res
  5584. };
  5585. // this is a slot using the new v-slot syntax without scope. although it is
  5586. // compiled as a scoped slot, render fn users would expect it to be present
  5587. // on this.$slots because the usage is semantically a normal slot.
  5588. if (fn.proxy) {
  5589. Object.defineProperty(normalSlots, key, {
  5590. get: normalized,
  5591. enumerable: true,
  5592. configurable: true
  5593. });
  5594. }
  5595. return normalized
  5596. }
  5597. function proxyNormalSlot(slots, key) {
  5598. return function () {
  5599. return slots[key];
  5600. }
  5601. }
  5602. /* */
  5603. /**
  5604. * Runtime helper for rendering v-for lists.
  5605. */
  5606. function renderList(
  5607. val,
  5608. render
  5609. ) {
  5610. var ret, i, l, keys, key;
  5611. if (Array.isArray(val) || typeof val === 'string') {
  5612. ret = new Array(val.length);
  5613. for (i = 0, l = val.length; i < l; i++) {
  5614. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  5615. }
  5616. } else if (typeof val === 'number') {
  5617. ret = new Array(val);
  5618. for (i = 0; i < val; i++) {
  5619. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  5620. }
  5621. } else if (isObject(val)) {
  5622. if (hasSymbol && val[Symbol.iterator]) {
  5623. ret = [];
  5624. var iterator = val[Symbol.iterator]();
  5625. var result = iterator.next();
  5626. while (!result.done) {
  5627. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  5628. result = iterator.next();
  5629. }
  5630. } else {
  5631. keys = Object.keys(val);
  5632. ret = new Array(keys.length);
  5633. for (i = 0, l = keys.length; i < l; i++) {
  5634. key = keys[i];
  5635. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  5636. }
  5637. }
  5638. }
  5639. if (!isDef(ret)) {
  5640. ret = [];
  5641. }
  5642. (ret)._isVList = true;
  5643. return ret
  5644. }
  5645. /* */
  5646. /**
  5647. * Runtime helper for rendering <slot>
  5648. */
  5649. function renderSlot(
  5650. name,
  5651. fallback,
  5652. props,
  5653. bindObject
  5654. ) {
  5655. var scopedSlotFn = this.$scopedSlots[name];
  5656. var nodes;
  5657. if (scopedSlotFn) { // scoped slot
  5658. props = props || {};
  5659. if (bindObject) {
  5660. if (true && !isObject(bindObject)) {
  5661. warn(
  5662. 'slot v-bind without argument expects an Object',
  5663. this
  5664. );
  5665. }
  5666. props = extend(extend({}, bindObject), props);
  5667. }
  5668. // fixed by xxxxxx app-plus scopedSlot
  5669. nodes = scopedSlotFn(props, this, props._i) || fallback;
  5670. } else {
  5671. nodes = this.$slots[name] || fallback;
  5672. }
  5673. var target = props && props.slot;
  5674. if (target) {
  5675. return this.$createElement('template', {
  5676. slot: target
  5677. }, nodes)
  5678. } else {
  5679. return nodes
  5680. }
  5681. }
  5682. /* */
  5683. /**
  5684. * Runtime helper for resolving filters
  5685. */
  5686. function resolveFilter(id) {
  5687. return resolveAsset(this.$options, 'filters', id, true) || identity
  5688. }
  5689. /* */
  5690. function isKeyNotMatch(expect, actual) {
  5691. if (Array.isArray(expect)) {
  5692. return expect.indexOf(actual) === -1
  5693. } else {
  5694. return expect !== actual
  5695. }
  5696. }
  5697. /**
  5698. * Runtime helper for checking keyCodes from config.
  5699. * exposed as Vue.prototype._k
  5700. * passing in eventKeyName as last argument separately for backwards compat
  5701. */
  5702. function checkKeyCodes(
  5703. eventKeyCode,
  5704. key,
  5705. builtInKeyCode,
  5706. eventKeyName,
  5707. builtInKeyName
  5708. ) {
  5709. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  5710. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  5711. return isKeyNotMatch(builtInKeyName, eventKeyName)
  5712. } else if (mappedKeyCode) {
  5713. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  5714. } else if (eventKeyName) {
  5715. return hyphenate(eventKeyName) !== key
  5716. }
  5717. }
  5718. /* */
  5719. /**
  5720. * Runtime helper for merging v-bind="object" into a VNode's data.
  5721. */
  5722. function bindObjectProps(
  5723. data,
  5724. tag,
  5725. value,
  5726. asProp,
  5727. isSync
  5728. ) {
  5729. if (value) {
  5730. if (!isObject(value)) {
  5731. true && warn(
  5732. 'v-bind without argument expects an Object or Array value',
  5733. this
  5734. );
  5735. } else {
  5736. if (Array.isArray(value)) {
  5737. value = toObject(value);
  5738. }
  5739. var hash;
  5740. var loop = function (key) {
  5741. if (
  5742. key === 'class' ||
  5743. key === 'style' ||
  5744. isReservedAttribute(key)
  5745. ) {
  5746. hash = data;
  5747. } else {
  5748. var type = data.attrs && data.attrs.type;
  5749. hash = asProp || config.mustUseProp(tag, type, key) ?
  5750. data.domProps || (data.domProps = {}) :
  5751. data.attrs || (data.attrs = {});
  5752. }
  5753. var camelizedKey = camelize(key);
  5754. var hyphenatedKey = hyphenate(key);
  5755. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  5756. hash[key] = value[key];
  5757. if (isSync) {
  5758. var on = data.on || (data.on = {});
  5759. on[("update:" + key)] = function ($event) {
  5760. value[key] = $event;
  5761. };
  5762. }
  5763. }
  5764. };
  5765. for (var key in value) loop(key);
  5766. }
  5767. }
  5768. return data
  5769. }
  5770. /* */
  5771. /**
  5772. * Runtime helper for rendering static trees.
  5773. */
  5774. function renderStatic(
  5775. index,
  5776. isInFor
  5777. ) {
  5778. var cached = this._staticTrees || (this._staticTrees = []);
  5779. var tree = cached[index];
  5780. // if has already-rendered static tree and not inside v-for,
  5781. // we can reuse the same tree.
  5782. if (tree && !isInFor) {
  5783. return tree
  5784. }
  5785. // otherwise, render a fresh tree.
  5786. tree = cached[index] = this.$options.staticRenderFns[index].call(
  5787. this._renderProxy,
  5788. null,
  5789. this // for render fns generated for functional component templates
  5790. );
  5791. markStatic(tree, ("__static__" + index), false);
  5792. return tree
  5793. }
  5794. /**
  5795. * Runtime helper for v-once.
  5796. * Effectively it means marking the node as static with a unique key.
  5797. */
  5798. function markOnce(
  5799. tree,
  5800. index,
  5801. key
  5802. ) {
  5803. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  5804. return tree
  5805. }
  5806. function markStatic(
  5807. tree,
  5808. key,
  5809. isOnce
  5810. ) {
  5811. if (Array.isArray(tree)) {
  5812. for (var i = 0; i < tree.length; i++) {
  5813. if (tree[i] && typeof tree[i] !== 'string') {
  5814. markStaticNode(tree[i], (key + "_" + i), isOnce);
  5815. }
  5816. }
  5817. } else {
  5818. markStaticNode(tree, key, isOnce);
  5819. }
  5820. }
  5821. function markStaticNode(node, key, isOnce) {
  5822. node.isStatic = true;
  5823. node.key = key;
  5824. node.isOnce = isOnce;
  5825. }
  5826. /* */
  5827. function bindObjectListeners(data, value) {
  5828. if (value) {
  5829. if (!isPlainObject(value)) {
  5830. true && warn(
  5831. 'v-on without argument expects an Object value',
  5832. this
  5833. );
  5834. } else {
  5835. var on = data.on = data.on ? extend({}, data.on) : {};
  5836. for (var key in value) {
  5837. var existing = on[key];
  5838. var ours = value[key];
  5839. on[key] = existing ? [].concat(existing, ours) : ours;
  5840. }
  5841. }
  5842. }
  5843. return data
  5844. }
  5845. /* */
  5846. function resolveScopedSlots(
  5847. fns, // see flow/vnode
  5848. res,
  5849. // the following are added in 2.6
  5850. hasDynamicKeys,
  5851. contentHashKey
  5852. ) {
  5853. res = res || {
  5854. $stable: !hasDynamicKeys
  5855. };
  5856. for (var i = 0; i < fns.length; i++) {
  5857. var slot = fns[i];
  5858. if (Array.isArray(slot)) {
  5859. resolveScopedSlots(slot, res, hasDynamicKeys);
  5860. } else if (slot) {
  5861. // marker for reverse proxying v-slot without scope on this.$slots
  5862. if (slot.proxy) {
  5863. slot.fn.proxy = true;
  5864. }
  5865. res[slot.key] = slot.fn;
  5866. }
  5867. }
  5868. if (contentHashKey) {
  5869. (res).$key = contentHashKey;
  5870. }
  5871. return res
  5872. }
  5873. /* */
  5874. function bindDynamicKeys(baseObj, values) {
  5875. for (var i = 0; i < values.length; i += 2) {
  5876. var key = values[i];
  5877. if (typeof key === 'string' && key) {
  5878. baseObj[values[i]] = values[i + 1];
  5879. } else if (true && key !== '' && key !== null) {
  5880. // null is a special value for explicitly removing a binding
  5881. warn(
  5882. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  5883. this
  5884. );
  5885. }
  5886. }
  5887. return baseObj
  5888. }
  5889. // helper to dynamically append modifier runtime markers to event names.
  5890. // ensure only append when value is already string, otherwise it will be cast
  5891. // to string and cause the type check to miss.
  5892. function prependModifier(value, symbol) {
  5893. return typeof value === 'string' ? symbol + value : value
  5894. }
  5895. /* */
  5896. function installRenderHelpers(target) {
  5897. target._o = markOnce;
  5898. target._n = toNumber;
  5899. target._s = toString;
  5900. target._l = renderList;
  5901. target._t = renderSlot;
  5902. target._q = looseEqual;
  5903. target._i = looseIndexOf;
  5904. target._m = renderStatic;
  5905. target._f = resolveFilter;
  5906. target._k = checkKeyCodes;
  5907. target._b = bindObjectProps;
  5908. target._v = createTextVNode;
  5909. target._e = createEmptyVNode;
  5910. target._u = resolveScopedSlots;
  5911. target._g = bindObjectListeners;
  5912. target._d = bindDynamicKeys;
  5913. target._p = prependModifier;
  5914. }
  5915. /* */
  5916. function FunctionalRenderContext(
  5917. data,
  5918. props,
  5919. children,
  5920. parent,
  5921. Ctor
  5922. ) {
  5923. var this$1 = this;
  5924. var options = Ctor.options;
  5925. // ensure the createElement function in functional components
  5926. // gets a unique context - this is necessary for correct named slot check
  5927. var contextVm;
  5928. if (hasOwn(parent, '_uid')) {
  5929. contextVm = Object.create(parent);
  5930. // $flow-disable-line
  5931. contextVm._original = parent;
  5932. } else {
  5933. // the context vm passed in is a functional context as well.
  5934. // in this case we want to make sure we are able to get a hold to the
  5935. // real context instance.
  5936. contextVm = parent;
  5937. // $flow-disable-line
  5938. parent = parent._original;
  5939. }
  5940. var isCompiled = isTrue(options._compiled);
  5941. var needNormalization = !isCompiled;
  5942. this.data = data;
  5943. this.props = props;
  5944. this.children = children;
  5945. this.parent = parent;
  5946. this.listeners = data.on || emptyObject;
  5947. this.injections = resolveInject(options.inject, parent);
  5948. this.slots = function () {
  5949. if (!this$1.$slots) {
  5950. normalizeScopedSlots(
  5951. data.scopedSlots,
  5952. this$1.$slots = resolveSlots(children, parent)
  5953. );
  5954. }
  5955. return this$1.$slots
  5956. };
  5957. Object.defineProperty(this, 'scopedSlots', ({
  5958. enumerable: true,
  5959. get: function get() {
  5960. return normalizeScopedSlots(data.scopedSlots, this.slots())
  5961. }
  5962. }));
  5963. // support for compiled functional template
  5964. if (isCompiled) {
  5965. // exposing $options for renderStatic()
  5966. this.$options = options;
  5967. // pre-resolve slots for renderSlot()
  5968. this.$slots = this.slots();
  5969. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  5970. }
  5971. if (options._scopeId) {
  5972. this._c = function (a, b, c, d) {
  5973. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  5974. if (vnode && !Array.isArray(vnode)) {
  5975. vnode.fnScopeId = options._scopeId;
  5976. vnode.fnContext = parent;
  5977. }
  5978. return vnode
  5979. };
  5980. } else {
  5981. this._c = function (a, b, c, d) {
  5982. return createElement(contextVm, a, b, c, d, needNormalization);
  5983. };
  5984. }
  5985. }
  5986. installRenderHelpers(FunctionalRenderContext.prototype);
  5987. function createFunctionalComponent(
  5988. Ctor,
  5989. propsData,
  5990. data,
  5991. contextVm,
  5992. children
  5993. ) {
  5994. var options = Ctor.options;
  5995. var props = {};
  5996. var propOptions = options.props;
  5997. if (isDef(propOptions)) {
  5998. for (var key in propOptions) {
  5999. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  6000. }
  6001. } else {
  6002. if (isDef(data.attrs)) {
  6003. mergeProps(props, data.attrs);
  6004. }
  6005. if (isDef(data.props)) {
  6006. mergeProps(props, data.props);
  6007. }
  6008. }
  6009. var renderContext = new FunctionalRenderContext(
  6010. data,
  6011. props,
  6012. children,
  6013. contextVm,
  6014. Ctor
  6015. );
  6016. var vnode = options.render.call(null, renderContext._c, renderContext);
  6017. if (vnode instanceof VNode) {
  6018. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  6019. } else if (Array.isArray(vnode)) {
  6020. var vnodes = normalizeChildren(vnode) || [];
  6021. var res = new Array(vnodes.length);
  6022. for (var i = 0; i < vnodes.length; i++) {
  6023. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  6024. }
  6025. return res
  6026. }
  6027. }
  6028. function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
  6029. // #7817 clone node before setting fnContext, otherwise if the node is reused
  6030. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  6031. // that should not be matched to match.
  6032. var clone = cloneVNode(vnode);
  6033. clone.fnContext = contextVm;
  6034. clone.fnOptions = options;
  6035. if (true) {
  6036. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  6037. }
  6038. if (data.slot) {
  6039. (clone.data || (clone.data = {})).slot = data.slot;
  6040. }
  6041. return clone
  6042. }
  6043. function mergeProps(to, from) {
  6044. for (var key in from) {
  6045. to[camelize(key)] = from[key];
  6046. }
  6047. }
  6048. /* */
  6049. /* */
  6050. /* */
  6051. /* */
  6052. // inline hooks to be invoked on component VNodes during patch
  6053. var componentVNodeHooks = {
  6054. init: function init(vnode, hydrating) {
  6055. if (
  6056. vnode.componentInstance &&
  6057. !vnode.componentInstance._isDestroyed &&
  6058. vnode.data.keepAlive
  6059. ) {
  6060. // kept-alive components, treat as a patch
  6061. var mountedNode = vnode; // work around flow
  6062. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  6063. } else {
  6064. var child = vnode.componentInstance = createComponentInstanceForVnode(
  6065. vnode,
  6066. activeInstance
  6067. );
  6068. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  6069. }
  6070. },
  6071. prepatch: function prepatch(oldVnode, vnode) {
  6072. var options = vnode.componentOptions;
  6073. var child = vnode.componentInstance = oldVnode.componentInstance;
  6074. updateChildComponent(
  6075. child,
  6076. options.propsData, // updated props
  6077. options.listeners, // updated listeners
  6078. vnode, // new parent vnode
  6079. options.children // new children
  6080. );
  6081. },
  6082. insert: function insert(vnode) {
  6083. var context = vnode.context;
  6084. var componentInstance = vnode.componentInstance;
  6085. if (!componentInstance._isMounted) {
  6086. callHook(componentInstance, 'onServiceCreated');
  6087. callHook(componentInstance, 'onServiceAttached');
  6088. componentInstance._isMounted = true;
  6089. callHook(componentInstance, 'mounted');
  6090. }
  6091. if (vnode.data.keepAlive) {
  6092. if (context._isMounted) {
  6093. // vue-router#1212
  6094. // During updates, a kept-alive component's child components may
  6095. // change, so directly walking the tree here may call activated hooks
  6096. // on incorrect children. Instead we push them into a queue which will
  6097. // be processed after the whole patch process ended.
  6098. queueActivatedComponent(componentInstance);
  6099. } else {
  6100. activateChildComponent(componentInstance, true /* direct */ );
  6101. }
  6102. }
  6103. },
  6104. destroy: function destroy(vnode) {
  6105. var componentInstance = vnode.componentInstance;
  6106. if (!componentInstance._isDestroyed) {
  6107. if (!vnode.data.keepAlive) {
  6108. componentInstance.$destroy();
  6109. } else {
  6110. deactivateChildComponent(componentInstance, true /* direct */ );
  6111. }
  6112. }
  6113. }
  6114. };
  6115. var hooksToMerge = Object.keys(componentVNodeHooks);
  6116. function createComponent(
  6117. Ctor,
  6118. data,
  6119. context,
  6120. children,
  6121. tag
  6122. ) {
  6123. if (isUndef(Ctor)) {
  6124. return
  6125. }
  6126. var baseCtor = context.$options._base;
  6127. // plain options object: turn it into a constructor
  6128. if (isObject(Ctor)) {
  6129. Ctor = baseCtor.extend(Ctor);
  6130. }
  6131. // if at this stage it's not a constructor or an async component factory,
  6132. // reject.
  6133. if (typeof Ctor !== 'function') {
  6134. if (true) {
  6135. warn(("Invalid Component definition: " + (String(Ctor))), context);
  6136. }
  6137. return
  6138. }
  6139. // async component
  6140. var asyncFactory;
  6141. if (isUndef(Ctor.cid)) {
  6142. asyncFactory = Ctor;
  6143. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  6144. if (Ctor === undefined) {
  6145. // return a placeholder node for async component, which is rendered
  6146. // as a comment node but preserves all the raw information for the node.
  6147. // the information will be used for async server-rendering and hydration.
  6148. return createAsyncPlaceholder(
  6149. asyncFactory,
  6150. data,
  6151. context,
  6152. children,
  6153. tag
  6154. )
  6155. }
  6156. }
  6157. data = data || {};
  6158. // resolve constructor options in case global mixins are applied after
  6159. // component constructor creation
  6160. resolveConstructorOptions(Ctor);
  6161. // transform component v-model data into props & events
  6162. if (isDef(data.model)) {
  6163. transformModel(Ctor.options, data);
  6164. }
  6165. // extract props
  6166. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  6167. // functional component
  6168. if (isTrue(Ctor.options.functional)) {
  6169. return createFunctionalComponent(Ctor, propsData, data, context, children)
  6170. }
  6171. // extract listeners, since these needs to be treated as
  6172. // child component listeners instead of DOM listeners
  6173. var listeners = data.on;
  6174. // replace with listeners with .native modifier
  6175. // so it gets processed during parent component patch.
  6176. data.on = data.nativeOn;
  6177. if (isTrue(Ctor.options.abstract)) {
  6178. // abstract components do not keep anything
  6179. // other than props & listeners & slot
  6180. // work around flow
  6181. var slot = data.slot;
  6182. data = {};
  6183. if (slot) {
  6184. data.slot = slot;
  6185. }
  6186. }
  6187. // install component management hooks onto the placeholder node
  6188. installComponentHooks(data);
  6189. // return a placeholder vnode
  6190. var name = Ctor.options.name || tag;
  6191. var vnode = new VNode(
  6192. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  6193. data, undefined, undefined, undefined, context, {
  6194. Ctor: Ctor,
  6195. propsData: propsData,
  6196. listeners: listeners,
  6197. tag: tag,
  6198. children: children
  6199. },
  6200. asyncFactory
  6201. );
  6202. return vnode
  6203. }
  6204. function createComponentInstanceForVnode(
  6205. vnode, // we know it's MountedComponentVNode but flow doesn't
  6206. parent // activeInstance in lifecycle state
  6207. ) {
  6208. var options = {
  6209. _isComponent: true,
  6210. _parentVnode: vnode,
  6211. parent: parent
  6212. };
  6213. // check inline-template render functions
  6214. var inlineTemplate = vnode.data.inlineTemplate;
  6215. if (isDef(inlineTemplate)) {
  6216. options.render = inlineTemplate.render;
  6217. options.staticRenderFns = inlineTemplate.staticRenderFns;
  6218. }
  6219. return new vnode.componentOptions.Ctor(options)
  6220. }
  6221. function installComponentHooks(data) {
  6222. var hooks = data.hook || (data.hook = {});
  6223. for (var i = 0; i < hooksToMerge.length; i++) {
  6224. var key = hooksToMerge[i];
  6225. var existing = hooks[key];
  6226. var toMerge = componentVNodeHooks[key];
  6227. if (existing !== toMerge && !(existing && existing._merged)) {
  6228. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  6229. }
  6230. }
  6231. }
  6232. function mergeHook$1(f1, f2) {
  6233. var merged = function (a, b) {
  6234. // flow complains about extra args which is why we use any
  6235. f1(a, b);
  6236. f2(a, b);
  6237. };
  6238. merged._merged = true;
  6239. return merged
  6240. }
  6241. // transform component v-model info (value and callback) into
  6242. // prop and event handler respectively.
  6243. function transformModel(options, data) {
  6244. var prop = (options.model && options.model.prop) || 'value';
  6245. var event = (options.model && options.model.event) || 'input';
  6246. (data.attrs || (data.attrs = {}))[prop] = data.model.value;
  6247. var on = data.on || (data.on = {});
  6248. var existing = on[event];
  6249. var callback = data.model.callback;
  6250. if (isDef(existing)) {
  6251. if (
  6252. Array.isArray(existing) ?
  6253. existing.indexOf(callback) === -1 :
  6254. existing !== callback
  6255. ) {
  6256. on[event] = [callback].concat(existing);
  6257. }
  6258. } else {
  6259. on[event] = callback;
  6260. }
  6261. }
  6262. /* */
  6263. var SIMPLE_NORMALIZE = 1;
  6264. var ALWAYS_NORMALIZE = 2;
  6265. // wrapper function for providing a more flexible interface
  6266. // without getting yelled at by flow
  6267. function createElement(
  6268. context,
  6269. tag,
  6270. data,
  6271. children,
  6272. normalizationType,
  6273. alwaysNormalize
  6274. ) {
  6275. if (Array.isArray(data) || isPrimitive(data)) {
  6276. normalizationType = children;
  6277. children = data;
  6278. data = undefined;
  6279. }
  6280. if (isTrue(alwaysNormalize)) {
  6281. normalizationType = ALWAYS_NORMALIZE;
  6282. }
  6283. return _createElement(context, tag, data, children, normalizationType)
  6284. }
  6285. function _createElement(
  6286. context,
  6287. tag,
  6288. data,
  6289. children,
  6290. normalizationType
  6291. ) {
  6292. if (isDef(data) && isDef((data).__ob__)) {
  6293. true && warn(
  6294. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  6295. 'Always create fresh vnode data objects in each render!',
  6296. context
  6297. );
  6298. return createEmptyVNode()
  6299. }
  6300. // object syntax in v-bind
  6301. if (isDef(data) && isDef(data.is)) {
  6302. tag = data.is;
  6303. }
  6304. if (!tag) {
  6305. // in case of component :is set to falsy value
  6306. return createEmptyVNode()
  6307. }
  6308. // warn against non-primitive key
  6309. if (true &&
  6310. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  6311. ) {
  6312. {
  6313. warn(
  6314. 'Avoid using non-primitive value as key, ' +
  6315. 'use string/number value instead.',
  6316. context
  6317. );
  6318. }
  6319. }
  6320. // support single function children as default scoped slot
  6321. if (Array.isArray(children) &&
  6322. typeof children[0] === 'function'
  6323. ) {
  6324. data = data || {};
  6325. data.scopedSlots = {
  6326. default: children[0]
  6327. };
  6328. children.length = 0;
  6329. }
  6330. if (normalizationType === ALWAYS_NORMALIZE) {
  6331. children = normalizeChildren(children);
  6332. } else if (normalizationType === SIMPLE_NORMALIZE) {
  6333. children = simpleNormalizeChildren(children);
  6334. }
  6335. var vnode, ns;
  6336. if (typeof tag === 'string') {
  6337. var Ctor;
  6338. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  6339. if (config.isReservedTag(tag)) {
  6340. // platform built-in elements
  6341. if (true && isDef(data) && isDef(data.nativeOn)) {
  6342. warn(
  6343. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  6344. context
  6345. );
  6346. }
  6347. vnode = new VNode(
  6348. config.parsePlatformTagName(tag), data, children,
  6349. undefined, undefined, context
  6350. );
  6351. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  6352. // component
  6353. vnode = createComponent(Ctor, data, context, children, tag);
  6354. } else {
  6355. // unknown or unlisted namespaced elements
  6356. // check at runtime because it may get assigned a namespace when its
  6357. // parent normalizes children
  6358. vnode = new VNode(
  6359. tag, data, children,
  6360. undefined, undefined, context
  6361. );
  6362. }
  6363. } else {
  6364. // direct component options / constructor
  6365. vnode = createComponent(tag, data, context, children);
  6366. }
  6367. if (Array.isArray(vnode)) {
  6368. return vnode
  6369. } else if (isDef(vnode)) {
  6370. if (isDef(ns)) {
  6371. applyNS(vnode, ns);
  6372. }
  6373. if (isDef(data)) {
  6374. registerDeepBindings(data);
  6375. }
  6376. return vnode
  6377. } else {
  6378. return createEmptyVNode()
  6379. }
  6380. }
  6381. function applyNS(vnode, ns, force) {
  6382. vnode.ns = ns;
  6383. if (vnode.tag === 'foreignObject') {
  6384. // use default namespace inside foreignObject
  6385. ns = undefined;
  6386. force = true;
  6387. }
  6388. if (isDef(vnode.children)) {
  6389. for (var i = 0, l = vnode.children.length; i < l; i++) {
  6390. var child = vnode.children[i];
  6391. if (isDef(child.tag) && (
  6392. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  6393. applyNS(child, ns, force);
  6394. }
  6395. }
  6396. }
  6397. }
  6398. // ref #5318
  6399. // necessary to ensure parent re-render when deep bindings like :style and
  6400. // :class are used on slot nodes
  6401. function registerDeepBindings(data) {
  6402. if (isObject(data.style)) {
  6403. traverse(data.style);
  6404. }
  6405. if (isObject(data.class)) {
  6406. traverse(data.class);
  6407. }
  6408. }
  6409. /* */
  6410. function initRender(vm) {
  6411. vm._vnode = null; // the root of the child tree
  6412. vm._staticTrees = null; // v-once cached trees
  6413. var options = vm.$options;
  6414. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  6415. var renderContext = parentVnode && parentVnode.context;
  6416. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  6417. vm.$scopedSlots = emptyObject;
  6418. // bind the createElement fn to this instance
  6419. // so that we get proper render context inside it.
  6420. // args order: tag, data, children, normalizationType, alwaysNormalize
  6421. // internal version is used by render functions compiled from templates
  6422. vm._c = function (a, b, c, d) {
  6423. return createElement(vm, a, b, c, d, false);
  6424. };
  6425. // normalization is always applied for the public version, used in
  6426. // user-written render functions.
  6427. vm.$createElement = function (a, b, c, d) {
  6428. return createElement(vm, a, b, c, d, true);
  6429. };
  6430. // $attrs & $listeners are exposed for easier HOC creation.
  6431. // they need to be reactive so that HOCs using them are always updated
  6432. var parentData = parentVnode && parentVnode.data;
  6433. /* istanbul ignore else */
  6434. if (true) {
  6435. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  6436. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  6437. }, true);
  6438. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  6439. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  6440. }, true);
  6441. } else {}
  6442. }
  6443. var currentRenderingInstance = null;
  6444. function renderMixin(Vue) {
  6445. // install runtime convenience helpers
  6446. installRenderHelpers(Vue.prototype);
  6447. Vue.prototype.$nextTick = function (fn) {
  6448. return nextTick(fn, this)
  6449. };
  6450. Vue.prototype._render = function () {
  6451. var vm = this;
  6452. var ref = vm.$options;
  6453. var render = ref.render;
  6454. var _parentVnode = ref._parentVnode;
  6455. if (_parentVnode) {
  6456. vm.$scopedSlots = normalizeScopedSlots(
  6457. _parentVnode.data.scopedSlots,
  6458. vm.$slots,
  6459. vm.$scopedSlots
  6460. );
  6461. }
  6462. // set parent vnode. this allows render functions to have access
  6463. // to the data on the placeholder node.
  6464. vm.$vnode = _parentVnode;
  6465. // render self
  6466. var vnode;
  6467. try {
  6468. // There's no need to maintain a stack because all render fns are called
  6469. // separately from one another. Nested component's render fns are called
  6470. // when parent component is patched.
  6471. currentRenderingInstance = vm;
  6472. vnode = render.call(vm._renderProxy, vm.$createElement);
  6473. } catch (e) {
  6474. handleError(e, vm, "render");
  6475. // return error render result,
  6476. // or previous vnode to prevent render error causing blank component
  6477. /* istanbul ignore else */
  6478. if (true && vm.$options.renderError) {
  6479. try {
  6480. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  6481. } catch (e) {
  6482. handleError(e, vm, "renderError");
  6483. vnode = vm._vnode;
  6484. }
  6485. } else {
  6486. vnode = vm._vnode;
  6487. }
  6488. } finally {
  6489. currentRenderingInstance = null;
  6490. }
  6491. // if the returned array contains only a single node, allow it
  6492. if (Array.isArray(vnode) && vnode.length === 1) {
  6493. vnode = vnode[0];
  6494. }
  6495. // return empty vnode in case the render function errored out
  6496. if (!(vnode instanceof VNode)) {
  6497. if (true && Array.isArray(vnode)) {
  6498. warn(
  6499. 'Multiple root nodes returned from render function. Render function ' +
  6500. 'should return a single root node.',
  6501. vm
  6502. );
  6503. }
  6504. vnode = createEmptyVNode();
  6505. }
  6506. // set parent
  6507. vnode.parent = _parentVnode;
  6508. return vnode
  6509. };
  6510. }
  6511. /* */
  6512. function ensureCtor(comp, base) {
  6513. if (
  6514. comp.__esModule ||
  6515. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  6516. ) {
  6517. comp = comp.default;
  6518. }
  6519. return isObject(comp) ?
  6520. base.extend(comp) :
  6521. comp
  6522. }
  6523. function createAsyncPlaceholder(
  6524. factory,
  6525. data,
  6526. context,
  6527. children,
  6528. tag
  6529. ) {
  6530. var node = createEmptyVNode();
  6531. node.asyncFactory = factory;
  6532. node.asyncMeta = {
  6533. data: data,
  6534. context: context,
  6535. children: children,
  6536. tag: tag
  6537. };
  6538. return node
  6539. }
  6540. function resolveAsyncComponent(
  6541. factory,
  6542. baseCtor
  6543. ) {
  6544. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  6545. return factory.errorComp
  6546. }
  6547. if (isDef(factory.resolved)) {
  6548. return factory.resolved
  6549. }
  6550. var owner = currentRenderingInstance;
  6551. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  6552. // already pending
  6553. factory.owners.push(owner);
  6554. }
  6555. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  6556. return factory.loadingComp
  6557. }
  6558. if (owner && !isDef(factory.owners)) {
  6559. var owners = factory.owners = [owner];
  6560. var sync = true;
  6561. var timerLoading = null;
  6562. var timerTimeout = null
  6563. ;
  6564. (owner).$on('hook:destroyed', function () {
  6565. return remove(owners, owner);
  6566. });
  6567. var forceRender = function (renderCompleted) {
  6568. for (var i = 0, l = owners.length; i < l; i++) {
  6569. (owners[i]).$forceUpdate();
  6570. }
  6571. if (renderCompleted) {
  6572. owners.length = 0;
  6573. if (timerLoading !== null) {
  6574. clearTimeout(timerLoading);
  6575. timerLoading = null;
  6576. }
  6577. if (timerTimeout !== null) {
  6578. clearTimeout(timerTimeout);
  6579. timerTimeout = null;
  6580. }
  6581. }
  6582. };
  6583. var resolve = once(function (res) {
  6584. // cache resolved
  6585. factory.resolved = ensureCtor(res, baseCtor);
  6586. // invoke callbacks only if this is not a synchronous resolve
  6587. // (async resolves are shimmed as synchronous during SSR)
  6588. if (!sync) {
  6589. forceRender(true);
  6590. } else {
  6591. owners.length = 0;
  6592. }
  6593. });
  6594. var reject = once(function (reason) {
  6595. true && warn(
  6596. "Failed to resolve async component: " + (String(factory)) +
  6597. (reason ? ("\nReason: " + reason) : '')
  6598. );
  6599. if (isDef(factory.errorComp)) {
  6600. factory.error = true;
  6601. forceRender(true);
  6602. }
  6603. });
  6604. var res = factory(resolve, reject);
  6605. if (isObject(res)) {
  6606. if (isPromise(res)) {
  6607. // () => Promise
  6608. if (isUndef(factory.resolved)) {
  6609. res.then(resolve, reject);
  6610. }
  6611. } else if (isPromise(res.component)) {
  6612. res.component.then(resolve, reject);
  6613. if (isDef(res.error)) {
  6614. factory.errorComp = ensureCtor(res.error, baseCtor);
  6615. }
  6616. if (isDef(res.loading)) {
  6617. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  6618. if (res.delay === 0) {
  6619. factory.loading = true;
  6620. } else {
  6621. timerLoading = setTimeout(function () {
  6622. timerLoading = null;
  6623. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  6624. factory.loading = true;
  6625. forceRender(false);
  6626. }
  6627. }, res.delay || 200);
  6628. }
  6629. }
  6630. if (isDef(res.timeout)) {
  6631. timerTimeout = setTimeout(function () {
  6632. timerTimeout = null;
  6633. if (isUndef(factory.resolved)) {
  6634. reject(
  6635. true ?
  6636. ("timeout (" + (res.timeout) + "ms)") :
  6637. undefined
  6638. );
  6639. }
  6640. }, res.timeout);
  6641. }
  6642. }
  6643. }
  6644. sync = false;
  6645. // return in case resolved synchronously
  6646. return factory.loading ?
  6647. factory.loadingComp :
  6648. factory.resolved
  6649. }
  6650. }
  6651. /* */
  6652. function isAsyncPlaceholder(node) {
  6653. return node.isComment && node.asyncFactory
  6654. }
  6655. /* */
  6656. function getFirstComponentChild(children) {
  6657. if (Array.isArray(children)) {
  6658. for (var i = 0; i < children.length; i++) {
  6659. var c = children[i];
  6660. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  6661. return c
  6662. }
  6663. }
  6664. }
  6665. }
  6666. /* */
  6667. /* */
  6668. function initEvents(vm) {
  6669. vm._events = Object.create(null);
  6670. vm._hasHookEvent = false;
  6671. // init parent attached events
  6672. var listeners = vm.$options._parentListeners;
  6673. if (listeners) {
  6674. updateComponentListeners(vm, listeners);
  6675. }
  6676. }
  6677. var target;
  6678. function add(event, fn) {
  6679. target.$on(event, fn);
  6680. }
  6681. function remove$1(event, fn) {
  6682. target.$off(event, fn);
  6683. }
  6684. function createOnceHandler(event, fn) {
  6685. var _target = target;
  6686. return function onceHandler() {
  6687. var res = fn.apply(null, arguments);
  6688. if (res !== null) {
  6689. _target.$off(event, onceHandler);
  6690. }
  6691. }
  6692. }
  6693. function updateComponentListeners(
  6694. vm,
  6695. listeners,
  6696. oldListeners
  6697. ) {
  6698. target = vm;
  6699. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  6700. target = undefined;
  6701. }
  6702. function eventsMixin(Vue) {
  6703. var hookRE = /^hook:/;
  6704. Vue.prototype.$on = function (event, fn) {
  6705. var vm = this;
  6706. if (Array.isArray(event)) {
  6707. for (var i = 0, l = event.length; i < l; i++) {
  6708. vm.$on(event[i], fn);
  6709. }
  6710. } else {
  6711. (vm._events[event] || (vm._events[event] = [])).push(fn);
  6712. // optimize hook:event cost by using a boolean flag marked at registration
  6713. // instead of a hash lookup
  6714. if (hookRE.test(event)) {
  6715. vm._hasHookEvent = true;
  6716. }
  6717. }
  6718. return vm
  6719. };
  6720. Vue.prototype.$once = function (event, fn) {
  6721. var vm = this;
  6722. function on() {
  6723. vm.$off(event, on);
  6724. fn.apply(vm, arguments);
  6725. }
  6726. on.fn = fn;
  6727. vm.$on(event, on);
  6728. return vm
  6729. };
  6730. Vue.prototype.$off = function (event, fn) {
  6731. var vm = this;
  6732. // all
  6733. if (!arguments.length) {
  6734. vm._events = Object.create(null);
  6735. return vm
  6736. }
  6737. // array of events
  6738. if (Array.isArray(event)) {
  6739. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  6740. vm.$off(event[i$1], fn);
  6741. }
  6742. return vm
  6743. }
  6744. // specific event
  6745. var cbs = vm._events[event];
  6746. if (!cbs) {
  6747. return vm
  6748. }
  6749. if (!fn) {
  6750. vm._events[event] = null;
  6751. return vm
  6752. }
  6753. // specific handler
  6754. var cb;
  6755. var i = cbs.length;
  6756. while (i--) {
  6757. cb = cbs[i];
  6758. if (cb === fn || cb.fn === fn) {
  6759. cbs.splice(i, 1);
  6760. break
  6761. }
  6762. }
  6763. return vm
  6764. };
  6765. Vue.prototype.$emit = function (event) {
  6766. var vm = this;
  6767. if (true) {
  6768. var lowerCaseEvent = event.toLowerCase();
  6769. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  6770. tip(
  6771. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  6772. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  6773. "Note that HTML attributes are case-insensitive and you cannot use " +
  6774. "v-on to listen to camelCase events when using in-DOM templates. " +
  6775. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  6776. );
  6777. }
  6778. }
  6779. var cbs = vm._events[event];
  6780. if (cbs) {
  6781. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  6782. var args = toArray(arguments, 1);
  6783. var info = "event handler for \"" + event + "\"";
  6784. for (var i = 0, l = cbs.length; i < l; i++) {
  6785. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  6786. }
  6787. }
  6788. return vm
  6789. };
  6790. }
  6791. /* */
  6792. var activeInstance = null;
  6793. var isUpdatingChildComponent = false;
  6794. function setActiveInstance(vm) {
  6795. var prevActiveInstance = activeInstance;
  6796. activeInstance = vm;
  6797. return function () {
  6798. activeInstance = prevActiveInstance;
  6799. }
  6800. }
  6801. function initLifecycle(vm) {
  6802. var options = vm.$options;
  6803. // locate first non-abstract parent
  6804. var parent = options.parent;
  6805. if (parent && !options.abstract) {
  6806. while (parent.$options.abstract && parent.$parent) {
  6807. parent = parent.$parent;
  6808. }
  6809. parent.$children.push(vm);
  6810. }
  6811. vm.$parent = parent;
  6812. vm.$root = parent ? parent.$root : vm;
  6813. vm.$children = [];
  6814. vm.$refs = {};
  6815. vm._watcher = null;
  6816. vm._inactive = null;
  6817. vm._directInactive = false;
  6818. vm._isMounted = false;
  6819. vm._isDestroyed = false;
  6820. vm._isBeingDestroyed = false;
  6821. }
  6822. function lifecycleMixin(Vue) {
  6823. Vue.prototype._update = function (vnode, hydrating) {
  6824. var vm = this;
  6825. var prevEl = vm.$el;
  6826. var prevVnode = vm._vnode;
  6827. var restoreActiveInstance = setActiveInstance(vm);
  6828. vm._vnode = vnode;
  6829. // Vue.prototype.__patch__ is injected in entry points
  6830. // based on the rendering backend used.
  6831. if (!prevVnode) {
  6832. // initial render
  6833. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */ );
  6834. } else {
  6835. // updates
  6836. vm.$el = vm.__patch__(prevVnode, vnode);
  6837. }
  6838. restoreActiveInstance();
  6839. // update __vue__ reference
  6840. if (prevEl) {
  6841. prevEl.__vue__ = null;
  6842. }
  6843. if (vm.$el) {
  6844. vm.$el.__vue__ = vm;
  6845. }
  6846. // if parent is an HOC, update its $el as well
  6847. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  6848. vm.$parent.$el = vm.$el;
  6849. }
  6850. // updated hook is called by the scheduler to ensure that children are
  6851. // updated in a parent's updated hook.
  6852. };
  6853. Vue.prototype.$forceUpdate = function () {
  6854. var vm = this;
  6855. if (vm._watcher) {
  6856. vm._watcher.update();
  6857. }
  6858. };
  6859. Vue.prototype.$destroy = function () {
  6860. var vm = this;
  6861. if (vm._isBeingDestroyed) {
  6862. return
  6863. }
  6864. callHook(vm, 'beforeDestroy');
  6865. vm._isBeingDestroyed = true;
  6866. // remove self from parent
  6867. var parent = vm.$parent;
  6868. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  6869. remove(parent.$children, vm);
  6870. }
  6871. // teardown watchers
  6872. if (vm._watcher) {
  6873. vm._watcher.teardown();
  6874. }
  6875. var i = vm._watchers.length;
  6876. while (i--) {
  6877. vm._watchers[i].teardown();
  6878. }
  6879. // remove reference from data ob
  6880. // frozen object may not have observer.
  6881. if (vm._data.__ob__) {
  6882. vm._data.__ob__.vmCount--;
  6883. }
  6884. // call the last hook...
  6885. vm._isDestroyed = true;
  6886. // invoke destroy hooks on current rendered tree
  6887. vm.__patch__(vm._vnode, null);
  6888. // fire destroyed hook
  6889. callHook(vm, 'destroyed');
  6890. // turn off all instance listeners.
  6891. vm.$off();
  6892. // remove __vue__ reference
  6893. if (vm.$el) {
  6894. vm.$el.__vue__ = null;
  6895. }
  6896. // release circular reference (#6759)
  6897. if (vm.$vnode) {
  6898. vm.$vnode.parent = null;
  6899. }
  6900. };
  6901. }
  6902. function updateChildComponent(
  6903. vm,
  6904. propsData,
  6905. listeners,
  6906. parentVnode,
  6907. renderChildren
  6908. ) {
  6909. if (true) {
  6910. isUpdatingChildComponent = true;
  6911. }
  6912. // determine whether component has slot children
  6913. // we need to do this before overwriting $options._renderChildren.
  6914. // check if there are dynamic scopedSlots (hand-written or compiled but with
  6915. // dynamic slot names). Static scoped slots compiled from template has the
  6916. // "$stable" marker.
  6917. var newScopedSlots = parentVnode.data.scopedSlots;
  6918. var oldScopedSlots = vm.$scopedSlots;
  6919. var hasDynamicScopedSlot = !!(
  6920. (newScopedSlots && !newScopedSlots.$stable) ||
  6921. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  6922. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  6923. );
  6924. // Any static slot children from the parent may have changed during parent's
  6925. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  6926. // update is necessary to ensure correctness.
  6927. var needsForceUpdate = !!(
  6928. renderChildren || // has new static slots
  6929. vm.$options._renderChildren || // has old static slots
  6930. hasDynamicScopedSlot
  6931. );
  6932. vm.$options._parentVnode = parentVnode;
  6933. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  6934. if (vm._vnode) { // update child tree's parent
  6935. vm._vnode.parent = parentVnode;
  6936. }
  6937. vm.$options._renderChildren = renderChildren;
  6938. // update $attrs and $listeners hash
  6939. // these are also reactive so they may trigger child update if the child
  6940. // used them during render
  6941. vm.$attrs = parentVnode.data.attrs || emptyObject;
  6942. vm.$listeners = listeners || emptyObject;
  6943. // update props
  6944. if (propsData && vm.$options.props) {
  6945. toggleObserving(false);
  6946. var props = vm._props;
  6947. var propKeys = vm.$options._propKeys || [];
  6948. for (var i = 0; i < propKeys.length; i++) {
  6949. var key = propKeys[i];
  6950. var propOptions = vm.$options.props; // wtf flow?
  6951. props[key] = validateProp(key, propOptions, propsData, vm);
  6952. }
  6953. toggleObserving(true);
  6954. // keep a copy of raw propsData
  6955. vm.$options.propsData = propsData;
  6956. }
  6957. // fixed by xxxxxx update properties(mp runtime)
  6958. vm._$updateProperties && vm._$updateProperties(vm);
  6959. // update listeners
  6960. listeners = listeners || emptyObject;
  6961. var oldListeners = vm.$options._parentListeners;
  6962. vm.$options._parentListeners = listeners;
  6963. updateComponentListeners(vm, listeners, oldListeners);
  6964. // resolve slots + force update if has children
  6965. if (needsForceUpdate) {
  6966. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  6967. vm.$forceUpdate();
  6968. }
  6969. if (true) {
  6970. isUpdatingChildComponent = false;
  6971. }
  6972. }
  6973. function isInInactiveTree(vm) {
  6974. while (vm && (vm = vm.$parent)) {
  6975. if (vm._inactive) {
  6976. return true
  6977. }
  6978. }
  6979. return false
  6980. }
  6981. function activateChildComponent(vm, direct) {
  6982. if (direct) {
  6983. vm._directInactive = false;
  6984. if (isInInactiveTree(vm)) {
  6985. return
  6986. }
  6987. } else if (vm._directInactive) {
  6988. return
  6989. }
  6990. if (vm._inactive || vm._inactive === null) {
  6991. vm._inactive = false;
  6992. for (var i = 0; i < vm.$children.length; i++) {
  6993. activateChildComponent(vm.$children[i]);
  6994. }
  6995. callHook(vm, 'activated');
  6996. }
  6997. }
  6998. function deactivateChildComponent(vm, direct) {
  6999. if (direct) {
  7000. vm._directInactive = true;
  7001. if (isInInactiveTree(vm)) {
  7002. return
  7003. }
  7004. }
  7005. if (!vm._inactive) {
  7006. vm._inactive = true;
  7007. for (var i = 0; i < vm.$children.length; i++) {
  7008. deactivateChildComponent(vm.$children[i]);
  7009. }
  7010. callHook(vm, 'deactivated');
  7011. }
  7012. }
  7013. function callHook(vm, hook) {
  7014. // #7573 disable dep collection when invoking lifecycle hooks
  7015. pushTarget();
  7016. var handlers = vm.$options[hook];
  7017. var info = hook + " hook";
  7018. if (handlers) {
  7019. for (var i = 0, j = handlers.length; i < j; i++) {
  7020. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  7021. }
  7022. }
  7023. if (vm._hasHookEvent) {
  7024. vm.$emit('hook:' + hook);
  7025. }
  7026. popTarget();
  7027. }
  7028. /* */
  7029. var MAX_UPDATE_COUNT = 100;
  7030. var queue = [];
  7031. var activatedChildren = [];
  7032. var has = {};
  7033. var circular = {};
  7034. var waiting = false;
  7035. var flushing = false;
  7036. var index = 0;
  7037. /**
  7038. * Reset the scheduler's state.
  7039. */
  7040. function resetSchedulerState() {
  7041. index = queue.length = activatedChildren.length = 0;
  7042. has = {};
  7043. if (true) {
  7044. circular = {};
  7045. }
  7046. waiting = flushing = false;
  7047. }
  7048. // Async edge case #6566 requires saving the timestamp when event listeners are
  7049. // attached. However, calling performance.now() has a perf overhead especially
  7050. // if the page has thousands of event listeners. Instead, we take a timestamp
  7051. // every time the scheduler flushes and use that for all event listeners
  7052. // attached during that flush.
  7053. var currentFlushTimestamp = 0;
  7054. // Async edge case fix requires storing an event listener's attach timestamp.
  7055. var getNow = Date.now;
  7056. // Determine what event timestamp the browser is using. Annoyingly, the
  7057. // timestamp can either be hi-res (relative to page load) or low-res
  7058. // (relative to UNIX epoch), so in order to compare time we have to use the
  7059. // same timestamp type when saving the flush timestamp.
  7060. // All IE versions use low-res event timestamps, and have problematic clock
  7061. // implementations (#9632)
  7062. if (inBrowser && !isIE) {
  7063. var performance = window.performance;
  7064. if (
  7065. performance &&
  7066. typeof performance.now === 'function' &&
  7067. getNow() > document.createEvent('Event').timeStamp
  7068. ) {
  7069. // if the event timestamp, although evaluated AFTER the Date.now(), is
  7070. // smaller than it, it means the event is using a hi-res timestamp,
  7071. // and we need to use the hi-res version for event listener timestamps as
  7072. // well.
  7073. getNow = function () {
  7074. return performance.now();
  7075. };
  7076. }
  7077. }
  7078. /**
  7079. * Flush both queues and run the watchers.
  7080. */
  7081. function flushSchedulerQueue() {
  7082. currentFlushTimestamp = getNow();
  7083. flushing = true;
  7084. var watcher, id;
  7085. // Sort queue before flush.
  7086. // This ensures that:
  7087. // 1. Components are updated from parent to child. (because parent is always
  7088. // created before the child)
  7089. // 2. A component's user watchers are run before its render watcher (because
  7090. // user watchers are created before the render watcher)
  7091. // 3. If a component is destroyed during a parent component's watcher run,
  7092. // its watchers can be skipped.
  7093. queue.sort(function (a, b) {
  7094. return a.id - b.id;
  7095. });
  7096. // do not cache length because more watchers might be pushed
  7097. // as we run existing watchers
  7098. for (index = 0; index < queue.length; index++) {
  7099. watcher = queue[index];
  7100. if (watcher.before) {
  7101. watcher.before();
  7102. }
  7103. id = watcher.id;
  7104. has[id] = null;
  7105. watcher.run();
  7106. // in dev build, check and stop circular updates.
  7107. if (true && has[id] != null) {
  7108. circular[id] = (circular[id] || 0) + 1;
  7109. if (circular[id] > MAX_UPDATE_COUNT) {
  7110. warn(
  7111. 'You may have an infinite update loop ' + (
  7112. watcher.user ?
  7113. ("in watcher with expression \"" + (watcher.expression) + "\"") :
  7114. "in a component render function."
  7115. ),
  7116. watcher.vm
  7117. );
  7118. break
  7119. }
  7120. }
  7121. }
  7122. // keep copies of post queues before resetting state
  7123. var activatedQueue = activatedChildren.slice();
  7124. var updatedQueue = queue.slice();
  7125. resetSchedulerState();
  7126. // call component updated and activated hooks
  7127. callActivatedHooks(activatedQueue);
  7128. callUpdatedHooks(updatedQueue);
  7129. // devtool hook
  7130. /* istanbul ignore if */
  7131. if (devtools && config.devtools) {
  7132. devtools.emit('flush');
  7133. }
  7134. }
  7135. function callUpdatedHooks(queue) {
  7136. var i = queue.length;
  7137. while (i--) {
  7138. var watcher = queue[i];
  7139. var vm = watcher.vm;
  7140. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  7141. callHook(vm, 'updated');
  7142. }
  7143. }
  7144. }
  7145. /**
  7146. * Queue a kept-alive component that was activated during patch.
  7147. * The queue will be processed after the entire tree has been patched.
  7148. */
  7149. function queueActivatedComponent(vm) {
  7150. // setting _inactive to false here so that a render function can
  7151. // rely on checking whether it's in an inactive tree (e.g. router-view)
  7152. vm._inactive = false;
  7153. activatedChildren.push(vm);
  7154. }
  7155. function callActivatedHooks(queue) {
  7156. for (var i = 0; i < queue.length; i++) {
  7157. queue[i]._inactive = true;
  7158. activateChildComponent(queue[i], true /* true */ );
  7159. }
  7160. }
  7161. /**
  7162. * Push a watcher into the watcher queue.
  7163. * Jobs with duplicate IDs will be skipped unless it's
  7164. * pushed when the queue is being flushed.
  7165. */
  7166. function queueWatcher(watcher) {
  7167. var id = watcher.id;
  7168. if (has[id] == null) {
  7169. has[id] = true;
  7170. if (!flushing) {
  7171. queue.push(watcher);
  7172. } else {
  7173. // if already flushing, splice the watcher based on its id
  7174. // if already past its id, it will be run next immediately.
  7175. var i = queue.length - 1;
  7176. while (i > index && queue[i].id > watcher.id) {
  7177. i--;
  7178. }
  7179. queue.splice(i + 1, 0, watcher);
  7180. }
  7181. // queue the flush
  7182. if (!waiting) {
  7183. waiting = true;
  7184. if (true && !config.async) {
  7185. flushSchedulerQueue();
  7186. return
  7187. }
  7188. nextTick(flushSchedulerQueue);
  7189. }
  7190. }
  7191. }
  7192. /* */
  7193. var uid$2 = 0;
  7194. /**
  7195. * A watcher parses an expression, collects dependencies,
  7196. * and fires callback when the expression value changes.
  7197. * This is used for both the $watch() api and directives.
  7198. */
  7199. var Watcher = function Watcher(
  7200. vm,
  7201. expOrFn,
  7202. cb,
  7203. options,
  7204. isRenderWatcher
  7205. ) {
  7206. this.vm = vm;
  7207. if (isRenderWatcher) {
  7208. vm._watcher = this;
  7209. }
  7210. vm._watchers.push(this);
  7211. // options
  7212. if (options) {
  7213. this.deep = !!options.deep;
  7214. this.user = !!options.user;
  7215. this.lazy = !!options.lazy;
  7216. this.sync = !!options.sync;
  7217. this.before = options.before;
  7218. } else {
  7219. this.deep = this.user = this.lazy = this.sync = false;
  7220. }
  7221. this.cb = cb;
  7222. this.id = ++uid$2; // uid for batching
  7223. this.active = true;
  7224. this.dirty = this.lazy; // for lazy watchers
  7225. this.deps = [];
  7226. this.newDeps = [];
  7227. this.depIds = new _Set();
  7228. this.newDepIds = new _Set();
  7229. this.expression = true ?
  7230. expOrFn.toString() :
  7231. undefined;
  7232. // parse expression for getter
  7233. if (typeof expOrFn === 'function') {
  7234. this.getter = expOrFn;
  7235. } else {
  7236. this.getter = parsePath(expOrFn);
  7237. if (!this.getter) {
  7238. this.getter = noop;
  7239. true && warn(
  7240. "Failed watching path: \"" + expOrFn + "\" " +
  7241. 'Watcher only accepts simple dot-delimited paths. ' +
  7242. 'For full control, use a function instead.',
  7243. vm
  7244. );
  7245. }
  7246. }
  7247. this.value = this.lazy ?
  7248. undefined :
  7249. this.get();
  7250. };
  7251. /**
  7252. * Evaluate the getter, and re-collect dependencies.
  7253. */
  7254. Watcher.prototype.get = function get() {
  7255. pushTarget(this);
  7256. var value;
  7257. var vm = this.vm;
  7258. try {
  7259. value = this.getter.call(vm, vm);
  7260. } catch (e) {
  7261. if (this.user) {
  7262. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  7263. } else {
  7264. throw e
  7265. }
  7266. } finally {
  7267. // "touch" every property so they are all tracked as
  7268. // dependencies for deep watching
  7269. if (this.deep) {
  7270. traverse(value);
  7271. }
  7272. popTarget();
  7273. this.cleanupDeps();
  7274. }
  7275. return value
  7276. };
  7277. /**
  7278. * Add a dependency to this directive.
  7279. */
  7280. Watcher.prototype.addDep = function addDep(dep) {
  7281. var id = dep.id;
  7282. if (!this.newDepIds.has(id)) {
  7283. this.newDepIds.add(id);
  7284. this.newDeps.push(dep);
  7285. if (!this.depIds.has(id)) {
  7286. dep.addSub(this);
  7287. }
  7288. }
  7289. };
  7290. /**
  7291. * Clean up for dependency collection.
  7292. */
  7293. Watcher.prototype.cleanupDeps = function cleanupDeps() {
  7294. var i = this.deps.length;
  7295. while (i--) {
  7296. var dep = this.deps[i];
  7297. if (!this.newDepIds.has(dep.id)) {
  7298. dep.removeSub(this);
  7299. }
  7300. }
  7301. var tmp = this.depIds;
  7302. this.depIds = this.newDepIds;
  7303. this.newDepIds = tmp;
  7304. this.newDepIds.clear();
  7305. tmp = this.deps;
  7306. this.deps = this.newDeps;
  7307. this.newDeps = tmp;
  7308. this.newDeps.length = 0;
  7309. };
  7310. /**
  7311. * Subscriber interface.
  7312. * Will be called when a dependency changes.
  7313. */
  7314. Watcher.prototype.update = function update() {
  7315. /* istanbul ignore else */
  7316. if (this.lazy) {
  7317. this.dirty = true;
  7318. } else if (this.sync) {
  7319. this.run();
  7320. } else {
  7321. queueWatcher(this);
  7322. }
  7323. };
  7324. /**
  7325. * Scheduler job interface.
  7326. * Will be called by the scheduler.
  7327. */
  7328. Watcher.prototype.run = function run() {
  7329. if (this.active) {
  7330. var value = this.get();
  7331. if (
  7332. value !== this.value ||
  7333. // Deep watchers and watchers on Object/Arrays should fire even
  7334. // when the value is the same, because the value may
  7335. // have mutated.
  7336. isObject(value) ||
  7337. this.deep
  7338. ) {
  7339. // set new value
  7340. var oldValue = this.value;
  7341. this.value = value;
  7342. if (this.user) {
  7343. try {
  7344. this.cb.call(this.vm, value, oldValue);
  7345. } catch (e) {
  7346. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  7347. }
  7348. } else {
  7349. this.cb.call(this.vm, value, oldValue);
  7350. }
  7351. }
  7352. }
  7353. };
  7354. /**
  7355. * Evaluate the value of the watcher.
  7356. * This only gets called for lazy watchers.
  7357. */
  7358. Watcher.prototype.evaluate = function evaluate() {
  7359. this.value = this.get();
  7360. this.dirty = false;
  7361. };
  7362. /**
  7363. * Depend on all deps collected by this watcher.
  7364. */
  7365. Watcher.prototype.depend = function depend() {
  7366. var i = this.deps.length;
  7367. while (i--) {
  7368. this.deps[i].depend();
  7369. }
  7370. };
  7371. /**
  7372. * Remove self from all dependencies' subscriber list.
  7373. */
  7374. Watcher.prototype.teardown = function teardown() {
  7375. if (this.active) {
  7376. // remove self from vm's watcher list
  7377. // this is a somewhat expensive operation so we skip it
  7378. // if the vm is being destroyed.
  7379. if (!this.vm._isBeingDestroyed) {
  7380. remove(this.vm._watchers, this);
  7381. }
  7382. var i = this.deps.length;
  7383. while (i--) {
  7384. this.deps[i].removeSub(this);
  7385. }
  7386. this.active = false;
  7387. }
  7388. };
  7389. /* */
  7390. var sharedPropertyDefinition = {
  7391. enumerable: true,
  7392. configurable: true,
  7393. get: noop,
  7394. set: noop
  7395. };
  7396. function proxy(target, sourceKey, key) {
  7397. sharedPropertyDefinition.get = function proxyGetter() {
  7398. return this[sourceKey][key]
  7399. };
  7400. sharedPropertyDefinition.set = function proxySetter(val) {
  7401. this[sourceKey][key] = val;
  7402. };
  7403. Object.defineProperty(target, key, sharedPropertyDefinition);
  7404. }
  7405. function initState(vm) {
  7406. vm._watchers = [];
  7407. var opts = vm.$options;
  7408. if (opts.props) {
  7409. initProps(vm, opts.props);
  7410. }
  7411. if (opts.methods) {
  7412. initMethods(vm, opts.methods);
  7413. }
  7414. if (opts.data) {
  7415. initData(vm);
  7416. } else {
  7417. observe(vm._data = {}, true /* asRootData */ );
  7418. }
  7419. if (opts.computed) {
  7420. initComputed(vm, opts.computed);
  7421. }
  7422. if (opts.watch && opts.watch !== nativeWatch) {
  7423. initWatch(vm, opts.watch);
  7424. }
  7425. }
  7426. function initProps(vm, propsOptions) {
  7427. var propsData = vm.$options.propsData || {};
  7428. var props = vm._props = {};
  7429. // cache prop keys so that future props updates can iterate using Array
  7430. // instead of dynamic object key enumeration.
  7431. var keys = vm.$options._propKeys = [];
  7432. var isRoot = !vm.$parent;
  7433. // root instance props should be converted
  7434. if (!isRoot) {
  7435. toggleObserving(false);
  7436. }
  7437. var loop = function (key) {
  7438. keys.push(key);
  7439. var value = validateProp(key, propsOptions, propsData, vm);
  7440. /* istanbul ignore else */
  7441. if (true) {
  7442. var hyphenatedKey = hyphenate(key);
  7443. if (isReservedAttribute(hyphenatedKey) ||
  7444. config.isReservedAttr(hyphenatedKey)) {
  7445. warn(
  7446. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  7447. vm
  7448. );
  7449. }
  7450. defineReactive$$1(props, key, value, function () {
  7451. if (!isRoot && !isUpdatingChildComponent) {
  7452. {
  7453. if (vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs') { //百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  7454. return
  7455. }
  7456. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  7457. if (
  7458. key === 'value' &&
  7459. Array.isArray(vm.$options.behaviors) &&
  7460. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  7461. ) {
  7462. return
  7463. }
  7464. if (vm._getFormData) {
  7465. return
  7466. }
  7467. var $parent = vm.$parent;
  7468. while ($parent) {
  7469. if ($parent.__next_tick_pending) {
  7470. return
  7471. }
  7472. $parent = $parent.$parent;
  7473. }
  7474. }
  7475. warn(
  7476. "Avoid mutating a prop directly since the value will be " +
  7477. "overwritten whenever the parent component re-renders. " +
  7478. "Instead, use a data or computed property based on the prop's " +
  7479. "value. Prop being mutated: \"" + key + "\"",
  7480. vm
  7481. );
  7482. }
  7483. });
  7484. } else {}
  7485. // static props are already proxied on the component's prototype
  7486. // during Vue.extend(). We only need to proxy props defined at
  7487. // instantiation here.
  7488. if (!(key in vm)) {
  7489. proxy(vm, "_props", key);
  7490. }
  7491. };
  7492. for (var key in propsOptions) loop(key);
  7493. toggleObserving(true);
  7494. }
  7495. function initData(vm) {
  7496. var data = vm.$options.data;
  7497. data = vm._data = typeof data === 'function' ?
  7498. getData(data, vm) :
  7499. data || {};
  7500. if (!isPlainObject(data)) {
  7501. data = {};
  7502. true && warn(
  7503. 'data functions should return an object:\n' +
  7504. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  7505. vm
  7506. );
  7507. }
  7508. // proxy data on instance
  7509. var keys = Object.keys(data);
  7510. var props = vm.$options.props;
  7511. var methods = vm.$options.methods;
  7512. var i = keys.length;
  7513. while (i--) {
  7514. var key = keys[i];
  7515. if (true) {
  7516. if (methods && hasOwn(methods, key)) {
  7517. warn(
  7518. ("Method \"" + key + "\" has already been defined as a data property."),
  7519. vm
  7520. );
  7521. }
  7522. }
  7523. if (props && hasOwn(props, key)) {
  7524. true && warn(
  7525. "The data property \"" + key + "\" is already declared as a prop. " +
  7526. "Use prop default value instead.",
  7527. vm
  7528. );
  7529. } else if (!isReserved(key)) {
  7530. proxy(vm, "_data", key);
  7531. }
  7532. }
  7533. // observe data
  7534. observe(data, true /* asRootData */ );
  7535. }
  7536. function getData(data, vm) {
  7537. // #7573 disable dep collection when invoking data getters
  7538. pushTarget();
  7539. try {
  7540. return data.call(vm, vm)
  7541. } catch (e) {
  7542. handleError(e, vm, "data()");
  7543. return {}
  7544. } finally {
  7545. popTarget();
  7546. }
  7547. }
  7548. var computedWatcherOptions = {
  7549. lazy: true
  7550. };
  7551. function initComputed(vm, computed) {
  7552. // $flow-disable-line
  7553. var watchers = vm._computedWatchers = Object.create(null);
  7554. // computed properties are just getters during SSR
  7555. var isSSR = isServerRendering();
  7556. for (var key in computed) {
  7557. var userDef = computed[key];
  7558. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  7559. if (true && getter == null) {
  7560. warn(
  7561. ("Getter is missing for computed property \"" + key + "\"."),
  7562. vm
  7563. );
  7564. }
  7565. if (!isSSR) {
  7566. // create internal watcher for the computed property.
  7567. watchers[key] = new Watcher(
  7568. vm,
  7569. getter || noop,
  7570. noop,
  7571. computedWatcherOptions
  7572. );
  7573. }
  7574. // component-defined computed properties are already defined on the
  7575. // component prototype. We only need to define computed properties defined
  7576. // at instantiation here.
  7577. if (!(key in vm)) {
  7578. defineComputed(vm, key, userDef);
  7579. } else if (true) {
  7580. if (key in vm.$data) {
  7581. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  7582. } else if (vm.$options.props && key in vm.$options.props) {
  7583. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  7584. }
  7585. }
  7586. }
  7587. }
  7588. function defineComputed(
  7589. target,
  7590. key,
  7591. userDef
  7592. ) {
  7593. var shouldCache = !isServerRendering();
  7594. if (typeof userDef === 'function') {
  7595. sharedPropertyDefinition.get = shouldCache ?
  7596. createComputedGetter(key) :
  7597. createGetterInvoker(userDef);
  7598. sharedPropertyDefinition.set = noop;
  7599. } else {
  7600. sharedPropertyDefinition.get = userDef.get ?
  7601. shouldCache && userDef.cache !== false ?
  7602. createComputedGetter(key) :
  7603. createGetterInvoker(userDef.get) :
  7604. noop;
  7605. sharedPropertyDefinition.set = userDef.set || noop;
  7606. }
  7607. if (true &&
  7608. sharedPropertyDefinition.set === noop) {
  7609. sharedPropertyDefinition.set = function () {
  7610. warn(
  7611. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  7612. this
  7613. );
  7614. };
  7615. }
  7616. Object.defineProperty(target, key, sharedPropertyDefinition);
  7617. }
  7618. function createComputedGetter(key) {
  7619. return function computedGetter() {
  7620. var watcher = this._computedWatchers && this._computedWatchers[key];
  7621. if (watcher) {
  7622. if (watcher.dirty) {
  7623. watcher.evaluate();
  7624. }
  7625. if (Dep.SharedObject.target) { // fixed by xxxxxx
  7626. watcher.depend();
  7627. }
  7628. return watcher.value
  7629. }
  7630. }
  7631. }
  7632. function createGetterInvoker(fn) {
  7633. return function computedGetter() {
  7634. return fn.call(this, this)
  7635. }
  7636. }
  7637. function initMethods(vm, methods) {
  7638. var props = vm.$options.props;
  7639. for (var key in methods) {
  7640. if (true) {
  7641. if (typeof methods[key] !== 'function') {
  7642. warn(
  7643. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  7644. "Did you reference the function correctly?",
  7645. vm
  7646. );
  7647. }
  7648. if (props && hasOwn(props, key)) {
  7649. warn(
  7650. ("Method \"" + key + "\" has already been defined as a prop."),
  7651. vm
  7652. );
  7653. }
  7654. if ((key in vm) && isReserved(key)) {
  7655. warn(
  7656. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  7657. "Avoid defining component methods that start with _ or $."
  7658. );
  7659. }
  7660. }
  7661. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  7662. }
  7663. }
  7664. function initWatch(vm, watch) {
  7665. for (var key in watch) {
  7666. var handler = watch[key];
  7667. if (Array.isArray(handler)) {
  7668. for (var i = 0; i < handler.length; i++) {
  7669. createWatcher(vm, key, handler[i]);
  7670. }
  7671. } else {
  7672. createWatcher(vm, key, handler);
  7673. }
  7674. }
  7675. }
  7676. function createWatcher(
  7677. vm,
  7678. expOrFn,
  7679. handler,
  7680. options
  7681. ) {
  7682. if (isPlainObject(handler)) {
  7683. options = handler;
  7684. handler = handler.handler;
  7685. }
  7686. if (typeof handler === 'string') {
  7687. handler = vm[handler];
  7688. }
  7689. return vm.$watch(expOrFn, handler, options)
  7690. }
  7691. function stateMixin(Vue) {
  7692. // flow somehow has problems with directly declared definition object
  7693. // when using Object.defineProperty, so we have to procedurally build up
  7694. // the object here.
  7695. var dataDef = {};
  7696. dataDef.get = function () {
  7697. return this._data
  7698. };
  7699. var propsDef = {};
  7700. propsDef.get = function () {
  7701. return this._props
  7702. };
  7703. if (true) {
  7704. dataDef.set = function () {
  7705. warn(
  7706. 'Avoid replacing instance root $data. ' +
  7707. 'Use nested data properties instead.',
  7708. this
  7709. );
  7710. };
  7711. propsDef.set = function () {
  7712. warn("$props is readonly.", this);
  7713. };
  7714. }
  7715. Object.defineProperty(Vue.prototype, '$data', dataDef);
  7716. Object.defineProperty(Vue.prototype, '$props', propsDef);
  7717. Vue.prototype.$set = set;
  7718. Vue.prototype.$delete = del;
  7719. Vue.prototype.$watch = function (
  7720. expOrFn,
  7721. cb,
  7722. options
  7723. ) {
  7724. var vm = this;
  7725. if (isPlainObject(cb)) {
  7726. return createWatcher(vm, expOrFn, cb, options)
  7727. }
  7728. options = options || {};
  7729. options.user = true;
  7730. var watcher = new Watcher(vm, expOrFn, cb, options);
  7731. if (options.immediate) {
  7732. try {
  7733. cb.call(vm, watcher.value);
  7734. } catch (error) {
  7735. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  7736. }
  7737. }
  7738. return function unwatchFn() {
  7739. watcher.teardown();
  7740. }
  7741. };
  7742. }
  7743. /* */
  7744. var uid$3 = 0;
  7745. function initMixin(Vue) {
  7746. Vue.prototype._init = function (options) {
  7747. var vm = this;
  7748. // a uid
  7749. vm._uid = uid$3++;
  7750. var startTag, endTag;
  7751. /* istanbul ignore if */
  7752. if (true && config.performance && mark) {
  7753. startTag = "vue-perf-start:" + (vm._uid);
  7754. endTag = "vue-perf-end:" + (vm._uid);
  7755. mark(startTag);
  7756. }
  7757. // a flag to avoid this being observed
  7758. vm._isVue = true;
  7759. // merge options
  7760. if (options && options._isComponent) {
  7761. // optimize internal component instantiation
  7762. // since dynamic options merging is pretty slow, and none of the
  7763. // internal component options needs special treatment.
  7764. initInternalComponent(vm, options);
  7765. } else {
  7766. vm.$options = mergeOptions(
  7767. resolveConstructorOptions(vm.constructor),
  7768. options || {},
  7769. vm
  7770. );
  7771. }
  7772. /* istanbul ignore else */
  7773. if (true) {
  7774. initProxy(vm);
  7775. } else {}
  7776. // expose real self
  7777. vm._self = vm;
  7778. initLifecycle(vm);
  7779. initEvents(vm);
  7780. initRender(vm);
  7781. callHook(vm, 'beforeCreate');
  7782. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  7783. initState(vm);
  7784. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  7785. !vm._$fallback && callHook(vm, 'created');
  7786. /* istanbul ignore if */
  7787. if (true && config.performance && mark) {
  7788. vm._name = formatComponentName(vm, false);
  7789. mark(endTag);
  7790. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  7791. }
  7792. if (vm.$options.el) {
  7793. vm.$mount(vm.$options.el);
  7794. }
  7795. };
  7796. }
  7797. function initInternalComponent(vm, options) {
  7798. var opts = vm.$options = Object.create(vm.constructor.options);
  7799. // doing this because it's faster than dynamic enumeration.
  7800. var parentVnode = options._parentVnode;
  7801. opts.parent = options.parent;
  7802. opts._parentVnode = parentVnode;
  7803. var vnodeComponentOptions = parentVnode.componentOptions;
  7804. opts.propsData = vnodeComponentOptions.propsData;
  7805. opts._parentListeners = vnodeComponentOptions.listeners;
  7806. opts._renderChildren = vnodeComponentOptions.children;
  7807. opts._componentTag = vnodeComponentOptions.tag;
  7808. if (options.render) {
  7809. opts.render = options.render;
  7810. opts.staticRenderFns = options.staticRenderFns;
  7811. }
  7812. }
  7813. function resolveConstructorOptions(Ctor) {
  7814. var options = Ctor.options;
  7815. if (Ctor.super) {
  7816. var superOptions = resolveConstructorOptions(Ctor.super);
  7817. var cachedSuperOptions = Ctor.superOptions;
  7818. if (superOptions !== cachedSuperOptions) {
  7819. // super option changed,
  7820. // need to resolve new options.
  7821. Ctor.superOptions = superOptions;
  7822. // check if there are any late-modified/attached options (#4976)
  7823. var modifiedOptions = resolveModifiedOptions(Ctor);
  7824. // update base extend options
  7825. if (modifiedOptions) {
  7826. extend(Ctor.extendOptions, modifiedOptions);
  7827. }
  7828. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  7829. if (options.name) {
  7830. options.components[options.name] = Ctor;
  7831. }
  7832. }
  7833. }
  7834. return options
  7835. }
  7836. function resolveModifiedOptions(Ctor) {
  7837. var modified;
  7838. var latest = Ctor.options;
  7839. var sealed = Ctor.sealedOptions;
  7840. for (var key in latest) {
  7841. if (latest[key] !== sealed[key]) {
  7842. if (!modified) {
  7843. modified = {};
  7844. }
  7845. modified[key] = latest[key];
  7846. }
  7847. }
  7848. return modified
  7849. }
  7850. function Vue(options) {
  7851. if (true &&
  7852. !(this instanceof Vue)
  7853. ) {
  7854. warn('Vue is a constructor and should be called with the `new` keyword');
  7855. }
  7856. this._init(options);
  7857. }
  7858. initMixin(Vue);
  7859. stateMixin(Vue);
  7860. eventsMixin(Vue);
  7861. lifecycleMixin(Vue);
  7862. renderMixin(Vue);
  7863. /* */
  7864. function initUse(Vue) {
  7865. Vue.use = function (plugin) {
  7866. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  7867. if (installedPlugins.indexOf(plugin) > -1) {
  7868. return this
  7869. }
  7870. // additional parameters
  7871. var args = toArray(arguments, 1);
  7872. args.unshift(this);
  7873. if (typeof plugin.install === 'function') {
  7874. plugin.install.apply(plugin, args);
  7875. } else if (typeof plugin === 'function') {
  7876. plugin.apply(null, args);
  7877. }
  7878. installedPlugins.push(plugin);
  7879. return this
  7880. };
  7881. }
  7882. /* */
  7883. function initMixin$1(Vue) {
  7884. Vue.mixin = function (mixin) {
  7885. this.options = mergeOptions(this.options, mixin);
  7886. return this
  7887. };
  7888. }
  7889. /* */
  7890. function initExtend(Vue) {
  7891. /**
  7892. * Each instance constructor, including Vue, has a unique
  7893. * cid. This enables us to create wrapped "child
  7894. * constructors" for prototypal inheritance and cache them.
  7895. */
  7896. Vue.cid = 0;
  7897. var cid = 1;
  7898. /**
  7899. * Class inheritance
  7900. */
  7901. Vue.extend = function (extendOptions) {
  7902. extendOptions = extendOptions || {};
  7903. var Super = this;
  7904. var SuperId = Super.cid;
  7905. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  7906. if (cachedCtors[SuperId]) {
  7907. return cachedCtors[SuperId]
  7908. }
  7909. var name = extendOptions.name || Super.options.name;
  7910. if (true && name) {
  7911. validateComponentName(name);
  7912. }
  7913. var Sub = function VueComponent(options) {
  7914. this._init(options);
  7915. };
  7916. Sub.prototype = Object.create(Super.prototype);
  7917. Sub.prototype.constructor = Sub;
  7918. Sub.cid = cid++;
  7919. Sub.options = mergeOptions(
  7920. Super.options,
  7921. extendOptions
  7922. );
  7923. Sub['super'] = Super;
  7924. // For props and computed properties, we define the proxy getters on
  7925. // the Vue instances at extension time, on the extended prototype. This
  7926. // avoids Object.defineProperty calls for each instance created.
  7927. if (Sub.options.props) {
  7928. initProps$1(Sub);
  7929. }
  7930. if (Sub.options.computed) {
  7931. initComputed$1(Sub);
  7932. }
  7933. // allow further extension/mixin/plugin usage
  7934. Sub.extend = Super.extend;
  7935. Sub.mixin = Super.mixin;
  7936. Sub.use = Super.use;
  7937. // create asset registers, so extended classes
  7938. // can have their private assets too.
  7939. ASSET_TYPES.forEach(function (type) {
  7940. Sub[type] = Super[type];
  7941. });
  7942. // enable recursive self-lookup
  7943. if (name) {
  7944. Sub.options.components[name] = Sub;
  7945. }
  7946. // keep a reference to the super options at extension time.
  7947. // later at instantiation we can check if Super's options have
  7948. // been updated.
  7949. Sub.superOptions = Super.options;
  7950. Sub.extendOptions = extendOptions;
  7951. Sub.sealedOptions = extend({}, Sub.options);
  7952. // cache constructor
  7953. cachedCtors[SuperId] = Sub;
  7954. return Sub
  7955. };
  7956. }
  7957. function initProps$1(Comp) {
  7958. var props = Comp.options.props;
  7959. for (var key in props) {
  7960. proxy(Comp.prototype, "_props", key);
  7961. }
  7962. }
  7963. function initComputed$1(Comp) {
  7964. var computed = Comp.options.computed;
  7965. for (var key in computed) {
  7966. defineComputed(Comp.prototype, key, computed[key]);
  7967. }
  7968. }
  7969. /* */
  7970. function initAssetRegisters(Vue) {
  7971. /**
  7972. * Create asset registration methods.
  7973. */
  7974. ASSET_TYPES.forEach(function (type) {
  7975. Vue[type] = function (
  7976. id,
  7977. definition
  7978. ) {
  7979. if (!definition) {
  7980. return this.options[type + 's'][id]
  7981. } else {
  7982. /* istanbul ignore if */
  7983. if (true && type === 'component') {
  7984. validateComponentName(id);
  7985. }
  7986. if (type === 'component' && isPlainObject(definition)) {
  7987. definition.name = definition.name || id;
  7988. definition = this.options._base.extend(definition);
  7989. }
  7990. if (type === 'directive' && typeof definition === 'function') {
  7991. definition = {
  7992. bind: definition,
  7993. update: definition
  7994. };
  7995. }
  7996. this.options[type + 's'][id] = definition;
  7997. return definition
  7998. }
  7999. };
  8000. });
  8001. }
  8002. /* */
  8003. function getComponentName(opts) {
  8004. return opts && (opts.Ctor.options.name || opts.tag)
  8005. }
  8006. function matches(pattern, name) {
  8007. if (Array.isArray(pattern)) {
  8008. return pattern.indexOf(name) > -1
  8009. } else if (typeof pattern === 'string') {
  8010. return pattern.split(',').indexOf(name) > -1
  8011. } else if (isRegExp(pattern)) {
  8012. return pattern.test(name)
  8013. }
  8014. /* istanbul ignore next */
  8015. return false
  8016. }
  8017. function pruneCache(keepAliveInstance, filter) {
  8018. var cache = keepAliveInstance.cache;
  8019. var keys = keepAliveInstance.keys;
  8020. var _vnode = keepAliveInstance._vnode;
  8021. for (var key in cache) {
  8022. var cachedNode = cache[key];
  8023. if (cachedNode) {
  8024. var name = getComponentName(cachedNode.componentOptions);
  8025. if (name && !filter(name)) {
  8026. pruneCacheEntry(cache, key, keys, _vnode);
  8027. }
  8028. }
  8029. }
  8030. }
  8031. function pruneCacheEntry(
  8032. cache,
  8033. key,
  8034. keys,
  8035. current
  8036. ) {
  8037. var cached$$1 = cache[key];
  8038. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  8039. cached$$1.componentInstance.$destroy();
  8040. }
  8041. cache[key] = null;
  8042. remove(keys, key);
  8043. }
  8044. var patternTypes = [String, RegExp, Array];
  8045. var KeepAlive = {
  8046. name: 'keep-alive',
  8047. abstract: true,
  8048. props: {
  8049. include: patternTypes,
  8050. exclude: patternTypes,
  8051. max: [String, Number]
  8052. },
  8053. created: function created() {
  8054. this.cache = Object.create(null);
  8055. this.keys = [];
  8056. },
  8057. destroyed: function destroyed() {
  8058. for (var key in this.cache) {
  8059. pruneCacheEntry(this.cache, key, this.keys);
  8060. }
  8061. },
  8062. mounted: function mounted() {
  8063. var this$1 = this;
  8064. this.$watch('include', function (val) {
  8065. pruneCache(this$1, function (name) {
  8066. return matches(val, name);
  8067. });
  8068. });
  8069. this.$watch('exclude', function (val) {
  8070. pruneCache(this$1, function (name) {
  8071. return !matches(val, name);
  8072. });
  8073. });
  8074. },
  8075. render: function render() {
  8076. var slot = this.$slots.default;
  8077. var vnode = getFirstComponentChild(slot);
  8078. var componentOptions = vnode && vnode.componentOptions;
  8079. if (componentOptions) {
  8080. // check pattern
  8081. var name = getComponentName(componentOptions);
  8082. var ref = this;
  8083. var include = ref.include;
  8084. var exclude = ref.exclude;
  8085. if (
  8086. // not included
  8087. (include && (!name || !matches(include, name))) ||
  8088. // excluded
  8089. (exclude && name && matches(exclude, name))
  8090. ) {
  8091. return vnode
  8092. }
  8093. var ref$1 = this;
  8094. var cache = ref$1.cache;
  8095. var keys = ref$1.keys;
  8096. var key = vnode.key == null
  8097. // same constructor may get registered as different local components
  8098. // so cid alone is not enough (#3269)
  8099. ?
  8100. componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '') :
  8101. vnode.key;
  8102. if (cache[key]) {
  8103. vnode.componentInstance = cache[key].componentInstance;
  8104. // make current key freshest
  8105. remove(keys, key);
  8106. keys.push(key);
  8107. } else {
  8108. cache[key] = vnode;
  8109. keys.push(key);
  8110. // prune oldest entry
  8111. if (this.max && keys.length > parseInt(this.max)) {
  8112. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  8113. }
  8114. }
  8115. vnode.data.keepAlive = true;
  8116. }
  8117. return vnode || (slot && slot[0])
  8118. }
  8119. };
  8120. var builtInComponents = {
  8121. KeepAlive: KeepAlive
  8122. };
  8123. /* */
  8124. function initGlobalAPI(Vue) {
  8125. // config
  8126. var configDef = {};
  8127. configDef.get = function () {
  8128. return config;
  8129. };
  8130. if (true) {
  8131. configDef.set = function () {
  8132. warn(
  8133. 'Do not replace the Vue.config object, set individual fields instead.'
  8134. );
  8135. };
  8136. }
  8137. Object.defineProperty(Vue, 'config', configDef);
  8138. // exposed util methods.
  8139. // NOTE: these are not considered part of the public API - avoid relying on
  8140. // them unless you are aware of the risk.
  8141. Vue.util = {
  8142. warn: warn,
  8143. extend: extend,
  8144. mergeOptions: mergeOptions,
  8145. defineReactive: defineReactive$$1
  8146. };
  8147. Vue.set = set;
  8148. Vue.delete = del;
  8149. Vue.nextTick = nextTick;
  8150. // 2.6 explicit observable API
  8151. Vue.observable = function (obj) {
  8152. observe(obj);
  8153. return obj
  8154. };
  8155. Vue.options = Object.create(null);
  8156. ASSET_TYPES.forEach(function (type) {
  8157. Vue.options[type + 's'] = Object.create(null);
  8158. });
  8159. // this is used to identify the "base" constructor to extend all plain-object
  8160. // components with in Weex's multi-instance scenarios.
  8161. Vue.options._base = Vue;
  8162. extend(Vue.options.components, builtInComponents);
  8163. initUse(Vue);
  8164. initMixin$1(Vue);
  8165. initExtend(Vue);
  8166. initAssetRegisters(Vue);
  8167. }
  8168. initGlobalAPI(Vue);
  8169. Object.defineProperty(Vue.prototype, '$isServer', {
  8170. get: isServerRendering
  8171. });
  8172. Object.defineProperty(Vue.prototype, '$ssrContext', {
  8173. get: function get() {
  8174. /* istanbul ignore next */
  8175. return this.$vnode && this.$vnode.ssrContext
  8176. }
  8177. });
  8178. // expose FunctionalRenderContext for ssr runtime helper installation
  8179. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  8180. value: FunctionalRenderContext
  8181. });
  8182. Vue.version = '2.6.11';
  8183. /**
  8184. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  8185. */
  8186. var ARRAYTYPE = '[object Array]';
  8187. var OBJECTTYPE = '[object Object]';
  8188. // const FUNCTIONTYPE = '[object Function]'
  8189. function diff(current, pre) {
  8190. var result = {};
  8191. syncKeys(current, pre);
  8192. _diff(current, pre, '', result);
  8193. return result
  8194. }
  8195. function syncKeys(current, pre) {
  8196. if (current === pre) {
  8197. return
  8198. }
  8199. var rootCurrentType = type(current);
  8200. var rootPreType = type(pre);
  8201. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  8202. if (Object.keys(current).length >= Object.keys(pre).length) {
  8203. for (var key in pre) {
  8204. var currentValue = current[key];
  8205. if (currentValue === undefined) {
  8206. current[key] = null;
  8207. } else {
  8208. syncKeys(currentValue, pre[key]);
  8209. }
  8210. }
  8211. }
  8212. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  8213. if (current.length >= pre.length) {
  8214. pre.forEach(function (item, index) {
  8215. syncKeys(current[index], item);
  8216. });
  8217. }
  8218. }
  8219. }
  8220. function _diff(current, pre, path, result) {
  8221. if (current === pre) {
  8222. return
  8223. }
  8224. var rootCurrentType = type(current);
  8225. var rootPreType = type(pre);
  8226. if (rootCurrentType == OBJECTTYPE) {
  8227. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  8228. setResult(result, path, current);
  8229. } else {
  8230. var loop = function (key) {
  8231. var currentValue = current[key];
  8232. var preValue = pre[key];
  8233. var currentType = type(currentValue);
  8234. var preType = type(preValue);
  8235. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  8236. if (currentValue !== pre[key]) {
  8237. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8238. }
  8239. } else if (currentType == ARRAYTYPE) {
  8240. if (preType != ARRAYTYPE) {
  8241. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8242. } else {
  8243. if (currentValue.length < preValue.length) {
  8244. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8245. } else {
  8246. currentValue.forEach(function (item, index) {
  8247. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  8248. });
  8249. }
  8250. }
  8251. } else if (currentType == OBJECTTYPE) {
  8252. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  8253. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8254. } else {
  8255. for (var subKey in currentValue) {
  8256. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  8257. }
  8258. }
  8259. }
  8260. };
  8261. for (var key in current) loop(key);
  8262. }
  8263. } else if (rootCurrentType == ARRAYTYPE) {
  8264. if (rootPreType != ARRAYTYPE) {
  8265. setResult(result, path, current);
  8266. } else {
  8267. if (current.length < pre.length) {
  8268. setResult(result, path, current);
  8269. } else {
  8270. current.forEach(function (item, index) {
  8271. _diff(item, pre[index], path + '[' + index + ']', result);
  8272. });
  8273. }
  8274. }
  8275. } else {
  8276. setResult(result, path, current);
  8277. }
  8278. }
  8279. function setResult(result, k, v) {
  8280. // if (type(v) != FUNCTIONTYPE) {
  8281. result[k] = v;
  8282. // }
  8283. }
  8284. function type(obj) {
  8285. return Object.prototype.toString.call(obj)
  8286. }
  8287. /* */
  8288. function flushCallbacks$1(vm) {
  8289. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  8290. if (Object({
  8291. "VUE_APP_NAME": "aaa",
  8292. "VUE_APP_PLATFORM": "mp-weixin",
  8293. "NODE_ENV": "development",
  8294. "BASE_URL": "/"
  8295. }).VUE_APP_DEBUG) {
  8296. var mpInstance = vm.$scope;
  8297. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8298. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  8299. }
  8300. var copies = vm.__next_tick_callbacks.slice(0);
  8301. vm.__next_tick_callbacks.length = 0;
  8302. for (var i = 0; i < copies.length; i++) {
  8303. copies[i]();
  8304. }
  8305. }
  8306. }
  8307. function hasRenderWatcher(vm) {
  8308. return queue.find(function (watcher) {
  8309. return vm._watcher === watcher;
  8310. })
  8311. }
  8312. function nextTick$1(vm, cb) {
  8313. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  8314. //2.nextTick 之前存在 render watcher
  8315. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  8316. if (Object({
  8317. "VUE_APP_NAME": "aaa",
  8318. "VUE_APP_PLATFORM": "mp-weixin",
  8319. "NODE_ENV": "development",
  8320. "BASE_URL": "/"
  8321. }).VUE_APP_DEBUG) {
  8322. var mpInstance = vm.$scope;
  8323. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8324. ']:nextVueTick');
  8325. }
  8326. return nextTick(cb, vm)
  8327. } else {
  8328. if (Object({
  8329. "VUE_APP_NAME": "aaa",
  8330. "VUE_APP_PLATFORM": "mp-weixin",
  8331. "NODE_ENV": "development",
  8332. "BASE_URL": "/"
  8333. }).VUE_APP_DEBUG) {
  8334. var mpInstance$1 = vm.$scope;
  8335. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  8336. ']:nextMPTick');
  8337. }
  8338. }
  8339. var _resolve;
  8340. if (!vm.__next_tick_callbacks) {
  8341. vm.__next_tick_callbacks = [];
  8342. }
  8343. vm.__next_tick_callbacks.push(function () {
  8344. if (cb) {
  8345. try {
  8346. cb.call(vm);
  8347. } catch (e) {
  8348. handleError(e, vm, 'nextTick');
  8349. }
  8350. } else if (_resolve) {
  8351. _resolve(vm);
  8352. }
  8353. });
  8354. // $flow-disable-line
  8355. if (!cb && typeof Promise !== 'undefined') {
  8356. return new Promise(function (resolve) {
  8357. _resolve = resolve;
  8358. })
  8359. }
  8360. }
  8361. /* */
  8362. function cloneWithData(vm) {
  8363. // 确保当前 vm 所有数据被同步
  8364. var ret = Object.create(null);
  8365. var dataKeys = [].concat(
  8366. Object.keys(vm._data || {}),
  8367. Object.keys(vm._computedWatchers || {}));
  8368. dataKeys.reduce(function (ret, key) {
  8369. ret[key] = vm[key];
  8370. return ret
  8371. }, ret);
  8372. // vue-composition-api
  8373. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  8374. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  8375. if (rawBindings) {
  8376. Object.keys(rawBindings).forEach(function (key) {
  8377. ret[key] = vm[key];
  8378. });
  8379. }
  8380. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  8381. Object.assign(ret, vm.$mp.data || {});
  8382. if (
  8383. Array.isArray(vm.$options.behaviors) &&
  8384. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  8385. ) { //form-field
  8386. ret['name'] = vm.name;
  8387. ret['value'] = vm.value;
  8388. }
  8389. return JSON.parse(JSON.stringify(ret))
  8390. }
  8391. var patch = function (oldVnode, vnode) {
  8392. var this$1 = this;
  8393. if (vnode === null) { //destroy
  8394. return
  8395. }
  8396. if (this.mpType === 'page' || this.mpType === 'component') {
  8397. var mpInstance = this.$scope;
  8398. var data = Object.create(null);
  8399. try {
  8400. data = cloneWithData(this);
  8401. } catch (err) {
  8402. console.error(err);
  8403. }
  8404. data.__webviewId__ = mpInstance.data.__webviewId__;
  8405. var mpData = Object.create(null);
  8406. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  8407. mpData[key] = mpInstance.data[key];
  8408. });
  8409. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  8410. if (Object.keys(diffData).length) {
  8411. if (Object({
  8412. "VUE_APP_NAME": "aaa",
  8413. "VUE_APP_PLATFORM": "mp-weixin",
  8414. "NODE_ENV": "development",
  8415. "BASE_URL": "/"
  8416. }).VUE_APP_DEBUG) {
  8417. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  8418. ']差量更新',
  8419. JSON.stringify(diffData));
  8420. }
  8421. this.__next_tick_pending = true;
  8422. mpInstance.setData(diffData, function () {
  8423. this$1.__next_tick_pending = false;
  8424. flushCallbacks$1(this$1);
  8425. });
  8426. } else {
  8427. flushCallbacks$1(this);
  8428. }
  8429. }
  8430. };
  8431. /* */
  8432. function createEmptyRender() {
  8433. }
  8434. function mountComponent$1(
  8435. vm,
  8436. el,
  8437. hydrating
  8438. ) {
  8439. if (!vm.mpType) { //main.js 中的 new Vue
  8440. return vm
  8441. }
  8442. if (vm.mpType === 'app') {
  8443. vm.$options.render = createEmptyRender;
  8444. }
  8445. if (!vm.$options.render) {
  8446. vm.$options.render = createEmptyRender;
  8447. if (true) {
  8448. /* istanbul ignore if */
  8449. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  8450. vm.$options.el || el) {
  8451. warn(
  8452. 'You are using the runtime-only build of Vue where the template ' +
  8453. 'compiler is not available. Either pre-compile the templates into ' +
  8454. 'render functions, or use the compiler-included build.',
  8455. vm
  8456. );
  8457. } else {
  8458. warn(
  8459. 'Failed to mount component: template or render function not defined.',
  8460. vm
  8461. );
  8462. }
  8463. }
  8464. }
  8465. !vm._$fallback && callHook(vm, 'beforeMount');
  8466. var updateComponent = function () {
  8467. vm._update(vm._render(), hydrating);
  8468. };
  8469. // we set this to vm._watcher inside the watcher's constructor
  8470. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  8471. // component's mounted hook), which relies on vm._watcher being already defined
  8472. new Watcher(vm, updateComponent, noop, {
  8473. before: function before() {
  8474. if (vm._isMounted && !vm._isDestroyed) {
  8475. callHook(vm, 'beforeUpdate');
  8476. }
  8477. }
  8478. }, true /* isRenderWatcher */ );
  8479. hydrating = false;
  8480. return vm
  8481. }
  8482. /* */
  8483. function renderClass(
  8484. staticClass,
  8485. dynamicClass
  8486. ) {
  8487. if (isDef(staticClass) || isDef(dynamicClass)) {
  8488. return concat(staticClass, stringifyClass(dynamicClass))
  8489. }
  8490. /* istanbul ignore next */
  8491. return ''
  8492. }
  8493. function concat(a, b) {
  8494. return a ? b ? (a + ' ' + b) : a : (b || '')
  8495. }
  8496. function stringifyClass(value) {
  8497. if (Array.isArray(value)) {
  8498. return stringifyArray(value)
  8499. }
  8500. if (isObject(value)) {
  8501. return stringifyObject(value)
  8502. }
  8503. if (typeof value === 'string') {
  8504. return value
  8505. }
  8506. /* istanbul ignore next */
  8507. return ''
  8508. }
  8509. function stringifyArray(value) {
  8510. var res = '';
  8511. var stringified;
  8512. for (var i = 0, l = value.length; i < l; i++) {
  8513. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  8514. if (res) {
  8515. res += ' ';
  8516. }
  8517. res += stringified;
  8518. }
  8519. }
  8520. return res
  8521. }
  8522. function stringifyObject(value) {
  8523. var res = '';
  8524. for (var key in value) {
  8525. if (value[key]) {
  8526. if (res) {
  8527. res += ' ';
  8528. }
  8529. res += key;
  8530. }
  8531. }
  8532. return res
  8533. }
  8534. /* */
  8535. var parseStyleText = cached(function (cssText) {
  8536. var res = {};
  8537. var listDelimiter = /;(?![^(]*\))/g;
  8538. var propertyDelimiter = /:(.+)/;
  8539. cssText.split(listDelimiter).forEach(function (item) {
  8540. if (item) {
  8541. var tmp = item.split(propertyDelimiter);
  8542. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8543. }
  8544. });
  8545. return res
  8546. });
  8547. // normalize possible array / string values into Object
  8548. function normalizeStyleBinding(bindingStyle) {
  8549. if (Array.isArray(bindingStyle)) {
  8550. return toObject(bindingStyle)
  8551. }
  8552. if (typeof bindingStyle === 'string') {
  8553. return parseStyleText(bindingStyle)
  8554. }
  8555. return bindingStyle
  8556. }
  8557. /* */
  8558. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  8559. function getTarget(obj, path) {
  8560. var parts = path.split('.');
  8561. var key = parts[0];
  8562. if (key.indexOf('__$n') === 0) { //number index
  8563. key = parseInt(key.replace('__$n', ''));
  8564. }
  8565. if (parts.length === 1) {
  8566. return obj[key]
  8567. }
  8568. return getTarget(obj[key], parts.slice(1).join('.'))
  8569. }
  8570. function internalMixin(Vue) {
  8571. Vue.config.errorHandler = function (err, vm, info) {
  8572. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  8573. console.error(err);
  8574. /* eslint-disable no-undef */
  8575. var app = typeof getApp === 'function' && getApp();
  8576. if (app && app.onError) {
  8577. app.onError(err);
  8578. }
  8579. };
  8580. var oldEmit = Vue.prototype.$emit;
  8581. Vue.prototype.$emit = function (event) {
  8582. if (this.$scope && event) {
  8583. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  8584. if (triggerEvent) {
  8585. triggerEvent.call(this.$scope, event, {
  8586. __args__: toArray(arguments, 1)
  8587. });
  8588. }
  8589. }
  8590. return oldEmit.apply(this, arguments)
  8591. };
  8592. Vue.prototype.$nextTick = function (fn) {
  8593. return nextTick$1(this, fn)
  8594. };
  8595. MP_METHODS.forEach(function (method) {
  8596. Vue.prototype[method] = function (args) {
  8597. if (this.$scope && this.$scope[method]) {
  8598. return this.$scope[method](args)
  8599. }
  8600. // mp-alipay
  8601. if (typeof my === 'undefined') {
  8602. return
  8603. }
  8604. if (method === 'createSelectorQuery') {
  8605. /* eslint-disable no-undef */
  8606. return my.createSelectorQuery(args)
  8607. } else if (method === 'createIntersectionObserver') {
  8608. /* eslint-disable no-undef */
  8609. return my.createIntersectionObserver(args)
  8610. }
  8611. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  8612. };
  8613. });
  8614. Vue.prototype.__init_provide = initProvide;
  8615. Vue.prototype.__init_injections = initInjections;
  8616. Vue.prototype.__call_hook = function (hook, args) {
  8617. var vm = this;
  8618. // #7573 disable dep collection when invoking lifecycle hooks
  8619. pushTarget();
  8620. var handlers = vm.$options[hook];
  8621. var info = hook + " hook";
  8622. var ret;
  8623. if (handlers) {
  8624. for (var i = 0, j = handlers.length; i < j; i++) {
  8625. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  8626. }
  8627. }
  8628. if (vm._hasHookEvent) {
  8629. vm.$emit('hook:' + hook, args);
  8630. }
  8631. popTarget();
  8632. return ret
  8633. };
  8634. Vue.prototype.__set_model = function (target, key, value, modifiers) {
  8635. if (Array.isArray(modifiers)) {
  8636. if (modifiers.indexOf('trim') !== -1) {
  8637. value = value.trim();
  8638. }
  8639. if (modifiers.indexOf('number') !== -1) {
  8640. value = this._n(value);
  8641. }
  8642. }
  8643. if (!target) {
  8644. target = this;
  8645. }
  8646. // 解决动态属性添加
  8647. Vue.set(target, key, value);
  8648. };
  8649. Vue.prototype.__set_sync = function (target, key, value) {
  8650. if (!target) {
  8651. target = this;
  8652. }
  8653. // 解决动态属性添加
  8654. Vue.set(target, key, value);
  8655. };
  8656. Vue.prototype.__get_orig = function (item) {
  8657. if (isPlainObject(item)) {
  8658. return item['$orig'] || item
  8659. }
  8660. return item
  8661. };
  8662. Vue.prototype.__get_value = function (dataPath, target) {
  8663. return getTarget(target || this, dataPath)
  8664. };
  8665. Vue.prototype.__get_class = function (dynamicClass, staticClass) {
  8666. return renderClass(staticClass, dynamicClass)
  8667. };
  8668. Vue.prototype.__get_style = function (dynamicStyle, staticStyle) {
  8669. if (!dynamicStyle && !staticStyle) {
  8670. return ''
  8671. }
  8672. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  8673. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  8674. return Object.keys(styleObj).map(function (name) {
  8675. return ((hyphenate(name)) + ":" + (styleObj[name]));
  8676. }).join(';')
  8677. };
  8678. Vue.prototype.__map = function (val, iteratee) {
  8679. //TODO 暂不考虑 string
  8680. var ret, i, l, keys, key;
  8681. if (Array.isArray(val)) {
  8682. ret = new Array(val.length);
  8683. for (i = 0, l = val.length; i < l; i++) {
  8684. ret[i] = iteratee(val[i], i);
  8685. }
  8686. return ret
  8687. } else if (isObject(val)) {
  8688. keys = Object.keys(val);
  8689. ret = Object.create(null);
  8690. for (i = 0, l = keys.length; i < l; i++) {
  8691. key = keys[i];
  8692. ret[key] = iteratee(val[key], key, i);
  8693. }
  8694. return ret
  8695. } else if (typeof val === 'number') {
  8696. ret = new Array(val);
  8697. for (i = 0, l = val; i < l; i++) {
  8698. // 第一个参数暂时仍和小程序一致
  8699. ret[i] = iteratee(i, i);
  8700. }
  8701. return ret
  8702. }
  8703. return []
  8704. };
  8705. }
  8706. /* */
  8707. var LIFECYCLE_HOOKS$1 = [
  8708. //App
  8709. 'onLaunch',
  8710. 'onShow',
  8711. 'onHide',
  8712. 'onUniNViewMessage',
  8713. 'onPageNotFound',
  8714. 'onThemeChange',
  8715. 'onError',
  8716. 'onUnhandledRejection',
  8717. //Page
  8718. 'onInit',
  8719. 'onLoad',
  8720. // 'onShow',
  8721. 'onReady',
  8722. // 'onHide',
  8723. 'onUnload',
  8724. 'onPullDownRefresh',
  8725. 'onReachBottom',
  8726. 'onTabItemTap',
  8727. 'onAddToFavorites',
  8728. 'onShareTimeline',
  8729. 'onShareAppMessage',
  8730. 'onResize',
  8731. 'onPageScroll',
  8732. 'onNavigationBarButtonTap',
  8733. 'onBackPress',
  8734. 'onNavigationBarSearchInputChanged',
  8735. 'onNavigationBarSearchInputConfirmed',
  8736. 'onNavigationBarSearchInputClicked',
  8737. //Component
  8738. // 'onReady', // 兼容旧版本,应该移除该事件
  8739. 'onPageShow',
  8740. 'onPageHide',
  8741. 'onPageResize',
  8742. 'onUploadDouyinVideo'
  8743. ];
  8744. function lifecycleMixin$1(Vue) {
  8745. //fixed vue-class-component
  8746. var oldExtend = Vue.extend;
  8747. Vue.extend = function (extendOptions) {
  8748. extendOptions = extendOptions || {};
  8749. var methods = extendOptions.methods;
  8750. if (methods) {
  8751. Object.keys(methods).forEach(function (methodName) {
  8752. if (LIFECYCLE_HOOKS$1.indexOf(methodName) !== -1) {
  8753. extendOptions[methodName] = methods[methodName];
  8754. delete methods[methodName];
  8755. }
  8756. });
  8757. }
  8758. return oldExtend.call(this, extendOptions)
  8759. };
  8760. var strategies = Vue.config.optionMergeStrategies;
  8761. var mergeHook = strategies.created;
  8762. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  8763. strategies[hook] = mergeHook;
  8764. });
  8765. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  8766. }
  8767. /* */
  8768. // install platform patch function
  8769. Vue.prototype.__patch__ = patch;
  8770. // public mount method
  8771. Vue.prototype.$mount = function (
  8772. el,
  8773. hydrating
  8774. ) {
  8775. return mountComponent$1(this, el, hydrating)
  8776. };
  8777. lifecycleMixin$1(Vue);
  8778. internalMixin(Vue);
  8779. /* */
  8780. /* harmony default export */
  8781. __webpack_exports__["default"] = (Vue);
  8782. /* WEBPACK VAR INJECTION */
  8783. }.call(this, __webpack_require__( /*! ./../../../../../webpack/buildin/global.js */ 2)))
  8784. /***/
  8785. }),
  8786. /* 5 */
  8787. /*!****************************************************************!*\
  8788. !*** C:/Users/17688/Documents/HBuilderProjects/aaa/pages.json ***!
  8789. \****************************************************************/
  8790. /*! no static exports found */
  8791. /***/
  8792. (function (module, exports) {
  8793. /***/
  8794. }),
  8795. /* 6 */
  8796. ,
  8797. /* 7 */
  8798. ,
  8799. /* 8 */
  8800. ,
  8801. /* 9 */
  8802. ,
  8803. /* 10 */
  8804. ,
  8805. /* 11 */
  8806. /*!**********************************************************************************************************!*\
  8807. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  8808. \**********************************************************************************************************/
  8809. /*! exports provided: default */
  8810. /***/
  8811. (function (module, __webpack_exports__, __webpack_require__) {
  8812. "use strict";
  8813. __webpack_require__.r(__webpack_exports__);
  8814. /* harmony export (binding) */
  8815. __webpack_require__.d(__webpack_exports__, "default", function () {
  8816. return normalizeComponent;
  8817. });
  8818. /* globals __VUE_SSR_CONTEXT__ */
  8819. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  8820. // This module is a runtime utility for cleaner component module output and will
  8821. // be included in the final webpack user bundle.
  8822. function normalizeComponent(
  8823. scriptExports,
  8824. render,
  8825. staticRenderFns,
  8826. functionalTemplate,
  8827. injectStyles,
  8828. scopeId,
  8829. moduleIdentifier, /* server only */
  8830. shadowMode, /* vue-cli only */
  8831. components, // fixed by xxxxxx auto components
  8832. renderjs // fixed by xxxxxx renderjs
  8833. ) {
  8834. // Vue.extend constructor export interop
  8835. var options = typeof scriptExports === 'function' ?
  8836. scriptExports.options :
  8837. scriptExports
  8838. // fixed by xxxxxx auto components
  8839. if (components) {
  8840. if (!options.components) {
  8841. options.components = {}
  8842. }
  8843. var hasOwn = Object.prototype.hasOwnProperty
  8844. for (var name in components) {
  8845. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  8846. options.components[name] = components[name]
  8847. }
  8848. }
  8849. }
  8850. // fixed by xxxxxx renderjs
  8851. if (renderjs) {
  8852. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function () {
  8853. this[renderjs.__module] = this
  8854. });
  8855. (options.mixins || (options.mixins = [])).push(renderjs)
  8856. }
  8857. // render functions
  8858. if (render) {
  8859. options.render = render
  8860. options.staticRenderFns = staticRenderFns
  8861. options._compiled = true
  8862. }
  8863. // functional template
  8864. if (functionalTemplate) {
  8865. options.functional = true
  8866. }
  8867. // scopedId
  8868. if (scopeId) {
  8869. options._scopeId = 'data-v-' + scopeId
  8870. }
  8871. var hook
  8872. if (moduleIdentifier) { // server build
  8873. hook = function (context) {
  8874. // 2.3 injection
  8875. context =
  8876. context || // cached call
  8877. (this.$vnode && this.$vnode.ssrContext) || // stateful
  8878. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  8879. // 2.2 with runInNewContext: true
  8880. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  8881. context = __VUE_SSR_CONTEXT__
  8882. }
  8883. // inject component styles
  8884. if (injectStyles) {
  8885. injectStyles.call(this, context)
  8886. }
  8887. // register component module identifier for async chunk inferrence
  8888. if (context && context._registeredComponents) {
  8889. context._registeredComponents.add(moduleIdentifier)
  8890. }
  8891. }
  8892. // used by ssr in case component is cached and beforeCreate
  8893. // never gets called
  8894. options._ssrRegister = hook
  8895. } else if (injectStyles) {
  8896. hook = shadowMode ?
  8897. function () {
  8898. injectStyles.call(this, this.$root.$options.shadowRoot)
  8899. } :
  8900. injectStyles
  8901. }
  8902. if (hook) {
  8903. if (options.functional) {
  8904. // for template-only hot-reload because in that case the render fn doesn't
  8905. // go through the normalizer
  8906. options._injectStyles = hook
  8907. // register for functioal component in vue file
  8908. var originalRender = options.render
  8909. options.render = function renderWithStyleInjection(h, context) {
  8910. hook.call(context)
  8911. return originalRender(h, context)
  8912. }
  8913. } else {
  8914. // inject component registration as beforeCreate hook
  8915. var existing = options.beforeCreate
  8916. options.beforeCreate = existing ?
  8917. [].concat(existing, hook) :
  8918. [hook]
  8919. }
  8920. }
  8921. return {
  8922. exports: scriptExports,
  8923. options: options
  8924. }
  8925. }
  8926. /***/
  8927. }),
  8928. /* 12 */
  8929. ,
  8930. /* 13 */
  8931. ,
  8932. /* 14 */
  8933. ,
  8934. /* 15 */
  8935. ,
  8936. /* 16 */
  8937. ,
  8938. /* 17 */
  8939. ,
  8940. /* 18 */
  8941. ,
  8942. /* 19 */
  8943. ,
  8944. /* 20 */
  8945. ,
  8946. /* 21 */
  8947. /*!**************************************!*\
  8948. !*** ./node_modules/buffer/index.js ***!
  8949. \**************************************/
  8950. /*! no static exports found */
  8951. /***/
  8952. (function (module, exports, __webpack_require__) {
  8953. "use strict";
  8954. /* WEBPACK VAR INJECTION */
  8955. (function (global) {
  8956. /*!
  8957. * The buffer module from node.js, for the browser.
  8958. *
  8959. * @author Feross Aboukhadijeh <http://feross.org>
  8960. * @license MIT
  8961. */
  8962. /* eslint-disable no-proto */
  8963. var base64 = __webpack_require__( /*! base64-js */ 22)
  8964. var ieee754 = __webpack_require__( /*! ieee754 */ 23)
  8965. var isArray = __webpack_require__( /*! isarray */ 24)
  8966. exports.Buffer = Buffer
  8967. exports.SlowBuffer = SlowBuffer
  8968. exports.INSPECT_MAX_BYTES = 50
  8969. /**
  8970. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  8971. * === true Use Uint8Array implementation (fastest)
  8972. * === false Use Object implementation (most compatible, even IE6)
  8973. *
  8974. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  8975. * Opera 11.6+, iOS 4.2+.
  8976. *
  8977. * Due to various browser bugs, sometimes the Object implementation will be used even
  8978. * when the browser supports typed arrays.
  8979. *
  8980. * Note:
  8981. *
  8982. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  8983. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  8984. *
  8985. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  8986. *
  8987. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  8988. * incorrect length in some situations.
  8989. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  8990. * get the Object implementation, which is slower but behaves correctly.
  8991. */
  8992. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ?
  8993. global.TYPED_ARRAY_SUPPORT :
  8994. typedArraySupport()
  8995. /*
  8996. * Export kMaxLength after typed array support is determined.
  8997. */
  8998. exports.kMaxLength = kMaxLength()
  8999. function typedArraySupport() {
  9000. try {
  9001. var arr = new Uint8Array(1)
  9002. arr.__proto__ = {
  9003. __proto__: Uint8Array.prototype,
  9004. foo: function () {
  9005. return 42
  9006. }
  9007. }
  9008. return arr.foo() === 42 && // typed array instances can be augmented
  9009. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  9010. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  9011. } catch (e) {
  9012. return false
  9013. }
  9014. }
  9015. function kMaxLength() {
  9016. return Buffer.TYPED_ARRAY_SUPPORT ?
  9017. 0x7fffffff :
  9018. 0x3fffffff
  9019. }
  9020. function createBuffer(that, length) {
  9021. if (kMaxLength() < length) {
  9022. throw new RangeError('Invalid typed array length')
  9023. }
  9024. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9025. // Return an augmented `Uint8Array` instance, for best performance
  9026. that = new Uint8Array(length)
  9027. that.__proto__ = Buffer.prototype
  9028. } else {
  9029. // Fallback: Return an object instance of the Buffer class
  9030. if (that === null) {
  9031. that = new Buffer(length)
  9032. }
  9033. that.length = length
  9034. }
  9035. return that
  9036. }
  9037. /**
  9038. * The Buffer constructor returns instances of `Uint8Array` that have their
  9039. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  9040. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  9041. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  9042. * returns a single octet.
  9043. *
  9044. * The `Uint8Array` prototype remains unmodified.
  9045. */
  9046. function Buffer(arg, encodingOrOffset, length) {
  9047. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  9048. return new Buffer(arg, encodingOrOffset, length)
  9049. }
  9050. // Common case.
  9051. if (typeof arg === 'number') {
  9052. if (typeof encodingOrOffset === 'string') {
  9053. throw new Error(
  9054. 'If encoding is specified then the first argument must be a string'
  9055. )
  9056. }
  9057. return allocUnsafe(this, arg)
  9058. }
  9059. return from(this, arg, encodingOrOffset, length)
  9060. }
  9061. Buffer.poolSize = 8192 // not used by this implementation
  9062. // TODO: Legacy, not needed anymore. Remove in next major version.
  9063. Buffer._augment = function (arr) {
  9064. arr.__proto__ = Buffer.prototype
  9065. return arr
  9066. }
  9067. function from(that, value, encodingOrOffset, length) {
  9068. if (typeof value === 'number') {
  9069. throw new TypeError('"value" argument must not be a number')
  9070. }
  9071. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  9072. return fromArrayBuffer(that, value, encodingOrOffset, length)
  9073. }
  9074. if (typeof value === 'string') {
  9075. return fromString(that, value, encodingOrOffset)
  9076. }
  9077. return fromObject(that, value)
  9078. }
  9079. /**
  9080. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  9081. * if value is a number.
  9082. * Buffer.from(str[, encoding])
  9083. * Buffer.from(array)
  9084. * Buffer.from(buffer)
  9085. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  9086. **/
  9087. Buffer.from = function (value, encodingOrOffset, length) {
  9088. return from(null, value, encodingOrOffset, length)
  9089. }
  9090. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9091. Buffer.prototype.__proto__ = Uint8Array.prototype
  9092. Buffer.__proto__ = Uint8Array
  9093. if (typeof Symbol !== 'undefined' && Symbol.species &&
  9094. Buffer[Symbol.species] === Buffer) {
  9095. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  9096. Object.defineProperty(Buffer, Symbol.species, {
  9097. value: null,
  9098. configurable: true
  9099. })
  9100. }
  9101. }
  9102. function assertSize(size) {
  9103. if (typeof size !== 'number') {
  9104. throw new TypeError('"size" argument must be a number')
  9105. } else if (size < 0) {
  9106. throw new RangeError('"size" argument must not be negative')
  9107. }
  9108. }
  9109. function alloc(that, size, fill, encoding) {
  9110. assertSize(size)
  9111. if (size <= 0) {
  9112. return createBuffer(that, size)
  9113. }
  9114. if (fill !== undefined) {
  9115. // Only pay attention to encoding if it's a string. This
  9116. // prevents accidentally sending in a number that would
  9117. // be interpretted as a start offset.
  9118. return typeof encoding === 'string' ?
  9119. createBuffer(that, size).fill(fill, encoding) :
  9120. createBuffer(that, size).fill(fill)
  9121. }
  9122. return createBuffer(that, size)
  9123. }
  9124. /**
  9125. * Creates a new filled Buffer instance.
  9126. * alloc(size[, fill[, encoding]])
  9127. **/
  9128. Buffer.alloc = function (size, fill, encoding) {
  9129. return alloc(null, size, fill, encoding)
  9130. }
  9131. function allocUnsafe(that, size) {
  9132. assertSize(size)
  9133. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  9134. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  9135. for (var i = 0; i < size; ++i) {
  9136. that[i] = 0
  9137. }
  9138. }
  9139. return that
  9140. }
  9141. /**
  9142. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  9143. * */
  9144. Buffer.allocUnsafe = function (size) {
  9145. return allocUnsafe(null, size)
  9146. }
  9147. /**
  9148. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  9149. */
  9150. Buffer.allocUnsafeSlow = function (size) {
  9151. return allocUnsafe(null, size)
  9152. }
  9153. function fromString(that, string, encoding) {
  9154. if (typeof encoding !== 'string' || encoding === '') {
  9155. encoding = 'utf8'
  9156. }
  9157. if (!Buffer.isEncoding(encoding)) {
  9158. throw new TypeError('"encoding" must be a valid string encoding')
  9159. }
  9160. var length = byteLength(string, encoding) | 0
  9161. that = createBuffer(that, length)
  9162. var actual = that.write(string, encoding)
  9163. if (actual !== length) {
  9164. // Writing a hex string, for example, that contains invalid characters will
  9165. // cause everything after the first invalid character to be ignored. (e.g.
  9166. // 'abxxcd' will be treated as 'ab')
  9167. that = that.slice(0, actual)
  9168. }
  9169. return that
  9170. }
  9171. function fromArrayLike(that, array) {
  9172. var length = array.length < 0 ? 0 : checked(array.length) | 0
  9173. that = createBuffer(that, length)
  9174. for (var i = 0; i < length; i += 1) {
  9175. that[i] = array[i] & 255
  9176. }
  9177. return that
  9178. }
  9179. function fromArrayBuffer(that, array, byteOffset, length) {
  9180. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  9181. if (byteOffset < 0 || array.byteLength < byteOffset) {
  9182. throw new RangeError('\'offset\' is out of bounds')
  9183. }
  9184. if (array.byteLength < byteOffset + (length || 0)) {
  9185. throw new RangeError('\'length\' is out of bounds')
  9186. }
  9187. if (byteOffset === undefined && length === undefined) {
  9188. array = new Uint8Array(array)
  9189. } else if (length === undefined) {
  9190. array = new Uint8Array(array, byteOffset)
  9191. } else {
  9192. array = new Uint8Array(array, byteOffset, length)
  9193. }
  9194. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9195. // Return an augmented `Uint8Array` instance, for best performance
  9196. that = array
  9197. that.__proto__ = Buffer.prototype
  9198. } else {
  9199. // Fallback: Return an object instance of the Buffer class
  9200. that = fromArrayLike(that, array)
  9201. }
  9202. return that
  9203. }
  9204. function fromObject(that, obj) {
  9205. if (Buffer.isBuffer(obj)) {
  9206. var len = checked(obj.length) | 0
  9207. that = createBuffer(that, len)
  9208. if (that.length === 0) {
  9209. return that
  9210. }
  9211. obj.copy(that, 0, 0, len)
  9212. return that
  9213. }
  9214. if (obj) {
  9215. if ((typeof ArrayBuffer !== 'undefined' &&
  9216. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  9217. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  9218. return createBuffer(that, 0)
  9219. }
  9220. return fromArrayLike(that, obj)
  9221. }
  9222. if (obj.type === 'Buffer' && isArray(obj.data)) {
  9223. return fromArrayLike(that, obj.data)
  9224. }
  9225. }
  9226. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  9227. }
  9228. function checked(length) {
  9229. // Note: cannot use `length < kMaxLength()` here because that fails when
  9230. // length is NaN (which is otherwise coerced to zero.)
  9231. if (length >= kMaxLength()) {
  9232. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  9233. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  9234. }
  9235. return length | 0
  9236. }
  9237. function SlowBuffer(length) {
  9238. if (+length != length) { // eslint-disable-line eqeqeq
  9239. length = 0
  9240. }
  9241. return Buffer.alloc(+length)
  9242. }
  9243. Buffer.isBuffer = function isBuffer(b) {
  9244. return !!(b != null && b._isBuffer)
  9245. }
  9246. Buffer.compare = function compare(a, b) {
  9247. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  9248. throw new TypeError('Arguments must be Buffers')
  9249. }
  9250. if (a === b) return 0
  9251. var x = a.length
  9252. var y = b.length
  9253. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  9254. if (a[i] !== b[i]) {
  9255. x = a[i]
  9256. y = b[i]
  9257. break
  9258. }
  9259. }
  9260. if (x < y) return -1
  9261. if (y < x) return 1
  9262. return 0
  9263. }
  9264. Buffer.isEncoding = function isEncoding(encoding) {
  9265. switch (String(encoding).toLowerCase()) {
  9266. case 'hex':
  9267. case 'utf8':
  9268. case 'utf-8':
  9269. case 'ascii':
  9270. case 'latin1':
  9271. case 'binary':
  9272. case 'base64':
  9273. case 'ucs2':
  9274. case 'ucs-2':
  9275. case 'utf16le':
  9276. case 'utf-16le':
  9277. return true
  9278. default:
  9279. return false
  9280. }
  9281. }
  9282. Buffer.concat = function concat(list, length) {
  9283. if (!isArray(list)) {
  9284. throw new TypeError('"list" argument must be an Array of Buffers')
  9285. }
  9286. if (list.length === 0) {
  9287. return Buffer.alloc(0)
  9288. }
  9289. var i
  9290. if (length === undefined) {
  9291. length = 0
  9292. for (i = 0; i < list.length; ++i) {
  9293. length += list[i].length
  9294. }
  9295. }
  9296. var buffer = Buffer.allocUnsafe(length)
  9297. var pos = 0
  9298. for (i = 0; i < list.length; ++i) {
  9299. var buf = list[i]
  9300. if (!Buffer.isBuffer(buf)) {
  9301. throw new TypeError('"list" argument must be an Array of Buffers')
  9302. }
  9303. buf.copy(buffer, pos)
  9304. pos += buf.length
  9305. }
  9306. return buffer
  9307. }
  9308. function byteLength(string, encoding) {
  9309. if (Buffer.isBuffer(string)) {
  9310. return string.length
  9311. }
  9312. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  9313. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  9314. return string.byteLength
  9315. }
  9316. if (typeof string !== 'string') {
  9317. string = '' + string
  9318. }
  9319. var len = string.length
  9320. if (len === 0) return 0
  9321. // Use a for loop to avoid recursion
  9322. var loweredCase = false
  9323. for (;;) {
  9324. switch (encoding) {
  9325. case 'ascii':
  9326. case 'latin1':
  9327. case 'binary':
  9328. return len
  9329. case 'utf8':
  9330. case 'utf-8':
  9331. case undefined:
  9332. return utf8ToBytes(string).length
  9333. case 'ucs2':
  9334. case 'ucs-2':
  9335. case 'utf16le':
  9336. case 'utf-16le':
  9337. return len * 2
  9338. case 'hex':
  9339. return len >>> 1
  9340. case 'base64':
  9341. return base64ToBytes(string).length
  9342. default:
  9343. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  9344. encoding = ('' + encoding).toLowerCase()
  9345. loweredCase = true
  9346. }
  9347. }
  9348. }
  9349. Buffer.byteLength = byteLength
  9350. function slowToString(encoding, start, end) {
  9351. var loweredCase = false
  9352. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  9353. // property of a typed array.
  9354. // This behaves neither like String nor Uint8Array in that we set start/end
  9355. // to their upper/lower bounds if the value passed is out of range.
  9356. // undefined is handled specially as per ECMA-262 6th Edition,
  9357. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  9358. if (start === undefined || start < 0) {
  9359. start = 0
  9360. }
  9361. // Return early if start > this.length. Done here to prevent potential uint32
  9362. // coercion fail below.
  9363. if (start > this.length) {
  9364. return ''
  9365. }
  9366. if (end === undefined || end > this.length) {
  9367. end = this.length
  9368. }
  9369. if (end <= 0) {
  9370. return ''
  9371. }
  9372. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  9373. end >>>= 0
  9374. start >>>= 0
  9375. if (end <= start) {
  9376. return ''
  9377. }
  9378. if (!encoding) encoding = 'utf8'
  9379. while (true) {
  9380. switch (encoding) {
  9381. case 'hex':
  9382. return hexSlice(this, start, end)
  9383. case 'utf8':
  9384. case 'utf-8':
  9385. return utf8Slice(this, start, end)
  9386. case 'ascii':
  9387. return asciiSlice(this, start, end)
  9388. case 'latin1':
  9389. case 'binary':
  9390. return latin1Slice(this, start, end)
  9391. case 'base64':
  9392. return base64Slice(this, start, end)
  9393. case 'ucs2':
  9394. case 'ucs-2':
  9395. case 'utf16le':
  9396. case 'utf-16le':
  9397. return utf16leSlice(this, start, end)
  9398. default:
  9399. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  9400. encoding = (encoding + '').toLowerCase()
  9401. loweredCase = true
  9402. }
  9403. }
  9404. }
  9405. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  9406. // Buffer instances.
  9407. Buffer.prototype._isBuffer = true
  9408. function swap(b, n, m) {
  9409. var i = b[n]
  9410. b[n] = b[m]
  9411. b[m] = i
  9412. }
  9413. Buffer.prototype.swap16 = function swap16() {
  9414. var len = this.length
  9415. if (len % 2 !== 0) {
  9416. throw new RangeError('Buffer size must be a multiple of 16-bits')
  9417. }
  9418. for (var i = 0; i < len; i += 2) {
  9419. swap(this, i, i + 1)
  9420. }
  9421. return this
  9422. }
  9423. Buffer.prototype.swap32 = function swap32() {
  9424. var len = this.length
  9425. if (len % 4 !== 0) {
  9426. throw new RangeError('Buffer size must be a multiple of 32-bits')
  9427. }
  9428. for (var i = 0; i < len; i += 4) {
  9429. swap(this, i, i + 3)
  9430. swap(this, i + 1, i + 2)
  9431. }
  9432. return this
  9433. }
  9434. Buffer.prototype.swap64 = function swap64() {
  9435. var len = this.length
  9436. if (len % 8 !== 0) {
  9437. throw new RangeError('Buffer size must be a multiple of 64-bits')
  9438. }
  9439. for (var i = 0; i < len; i += 8) {
  9440. swap(this, i, i + 7)
  9441. swap(this, i + 1, i + 6)
  9442. swap(this, i + 2, i + 5)
  9443. swap(this, i + 3, i + 4)
  9444. }
  9445. return this
  9446. }
  9447. Buffer.prototype.toString = function toString() {
  9448. var length = this.length | 0
  9449. if (length === 0) return ''
  9450. if (arguments.length === 0) return utf8Slice(this, 0, length)
  9451. return slowToString.apply(this, arguments)
  9452. }
  9453. Buffer.prototype.equals = function equals(b) {
  9454. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  9455. if (this === b) return true
  9456. return Buffer.compare(this, b) === 0
  9457. }
  9458. Buffer.prototype.inspect = function inspect() {
  9459. var str = ''
  9460. var max = exports.INSPECT_MAX_BYTES
  9461. if (this.length > 0) {
  9462. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  9463. if (this.length > max) str += ' ... '
  9464. }
  9465. return '<Buffer ' + str + '>'
  9466. }
  9467. Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
  9468. if (!Buffer.isBuffer(target)) {
  9469. throw new TypeError('Argument must be a Buffer')
  9470. }
  9471. if (start === undefined) {
  9472. start = 0
  9473. }
  9474. if (end === undefined) {
  9475. end = target ? target.length : 0
  9476. }
  9477. if (thisStart === undefined) {
  9478. thisStart = 0
  9479. }
  9480. if (thisEnd === undefined) {
  9481. thisEnd = this.length
  9482. }
  9483. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  9484. throw new RangeError('out of range index')
  9485. }
  9486. if (thisStart >= thisEnd && start >= end) {
  9487. return 0
  9488. }
  9489. if (thisStart >= thisEnd) {
  9490. return -1
  9491. }
  9492. if (start >= end) {
  9493. return 1
  9494. }
  9495. start >>>= 0
  9496. end >>>= 0
  9497. thisStart >>>= 0
  9498. thisEnd >>>= 0
  9499. if (this === target) return 0
  9500. var x = thisEnd - thisStart
  9501. var y = end - start
  9502. var len = Math.min(x, y)
  9503. var thisCopy = this.slice(thisStart, thisEnd)
  9504. var targetCopy = target.slice(start, end)
  9505. for (var i = 0; i < len; ++i) {
  9506. if (thisCopy[i] !== targetCopy[i]) {
  9507. x = thisCopy[i]
  9508. y = targetCopy[i]
  9509. break
  9510. }
  9511. }
  9512. if (x < y) return -1
  9513. if (y < x) return 1
  9514. return 0
  9515. }
  9516. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  9517. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  9518. //
  9519. // Arguments:
  9520. // - buffer - a Buffer to search
  9521. // - val - a string, Buffer, or number
  9522. // - byteOffset - an index into `buffer`; will be clamped to an int32
  9523. // - encoding - an optional encoding, relevant is val is a string
  9524. // - dir - true for indexOf, false for lastIndexOf
  9525. function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
  9526. // Empty buffer means no match
  9527. if (buffer.length === 0) return -1
  9528. // Normalize byteOffset
  9529. if (typeof byteOffset === 'string') {
  9530. encoding = byteOffset
  9531. byteOffset = 0
  9532. } else if (byteOffset > 0x7fffffff) {
  9533. byteOffset = 0x7fffffff
  9534. } else if (byteOffset < -0x80000000) {
  9535. byteOffset = -0x80000000
  9536. }
  9537. byteOffset = +byteOffset // Coerce to Number.
  9538. if (isNaN(byteOffset)) {
  9539. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  9540. byteOffset = dir ? 0 : (buffer.length - 1)
  9541. }
  9542. // Normalize byteOffset: negative offsets start from the end of the buffer
  9543. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  9544. if (byteOffset >= buffer.length) {
  9545. if (dir) return -1
  9546. else byteOffset = buffer.length - 1
  9547. } else if (byteOffset < 0) {
  9548. if (dir) byteOffset = 0
  9549. else return -1
  9550. }
  9551. // Normalize val
  9552. if (typeof val === 'string') {
  9553. val = Buffer.from(val, encoding)
  9554. }
  9555. // Finally, search either indexOf (if dir is true) or lastIndexOf
  9556. if (Buffer.isBuffer(val)) {
  9557. // Special case: looking for empty string/buffer always fails
  9558. if (val.length === 0) {
  9559. return -1
  9560. }
  9561. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  9562. } else if (typeof val === 'number') {
  9563. val = val & 0xFF // Search for a byte value [0-255]
  9564. if (Buffer.TYPED_ARRAY_SUPPORT &&
  9565. typeof Uint8Array.prototype.indexOf === 'function') {
  9566. if (dir) {
  9567. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  9568. } else {
  9569. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  9570. }
  9571. }
  9572. return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
  9573. }
  9574. throw new TypeError('val must be string, number or Buffer')
  9575. }
  9576. function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
  9577. var indexSize = 1
  9578. var arrLength = arr.length
  9579. var valLength = val.length
  9580. if (encoding !== undefined) {
  9581. encoding = String(encoding).toLowerCase()
  9582. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  9583. encoding === 'utf16le' || encoding === 'utf-16le') {
  9584. if (arr.length < 2 || val.length < 2) {
  9585. return -1
  9586. }
  9587. indexSize = 2
  9588. arrLength /= 2
  9589. valLength /= 2
  9590. byteOffset /= 2
  9591. }
  9592. }
  9593. function read(buf, i) {
  9594. if (indexSize === 1) {
  9595. return buf[i]
  9596. } else {
  9597. return buf.readUInt16BE(i * indexSize)
  9598. }
  9599. }
  9600. var i
  9601. if (dir) {
  9602. var foundIndex = -1
  9603. for (i = byteOffset; i < arrLength; i++) {
  9604. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  9605. if (foundIndex === -1) foundIndex = i
  9606. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  9607. } else {
  9608. if (foundIndex !== -1) i -= i - foundIndex
  9609. foundIndex = -1
  9610. }
  9611. }
  9612. } else {
  9613. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  9614. for (i = byteOffset; i >= 0; i--) {
  9615. var found = true
  9616. for (var j = 0; j < valLength; j++) {
  9617. if (read(arr, i + j) !== read(val, j)) {
  9618. found = false
  9619. break
  9620. }
  9621. }
  9622. if (found) return i
  9623. }
  9624. }
  9625. return -1
  9626. }
  9627. Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
  9628. return this.indexOf(val, byteOffset, encoding) !== -1
  9629. }
  9630. Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
  9631. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  9632. }
  9633. Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
  9634. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  9635. }
  9636. function hexWrite(buf, string, offset, length) {
  9637. offset = Number(offset) || 0
  9638. var remaining = buf.length - offset
  9639. if (!length) {
  9640. length = remaining
  9641. } else {
  9642. length = Number(length)
  9643. if (length > remaining) {
  9644. length = remaining
  9645. }
  9646. }
  9647. // must be an even number of digits
  9648. var strLen = string.length
  9649. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  9650. if (length > strLen / 2) {
  9651. length = strLen / 2
  9652. }
  9653. for (var i = 0; i < length; ++i) {
  9654. var parsed = parseInt(string.substr(i * 2, 2), 16)
  9655. if (isNaN(parsed)) return i
  9656. buf[offset + i] = parsed
  9657. }
  9658. return i
  9659. }
  9660. function utf8Write(buf, string, offset, length) {
  9661. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  9662. }
  9663. function asciiWrite(buf, string, offset, length) {
  9664. return blitBuffer(asciiToBytes(string), buf, offset, length)
  9665. }
  9666. function latin1Write(buf, string, offset, length) {
  9667. return asciiWrite(buf, string, offset, length)
  9668. }
  9669. function base64Write(buf, string, offset, length) {
  9670. return blitBuffer(base64ToBytes(string), buf, offset, length)
  9671. }
  9672. function ucs2Write(buf, string, offset, length) {
  9673. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  9674. }
  9675. Buffer.prototype.write = function write(string, offset, length, encoding) {
  9676. // Buffer#write(string)
  9677. if (offset === undefined) {
  9678. encoding = 'utf8'
  9679. length = this.length
  9680. offset = 0
  9681. // Buffer#write(string, encoding)
  9682. } else if (length === undefined && typeof offset === 'string') {
  9683. encoding = offset
  9684. length = this.length
  9685. offset = 0
  9686. // Buffer#write(string, offset[, length][, encoding])
  9687. } else if (isFinite(offset)) {
  9688. offset = offset | 0
  9689. if (isFinite(length)) {
  9690. length = length | 0
  9691. if (encoding === undefined) encoding = 'utf8'
  9692. } else {
  9693. encoding = length
  9694. length = undefined
  9695. }
  9696. // legacy write(string, encoding, offset, length) - remove in v0.13
  9697. } else {
  9698. throw new Error(
  9699. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  9700. )
  9701. }
  9702. var remaining = this.length - offset
  9703. if (length === undefined || length > remaining) length = remaining
  9704. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  9705. throw new RangeError('Attempt to write outside buffer bounds')
  9706. }
  9707. if (!encoding) encoding = 'utf8'
  9708. var loweredCase = false
  9709. for (;;) {
  9710. switch (encoding) {
  9711. case 'hex':
  9712. return hexWrite(this, string, offset, length)
  9713. case 'utf8':
  9714. case 'utf-8':
  9715. return utf8Write(this, string, offset, length)
  9716. case 'ascii':
  9717. return asciiWrite(this, string, offset, length)
  9718. case 'latin1':
  9719. case 'binary':
  9720. return latin1Write(this, string, offset, length)
  9721. case 'base64':
  9722. // Warning: maxLength not taken into account in base64Write
  9723. return base64Write(this, string, offset, length)
  9724. case 'ucs2':
  9725. case 'ucs-2':
  9726. case 'utf16le':
  9727. case 'utf-16le':
  9728. return ucs2Write(this, string, offset, length)
  9729. default:
  9730. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  9731. encoding = ('' + encoding).toLowerCase()
  9732. loweredCase = true
  9733. }
  9734. }
  9735. }
  9736. Buffer.prototype.toJSON = function toJSON() {
  9737. return {
  9738. type: 'Buffer',
  9739. data: Array.prototype.slice.call(this._arr || this, 0)
  9740. }
  9741. }
  9742. function base64Slice(buf, start, end) {
  9743. if (start === 0 && end === buf.length) {
  9744. return base64.fromByteArray(buf)
  9745. } else {
  9746. return base64.fromByteArray(buf.slice(start, end))
  9747. }
  9748. }
  9749. function utf8Slice(buf, start, end) {
  9750. end = Math.min(buf.length, end)
  9751. var res = []
  9752. var i = start
  9753. while (i < end) {
  9754. var firstByte = buf[i]
  9755. var codePoint = null
  9756. var bytesPerSequence = (firstByte > 0xEF) ? 4 :
  9757. (firstByte > 0xDF) ? 3 :
  9758. (firstByte > 0xBF) ? 2 :
  9759. 1
  9760. if (i + bytesPerSequence <= end) {
  9761. var secondByte, thirdByte, fourthByte, tempCodePoint
  9762. switch (bytesPerSequence) {
  9763. case 1:
  9764. if (firstByte < 0x80) {
  9765. codePoint = firstByte
  9766. }
  9767. break
  9768. case 2:
  9769. secondByte = buf[i + 1]
  9770. if ((secondByte & 0xC0) === 0x80) {
  9771. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  9772. if (tempCodePoint > 0x7F) {
  9773. codePoint = tempCodePoint
  9774. }
  9775. }
  9776. break
  9777. case 3:
  9778. secondByte = buf[i + 1]
  9779. thirdByte = buf[i + 2]
  9780. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  9781. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  9782. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  9783. codePoint = tempCodePoint
  9784. }
  9785. }
  9786. break
  9787. case 4:
  9788. secondByte = buf[i + 1]
  9789. thirdByte = buf[i + 2]
  9790. fourthByte = buf[i + 3]
  9791. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  9792. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  9793. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  9794. codePoint = tempCodePoint
  9795. }
  9796. }
  9797. }
  9798. }
  9799. if (codePoint === null) {
  9800. // we did not generate a valid codePoint so insert a
  9801. // replacement char (U+FFFD) and advance only 1 byte
  9802. codePoint = 0xFFFD
  9803. bytesPerSequence = 1
  9804. } else if (codePoint > 0xFFFF) {
  9805. // encode to utf16 (surrogate pair dance)
  9806. codePoint -= 0x10000
  9807. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  9808. codePoint = 0xDC00 | codePoint & 0x3FF
  9809. }
  9810. res.push(codePoint)
  9811. i += bytesPerSequence
  9812. }
  9813. return decodeCodePointsArray(res)
  9814. }
  9815. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  9816. // the lowest limit is Chrome, with 0x10000 args.
  9817. // We go 1 magnitude less, for safety
  9818. var MAX_ARGUMENTS_LENGTH = 0x1000
  9819. function decodeCodePointsArray(codePoints) {
  9820. var len = codePoints.length
  9821. if (len <= MAX_ARGUMENTS_LENGTH) {
  9822. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  9823. }
  9824. // Decode in chunks to avoid "call stack size exceeded".
  9825. var res = ''
  9826. var i = 0
  9827. while (i < len) {
  9828. res += String.fromCharCode.apply(
  9829. String,
  9830. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  9831. )
  9832. }
  9833. return res
  9834. }
  9835. function asciiSlice(buf, start, end) {
  9836. var ret = ''
  9837. end = Math.min(buf.length, end)
  9838. for (var i = start; i < end; ++i) {
  9839. ret += String.fromCharCode(buf[i] & 0x7F)
  9840. }
  9841. return ret
  9842. }
  9843. function latin1Slice(buf, start, end) {
  9844. var ret = ''
  9845. end = Math.min(buf.length, end)
  9846. for (var i = start; i < end; ++i) {
  9847. ret += String.fromCharCode(buf[i])
  9848. }
  9849. return ret
  9850. }
  9851. function hexSlice(buf, start, end) {
  9852. var len = buf.length
  9853. if (!start || start < 0) start = 0
  9854. if (!end || end < 0 || end > len) end = len
  9855. var out = ''
  9856. for (var i = start; i < end; ++i) {
  9857. out += toHex(buf[i])
  9858. }
  9859. return out
  9860. }
  9861. function utf16leSlice(buf, start, end) {
  9862. var bytes = buf.slice(start, end)
  9863. var res = ''
  9864. for (var i = 0; i < bytes.length; i += 2) {
  9865. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  9866. }
  9867. return res
  9868. }
  9869. Buffer.prototype.slice = function slice(start, end) {
  9870. var len = this.length
  9871. start = ~~start
  9872. end = end === undefined ? len : ~~end
  9873. if (start < 0) {
  9874. start += len
  9875. if (start < 0) start = 0
  9876. } else if (start > len) {
  9877. start = len
  9878. }
  9879. if (end < 0) {
  9880. end += len
  9881. if (end < 0) end = 0
  9882. } else if (end > len) {
  9883. end = len
  9884. }
  9885. if (end < start) end = start
  9886. var newBuf
  9887. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9888. newBuf = this.subarray(start, end)
  9889. newBuf.__proto__ = Buffer.prototype
  9890. } else {
  9891. var sliceLen = end - start
  9892. newBuf = new Buffer(sliceLen, undefined)
  9893. for (var i = 0; i < sliceLen; ++i) {
  9894. newBuf[i] = this[i + start]
  9895. }
  9896. }
  9897. return newBuf
  9898. }
  9899. /*
  9900. * Need to make sure that buffer isn't trying to write out of bounds.
  9901. */
  9902. function checkOffset(offset, ext, length) {
  9903. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  9904. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  9905. }
  9906. Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
  9907. offset = offset | 0
  9908. byteLength = byteLength | 0
  9909. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9910. var val = this[offset]
  9911. var mul = 1
  9912. var i = 0
  9913. while (++i < byteLength && (mul *= 0x100)) {
  9914. val += this[offset + i] * mul
  9915. }
  9916. return val
  9917. }
  9918. Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
  9919. offset = offset | 0
  9920. byteLength = byteLength | 0
  9921. if (!noAssert) {
  9922. checkOffset(offset, byteLength, this.length)
  9923. }
  9924. var val = this[offset + --byteLength]
  9925. var mul = 1
  9926. while (byteLength > 0 && (mul *= 0x100)) {
  9927. val += this[offset + --byteLength] * mul
  9928. }
  9929. return val
  9930. }
  9931. Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
  9932. if (!noAssert) checkOffset(offset, 1, this.length)
  9933. return this[offset]
  9934. }
  9935. Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
  9936. if (!noAssert) checkOffset(offset, 2, this.length)
  9937. return this[offset] | (this[offset + 1] << 8)
  9938. }
  9939. Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
  9940. if (!noAssert) checkOffset(offset, 2, this.length)
  9941. return (this[offset] << 8) | this[offset + 1]
  9942. }
  9943. Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
  9944. if (!noAssert) checkOffset(offset, 4, this.length)
  9945. return ((this[offset]) |
  9946. (this[offset + 1] << 8) |
  9947. (this[offset + 2] << 16)) +
  9948. (this[offset + 3] * 0x1000000)
  9949. }
  9950. Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
  9951. if (!noAssert) checkOffset(offset, 4, this.length)
  9952. return (this[offset] * 0x1000000) +
  9953. ((this[offset + 1] << 16) |
  9954. (this[offset + 2] << 8) |
  9955. this[offset + 3])
  9956. }
  9957. Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
  9958. offset = offset | 0
  9959. byteLength = byteLength | 0
  9960. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9961. var val = this[offset]
  9962. var mul = 1
  9963. var i = 0
  9964. while (++i < byteLength && (mul *= 0x100)) {
  9965. val += this[offset + i] * mul
  9966. }
  9967. mul *= 0x80
  9968. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  9969. return val
  9970. }
  9971. Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
  9972. offset = offset | 0
  9973. byteLength = byteLength | 0
  9974. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9975. var i = byteLength
  9976. var mul = 1
  9977. var val = this[offset + --i]
  9978. while (i > 0 && (mul *= 0x100)) {
  9979. val += this[offset + --i] * mul
  9980. }
  9981. mul *= 0x80
  9982. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  9983. return val
  9984. }
  9985. Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
  9986. if (!noAssert) checkOffset(offset, 1, this.length)
  9987. if (!(this[offset] & 0x80)) return (this[offset])
  9988. return ((0xff - this[offset] + 1) * -1)
  9989. }
  9990. Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
  9991. if (!noAssert) checkOffset(offset, 2, this.length)
  9992. var val = this[offset] | (this[offset + 1] << 8)
  9993. return (val & 0x8000) ? val | 0xFFFF0000 : val
  9994. }
  9995. Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
  9996. if (!noAssert) checkOffset(offset, 2, this.length)
  9997. var val = this[offset + 1] | (this[offset] << 8)
  9998. return (val & 0x8000) ? val | 0xFFFF0000 : val
  9999. }
  10000. Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
  10001. if (!noAssert) checkOffset(offset, 4, this.length)
  10002. return (this[offset]) |
  10003. (this[offset + 1] << 8) |
  10004. (this[offset + 2] << 16) |
  10005. (this[offset + 3] << 24)
  10006. }
  10007. Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
  10008. if (!noAssert) checkOffset(offset, 4, this.length)
  10009. return (this[offset] << 24) |
  10010. (this[offset + 1] << 16) |
  10011. (this[offset + 2] << 8) |
  10012. (this[offset + 3])
  10013. }
  10014. Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
  10015. if (!noAssert) checkOffset(offset, 4, this.length)
  10016. return ieee754.read(this, offset, true, 23, 4)
  10017. }
  10018. Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
  10019. if (!noAssert) checkOffset(offset, 4, this.length)
  10020. return ieee754.read(this, offset, false, 23, 4)
  10021. }
  10022. Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
  10023. if (!noAssert) checkOffset(offset, 8, this.length)
  10024. return ieee754.read(this, offset, true, 52, 8)
  10025. }
  10026. Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
  10027. if (!noAssert) checkOffset(offset, 8, this.length)
  10028. return ieee754.read(this, offset, false, 52, 8)
  10029. }
  10030. function checkInt(buf, value, offset, ext, max, min) {
  10031. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  10032. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  10033. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  10034. }
  10035. Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
  10036. value = +value
  10037. offset = offset | 0
  10038. byteLength = byteLength | 0
  10039. if (!noAssert) {
  10040. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  10041. checkInt(this, value, offset, byteLength, maxBytes, 0)
  10042. }
  10043. var mul = 1
  10044. var i = 0
  10045. this[offset] = value & 0xFF
  10046. while (++i < byteLength && (mul *= 0x100)) {
  10047. this[offset + i] = (value / mul) & 0xFF
  10048. }
  10049. return offset + byteLength
  10050. }
  10051. Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
  10052. value = +value
  10053. offset = offset | 0
  10054. byteLength = byteLength | 0
  10055. if (!noAssert) {
  10056. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  10057. checkInt(this, value, offset, byteLength, maxBytes, 0)
  10058. }
  10059. var i = byteLength - 1
  10060. var mul = 1
  10061. this[offset + i] = value & 0xFF
  10062. while (--i >= 0 && (mul *= 0x100)) {
  10063. this[offset + i] = (value / mul) & 0xFF
  10064. }
  10065. return offset + byteLength
  10066. }
  10067. Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
  10068. value = +value
  10069. offset = offset | 0
  10070. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  10071. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  10072. this[offset] = (value & 0xff)
  10073. return offset + 1
  10074. }
  10075. function objectWriteUInt16(buf, value, offset, littleEndian) {
  10076. if (value < 0) value = 0xffff + value + 1
  10077. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  10078. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  10079. (littleEndian ? i : 1 - i) * 8
  10080. }
  10081. }
  10082. Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
  10083. value = +value
  10084. offset = offset | 0
  10085. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  10086. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10087. this[offset] = (value & 0xff)
  10088. this[offset + 1] = (value >>> 8)
  10089. } else {
  10090. objectWriteUInt16(this, value, offset, true)
  10091. }
  10092. return offset + 2
  10093. }
  10094. Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
  10095. value = +value
  10096. offset = offset | 0
  10097. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  10098. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10099. this[offset] = (value >>> 8)
  10100. this[offset + 1] = (value & 0xff)
  10101. } else {
  10102. objectWriteUInt16(this, value, offset, false)
  10103. }
  10104. return offset + 2
  10105. }
  10106. function objectWriteUInt32(buf, value, offset, littleEndian) {
  10107. if (value < 0) value = 0xffffffff + value + 1
  10108. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  10109. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  10110. }
  10111. }
  10112. Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
  10113. value = +value
  10114. offset = offset | 0
  10115. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  10116. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10117. this[offset + 3] = (value >>> 24)
  10118. this[offset + 2] = (value >>> 16)
  10119. this[offset + 1] = (value >>> 8)
  10120. this[offset] = (value & 0xff)
  10121. } else {
  10122. objectWriteUInt32(this, value, offset, true)
  10123. }
  10124. return offset + 4
  10125. }
  10126. Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
  10127. value = +value
  10128. offset = offset | 0
  10129. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  10130. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10131. this[offset] = (value >>> 24)
  10132. this[offset + 1] = (value >>> 16)
  10133. this[offset + 2] = (value >>> 8)
  10134. this[offset + 3] = (value & 0xff)
  10135. } else {
  10136. objectWriteUInt32(this, value, offset, false)
  10137. }
  10138. return offset + 4
  10139. }
  10140. Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
  10141. value = +value
  10142. offset = offset | 0
  10143. if (!noAssert) {
  10144. var limit = Math.pow(2, 8 * byteLength - 1)
  10145. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  10146. }
  10147. var i = 0
  10148. var mul = 1
  10149. var sub = 0
  10150. this[offset] = value & 0xFF
  10151. while (++i < byteLength && (mul *= 0x100)) {
  10152. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  10153. sub = 1
  10154. }
  10155. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  10156. }
  10157. return offset + byteLength
  10158. }
  10159. Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
  10160. value = +value
  10161. offset = offset | 0
  10162. if (!noAssert) {
  10163. var limit = Math.pow(2, 8 * byteLength - 1)
  10164. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  10165. }
  10166. var i = byteLength - 1
  10167. var mul = 1
  10168. var sub = 0
  10169. this[offset + i] = value & 0xFF
  10170. while (--i >= 0 && (mul *= 0x100)) {
  10171. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  10172. sub = 1
  10173. }
  10174. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  10175. }
  10176. return offset + byteLength
  10177. }
  10178. Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
  10179. value = +value
  10180. offset = offset | 0
  10181. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  10182. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  10183. if (value < 0) value = 0xff + value + 1
  10184. this[offset] = (value & 0xff)
  10185. return offset + 1
  10186. }
  10187. Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
  10188. value = +value
  10189. offset = offset | 0
  10190. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  10191. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10192. this[offset] = (value & 0xff)
  10193. this[offset + 1] = (value >>> 8)
  10194. } else {
  10195. objectWriteUInt16(this, value, offset, true)
  10196. }
  10197. return offset + 2
  10198. }
  10199. Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
  10200. value = +value
  10201. offset = offset | 0
  10202. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  10203. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10204. this[offset] = (value >>> 8)
  10205. this[offset + 1] = (value & 0xff)
  10206. } else {
  10207. objectWriteUInt16(this, value, offset, false)
  10208. }
  10209. return offset + 2
  10210. }
  10211. Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
  10212. value = +value
  10213. offset = offset | 0
  10214. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  10215. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10216. this[offset] = (value & 0xff)
  10217. this[offset + 1] = (value >>> 8)
  10218. this[offset + 2] = (value >>> 16)
  10219. this[offset + 3] = (value >>> 24)
  10220. } else {
  10221. objectWriteUInt32(this, value, offset, true)
  10222. }
  10223. return offset + 4
  10224. }
  10225. Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
  10226. value = +value
  10227. offset = offset | 0
  10228. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  10229. if (value < 0) value = 0xffffffff + value + 1
  10230. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10231. this[offset] = (value >>> 24)
  10232. this[offset + 1] = (value >>> 16)
  10233. this[offset + 2] = (value >>> 8)
  10234. this[offset + 3] = (value & 0xff)
  10235. } else {
  10236. objectWriteUInt32(this, value, offset, false)
  10237. }
  10238. return offset + 4
  10239. }
  10240. function checkIEEE754(buf, value, offset, ext, max, min) {
  10241. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  10242. if (offset < 0) throw new RangeError('Index out of range')
  10243. }
  10244. function writeFloat(buf, value, offset, littleEndian, noAssert) {
  10245. if (!noAssert) {
  10246. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  10247. }
  10248. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  10249. return offset + 4
  10250. }
  10251. Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
  10252. return writeFloat(this, value, offset, true, noAssert)
  10253. }
  10254. Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
  10255. return writeFloat(this, value, offset, false, noAssert)
  10256. }
  10257. function writeDouble(buf, value, offset, littleEndian, noAssert) {
  10258. if (!noAssert) {
  10259. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  10260. }
  10261. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  10262. return offset + 8
  10263. }
  10264. Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
  10265. return writeDouble(this, value, offset, true, noAssert)
  10266. }
  10267. Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
  10268. return writeDouble(this, value, offset, false, noAssert)
  10269. }
  10270. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  10271. Buffer.prototype.copy = function copy(target, targetStart, start, end) {
  10272. if (!start) start = 0
  10273. if (!end && end !== 0) end = this.length
  10274. if (targetStart >= target.length) targetStart = target.length
  10275. if (!targetStart) targetStart = 0
  10276. if (end > 0 && end < start) end = start
  10277. // Copy 0 bytes; we're done
  10278. if (end === start) return 0
  10279. if (target.length === 0 || this.length === 0) return 0
  10280. // Fatal error conditions
  10281. if (targetStart < 0) {
  10282. throw new RangeError('targetStart out of bounds')
  10283. }
  10284. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  10285. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  10286. // Are we oob?
  10287. if (end > this.length) end = this.length
  10288. if (target.length - targetStart < end - start) {
  10289. end = target.length - targetStart + start
  10290. }
  10291. var len = end - start
  10292. var i
  10293. if (this === target && start < targetStart && targetStart < end) {
  10294. // descending copy from end
  10295. for (i = len - 1; i >= 0; --i) {
  10296. target[i + targetStart] = this[i + start]
  10297. }
  10298. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  10299. // ascending copy from start
  10300. for (i = 0; i < len; ++i) {
  10301. target[i + targetStart] = this[i + start]
  10302. }
  10303. } else {
  10304. Uint8Array.prototype.set.call(
  10305. target,
  10306. this.subarray(start, start + len),
  10307. targetStart
  10308. )
  10309. }
  10310. return len
  10311. }
  10312. // Usage:
  10313. // buffer.fill(number[, offset[, end]])
  10314. // buffer.fill(buffer[, offset[, end]])
  10315. // buffer.fill(string[, offset[, end]][, encoding])
  10316. Buffer.prototype.fill = function fill(val, start, end, encoding) {
  10317. // Handle string cases:
  10318. if (typeof val === 'string') {
  10319. if (typeof start === 'string') {
  10320. encoding = start
  10321. start = 0
  10322. end = this.length
  10323. } else if (typeof end === 'string') {
  10324. encoding = end
  10325. end = this.length
  10326. }
  10327. if (val.length === 1) {
  10328. var code = val.charCodeAt(0)
  10329. if (code < 256) {
  10330. val = code
  10331. }
  10332. }
  10333. if (encoding !== undefined && typeof encoding !== 'string') {
  10334. throw new TypeError('encoding must be a string')
  10335. }
  10336. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  10337. throw new TypeError('Unknown encoding: ' + encoding)
  10338. }
  10339. } else if (typeof val === 'number') {
  10340. val = val & 255
  10341. }
  10342. // Invalid ranges are not set to a default, so can range check early.
  10343. if (start < 0 || this.length < start || this.length < end) {
  10344. throw new RangeError('Out of range index')
  10345. }
  10346. if (end <= start) {
  10347. return this
  10348. }
  10349. start = start >>> 0
  10350. end = end === undefined ? this.length : end >>> 0
  10351. if (!val) val = 0
  10352. var i
  10353. if (typeof val === 'number') {
  10354. for (i = start; i < end; ++i) {
  10355. this[i] = val
  10356. }
  10357. } else {
  10358. var bytes = Buffer.isBuffer(val) ?
  10359. val :
  10360. utf8ToBytes(new Buffer(val, encoding).toString())
  10361. var len = bytes.length
  10362. for (i = 0; i < end - start; ++i) {
  10363. this[i + start] = bytes[i % len]
  10364. }
  10365. }
  10366. return this
  10367. }
  10368. // HELPER FUNCTIONS
  10369. // ================
  10370. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  10371. function base64clean(str) {
  10372. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  10373. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  10374. // Node converts strings with length < 2 to ''
  10375. if (str.length < 2) return ''
  10376. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  10377. while (str.length % 4 !== 0) {
  10378. str = str + '='
  10379. }
  10380. return str
  10381. }
  10382. function stringtrim(str) {
  10383. if (str.trim) return str.trim()
  10384. return str.replace(/^\s+|\s+$/g, '')
  10385. }
  10386. function toHex(n) {
  10387. if (n < 16) return '0' + n.toString(16)
  10388. return n.toString(16)
  10389. }
  10390. function utf8ToBytes(string, units) {
  10391. units = units || Infinity
  10392. var codePoint
  10393. var length = string.length
  10394. var leadSurrogate = null
  10395. var bytes = []
  10396. for (var i = 0; i < length; ++i) {
  10397. codePoint = string.charCodeAt(i)
  10398. // is surrogate component
  10399. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  10400. // last char was a lead
  10401. if (!leadSurrogate) {
  10402. // no lead yet
  10403. if (codePoint > 0xDBFF) {
  10404. // unexpected trail
  10405. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  10406. continue
  10407. } else if (i + 1 === length) {
  10408. // unpaired lead
  10409. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  10410. continue
  10411. }
  10412. // valid lead
  10413. leadSurrogate = codePoint
  10414. continue
  10415. }
  10416. // 2 leads in a row
  10417. if (codePoint < 0xDC00) {
  10418. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  10419. leadSurrogate = codePoint
  10420. continue
  10421. }
  10422. // valid surrogate pair
  10423. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  10424. } else if (leadSurrogate) {
  10425. // valid bmp char, but last char was a lead
  10426. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  10427. }
  10428. leadSurrogate = null
  10429. // encode utf8
  10430. if (codePoint < 0x80) {
  10431. if ((units -= 1) < 0) break
  10432. bytes.push(codePoint)
  10433. } else if (codePoint < 0x800) {
  10434. if ((units -= 2) < 0) break
  10435. bytes.push(
  10436. codePoint >> 0x6 | 0xC0,
  10437. codePoint & 0x3F | 0x80
  10438. )
  10439. } else if (codePoint < 0x10000) {
  10440. if ((units -= 3) < 0) break
  10441. bytes.push(
  10442. codePoint >> 0xC | 0xE0,
  10443. codePoint >> 0x6 & 0x3F | 0x80,
  10444. codePoint & 0x3F | 0x80
  10445. )
  10446. } else if (codePoint < 0x110000) {
  10447. if ((units -= 4) < 0) break
  10448. bytes.push(
  10449. codePoint >> 0x12 | 0xF0,
  10450. codePoint >> 0xC & 0x3F | 0x80,
  10451. codePoint >> 0x6 & 0x3F | 0x80,
  10452. codePoint & 0x3F | 0x80
  10453. )
  10454. } else {
  10455. throw new Error('Invalid code point')
  10456. }
  10457. }
  10458. return bytes
  10459. }
  10460. function asciiToBytes(str) {
  10461. var byteArray = []
  10462. for (var i = 0; i < str.length; ++i) {
  10463. // Node's code seems to be doing this and not & 0x7F..
  10464. byteArray.push(str.charCodeAt(i) & 0xFF)
  10465. }
  10466. return byteArray
  10467. }
  10468. function utf16leToBytes(str, units) {
  10469. var c, hi, lo
  10470. var byteArray = []
  10471. for (var i = 0; i < str.length; ++i) {
  10472. if ((units -= 2) < 0) break
  10473. c = str.charCodeAt(i)
  10474. hi = c >> 8
  10475. lo = c % 256
  10476. byteArray.push(lo)
  10477. byteArray.push(hi)
  10478. }
  10479. return byteArray
  10480. }
  10481. function base64ToBytes(str) {
  10482. return base64.toByteArray(base64clean(str))
  10483. }
  10484. function blitBuffer(src, dst, offset, length) {
  10485. for (var i = 0; i < length; ++i) {
  10486. if ((i + offset >= dst.length) || (i >= src.length)) break
  10487. dst[i + offset] = src[i]
  10488. }
  10489. return i
  10490. }
  10491. function isnan(val) {
  10492. return val !== val // eslint-disable-line no-self-compare
  10493. }
  10494. /* WEBPACK VAR INJECTION */
  10495. }.call(this, __webpack_require__( /*! ./../webpack/buildin/global.js */ 2)))
  10496. /***/
  10497. }),
  10498. /* 22 */
  10499. /*!*****************************************!*\
  10500. !*** ./node_modules/base64-js/index.js ***!
  10501. \*****************************************/
  10502. /*! no static exports found */
  10503. /***/
  10504. (function (module, exports, __webpack_require__) {
  10505. "use strict";
  10506. exports.byteLength = byteLength
  10507. exports.toByteArray = toByteArray
  10508. exports.fromByteArray = fromByteArray
  10509. var lookup = []
  10510. var revLookup = []
  10511. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  10512. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  10513. for (var i = 0, len = code.length; i < len; ++i) {
  10514. lookup[i] = code[i]
  10515. revLookup[code.charCodeAt(i)] = i
  10516. }
  10517. // Support decoding URL-safe base64 strings, as Node.js does.
  10518. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  10519. revLookup['-'.charCodeAt(0)] = 62
  10520. revLookup['_'.charCodeAt(0)] = 63
  10521. function getLens(b64) {
  10522. var len = b64.length
  10523. if (len % 4 > 0) {
  10524. throw new Error('Invalid string. Length must be a multiple of 4')
  10525. }
  10526. // Trim off extra bytes after placeholder bytes are found
  10527. // See: https://github.com/beatgammit/base64-js/issues/42
  10528. var validLen = b64.indexOf('=')
  10529. if (validLen === -1) validLen = len
  10530. var placeHoldersLen = validLen === len ?
  10531. 0 :
  10532. 4 - (validLen % 4)
  10533. return [validLen, placeHoldersLen]
  10534. }
  10535. // base64 is 4/3 + up to two characters of the original data
  10536. function byteLength(b64) {
  10537. var lens = getLens(b64)
  10538. var validLen = lens[0]
  10539. var placeHoldersLen = lens[1]
  10540. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  10541. }
  10542. function _byteLength(b64, validLen, placeHoldersLen) {
  10543. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  10544. }
  10545. function toByteArray(b64) {
  10546. var tmp
  10547. var lens = getLens(b64)
  10548. var validLen = lens[0]
  10549. var placeHoldersLen = lens[1]
  10550. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  10551. var curByte = 0
  10552. // if there are placeholders, only get up to the last complete 4 chars
  10553. var len = placeHoldersLen > 0 ?
  10554. validLen - 4 :
  10555. validLen
  10556. var i
  10557. for (i = 0; i < len; i += 4) {
  10558. tmp =
  10559. (revLookup[b64.charCodeAt(i)] << 18) |
  10560. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  10561. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  10562. revLookup[b64.charCodeAt(i + 3)]
  10563. arr[curByte++] = (tmp >> 16) & 0xFF
  10564. arr[curByte++] = (tmp >> 8) & 0xFF
  10565. arr[curByte++] = tmp & 0xFF
  10566. }
  10567. if (placeHoldersLen === 2) {
  10568. tmp =
  10569. (revLookup[b64.charCodeAt(i)] << 2) |
  10570. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  10571. arr[curByte++] = tmp & 0xFF
  10572. }
  10573. if (placeHoldersLen === 1) {
  10574. tmp =
  10575. (revLookup[b64.charCodeAt(i)] << 10) |
  10576. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  10577. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  10578. arr[curByte++] = (tmp >> 8) & 0xFF
  10579. arr[curByte++] = tmp & 0xFF
  10580. }
  10581. return arr
  10582. }
  10583. function tripletToBase64(num) {
  10584. return lookup[num >> 18 & 0x3F] +
  10585. lookup[num >> 12 & 0x3F] +
  10586. lookup[num >> 6 & 0x3F] +
  10587. lookup[num & 0x3F]
  10588. }
  10589. function encodeChunk(uint8, start, end) {
  10590. var tmp
  10591. var output = []
  10592. for (var i = start; i < end; i += 3) {
  10593. tmp =
  10594. ((uint8[i] << 16) & 0xFF0000) +
  10595. ((uint8[i + 1] << 8) & 0xFF00) +
  10596. (uint8[i + 2] & 0xFF)
  10597. output.push(tripletToBase64(tmp))
  10598. }
  10599. return output.join('')
  10600. }
  10601. function fromByteArray(uint8) {
  10602. var tmp
  10603. var len = uint8.length
  10604. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  10605. var parts = []
  10606. var maxChunkLength = 16383 // must be multiple of 3
  10607. // go through the array every three bytes, we'll deal with trailing stuff later
  10608. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  10609. parts.push(encodeChunk(
  10610. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  10611. ))
  10612. }
  10613. // pad the end with zeros, but make sure to not forget the extra bytes
  10614. if (extraBytes === 1) {
  10615. tmp = uint8[len - 1]
  10616. parts.push(
  10617. lookup[tmp >> 2] +
  10618. lookup[(tmp << 4) & 0x3F] +
  10619. '=='
  10620. )
  10621. } else if (extraBytes === 2) {
  10622. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  10623. parts.push(
  10624. lookup[tmp >> 10] +
  10625. lookup[(tmp >> 4) & 0x3F] +
  10626. lookup[(tmp << 2) & 0x3F] +
  10627. '='
  10628. )
  10629. }
  10630. return parts.join('')
  10631. }
  10632. /***/
  10633. }),
  10634. /* 23 */
  10635. /*!***************************************!*\
  10636. !*** ./node_modules/ieee754/index.js ***!
  10637. \***************************************/
  10638. /*! no static exports found */
  10639. /***/
  10640. (function (module, exports) {
  10641. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  10642. var e, m
  10643. var eLen = (nBytes * 8) - mLen - 1
  10644. var eMax = (1 << eLen) - 1
  10645. var eBias = eMax >> 1
  10646. var nBits = -7
  10647. var i = isLE ? (nBytes - 1) : 0
  10648. var d = isLE ? -1 : 1
  10649. var s = buffer[offset + i]
  10650. i += d
  10651. e = s & ((1 << (-nBits)) - 1)
  10652. s >>= (-nBits)
  10653. nBits += eLen
  10654. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  10655. m = e & ((1 << (-nBits)) - 1)
  10656. e >>= (-nBits)
  10657. nBits += mLen
  10658. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  10659. if (e === 0) {
  10660. e = 1 - eBias
  10661. } else if (e === eMax) {
  10662. return m ? NaN : ((s ? -1 : 1) * Infinity)
  10663. } else {
  10664. m = m + Math.pow(2, mLen)
  10665. e = e - eBias
  10666. }
  10667. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  10668. }
  10669. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  10670. var e, m, c
  10671. var eLen = (nBytes * 8) - mLen - 1
  10672. var eMax = (1 << eLen) - 1
  10673. var eBias = eMax >> 1
  10674. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  10675. var i = isLE ? 0 : (nBytes - 1)
  10676. var d = isLE ? 1 : -1
  10677. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  10678. value = Math.abs(value)
  10679. if (isNaN(value) || value === Infinity) {
  10680. m = isNaN(value) ? 1 : 0
  10681. e = eMax
  10682. } else {
  10683. e = Math.floor(Math.log(value) / Math.LN2)
  10684. if (value * (c = Math.pow(2, -e)) < 1) {
  10685. e--
  10686. c *= 2
  10687. }
  10688. if (e + eBias >= 1) {
  10689. value += rt / c
  10690. } else {
  10691. value += rt * Math.pow(2, 1 - eBias)
  10692. }
  10693. if (value * c >= 2) {
  10694. e++
  10695. c /= 2
  10696. }
  10697. if (e + eBias >= eMax) {
  10698. m = 0
  10699. e = eMax
  10700. } else if (e + eBias >= 1) {
  10701. m = ((value * c) - 1) * Math.pow(2, mLen)
  10702. e = e + eBias
  10703. } else {
  10704. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  10705. e = 0
  10706. }
  10707. }
  10708. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  10709. e = (e << mLen) | m
  10710. eLen += mLen
  10711. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  10712. buffer[offset + i - d] |= s * 128
  10713. }
  10714. /***/
  10715. }),
  10716. /* 24 */
  10717. /*!***************************************!*\
  10718. !*** ./node_modules/isarray/index.js ***!
  10719. \***************************************/
  10720. /*! no static exports found */
  10721. /***/
  10722. (function (module, exports) {
  10723. var toString = {}.toString;
  10724. module.exports = Array.isArray || function (arr) {
  10725. return toString.call(arr) == '[object Array]';
  10726. };
  10727. /***/
  10728. })
  10729. ]
  10730. ]);
  10731. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map