vendor.js 431 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745
  1. (my["webpackJsonp"] = my["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!************************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-alipay/dist/index.js ***!
  6. \************************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. /* WEBPACK VAR INJECTION */(function(global) {
  11. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 3);
  12. Object.defineProperty(exports, "__esModule", {
  13. value: true
  14. });
  15. exports.createApp = createApp;
  16. exports.createComponent = createComponent;
  17. exports.createPage = createPage;
  18. exports.createPlugin = createPlugin;
  19. exports.createSubpackageApp = createSubpackageApp;
  20. exports.default = void 0;
  21. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 4));
  22. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 10));
  23. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 14));
  24. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 15));
  25. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 16));
  26. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 12));
  27. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 20);
  28. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 21));
  29. var realAtob;
  30. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  31. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  32. if (typeof atob !== 'function') {
  33. realAtob = function realAtob(str) {
  34. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  35. if (!b64re.test(str)) {
  36. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  37. }
  38. // Adding the padding if missing, for semplicity
  39. str += '=='.slice(2 - (str.length & 3));
  40. var bitmap;
  41. var result = '';
  42. var r1;
  43. var r2;
  44. var i = 0;
  45. for (; i < str.length;) {
  46. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  47. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  48. }
  49. return result;
  50. };
  51. } else {
  52. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  53. realAtob = atob;
  54. }
  55. function b64DecodeUnicode(str) {
  56. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  57. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  58. }).join(''));
  59. }
  60. function getCurrentUserInfo() {
  61. var token = my.getStorageSync('uni_id_token') || '';
  62. var tokenArr = token.split('.');
  63. if (!token || tokenArr.length !== 3) {
  64. return {
  65. uid: null,
  66. role: [],
  67. permission: [],
  68. tokenExpired: 0
  69. };
  70. }
  71. var userInfo;
  72. try {
  73. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  74. } catch (error) {
  75. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  76. }
  77. userInfo.tokenExpired = userInfo.exp * 1000;
  78. delete userInfo.exp;
  79. delete userInfo.iat;
  80. return userInfo;
  81. }
  82. function uniIdMixin(Vue) {
  83. Vue.prototype.uniIDHasRole = function (roleId) {
  84. var _getCurrentUserInfo = getCurrentUserInfo(),
  85. role = _getCurrentUserInfo.role;
  86. return role.indexOf(roleId) > -1;
  87. };
  88. Vue.prototype.uniIDHasPermission = function (permissionId) {
  89. var _getCurrentUserInfo2 = getCurrentUserInfo(),
  90. permission = _getCurrentUserInfo2.permission;
  91. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  92. };
  93. Vue.prototype.uniIDTokenValid = function () {
  94. var _getCurrentUserInfo3 = getCurrentUserInfo(),
  95. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  96. return tokenExpired > Date.now();
  97. };
  98. }
  99. var _toString = Object.prototype.toString;
  100. var hasOwnProperty = Object.prototype.hasOwnProperty;
  101. function isFn(fn) {
  102. return typeof fn === 'function';
  103. }
  104. function isStr(str) {
  105. return typeof str === 'string';
  106. }
  107. function isObject(obj) {
  108. return obj !== null && (0, _typeof2.default)(obj) === 'object';
  109. }
  110. function isPlainObject(obj) {
  111. return _toString.call(obj) === '[object Object]';
  112. }
  113. function hasOwn(obj, key) {
  114. return hasOwnProperty.call(obj, key);
  115. }
  116. function noop() {}
  117. /**
  118. * Create a cached version of a pure function.
  119. */
  120. function cached(fn) {
  121. var cache = Object.create(null);
  122. return function cachedFn(str) {
  123. var hit = cache[str];
  124. return hit || (cache[str] = fn(str));
  125. };
  126. }
  127. /**
  128. * Camelize a hyphen-delimited string.
  129. */
  130. var camelizeRE = /-(\w)/g;
  131. var camelize = cached(function (str) {
  132. return str.replace(camelizeRE, function (_, c) {
  133. return c ? c.toUpperCase() : '';
  134. });
  135. });
  136. var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
  137. var globalInterceptors = {};
  138. var scopedInterceptors = {};
  139. function mergeHook(parentVal, childVal) {
  140. var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
  141. return res ? dedupeHooks(res) : res;
  142. }
  143. function dedupeHooks(hooks) {
  144. var res = [];
  145. for (var i = 0; i < hooks.length; i++) {
  146. if (res.indexOf(hooks[i]) === -1) {
  147. res.push(hooks[i]);
  148. }
  149. }
  150. return res;
  151. }
  152. function removeHook(hooks, hook) {
  153. var index = hooks.indexOf(hook);
  154. if (index !== -1) {
  155. hooks.splice(index, 1);
  156. }
  157. }
  158. function mergeInterceptorHook(interceptor, option) {
  159. Object.keys(option).forEach(function (hook) {
  160. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  161. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  162. }
  163. });
  164. }
  165. function removeInterceptorHook(interceptor, option) {
  166. if (!interceptor || !option) {
  167. return;
  168. }
  169. Object.keys(option).forEach(function (hook) {
  170. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  171. removeHook(interceptor[hook], option[hook]);
  172. }
  173. });
  174. }
  175. function addInterceptor(method, option) {
  176. if (typeof method === 'string' && isPlainObject(option)) {
  177. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  178. } else if (isPlainObject(method)) {
  179. mergeInterceptorHook(globalInterceptors, method);
  180. }
  181. }
  182. function removeInterceptor(method, option) {
  183. if (typeof method === 'string') {
  184. if (isPlainObject(option)) {
  185. removeInterceptorHook(scopedInterceptors[method], option);
  186. } else {
  187. delete scopedInterceptors[method];
  188. }
  189. } else if (isPlainObject(method)) {
  190. removeInterceptorHook(globalInterceptors, method);
  191. }
  192. }
  193. function wrapperHook(hook, params) {
  194. return function (data) {
  195. return hook(data, params) || data;
  196. };
  197. }
  198. function isPromise(obj) {
  199. return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  200. }
  201. function queue(hooks, data, params) {
  202. var promise = false;
  203. for (var i = 0; i < hooks.length; i++) {
  204. var hook = hooks[i];
  205. if (promise) {
  206. promise = Promise.resolve(wrapperHook(hook, params));
  207. } else {
  208. var res = hook(data, params);
  209. if (isPromise(res)) {
  210. promise = Promise.resolve(res);
  211. }
  212. if (res === false) {
  213. return {
  214. then: function then() {}
  215. };
  216. }
  217. }
  218. }
  219. return promise || {
  220. then: function then(callback) {
  221. return callback(data);
  222. }
  223. };
  224. }
  225. function wrapperOptions(interceptor) {
  226. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  227. ['success', 'fail', 'complete'].forEach(function (name) {
  228. if (Array.isArray(interceptor[name])) {
  229. var oldCallback = options[name];
  230. options[name] = function callbackInterceptor(res) {
  231. queue(interceptor[name], res, options).then(function (res) {
  232. /* eslint-disable no-mixed-operators */
  233. return isFn(oldCallback) && oldCallback(res) || res;
  234. });
  235. };
  236. }
  237. });
  238. return options;
  239. }
  240. function wrapperReturnValue(method, returnValue) {
  241. var returnValueHooks = [];
  242. if (Array.isArray(globalInterceptors.returnValue)) {
  243. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
  244. }
  245. var interceptor = scopedInterceptors[method];
  246. if (interceptor && Array.isArray(interceptor.returnValue)) {
  247. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
  248. }
  249. returnValueHooks.forEach(function (hook) {
  250. returnValue = hook(returnValue) || returnValue;
  251. });
  252. return returnValue;
  253. }
  254. function getApiInterceptorHooks(method) {
  255. var interceptor = Object.create(null);
  256. Object.keys(globalInterceptors).forEach(function (hook) {
  257. if (hook !== 'returnValue') {
  258. interceptor[hook] = globalInterceptors[hook].slice();
  259. }
  260. });
  261. var scopedInterceptor = scopedInterceptors[method];
  262. if (scopedInterceptor) {
  263. Object.keys(scopedInterceptor).forEach(function (hook) {
  264. if (hook !== 'returnValue') {
  265. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  266. }
  267. });
  268. }
  269. return interceptor;
  270. }
  271. function invokeApi(method, api, options) {
  272. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  273. params[_key - 3] = arguments[_key];
  274. }
  275. var interceptor = getApiInterceptorHooks(method);
  276. if (interceptor && Object.keys(interceptor).length) {
  277. if (Array.isArray(interceptor.invoke)) {
  278. var res = queue(interceptor.invoke, options);
  279. return res.then(function (options) {
  280. // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
  281. return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
  282. });
  283. } else {
  284. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  285. }
  286. }
  287. return api.apply(void 0, [options].concat(params));
  288. }
  289. var promiseInterceptor = {
  290. returnValue: function returnValue(res) {
  291. if (!isPromise(res)) {
  292. return res;
  293. }
  294. return new Promise(function (resolve, reject) {
  295. res.then(function (res) {
  296. if (res[0]) {
  297. reject(res[0]);
  298. } else {
  299. resolve(res[1]);
  300. }
  301. });
  302. });
  303. }
  304. };
  305. var SYNC_API_RE = /^\$|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|initUTS|requireUTS|registerUTS/;
  306. var CONTEXT_API_RE = /^create|Manager$/;
  307. // Context例外情况
  308. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  309. // 同步例外情况
  310. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  311. var CALLBACK_API_RE = /^on|^off/;
  312. function isContextApi(name) {
  313. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  314. }
  315. function isSyncApi(name) {
  316. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  317. }
  318. function isCallbackApi(name) {
  319. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  320. }
  321. function handlePromise(promise) {
  322. return promise.then(function (data) {
  323. return [null, data];
  324. }).catch(function (err) {
  325. return [err];
  326. });
  327. }
  328. function shouldPromise(name) {
  329. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  330. return false;
  331. }
  332. return true;
  333. }
  334. /* eslint-disable no-extend-native */
  335. if (!Promise.prototype.finally) {
  336. Promise.prototype.finally = function (callback) {
  337. var promise = this.constructor;
  338. return this.then(function (value) {
  339. return promise.resolve(callback()).then(function () {
  340. return value;
  341. });
  342. }, function (reason) {
  343. return promise.resolve(callback()).then(function () {
  344. throw reason;
  345. });
  346. });
  347. };
  348. }
  349. function promisify(name, api) {
  350. if (!shouldPromise(name) || !isFn(api)) {
  351. return api;
  352. }
  353. return function promiseApi() {
  354. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  355. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  356. params[_key2 - 1] = arguments[_key2];
  357. }
  358. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  359. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  360. }
  361. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  362. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  363. success: resolve,
  364. fail: reject
  365. })].concat(params));
  366. })));
  367. };
  368. }
  369. var EPS = 1e-4;
  370. var BASE_DEVICE_WIDTH = 750;
  371. var isIOS = false;
  372. var deviceWidth = 0;
  373. var deviceDPR = 0;
  374. function checkDeviceWidth() {
  375. var _my$getSystemInfoSync = my.getSystemInfoSync(),
  376. platform = _my$getSystemInfoSync.platform,
  377. pixelRatio = _my$getSystemInfoSync.pixelRatio,
  378. windowWidth = _my$getSystemInfoSync.windowWidth; // uni=>my runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  379. deviceWidth = windowWidth;
  380. deviceDPR = pixelRatio;
  381. isIOS = platform === 'ios';
  382. }
  383. function upx2px(number, newDeviceWidth) {
  384. if (deviceWidth === 0) {
  385. checkDeviceWidth();
  386. }
  387. number = Number(number);
  388. if (number === 0) {
  389. return 0;
  390. }
  391. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  392. if (result < 0) {
  393. result = -result;
  394. }
  395. result = Math.floor(result + EPS);
  396. if (result === 0) {
  397. if (deviceDPR === 1 || !isIOS) {
  398. result = 1;
  399. } else {
  400. result = 0.5;
  401. }
  402. }
  403. return number < 0 ? -result : result;
  404. }
  405. var LOCALE_ZH_HANS = 'zh-Hans';
  406. var LOCALE_ZH_HANT = 'zh-Hant';
  407. var LOCALE_EN = 'en';
  408. var LOCALE_FR = 'fr';
  409. var LOCALE_ES = 'es';
  410. var messages = {};
  411. var locale;
  412. {
  413. locale = normalizeLocale(my.getSystemInfoSync().language) || LOCALE_EN;
  414. }
  415. function initI18nMessages() {
  416. if (!isEnableLocale()) {
  417. return;
  418. }
  419. var localeKeys = Object.keys(__uniConfig.locales);
  420. if (localeKeys.length) {
  421. localeKeys.forEach(function (locale) {
  422. var curMessages = messages[locale];
  423. var userMessages = __uniConfig.locales[locale];
  424. if (curMessages) {
  425. Object.assign(curMessages, userMessages);
  426. } else {
  427. messages[locale] = userMessages;
  428. }
  429. });
  430. }
  431. }
  432. initI18nMessages();
  433. var i18n = (0, _uniI18n.initVueI18n)(locale, {});
  434. var t = i18n.t;
  435. var i18nMixin = i18n.mixin = {
  436. beforeCreate: function beforeCreate() {
  437. var _this = this;
  438. var unwatch = i18n.i18n.watchLocale(function () {
  439. _this.$forceUpdate();
  440. });
  441. this.$once('hook:beforeDestroy', function () {
  442. unwatch();
  443. });
  444. },
  445. methods: {
  446. $$t: function $$t(key, values) {
  447. return t(key, values);
  448. }
  449. }
  450. };
  451. var setLocale = i18n.setLocale;
  452. var getLocale = i18n.getLocale;
  453. function initAppLocale(Vue, appVm, locale) {
  454. var state = Vue.observable({
  455. locale: locale || i18n.getLocale()
  456. });
  457. var localeWatchers = [];
  458. appVm.$watchLocale = function (fn) {
  459. localeWatchers.push(fn);
  460. };
  461. Object.defineProperty(appVm, '$locale', {
  462. get: function get() {
  463. return state.locale;
  464. },
  465. set: function set(v) {
  466. state.locale = v;
  467. localeWatchers.forEach(function (watch) {
  468. return watch(v);
  469. });
  470. }
  471. });
  472. }
  473. function isEnableLocale() {
  474. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  475. }
  476. function include(str, parts) {
  477. return !!parts.find(function (part) {
  478. return str.indexOf(part) !== -1;
  479. });
  480. }
  481. function startsWith(str, parts) {
  482. return parts.find(function (part) {
  483. return str.indexOf(part) === 0;
  484. });
  485. }
  486. function normalizeLocale(locale, messages) {
  487. if (!locale) {
  488. return;
  489. }
  490. locale = locale.trim().replace(/_/g, '-');
  491. if (messages && messages[locale]) {
  492. return locale;
  493. }
  494. locale = locale.toLowerCase();
  495. if (locale === 'chinese') {
  496. // 支付宝
  497. return LOCALE_ZH_HANS;
  498. }
  499. if (locale.indexOf('zh') === 0) {
  500. if (locale.indexOf('-hans') > -1) {
  501. return LOCALE_ZH_HANS;
  502. }
  503. if (locale.indexOf('-hant') > -1) {
  504. return LOCALE_ZH_HANT;
  505. }
  506. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  507. return LOCALE_ZH_HANT;
  508. }
  509. return LOCALE_ZH_HANS;
  510. }
  511. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  512. if (lang) {
  513. return lang;
  514. }
  515. }
  516. // export function initI18n() {
  517. // const localeKeys = Object.keys(__uniConfig.locales || {})
  518. // if (localeKeys.length) {
  519. // localeKeys.forEach((locale) =>
  520. // i18n.add(locale, __uniConfig.locales[locale])
  521. // )
  522. // }
  523. // }
  524. function getLocale$1() {
  525. // 优先使用 $locale
  526. if (isFn(getApp)) {
  527. var app = getApp({
  528. allowDefault: true
  529. });
  530. if (app && app.$vm) {
  531. return app.$vm.$locale;
  532. }
  533. }
  534. return normalizeLocale(my.getSystemInfoSync().language) || LOCALE_EN;
  535. }
  536. function setLocale$1(locale) {
  537. var app = isFn(getApp) ? getApp() : false;
  538. if (!app) {
  539. return false;
  540. }
  541. var oldLocale = app.$vm.$locale;
  542. if (oldLocale !== locale) {
  543. app.$vm.$locale = locale;
  544. onLocaleChangeCallbacks.forEach(function (fn) {
  545. return fn({
  546. locale: locale
  547. });
  548. });
  549. return true;
  550. }
  551. return false;
  552. }
  553. var onLocaleChangeCallbacks = [];
  554. function onLocaleChange(fn) {
  555. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  556. onLocaleChangeCallbacks.push(fn);
  557. }
  558. }
  559. if (typeof global !== 'undefined') {
  560. global.getLocale = getLocale$1;
  561. }
  562. var interceptors = {
  563. promiseInterceptor: promiseInterceptor
  564. };
  565. var baseApi = /*#__PURE__*/Object.freeze({
  566. __proto__: null,
  567. upx2px: upx2px,
  568. getLocale: getLocale$1,
  569. setLocale: setLocale$1,
  570. onLocaleChange: onLocaleChange,
  571. addInterceptor: addInterceptor,
  572. removeInterceptor: removeInterceptor,
  573. interceptors: interceptors
  574. });
  575. var EventChannel = /*#__PURE__*/function () {
  576. function EventChannel(id, events) {
  577. var _this2 = this;
  578. (0, _classCallCheck2.default)(this, EventChannel);
  579. this.id = id;
  580. this.listener = {};
  581. this.emitCache = {};
  582. if (events) {
  583. Object.keys(events).forEach(function (name) {
  584. _this2.on(name, events[name]);
  585. });
  586. }
  587. }
  588. (0, _createClass2.default)(EventChannel, [{
  589. key: "emit",
  590. value: function emit(eventName) {
  591. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  592. args[_key3 - 1] = arguments[_key3];
  593. }
  594. var fns = this.listener[eventName];
  595. if (!fns) {
  596. return (this.emitCache[eventName] || (this.emitCache[eventName] = [])).push(args);
  597. }
  598. fns.forEach(function (opt) {
  599. opt.fn.apply(opt.fn, args);
  600. });
  601. this.listener[eventName] = fns.filter(function (opt) {
  602. return opt.type !== 'once';
  603. });
  604. }
  605. }, {
  606. key: "on",
  607. value: function on(eventName, fn) {
  608. this._addListener(eventName, 'on', fn);
  609. this._clearCache(eventName);
  610. }
  611. }, {
  612. key: "once",
  613. value: function once(eventName, fn) {
  614. this._addListener(eventName, 'once', fn);
  615. this._clearCache(eventName);
  616. }
  617. }, {
  618. key: "off",
  619. value: function off(eventName, fn) {
  620. var fns = this.listener[eventName];
  621. if (!fns) {
  622. return;
  623. }
  624. if (fn) {
  625. for (var i = 0; i < fns.length;) {
  626. if (fns[i].fn === fn) {
  627. fns.splice(i, 1);
  628. i--;
  629. }
  630. i++;
  631. }
  632. } else {
  633. delete this.listener[eventName];
  634. }
  635. }
  636. }, {
  637. key: "_clearCache",
  638. value: function _clearCache(eventName) {
  639. var cacheArgs = this.emitCache[eventName];
  640. if (cacheArgs) {
  641. for (; cacheArgs.length > 0;) {
  642. this.emit.apply(this, [eventName].concat(cacheArgs.shift()));
  643. }
  644. }
  645. }
  646. }, {
  647. key: "_addListener",
  648. value: function _addListener(eventName, type, fn) {
  649. (this.listener[eventName] || (this.listener[eventName] = [])).push({
  650. fn: fn,
  651. type: type
  652. });
  653. }
  654. }]);
  655. return EventChannel;
  656. }();
  657. var eventChannels = {};
  658. var id = 0;
  659. function initEventChannel(events) {
  660. var cache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  661. id++;
  662. var eventChannel = new EventChannel(id, events);
  663. if (cache) {
  664. eventChannels[id] = eventChannel;
  665. }
  666. return eventChannel;
  667. }
  668. function getEventChannel(id) {
  669. var eventChannel = eventChannels[id];
  670. delete eventChannels[id];
  671. return eventChannel;
  672. }
  673. function navigateTo() {
  674. var eventChannel;
  675. return {
  676. args: function args(fromArgs, toArgs) {
  677. eventChannel = initEventChannel(fromArgs.events);
  678. if (fromArgs.url) {
  679. fromArgs.url = fromArgs.url + (fromArgs.url.indexOf('?') === -1 ? '?' : '&') + '__id__=' + eventChannel.id;
  680. }
  681. },
  682. returnValue: function returnValue(fromRes, toRes) {
  683. fromRes.eventChannel = eventChannel;
  684. }
  685. };
  686. }
  687. function findExistsPageIndex(url) {
  688. var pages = getCurrentPages();
  689. var len = pages.length;
  690. while (len--) {
  691. var page = pages[len];
  692. if (page.$page && page.$page.fullPath === url) {
  693. return len;
  694. }
  695. }
  696. return -1;
  697. }
  698. var redirectTo = {
  699. name: function name(fromArgs) {
  700. if (fromArgs.exists === 'back' && fromArgs.delta) {
  701. return 'navigateBack';
  702. }
  703. return 'redirectTo';
  704. },
  705. args: function args(fromArgs) {
  706. if (fromArgs.exists === 'back' && fromArgs.url) {
  707. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  708. if (existsPageIndex !== -1) {
  709. var delta = getCurrentPages().length - 1 - existsPageIndex;
  710. if (delta > 0) {
  711. fromArgs.delta = delta;
  712. }
  713. }
  714. }
  715. }
  716. };
  717. function setStorageSync(key, data) {
  718. return my.setStorageSync({
  719. key: key,
  720. data: data
  721. });
  722. }
  723. function getStorageSync(key) {
  724. var result = my.getStorageSync({
  725. key: key
  726. });
  727. // 支付宝平台会返回一个 success 值,但是目前测试的结果这个始终是 true。当没有存储数据的时候,其它平台会返回空字符串。
  728. return result.data !== null ? result.data : '';
  729. }
  730. function removeStorageSync(key) {
  731. return my.removeStorageSync({
  732. key: key
  733. });
  734. }
  735. function addSafeAreaInsets(result) {
  736. if (result.safeArea) {
  737. var safeArea = result.safeArea;
  738. result.safeAreaInsets = {
  739. top: safeArea.top,
  740. left: safeArea.left,
  741. right: result.windowWidth - safeArea.right,
  742. bottom: result.screenHeight - safeArea.bottom
  743. };
  744. }
  745. }
  746. function populateParameters(result) {
  747. var _result$brand = result.brand,
  748. brand = _result$brand === void 0 ? '' : _result$brand,
  749. _result$model = result.model,
  750. model = _result$model === void 0 ? '' : _result$model,
  751. _result$system = result.system,
  752. system = _result$system === void 0 ? '' : _result$system,
  753. _result$language = result.language,
  754. language = _result$language === void 0 ? '' : _result$language,
  755. theme = result.theme,
  756. version = result.version,
  757. platform = result.platform,
  758. fontSizeSetting = result.fontSizeSetting,
  759. SDKVersion = result.SDKVersion,
  760. pixelRatio = result.pixelRatio,
  761. deviceOrientation = result.deviceOrientation;
  762. // const isQuickApp = "mp-alipay".indexOf('quickapp-webview') !== -1
  763. var extraParam = {};
  764. // osName osVersion
  765. var osName = '';
  766. var osVersion = '';
  767. {
  768. my.canIUse('isIDE') && my.isIDE && (extraParam.platform = 'devtools');
  769. osName = platform;
  770. osVersion = system;
  771. }
  772. var hostVersion = version;
  773. // deviceType
  774. var deviceType = getGetDeviceType(result, model);
  775. // deviceModel
  776. var deviceBrand = getDeviceBrand(brand);
  777. // hostName
  778. var _hostName = getHostName(result);
  779. // deviceOrientation
  780. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  781. // devicePixelRatio
  782. var _devicePixelRatio = pixelRatio;
  783. // SDKVersion
  784. var _SDKVersion = SDKVersion;
  785. {
  786. _SDKVersion = my.SDKVersion;
  787. }
  788. // hostLanguage
  789. var hostLanguage = language.replace(/_/g, '-');
  790. // wx.getAccountInfoSync
  791. var parameters = {
  792. appId: "__UNI__C0ABCC1",
  793. appName: "chargingPile",
  794. appVersion: "1.0.0",
  795. appVersionCode: "100",
  796. appLanguage: getAppLanguage(hostLanguage),
  797. uniCompileVersion: "4.29",
  798. uniRuntimeVersion: "4.29",
  799. uniPlatform: undefined || "mp-alipay",
  800. deviceBrand: deviceBrand,
  801. deviceModel: model,
  802. deviceType: deviceType,
  803. devicePixelRatio: _devicePixelRatio,
  804. deviceOrientation: _deviceOrientation,
  805. osName: osName.toLocaleLowerCase(),
  806. osVersion: osVersion,
  807. hostTheme: theme,
  808. hostVersion: hostVersion,
  809. hostLanguage: hostLanguage,
  810. hostName: _hostName,
  811. hostSDKVersion: _SDKVersion,
  812. hostFontSizeSetting: fontSizeSetting,
  813. windowTop: 0,
  814. windowBottom: 0,
  815. // TODO
  816. osLanguage: undefined,
  817. osTheme: undefined,
  818. ua: undefined,
  819. hostPackageName: undefined,
  820. browserName: undefined,
  821. browserVersion: undefined
  822. };
  823. Object.assign(result, parameters, extraParam);
  824. }
  825. function getGetDeviceType(result, model) {
  826. var deviceType = result.deviceType || 'phone';
  827. {
  828. var deviceTypeMaps = {
  829. ipad: 'pad',
  830. windows: 'pc',
  831. mac: 'pc'
  832. };
  833. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  834. var _model = model.toLocaleLowerCase();
  835. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  836. var _m = deviceTypeMapsKeys[index];
  837. if (_model.indexOf(_m) !== -1) {
  838. deviceType = deviceTypeMaps[_m];
  839. break;
  840. }
  841. }
  842. }
  843. return deviceType;
  844. }
  845. function getDeviceBrand(brand) {
  846. var deviceBrand = brand;
  847. if (deviceBrand) {
  848. deviceBrand = brand.toLocaleLowerCase();
  849. }
  850. return deviceBrand;
  851. }
  852. function getAppLanguage(defaultLanguage) {
  853. return getLocale$1 ? getLocale$1() : defaultLanguage;
  854. }
  855. function getHostName(result) {
  856. var _platform = "mp-alipay".split('-')[1];
  857. var _hostName = result.hostName || _platform; // mp-jd
  858. _hostName = result.app;
  859. return _hostName;
  860. }
  861. var UUID_KEY = '__DC_STAT_UUID';
  862. var deviceId;
  863. function addUuid(result) {
  864. deviceId = deviceId || getStorageSync(UUID_KEY);
  865. if (!deviceId) {
  866. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  867. my.setStorage({
  868. key: UUID_KEY,
  869. data: deviceId
  870. });
  871. }
  872. result.deviceId = deviceId;
  873. }
  874. function normalizePlatform(result) {
  875. var platform = result.platform ? result.platform.toLowerCase() : 'devtools';
  876. if (!~['android', 'ios'].indexOf(platform)) {
  877. platform = 'devtools';
  878. }
  879. result.platform = platform;
  880. }
  881. function reviseScreenSize(result) {
  882. // 支付宝: 10.2.0+ 修正屏幕宽度和高度 https://opendocs.alipay.com/mini/api/gawhvz
  883. if (result.screen) {
  884. result.screenWidth = result.screen.width;
  885. result.screenHeight = result.screen.height;
  886. }
  887. }
  888. var getSystemInfo = {
  889. returnValue: function returnValue(result) {
  890. reviseScreenSize(result);
  891. addUuid(result);
  892. addSafeAreaInsets(result);
  893. normalizePlatform(result);
  894. populateParameters(result);
  895. }
  896. };
  897. // 不支持的 API 列表
  898. var todos = ['preloadPage', 'unPreloadPage', 'loadSubPackage'
  899. // 'getRecorderManager',
  900. // 'getBackgroundAudioManager',
  901. // 'createInnerAudioContext',
  902. // 'createCameraContext',
  903. // 'createLivePlayerContext',
  904. // 'startAccelerometer',
  905. // 'startCompass',
  906. // 'authorize',
  907. // 'chooseInvoiceTitle',
  908. // 'addTemplate',
  909. // 'deleteTemplate',
  910. // 'getTemplateLibraryById',
  911. // 'getTemplateLibraryList',
  912. // 'getTemplateList',
  913. // 'sendTemplateMessage',
  914. // 'setEnableDebug',
  915. // 'getExtConfig',
  916. // 'getExtConfigSync',
  917. // 'onWindowResize',
  918. // 'offWindowResize'
  919. ];
  920. // 存在兼容性的 API 列表
  921. var canIUses = ['startPullDownRefresh', 'setTabBarItem', 'setTabBarStyle', 'hideTabBar', 'showTabBar', 'setTabBarBadge', 'removeTabBarBadge', 'showTabBarRedDot', 'hideTabBarRedDot', 'openSetting', 'getSetting', 'createIntersectionObserver', 'getUpdateManager', 'setBackgroundColor', 'setBackgroundTextStyle', 'checkIsSupportSoterAuthentication', 'startSoterAuthentication', 'checkIsSoterEnrolledInDevice', 'openDocument', 'createVideoContext', 'onMemoryWarning', 'addPhoneContact'];
  922. function _handleNetworkInfo(result) {
  923. switch (result.networkType) {
  924. case 'NOTREACHABLE':
  925. result.networkType = 'none';
  926. break;
  927. case 'WWAN':
  928. // TODO ?
  929. result.networkType = '3g';
  930. break;
  931. default:
  932. result.networkType = result.networkType.toLowerCase();
  933. break;
  934. }
  935. return {};
  936. }
  937. var protocols = {
  938. // 需要做转换的 API 列表
  939. navigateTo: navigateTo(),
  940. redirectTo: redirectTo,
  941. returnValue: function returnValue(methodName) {
  942. var res = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  943. // 通用 returnValue 解析
  944. if (res.error || res.errorMessage) {
  945. res.errMsg = "".concat(methodName, ":fail ").concat(res.errorMessage || res.error);
  946. delete res.error;
  947. delete res.errorMessage;
  948. } else {
  949. res.errMsg = "".concat(methodName, ":ok");
  950. }
  951. return res;
  952. },
  953. request: {
  954. name: my.canIUse('request') ? 'request' : 'httpRequest',
  955. args: function args(fromArgs) {
  956. var method = fromArgs.method || 'GET';
  957. if (!fromArgs.header) {
  958. // 默认增加 header 参数,方便格式化 content-type
  959. fromArgs.header = {};
  960. }
  961. var headers = {
  962. 'content-type': 'application/json'
  963. };
  964. Object.keys(fromArgs.header).forEach(function (key) {
  965. headers[key.toLocaleLowerCase()] = fromArgs.header[key];
  966. });
  967. return {
  968. header: function header() {
  969. var header = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  970. var toArgs = arguments.length > 1 ? arguments[1] : undefined;
  971. return {
  972. name: 'headers',
  973. value: headers
  974. };
  975. },
  976. data: function data(_data) {
  977. // 钉钉小程序在content-type为application/json时需上传字符串形式data,使用my.dd在真机运行钉钉小程序时不能正确判断
  978. if (my.canIUse('saveFileToDingTalk') && method.toUpperCase() === 'POST' && headers['content-type'].indexOf('application/json') === 0 && isPlainObject(_data)) {
  979. return {
  980. name: 'data',
  981. value: JSON.stringify(_data)
  982. };
  983. }
  984. return {
  985. name: 'data',
  986. value: _data
  987. };
  988. },
  989. method: 'method',
  990. // TODO 支付宝小程序仅支持 get,post
  991. responseType: false
  992. };
  993. },
  994. returnValue: {
  995. status: 'statusCode',
  996. headers: 'header'
  997. }
  998. },
  999. setNavigationBarColor: {
  1000. name: 'setNavigationBar',
  1001. args: {
  1002. frontColor: false,
  1003. animation: false
  1004. }
  1005. },
  1006. setNavigationBarTitle: {
  1007. name: 'setNavigationBar'
  1008. },
  1009. showModal: function showModal() {
  1010. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  1011. _ref$showCancel = _ref.showCancel,
  1012. showCancel = _ref$showCancel === void 0 ? true : _ref$showCancel;
  1013. if (showCancel) {
  1014. return {
  1015. name: 'confirm',
  1016. args: {
  1017. cancelColor: false,
  1018. confirmColor: false,
  1019. cancelText: 'cancelButtonText',
  1020. confirmText: 'confirmButtonText'
  1021. },
  1022. returnValue: function returnValue(fromRes, toRes) {
  1023. toRes.confirm = fromRes.confirm;
  1024. toRes.cancel = !fromRes.confirm;
  1025. }
  1026. };
  1027. }
  1028. return {
  1029. name: 'alert',
  1030. args: {
  1031. confirmColor: false,
  1032. confirmText: 'buttonText'
  1033. },
  1034. returnValue: function returnValue(fromRes, toRes) {
  1035. toRes.confirm = true;
  1036. toRes.cancel = false;
  1037. }
  1038. };
  1039. },
  1040. showToast: function showToast() {
  1041. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  1042. _ref2$icon = _ref2.icon,
  1043. icon = _ref2$icon === void 0 ? 'success' : _ref2$icon;
  1044. var args = {
  1045. title: 'content',
  1046. icon: 'type',
  1047. image: false,
  1048. mask: false
  1049. };
  1050. if (icon === 'loading') {
  1051. return {
  1052. name: 'showLoading',
  1053. args: args
  1054. };
  1055. }
  1056. return {
  1057. name: 'showToast',
  1058. args: args
  1059. };
  1060. },
  1061. showActionSheet: {
  1062. name: 'showActionSheet',
  1063. args: {
  1064. itemList: 'items',
  1065. itemColor: false
  1066. },
  1067. returnValue: {
  1068. index: 'tapIndex'
  1069. }
  1070. },
  1071. showLoading: {
  1072. args: {
  1073. title: 'content'
  1074. }
  1075. },
  1076. uploadFile: {
  1077. args: {
  1078. name: 'fileName'
  1079. }
  1080. // 从测试结果看,是有返回对象的,文档上没有说明。
  1081. },
  1082. downloadFile: {
  1083. returnValue: {
  1084. apFilePath: 'tempFilePath'
  1085. }
  1086. },
  1087. getFileInfo: {
  1088. args: {
  1089. filePath: 'apFilePath'
  1090. }
  1091. },
  1092. compressImage: {
  1093. args: function args(fromArgs) {
  1094. fromArgs.compressLevel = 4;
  1095. if (fromArgs && fromArgs.quality) {
  1096. fromArgs.compressLevel = Math.floor(fromArgs.quality / 26);
  1097. }
  1098. fromArgs.apFilePaths = [fromArgs.src];
  1099. },
  1100. returnValue: function returnValue(result) {
  1101. if (result.apFilePaths && result.apFilePaths.length) {
  1102. result.tempFilePath = result.apFilePaths[0];
  1103. }
  1104. }
  1105. },
  1106. chooseVideo: {
  1107. // 支付宝小程序文档中未找到(仅在getSetting处提及),但实际可用
  1108. returnValue: {
  1109. apFilePath: 'tempFilePath'
  1110. }
  1111. },
  1112. connectSocket: {
  1113. args: {
  1114. method: false,
  1115. protocols: false
  1116. }
  1117. // TODO 有没有返回值还需要测试下
  1118. },
  1119. chooseImage: {
  1120. returnValue: function returnValue(result) {
  1121. var hasTempFilePaths = hasOwn(result, 'tempFilePaths') && result.tempFilePaths;
  1122. if (hasOwn(result, 'apFilePaths') && !hasTempFilePaths) {
  1123. result.tempFilePaths = result.apFilePaths;
  1124. delete result.apFilePaths;
  1125. }
  1126. if (!hasOwn(result, 'tempFiles') && hasTempFilePaths) {
  1127. result.tempFiles = [];
  1128. result.tempFilePaths.forEach(function (tempFilePath) {
  1129. return result.tempFiles.push({
  1130. path: tempFilePath
  1131. });
  1132. });
  1133. }
  1134. return {};
  1135. }
  1136. },
  1137. previewImage: {
  1138. args: function args(fromArgs) {
  1139. // 支付宝小程序的 current 是索引值,而非图片地址。
  1140. var currentIndex = Number(fromArgs.current);
  1141. if (isNaN(currentIndex)) {
  1142. if (fromArgs.current && Array.isArray(fromArgs.urls)) {
  1143. var index = fromArgs.urls.indexOf(fromArgs.current);
  1144. fromArgs.current = ~index ? index : 0;
  1145. }
  1146. } else {
  1147. fromArgs.current = currentIndex;
  1148. }
  1149. return {
  1150. indicator: false,
  1151. loop: false
  1152. };
  1153. }
  1154. },
  1155. saveFile: {
  1156. args: {
  1157. tempFilePath: 'apFilePath'
  1158. },
  1159. returnValue: {
  1160. apFilePath: 'savedFilePath'
  1161. }
  1162. },
  1163. getSavedFileInfo: {
  1164. args: {
  1165. filePath: 'apFilePath'
  1166. }
  1167. },
  1168. getSavedFileList: {
  1169. returnValue: function returnValue(result) {
  1170. if (result.fileList && result.fileList.length) {
  1171. result.fileList.forEach(function (file) {
  1172. file.filePath = file.apFilePath;
  1173. delete file.apFilePath;
  1174. });
  1175. }
  1176. return {};
  1177. }
  1178. },
  1179. removeSavedFile: {
  1180. args: {
  1181. filePath: 'apFilePath'
  1182. }
  1183. },
  1184. getLocation: {
  1185. args: {
  1186. type: false,
  1187. altitude: false
  1188. }
  1189. },
  1190. openLocation: {
  1191. args: {
  1192. // TODO address 参数在阿里上是必传的
  1193. }
  1194. },
  1195. getNetworkType: {
  1196. returnValue: _handleNetworkInfo
  1197. },
  1198. onNetworkStatusChange: {
  1199. returnValue: _handleNetworkInfo
  1200. },
  1201. stopAccelerometer: {
  1202. name: 'offAccelerometerChange'
  1203. },
  1204. stopCompass: {
  1205. name: 'offCompassChange'
  1206. },
  1207. scanCode: {
  1208. name: 'scan',
  1209. args: function args(fromArgs) {
  1210. if (fromArgs.scanType) {
  1211. switch (fromArgs.scanType[0]) {
  1212. case 'qrCode':
  1213. fromArgs.type = 'qr';
  1214. break;
  1215. case 'barCode':
  1216. fromArgs.type = 'bar';
  1217. break;
  1218. }
  1219. }
  1220. return {
  1221. onlyFromCamera: 'hideAlbum'
  1222. };
  1223. },
  1224. returnValue: {
  1225. code: 'result'
  1226. }
  1227. },
  1228. setClipboardData: {
  1229. name: 'setClipboard',
  1230. args: {
  1231. data: 'text'
  1232. }
  1233. },
  1234. getClipboardData: {
  1235. name: 'getClipboard',
  1236. returnValue: {
  1237. text: 'data'
  1238. }
  1239. },
  1240. login: {
  1241. name: 'getAuthCode',
  1242. returnValue: function returnValue(result) {
  1243. result.code = result.authCode;
  1244. }
  1245. },
  1246. getUserInfo: {
  1247. name: my.canIUse('getOpenUserInfo') ? 'getOpenUserInfo' : 'getAuthUserInfo',
  1248. returnValue: function returnValue(result) {
  1249. if (my.canIUse('getOpenUserInfo')) {
  1250. var response = {};
  1251. try {
  1252. response = JSON.parse(result.response).response;
  1253. } catch (e) {}
  1254. result.nickName = response.nickName;
  1255. result.avatar = response.avatar;
  1256. }
  1257. result.userInfo = {
  1258. nickName: result.nickName,
  1259. avatarUrl: result.avatar
  1260. };
  1261. }
  1262. },
  1263. getUserProfile: {
  1264. name: my.canIUse('getOpenUserInfo') ? 'getOpenUserInfo' : 'getAuthUserInfo',
  1265. returnValue: function returnValue(result) {
  1266. if (my.canIUse('getOpenUserInfo')) {
  1267. var response = {};
  1268. try {
  1269. response = JSON.parse(result.response).response;
  1270. } catch (e) {}
  1271. result.nickName = response.nickName;
  1272. result.avatar = response.avatar;
  1273. }
  1274. result.userInfo = {
  1275. nickName: result.nickName,
  1276. avatarUrl: result.avatar
  1277. };
  1278. }
  1279. },
  1280. requestPayment: {
  1281. name: 'tradePay',
  1282. args: {
  1283. orderInfo: 'tradeNO'
  1284. }
  1285. },
  1286. getBLEDeviceServices: {
  1287. returnValue: function returnValue(result) {
  1288. result.services.forEach(function (item) {
  1289. item.uuid = item.serviceId;
  1290. });
  1291. }
  1292. },
  1293. createBLEConnection: {
  1294. name: 'connectBLEDevice',
  1295. args: {
  1296. timeout: false
  1297. }
  1298. },
  1299. closeBLEConnection: {
  1300. name: 'disconnectBLEDevice'
  1301. },
  1302. onBLEConnectionStateChange: {
  1303. name: 'onBLEConnectionStateChanged'
  1304. },
  1305. makePhoneCall: {
  1306. args: {
  1307. phoneNumber: 'number'
  1308. }
  1309. },
  1310. stopGyroscope: {
  1311. name: 'offGyroscopeChange'
  1312. },
  1313. getSystemInfo: getSystemInfo,
  1314. getSystemInfoSync: getSystemInfo,
  1315. // 文档没提到,但是实测可用。
  1316. canvasToTempFilePath: {
  1317. returnValue: function returnValue(result) {
  1318. // 真机的情况下会有 tempFilePath 这个值,因此需要主动修改。
  1319. result.tempFilePath = result.apFilePath;
  1320. }
  1321. },
  1322. setScreenBrightness: {
  1323. args: {
  1324. value: 'brightness'
  1325. }
  1326. },
  1327. getScreenBrightness: {
  1328. returnValue: {
  1329. brightness: 'value'
  1330. }
  1331. },
  1332. showShareMenu: {
  1333. name: 'showSharePanel'
  1334. },
  1335. hideHomeButton: {
  1336. name: 'hideBackHome'
  1337. },
  1338. saveVideoToPhotosAlbum: {
  1339. args: {
  1340. filePath: 'src'
  1341. }
  1342. },
  1343. chooseAddress: {
  1344. name: 'getAddress',
  1345. returnValue: function returnValue(result) {
  1346. var info = result.result || {};
  1347. result.userName = info.fullname;
  1348. result.provinceName = info.prov;
  1349. result.cityName = info.city;
  1350. result.countyName = info.area;
  1351. result.detailInfo = info.address;
  1352. result.telNumber = info.mobilePhone;
  1353. result.errMsg = result.resultStatus;
  1354. }
  1355. }
  1356. };
  1357. // 钉钉小程序处理
  1358. if (!my.canIUse('saveImageToPhotosAlbum')) {
  1359. protocols.saveImageToPhotosAlbum = {
  1360. name: 'saveImage',
  1361. args: {
  1362. filePath: 'url'
  1363. }
  1364. };
  1365. }
  1366. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  1367. function processCallback(methodName, method, returnValue) {
  1368. return function (res) {
  1369. return method(processReturnValue(methodName, res, returnValue));
  1370. };
  1371. }
  1372. function processArgs(methodName, fromArgs) {
  1373. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  1374. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  1375. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  1376. if (isPlainObject(fromArgs)) {
  1377. // 一般 api 的参数解析
  1378. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  1379. if (isFn(argsOption)) {
  1380. argsOption = argsOption(fromArgs, toArgs) || {};
  1381. }
  1382. for (var key in fromArgs) {
  1383. if (hasOwn(argsOption, key)) {
  1384. var keyOption = argsOption[key];
  1385. if (isFn(keyOption)) {
  1386. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  1387. }
  1388. if (!keyOption) {
  1389. // 不支持的参数
  1390. console.warn("The '".concat(methodName, "' method of platform '\u652F\u4ED8\u5B9D\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  1391. } else if (isStr(keyOption)) {
  1392. // 重写参数 key
  1393. toArgs[keyOption] = fromArgs[key];
  1394. } else if (isPlainObject(keyOption)) {
  1395. // {name:newName,value:value}可重新指定参数 key:value
  1396. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  1397. }
  1398. } else if (CALLBACKS.indexOf(key) !== -1) {
  1399. if (isFn(fromArgs[key])) {
  1400. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  1401. }
  1402. } else {
  1403. if (!keepFromArgs) {
  1404. toArgs[key] = fromArgs[key];
  1405. }
  1406. }
  1407. }
  1408. return toArgs;
  1409. } else if (isFn(fromArgs)) {
  1410. fromArgs = processCallback(methodName, fromArgs, returnValue);
  1411. }
  1412. return fromArgs;
  1413. }
  1414. function processReturnValue(methodName, res, returnValue) {
  1415. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  1416. if (isFn(protocols.returnValue)) {
  1417. // 处理通用 returnValue
  1418. res = protocols.returnValue(methodName, res);
  1419. }
  1420. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  1421. }
  1422. function wrapper(methodName, method) {
  1423. if (hasOwn(protocols, methodName)) {
  1424. var protocol = protocols[methodName];
  1425. if (!protocol) {
  1426. // 暂不支持的 api
  1427. return function () {
  1428. console.error("Platform '\u652F\u4ED8\u5B9D\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  1429. };
  1430. }
  1431. return function (arg1, arg2) {
  1432. // 目前 api 最多两个参数
  1433. var options = protocol;
  1434. if (isFn(protocol)) {
  1435. options = protocol(arg1);
  1436. }
  1437. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  1438. var args = [arg1];
  1439. if (typeof arg2 !== 'undefined') {
  1440. args.push(arg2);
  1441. }
  1442. if (isFn(options.name)) {
  1443. methodName = options.name(arg1);
  1444. } else if (isStr(options.name)) {
  1445. methodName = options.name;
  1446. }
  1447. var returnValue = my[methodName].apply(my, args);
  1448. if (isSyncApi(methodName)) {
  1449. // 同步 api
  1450. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1451. }
  1452. return returnValue;
  1453. };
  1454. }
  1455. return method;
  1456. }
  1457. var todoApis = Object.create(null);
  1458. var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
  1459. function createTodoApi(name) {
  1460. return function todoApi(_ref3) {
  1461. var fail = _ref3.fail,
  1462. complete = _ref3.complete;
  1463. var res = {
  1464. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  1465. };
  1466. isFn(fail) && fail(res);
  1467. isFn(complete) && complete(res);
  1468. };
  1469. }
  1470. TODOS.forEach(function (name) {
  1471. todoApis[name] = createTodoApi(name);
  1472. });
  1473. var providers = {
  1474. oauth: ['alipay'],
  1475. share: ['alipay'],
  1476. payment: ['alipay'],
  1477. push: ['alipay']
  1478. };
  1479. function getProvider(_ref4) {
  1480. var service = _ref4.service,
  1481. success = _ref4.success,
  1482. fail = _ref4.fail,
  1483. complete = _ref4.complete;
  1484. var res = false;
  1485. if (providers[service]) {
  1486. res = {
  1487. errMsg: 'getProvider:ok',
  1488. service: service,
  1489. provider: providers[service]
  1490. };
  1491. isFn(success) && success(res);
  1492. } else {
  1493. res = {
  1494. errMsg: 'getProvider:fail service not found'
  1495. };
  1496. isFn(fail) && fail(res);
  1497. }
  1498. isFn(complete) && complete(res);
  1499. }
  1500. var extraApi = /*#__PURE__*/Object.freeze({
  1501. __proto__: null,
  1502. getProvider: getProvider
  1503. });
  1504. var getEmitter = function () {
  1505. var Emitter;
  1506. return function getUniEmitter() {
  1507. if (!Emitter) {
  1508. Emitter = new _vue.default();
  1509. }
  1510. return Emitter;
  1511. };
  1512. }();
  1513. function apply(ctx, method, args) {
  1514. return ctx[method].apply(ctx, args);
  1515. }
  1516. function $on() {
  1517. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  1518. }
  1519. function $off() {
  1520. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  1521. }
  1522. function $once() {
  1523. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  1524. }
  1525. function $emit() {
  1526. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  1527. }
  1528. var eventApi = /*#__PURE__*/Object.freeze({
  1529. __proto__: null,
  1530. $on: $on,
  1531. $off: $off,
  1532. $once: $once,
  1533. $emit: $emit
  1534. });
  1535. function createMediaQueryObserver() {
  1536. var mediaQueryObserver = {};
  1537. var _my$getSystemInfoSync2 = my.getSystemInfoSync(),
  1538. windowWidth = _my$getSystemInfoSync2.windowWidth,
  1539. windowHeight = _my$getSystemInfoSync2.windowHeight;
  1540. var orientation = windowWidth < windowHeight ? 'portrait' : 'landscape';
  1541. mediaQueryObserver.observe = function (options, callback) {
  1542. var matches = true;
  1543. for (var item in options) {
  1544. var itemValue = item === 'orientation' ? options[item] : Number(options[item]);
  1545. if (options[item] !== '') {
  1546. if (item === 'width') {
  1547. if (itemValue === windowWidth) {
  1548. matches = true;
  1549. } else {
  1550. matches = false;
  1551. callback(matches);
  1552. return matches;
  1553. }
  1554. }
  1555. if (item === 'minWidth') {
  1556. if (windowWidth >= itemValue) {
  1557. matches = true;
  1558. } else {
  1559. matches = false;
  1560. callback(matches);
  1561. return matches;
  1562. }
  1563. }
  1564. if (item === 'maxWidth') {
  1565. if (windowWidth <= itemValue) {
  1566. matches = true;
  1567. } else {
  1568. matches = false;
  1569. callback(matches);
  1570. return matches;
  1571. }
  1572. }
  1573. if (item === 'height') {
  1574. if (itemValue === windowHeight) {
  1575. matches = true;
  1576. } else {
  1577. matches = false;
  1578. callback(matches);
  1579. return matches;
  1580. }
  1581. }
  1582. if (item === 'minHeight') {
  1583. if (windowHeight >= itemValue) {
  1584. matches = true;
  1585. } else {
  1586. matches = false;
  1587. callback(matches);
  1588. return matches;
  1589. }
  1590. }
  1591. if (item === 'maxHeight') {
  1592. if (windowHeight <= itemValue) {
  1593. matches = true;
  1594. } else {
  1595. matches = false;
  1596. callback(matches);
  1597. return matches;
  1598. }
  1599. }
  1600. if (item === 'orientation') {
  1601. if (options[item] === orientation) {
  1602. matches = true;
  1603. } else {
  1604. matches = false;
  1605. callback(matches);
  1606. return matches;
  1607. }
  1608. }
  1609. }
  1610. }
  1611. callback(matches);
  1612. return matches;
  1613. };
  1614. mediaQueryObserver.disconnect = function () {};
  1615. return mediaQueryObserver;
  1616. }
  1617. /**
  1618. * 框架内 try-catch
  1619. */
  1620. /**
  1621. * 开发者 try-catch
  1622. */
  1623. function tryCatch(fn) {
  1624. return function () {
  1625. try {
  1626. return fn.apply(fn, arguments);
  1627. } catch (e) {
  1628. // TODO
  1629. console.error(e);
  1630. }
  1631. };
  1632. }
  1633. function getApiCallbacks(params) {
  1634. var apiCallbacks = {};
  1635. for (var name in params) {
  1636. var param = params[name];
  1637. if (isFn(param)) {
  1638. apiCallbacks[name] = tryCatch(param);
  1639. delete params[name];
  1640. }
  1641. }
  1642. return apiCallbacks;
  1643. }
  1644. var cid;
  1645. var cidErrMsg;
  1646. var enabled;
  1647. function normalizePushMessage(message) {
  1648. try {
  1649. return JSON.parse(message);
  1650. } catch (e) {}
  1651. return message;
  1652. }
  1653. function invokePushCallback(args) {
  1654. if (args.type === 'enabled') {
  1655. enabled = true;
  1656. } else if (args.type === 'clientId') {
  1657. cid = args.cid;
  1658. cidErrMsg = args.errMsg;
  1659. invokeGetPushCidCallbacks(cid, args.errMsg);
  1660. } else if (args.type === 'pushMsg') {
  1661. var message = {
  1662. type: 'receive',
  1663. data: normalizePushMessage(args.message)
  1664. };
  1665. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  1666. var callback = onPushMessageCallbacks[i];
  1667. callback(message);
  1668. // 该消息已被阻止
  1669. if (message.stopped) {
  1670. break;
  1671. }
  1672. }
  1673. } else if (args.type === 'click') {
  1674. onPushMessageCallbacks.forEach(function (callback) {
  1675. callback({
  1676. type: 'click',
  1677. data: normalizePushMessage(args.message)
  1678. });
  1679. });
  1680. }
  1681. }
  1682. var getPushCidCallbacks = [];
  1683. function invokeGetPushCidCallbacks(cid, errMsg) {
  1684. getPushCidCallbacks.forEach(function (callback) {
  1685. callback(cid, errMsg);
  1686. });
  1687. getPushCidCallbacks.length = 0;
  1688. }
  1689. function getPushClientId(args) {
  1690. if (!isPlainObject(args)) {
  1691. args = {};
  1692. }
  1693. var _getApiCallbacks = getApiCallbacks(args),
  1694. success = _getApiCallbacks.success,
  1695. fail = _getApiCallbacks.fail,
  1696. complete = _getApiCallbacks.complete;
  1697. var hasSuccess = isFn(success);
  1698. var hasFail = isFn(fail);
  1699. var hasComplete = isFn(complete);
  1700. Promise.resolve().then(function () {
  1701. if (typeof enabled === 'undefined') {
  1702. enabled = false;
  1703. cid = '';
  1704. cidErrMsg = 'uniPush is not enabled';
  1705. }
  1706. getPushCidCallbacks.push(function (cid, errMsg) {
  1707. var res;
  1708. if (cid) {
  1709. res = {
  1710. errMsg: 'getPushClientId:ok',
  1711. cid: cid
  1712. };
  1713. hasSuccess && success(res);
  1714. } else {
  1715. res = {
  1716. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  1717. };
  1718. hasFail && fail(res);
  1719. }
  1720. hasComplete && complete(res);
  1721. });
  1722. if (typeof cid !== 'undefined') {
  1723. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1724. }
  1725. });
  1726. }
  1727. var onPushMessageCallbacks = [];
  1728. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1729. var onPushMessage = function onPushMessage(fn) {
  1730. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1731. onPushMessageCallbacks.push(fn);
  1732. }
  1733. };
  1734. var offPushMessage = function offPushMessage(fn) {
  1735. if (!fn) {
  1736. onPushMessageCallbacks.length = 0;
  1737. } else {
  1738. var index = onPushMessageCallbacks.indexOf(fn);
  1739. if (index > -1) {
  1740. onPushMessageCallbacks.splice(index, 1);
  1741. }
  1742. }
  1743. };
  1744. var onKeyboardHeightChangeCallback;
  1745. function startGyroscope(params) {
  1746. if (hasOwn(params, 'interval')) {
  1747. console.warn('支付宝小程序 startGyroscope暂不支持interval');
  1748. }
  1749. params.success && params.success({
  1750. errMsg: 'startGyroscope:ok'
  1751. });
  1752. params.complete && params.complete({
  1753. errMsg: 'startGyroscope:ok'
  1754. });
  1755. }
  1756. function createExecCallback(execCallback) {
  1757. return function wrapperExecCallback(res) {
  1758. this.actions.forEach(function (action, index) {
  1759. (action._$callbacks || []).forEach(function (callback) {
  1760. callback(res[index]);
  1761. });
  1762. });
  1763. if (isFn(execCallback)) {
  1764. execCallback(res);
  1765. }
  1766. };
  1767. }
  1768. function addCallback(callback) {
  1769. if (isFn(callback)) {
  1770. var action = this.actions[this.actions.length - 1];
  1771. if (action) {
  1772. (action._$callbacks || (action._$callbacks = [])).push(callback);
  1773. }
  1774. }
  1775. }
  1776. function createSelectorQuery() {
  1777. var query = my.createSelectorQuery();
  1778. var oldExec = query.exec;
  1779. var oldScrollOffset = query.scrollOffset;
  1780. var oldBoundingClientRect = query.boundingClientRect;
  1781. query.exec = function exec(callback) {
  1782. return oldExec.call(this, createExecCallback(callback).bind(this));
  1783. };
  1784. query.scrollOffset = function scrollOffset(callback) {
  1785. var ret = oldScrollOffset.call(this);
  1786. addCallback.call(this, callback);
  1787. return ret;
  1788. };
  1789. query.boundingClientRect = function boundingClientRect(callback) {
  1790. var ret = oldBoundingClientRect.call(this);
  1791. addCallback.call(this, callback);
  1792. return ret;
  1793. };
  1794. if (!query.fields) {
  1795. query.fields = function () {
  1796. var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  1797. rect = _ref5.rect,
  1798. size = _ref5.size,
  1799. scrollOffset = _ref5.scrollOffset;
  1800. var callback = arguments.length > 1 ? arguments[1] : undefined;
  1801. if (rect || size) {
  1802. this.boundingClientRect();
  1803. }
  1804. if (scrollOffset) {
  1805. this.scrollOffset();
  1806. }
  1807. addCallback.call(this, callback);
  1808. return this;
  1809. };
  1810. }
  1811. if (!query.in) {
  1812. query.in = function () {
  1813. return this;
  1814. };
  1815. }
  1816. return query;
  1817. }
  1818. function createIntersectionObserver(component, options) {
  1819. if (options && options.observeAll) {
  1820. options.selectAll = options.observeAll;
  1821. delete options.observeAll;
  1822. }
  1823. return my.createIntersectionObserver(options);
  1824. }
  1825. function onKeyboardHeightChange(callback) {
  1826. // 与微信小程序一致仅保留最后一次监听
  1827. if (onKeyboardHeightChangeCallback) {
  1828. $off('uni:keyboardHeightChange', onKeyboardHeightChangeCallback);
  1829. }
  1830. onKeyboardHeightChangeCallback = callback;
  1831. $on('uni:keyboardHeightChange', onKeyboardHeightChangeCallback);
  1832. }
  1833. function offKeyboardHeightChange() {
  1834. // 与微信小程序一致移除最后一次监听
  1835. $off('uni:keyboardHeightChange', onKeyboardHeightChangeCallback);
  1836. onKeyboardHeightChangeCallback = null;
  1837. }
  1838. var api = /*#__PURE__*/Object.freeze({
  1839. __proto__: null,
  1840. startGyroscope: startGyroscope,
  1841. createSelectorQuery: createSelectorQuery,
  1842. createIntersectionObserver: createIntersectionObserver,
  1843. onKeyboardHeightChange: onKeyboardHeightChange,
  1844. offKeyboardHeightChange: offKeyboardHeightChange,
  1845. createMediaQueryObserver: createMediaQueryObserver,
  1846. setStorageSync: setStorageSync,
  1847. getStorageSync: getStorageSync,
  1848. removeStorageSync: removeStorageSync,
  1849. getPushClientId: getPushClientId,
  1850. onPushMessage: onPushMessage,
  1851. offPushMessage: offPushMessage,
  1852. invokePushCallback: invokePushCallback
  1853. });
  1854. function findVmByVueId(vm, vuePid) {
  1855. var $children = vm.$children;
  1856. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1857. for (var i = $children.length - 1; i >= 0; i--) {
  1858. var childVm = $children[i];
  1859. if (childVm.$scope._$vueId === vuePid) {
  1860. return childVm;
  1861. }
  1862. }
  1863. // 反向递归查找
  1864. var parentVm;
  1865. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1866. parentVm = findVmByVueId($children[_i], vuePid);
  1867. if (parentVm) {
  1868. return parentVm;
  1869. }
  1870. }
  1871. }
  1872. function handleLink(event) {
  1873. var _ref6 = event.detail || event.value,
  1874. vuePid = _ref6.vuePid,
  1875. vueOptions = _ref6.vueOptions; // detail 是微信,value 是百度(dipatch)
  1876. var parentVm;
  1877. if (vuePid) {
  1878. parentVm = findVmByVueId(this.$vm, vuePid);
  1879. }
  1880. if (!parentVm) {
  1881. parentVm = this.$vm;
  1882. }
  1883. vueOptions.parent = parentVm;
  1884. }
  1885. function markMPComponent(component) {
  1886. // 在 Vue 中标记为小程序组件
  1887. var IS_MP = '__v_isMPComponent';
  1888. Object.defineProperty(component, IS_MP, {
  1889. configurable: true,
  1890. enumerable: false,
  1891. value: true
  1892. });
  1893. return component;
  1894. }
  1895. function toSkip(obj) {
  1896. var OB = '__ob__';
  1897. var SKIP = '__v_skip';
  1898. if (isObject(obj) && Object.isExtensible(obj)) {
  1899. // 避免被 @vue/composition-api 观测
  1900. Object.defineProperty(obj, OB, {
  1901. configurable: true,
  1902. enumerable: false,
  1903. value: (0, _defineProperty2.default)({}, SKIP, true)
  1904. });
  1905. }
  1906. return obj;
  1907. }
  1908. var isArray = Array.isArray;
  1909. var keyList = Object.keys;
  1910. function equal(a, b) {
  1911. if (a === b) return true;
  1912. if (a && b && (0, _typeof2.default)(a) === 'object' && (0, _typeof2.default)(b) === 'object') {
  1913. var arrA = isArray(a);
  1914. var arrB = isArray(b);
  1915. var i, length, key;
  1916. if (arrA && arrB) {
  1917. length = a.length;
  1918. if (length !== b.length) return false;
  1919. for (i = length; i-- !== 0;) {
  1920. if (!equal(a[i], b[i])) return false;
  1921. }
  1922. return true;
  1923. }
  1924. if (arrA !== arrB) return false;
  1925. var dateA = a instanceof Date;
  1926. var dateB = b instanceof Date;
  1927. if (dateA !== dateB) return false;
  1928. if (dateA && dateB) return a.getTime() === b.getTime();
  1929. var regexpA = a instanceof RegExp;
  1930. var regexpB = b instanceof RegExp;
  1931. if (regexpA !== regexpB) return false;
  1932. if (regexpA && regexpB) return a.toString() === b.toString();
  1933. var keys = keyList(a);
  1934. length = keys.length;
  1935. if (length !== keyList(b).length) {
  1936. return false;
  1937. }
  1938. for (i = length; i-- !== 0;) {
  1939. if (!hasOwn.call(b, keys[i])) return false;
  1940. }
  1941. for (i = length; i-- !== 0;) {
  1942. key = keys[i];
  1943. if (!equal(a[key], b[key])) return false;
  1944. }
  1945. return true;
  1946. }
  1947. return false;
  1948. }
  1949. var customizeRE = /:/g;
  1950. var customize = cached(function (str) {
  1951. return camelize(str.replace(customizeRE, '-'));
  1952. });
  1953. var isComponent2 = my.canIUse('component2');
  1954. var mocks = ['$id'];
  1955. function initRefs() {}
  1956. function initRelation(detail) {
  1957. this.props.onVueInit(detail);
  1958. }
  1959. function initSpecialMethods(mpInstance) {
  1960. if (!mpInstance.$vm) {
  1961. return;
  1962. }
  1963. var path = mpInstance.is || mpInstance.route;
  1964. if (!path) {
  1965. return;
  1966. }
  1967. if (path.indexOf('/') === 0) {
  1968. path = path.substr(1);
  1969. }
  1970. var specialMethods = my.specialMethods && my.specialMethods[path];
  1971. if (specialMethods) {
  1972. specialMethods.forEach(function (method) {
  1973. if (isFn(mpInstance.$vm[method])) {
  1974. mpInstance[method] = function (event) {
  1975. if (hasOwn(event, 'markerId')) {
  1976. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  1977. event.detail.markerId = event.markerId;
  1978. }
  1979. // TODO normalizeEvent
  1980. mpInstance.$vm[method](event);
  1981. };
  1982. }
  1983. });
  1984. }
  1985. }
  1986. function initChildVues(mpInstance) {
  1987. // 此时需保证当前 mpInstance 已经存在 $vm
  1988. if (!mpInstance.$vm) {
  1989. return;
  1990. }
  1991. mpInstance._$childVues && mpInstance._$childVues.forEach(function (_ref7) {
  1992. var vuePid = _ref7.vuePid,
  1993. vueOptions = _ref7.vueOptions,
  1994. VueComponent = _ref7.VueComponent,
  1995. childMPInstance = _ref7.mpInstance;
  1996. // 父子关系
  1997. handleLink.call(mpInstance, {
  1998. detail: {
  1999. vuePid: vuePid,
  2000. vueOptions: vueOptions
  2001. }
  2002. });
  2003. childMPInstance.$vm = new VueComponent(vueOptions);
  2004. initSpecialMethods(childMPInstance);
  2005. handleRef.call(vueOptions.parent.$scope, childMPInstance);
  2006. childMPInstance.$vm.$mount();
  2007. initChildVues(childMPInstance);
  2008. childMPInstance.$vm._isMounted = true;
  2009. childMPInstance.$vm.__call_hook('mounted');
  2010. childMPInstance.$vm.__call_hook('onReady');
  2011. });
  2012. delete mpInstance._$childVues;
  2013. }
  2014. function handleProps(ref) {
  2015. var eventProps = {};
  2016. var refProps = ref.props;
  2017. var eventList = (refProps['data-event-list'] || '').split(',');
  2018. // 初始化支付宝小程序组件事件
  2019. eventList.forEach(function (key) {
  2020. var handler = refProps[key];
  2021. var res = key.match(/^on([A-Z])(\S*)/);
  2022. var event = res && res[1].toLowerCase() + res[2];
  2023. refProps[key] = eventProps[key] = function () {
  2024. var props = Object.assign({}, refProps);
  2025. props[key] = handler;
  2026. // 由于支付宝事件可能包含多个参数,不使用微信小程序事件格式
  2027. delete props['data-com-type'];
  2028. triggerEvent.bind({
  2029. props: props
  2030. })(event, {
  2031. __args__: Array.prototype.slice.call(arguments)
  2032. });
  2033. };
  2034. });
  2035. // 处理 props 重写
  2036. Object.defineProperty(ref, 'props', {
  2037. get: function get() {
  2038. return refProps;
  2039. },
  2040. set: function set(value) {
  2041. refProps = Object.assign(value, eventProps);
  2042. }
  2043. });
  2044. }
  2045. function handleRef(ref) {
  2046. if (!(ref && this.$vm)) {
  2047. return;
  2048. }
  2049. var refName = ref.props['data-ref'];
  2050. var refInForName = ref.props['data-ref-in-for'];
  2051. if (refName) {
  2052. this.$vm.$refs[refName] = ref.$vm || toSkip(ref);
  2053. } else if (refInForName) {
  2054. (this.$vm.$refs[refInForName] || (this.$vm.$refs[refInForName] = [])).push(ref.$vm || toSkip(ref));
  2055. }
  2056. }
  2057. function triggerEvent(type, detail, options) {
  2058. var handler = this.props && this.props[customize('on-' + type)];
  2059. if (!handler) {
  2060. return;
  2061. }
  2062. var eventOpts = this.props['data-event-opts'];
  2063. var eventParams = this.props['data-event-params'];
  2064. var comType = this.props['data-com-type'];
  2065. var target = {
  2066. dataset: {
  2067. eventOpts: eventOpts,
  2068. eventParams: eventParams,
  2069. comType: comType
  2070. }
  2071. };
  2072. handler({
  2073. type: customize(type),
  2074. target: target,
  2075. currentTarget: target,
  2076. detail: detail
  2077. });
  2078. }
  2079. var IGNORES = ['$slots', '$scopedSlots'];
  2080. function createObserver(isDidUpdate) {
  2081. return function observe(props) {
  2082. var _this3 = this;
  2083. var prevProps = isDidUpdate ? props : this.props;
  2084. var nextProps = isDidUpdate ? this.props : props;
  2085. if (equal(prevProps, nextProps)) {
  2086. return;
  2087. }
  2088. Object.keys(prevProps).forEach(function (name) {
  2089. if (IGNORES.indexOf(name) === -1) {
  2090. var prevValue = prevProps[name];
  2091. var nextValue = nextProps[name];
  2092. if (!isFn(prevValue) && !isFn(nextValue) && !equal(prevValue, nextValue)) {
  2093. _this3.$vm[name] = nextProps[name];
  2094. }
  2095. }
  2096. });
  2097. };
  2098. }
  2099. var handleLink$1 = function () {
  2100. if (isComponent2) {
  2101. return function handleLink$1(detail) {
  2102. return handleLink.call(this, {
  2103. detail: detail
  2104. });
  2105. };
  2106. }
  2107. return function handleLink$1(detail) {
  2108. if (this.$vm && this.$vm._isMounted) {
  2109. // 父已初始化
  2110. return handleLink.call(this, {
  2111. detail: {
  2112. vuePid: detail.vuePid,
  2113. vueOptions: detail.vueOptions
  2114. }
  2115. });
  2116. }
  2117. // 支付宝通过 didMount 来实现,先子后父,故等父 ready 之后,统一初始化
  2118. (this._$childVues || (this._$childVues = [])).unshift(detail);
  2119. };
  2120. }();
  2121. var handleWrap = function handleWrap(mp, destory) {
  2122. var _this4 = this;
  2123. var vueId = mp.props.vueId;
  2124. var list = (mp.props['data-event-list'] || '').split(',');
  2125. list.forEach(function (eventName) {
  2126. var key = "".concat(eventName).concat(vueId);
  2127. if (destory) {
  2128. delete _this4[key];
  2129. } else {
  2130. _this4[key] = function () {
  2131. mp.props[eventName].apply(this, arguments);
  2132. };
  2133. }
  2134. });
  2135. if (!destory) {
  2136. handleProps(mp);
  2137. }
  2138. };
  2139. var MPComponent = Component;
  2140. function initHook(name, options) {
  2141. var oldHook = options[name];
  2142. options[name] = function () {
  2143. markMPComponent(this);
  2144. var props = this.props;
  2145. if (props && props['data-com-type'] === 'wx') {
  2146. handleProps(this);
  2147. }
  2148. if (oldHook) {
  2149. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  2150. args[_key4] = arguments[_key4];
  2151. }
  2152. return oldHook.apply(this, args);
  2153. }
  2154. };
  2155. }
  2156. if (!MPComponent.__$wrappered) {
  2157. MPComponent.__$wrappered = true;
  2158. Component = function Component() {
  2159. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2160. initHook('onInit', options);
  2161. return MPComponent(options);
  2162. };
  2163. }
  2164. var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
  2165. function initMocks(vm, mocks) {
  2166. var mpInstance = vm.$mp[vm.mpType];
  2167. mocks.forEach(function (mock) {
  2168. if (hasOwn(mpInstance, mock)) {
  2169. vm[mock] = mpInstance[mock];
  2170. }
  2171. });
  2172. }
  2173. function hasHook(hook, vueOptions) {
  2174. if (!vueOptions) {
  2175. return true;
  2176. }
  2177. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  2178. return true;
  2179. }
  2180. vueOptions = vueOptions.default || vueOptions;
  2181. if (isFn(vueOptions)) {
  2182. if (isFn(vueOptions.extendOptions[hook])) {
  2183. return true;
  2184. }
  2185. if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
  2186. return true;
  2187. }
  2188. return false;
  2189. }
  2190. if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
  2191. return true;
  2192. }
  2193. var mixins = vueOptions.mixins;
  2194. if (Array.isArray(mixins)) {
  2195. return !!mixins.find(function (mixin) {
  2196. return hasHook(hook, mixin);
  2197. });
  2198. }
  2199. }
  2200. function initHooks(mpOptions, hooks, vueOptions) {
  2201. hooks.forEach(function (hook) {
  2202. if (hasHook(hook, vueOptions)) {
  2203. mpOptions[hook] = function (args) {
  2204. return this.$vm && this.$vm.__call_hook(hook, args);
  2205. };
  2206. }
  2207. });
  2208. }
  2209. function initUnknownHooks(mpOptions, vueOptions) {
  2210. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  2211. findHooks(vueOptions).forEach(function (hook) {
  2212. return initHook$1(mpOptions, hook, excludes);
  2213. });
  2214. }
  2215. function findHooks(vueOptions) {
  2216. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2217. if (vueOptions) {
  2218. Object.keys(vueOptions).forEach(function (name) {
  2219. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  2220. hooks.push(name);
  2221. }
  2222. });
  2223. }
  2224. return hooks;
  2225. }
  2226. function initHook$1(mpOptions, hook, excludes) {
  2227. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  2228. mpOptions[hook] = function (args) {
  2229. return this.$vm && this.$vm.__call_hook(hook, args);
  2230. };
  2231. }
  2232. }
  2233. function initVueComponent(Vue, vueOptions) {
  2234. vueOptions = vueOptions.default || vueOptions;
  2235. var VueComponent;
  2236. if (isFn(vueOptions)) {
  2237. VueComponent = vueOptions;
  2238. } else {
  2239. VueComponent = Vue.extend(vueOptions);
  2240. }
  2241. vueOptions = VueComponent.options;
  2242. return [VueComponent, vueOptions];
  2243. }
  2244. function initVueIds(vueIds, mpInstance) {
  2245. vueIds = (vueIds || '').split(',');
  2246. var len = vueIds.length;
  2247. if (len === 1) {
  2248. mpInstance._$vueId = vueIds[0];
  2249. } else if (len === 2) {
  2250. mpInstance._$vueId = vueIds[0];
  2251. mpInstance._$vuePid = vueIds[1];
  2252. }
  2253. }
  2254. function initData(vueOptions, context) {
  2255. var data = vueOptions.data || {};
  2256. var methods = vueOptions.methods || {};
  2257. if (typeof data === 'function') {
  2258. try {
  2259. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  2260. } catch (e) {
  2261. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-alipay","BASE_URL":"/"}).VUE_APP_DEBUG) {
  2262. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  2263. }
  2264. }
  2265. } else {
  2266. try {
  2267. // 对 data 格式化
  2268. data = JSON.parse(JSON.stringify(data));
  2269. } catch (e) {}
  2270. }
  2271. if (!isPlainObject(data)) {
  2272. data = {};
  2273. }
  2274. Object.keys(methods).forEach(function (methodName) {
  2275. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  2276. data[methodName] = methods[methodName];
  2277. }
  2278. });
  2279. return data;
  2280. }
  2281. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  2282. function createObserver$1(name) {
  2283. return function observer(newVal, oldVal) {
  2284. if (this.$vm) {
  2285. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  2286. }
  2287. };
  2288. }
  2289. function initBehaviors(vueOptions, initBehavior) {
  2290. var vueBehaviors = vueOptions.behaviors;
  2291. var vueExtends = vueOptions.extends;
  2292. var vueMixins = vueOptions.mixins;
  2293. var vueProps = vueOptions.props;
  2294. if (!vueProps) {
  2295. vueOptions.props = vueProps = [];
  2296. }
  2297. var behaviors = [];
  2298. if (Array.isArray(vueBehaviors)) {
  2299. vueBehaviors.forEach(function (behavior) {
  2300. behaviors.push(behavior.replace('uni://', "my".concat("://")));
  2301. if (behavior === 'uni://form-field') {
  2302. if (Array.isArray(vueProps)) {
  2303. vueProps.push('name');
  2304. vueProps.push('value');
  2305. } else {
  2306. vueProps.name = {
  2307. type: String,
  2308. default: ''
  2309. };
  2310. vueProps.value = {
  2311. type: [String, Number, Boolean, Array, Object, Date],
  2312. default: ''
  2313. };
  2314. }
  2315. }
  2316. });
  2317. }
  2318. {
  2319. // alipay 重复定义props会报错,下边的代码对于其他平台也没有意义,保险起见,仅对alipay做处理
  2320. return;
  2321. }
  2322. }
  2323. function parsePropType(key, type, defaultValue, file) {
  2324. // [String]=>String
  2325. if (Array.isArray(type) && type.length === 1) {
  2326. return type[0];
  2327. }
  2328. return type;
  2329. }
  2330. function initProperties(props) {
  2331. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2332. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  2333. var options = arguments.length > 3 ? arguments[3] : undefined;
  2334. var properties = {};
  2335. if (!isBehavior) {
  2336. properties.vueId = {
  2337. type: String,
  2338. value: ''
  2339. };
  2340. {
  2341. {
  2342. properties.virtualHostStyle = {
  2343. type: null,
  2344. value: ''
  2345. };
  2346. properties.virtualHostClass = {
  2347. type: null,
  2348. value: ''
  2349. };
  2350. }
  2351. }
  2352. // scopedSlotsCompiler auto
  2353. properties.scopedSlotsCompiler = {
  2354. type: String,
  2355. value: ''
  2356. };
  2357. properties.vueSlots = {
  2358. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  2359. type: null,
  2360. value: [],
  2361. observer: function observer(newVal, oldVal) {
  2362. var $slots = Object.create(null);
  2363. newVal.forEach(function (slotName) {
  2364. $slots[slotName] = true;
  2365. });
  2366. this.setData({
  2367. $slots: $slots
  2368. });
  2369. }
  2370. };
  2371. }
  2372. if (Array.isArray(props)) {
  2373. // ['title']
  2374. props.forEach(function (key) {
  2375. properties[key] = {
  2376. type: null,
  2377. observer: createObserver$1(key)
  2378. };
  2379. });
  2380. } else if (isPlainObject(props)) {
  2381. // {title:{type:String,default:''},content:String}
  2382. Object.keys(props).forEach(function (key) {
  2383. var opts = props[key];
  2384. if (isPlainObject(opts)) {
  2385. // title:{type:String,default:''}
  2386. var value = opts.default;
  2387. if (isFn(value)) {
  2388. value = value();
  2389. }
  2390. opts.type = parsePropType(key, opts.type);
  2391. properties[key] = {
  2392. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  2393. value: value,
  2394. observer: createObserver$1(key)
  2395. };
  2396. } else {
  2397. // content:String
  2398. var type = parsePropType(key, opts);
  2399. properties[key] = {
  2400. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  2401. observer: createObserver$1(key)
  2402. };
  2403. }
  2404. });
  2405. }
  2406. return properties;
  2407. }
  2408. function wrapper$1(event) {
  2409. // TODO 又得兼容 mpvue 的 mp 对象
  2410. try {
  2411. event.mp = JSON.parse(JSON.stringify(event));
  2412. } catch (e) {}
  2413. event.stopPropagation = noop;
  2414. event.preventDefault = noop;
  2415. event.target = event.target || {};
  2416. if (!hasOwn(event, 'detail')) {
  2417. event.detail = {};
  2418. }
  2419. if (hasOwn(event, 'markerId')) {
  2420. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  2421. event.detail.markerId = event.markerId;
  2422. }
  2423. if (isPlainObject(event.detail)) {
  2424. event.target = Object.assign({}, event.target, event.detail);
  2425. }
  2426. return event;
  2427. }
  2428. function getExtraValue(vm, dataPathsArray) {
  2429. var context = vm;
  2430. dataPathsArray.forEach(function (dataPathArray) {
  2431. var dataPath = dataPathArray[0];
  2432. var value = dataPathArray[2];
  2433. if (dataPath || typeof value !== 'undefined') {
  2434. // ['','',index,'disable']
  2435. var propPath = dataPathArray[1];
  2436. var valuePath = dataPathArray[3];
  2437. var vFor;
  2438. if (Number.isInteger(dataPath)) {
  2439. vFor = dataPath;
  2440. } else if (!dataPath) {
  2441. vFor = context;
  2442. } else if (typeof dataPath === 'string' && dataPath) {
  2443. if (dataPath.indexOf('#s#') === 0) {
  2444. vFor = dataPath.substr(3);
  2445. } else {
  2446. vFor = vm.__get_value(dataPath, context);
  2447. }
  2448. }
  2449. if (Number.isInteger(vFor)) {
  2450. context = value;
  2451. } else if (!propPath) {
  2452. context = vFor[value];
  2453. } else {
  2454. if (Array.isArray(vFor)) {
  2455. context = vFor.find(function (vForItem) {
  2456. return vm.__get_value(propPath, vForItem) === value;
  2457. });
  2458. } else if (isPlainObject(vFor)) {
  2459. context = Object.keys(vFor).find(function (vForKey) {
  2460. return vm.__get_value(propPath, vFor[vForKey]) === value;
  2461. });
  2462. } else {
  2463. console.error('v-for 暂不支持循环数据:', vFor);
  2464. }
  2465. }
  2466. if (valuePath) {
  2467. context = vm.__get_value(valuePath, context);
  2468. }
  2469. }
  2470. });
  2471. return context;
  2472. }
  2473. function processEventExtra(vm, extra, event, __args__) {
  2474. var extraObj = {};
  2475. if (Array.isArray(extra) && extra.length) {
  2476. /**
  2477. *[
  2478. * ['data.items', 'data.id', item.data.id],
  2479. * ['metas', 'id', meta.id]
  2480. *],
  2481. *[
  2482. * ['data.items', 'data.id', item.data.id],
  2483. * ['metas', 'id', meta.id]
  2484. *],
  2485. *'test'
  2486. */
  2487. extra.forEach(function (dataPath, index) {
  2488. if (typeof dataPath === 'string') {
  2489. if (!dataPath) {
  2490. // model,prop.sync
  2491. extraObj['$' + index] = vm;
  2492. } else {
  2493. if (dataPath === '$event') {
  2494. // $event
  2495. extraObj['$' + index] = event;
  2496. } else if (dataPath === 'arguments') {
  2497. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  2498. } else if (dataPath.indexOf('$event.') === 0) {
  2499. // $event.target.value
  2500. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  2501. } else {
  2502. extraObj['$' + index] = vm.__get_value(dataPath);
  2503. }
  2504. }
  2505. } else {
  2506. extraObj['$' + index] = getExtraValue(vm, dataPath);
  2507. }
  2508. });
  2509. }
  2510. return extraObj;
  2511. }
  2512. function getObjByArray(arr) {
  2513. var obj = {};
  2514. for (var i = 1; i < arr.length; i++) {
  2515. var element = arr[i];
  2516. obj[element[0]] = element[1];
  2517. }
  2518. return obj;
  2519. }
  2520. function processEventArgs(vm, event) {
  2521. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  2522. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  2523. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  2524. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  2525. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  2526. // fixed 用户直接触发 mpInstance.triggerEvent
  2527. var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
  2528. if (isCustom) {
  2529. // 自定义事件
  2530. isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
  2531. if (!args.length) {
  2532. // 无参数,直接传入 event 或 detail 数组
  2533. if (isCustomMPEvent) {
  2534. return [event];
  2535. }
  2536. return __args__;
  2537. }
  2538. }
  2539. var extraObj = processEventExtra(vm, extra, event, __args__);
  2540. var ret = [];
  2541. args.forEach(function (arg) {
  2542. if (arg === '$event') {
  2543. if (methodName === '__set_model' && !isCustom) {
  2544. // input v-model value
  2545. ret.push(event.target.value);
  2546. } else {
  2547. if (isCustom && !isCustomMPEvent) {
  2548. ret.push(__args__[0]);
  2549. } else {
  2550. // wxcomponent 组件或内置组件
  2551. ret.push(event);
  2552. }
  2553. }
  2554. } else {
  2555. if (Array.isArray(arg) && arg[0] === 'o') {
  2556. ret.push(getObjByArray(arg));
  2557. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  2558. ret.push(extraObj[arg]);
  2559. } else {
  2560. ret.push(arg);
  2561. }
  2562. }
  2563. });
  2564. return ret;
  2565. }
  2566. var ONCE = '~';
  2567. var CUSTOM = '^';
  2568. function isMatchEventType(eventType, optType) {
  2569. return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
  2570. }
  2571. function getContextVm(vm) {
  2572. var $parent = vm.$parent;
  2573. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  2574. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  2575. $parent = $parent.$parent;
  2576. }
  2577. return $parent && $parent.$parent;
  2578. }
  2579. function handleEvent(event) {
  2580. var _this5 = this;
  2581. event = wrapper$1(event);
  2582. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  2583. var dataset = (event.currentTarget || event.target).dataset;
  2584. if (!dataset) {
  2585. return console.warn('事件信息不存在');
  2586. }
  2587. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  2588. if (!eventOpts) {
  2589. return console.warn('事件信息不存在');
  2590. }
  2591. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  2592. var eventType = event.type;
  2593. var ret = [];
  2594. eventOpts.forEach(function (eventOpt) {
  2595. var type = eventOpt[0];
  2596. var eventsArray = eventOpt[1];
  2597. var isCustom = type.charAt(0) === CUSTOM;
  2598. type = isCustom ? type.slice(1) : type;
  2599. var isOnce = type.charAt(0) === ONCE;
  2600. type = isOnce ? type.slice(1) : type;
  2601. if (eventsArray && isMatchEventType(eventType, type)) {
  2602. eventsArray.forEach(function (eventArray) {
  2603. var methodName = eventArray[0];
  2604. if (methodName) {
  2605. var handlerCtx = _this5.$vm;
  2606. if (handlerCtx.$options.generic) {
  2607. // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  2608. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  2609. }
  2610. if (methodName === '$emit') {
  2611. handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this5.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
  2612. return;
  2613. }
  2614. var handler = handlerCtx[methodName];
  2615. if (!isFn(handler)) {
  2616. var _type = _this5.$vm.mpType === 'page' ? 'Page' : 'Component';
  2617. var path = _this5.route || _this5.is;
  2618. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  2619. }
  2620. if (isOnce) {
  2621. if (handler.once) {
  2622. return;
  2623. }
  2624. handler.once = true;
  2625. }
  2626. var params = processEventArgs(_this5.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
  2627. params = Array.isArray(params) ? params : [];
  2628. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  2629. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  2630. // eslint-disable-next-line no-sparse-arrays
  2631. params = params.concat([,,,,,,,,,, event]);
  2632. }
  2633. ret.push(handler.apply(handlerCtx, params));
  2634. }
  2635. });
  2636. }
  2637. });
  2638. if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
  2639. return ret[0];
  2640. }
  2641. }
  2642. var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
  2643. function initEventChannel$1() {
  2644. _vue.default.prototype.getOpenerEventChannel = function () {
  2645. {
  2646. if (my.canIUse('getOpenerEventChannel')) {
  2647. return this.$scope.getOpenerEventChannel();
  2648. }
  2649. }
  2650. if (!this.__eventChannel__) {
  2651. this.__eventChannel__ = new EventChannel();
  2652. }
  2653. return this.__eventChannel__;
  2654. };
  2655. var callHook = _vue.default.prototype.__call_hook;
  2656. _vue.default.prototype.__call_hook = function (hook, args) {
  2657. if (hook === 'onLoad' && args && args.__id__) {
  2658. this.__eventChannel__ = getEventChannel(args.__id__);
  2659. delete args.__id__;
  2660. }
  2661. return callHook.call(this, hook, args);
  2662. };
  2663. }
  2664. function initScopedSlotsParams() {
  2665. var center = {};
  2666. var parents = {};
  2667. function currentId(fn) {
  2668. var vueIds = this.$options.propsData.vueId;
  2669. if (vueIds) {
  2670. var vueId = vueIds.split(',')[0];
  2671. fn(vueId);
  2672. }
  2673. }
  2674. _vue.default.prototype.$hasSSP = function (vueId) {
  2675. var slot = center[vueId];
  2676. if (!slot) {
  2677. parents[vueId] = this;
  2678. this.$on('hook:destroyed', function () {
  2679. delete parents[vueId];
  2680. });
  2681. }
  2682. return slot;
  2683. };
  2684. _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
  2685. var slot = center[vueId];
  2686. if (slot) {
  2687. var params = slot[name] || [];
  2688. if (needAll) {
  2689. return params;
  2690. }
  2691. return params[0];
  2692. }
  2693. };
  2694. _vue.default.prototype.$setSSP = function (name, value) {
  2695. var index = 0;
  2696. currentId.call(this, function (vueId) {
  2697. var slot = center[vueId];
  2698. var params = slot[name] = slot[name] || [];
  2699. params.push(value);
  2700. index = params.length - 1;
  2701. });
  2702. return index;
  2703. };
  2704. _vue.default.prototype.$initSSP = function () {
  2705. currentId.call(this, function (vueId) {
  2706. center[vueId] = {};
  2707. });
  2708. };
  2709. _vue.default.prototype.$callSSP = function () {
  2710. currentId.call(this, function (vueId) {
  2711. if (parents[vueId]) {
  2712. parents[vueId].$forceUpdate();
  2713. }
  2714. });
  2715. };
  2716. _vue.default.mixin({
  2717. destroyed: function destroyed() {
  2718. var propsData = this.$options.propsData;
  2719. var vueId = propsData && propsData.vueId;
  2720. if (vueId) {
  2721. delete center[vueId];
  2722. delete parents[vueId];
  2723. }
  2724. }
  2725. });
  2726. }
  2727. function parseBaseApp(vm, _ref8) {
  2728. var mocks = _ref8.mocks,
  2729. initRefs = _ref8.initRefs;
  2730. initEventChannel$1();
  2731. {
  2732. initScopedSlotsParams();
  2733. }
  2734. if (vm.$options.store) {
  2735. _vue.default.prototype.$store = vm.$options.store;
  2736. }
  2737. uniIdMixin(_vue.default);
  2738. _vue.default.prototype.mpHost = "mp-alipay";
  2739. _vue.default.mixin({
  2740. beforeCreate: function beforeCreate() {
  2741. if (!this.$options.mpType) {
  2742. return;
  2743. }
  2744. this.mpType = this.$options.mpType;
  2745. this.$mp = (0, _defineProperty2.default)({
  2746. data: {}
  2747. }, this.mpType, this.$options.mpInstance);
  2748. this.$scope = this.$options.mpInstance;
  2749. delete this.$options.mpType;
  2750. delete this.$options.mpInstance;
  2751. if (this.mpType === 'page' && typeof getApp === 'function') {
  2752. // hack vue-i18n
  2753. var app = getApp();
  2754. if (app.$vm && app.$vm.$i18n) {
  2755. this._i18n = app.$vm.$i18n;
  2756. }
  2757. }
  2758. if (this.mpType !== 'app') {
  2759. initRefs(this);
  2760. initMocks(this, mocks);
  2761. }
  2762. }
  2763. });
  2764. var appOptions = {
  2765. onLaunch: function onLaunch(args) {
  2766. if (this.$vm) {
  2767. // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  2768. return;
  2769. }
  2770. this.$vm = vm;
  2771. this.$vm.$mp = {
  2772. app: this
  2773. };
  2774. this.$vm.$scope = this;
  2775. // vm 上也挂载 globalData
  2776. this.$vm.globalData = this.globalData;
  2777. this.$vm._isMounted = true;
  2778. this.$vm.__call_hook('mounted', args);
  2779. this.$vm.__call_hook('onLaunch', args);
  2780. }
  2781. };
  2782. // 兼容旧版本 globalData
  2783. appOptions.globalData = vm.$options.globalData || {};
  2784. // 将 methods 中的方法挂在 getApp() 中
  2785. var methods = vm.$options.methods;
  2786. if (methods) {
  2787. Object.keys(methods).forEach(function (name) {
  2788. appOptions[name] = methods[name];
  2789. });
  2790. }
  2791. initAppLocale(_vue.default, vm, normalizeLocale(my.getSystemInfoSync().language) || LOCALE_EN);
  2792. initHooks(appOptions, hooks);
  2793. initUnknownHooks(appOptions, vm.$options);
  2794. return appOptions;
  2795. }
  2796. function parseApp(vm) {
  2797. _vue.default.prototype.$onAliGetAuthorize = function onAliGetAuthorize(method, $event) {
  2798. var _this6 = this;
  2799. my.getPhoneNumber({
  2800. success: function success(res) {
  2801. $event.type = 'getphonenumber';
  2802. var response = JSON.parse(res.response);
  2803. $event.detail.errMsg = 'getPhoneNumber:ok';
  2804. $event.detail.encryptedData = response.response;
  2805. $event.detail.sign = response.sign;
  2806. _this6[method]($event);
  2807. },
  2808. fail: function fail(res) {
  2809. $event.type = 'getphonenumber';
  2810. $event.detail.errMsg = 'getPhoneNumber:fail Error: ' + JSON.stringify(res);
  2811. _this6[method]($event);
  2812. }
  2813. });
  2814. };
  2815. _vue.default.prototype.$onAliAuthError = function $onAliAuthError(method, $event) {
  2816. $event.type = 'getphonenumber';
  2817. $event.detail.errMsg = 'getPhoneNumber:fail Error: ' + $event.detail.errorMessage;
  2818. this[method]($event);
  2819. };
  2820. return parseBaseApp(vm, {
  2821. mocks: mocks,
  2822. initRefs: initRefs
  2823. });
  2824. }
  2825. function createApp(vm) {
  2826. App(parseApp(vm));
  2827. return vm;
  2828. }
  2829. var encodeReserveRE = /[!'()*]/g;
  2830. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  2831. return '%' + c.charCodeAt(0).toString(16);
  2832. };
  2833. var commaRE = /%2C/g;
  2834. // fixed encodeURIComponent which is more conformant to RFC3986:
  2835. // - escapes [!'()*]
  2836. // - preserve commas
  2837. var encode = function encode(str) {
  2838. return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
  2839. };
  2840. function stringifyQuery(obj) {
  2841. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  2842. var res = obj ? Object.keys(obj).map(function (key) {
  2843. var val = obj[key];
  2844. if (val === undefined) {
  2845. return '';
  2846. }
  2847. if (val === null) {
  2848. return encodeStr(key);
  2849. }
  2850. if (Array.isArray(val)) {
  2851. var result = [];
  2852. val.forEach(function (val2) {
  2853. if (val2 === undefined) {
  2854. return;
  2855. }
  2856. if (val2 === null) {
  2857. result.push(encodeStr(key));
  2858. } else {
  2859. result.push(encodeStr(key) + '=' + encodeStr(val2));
  2860. }
  2861. });
  2862. return result.join('&');
  2863. }
  2864. return encodeStr(key) + '=' + encodeStr(val);
  2865. }).filter(function (x) {
  2866. return x.length > 0;
  2867. }).join('&') : null;
  2868. return res ? "?".concat(res) : '';
  2869. }
  2870. var hooks$1 = ['onShow', 'onHide',
  2871. // mp-alipay 特有
  2872. 'onTitleClick', 'onOptionMenuClick', 'onPopMenuClick', 'onPullIntercept'];
  2873. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  2874. function parsePage(vuePageOptions) {
  2875. var _initVueComponent = initVueComponent(_vue.default, vuePageOptions),
  2876. _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
  2877. VueComponent = _initVueComponent2[0],
  2878. vueOptions = _initVueComponent2[1];
  2879. var pageOptions = {
  2880. mixins: initBehaviors(vueOptions),
  2881. data: initData(vueOptions, _vue.default.prototype),
  2882. onLoad: function onLoad(query) {
  2883. var properties = this.props;
  2884. var options = {
  2885. mpType: 'page',
  2886. mpInstance: this,
  2887. propsData: properties
  2888. };
  2889. // 初始化 vue 实例
  2890. this.$vm = new VueComponent(options);
  2891. initSpecialMethods(this);
  2892. // 触发首次 setData
  2893. this.$vm.$mount();
  2894. var copyQuery = Object.assign({}, query);
  2895. delete copyQuery.__id__;
  2896. this.$page = {
  2897. fullPath: '/' + this.route + stringifyQuery(copyQuery)
  2898. };
  2899. this.options = query;
  2900. this.$vm.$mp.query = query; // 兼容 mpvue
  2901. this.$vm.__call_hook('onLoad', query);
  2902. },
  2903. onReady: function onReady() {
  2904. initChildVues(this);
  2905. this.$vm._isMounted = true;
  2906. this.$vm.__call_hook('mounted');
  2907. this.$vm.__call_hook('onReady');
  2908. },
  2909. onUnload: function onUnload() {
  2910. this.$vm.__call_hook('onUnload');
  2911. this.$vm.$destroy();
  2912. },
  2913. events: {
  2914. // 支付宝小程序有些页面事件只能放在events下
  2915. onBack: function onBack() {
  2916. this.$vm.__call_hook('onBackPress');
  2917. },
  2918. onKeyboardHeight: function onKeyboardHeight(res) {
  2919. $emit('uni:keyboardHeightChange', res);
  2920. }
  2921. },
  2922. __r: handleRef,
  2923. __e: handleEvent,
  2924. __l: handleLink$1,
  2925. __w: handleWrap,
  2926. triggerEvent: triggerEvent
  2927. };
  2928. Object.assign(pageOptions.events, vueOptions.events || {});
  2929. initHooks(pageOptions, hooks$1, vueOptions);
  2930. initUnknownHooks(pageOptions, vueOptions, ['onReady']);
  2931. if (Array.isArray(vueOptions.wxsCallMethods)) {
  2932. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  2933. pageOptions[callMethod] = function (args) {
  2934. return this.$vm[callMethod](args);
  2935. };
  2936. });
  2937. }
  2938. return pageOptions;
  2939. }
  2940. function createPage(vuePageOptions) {
  2941. {
  2942. return Page(parsePage(vuePageOptions));
  2943. }
  2944. }
  2945. function initSlots(vm, vueSlots) {
  2946. var $slots = Object.create(null);
  2947. // 未启用小程序基础库 2.0 时,组件实例支持支持访问 $slots、$scopedSlots
  2948. Object.defineProperty(vm, '$slots', {
  2949. get: function get() {
  2950. var $scope = this.$scope;
  2951. return $scope && $scope.props.$slots || ($scope && $scope.props.$scopedSlots ? {} : $slots);
  2952. }
  2953. });
  2954. Object.defineProperty(vm, '$scopedSlots', {
  2955. get: function get() {
  2956. var $scope = this.$scope;
  2957. return $scope && $scope.props.$scopedSlots || ($scope && $scope.props.$slots ? {} : $slots);
  2958. }
  2959. });
  2960. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  2961. if (Array.isArray(vueSlots) && vueSlots.length) {
  2962. vueSlots.forEach(function (slotName) {
  2963. $slots[slotName] = true;
  2964. });
  2965. }
  2966. }
  2967. function initVm(VueComponent) {
  2968. if (this.$vm) {
  2969. return;
  2970. }
  2971. var properties = this.props;
  2972. var options = {
  2973. mpType: 'component',
  2974. mpInstance: this,
  2975. propsData: properties
  2976. };
  2977. initVueIds(properties.vueId, this);
  2978. if (isComponent2) {
  2979. // 处理父子关系
  2980. initRelation.call(this, {
  2981. vuePid: this._$vuePid,
  2982. vueOptions: options
  2983. });
  2984. // 初始化 vue 实例
  2985. this.$vm = new VueComponent(options);
  2986. initSlots(this.$vm, properties.vueSlots);
  2987. // 触发首次 setData
  2988. this.$vm.$mount();
  2989. } else {
  2990. // 处理父子关系
  2991. initRelation.call(this, {
  2992. vuePid: this._$vuePid,
  2993. vueOptions: options,
  2994. VueComponent: VueComponent,
  2995. mpInstance: this
  2996. });
  2997. if (options.parent) {
  2998. // 父组件已经初始化,直接初始化子,否则放到父组件的 didMount 中处理
  2999. // 初始化 vue 实例
  3000. this.$vm = new VueComponent(options);
  3001. handleRef.call(options.parent.$scope, this);
  3002. initSlots(this.$vm, properties.vueSlots);
  3003. // 触发首次 setData
  3004. this.$vm.$mount();
  3005. initChildVues(this);
  3006. this.$vm._isMounted = true;
  3007. this.$vm.__call_hook('mounted');
  3008. this.$vm.__call_hook('onReady');
  3009. }
  3010. }
  3011. }
  3012. function parseComponent(vueComponentOptions, needVueOptions) {
  3013. var _initVueComponent3 = initVueComponent(_vue.default, vueComponentOptions),
  3014. _initVueComponent4 = (0, _slicedToArray2.default)(_initVueComponent3, 2),
  3015. VueComponent = _initVueComponent4[0],
  3016. vueOptions = _initVueComponent4[1];
  3017. var properties = initProperties(vueOptions.props, false, vueOptions.__file);
  3018. var props = {
  3019. onVueInit: function onVueInit() {}
  3020. };
  3021. Object.keys(properties).forEach(function (key) {
  3022. props[key] = properties[key].value;
  3023. });
  3024. var componentOptions = {
  3025. mixins: initBehaviors(vueOptions),
  3026. data: initData(vueOptions, _vue.default.prototype),
  3027. props: props,
  3028. didMount: function didMount() {
  3029. var _this7 = this;
  3030. if (my.dd) {
  3031. // 钉钉小程序底层基础库有 bug,组件嵌套使用时,在 didMount 中无法及时调用 props 中的方法
  3032. setTimeout(function () {
  3033. initVm.call(_this7, VueComponent);
  3034. }, 4);
  3035. } else {
  3036. initVm.call(this, VueComponent);
  3037. }
  3038. initSpecialMethods(this);
  3039. if (isComponent2) {
  3040. this.$vm._isMounted = true;
  3041. this.$vm.__call_hook('mounted');
  3042. this.$vm.__call_hook('onReady');
  3043. }
  3044. },
  3045. didUnmount: function didUnmount() {
  3046. this.$vm && this.$vm.$destroy();
  3047. },
  3048. methods: {
  3049. __r: handleRef,
  3050. __e: handleEvent,
  3051. __l: handleLink$1,
  3052. __w: handleWrap,
  3053. triggerEvent: triggerEvent
  3054. }
  3055. };
  3056. if (vueOptions.options) {
  3057. componentOptions.options = vueOptions.options;
  3058. }
  3059. if (isComponent2) {
  3060. componentOptions.onInit = function onInit() {
  3061. initVm.call(this, VueComponent);
  3062. };
  3063. componentOptions.deriveDataFromProps = createObserver();
  3064. } else {
  3065. componentOptions.didUpdate = createObserver(true);
  3066. }
  3067. if (Array.isArray(vueOptions.wxsCallMethods)) {
  3068. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  3069. componentOptions.methods[callMethod] = function (args) {
  3070. return this.$vm[callMethod](args);
  3071. };
  3072. });
  3073. }
  3074. return needVueOptions ? [componentOptions, vueOptions] : componentOptions;
  3075. }
  3076. function createComponent(vueOptions) {
  3077. {
  3078. return my.defineComponent(parseComponent(vueOptions));
  3079. }
  3080. }
  3081. function createSubpackageApp(vm) {
  3082. var appOptions = parseApp(vm);
  3083. var app = getApp({
  3084. allowDefault: true
  3085. });
  3086. vm.$scope = app;
  3087. var globalData = app.globalData;
  3088. if (globalData) {
  3089. Object.keys(appOptions.globalData).forEach(function (name) {
  3090. if (!hasOwn(globalData, name)) {
  3091. globalData[name] = appOptions.globalData[name];
  3092. }
  3093. });
  3094. }
  3095. Object.keys(appOptions).forEach(function (name) {
  3096. if (!hasOwn(app, name)) {
  3097. app[name] = appOptions[name];
  3098. }
  3099. });
  3100. if (isFn(appOptions.onShow) && my.onAppShow) {
  3101. my.onAppShow(function () {
  3102. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  3103. args[_key5] = arguments[_key5];
  3104. }
  3105. vm.__call_hook('onShow', args);
  3106. });
  3107. }
  3108. if (isFn(appOptions.onHide) && my.onAppHide) {
  3109. my.onAppHide(function () {
  3110. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  3111. args[_key6] = arguments[_key6];
  3112. }
  3113. vm.__call_hook('onHide', args);
  3114. });
  3115. }
  3116. if (isFn(appOptions.onLaunch)) {
  3117. var args = my.getLaunchOptionsSync && my.getLaunchOptionsSync();
  3118. vm.__call_hook('onLaunch', args);
  3119. }
  3120. return vm;
  3121. }
  3122. function createPlugin(vm) {
  3123. var appOptions = parseApp(vm);
  3124. if (isFn(appOptions.onShow) && my.onAppShow) {
  3125. my.onAppShow(function () {
  3126. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  3127. args[_key7] = arguments[_key7];
  3128. }
  3129. vm.__call_hook('onShow', args);
  3130. });
  3131. }
  3132. if (isFn(appOptions.onHide) && my.onAppHide) {
  3133. my.onAppHide(function () {
  3134. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  3135. args[_key8] = arguments[_key8];
  3136. }
  3137. vm.__call_hook('onHide', args);
  3138. });
  3139. }
  3140. if (isFn(appOptions.onLaunch)) {
  3141. var args = my.getLaunchOptionsSync && my.getLaunchOptionsSync();
  3142. vm.__call_hook('onLaunch', args);
  3143. }
  3144. return vm;
  3145. }
  3146. todos.forEach(function (todoApi) {
  3147. protocols[todoApi] = false;
  3148. });
  3149. canIUses.forEach(function (canIUseApi) {
  3150. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
  3151. if (!my.canIUse(apiName)) {
  3152. protocols[canIUseApi] = false;
  3153. }
  3154. });
  3155. var uni = {};
  3156. if (typeof Proxy !== 'undefined' && "mp-alipay" !== 'app-plus') {
  3157. uni = new Proxy({}, {
  3158. get: function get(target, name) {
  3159. if (hasOwn(target, name)) {
  3160. return target[name];
  3161. }
  3162. if (baseApi[name]) {
  3163. return baseApi[name];
  3164. }
  3165. if (api[name]) {
  3166. return promisify(name, api[name]);
  3167. }
  3168. {
  3169. if (extraApi[name]) {
  3170. return promisify(name, extraApi[name]);
  3171. }
  3172. if (todoApis[name]) {
  3173. return promisify(name, todoApis[name]);
  3174. }
  3175. }
  3176. if (eventApi[name]) {
  3177. return eventApi[name];
  3178. }
  3179. return promisify(name, wrapper(name, my[name]));
  3180. },
  3181. set: function set(target, name, value) {
  3182. target[name] = value;
  3183. return true;
  3184. }
  3185. });
  3186. } else {
  3187. Object.keys(baseApi).forEach(function (name) {
  3188. uni[name] = baseApi[name];
  3189. });
  3190. {
  3191. Object.keys(todoApis).forEach(function (name) {
  3192. uni[name] = promisify(name, todoApis[name]);
  3193. });
  3194. Object.keys(extraApi).forEach(function (name) {
  3195. uni[name] = promisify(name, extraApi[name]);
  3196. });
  3197. }
  3198. Object.keys(eventApi).forEach(function (name) {
  3199. uni[name] = eventApi[name];
  3200. });
  3201. Object.keys(api).forEach(function (name) {
  3202. uni[name] = promisify(name, api[name]);
  3203. });
  3204. Object.keys(my).forEach(function (name) {
  3205. if (hasOwn(my, name) || hasOwn(protocols, name)) {
  3206. uni[name] = promisify(name, wrapper(name, my[name]));
  3207. }
  3208. });
  3209. }
  3210. my.createApp = createApp;
  3211. my.createPage = createPage;
  3212. my.createComponent = createComponent;
  3213. my.createSubpackageApp = createSubpackageApp;
  3214. my.createPlugin = createPlugin;
  3215. var uni$1 = uni;
  3216. var _default = uni$1;
  3217. exports.default = _default;
  3218. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 2)))
  3219. /***/ }),
  3220. /* 2 */
  3221. /*!***********************************!*\
  3222. !*** (webpack)/buildin/global.js ***!
  3223. \***********************************/
  3224. /*! no static exports found */
  3225. /***/ (function(module, exports) {
  3226. var g;
  3227. // This works in non-strict mode
  3228. g = (function() {
  3229. return this;
  3230. })();
  3231. try {
  3232. // This works if eval is allowed (see CSP)
  3233. g = g || new Function("return this")();
  3234. } catch (e) {
  3235. // This works if the window reference is available
  3236. if (typeof window === "object") g = window;
  3237. }
  3238. // g can still be undefined, but nothing to do about it...
  3239. // We return undefined, instead of nothing here, so it's
  3240. // easier to handle this case. if(!global) { ...}
  3241. module.exports = g;
  3242. /***/ }),
  3243. /* 3 */
  3244. /*!**********************************************************************!*\
  3245. !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
  3246. \**********************************************************************/
  3247. /*! no static exports found */
  3248. /***/ (function(module, exports) {
  3249. function _interopRequireDefault(obj) {
  3250. return obj && obj.__esModule ? obj : {
  3251. "default": obj
  3252. };
  3253. }
  3254. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3255. /***/ }),
  3256. /* 4 */
  3257. /*!**************************************************************!*\
  3258. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  3259. \**************************************************************/
  3260. /*! no static exports found */
  3261. /***/ (function(module, exports, __webpack_require__) {
  3262. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 5);
  3263. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 6);
  3264. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 7);
  3265. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 9);
  3266. function _slicedToArray(arr, i) {
  3267. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  3268. }
  3269. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3270. /***/ }),
  3271. /* 5 */
  3272. /*!***************************************************************!*\
  3273. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  3274. \***************************************************************/
  3275. /*! no static exports found */
  3276. /***/ (function(module, exports) {
  3277. function _arrayWithHoles(arr) {
  3278. if (Array.isArray(arr)) return arr;
  3279. }
  3280. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3281. /***/ }),
  3282. /* 6 */
  3283. /*!*********************************************************************!*\
  3284. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  3285. \*********************************************************************/
  3286. /*! no static exports found */
  3287. /***/ (function(module, exports) {
  3288. function _iterableToArrayLimit(r, l) {
  3289. var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  3290. if (null != t) {
  3291. var e,
  3292. n,
  3293. i,
  3294. u,
  3295. a = [],
  3296. f = !0,
  3297. o = !1;
  3298. try {
  3299. if (i = (t = t.call(r)).next, 0 === l) {
  3300. if (Object(t) !== t) return;
  3301. f = !1;
  3302. } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) {
  3303. ;
  3304. }
  3305. } catch (r) {
  3306. o = !0, n = r;
  3307. } finally {
  3308. try {
  3309. if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
  3310. } finally {
  3311. if (o) throw n;
  3312. }
  3313. }
  3314. return a;
  3315. }
  3316. }
  3317. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3318. /***/ }),
  3319. /* 7 */
  3320. /*!***************************************************************************!*\
  3321. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  3322. \***************************************************************************/
  3323. /*! no static exports found */
  3324. /***/ (function(module, exports, __webpack_require__) {
  3325. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 8);
  3326. function _unsupportedIterableToArray(o, minLen) {
  3327. if (!o) return;
  3328. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  3329. var n = Object.prototype.toString.call(o).slice(8, -1);
  3330. if (n === "Object" && o.constructor) n = o.constructor.name;
  3331. if (n === "Map" || n === "Set") return Array.from(o);
  3332. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  3333. }
  3334. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3335. /***/ }),
  3336. /* 8 */
  3337. /*!*****************************************************************!*\
  3338. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  3339. \*****************************************************************/
  3340. /*! no static exports found */
  3341. /***/ (function(module, exports) {
  3342. function _arrayLikeToArray(arr, len) {
  3343. if (len == null || len > arr.length) len = arr.length;
  3344. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  3345. arr2[i] = arr[i];
  3346. }
  3347. return arr2;
  3348. }
  3349. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3350. /***/ }),
  3351. /* 9 */
  3352. /*!****************************************************************!*\
  3353. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  3354. \****************************************************************/
  3355. /*! no static exports found */
  3356. /***/ (function(module, exports) {
  3357. function _nonIterableRest() {
  3358. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  3359. }
  3360. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3361. /***/ }),
  3362. /* 10 */
  3363. /*!***************************************************************!*\
  3364. !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
  3365. \***************************************************************/
  3366. /*! no static exports found */
  3367. /***/ (function(module, exports, __webpack_require__) {
  3368. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 11);
  3369. function _defineProperty(obj, key, value) {
  3370. key = toPropertyKey(key);
  3371. if (key in obj) {
  3372. Object.defineProperty(obj, key, {
  3373. value: value,
  3374. enumerable: true,
  3375. configurable: true,
  3376. writable: true
  3377. });
  3378. } else {
  3379. obj[key] = value;
  3380. }
  3381. return obj;
  3382. }
  3383. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3384. /***/ }),
  3385. /* 11 */
  3386. /*!**************************************************************!*\
  3387. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  3388. \**************************************************************/
  3389. /*! no static exports found */
  3390. /***/ (function(module, exports, __webpack_require__) {
  3391. var _typeof = __webpack_require__(/*! ./typeof.js */ 12)["default"];
  3392. var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 13);
  3393. function toPropertyKey(t) {
  3394. var i = toPrimitive(t, "string");
  3395. return "symbol" == _typeof(i) ? i : i + "";
  3396. }
  3397. module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3398. /***/ }),
  3399. /* 12 */
  3400. /*!*******************************************************!*\
  3401. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  3402. \*******************************************************/
  3403. /*! no static exports found */
  3404. /***/ (function(module, exports) {
  3405. function _typeof(o) {
  3406. "@babel/helpers - typeof";
  3407. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  3408. return typeof o;
  3409. } : function (o) {
  3410. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  3411. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
  3412. }
  3413. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3414. /***/ }),
  3415. /* 13 */
  3416. /*!************************************************************!*\
  3417. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  3418. \************************************************************/
  3419. /*! no static exports found */
  3420. /***/ (function(module, exports, __webpack_require__) {
  3421. var _typeof = __webpack_require__(/*! ./typeof.js */ 12)["default"];
  3422. function toPrimitive(t, r) {
  3423. if ("object" != _typeof(t) || !t) return t;
  3424. var e = t[Symbol.toPrimitive];
  3425. if (void 0 !== e) {
  3426. var i = e.call(t, r || "default");
  3427. if ("object" != _typeof(i)) return i;
  3428. throw new TypeError("@@toPrimitive must return a primitive value.");
  3429. }
  3430. return ("string" === r ? String : Number)(t);
  3431. }
  3432. module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3433. /***/ }),
  3434. /* 14 */
  3435. /*!***************************************************************!*\
  3436. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  3437. \***************************************************************/
  3438. /*! no static exports found */
  3439. /***/ (function(module, exports) {
  3440. function _classCallCheck(instance, Constructor) {
  3441. if (!(instance instanceof Constructor)) {
  3442. throw new TypeError("Cannot call a class as a function");
  3443. }
  3444. }
  3445. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3446. /***/ }),
  3447. /* 15 */
  3448. /*!************************************************************!*\
  3449. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  3450. \************************************************************/
  3451. /*! no static exports found */
  3452. /***/ (function(module, exports, __webpack_require__) {
  3453. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 11);
  3454. function _defineProperties(target, props) {
  3455. for (var i = 0; i < props.length; i++) {
  3456. var descriptor = props[i];
  3457. descriptor.enumerable = descriptor.enumerable || false;
  3458. descriptor.configurable = true;
  3459. if ("value" in descriptor) descriptor.writable = true;
  3460. Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
  3461. }
  3462. }
  3463. function _createClass(Constructor, protoProps, staticProps) {
  3464. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3465. if (staticProps) _defineProperties(Constructor, staticProps);
  3466. Object.defineProperty(Constructor, "prototype", {
  3467. writable: false
  3468. });
  3469. return Constructor;
  3470. }
  3471. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3472. /***/ }),
  3473. /* 16 */
  3474. /*!******************************************************************!*\
  3475. !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
  3476. \******************************************************************/
  3477. /*! no static exports found */
  3478. /***/ (function(module, exports, __webpack_require__) {
  3479. var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 17);
  3480. var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 18);
  3481. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 7);
  3482. var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 19);
  3483. function _toConsumableArray(arr) {
  3484. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  3485. }
  3486. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3487. /***/ }),
  3488. /* 17 */
  3489. /*!******************************************************************!*\
  3490. !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
  3491. \******************************************************************/
  3492. /*! no static exports found */
  3493. /***/ (function(module, exports, __webpack_require__) {
  3494. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 8);
  3495. function _arrayWithoutHoles(arr) {
  3496. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  3497. }
  3498. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3499. /***/ }),
  3500. /* 18 */
  3501. /*!****************************************************************!*\
  3502. !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
  3503. \****************************************************************/
  3504. /*! no static exports found */
  3505. /***/ (function(module, exports) {
  3506. function _iterableToArray(iter) {
  3507. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  3508. }
  3509. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3510. /***/ }),
  3511. /* 19 */
  3512. /*!******************************************************************!*\
  3513. !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
  3514. \******************************************************************/
  3515. /*! no static exports found */
  3516. /***/ (function(module, exports) {
  3517. function _nonIterableSpread() {
  3518. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  3519. }
  3520. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3521. /***/ }),
  3522. /* 20 */
  3523. /*!*************************************************************!*\
  3524. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  3525. \*************************************************************/
  3526. /*! no static exports found */
  3527. /***/ (function(module, exports, __webpack_require__) {
  3528. "use strict";
  3529. /* WEBPACK VAR INJECTION */(function(uni, global) {
  3530. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 3);
  3531. Object.defineProperty(exports, "__esModule", {
  3532. value: true
  3533. });
  3534. exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
  3535. exports.compileI18nJsonStr = compileI18nJsonStr;
  3536. exports.hasI18nJson = hasI18nJson;
  3537. exports.initVueI18n = initVueI18n;
  3538. exports.isI18nStr = isI18nStr;
  3539. exports.isString = void 0;
  3540. exports.normalizeLocale = normalizeLocale;
  3541. exports.parseI18nJson = parseI18nJson;
  3542. exports.resolveLocale = resolveLocale;
  3543. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 4));
  3544. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 14));
  3545. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 15));
  3546. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 12));
  3547. var isObject = function isObject(val) {
  3548. return val !== null && (0, _typeof2.default)(val) === 'object';
  3549. };
  3550. var defaultDelimiters = ['{', '}'];
  3551. var BaseFormatter = /*#__PURE__*/function () {
  3552. function BaseFormatter() {
  3553. (0, _classCallCheck2.default)(this, BaseFormatter);
  3554. this._caches = Object.create(null);
  3555. }
  3556. (0, _createClass2.default)(BaseFormatter, [{
  3557. key: "interpolate",
  3558. value: function interpolate(message, values) {
  3559. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  3560. if (!values) {
  3561. return [message];
  3562. }
  3563. var tokens = this._caches[message];
  3564. if (!tokens) {
  3565. tokens = parse(message, delimiters);
  3566. this._caches[message] = tokens;
  3567. }
  3568. return compile(tokens, values);
  3569. }
  3570. }]);
  3571. return BaseFormatter;
  3572. }();
  3573. exports.Formatter = BaseFormatter;
  3574. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  3575. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  3576. function parse(format, _ref) {
  3577. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  3578. startDelimiter = _ref2[0],
  3579. endDelimiter = _ref2[1];
  3580. var tokens = [];
  3581. var position = 0;
  3582. var text = '';
  3583. while (position < format.length) {
  3584. var char = format[position++];
  3585. if (char === startDelimiter) {
  3586. if (text) {
  3587. tokens.push({
  3588. type: 'text',
  3589. value: text
  3590. });
  3591. }
  3592. text = '';
  3593. var sub = '';
  3594. char = format[position++];
  3595. while (char !== undefined && char !== endDelimiter) {
  3596. sub += char;
  3597. char = format[position++];
  3598. }
  3599. var isClosed = char === endDelimiter;
  3600. var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
  3601. tokens.push({
  3602. value: sub,
  3603. type: type
  3604. });
  3605. }
  3606. // else if (char === '%') {
  3607. // // when found rails i18n syntax, skip text capture
  3608. // if (format[position] !== '{') {
  3609. // text += char
  3610. // }
  3611. // }
  3612. else {
  3613. text += char;
  3614. }
  3615. }
  3616. text && tokens.push({
  3617. type: 'text',
  3618. value: text
  3619. });
  3620. return tokens;
  3621. }
  3622. function compile(tokens, values) {
  3623. var compiled = [];
  3624. var index = 0;
  3625. var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
  3626. if (mode === 'unknown') {
  3627. return compiled;
  3628. }
  3629. while (index < tokens.length) {
  3630. var token = tokens[index];
  3631. switch (token.type) {
  3632. case 'text':
  3633. compiled.push(token.value);
  3634. break;
  3635. case 'list':
  3636. compiled.push(values[parseInt(token.value, 10)]);
  3637. break;
  3638. case 'named':
  3639. if (mode === 'named') {
  3640. compiled.push(values[token.value]);
  3641. } else {
  3642. if (true) {
  3643. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  3644. }
  3645. }
  3646. break;
  3647. case 'unknown':
  3648. if (true) {
  3649. console.warn("Detect 'unknown' type of token!");
  3650. }
  3651. break;
  3652. }
  3653. index++;
  3654. }
  3655. return compiled;
  3656. }
  3657. var LOCALE_ZH_HANS = 'zh-Hans';
  3658. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  3659. var LOCALE_ZH_HANT = 'zh-Hant';
  3660. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  3661. var LOCALE_EN = 'en';
  3662. exports.LOCALE_EN = LOCALE_EN;
  3663. var LOCALE_FR = 'fr';
  3664. exports.LOCALE_FR = LOCALE_FR;
  3665. var LOCALE_ES = 'es';
  3666. exports.LOCALE_ES = LOCALE_ES;
  3667. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3668. var hasOwn = function hasOwn(val, key) {
  3669. return hasOwnProperty.call(val, key);
  3670. };
  3671. var defaultFormatter = new BaseFormatter();
  3672. function include(str, parts) {
  3673. return !!parts.find(function (part) {
  3674. return str.indexOf(part) !== -1;
  3675. });
  3676. }
  3677. function startsWith(str, parts) {
  3678. return parts.find(function (part) {
  3679. return str.indexOf(part) === 0;
  3680. });
  3681. }
  3682. function normalizeLocale(locale, messages) {
  3683. if (!locale) {
  3684. return;
  3685. }
  3686. locale = locale.trim().replace(/_/g, '-');
  3687. if (messages && messages[locale]) {
  3688. return locale;
  3689. }
  3690. locale = locale.toLowerCase();
  3691. if (locale === 'chinese') {
  3692. // 支付宝
  3693. return LOCALE_ZH_HANS;
  3694. }
  3695. if (locale.indexOf('zh') === 0) {
  3696. if (locale.indexOf('-hans') > -1) {
  3697. return LOCALE_ZH_HANS;
  3698. }
  3699. if (locale.indexOf('-hant') > -1) {
  3700. return LOCALE_ZH_HANT;
  3701. }
  3702. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  3703. return LOCALE_ZH_HANT;
  3704. }
  3705. return LOCALE_ZH_HANS;
  3706. }
  3707. var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  3708. if (messages && Object.keys(messages).length > 0) {
  3709. locales = Object.keys(messages);
  3710. }
  3711. var lang = startsWith(locale, locales);
  3712. if (lang) {
  3713. return lang;
  3714. }
  3715. }
  3716. var I18n = /*#__PURE__*/function () {
  3717. function I18n(_ref3) {
  3718. var locale = _ref3.locale,
  3719. fallbackLocale = _ref3.fallbackLocale,
  3720. messages = _ref3.messages,
  3721. watcher = _ref3.watcher,
  3722. formater = _ref3.formater;
  3723. (0, _classCallCheck2.default)(this, I18n);
  3724. this.locale = LOCALE_EN;
  3725. this.fallbackLocale = LOCALE_EN;
  3726. this.message = {};
  3727. this.messages = {};
  3728. this.watchers = [];
  3729. if (fallbackLocale) {
  3730. this.fallbackLocale = fallbackLocale;
  3731. }
  3732. this.formater = formater || defaultFormatter;
  3733. this.messages = messages || {};
  3734. this.setLocale(locale || LOCALE_EN);
  3735. if (watcher) {
  3736. this.watchLocale(watcher);
  3737. }
  3738. }
  3739. (0, _createClass2.default)(I18n, [{
  3740. key: "setLocale",
  3741. value: function setLocale(locale) {
  3742. var _this = this;
  3743. var oldLocale = this.locale;
  3744. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  3745. if (!this.messages[this.locale]) {
  3746. // 可能初始化时不存在
  3747. this.messages[this.locale] = {};
  3748. }
  3749. this.message = this.messages[this.locale];
  3750. // 仅发生变化时,通知
  3751. if (oldLocale !== this.locale) {
  3752. this.watchers.forEach(function (watcher) {
  3753. watcher(_this.locale, oldLocale);
  3754. });
  3755. }
  3756. }
  3757. }, {
  3758. key: "getLocale",
  3759. value: function getLocale() {
  3760. return this.locale;
  3761. }
  3762. }, {
  3763. key: "watchLocale",
  3764. value: function watchLocale(fn) {
  3765. var _this2 = this;
  3766. var index = this.watchers.push(fn) - 1;
  3767. return function () {
  3768. _this2.watchers.splice(index, 1);
  3769. };
  3770. }
  3771. }, {
  3772. key: "add",
  3773. value: function add(locale, message) {
  3774. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3775. var curMessages = this.messages[locale];
  3776. if (curMessages) {
  3777. if (override) {
  3778. Object.assign(curMessages, message);
  3779. } else {
  3780. Object.keys(message).forEach(function (key) {
  3781. if (!hasOwn(curMessages, key)) {
  3782. curMessages[key] = message[key];
  3783. }
  3784. });
  3785. }
  3786. } else {
  3787. this.messages[locale] = message;
  3788. }
  3789. }
  3790. }, {
  3791. key: "f",
  3792. value: function f(message, values, delimiters) {
  3793. return this.formater.interpolate(message, values, delimiters).join('');
  3794. }
  3795. }, {
  3796. key: "t",
  3797. value: function t(key, locale, values) {
  3798. var message = this.message;
  3799. if (typeof locale === 'string') {
  3800. locale = normalizeLocale(locale, this.messages);
  3801. locale && (message = this.messages[locale]);
  3802. } else {
  3803. values = locale;
  3804. }
  3805. if (!hasOwn(message, key)) {
  3806. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  3807. return key;
  3808. }
  3809. return this.formater.interpolate(message[key], values).join('');
  3810. }
  3811. }]);
  3812. return I18n;
  3813. }();
  3814. exports.I18n = I18n;
  3815. function watchAppLocale(appVm, i18n) {
  3816. // 需要保证 watch 的触发在组件渲染之前
  3817. if (appVm.$watchLocale) {
  3818. // vue2
  3819. appVm.$watchLocale(function (newLocale) {
  3820. i18n.setLocale(newLocale);
  3821. });
  3822. } else {
  3823. appVm.$watch(function () {
  3824. return appVm.$locale;
  3825. }, function (newLocale) {
  3826. i18n.setLocale(newLocale);
  3827. });
  3828. }
  3829. }
  3830. function getDefaultLocale() {
  3831. if (typeof uni !== 'undefined' && uni.getLocale) {
  3832. return uni.getLocale();
  3833. }
  3834. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  3835. if (typeof global !== 'undefined' && global.getLocale) {
  3836. return global.getLocale();
  3837. }
  3838. return LOCALE_EN;
  3839. }
  3840. function initVueI18n(locale) {
  3841. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3842. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  3843. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  3844. // 兼容旧版本入参
  3845. if (typeof locale !== 'string') {
  3846. var _ref4 = [messages, locale];
  3847. locale = _ref4[0];
  3848. messages = _ref4[1];
  3849. }
  3850. if (typeof locale !== 'string') {
  3851. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  3852. locale = getDefaultLocale();
  3853. }
  3854. if (typeof fallbackLocale !== 'string') {
  3855. fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
  3856. }
  3857. var i18n = new I18n({
  3858. locale: locale,
  3859. fallbackLocale: fallbackLocale,
  3860. messages: messages,
  3861. watcher: watcher
  3862. });
  3863. var _t = function t(key, values) {
  3864. if (typeof getApp !== 'function') {
  3865. // app view
  3866. /* eslint-disable no-func-assign */
  3867. _t = function t(key, values) {
  3868. return i18n.t(key, values);
  3869. };
  3870. } else {
  3871. var isWatchedAppLocale = false;
  3872. _t = function t(key, values) {
  3873. var appVm = getApp().$vm;
  3874. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  3875. // options: {
  3876. // type: Array,
  3877. // default () {
  3878. // return [{
  3879. // icon: 'shop',
  3880. // text: t("uni-goods-nav.options.shop"),
  3881. // }, {
  3882. // icon: 'cart',
  3883. // text: t("uni-goods-nav.options.cart")
  3884. // }]
  3885. // }
  3886. // },
  3887. if (appVm) {
  3888. // 触发响应式
  3889. appVm.$locale;
  3890. if (!isWatchedAppLocale) {
  3891. isWatchedAppLocale = true;
  3892. watchAppLocale(appVm, i18n);
  3893. }
  3894. }
  3895. return i18n.t(key, values);
  3896. };
  3897. }
  3898. return _t(key, values);
  3899. };
  3900. return {
  3901. i18n: i18n,
  3902. f: function f(message, values, delimiters) {
  3903. return i18n.f(message, values, delimiters);
  3904. },
  3905. t: function t(key, values) {
  3906. return _t(key, values);
  3907. },
  3908. add: function add(locale, message) {
  3909. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3910. return i18n.add(locale, message, override);
  3911. },
  3912. watch: function watch(fn) {
  3913. return i18n.watchLocale(fn);
  3914. },
  3915. getLocale: function getLocale() {
  3916. return i18n.getLocale();
  3917. },
  3918. setLocale: function setLocale(newLocale) {
  3919. return i18n.setLocale(newLocale);
  3920. }
  3921. };
  3922. }
  3923. var isString = function isString(val) {
  3924. return typeof val === 'string';
  3925. };
  3926. exports.isString = isString;
  3927. var formater;
  3928. function hasI18nJson(jsonObj, delimiters) {
  3929. if (!formater) {
  3930. formater = new BaseFormatter();
  3931. }
  3932. return walkJsonObj(jsonObj, function (jsonObj, key) {
  3933. var value = jsonObj[key];
  3934. if (isString(value)) {
  3935. if (isI18nStr(value, delimiters)) {
  3936. return true;
  3937. }
  3938. } else {
  3939. return hasI18nJson(value, delimiters);
  3940. }
  3941. });
  3942. }
  3943. function parseI18nJson(jsonObj, values, delimiters) {
  3944. if (!formater) {
  3945. formater = new BaseFormatter();
  3946. }
  3947. walkJsonObj(jsonObj, function (jsonObj, key) {
  3948. var value = jsonObj[key];
  3949. if (isString(value)) {
  3950. if (isI18nStr(value, delimiters)) {
  3951. jsonObj[key] = compileStr(value, values, delimiters);
  3952. }
  3953. } else {
  3954. parseI18nJson(value, values, delimiters);
  3955. }
  3956. });
  3957. return jsonObj;
  3958. }
  3959. function compileI18nJsonStr(jsonStr, _ref5) {
  3960. var locale = _ref5.locale,
  3961. locales = _ref5.locales,
  3962. delimiters = _ref5.delimiters;
  3963. if (!isI18nStr(jsonStr, delimiters)) {
  3964. return jsonStr;
  3965. }
  3966. if (!formater) {
  3967. formater = new BaseFormatter();
  3968. }
  3969. var localeValues = [];
  3970. Object.keys(locales).forEach(function (name) {
  3971. if (name !== locale) {
  3972. localeValues.push({
  3973. locale: name,
  3974. values: locales[name]
  3975. });
  3976. }
  3977. });
  3978. localeValues.unshift({
  3979. locale: locale,
  3980. values: locales[locale]
  3981. });
  3982. try {
  3983. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  3984. } catch (e) {}
  3985. return jsonStr;
  3986. }
  3987. function isI18nStr(value, delimiters) {
  3988. return value.indexOf(delimiters[0]) > -1;
  3989. }
  3990. function compileStr(value, values, delimiters) {
  3991. return formater.interpolate(value, values, delimiters).join('');
  3992. }
  3993. function compileValue(jsonObj, key, localeValues, delimiters) {
  3994. var value = jsonObj[key];
  3995. if (isString(value)) {
  3996. // 存在国际化
  3997. if (isI18nStr(value, delimiters)) {
  3998. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  3999. if (localeValues.length > 1) {
  4000. // 格式化国际化语言
  4001. var valueLocales = jsonObj[key + 'Locales'] = {};
  4002. localeValues.forEach(function (localValue) {
  4003. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  4004. });
  4005. }
  4006. }
  4007. } else {
  4008. compileJsonObj(value, localeValues, delimiters);
  4009. }
  4010. }
  4011. function compileJsonObj(jsonObj, localeValues, delimiters) {
  4012. walkJsonObj(jsonObj, function (jsonObj, key) {
  4013. compileValue(jsonObj, key, localeValues, delimiters);
  4014. });
  4015. return jsonObj;
  4016. }
  4017. function walkJsonObj(jsonObj, walk) {
  4018. if (Array.isArray(jsonObj)) {
  4019. for (var i = 0; i < jsonObj.length; i++) {
  4020. if (walk(jsonObj, i)) {
  4021. return true;
  4022. }
  4023. }
  4024. } else if (isObject(jsonObj)) {
  4025. for (var key in jsonObj) {
  4026. if (walk(jsonObj, key)) {
  4027. return true;
  4028. }
  4029. }
  4030. }
  4031. return false;
  4032. }
  4033. function resolveLocale(locales) {
  4034. return function (locale) {
  4035. if (!locale) {
  4036. return locale;
  4037. }
  4038. locale = normalizeLocale(locale) || locale;
  4039. return resolveLocaleChain(locale).find(function (locale) {
  4040. return locales.indexOf(locale) > -1;
  4041. });
  4042. };
  4043. }
  4044. function resolveLocaleChain(locale) {
  4045. var chain = [];
  4046. var tokens = locale.split('-');
  4047. while (tokens.length) {
  4048. chain.push(tokens.join('-'));
  4049. tokens.pop();
  4050. }
  4051. return chain;
  4052. }
  4053. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-alipay/dist/index.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 2)))
  4054. /***/ }),
  4055. /* 21 */
  4056. /*!******************************************************************************************!*\
  4057. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  4058. \******************************************************************************************/
  4059. /*! exports provided: default */
  4060. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4061. "use strict";
  4062. __webpack_require__.r(__webpack_exports__);
  4063. /* WEBPACK VAR INJECTION */(function(global) {/*!
  4064. * Vue.js v2.6.11
  4065. * (c) 2014-2023 Evan You
  4066. * Released under the MIT License.
  4067. */
  4068. /* */
  4069. var emptyObject = Object.freeze({});
  4070. // These helpers produce better VM code in JS engines due to their
  4071. // explicitness and function inlining.
  4072. function isUndef (v) {
  4073. return v === undefined || v === null
  4074. }
  4075. function isDef (v) {
  4076. return v !== undefined && v !== null
  4077. }
  4078. function isTrue (v) {
  4079. return v === true
  4080. }
  4081. function isFalse (v) {
  4082. return v === false
  4083. }
  4084. /**
  4085. * Check if value is primitive.
  4086. */
  4087. function isPrimitive (value) {
  4088. return (
  4089. typeof value === 'string' ||
  4090. typeof value === 'number' ||
  4091. // $flow-disable-line
  4092. typeof value === 'symbol' ||
  4093. typeof value === 'boolean'
  4094. )
  4095. }
  4096. /**
  4097. * Quick object check - this is primarily used to tell
  4098. * Objects from primitive values when we know the value
  4099. * is a JSON-compliant type.
  4100. */
  4101. function isObject (obj) {
  4102. return obj !== null && typeof obj === 'object'
  4103. }
  4104. /**
  4105. * Get the raw type string of a value, e.g., [object Object].
  4106. */
  4107. var _toString = Object.prototype.toString;
  4108. function toRawType (value) {
  4109. return _toString.call(value).slice(8, -1)
  4110. }
  4111. /**
  4112. * Strict object type check. Only returns true
  4113. * for plain JavaScript objects.
  4114. */
  4115. function isPlainObject (obj) {
  4116. return _toString.call(obj) === '[object Object]'
  4117. }
  4118. function isRegExp (v) {
  4119. return _toString.call(v) === '[object RegExp]'
  4120. }
  4121. /**
  4122. * Check if val is a valid array index.
  4123. */
  4124. function isValidArrayIndex (val) {
  4125. var n = parseFloat(String(val));
  4126. return n >= 0 && Math.floor(n) === n && isFinite(val)
  4127. }
  4128. function isPromise (val) {
  4129. return (
  4130. isDef(val) &&
  4131. typeof val.then === 'function' &&
  4132. typeof val.catch === 'function'
  4133. )
  4134. }
  4135. /**
  4136. * Convert a value to a string that is actually rendered.
  4137. */
  4138. function toString (val) {
  4139. return val == null
  4140. ? ''
  4141. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  4142. ? JSON.stringify(val, null, 2)
  4143. : String(val)
  4144. }
  4145. /**
  4146. * Convert an input value to a number for persistence.
  4147. * If the conversion fails, return original string.
  4148. */
  4149. function toNumber (val) {
  4150. var n = parseFloat(val);
  4151. return isNaN(n) ? val : n
  4152. }
  4153. /**
  4154. * Make a map and return a function for checking if a key
  4155. * is in that map.
  4156. */
  4157. function makeMap (
  4158. str,
  4159. expectsLowerCase
  4160. ) {
  4161. var map = Object.create(null);
  4162. var list = str.split(',');
  4163. for (var i = 0; i < list.length; i++) {
  4164. map[list[i]] = true;
  4165. }
  4166. return expectsLowerCase
  4167. ? function (val) { return map[val.toLowerCase()]; }
  4168. : function (val) { return map[val]; }
  4169. }
  4170. /**
  4171. * Check if a tag is a built-in tag.
  4172. */
  4173. var isBuiltInTag = makeMap('slot,component', true);
  4174. /**
  4175. * Check if an attribute is a reserved attribute.
  4176. */
  4177. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  4178. /**
  4179. * Remove an item from an array.
  4180. */
  4181. function remove (arr, item) {
  4182. if (arr.length) {
  4183. var index = arr.indexOf(item);
  4184. if (index > -1) {
  4185. return arr.splice(index, 1)
  4186. }
  4187. }
  4188. }
  4189. /**
  4190. * Check whether an object has the property.
  4191. */
  4192. var hasOwnProperty = Object.prototype.hasOwnProperty;
  4193. function hasOwn (obj, key) {
  4194. return hasOwnProperty.call(obj, key)
  4195. }
  4196. /**
  4197. * Create a cached version of a pure function.
  4198. */
  4199. function cached (fn) {
  4200. var cache = Object.create(null);
  4201. return (function cachedFn (str) {
  4202. var hit = cache[str];
  4203. return hit || (cache[str] = fn(str))
  4204. })
  4205. }
  4206. /**
  4207. * Camelize a hyphen-delimited string.
  4208. */
  4209. var camelizeRE = /-(\w)/g;
  4210. var camelize = cached(function (str) {
  4211. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  4212. });
  4213. /**
  4214. * Capitalize a string.
  4215. */
  4216. var capitalize = cached(function (str) {
  4217. return str.charAt(0).toUpperCase() + str.slice(1)
  4218. });
  4219. /**
  4220. * Hyphenate a camelCase string.
  4221. */
  4222. var hyphenateRE = /\B([A-Z])/g;
  4223. var hyphenate = cached(function (str) {
  4224. return str.replace(hyphenateRE, '-$1').toLowerCase()
  4225. });
  4226. /**
  4227. * Simple bind polyfill for environments that do not support it,
  4228. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  4229. * since native bind is now performant enough in most browsers.
  4230. * But removing it would mean breaking code that was able to run in
  4231. * PhantomJS 1.x, so this must be kept for backward compatibility.
  4232. */
  4233. /* istanbul ignore next */
  4234. function polyfillBind (fn, ctx) {
  4235. function boundFn (a) {
  4236. var l = arguments.length;
  4237. return l
  4238. ? l > 1
  4239. ? fn.apply(ctx, arguments)
  4240. : fn.call(ctx, a)
  4241. : fn.call(ctx)
  4242. }
  4243. boundFn._length = fn.length;
  4244. return boundFn
  4245. }
  4246. function nativeBind (fn, ctx) {
  4247. return fn.bind(ctx)
  4248. }
  4249. var bind = Function.prototype.bind
  4250. ? nativeBind
  4251. : polyfillBind;
  4252. /**
  4253. * Convert an Array-like object to a real Array.
  4254. */
  4255. function toArray (list, start) {
  4256. start = start || 0;
  4257. var i = list.length - start;
  4258. var ret = new Array(i);
  4259. while (i--) {
  4260. ret[i] = list[i + start];
  4261. }
  4262. return ret
  4263. }
  4264. /**
  4265. * Mix properties into target object.
  4266. */
  4267. function extend (to, _from) {
  4268. for (var key in _from) {
  4269. to[key] = _from[key];
  4270. }
  4271. return to
  4272. }
  4273. /**
  4274. * Merge an Array of Objects into a single Object.
  4275. */
  4276. function toObject (arr) {
  4277. var res = {};
  4278. for (var i = 0; i < arr.length; i++) {
  4279. if (arr[i]) {
  4280. extend(res, arr[i]);
  4281. }
  4282. }
  4283. return res
  4284. }
  4285. /* eslint-disable no-unused-vars */
  4286. /**
  4287. * Perform no operation.
  4288. * Stubbing args to make Flow happy without leaving useless transpiled code
  4289. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  4290. */
  4291. function noop (a, b, c) {}
  4292. /**
  4293. * Always return false.
  4294. */
  4295. var no = function (a, b, c) { return false; };
  4296. /* eslint-enable no-unused-vars */
  4297. /**
  4298. * Return the same value.
  4299. */
  4300. var identity = function (_) { return _; };
  4301. /**
  4302. * Check if two values are loosely equal - that is,
  4303. * if they are plain objects, do they have the same shape?
  4304. */
  4305. function looseEqual (a, b) {
  4306. if (a === b) { return true }
  4307. var isObjectA = isObject(a);
  4308. var isObjectB = isObject(b);
  4309. if (isObjectA && isObjectB) {
  4310. try {
  4311. var isArrayA = Array.isArray(a);
  4312. var isArrayB = Array.isArray(b);
  4313. if (isArrayA && isArrayB) {
  4314. return a.length === b.length && a.every(function (e, i) {
  4315. return looseEqual(e, b[i])
  4316. })
  4317. } else if (a instanceof Date && b instanceof Date) {
  4318. return a.getTime() === b.getTime()
  4319. } else if (!isArrayA && !isArrayB) {
  4320. var keysA = Object.keys(a);
  4321. var keysB = Object.keys(b);
  4322. return keysA.length === keysB.length && keysA.every(function (key) {
  4323. return looseEqual(a[key], b[key])
  4324. })
  4325. } else {
  4326. /* istanbul ignore next */
  4327. return false
  4328. }
  4329. } catch (e) {
  4330. /* istanbul ignore next */
  4331. return false
  4332. }
  4333. } else if (!isObjectA && !isObjectB) {
  4334. return String(a) === String(b)
  4335. } else {
  4336. return false
  4337. }
  4338. }
  4339. /**
  4340. * Return the first index at which a loosely equal value can be
  4341. * found in the array (if value is a plain object, the array must
  4342. * contain an object of the same shape), or -1 if it is not present.
  4343. */
  4344. function looseIndexOf (arr, val) {
  4345. for (var i = 0; i < arr.length; i++) {
  4346. if (looseEqual(arr[i], val)) { return i }
  4347. }
  4348. return -1
  4349. }
  4350. /**
  4351. * Ensure a function is called only once.
  4352. */
  4353. function once (fn) {
  4354. var called = false;
  4355. return function () {
  4356. if (!called) {
  4357. called = true;
  4358. fn.apply(this, arguments);
  4359. }
  4360. }
  4361. }
  4362. var ASSET_TYPES = [
  4363. 'component',
  4364. 'directive',
  4365. 'filter'
  4366. ];
  4367. var LIFECYCLE_HOOKS = [
  4368. 'beforeCreate',
  4369. 'created',
  4370. 'beforeMount',
  4371. 'mounted',
  4372. 'beforeUpdate',
  4373. 'updated',
  4374. 'beforeDestroy',
  4375. 'destroyed',
  4376. 'activated',
  4377. 'deactivated',
  4378. 'errorCaptured',
  4379. 'serverPrefetch'
  4380. ];
  4381. /* */
  4382. var config = ({
  4383. /**
  4384. * Option merge strategies (used in core/util/options)
  4385. */
  4386. // $flow-disable-line
  4387. optionMergeStrategies: Object.create(null),
  4388. /**
  4389. * Whether to suppress warnings.
  4390. */
  4391. silent: false,
  4392. /**
  4393. * Show production mode tip message on boot?
  4394. */
  4395. productionTip: "development" !== 'production',
  4396. /**
  4397. * Whether to enable devtools
  4398. */
  4399. devtools: "development" !== 'production',
  4400. /**
  4401. * Whether to record perf
  4402. */
  4403. performance: false,
  4404. /**
  4405. * Error handler for watcher errors
  4406. */
  4407. errorHandler: null,
  4408. /**
  4409. * Warn handler for watcher warns
  4410. */
  4411. warnHandler: null,
  4412. /**
  4413. * Ignore certain custom elements
  4414. */
  4415. ignoredElements: [],
  4416. /**
  4417. * Custom user key aliases for v-on
  4418. */
  4419. // $flow-disable-line
  4420. keyCodes: Object.create(null),
  4421. /**
  4422. * Check if a tag is reserved so that it cannot be registered as a
  4423. * component. This is platform-dependent and may be overwritten.
  4424. */
  4425. isReservedTag: no,
  4426. /**
  4427. * Check if an attribute is reserved so that it cannot be used as a component
  4428. * prop. This is platform-dependent and may be overwritten.
  4429. */
  4430. isReservedAttr: no,
  4431. /**
  4432. * Check if a tag is an unknown element.
  4433. * Platform-dependent.
  4434. */
  4435. isUnknownElement: no,
  4436. /**
  4437. * Get the namespace of an element
  4438. */
  4439. getTagNamespace: noop,
  4440. /**
  4441. * Parse the real tag name for the specific platform.
  4442. */
  4443. parsePlatformTagName: identity,
  4444. /**
  4445. * Check if an attribute must be bound using property, e.g. value
  4446. * Platform-dependent.
  4447. */
  4448. mustUseProp: no,
  4449. /**
  4450. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  4451. * This will significantly reduce performance if set to false.
  4452. */
  4453. async: true,
  4454. /**
  4455. * Exposed for legacy reasons
  4456. */
  4457. _lifecycleHooks: LIFECYCLE_HOOKS
  4458. });
  4459. /* */
  4460. /**
  4461. * unicode letters used for parsing html tags, component names and property paths.
  4462. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  4463. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  4464. */
  4465. 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/;
  4466. /**
  4467. * Check if a string starts with $ or _
  4468. */
  4469. function isReserved (str) {
  4470. var c = (str + '').charCodeAt(0);
  4471. return c === 0x24 || c === 0x5F
  4472. }
  4473. /**
  4474. * Define a property.
  4475. */
  4476. function def (obj, key, val, enumerable) {
  4477. Object.defineProperty(obj, key, {
  4478. value: val,
  4479. enumerable: !!enumerable,
  4480. writable: true,
  4481. configurable: true
  4482. });
  4483. }
  4484. /**
  4485. * Parse simple path.
  4486. */
  4487. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  4488. function parsePath (path) {
  4489. if (bailRE.test(path)) {
  4490. return
  4491. }
  4492. var segments = path.split('.');
  4493. return function (obj) {
  4494. for (var i = 0; i < segments.length; i++) {
  4495. if (!obj) { return }
  4496. obj = obj[segments[i]];
  4497. }
  4498. return obj
  4499. }
  4500. }
  4501. /* */
  4502. // can we use __proto__?
  4503. var hasProto = '__proto__' in {};
  4504. // Browser environment sniffing
  4505. var inBrowser = typeof window !== 'undefined';
  4506. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  4507. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  4508. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  4509. var isIE = UA && /msie|trident/.test(UA);
  4510. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  4511. var isEdge = UA && UA.indexOf('edge/') > 0;
  4512. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  4513. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  4514. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  4515. var isPhantomJS = UA && /phantomjs/.test(UA);
  4516. var isFF = UA && UA.match(/firefox\/(\d+)/);
  4517. // Firefox has a "watch" function on Object.prototype...
  4518. var nativeWatch = ({}).watch;
  4519. if (inBrowser) {
  4520. try {
  4521. var opts = {};
  4522. Object.defineProperty(opts, 'passive', ({
  4523. get: function get () {
  4524. }
  4525. })); // https://github.com/facebook/flow/issues/285
  4526. window.addEventListener('test-passive', null, opts);
  4527. } catch (e) {}
  4528. }
  4529. // this needs to be lazy-evaled because vue may be required before
  4530. // vue-server-renderer can set VUE_ENV
  4531. var _isServer;
  4532. var isServerRendering = function () {
  4533. if (_isServer === undefined) {
  4534. /* istanbul ignore if */
  4535. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  4536. // detect presence of vue-server-renderer and avoid
  4537. // Webpack shimming the process
  4538. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  4539. } else {
  4540. _isServer = false;
  4541. }
  4542. }
  4543. return _isServer
  4544. };
  4545. // detect devtools
  4546. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  4547. /* istanbul ignore next */
  4548. function isNative (Ctor) {
  4549. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  4550. }
  4551. var hasSymbol =
  4552. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  4553. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  4554. var _Set;
  4555. /* istanbul ignore if */ // $flow-disable-line
  4556. if (typeof Set !== 'undefined' && isNative(Set)) {
  4557. // use native Set when available.
  4558. _Set = Set;
  4559. } else {
  4560. // a non-standard Set polyfill that only works with primitive keys.
  4561. _Set = /*@__PURE__*/(function () {
  4562. function Set () {
  4563. this.set = Object.create(null);
  4564. }
  4565. Set.prototype.has = function has (key) {
  4566. return this.set[key] === true
  4567. };
  4568. Set.prototype.add = function add (key) {
  4569. this.set[key] = true;
  4570. };
  4571. Set.prototype.clear = function clear () {
  4572. this.set = Object.create(null);
  4573. };
  4574. return Set;
  4575. }());
  4576. }
  4577. /* */
  4578. var warn = noop;
  4579. var tip = noop;
  4580. var generateComponentTrace = (noop); // work around flow check
  4581. var formatComponentName = (noop);
  4582. if (true) {
  4583. var hasConsole = typeof console !== 'undefined';
  4584. var classifyRE = /(?:^|[-_])(\w)/g;
  4585. var classify = function (str) { return str
  4586. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  4587. .replace(/[-_]/g, ''); };
  4588. warn = function (msg, vm) {
  4589. var trace = vm ? generateComponentTrace(vm) : '';
  4590. if (config.warnHandler) {
  4591. config.warnHandler.call(null, msg, vm, trace);
  4592. } else if (hasConsole && (!config.silent)) {
  4593. console.error(("[Vue warn]: " + msg + trace));
  4594. }
  4595. };
  4596. tip = function (msg, vm) {
  4597. if (hasConsole && (!config.silent)) {
  4598. console.warn("[Vue tip]: " + msg + (
  4599. vm ? generateComponentTrace(vm) : ''
  4600. ));
  4601. }
  4602. };
  4603. formatComponentName = function (vm, includeFile) {
  4604. if (vm.$root === vm) {
  4605. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  4606. return ('') + vm.$options.__file
  4607. }
  4608. return '<Root>'
  4609. }
  4610. var options = typeof vm === 'function' && vm.cid != null
  4611. ? vm.options
  4612. : vm._isVue
  4613. ? vm.$options || vm.constructor.options
  4614. : vm;
  4615. var name = options.name || options._componentTag;
  4616. var file = options.__file;
  4617. if (!name && file) {
  4618. var match = file.match(/([^/\\]+)\.vue$/);
  4619. name = match && match[1];
  4620. }
  4621. return (
  4622. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  4623. (file && includeFile !== false ? (" at " + file) : '')
  4624. )
  4625. };
  4626. var repeat = function (str, n) {
  4627. var res = '';
  4628. while (n) {
  4629. if (n % 2 === 1) { res += str; }
  4630. if (n > 1) { str += str; }
  4631. n >>= 1;
  4632. }
  4633. return res
  4634. };
  4635. generateComponentTrace = function (vm) {
  4636. if (vm._isVue && vm.$parent) {
  4637. var tree = [];
  4638. var currentRecursiveSequence = 0;
  4639. while (vm && vm.$options.name !== 'PageBody') {
  4640. if (tree.length > 0) {
  4641. var last = tree[tree.length - 1];
  4642. if (last.constructor === vm.constructor) {
  4643. currentRecursiveSequence++;
  4644. vm = vm.$parent;
  4645. continue
  4646. } else if (currentRecursiveSequence > 0) {
  4647. tree[tree.length - 1] = [last, currentRecursiveSequence];
  4648. currentRecursiveSequence = 0;
  4649. }
  4650. }
  4651. !vm.$options.isReserved && tree.push(vm);
  4652. vm = vm.$parent;
  4653. }
  4654. return '\n\nfound in\n\n' + tree
  4655. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  4656. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  4657. : formatComponentName(vm))); })
  4658. .join('\n')
  4659. } else {
  4660. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  4661. }
  4662. };
  4663. }
  4664. /* */
  4665. var uid = 0;
  4666. /**
  4667. * A dep is an observable that can have multiple
  4668. * directives subscribing to it.
  4669. */
  4670. var Dep = function Dep () {
  4671. this.id = uid++;
  4672. this.subs = [];
  4673. };
  4674. Dep.prototype.addSub = function addSub (sub) {
  4675. this.subs.push(sub);
  4676. };
  4677. Dep.prototype.removeSub = function removeSub (sub) {
  4678. remove(this.subs, sub);
  4679. };
  4680. Dep.prototype.depend = function depend () {
  4681. if (Dep.SharedObject.target) {
  4682. Dep.SharedObject.target.addDep(this);
  4683. }
  4684. };
  4685. Dep.prototype.notify = function notify () {
  4686. // stabilize the subscriber list first
  4687. var subs = this.subs.slice();
  4688. if ( true && !config.async) {
  4689. // subs aren't sorted in scheduler if not running async
  4690. // we need to sort them now to make sure they fire in correct
  4691. // order
  4692. subs.sort(function (a, b) { return a.id - b.id; });
  4693. }
  4694. for (var i = 0, l = subs.length; i < l; i++) {
  4695. subs[i].update();
  4696. }
  4697. };
  4698. // The current target watcher being evaluated.
  4699. // This is globally unique because only one watcher
  4700. // can be evaluated at a time.
  4701. // fixed by xxxxxx (nvue shared vuex)
  4702. /* eslint-disable no-undef */
  4703. Dep.SharedObject = {};
  4704. Dep.SharedObject.target = null;
  4705. Dep.SharedObject.targetStack = [];
  4706. function pushTarget (target) {
  4707. Dep.SharedObject.targetStack.push(target);
  4708. Dep.SharedObject.target = target;
  4709. Dep.target = target;
  4710. }
  4711. function popTarget () {
  4712. Dep.SharedObject.targetStack.pop();
  4713. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  4714. Dep.target = Dep.SharedObject.target;
  4715. }
  4716. /* */
  4717. var VNode = function VNode (
  4718. tag,
  4719. data,
  4720. children,
  4721. text,
  4722. elm,
  4723. context,
  4724. componentOptions,
  4725. asyncFactory
  4726. ) {
  4727. this.tag = tag;
  4728. this.data = data;
  4729. this.children = children;
  4730. this.text = text;
  4731. this.elm = elm;
  4732. this.ns = undefined;
  4733. this.context = context;
  4734. this.fnContext = undefined;
  4735. this.fnOptions = undefined;
  4736. this.fnScopeId = undefined;
  4737. this.key = data && data.key;
  4738. this.componentOptions = componentOptions;
  4739. this.componentInstance = undefined;
  4740. this.parent = undefined;
  4741. this.raw = false;
  4742. this.isStatic = false;
  4743. this.isRootInsert = true;
  4744. this.isComment = false;
  4745. this.isCloned = false;
  4746. this.isOnce = false;
  4747. this.asyncFactory = asyncFactory;
  4748. this.asyncMeta = undefined;
  4749. this.isAsyncPlaceholder = false;
  4750. };
  4751. var prototypeAccessors = { child: { configurable: true } };
  4752. // DEPRECATED: alias for componentInstance for backwards compat.
  4753. /* istanbul ignore next */
  4754. prototypeAccessors.child.get = function () {
  4755. return this.componentInstance
  4756. };
  4757. Object.defineProperties( VNode.prototype, prototypeAccessors );
  4758. var createEmptyVNode = function (text) {
  4759. if ( text === void 0 ) text = '';
  4760. var node = new VNode();
  4761. node.text = text;
  4762. node.isComment = true;
  4763. return node
  4764. };
  4765. function createTextVNode (val) {
  4766. return new VNode(undefined, undefined, undefined, String(val))
  4767. }
  4768. // optimized shallow clone
  4769. // used for static nodes and slot nodes because they may be reused across
  4770. // multiple renders, cloning them avoids errors when DOM manipulations rely
  4771. // on their elm reference.
  4772. function cloneVNode (vnode) {
  4773. var cloned = new VNode(
  4774. vnode.tag,
  4775. vnode.data,
  4776. // #7975
  4777. // clone children array to avoid mutating original in case of cloning
  4778. // a child.
  4779. vnode.children && vnode.children.slice(),
  4780. vnode.text,
  4781. vnode.elm,
  4782. vnode.context,
  4783. vnode.componentOptions,
  4784. vnode.asyncFactory
  4785. );
  4786. cloned.ns = vnode.ns;
  4787. cloned.isStatic = vnode.isStatic;
  4788. cloned.key = vnode.key;
  4789. cloned.isComment = vnode.isComment;
  4790. cloned.fnContext = vnode.fnContext;
  4791. cloned.fnOptions = vnode.fnOptions;
  4792. cloned.fnScopeId = vnode.fnScopeId;
  4793. cloned.asyncMeta = vnode.asyncMeta;
  4794. cloned.isCloned = true;
  4795. return cloned
  4796. }
  4797. /*
  4798. * not type checking this file because flow doesn't play well with
  4799. * dynamically accessing methods on Array prototype
  4800. */
  4801. var arrayProto = Array.prototype;
  4802. var arrayMethods = Object.create(arrayProto);
  4803. var methodsToPatch = [
  4804. 'push',
  4805. 'pop',
  4806. 'shift',
  4807. 'unshift',
  4808. 'splice',
  4809. 'sort',
  4810. 'reverse'
  4811. ];
  4812. /**
  4813. * Intercept mutating methods and emit events
  4814. */
  4815. methodsToPatch.forEach(function (method) {
  4816. // cache original method
  4817. var original = arrayProto[method];
  4818. def(arrayMethods, method, function mutator () {
  4819. var args = [], len = arguments.length;
  4820. while ( len-- ) args[ len ] = arguments[ len ];
  4821. var result = original.apply(this, args);
  4822. var ob = this.__ob__;
  4823. var inserted;
  4824. switch (method) {
  4825. case 'push':
  4826. case 'unshift':
  4827. inserted = args;
  4828. break
  4829. case 'splice':
  4830. inserted = args.slice(2);
  4831. break
  4832. }
  4833. if (inserted) { ob.observeArray(inserted); }
  4834. // notify change
  4835. ob.dep.notify();
  4836. return result
  4837. });
  4838. });
  4839. /* */
  4840. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  4841. /**
  4842. * In some cases we may want to disable observation inside a component's
  4843. * update computation.
  4844. */
  4845. var shouldObserve = true;
  4846. function toggleObserving (value) {
  4847. shouldObserve = value;
  4848. }
  4849. /**
  4850. * Observer class that is attached to each observed
  4851. * object. Once attached, the observer converts the target
  4852. * object's property keys into getter/setters that
  4853. * collect dependencies and dispatch updates.
  4854. */
  4855. var Observer = function Observer (value) {
  4856. this.value = value;
  4857. this.dep = new Dep();
  4858. this.vmCount = 0;
  4859. def(value, '__ob__', this);
  4860. if (Array.isArray(value)) {
  4861. if (hasProto) {
  4862. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  4863. if(value.push !== value.__proto__.push){
  4864. copyAugment(value, arrayMethods, arrayKeys);
  4865. } else {
  4866. protoAugment(value, arrayMethods);
  4867. }
  4868. }
  4869. } else {
  4870. copyAugment(value, arrayMethods, arrayKeys);
  4871. }
  4872. this.observeArray(value);
  4873. } else {
  4874. this.walk(value);
  4875. }
  4876. };
  4877. /**
  4878. * Walk through all properties and convert them into
  4879. * getter/setters. This method should only be called when
  4880. * value type is Object.
  4881. */
  4882. Observer.prototype.walk = function walk (obj) {
  4883. var keys = Object.keys(obj);
  4884. for (var i = 0; i < keys.length; i++) {
  4885. defineReactive$$1(obj, keys[i]);
  4886. }
  4887. };
  4888. /**
  4889. * Observe a list of Array items.
  4890. */
  4891. Observer.prototype.observeArray = function observeArray (items) {
  4892. for (var i = 0, l = items.length; i < l; i++) {
  4893. observe(items[i]);
  4894. }
  4895. };
  4896. // helpers
  4897. /**
  4898. * Augment a target Object or Array by intercepting
  4899. * the prototype chain using __proto__
  4900. */
  4901. function protoAugment (target, src) {
  4902. /* eslint-disable no-proto */
  4903. target.__proto__ = src;
  4904. /* eslint-enable no-proto */
  4905. }
  4906. /**
  4907. * Augment a target Object or Array by defining
  4908. * hidden properties.
  4909. */
  4910. /* istanbul ignore next */
  4911. function copyAugment (target, src, keys) {
  4912. for (var i = 0, l = keys.length; i < l; i++) {
  4913. var key = keys[i];
  4914. def(target, key, src[key]);
  4915. }
  4916. }
  4917. /**
  4918. * Attempt to create an observer instance for a value,
  4919. * returns the new observer if successfully observed,
  4920. * or the existing observer if the value already has one.
  4921. */
  4922. function observe (value, asRootData) {
  4923. if (!isObject(value) || value instanceof VNode) {
  4924. return
  4925. }
  4926. var ob;
  4927. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  4928. ob = value.__ob__;
  4929. } else if (
  4930. shouldObserve &&
  4931. !isServerRendering() &&
  4932. (Array.isArray(value) || isPlainObject(value)) &&
  4933. Object.isExtensible(value) &&
  4934. !value._isVue &&
  4935. !value.__v_isMPComponent
  4936. ) {
  4937. ob = new Observer(value);
  4938. }
  4939. if (asRootData && ob) {
  4940. ob.vmCount++;
  4941. }
  4942. return ob
  4943. }
  4944. /**
  4945. * Define a reactive property on an Object.
  4946. */
  4947. function defineReactive$$1 (
  4948. obj,
  4949. key,
  4950. val,
  4951. customSetter,
  4952. shallow
  4953. ) {
  4954. var dep = new Dep();
  4955. var property = Object.getOwnPropertyDescriptor(obj, key);
  4956. if (property && property.configurable === false) {
  4957. return
  4958. }
  4959. // cater for pre-defined getter/setters
  4960. var getter = property && property.get;
  4961. var setter = property && property.set;
  4962. if ((!getter || setter) && arguments.length === 2) {
  4963. val = obj[key];
  4964. }
  4965. var childOb = !shallow && observe(val);
  4966. Object.defineProperty(obj, key, {
  4967. enumerable: true,
  4968. configurable: true,
  4969. get: function reactiveGetter () {
  4970. var value = getter ? getter.call(obj) : val;
  4971. if (Dep.SharedObject.target) { // fixed by xxxxxx
  4972. dep.depend();
  4973. if (childOb) {
  4974. childOb.dep.depend();
  4975. if (Array.isArray(value)) {
  4976. dependArray(value);
  4977. }
  4978. }
  4979. }
  4980. return value
  4981. },
  4982. set: function reactiveSetter (newVal) {
  4983. var value = getter ? getter.call(obj) : val;
  4984. /* eslint-disable no-self-compare */
  4985. if (newVal === value || (newVal !== newVal && value !== value)) {
  4986. return
  4987. }
  4988. /* eslint-enable no-self-compare */
  4989. if ( true && customSetter) {
  4990. customSetter();
  4991. }
  4992. // #7981: for accessor properties without setter
  4993. if (getter && !setter) { return }
  4994. if (setter) {
  4995. setter.call(obj, newVal);
  4996. } else {
  4997. val = newVal;
  4998. }
  4999. childOb = !shallow && observe(newVal);
  5000. dep.notify();
  5001. }
  5002. });
  5003. }
  5004. /**
  5005. * Set a property on an object. Adds the new property and
  5006. * triggers change notification if the property doesn't
  5007. * already exist.
  5008. */
  5009. function set (target, key, val) {
  5010. if ( true &&
  5011. (isUndef(target) || isPrimitive(target))
  5012. ) {
  5013. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  5014. }
  5015. if (Array.isArray(target) && isValidArrayIndex(key)) {
  5016. target.length = Math.max(target.length, key);
  5017. target.splice(key, 1, val);
  5018. return val
  5019. }
  5020. if (key in target && !(key in Object.prototype)) {
  5021. target[key] = val;
  5022. return val
  5023. }
  5024. var ob = (target).__ob__;
  5025. if (target._isVue || (ob && ob.vmCount)) {
  5026. true && warn(
  5027. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  5028. 'at runtime - declare it upfront in the data option.'
  5029. );
  5030. return val
  5031. }
  5032. if (!ob) {
  5033. target[key] = val;
  5034. return val
  5035. }
  5036. defineReactive$$1(ob.value, key, val);
  5037. ob.dep.notify();
  5038. return val
  5039. }
  5040. /**
  5041. * Delete a property and trigger change if necessary.
  5042. */
  5043. function del (target, key) {
  5044. if ( true &&
  5045. (isUndef(target) || isPrimitive(target))
  5046. ) {
  5047. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  5048. }
  5049. if (Array.isArray(target) && isValidArrayIndex(key)) {
  5050. target.splice(key, 1);
  5051. return
  5052. }
  5053. var ob = (target).__ob__;
  5054. if (target._isVue || (ob && ob.vmCount)) {
  5055. true && warn(
  5056. 'Avoid deleting properties on a Vue instance or its root $data ' +
  5057. '- just set it to null.'
  5058. );
  5059. return
  5060. }
  5061. if (!hasOwn(target, key)) {
  5062. return
  5063. }
  5064. delete target[key];
  5065. if (!ob) {
  5066. return
  5067. }
  5068. ob.dep.notify();
  5069. }
  5070. /**
  5071. * Collect dependencies on array elements when the array is touched, since
  5072. * we cannot intercept array element access like property getters.
  5073. */
  5074. function dependArray (value) {
  5075. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  5076. e = value[i];
  5077. e && e.__ob__ && e.__ob__.dep.depend();
  5078. if (Array.isArray(e)) {
  5079. dependArray(e);
  5080. }
  5081. }
  5082. }
  5083. /* */
  5084. /**
  5085. * Option overwriting strategies are functions that handle
  5086. * how to merge a parent option value and a child option
  5087. * value into the final value.
  5088. */
  5089. var strats = config.optionMergeStrategies;
  5090. /**
  5091. * Options with restrictions
  5092. */
  5093. if (true) {
  5094. strats.el = strats.propsData = function (parent, child, vm, key) {
  5095. if (!vm) {
  5096. warn(
  5097. "option \"" + key + "\" can only be used during instance " +
  5098. 'creation with the `new` keyword.'
  5099. );
  5100. }
  5101. return defaultStrat(parent, child)
  5102. };
  5103. }
  5104. /**
  5105. * Helper that recursively merges two data objects together.
  5106. */
  5107. function mergeData (to, from) {
  5108. if (!from) { return to }
  5109. var key, toVal, fromVal;
  5110. var keys = hasSymbol
  5111. ? Reflect.ownKeys(from)
  5112. : Object.keys(from);
  5113. for (var i = 0; i < keys.length; i++) {
  5114. key = keys[i];
  5115. // in case the object is already observed...
  5116. if (key === '__ob__') { continue }
  5117. toVal = to[key];
  5118. fromVal = from[key];
  5119. if (!hasOwn(to, key)) {
  5120. set(to, key, fromVal);
  5121. } else if (
  5122. toVal !== fromVal &&
  5123. isPlainObject(toVal) &&
  5124. isPlainObject(fromVal)
  5125. ) {
  5126. mergeData(toVal, fromVal);
  5127. }
  5128. }
  5129. return to
  5130. }
  5131. /**
  5132. * Data
  5133. */
  5134. function mergeDataOrFn (
  5135. parentVal,
  5136. childVal,
  5137. vm
  5138. ) {
  5139. if (!vm) {
  5140. // in a Vue.extend merge, both should be functions
  5141. if (!childVal) {
  5142. return parentVal
  5143. }
  5144. if (!parentVal) {
  5145. return childVal
  5146. }
  5147. // when parentVal & childVal are both present,
  5148. // we need to return a function that returns the
  5149. // merged result of both functions... no need to
  5150. // check if parentVal is a function here because
  5151. // it has to be a function to pass previous merges.
  5152. return function mergedDataFn () {
  5153. return mergeData(
  5154. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  5155. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  5156. )
  5157. }
  5158. } else {
  5159. return function mergedInstanceDataFn () {
  5160. // instance merge
  5161. var instanceData = typeof childVal === 'function'
  5162. ? childVal.call(vm, vm)
  5163. : childVal;
  5164. var defaultData = typeof parentVal === 'function'
  5165. ? parentVal.call(vm, vm)
  5166. : parentVal;
  5167. if (instanceData) {
  5168. return mergeData(instanceData, defaultData)
  5169. } else {
  5170. return defaultData
  5171. }
  5172. }
  5173. }
  5174. }
  5175. strats.data = function (
  5176. parentVal,
  5177. childVal,
  5178. vm
  5179. ) {
  5180. if (!vm) {
  5181. if (childVal && typeof childVal !== 'function') {
  5182. true && warn(
  5183. 'The "data" option should be a function ' +
  5184. 'that returns a per-instance value in component ' +
  5185. 'definitions.',
  5186. vm
  5187. );
  5188. return parentVal
  5189. }
  5190. return mergeDataOrFn(parentVal, childVal)
  5191. }
  5192. return mergeDataOrFn(parentVal, childVal, vm)
  5193. };
  5194. /**
  5195. * Hooks and props are merged as arrays.
  5196. */
  5197. function mergeHook (
  5198. parentVal,
  5199. childVal
  5200. ) {
  5201. var res = childVal
  5202. ? parentVal
  5203. ? parentVal.concat(childVal)
  5204. : Array.isArray(childVal)
  5205. ? childVal
  5206. : [childVal]
  5207. : parentVal;
  5208. return res
  5209. ? dedupeHooks(res)
  5210. : res
  5211. }
  5212. function dedupeHooks (hooks) {
  5213. var res = [];
  5214. for (var i = 0; i < hooks.length; i++) {
  5215. if (res.indexOf(hooks[i]) === -1) {
  5216. res.push(hooks[i]);
  5217. }
  5218. }
  5219. return res
  5220. }
  5221. LIFECYCLE_HOOKS.forEach(function (hook) {
  5222. strats[hook] = mergeHook;
  5223. });
  5224. /**
  5225. * Assets
  5226. *
  5227. * When a vm is present (instance creation), we need to do
  5228. * a three-way merge between constructor options, instance
  5229. * options and parent options.
  5230. */
  5231. function mergeAssets (
  5232. parentVal,
  5233. childVal,
  5234. vm,
  5235. key
  5236. ) {
  5237. var res = Object.create(parentVal || null);
  5238. if (childVal) {
  5239. true && assertObjectType(key, childVal, vm);
  5240. return extend(res, childVal)
  5241. } else {
  5242. return res
  5243. }
  5244. }
  5245. ASSET_TYPES.forEach(function (type) {
  5246. strats[type + 's'] = mergeAssets;
  5247. });
  5248. /**
  5249. * Watchers.
  5250. *
  5251. * Watchers hashes should not overwrite one
  5252. * another, so we merge them as arrays.
  5253. */
  5254. strats.watch = function (
  5255. parentVal,
  5256. childVal,
  5257. vm,
  5258. key
  5259. ) {
  5260. // work around Firefox's Object.prototype.watch...
  5261. if (parentVal === nativeWatch) { parentVal = undefined; }
  5262. if (childVal === nativeWatch) { childVal = undefined; }
  5263. /* istanbul ignore if */
  5264. if (!childVal) { return Object.create(parentVal || null) }
  5265. if (true) {
  5266. assertObjectType(key, childVal, vm);
  5267. }
  5268. if (!parentVal) { return childVal }
  5269. var ret = {};
  5270. extend(ret, parentVal);
  5271. for (var key$1 in childVal) {
  5272. var parent = ret[key$1];
  5273. var child = childVal[key$1];
  5274. if (parent && !Array.isArray(parent)) {
  5275. parent = [parent];
  5276. }
  5277. ret[key$1] = parent
  5278. ? parent.concat(child)
  5279. : Array.isArray(child) ? child : [child];
  5280. }
  5281. return ret
  5282. };
  5283. /**
  5284. * Other object hashes.
  5285. */
  5286. strats.props =
  5287. strats.methods =
  5288. strats.inject =
  5289. strats.computed = function (
  5290. parentVal,
  5291. childVal,
  5292. vm,
  5293. key
  5294. ) {
  5295. if (childVal && "development" !== 'production') {
  5296. assertObjectType(key, childVal, vm);
  5297. }
  5298. if (!parentVal) { return childVal }
  5299. var ret = Object.create(null);
  5300. extend(ret, parentVal);
  5301. if (childVal) { extend(ret, childVal); }
  5302. return ret
  5303. };
  5304. strats.provide = mergeDataOrFn;
  5305. /**
  5306. * Default strategy.
  5307. */
  5308. var defaultStrat = function (parentVal, childVal) {
  5309. return childVal === undefined
  5310. ? parentVal
  5311. : childVal
  5312. };
  5313. /**
  5314. * Validate component names
  5315. */
  5316. function checkComponents (options) {
  5317. for (var key in options.components) {
  5318. validateComponentName(key);
  5319. }
  5320. }
  5321. function validateComponentName (name) {
  5322. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  5323. warn(
  5324. 'Invalid component name: "' + name + '". Component names ' +
  5325. 'should conform to valid custom element name in html5 specification.'
  5326. );
  5327. }
  5328. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  5329. warn(
  5330. 'Do not use built-in or reserved HTML elements as component ' +
  5331. 'id: ' + name
  5332. );
  5333. }
  5334. }
  5335. /**
  5336. * Ensure all props option syntax are normalized into the
  5337. * Object-based format.
  5338. */
  5339. function normalizeProps (options, vm) {
  5340. var props = options.props;
  5341. if (!props) { return }
  5342. var res = {};
  5343. var i, val, name;
  5344. if (Array.isArray(props)) {
  5345. i = props.length;
  5346. while (i--) {
  5347. val = props[i];
  5348. if (typeof val === 'string') {
  5349. name = camelize(val);
  5350. res[name] = { type: null };
  5351. } else if (true) {
  5352. warn('props must be strings when using array syntax.');
  5353. }
  5354. }
  5355. } else if (isPlainObject(props)) {
  5356. for (var key in props) {
  5357. val = props[key];
  5358. name = camelize(key);
  5359. res[name] = isPlainObject(val)
  5360. ? val
  5361. : { type: val };
  5362. }
  5363. } else if (true) {
  5364. warn(
  5365. "Invalid value for option \"props\": expected an Array or an Object, " +
  5366. "but got " + (toRawType(props)) + ".",
  5367. vm
  5368. );
  5369. }
  5370. options.props = res;
  5371. }
  5372. /**
  5373. * Normalize all injections into Object-based format
  5374. */
  5375. function normalizeInject (options, vm) {
  5376. var inject = options.inject;
  5377. if (!inject) { return }
  5378. var normalized = options.inject = {};
  5379. if (Array.isArray(inject)) {
  5380. for (var i = 0; i < inject.length; i++) {
  5381. normalized[inject[i]] = { from: inject[i] };
  5382. }
  5383. } else if (isPlainObject(inject)) {
  5384. for (var key in inject) {
  5385. var val = inject[key];
  5386. normalized[key] = isPlainObject(val)
  5387. ? extend({ from: key }, val)
  5388. : { from: val };
  5389. }
  5390. } else if (true) {
  5391. warn(
  5392. "Invalid value for option \"inject\": expected an Array or an Object, " +
  5393. "but got " + (toRawType(inject)) + ".",
  5394. vm
  5395. );
  5396. }
  5397. }
  5398. /**
  5399. * Normalize raw function directives into object format.
  5400. */
  5401. function normalizeDirectives (options) {
  5402. var dirs = options.directives;
  5403. if (dirs) {
  5404. for (var key in dirs) {
  5405. var def$$1 = dirs[key];
  5406. if (typeof def$$1 === 'function') {
  5407. dirs[key] = { bind: def$$1, update: def$$1 };
  5408. }
  5409. }
  5410. }
  5411. }
  5412. function assertObjectType (name, value, vm) {
  5413. if (!isPlainObject(value)) {
  5414. warn(
  5415. "Invalid value for option \"" + name + "\": expected an Object, " +
  5416. "but got " + (toRawType(value)) + ".",
  5417. vm
  5418. );
  5419. }
  5420. }
  5421. /**
  5422. * Merge two option objects into a new one.
  5423. * Core utility used in both instantiation and inheritance.
  5424. */
  5425. function mergeOptions (
  5426. parent,
  5427. child,
  5428. vm
  5429. ) {
  5430. if (true) {
  5431. checkComponents(child);
  5432. }
  5433. if (typeof child === 'function') {
  5434. child = child.options;
  5435. }
  5436. normalizeProps(child, vm);
  5437. normalizeInject(child, vm);
  5438. normalizeDirectives(child);
  5439. // Apply extends and mixins on the child options,
  5440. // but only if it is a raw options object that isn't
  5441. // the result of another mergeOptions call.
  5442. // Only merged options has the _base property.
  5443. if (!child._base) {
  5444. if (child.extends) {
  5445. parent = mergeOptions(parent, child.extends, vm);
  5446. }
  5447. if (child.mixins) {
  5448. for (var i = 0, l = child.mixins.length; i < l; i++) {
  5449. parent = mergeOptions(parent, child.mixins[i], vm);
  5450. }
  5451. }
  5452. }
  5453. var options = {};
  5454. var key;
  5455. for (key in parent) {
  5456. mergeField(key);
  5457. }
  5458. for (key in child) {
  5459. if (!hasOwn(parent, key)) {
  5460. mergeField(key);
  5461. }
  5462. }
  5463. function mergeField (key) {
  5464. var strat = strats[key] || defaultStrat;
  5465. options[key] = strat(parent[key], child[key], vm, key);
  5466. }
  5467. return options
  5468. }
  5469. /**
  5470. * Resolve an asset.
  5471. * This function is used because child instances need access
  5472. * to assets defined in its ancestor chain.
  5473. */
  5474. function resolveAsset (
  5475. options,
  5476. type,
  5477. id,
  5478. warnMissing
  5479. ) {
  5480. /* istanbul ignore if */
  5481. if (typeof id !== 'string') {
  5482. return
  5483. }
  5484. var assets = options[type];
  5485. // check local registration variations first
  5486. if (hasOwn(assets, id)) { return assets[id] }
  5487. var camelizedId = camelize(id);
  5488. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  5489. var PascalCaseId = capitalize(camelizedId);
  5490. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  5491. // fallback to prototype chain
  5492. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  5493. if ( true && warnMissing && !res) {
  5494. warn(
  5495. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  5496. options
  5497. );
  5498. }
  5499. return res
  5500. }
  5501. /* */
  5502. function validateProp (
  5503. key,
  5504. propOptions,
  5505. propsData,
  5506. vm
  5507. ) {
  5508. var prop = propOptions[key];
  5509. var absent = !hasOwn(propsData, key);
  5510. var value = propsData[key];
  5511. // boolean casting
  5512. var booleanIndex = getTypeIndex(Boolean, prop.type);
  5513. if (booleanIndex > -1) {
  5514. if (absent && !hasOwn(prop, 'default')) {
  5515. value = false;
  5516. } else if (value === '' || value === hyphenate(key)) {
  5517. // only cast empty string / same name to boolean if
  5518. // boolean has higher priority
  5519. var stringIndex = getTypeIndex(String, prop.type);
  5520. if (stringIndex < 0 || booleanIndex < stringIndex) {
  5521. value = true;
  5522. }
  5523. }
  5524. }
  5525. // check default value
  5526. if (value === undefined) {
  5527. value = getPropDefaultValue(vm, prop, key);
  5528. // since the default value is a fresh copy,
  5529. // make sure to observe it.
  5530. var prevShouldObserve = shouldObserve;
  5531. toggleObserving(true);
  5532. observe(value);
  5533. toggleObserving(prevShouldObserve);
  5534. }
  5535. if (
  5536. true
  5537. ) {
  5538. assertProp(prop, key, value, vm, absent);
  5539. }
  5540. return value
  5541. }
  5542. /**
  5543. * Get the default value of a prop.
  5544. */
  5545. function getPropDefaultValue (vm, prop, key) {
  5546. // no default, return undefined
  5547. if (!hasOwn(prop, 'default')) {
  5548. return undefined
  5549. }
  5550. var def = prop.default;
  5551. // warn against non-factory defaults for Object & Array
  5552. if ( true && isObject(def)) {
  5553. warn(
  5554. 'Invalid default value for prop "' + key + '": ' +
  5555. 'Props with type Object/Array must use a factory function ' +
  5556. 'to return the default value.',
  5557. vm
  5558. );
  5559. }
  5560. // the raw prop value was also undefined from previous render,
  5561. // return previous default value to avoid unnecessary watcher trigger
  5562. if (vm && vm.$options.propsData &&
  5563. vm.$options.propsData[key] === undefined &&
  5564. vm._props[key] !== undefined
  5565. ) {
  5566. return vm._props[key]
  5567. }
  5568. // call factory function for non-Function types
  5569. // a value is Function if its prototype is function even across different execution context
  5570. return typeof def === 'function' && getType(prop.type) !== 'Function'
  5571. ? def.call(vm)
  5572. : def
  5573. }
  5574. /**
  5575. * Assert whether a prop is valid.
  5576. */
  5577. function assertProp (
  5578. prop,
  5579. name,
  5580. value,
  5581. vm,
  5582. absent
  5583. ) {
  5584. if (prop.required && absent) {
  5585. warn(
  5586. 'Missing required prop: "' + name + '"',
  5587. vm
  5588. );
  5589. return
  5590. }
  5591. if (value == null && !prop.required) {
  5592. return
  5593. }
  5594. var type = prop.type;
  5595. var valid = !type || type === true;
  5596. var expectedTypes = [];
  5597. if (type) {
  5598. if (!Array.isArray(type)) {
  5599. type = [type];
  5600. }
  5601. for (var i = 0; i < type.length && !valid; i++) {
  5602. var assertedType = assertType(value, type[i]);
  5603. expectedTypes.push(assertedType.expectedType || '');
  5604. valid = assertedType.valid;
  5605. }
  5606. }
  5607. if (!valid) {
  5608. warn(
  5609. getInvalidTypeMessage(name, value, expectedTypes),
  5610. vm
  5611. );
  5612. return
  5613. }
  5614. var validator = prop.validator;
  5615. if (validator) {
  5616. if (!validator(value)) {
  5617. warn(
  5618. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  5619. vm
  5620. );
  5621. }
  5622. }
  5623. }
  5624. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  5625. function assertType (value, type) {
  5626. var valid;
  5627. var expectedType = getType(type);
  5628. if (simpleCheckRE.test(expectedType)) {
  5629. var t = typeof value;
  5630. valid = t === expectedType.toLowerCase();
  5631. // for primitive wrapper objects
  5632. if (!valid && t === 'object') {
  5633. valid = value instanceof type;
  5634. }
  5635. } else if (expectedType === 'Object') {
  5636. valid = isPlainObject(value);
  5637. } else if (expectedType === 'Array') {
  5638. valid = Array.isArray(value);
  5639. } else {
  5640. valid = value instanceof type;
  5641. }
  5642. return {
  5643. valid: valid,
  5644. expectedType: expectedType
  5645. }
  5646. }
  5647. /**
  5648. * Use function string name to check built-in types,
  5649. * because a simple equality check will fail when running
  5650. * across different vms / iframes.
  5651. */
  5652. function getType (fn) {
  5653. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  5654. return match ? match[1] : ''
  5655. }
  5656. function isSameType (a, b) {
  5657. return getType(a) === getType(b)
  5658. }
  5659. function getTypeIndex (type, expectedTypes) {
  5660. if (!Array.isArray(expectedTypes)) {
  5661. return isSameType(expectedTypes, type) ? 0 : -1
  5662. }
  5663. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  5664. if (isSameType(expectedTypes[i], type)) {
  5665. return i
  5666. }
  5667. }
  5668. return -1
  5669. }
  5670. function getInvalidTypeMessage (name, value, expectedTypes) {
  5671. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  5672. " Expected " + (expectedTypes.map(capitalize).join(', '));
  5673. var expectedType = expectedTypes[0];
  5674. var receivedType = toRawType(value);
  5675. var expectedValue = styleValue(value, expectedType);
  5676. var receivedValue = styleValue(value, receivedType);
  5677. // check if we need to specify expected value
  5678. if (expectedTypes.length === 1 &&
  5679. isExplicable(expectedType) &&
  5680. !isBoolean(expectedType, receivedType)) {
  5681. message += " with value " + expectedValue;
  5682. }
  5683. message += ", got " + receivedType + " ";
  5684. // check if we need to specify received value
  5685. if (isExplicable(receivedType)) {
  5686. message += "with value " + receivedValue + ".";
  5687. }
  5688. return message
  5689. }
  5690. function styleValue (value, type) {
  5691. if (type === 'String') {
  5692. return ("\"" + value + "\"")
  5693. } else if (type === 'Number') {
  5694. return ("" + (Number(value)))
  5695. } else {
  5696. return ("" + value)
  5697. }
  5698. }
  5699. function isExplicable (value) {
  5700. var explicitTypes = ['string', 'number', 'boolean'];
  5701. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  5702. }
  5703. function isBoolean () {
  5704. var args = [], len = arguments.length;
  5705. while ( len-- ) args[ len ] = arguments[ len ];
  5706. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  5707. }
  5708. /* */
  5709. function handleError (err, vm, info) {
  5710. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  5711. // See: https://github.com/vuejs/vuex/issues/1505
  5712. pushTarget();
  5713. try {
  5714. if (vm) {
  5715. var cur = vm;
  5716. while ((cur = cur.$parent)) {
  5717. var hooks = cur.$options.errorCaptured;
  5718. if (hooks) {
  5719. for (var i = 0; i < hooks.length; i++) {
  5720. try {
  5721. var capture = hooks[i].call(cur, err, vm, info) === false;
  5722. if (capture) { return }
  5723. } catch (e) {
  5724. globalHandleError(e, cur, 'errorCaptured hook');
  5725. }
  5726. }
  5727. }
  5728. }
  5729. }
  5730. globalHandleError(err, vm, info);
  5731. } finally {
  5732. popTarget();
  5733. }
  5734. }
  5735. function invokeWithErrorHandling (
  5736. handler,
  5737. context,
  5738. args,
  5739. vm,
  5740. info
  5741. ) {
  5742. var res;
  5743. try {
  5744. res = args ? handler.apply(context, args) : handler.call(context);
  5745. if (res && !res._isVue && isPromise(res) && !res._handled) {
  5746. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  5747. // issue #9511
  5748. // avoid catch triggering multiple times when nested calls
  5749. res._handled = true;
  5750. }
  5751. } catch (e) {
  5752. handleError(e, vm, info);
  5753. }
  5754. return res
  5755. }
  5756. function globalHandleError (err, vm, info) {
  5757. if (config.errorHandler) {
  5758. try {
  5759. return config.errorHandler.call(null, err, vm, info)
  5760. } catch (e) {
  5761. // if the user intentionally throws the original error in the handler,
  5762. // do not log it twice
  5763. if (e !== err) {
  5764. logError(e, null, 'config.errorHandler');
  5765. }
  5766. }
  5767. }
  5768. logError(err, vm, info);
  5769. }
  5770. function logError (err, vm, info) {
  5771. if (true) {
  5772. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  5773. }
  5774. /* istanbul ignore else */
  5775. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  5776. console.error(err);
  5777. } else {
  5778. throw err
  5779. }
  5780. }
  5781. /* */
  5782. var callbacks = [];
  5783. var pending = false;
  5784. function flushCallbacks () {
  5785. pending = false;
  5786. var copies = callbacks.slice(0);
  5787. callbacks.length = 0;
  5788. for (var i = 0; i < copies.length; i++) {
  5789. copies[i]();
  5790. }
  5791. }
  5792. // Here we have async deferring wrappers using microtasks.
  5793. // In 2.5 we used (macro) tasks (in combination with microtasks).
  5794. // However, it has subtle problems when state is changed right before repaint
  5795. // (e.g. #6813, out-in transitions).
  5796. // Also, using (macro) tasks in event handler would cause some weird behaviors
  5797. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  5798. // So we now use microtasks everywhere, again.
  5799. // A major drawback of this tradeoff is that there are some scenarios
  5800. // where microtasks have too high a priority and fire in between supposedly
  5801. // sequential events (e.g. #4521, #6690, which have workarounds)
  5802. // or even between bubbling of the same event (#6566).
  5803. var timerFunc;
  5804. // The nextTick behavior leverages the microtask queue, which can be accessed
  5805. // via either native Promise.then or MutationObserver.
  5806. // MutationObserver has wider support, however it is seriously bugged in
  5807. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  5808. // completely stops working after triggering a few times... so, if native
  5809. // Promise is available, we will use it:
  5810. /* istanbul ignore next, $flow-disable-line */
  5811. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  5812. var p = Promise.resolve();
  5813. timerFunc = function () {
  5814. p.then(flushCallbacks);
  5815. // In problematic UIWebViews, Promise.then doesn't completely break, but
  5816. // it can get stuck in a weird state where callbacks are pushed into the
  5817. // microtask queue but the queue isn't being flushed, until the browser
  5818. // needs to do some other work, e.g. handle a timer. Therefore we can
  5819. // "force" the microtask queue to be flushed by adding an empty timer.
  5820. if (isIOS) { setTimeout(noop); }
  5821. };
  5822. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  5823. isNative(MutationObserver) ||
  5824. // PhantomJS and iOS 7.x
  5825. MutationObserver.toString() === '[object MutationObserverConstructor]'
  5826. )) {
  5827. // Use MutationObserver where native Promise is not available,
  5828. // e.g. PhantomJS, iOS7, Android 4.4
  5829. // (#6466 MutationObserver is unreliable in IE11)
  5830. var counter = 1;
  5831. var observer = new MutationObserver(flushCallbacks);
  5832. var textNode = document.createTextNode(String(counter));
  5833. observer.observe(textNode, {
  5834. characterData: true
  5835. });
  5836. timerFunc = function () {
  5837. counter = (counter + 1) % 2;
  5838. textNode.data = String(counter);
  5839. };
  5840. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  5841. // Fallback to setImmediate.
  5842. // Technically it leverages the (macro) task queue,
  5843. // but it is still a better choice than setTimeout.
  5844. timerFunc = function () {
  5845. setImmediate(flushCallbacks);
  5846. };
  5847. } else {
  5848. // Fallback to setTimeout.
  5849. timerFunc = function () {
  5850. setTimeout(flushCallbacks, 0);
  5851. };
  5852. }
  5853. function nextTick (cb, ctx) {
  5854. var _resolve;
  5855. callbacks.push(function () {
  5856. if (cb) {
  5857. try {
  5858. cb.call(ctx);
  5859. } catch (e) {
  5860. handleError(e, ctx, 'nextTick');
  5861. }
  5862. } else if (_resolve) {
  5863. _resolve(ctx);
  5864. }
  5865. });
  5866. if (!pending) {
  5867. pending = true;
  5868. timerFunc();
  5869. }
  5870. // $flow-disable-line
  5871. if (!cb && typeof Promise !== 'undefined') {
  5872. return new Promise(function (resolve) {
  5873. _resolve = resolve;
  5874. })
  5875. }
  5876. }
  5877. /* */
  5878. /* not type checking this file because flow doesn't play well with Proxy */
  5879. var initProxy;
  5880. if (true) {
  5881. var allowedGlobals = makeMap(
  5882. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  5883. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  5884. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  5885. 'require' // for Webpack/Browserify
  5886. );
  5887. var warnNonPresent = function (target, key) {
  5888. warn(
  5889. "Property or method \"" + key + "\" is not defined on the instance but " +
  5890. 'referenced during render. Make sure that this property is reactive, ' +
  5891. 'either in the data option, or for class-based components, by ' +
  5892. 'initializing the property. ' +
  5893. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  5894. target
  5895. );
  5896. };
  5897. var warnReservedPrefix = function (target, key) {
  5898. warn(
  5899. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  5900. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  5901. 'prevent conflicts with Vue internals. ' +
  5902. 'See: https://vuejs.org/v2/api/#data',
  5903. target
  5904. );
  5905. };
  5906. var hasProxy =
  5907. typeof Proxy !== 'undefined' && isNative(Proxy);
  5908. if (hasProxy) {
  5909. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  5910. config.keyCodes = new Proxy(config.keyCodes, {
  5911. set: function set (target, key, value) {
  5912. if (isBuiltInModifier(key)) {
  5913. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  5914. return false
  5915. } else {
  5916. target[key] = value;
  5917. return true
  5918. }
  5919. }
  5920. });
  5921. }
  5922. var hasHandler = {
  5923. has: function has (target, key) {
  5924. var has = key in target;
  5925. var isAllowed = allowedGlobals(key) ||
  5926. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  5927. if (!has && !isAllowed) {
  5928. if (key in target.$data) { warnReservedPrefix(target, key); }
  5929. else { warnNonPresent(target, key); }
  5930. }
  5931. return has || !isAllowed
  5932. }
  5933. };
  5934. var getHandler = {
  5935. get: function get (target, key) {
  5936. if (typeof key === 'string' && !(key in target)) {
  5937. if (key in target.$data) { warnReservedPrefix(target, key); }
  5938. else { warnNonPresent(target, key); }
  5939. }
  5940. return target[key]
  5941. }
  5942. };
  5943. initProxy = function initProxy (vm) {
  5944. if (hasProxy) {
  5945. // determine which proxy handler to use
  5946. var options = vm.$options;
  5947. var handlers = options.render && options.render._withStripped
  5948. ? getHandler
  5949. : hasHandler;
  5950. vm._renderProxy = new Proxy(vm, handlers);
  5951. } else {
  5952. vm._renderProxy = vm;
  5953. }
  5954. };
  5955. }
  5956. /* */
  5957. var seenObjects = new _Set();
  5958. /**
  5959. * Recursively traverse an object to evoke all converted
  5960. * getters, so that every nested property inside the object
  5961. * is collected as a "deep" dependency.
  5962. */
  5963. function traverse (val) {
  5964. _traverse(val, seenObjects);
  5965. seenObjects.clear();
  5966. }
  5967. function _traverse (val, seen) {
  5968. var i, keys;
  5969. var isA = Array.isArray(val);
  5970. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  5971. return
  5972. }
  5973. if (val.__ob__) {
  5974. var depId = val.__ob__.dep.id;
  5975. if (seen.has(depId)) {
  5976. return
  5977. }
  5978. seen.add(depId);
  5979. }
  5980. if (isA) {
  5981. i = val.length;
  5982. while (i--) { _traverse(val[i], seen); }
  5983. } else {
  5984. keys = Object.keys(val);
  5985. i = keys.length;
  5986. while (i--) { _traverse(val[keys[i]], seen); }
  5987. }
  5988. }
  5989. var mark;
  5990. var measure;
  5991. if (true) {
  5992. var perf = inBrowser && window.performance;
  5993. /* istanbul ignore if */
  5994. if (
  5995. perf &&
  5996. perf.mark &&
  5997. perf.measure &&
  5998. perf.clearMarks &&
  5999. perf.clearMeasures
  6000. ) {
  6001. mark = function (tag) { return perf.mark(tag); };
  6002. measure = function (name, startTag, endTag) {
  6003. perf.measure(name, startTag, endTag);
  6004. perf.clearMarks(startTag);
  6005. perf.clearMarks(endTag);
  6006. // perf.clearMeasures(name)
  6007. };
  6008. }
  6009. }
  6010. /* */
  6011. var normalizeEvent = cached(function (name) {
  6012. var passive = name.charAt(0) === '&';
  6013. name = passive ? name.slice(1) : name;
  6014. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  6015. name = once$$1 ? name.slice(1) : name;
  6016. var capture = name.charAt(0) === '!';
  6017. name = capture ? name.slice(1) : name;
  6018. return {
  6019. name: name,
  6020. once: once$$1,
  6021. capture: capture,
  6022. passive: passive
  6023. }
  6024. });
  6025. function createFnInvoker (fns, vm) {
  6026. function invoker () {
  6027. var arguments$1 = arguments;
  6028. var fns = invoker.fns;
  6029. if (Array.isArray(fns)) {
  6030. var cloned = fns.slice();
  6031. for (var i = 0; i < cloned.length; i++) {
  6032. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  6033. }
  6034. } else {
  6035. // return handler return value for single handlers
  6036. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  6037. }
  6038. }
  6039. invoker.fns = fns;
  6040. return invoker
  6041. }
  6042. function updateListeners (
  6043. on,
  6044. oldOn,
  6045. add,
  6046. remove$$1,
  6047. createOnceHandler,
  6048. vm
  6049. ) {
  6050. var name, def$$1, cur, old, event;
  6051. for (name in on) {
  6052. def$$1 = cur = on[name];
  6053. old = oldOn[name];
  6054. event = normalizeEvent(name);
  6055. if (isUndef(cur)) {
  6056. true && warn(
  6057. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  6058. vm
  6059. );
  6060. } else if (isUndef(old)) {
  6061. if (isUndef(cur.fns)) {
  6062. cur = on[name] = createFnInvoker(cur, vm);
  6063. }
  6064. if (isTrue(event.once)) {
  6065. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  6066. }
  6067. add(event.name, cur, event.capture, event.passive, event.params);
  6068. } else if (cur !== old) {
  6069. old.fns = cur;
  6070. on[name] = old;
  6071. }
  6072. }
  6073. for (name in oldOn) {
  6074. if (isUndef(on[name])) {
  6075. event = normalizeEvent(name);
  6076. remove$$1(event.name, oldOn[name], event.capture);
  6077. }
  6078. }
  6079. }
  6080. /* */
  6081. /* */
  6082. // fixed by xxxxxx (mp properties)
  6083. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  6084. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  6085. if (isUndef(propOptions)) {
  6086. return res
  6087. }
  6088. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  6089. var attrs = data.attrs;
  6090. var props = data.props;
  6091. if (isDef(attrs) || isDef(props)) {
  6092. for (var key in propOptions) {
  6093. var altKey = hyphenate(key);
  6094. var result = checkProp(res, props, key, altKey, true) ||
  6095. checkProp(res, attrs, key, altKey, false);
  6096. // externalClass
  6097. if (
  6098. result &&
  6099. res[key] &&
  6100. externalClasses.indexOf(altKey) !== -1 &&
  6101. context[camelize(res[key])]
  6102. ) {
  6103. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  6104. res[key] = context[camelize(res[key])];
  6105. }
  6106. }
  6107. }
  6108. return res
  6109. }
  6110. function extractPropsFromVNodeData (
  6111. data,
  6112. Ctor,
  6113. tag,
  6114. context// fixed by xxxxxx
  6115. ) {
  6116. // we are only extracting raw values here.
  6117. // validation and default values are handled in the child
  6118. // component itself.
  6119. var propOptions = Ctor.options.props;
  6120. if (isUndef(propOptions)) {
  6121. // fixed by xxxxxx
  6122. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  6123. }
  6124. var res = {};
  6125. var attrs = data.attrs;
  6126. var props = data.props;
  6127. if (isDef(attrs) || isDef(props)) {
  6128. for (var key in propOptions) {
  6129. var altKey = hyphenate(key);
  6130. if (true) {
  6131. var keyInLowerCase = key.toLowerCase();
  6132. if (
  6133. key !== keyInLowerCase &&
  6134. attrs && hasOwn(attrs, keyInLowerCase)
  6135. ) {
  6136. tip(
  6137. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  6138. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  6139. " \"" + key + "\". " +
  6140. "Note that HTML attributes are case-insensitive and camelCased " +
  6141. "props need to use their kebab-case equivalents when using in-DOM " +
  6142. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  6143. );
  6144. }
  6145. }
  6146. checkProp(res, props, key, altKey, true) ||
  6147. checkProp(res, attrs, key, altKey, false);
  6148. }
  6149. }
  6150. // fixed by xxxxxx
  6151. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  6152. }
  6153. function checkProp (
  6154. res,
  6155. hash,
  6156. key,
  6157. altKey,
  6158. preserve
  6159. ) {
  6160. if (isDef(hash)) {
  6161. if (hasOwn(hash, key)) {
  6162. res[key] = hash[key];
  6163. if (!preserve) {
  6164. delete hash[key];
  6165. }
  6166. return true
  6167. } else if (hasOwn(hash, altKey)) {
  6168. res[key] = hash[altKey];
  6169. if (!preserve) {
  6170. delete hash[altKey];
  6171. }
  6172. return true
  6173. }
  6174. }
  6175. return false
  6176. }
  6177. /* */
  6178. // The template compiler attempts to minimize the need for normalization by
  6179. // statically analyzing the template at compile time.
  6180. //
  6181. // For plain HTML markup, normalization can be completely skipped because the
  6182. // generated render function is guaranteed to return Array<VNode>. There are
  6183. // two cases where extra normalization is needed:
  6184. // 1. When the children contains components - because a functional component
  6185. // may return an Array instead of a single root. In this case, just a simple
  6186. // normalization is needed - if any child is an Array, we flatten the whole
  6187. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  6188. // because functional components already normalize their own children.
  6189. function simpleNormalizeChildren (children) {
  6190. for (var i = 0; i < children.length; i++) {
  6191. if (Array.isArray(children[i])) {
  6192. return Array.prototype.concat.apply([], children)
  6193. }
  6194. }
  6195. return children
  6196. }
  6197. // 2. When the children contains constructs that always generated nested Arrays,
  6198. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  6199. // with hand-written render functions / JSX. In such cases a full normalization
  6200. // is needed to cater to all possible types of children values.
  6201. function normalizeChildren (children) {
  6202. return isPrimitive(children)
  6203. ? [createTextVNode(children)]
  6204. : Array.isArray(children)
  6205. ? normalizeArrayChildren(children)
  6206. : undefined
  6207. }
  6208. function isTextNode (node) {
  6209. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  6210. }
  6211. function normalizeArrayChildren (children, nestedIndex) {
  6212. var res = [];
  6213. var i, c, lastIndex, last;
  6214. for (i = 0; i < children.length; i++) {
  6215. c = children[i];
  6216. if (isUndef(c) || typeof c === 'boolean') { continue }
  6217. lastIndex = res.length - 1;
  6218. last = res[lastIndex];
  6219. // nested
  6220. if (Array.isArray(c)) {
  6221. if (c.length > 0) {
  6222. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  6223. // merge adjacent text nodes
  6224. if (isTextNode(c[0]) && isTextNode(last)) {
  6225. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  6226. c.shift();
  6227. }
  6228. res.push.apply(res, c);
  6229. }
  6230. } else if (isPrimitive(c)) {
  6231. if (isTextNode(last)) {
  6232. // merge adjacent text nodes
  6233. // this is necessary for SSR hydration because text nodes are
  6234. // essentially merged when rendered to HTML strings
  6235. res[lastIndex] = createTextVNode(last.text + c);
  6236. } else if (c !== '') {
  6237. // convert primitive to vnode
  6238. res.push(createTextVNode(c));
  6239. }
  6240. } else {
  6241. if (isTextNode(c) && isTextNode(last)) {
  6242. // merge adjacent text nodes
  6243. res[lastIndex] = createTextVNode(last.text + c.text);
  6244. } else {
  6245. // default key for nested array children (likely generated by v-for)
  6246. if (isTrue(children._isVList) &&
  6247. isDef(c.tag) &&
  6248. isUndef(c.key) &&
  6249. isDef(nestedIndex)) {
  6250. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  6251. }
  6252. res.push(c);
  6253. }
  6254. }
  6255. }
  6256. return res
  6257. }
  6258. /* */
  6259. function initProvide (vm) {
  6260. var provide = vm.$options.provide;
  6261. if (provide) {
  6262. vm._provided = typeof provide === 'function'
  6263. ? provide.call(vm)
  6264. : provide;
  6265. }
  6266. }
  6267. function initInjections (vm) {
  6268. var result = resolveInject(vm.$options.inject, vm);
  6269. if (result) {
  6270. toggleObserving(false);
  6271. Object.keys(result).forEach(function (key) {
  6272. /* istanbul ignore else */
  6273. if (true) {
  6274. defineReactive$$1(vm, key, result[key], function () {
  6275. warn(
  6276. "Avoid mutating an injected value directly since the changes will be " +
  6277. "overwritten whenever the provided component re-renders. " +
  6278. "injection being mutated: \"" + key + "\"",
  6279. vm
  6280. );
  6281. });
  6282. } else {}
  6283. });
  6284. toggleObserving(true);
  6285. }
  6286. }
  6287. function resolveInject (inject, vm) {
  6288. if (inject) {
  6289. // inject is :any because flow is not smart enough to figure out cached
  6290. var result = Object.create(null);
  6291. var keys = hasSymbol
  6292. ? Reflect.ownKeys(inject)
  6293. : Object.keys(inject);
  6294. for (var i = 0; i < keys.length; i++) {
  6295. var key = keys[i];
  6296. // #6574 in case the inject object is observed...
  6297. if (key === '__ob__') { continue }
  6298. var provideKey = inject[key].from;
  6299. var source = vm;
  6300. while (source) {
  6301. if (source._provided && hasOwn(source._provided, provideKey)) {
  6302. result[key] = source._provided[provideKey];
  6303. break
  6304. }
  6305. source = source.$parent;
  6306. }
  6307. if (!source) {
  6308. if ('default' in inject[key]) {
  6309. var provideDefault = inject[key].default;
  6310. result[key] = typeof provideDefault === 'function'
  6311. ? provideDefault.call(vm)
  6312. : provideDefault;
  6313. } else if (true) {
  6314. warn(("Injection \"" + key + "\" not found"), vm);
  6315. }
  6316. }
  6317. }
  6318. return result
  6319. }
  6320. }
  6321. /* */
  6322. /**
  6323. * Runtime helper for resolving raw children VNodes into a slot object.
  6324. */
  6325. function resolveSlots (
  6326. children,
  6327. context
  6328. ) {
  6329. if (!children || !children.length) {
  6330. return {}
  6331. }
  6332. var slots = {};
  6333. for (var i = 0, l = children.length; i < l; i++) {
  6334. var child = children[i];
  6335. var data = child.data;
  6336. // remove slot attribute if the node is resolved as a Vue slot node
  6337. if (data && data.attrs && data.attrs.slot) {
  6338. delete data.attrs.slot;
  6339. }
  6340. // named slots should only be respected if the vnode was rendered in the
  6341. // same context.
  6342. if ((child.context === context || child.fnContext === context) &&
  6343. data && data.slot != null
  6344. ) {
  6345. var name = data.slot;
  6346. var slot = (slots[name] || (slots[name] = []));
  6347. if (child.tag === 'template') {
  6348. slot.push.apply(slot, child.children || []);
  6349. } else {
  6350. slot.push(child);
  6351. }
  6352. } else {
  6353. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  6354. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  6355. (slots['page'] || (slots['page'] = [])).push(child);
  6356. }else{
  6357. (slots.default || (slots.default = [])).push(child);
  6358. }
  6359. }
  6360. }
  6361. // ignore slots that contains only whitespace
  6362. for (var name$1 in slots) {
  6363. if (slots[name$1].every(isWhitespace)) {
  6364. delete slots[name$1];
  6365. }
  6366. }
  6367. return slots
  6368. }
  6369. function isWhitespace (node) {
  6370. return (node.isComment && !node.asyncFactory) || node.text === ' '
  6371. }
  6372. /* */
  6373. function normalizeScopedSlots (
  6374. slots,
  6375. normalSlots,
  6376. prevSlots
  6377. ) {
  6378. var res;
  6379. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  6380. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  6381. var key = slots && slots.$key;
  6382. if (!slots) {
  6383. res = {};
  6384. } else if (slots._normalized) {
  6385. // fast path 1: child component re-render only, parent did not change
  6386. return slots._normalized
  6387. } else if (
  6388. isStable &&
  6389. prevSlots &&
  6390. prevSlots !== emptyObject &&
  6391. key === prevSlots.$key &&
  6392. !hasNormalSlots &&
  6393. !prevSlots.$hasNormal
  6394. ) {
  6395. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  6396. // only need to normalize once
  6397. return prevSlots
  6398. } else {
  6399. res = {};
  6400. for (var key$1 in slots) {
  6401. if (slots[key$1] && key$1[0] !== '$') {
  6402. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  6403. }
  6404. }
  6405. }
  6406. // expose normal slots on scopedSlots
  6407. for (var key$2 in normalSlots) {
  6408. if (!(key$2 in res)) {
  6409. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  6410. }
  6411. }
  6412. // avoriaz seems to mock a non-extensible $scopedSlots object
  6413. // and when that is passed down this would cause an error
  6414. if (slots && Object.isExtensible(slots)) {
  6415. (slots)._normalized = res;
  6416. }
  6417. def(res, '$stable', isStable);
  6418. def(res, '$key', key);
  6419. def(res, '$hasNormal', hasNormalSlots);
  6420. return res
  6421. }
  6422. function normalizeScopedSlot(normalSlots, key, fn) {
  6423. var normalized = function () {
  6424. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  6425. res = res && typeof res === 'object' && !Array.isArray(res)
  6426. ? [res] // single vnode
  6427. : normalizeChildren(res);
  6428. return res && (
  6429. res.length === 0 ||
  6430. (res.length === 1 && res[0].isComment) // #9658
  6431. ) ? undefined
  6432. : res
  6433. };
  6434. // this is a slot using the new v-slot syntax without scope. although it is
  6435. // compiled as a scoped slot, render fn users would expect it to be present
  6436. // on this.$slots because the usage is semantically a normal slot.
  6437. if (fn.proxy) {
  6438. Object.defineProperty(normalSlots, key, {
  6439. get: normalized,
  6440. enumerable: true,
  6441. configurable: true
  6442. });
  6443. }
  6444. return normalized
  6445. }
  6446. function proxyNormalSlot(slots, key) {
  6447. return function () { return slots[key]; }
  6448. }
  6449. /* */
  6450. /**
  6451. * Runtime helper for rendering v-for lists.
  6452. */
  6453. function renderList (
  6454. val,
  6455. render
  6456. ) {
  6457. var ret, i, l, keys, key;
  6458. if (Array.isArray(val) || typeof val === 'string') {
  6459. ret = new Array(val.length);
  6460. for (i = 0, l = val.length; i < l; i++) {
  6461. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  6462. }
  6463. } else if (typeof val === 'number') {
  6464. ret = new Array(val);
  6465. for (i = 0; i < val; i++) {
  6466. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  6467. }
  6468. } else if (isObject(val)) {
  6469. if (hasSymbol && val[Symbol.iterator]) {
  6470. ret = [];
  6471. var iterator = val[Symbol.iterator]();
  6472. var result = iterator.next();
  6473. while (!result.done) {
  6474. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  6475. result = iterator.next();
  6476. }
  6477. } else {
  6478. keys = Object.keys(val);
  6479. ret = new Array(keys.length);
  6480. for (i = 0, l = keys.length; i < l; i++) {
  6481. key = keys[i];
  6482. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  6483. }
  6484. }
  6485. }
  6486. if (!isDef(ret)) {
  6487. ret = [];
  6488. }
  6489. (ret)._isVList = true;
  6490. return ret
  6491. }
  6492. /* */
  6493. /**
  6494. * Runtime helper for rendering <slot>
  6495. */
  6496. function renderSlot (
  6497. name,
  6498. fallback,
  6499. props,
  6500. bindObject
  6501. ) {
  6502. var scopedSlotFn = this.$scopedSlots[name];
  6503. var nodes;
  6504. if (scopedSlotFn) { // scoped slot
  6505. props = props || {};
  6506. if (bindObject) {
  6507. if ( true && !isObject(bindObject)) {
  6508. warn(
  6509. 'slot v-bind without argument expects an Object',
  6510. this
  6511. );
  6512. }
  6513. props = extend(extend({}, bindObject), props);
  6514. }
  6515. // fixed by xxxxxx app-plus scopedSlot
  6516. nodes = scopedSlotFn(props, this, props._i) || fallback;
  6517. } else {
  6518. nodes = this.$slots[name] || fallback;
  6519. }
  6520. var target = props && props.slot;
  6521. if (target) {
  6522. return this.$createElement('template', { slot: target }, nodes)
  6523. } else {
  6524. return nodes
  6525. }
  6526. }
  6527. /* */
  6528. /**
  6529. * Runtime helper for resolving filters
  6530. */
  6531. function resolveFilter (id) {
  6532. return resolveAsset(this.$options, 'filters', id, true) || identity
  6533. }
  6534. /* */
  6535. function isKeyNotMatch (expect, actual) {
  6536. if (Array.isArray(expect)) {
  6537. return expect.indexOf(actual) === -1
  6538. } else {
  6539. return expect !== actual
  6540. }
  6541. }
  6542. /**
  6543. * Runtime helper for checking keyCodes from config.
  6544. * exposed as Vue.prototype._k
  6545. * passing in eventKeyName as last argument separately for backwards compat
  6546. */
  6547. function checkKeyCodes (
  6548. eventKeyCode,
  6549. key,
  6550. builtInKeyCode,
  6551. eventKeyName,
  6552. builtInKeyName
  6553. ) {
  6554. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  6555. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  6556. return isKeyNotMatch(builtInKeyName, eventKeyName)
  6557. } else if (mappedKeyCode) {
  6558. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  6559. } else if (eventKeyName) {
  6560. return hyphenate(eventKeyName) !== key
  6561. }
  6562. }
  6563. /* */
  6564. /**
  6565. * Runtime helper for merging v-bind="object" into a VNode's data.
  6566. */
  6567. function bindObjectProps (
  6568. data,
  6569. tag,
  6570. value,
  6571. asProp,
  6572. isSync
  6573. ) {
  6574. if (value) {
  6575. if (!isObject(value)) {
  6576. true && warn(
  6577. 'v-bind without argument expects an Object or Array value',
  6578. this
  6579. );
  6580. } else {
  6581. if (Array.isArray(value)) {
  6582. value = toObject(value);
  6583. }
  6584. var hash;
  6585. var loop = function ( key ) {
  6586. if (
  6587. key === 'class' ||
  6588. key === 'style' ||
  6589. isReservedAttribute(key)
  6590. ) {
  6591. hash = data;
  6592. } else {
  6593. var type = data.attrs && data.attrs.type;
  6594. hash = asProp || config.mustUseProp(tag, type, key)
  6595. ? data.domProps || (data.domProps = {})
  6596. : data.attrs || (data.attrs = {});
  6597. }
  6598. var camelizedKey = camelize(key);
  6599. var hyphenatedKey = hyphenate(key);
  6600. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  6601. hash[key] = value[key];
  6602. if (isSync) {
  6603. var on = data.on || (data.on = {});
  6604. on[("update:" + key)] = function ($event) {
  6605. value[key] = $event;
  6606. };
  6607. }
  6608. }
  6609. };
  6610. for (var key in value) loop( key );
  6611. }
  6612. }
  6613. return data
  6614. }
  6615. /* */
  6616. /**
  6617. * Runtime helper for rendering static trees.
  6618. */
  6619. function renderStatic (
  6620. index,
  6621. isInFor
  6622. ) {
  6623. var cached = this._staticTrees || (this._staticTrees = []);
  6624. var tree = cached[index];
  6625. // if has already-rendered static tree and not inside v-for,
  6626. // we can reuse the same tree.
  6627. if (tree && !isInFor) {
  6628. return tree
  6629. }
  6630. // otherwise, render a fresh tree.
  6631. tree = cached[index] = this.$options.staticRenderFns[index].call(
  6632. this._renderProxy,
  6633. null,
  6634. this // for render fns generated for functional component templates
  6635. );
  6636. markStatic(tree, ("__static__" + index), false);
  6637. return tree
  6638. }
  6639. /**
  6640. * Runtime helper for v-once.
  6641. * Effectively it means marking the node as static with a unique key.
  6642. */
  6643. function markOnce (
  6644. tree,
  6645. index,
  6646. key
  6647. ) {
  6648. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  6649. return tree
  6650. }
  6651. function markStatic (
  6652. tree,
  6653. key,
  6654. isOnce
  6655. ) {
  6656. if (Array.isArray(tree)) {
  6657. for (var i = 0; i < tree.length; i++) {
  6658. if (tree[i] && typeof tree[i] !== 'string') {
  6659. markStaticNode(tree[i], (key + "_" + i), isOnce);
  6660. }
  6661. }
  6662. } else {
  6663. markStaticNode(tree, key, isOnce);
  6664. }
  6665. }
  6666. function markStaticNode (node, key, isOnce) {
  6667. node.isStatic = true;
  6668. node.key = key;
  6669. node.isOnce = isOnce;
  6670. }
  6671. /* */
  6672. function bindObjectListeners (data, value) {
  6673. if (value) {
  6674. if (!isPlainObject(value)) {
  6675. true && warn(
  6676. 'v-on without argument expects an Object value',
  6677. this
  6678. );
  6679. } else {
  6680. var on = data.on = data.on ? extend({}, data.on) : {};
  6681. for (var key in value) {
  6682. var existing = on[key];
  6683. var ours = value[key];
  6684. on[key] = existing ? [].concat(existing, ours) : ours;
  6685. }
  6686. }
  6687. }
  6688. return data
  6689. }
  6690. /* */
  6691. function resolveScopedSlots (
  6692. fns, // see flow/vnode
  6693. res,
  6694. // the following are added in 2.6
  6695. hasDynamicKeys,
  6696. contentHashKey
  6697. ) {
  6698. res = res || { $stable: !hasDynamicKeys };
  6699. for (var i = 0; i < fns.length; i++) {
  6700. var slot = fns[i];
  6701. if (Array.isArray(slot)) {
  6702. resolveScopedSlots(slot, res, hasDynamicKeys);
  6703. } else if (slot) {
  6704. // marker for reverse proxying v-slot without scope on this.$slots
  6705. if (slot.proxy) {
  6706. slot.fn.proxy = true;
  6707. }
  6708. res[slot.key] = slot.fn;
  6709. }
  6710. }
  6711. if (contentHashKey) {
  6712. (res).$key = contentHashKey;
  6713. }
  6714. return res
  6715. }
  6716. /* */
  6717. function bindDynamicKeys (baseObj, values) {
  6718. for (var i = 0; i < values.length; i += 2) {
  6719. var key = values[i];
  6720. if (typeof key === 'string' && key) {
  6721. baseObj[values[i]] = values[i + 1];
  6722. } else if ( true && key !== '' && key !== null) {
  6723. // null is a special value for explicitly removing a binding
  6724. warn(
  6725. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  6726. this
  6727. );
  6728. }
  6729. }
  6730. return baseObj
  6731. }
  6732. // helper to dynamically append modifier runtime markers to event names.
  6733. // ensure only append when value is already string, otherwise it will be cast
  6734. // to string and cause the type check to miss.
  6735. function prependModifier (value, symbol) {
  6736. return typeof value === 'string' ? symbol + value : value
  6737. }
  6738. /* */
  6739. function installRenderHelpers (target) {
  6740. target._o = markOnce;
  6741. target._n = toNumber;
  6742. target._s = toString;
  6743. target._l = renderList;
  6744. target._t = renderSlot;
  6745. target._q = looseEqual;
  6746. target._i = looseIndexOf;
  6747. target._m = renderStatic;
  6748. target._f = resolveFilter;
  6749. target._k = checkKeyCodes;
  6750. target._b = bindObjectProps;
  6751. target._v = createTextVNode;
  6752. target._e = createEmptyVNode;
  6753. target._u = resolveScopedSlots;
  6754. target._g = bindObjectListeners;
  6755. target._d = bindDynamicKeys;
  6756. target._p = prependModifier;
  6757. }
  6758. /* */
  6759. function FunctionalRenderContext (
  6760. data,
  6761. props,
  6762. children,
  6763. parent,
  6764. Ctor
  6765. ) {
  6766. var this$1 = this;
  6767. var options = Ctor.options;
  6768. // ensure the createElement function in functional components
  6769. // gets a unique context - this is necessary for correct named slot check
  6770. var contextVm;
  6771. if (hasOwn(parent, '_uid')) {
  6772. contextVm = Object.create(parent);
  6773. // $flow-disable-line
  6774. contextVm._original = parent;
  6775. } else {
  6776. // the context vm passed in is a functional context as well.
  6777. // in this case we want to make sure we are able to get a hold to the
  6778. // real context instance.
  6779. contextVm = parent;
  6780. // $flow-disable-line
  6781. parent = parent._original;
  6782. }
  6783. var isCompiled = isTrue(options._compiled);
  6784. var needNormalization = !isCompiled;
  6785. this.data = data;
  6786. this.props = props;
  6787. this.children = children;
  6788. this.parent = parent;
  6789. this.listeners = data.on || emptyObject;
  6790. this.injections = resolveInject(options.inject, parent);
  6791. this.slots = function () {
  6792. if (!this$1.$slots) {
  6793. normalizeScopedSlots(
  6794. data.scopedSlots,
  6795. this$1.$slots = resolveSlots(children, parent)
  6796. );
  6797. }
  6798. return this$1.$slots
  6799. };
  6800. Object.defineProperty(this, 'scopedSlots', ({
  6801. enumerable: true,
  6802. get: function get () {
  6803. return normalizeScopedSlots(data.scopedSlots, this.slots())
  6804. }
  6805. }));
  6806. // support for compiled functional template
  6807. if (isCompiled) {
  6808. // exposing $options for renderStatic()
  6809. this.$options = options;
  6810. // pre-resolve slots for renderSlot()
  6811. this.$slots = this.slots();
  6812. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  6813. }
  6814. if (options._scopeId) {
  6815. this._c = function (a, b, c, d) {
  6816. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  6817. if (vnode && !Array.isArray(vnode)) {
  6818. vnode.fnScopeId = options._scopeId;
  6819. vnode.fnContext = parent;
  6820. }
  6821. return vnode
  6822. };
  6823. } else {
  6824. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  6825. }
  6826. }
  6827. installRenderHelpers(FunctionalRenderContext.prototype);
  6828. function createFunctionalComponent (
  6829. Ctor,
  6830. propsData,
  6831. data,
  6832. contextVm,
  6833. children
  6834. ) {
  6835. var options = Ctor.options;
  6836. var props = {};
  6837. var propOptions = options.props;
  6838. if (isDef(propOptions)) {
  6839. for (var key in propOptions) {
  6840. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  6841. }
  6842. } else {
  6843. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  6844. if (isDef(data.props)) { mergeProps(props, data.props); }
  6845. }
  6846. var renderContext = new FunctionalRenderContext(
  6847. data,
  6848. props,
  6849. children,
  6850. contextVm,
  6851. Ctor
  6852. );
  6853. var vnode = options.render.call(null, renderContext._c, renderContext);
  6854. if (vnode instanceof VNode) {
  6855. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  6856. } else if (Array.isArray(vnode)) {
  6857. var vnodes = normalizeChildren(vnode) || [];
  6858. var res = new Array(vnodes.length);
  6859. for (var i = 0; i < vnodes.length; i++) {
  6860. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  6861. }
  6862. return res
  6863. }
  6864. }
  6865. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  6866. // #7817 clone node before setting fnContext, otherwise if the node is reused
  6867. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  6868. // that should not be matched to match.
  6869. var clone = cloneVNode(vnode);
  6870. clone.fnContext = contextVm;
  6871. clone.fnOptions = options;
  6872. if (true) {
  6873. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  6874. }
  6875. if (data.slot) {
  6876. (clone.data || (clone.data = {})).slot = data.slot;
  6877. }
  6878. return clone
  6879. }
  6880. function mergeProps (to, from) {
  6881. for (var key in from) {
  6882. to[camelize(key)] = from[key];
  6883. }
  6884. }
  6885. /* */
  6886. /* */
  6887. /* */
  6888. /* */
  6889. // inline hooks to be invoked on component VNodes during patch
  6890. var componentVNodeHooks = {
  6891. init: function init (vnode, hydrating) {
  6892. if (
  6893. vnode.componentInstance &&
  6894. !vnode.componentInstance._isDestroyed &&
  6895. vnode.data.keepAlive
  6896. ) {
  6897. // kept-alive components, treat as a patch
  6898. var mountedNode = vnode; // work around flow
  6899. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  6900. } else {
  6901. var child = vnode.componentInstance = createComponentInstanceForVnode(
  6902. vnode,
  6903. activeInstance
  6904. );
  6905. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  6906. }
  6907. },
  6908. prepatch: function prepatch (oldVnode, vnode) {
  6909. var options = vnode.componentOptions;
  6910. var child = vnode.componentInstance = oldVnode.componentInstance;
  6911. updateChildComponent(
  6912. child,
  6913. options.propsData, // updated props
  6914. options.listeners, // updated listeners
  6915. vnode, // new parent vnode
  6916. options.children // new children
  6917. );
  6918. },
  6919. insert: function insert (vnode) {
  6920. var context = vnode.context;
  6921. var componentInstance = vnode.componentInstance;
  6922. if (!componentInstance._isMounted) {
  6923. callHook(componentInstance, 'onServiceCreated');
  6924. callHook(componentInstance, 'onServiceAttached');
  6925. componentInstance._isMounted = true;
  6926. callHook(componentInstance, 'mounted');
  6927. }
  6928. if (vnode.data.keepAlive) {
  6929. if (context._isMounted) {
  6930. // vue-router#1212
  6931. // During updates, a kept-alive component's child components may
  6932. // change, so directly walking the tree here may call activated hooks
  6933. // on incorrect children. Instead we push them into a queue which will
  6934. // be processed after the whole patch process ended.
  6935. queueActivatedComponent(componentInstance);
  6936. } else {
  6937. activateChildComponent(componentInstance, true /* direct */);
  6938. }
  6939. }
  6940. },
  6941. destroy: function destroy (vnode) {
  6942. var componentInstance = vnode.componentInstance;
  6943. if (!componentInstance._isDestroyed) {
  6944. if (!vnode.data.keepAlive) {
  6945. componentInstance.$destroy();
  6946. } else {
  6947. deactivateChildComponent(componentInstance, true /* direct */);
  6948. }
  6949. }
  6950. }
  6951. };
  6952. var hooksToMerge = Object.keys(componentVNodeHooks);
  6953. function createComponent (
  6954. Ctor,
  6955. data,
  6956. context,
  6957. children,
  6958. tag
  6959. ) {
  6960. if (isUndef(Ctor)) {
  6961. return
  6962. }
  6963. var baseCtor = context.$options._base;
  6964. // plain options object: turn it into a constructor
  6965. if (isObject(Ctor)) {
  6966. Ctor = baseCtor.extend(Ctor);
  6967. }
  6968. // if at this stage it's not a constructor or an async component factory,
  6969. // reject.
  6970. if (typeof Ctor !== 'function') {
  6971. if (true) {
  6972. warn(("Invalid Component definition: " + (String(Ctor))), context);
  6973. }
  6974. return
  6975. }
  6976. // async component
  6977. var asyncFactory;
  6978. if (isUndef(Ctor.cid)) {
  6979. asyncFactory = Ctor;
  6980. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  6981. if (Ctor === undefined) {
  6982. // return a placeholder node for async component, which is rendered
  6983. // as a comment node but preserves all the raw information for the node.
  6984. // the information will be used for async server-rendering and hydration.
  6985. return createAsyncPlaceholder(
  6986. asyncFactory,
  6987. data,
  6988. context,
  6989. children,
  6990. tag
  6991. )
  6992. }
  6993. }
  6994. data = data || {};
  6995. // resolve constructor options in case global mixins are applied after
  6996. // component constructor creation
  6997. resolveConstructorOptions(Ctor);
  6998. // transform component v-model data into props & events
  6999. if (isDef(data.model)) {
  7000. transformModel(Ctor.options, data);
  7001. }
  7002. // extract props
  7003. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  7004. // functional component
  7005. if (isTrue(Ctor.options.functional)) {
  7006. return createFunctionalComponent(Ctor, propsData, data, context, children)
  7007. }
  7008. // extract listeners, since these needs to be treated as
  7009. // child component listeners instead of DOM listeners
  7010. var listeners = data.on;
  7011. // replace with listeners with .native modifier
  7012. // so it gets processed during parent component patch.
  7013. data.on = data.nativeOn;
  7014. if (isTrue(Ctor.options.abstract)) {
  7015. // abstract components do not keep anything
  7016. // other than props & listeners & slot
  7017. // work around flow
  7018. var slot = data.slot;
  7019. data = {};
  7020. if (slot) {
  7021. data.slot = slot;
  7022. }
  7023. }
  7024. // install component management hooks onto the placeholder node
  7025. installComponentHooks(data);
  7026. // return a placeholder vnode
  7027. var name = Ctor.options.name || tag;
  7028. var vnode = new VNode(
  7029. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  7030. data, undefined, undefined, undefined, context,
  7031. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  7032. asyncFactory
  7033. );
  7034. return vnode
  7035. }
  7036. function createComponentInstanceForVnode (
  7037. vnode, // we know it's MountedComponentVNode but flow doesn't
  7038. parent // activeInstance in lifecycle state
  7039. ) {
  7040. var options = {
  7041. _isComponent: true,
  7042. _parentVnode: vnode,
  7043. parent: parent
  7044. };
  7045. // check inline-template render functions
  7046. var inlineTemplate = vnode.data.inlineTemplate;
  7047. if (isDef(inlineTemplate)) {
  7048. options.render = inlineTemplate.render;
  7049. options.staticRenderFns = inlineTemplate.staticRenderFns;
  7050. }
  7051. return new vnode.componentOptions.Ctor(options)
  7052. }
  7053. function installComponentHooks (data) {
  7054. var hooks = data.hook || (data.hook = {});
  7055. for (var i = 0; i < hooksToMerge.length; i++) {
  7056. var key = hooksToMerge[i];
  7057. var existing = hooks[key];
  7058. var toMerge = componentVNodeHooks[key];
  7059. if (existing !== toMerge && !(existing && existing._merged)) {
  7060. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  7061. }
  7062. }
  7063. }
  7064. function mergeHook$1 (f1, f2) {
  7065. var merged = function (a, b) {
  7066. // flow complains about extra args which is why we use any
  7067. f1(a, b);
  7068. f2(a, b);
  7069. };
  7070. merged._merged = true;
  7071. return merged
  7072. }
  7073. // transform component v-model info (value and callback) into
  7074. // prop and event handler respectively.
  7075. function transformModel (options, data) {
  7076. var prop = (options.model && options.model.prop) || 'value';
  7077. var event = (options.model && options.model.event) || 'input'
  7078. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  7079. var on = data.on || (data.on = {});
  7080. var existing = on[event];
  7081. var callback = data.model.callback;
  7082. if (isDef(existing)) {
  7083. if (
  7084. Array.isArray(existing)
  7085. ? existing.indexOf(callback) === -1
  7086. : existing !== callback
  7087. ) {
  7088. on[event] = [callback].concat(existing);
  7089. }
  7090. } else {
  7091. on[event] = callback;
  7092. }
  7093. }
  7094. /* */
  7095. var SIMPLE_NORMALIZE = 1;
  7096. var ALWAYS_NORMALIZE = 2;
  7097. // wrapper function for providing a more flexible interface
  7098. // without getting yelled at by flow
  7099. function createElement (
  7100. context,
  7101. tag,
  7102. data,
  7103. children,
  7104. normalizationType,
  7105. alwaysNormalize
  7106. ) {
  7107. if (Array.isArray(data) || isPrimitive(data)) {
  7108. normalizationType = children;
  7109. children = data;
  7110. data = undefined;
  7111. }
  7112. if (isTrue(alwaysNormalize)) {
  7113. normalizationType = ALWAYS_NORMALIZE;
  7114. }
  7115. return _createElement(context, tag, data, children, normalizationType)
  7116. }
  7117. function _createElement (
  7118. context,
  7119. tag,
  7120. data,
  7121. children,
  7122. normalizationType
  7123. ) {
  7124. if (isDef(data) && isDef((data).__ob__)) {
  7125. true && warn(
  7126. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  7127. 'Always create fresh vnode data objects in each render!',
  7128. context
  7129. );
  7130. return createEmptyVNode()
  7131. }
  7132. // object syntax in v-bind
  7133. if (isDef(data) && isDef(data.is)) {
  7134. tag = data.is;
  7135. }
  7136. if (!tag) {
  7137. // in case of component :is set to falsy value
  7138. return createEmptyVNode()
  7139. }
  7140. // warn against non-primitive key
  7141. if ( true &&
  7142. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  7143. ) {
  7144. {
  7145. warn(
  7146. 'Avoid using non-primitive value as key, ' +
  7147. 'use string/number value instead.',
  7148. context
  7149. );
  7150. }
  7151. }
  7152. // support single function children as default scoped slot
  7153. if (Array.isArray(children) &&
  7154. typeof children[0] === 'function'
  7155. ) {
  7156. data = data || {};
  7157. data.scopedSlots = { default: children[0] };
  7158. children.length = 0;
  7159. }
  7160. if (normalizationType === ALWAYS_NORMALIZE) {
  7161. children = normalizeChildren(children);
  7162. } else if (normalizationType === SIMPLE_NORMALIZE) {
  7163. children = simpleNormalizeChildren(children);
  7164. }
  7165. var vnode, ns;
  7166. if (typeof tag === 'string') {
  7167. var Ctor;
  7168. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  7169. if (config.isReservedTag(tag)) {
  7170. // platform built-in elements
  7171. if ( true && isDef(data) && isDef(data.nativeOn)) {
  7172. warn(
  7173. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  7174. context
  7175. );
  7176. }
  7177. vnode = new VNode(
  7178. config.parsePlatformTagName(tag), data, children,
  7179. undefined, undefined, context
  7180. );
  7181. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  7182. // component
  7183. vnode = createComponent(Ctor, data, context, children, tag);
  7184. } else {
  7185. // unknown or unlisted namespaced elements
  7186. // check at runtime because it may get assigned a namespace when its
  7187. // parent normalizes children
  7188. vnode = new VNode(
  7189. tag, data, children,
  7190. undefined, undefined, context
  7191. );
  7192. }
  7193. } else {
  7194. // direct component options / constructor
  7195. vnode = createComponent(tag, data, context, children);
  7196. }
  7197. if (Array.isArray(vnode)) {
  7198. return vnode
  7199. } else if (isDef(vnode)) {
  7200. if (isDef(ns)) { applyNS(vnode, ns); }
  7201. if (isDef(data)) { registerDeepBindings(data); }
  7202. return vnode
  7203. } else {
  7204. return createEmptyVNode()
  7205. }
  7206. }
  7207. function applyNS (vnode, ns, force) {
  7208. vnode.ns = ns;
  7209. if (vnode.tag === 'foreignObject') {
  7210. // use default namespace inside foreignObject
  7211. ns = undefined;
  7212. force = true;
  7213. }
  7214. if (isDef(vnode.children)) {
  7215. for (var i = 0, l = vnode.children.length; i < l; i++) {
  7216. var child = vnode.children[i];
  7217. if (isDef(child.tag) && (
  7218. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  7219. applyNS(child, ns, force);
  7220. }
  7221. }
  7222. }
  7223. }
  7224. // ref #5318
  7225. // necessary to ensure parent re-render when deep bindings like :style and
  7226. // :class are used on slot nodes
  7227. function registerDeepBindings (data) {
  7228. if (isObject(data.style)) {
  7229. traverse(data.style);
  7230. }
  7231. if (isObject(data.class)) {
  7232. traverse(data.class);
  7233. }
  7234. }
  7235. /* */
  7236. function initRender (vm) {
  7237. vm._vnode = null; // the root of the child tree
  7238. vm._staticTrees = null; // v-once cached trees
  7239. var options = vm.$options;
  7240. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  7241. var renderContext = parentVnode && parentVnode.context;
  7242. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  7243. vm.$scopedSlots = emptyObject;
  7244. // bind the createElement fn to this instance
  7245. // so that we get proper render context inside it.
  7246. // args order: tag, data, children, normalizationType, alwaysNormalize
  7247. // internal version is used by render functions compiled from templates
  7248. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  7249. // normalization is always applied for the public version, used in
  7250. // user-written render functions.
  7251. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  7252. // $attrs & $listeners are exposed for easier HOC creation.
  7253. // they need to be reactive so that HOCs using them are always updated
  7254. var parentData = parentVnode && parentVnode.data;
  7255. /* istanbul ignore else */
  7256. if (true) {
  7257. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  7258. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  7259. }, true);
  7260. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  7261. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  7262. }, true);
  7263. } else {}
  7264. }
  7265. var currentRenderingInstance = null;
  7266. function renderMixin (Vue) {
  7267. // install runtime convenience helpers
  7268. installRenderHelpers(Vue.prototype);
  7269. Vue.prototype.$nextTick = function (fn) {
  7270. return nextTick(fn, this)
  7271. };
  7272. Vue.prototype._render = function () {
  7273. var vm = this;
  7274. var ref = vm.$options;
  7275. var render = ref.render;
  7276. var _parentVnode = ref._parentVnode;
  7277. if (_parentVnode) {
  7278. vm.$scopedSlots = normalizeScopedSlots(
  7279. _parentVnode.data.scopedSlots,
  7280. vm.$slots,
  7281. vm.$scopedSlots
  7282. );
  7283. }
  7284. // set parent vnode. this allows render functions to have access
  7285. // to the data on the placeholder node.
  7286. vm.$vnode = _parentVnode;
  7287. // render self
  7288. var vnode;
  7289. try {
  7290. // There's no need to maintain a stack because all render fns are called
  7291. // separately from one another. Nested component's render fns are called
  7292. // when parent component is patched.
  7293. currentRenderingInstance = vm;
  7294. vnode = render.call(vm._renderProxy, vm.$createElement);
  7295. } catch (e) {
  7296. handleError(e, vm, "render");
  7297. // return error render result,
  7298. // or previous vnode to prevent render error causing blank component
  7299. /* istanbul ignore else */
  7300. if ( true && vm.$options.renderError) {
  7301. try {
  7302. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  7303. } catch (e) {
  7304. handleError(e, vm, "renderError");
  7305. vnode = vm._vnode;
  7306. }
  7307. } else {
  7308. vnode = vm._vnode;
  7309. }
  7310. } finally {
  7311. currentRenderingInstance = null;
  7312. }
  7313. // if the returned array contains only a single node, allow it
  7314. if (Array.isArray(vnode) && vnode.length === 1) {
  7315. vnode = vnode[0];
  7316. }
  7317. // return empty vnode in case the render function errored out
  7318. if (!(vnode instanceof VNode)) {
  7319. if ( true && Array.isArray(vnode)) {
  7320. warn(
  7321. 'Multiple root nodes returned from render function. Render function ' +
  7322. 'should return a single root node.',
  7323. vm
  7324. );
  7325. }
  7326. vnode = createEmptyVNode();
  7327. }
  7328. // set parent
  7329. vnode.parent = _parentVnode;
  7330. return vnode
  7331. };
  7332. }
  7333. /* */
  7334. function ensureCtor (comp, base) {
  7335. if (
  7336. comp.__esModule ||
  7337. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  7338. ) {
  7339. comp = comp.default;
  7340. }
  7341. return isObject(comp)
  7342. ? base.extend(comp)
  7343. : comp
  7344. }
  7345. function createAsyncPlaceholder (
  7346. factory,
  7347. data,
  7348. context,
  7349. children,
  7350. tag
  7351. ) {
  7352. var node = createEmptyVNode();
  7353. node.asyncFactory = factory;
  7354. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  7355. return node
  7356. }
  7357. function resolveAsyncComponent (
  7358. factory,
  7359. baseCtor
  7360. ) {
  7361. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  7362. return factory.errorComp
  7363. }
  7364. if (isDef(factory.resolved)) {
  7365. return factory.resolved
  7366. }
  7367. var owner = currentRenderingInstance;
  7368. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  7369. // already pending
  7370. factory.owners.push(owner);
  7371. }
  7372. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  7373. return factory.loadingComp
  7374. }
  7375. if (owner && !isDef(factory.owners)) {
  7376. var owners = factory.owners = [owner];
  7377. var sync = true;
  7378. var timerLoading = null;
  7379. var timerTimeout = null
  7380. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  7381. var forceRender = function (renderCompleted) {
  7382. for (var i = 0, l = owners.length; i < l; i++) {
  7383. (owners[i]).$forceUpdate();
  7384. }
  7385. if (renderCompleted) {
  7386. owners.length = 0;
  7387. if (timerLoading !== null) {
  7388. clearTimeout(timerLoading);
  7389. timerLoading = null;
  7390. }
  7391. if (timerTimeout !== null) {
  7392. clearTimeout(timerTimeout);
  7393. timerTimeout = null;
  7394. }
  7395. }
  7396. };
  7397. var resolve = once(function (res) {
  7398. // cache resolved
  7399. factory.resolved = ensureCtor(res, baseCtor);
  7400. // invoke callbacks only if this is not a synchronous resolve
  7401. // (async resolves are shimmed as synchronous during SSR)
  7402. if (!sync) {
  7403. forceRender(true);
  7404. } else {
  7405. owners.length = 0;
  7406. }
  7407. });
  7408. var reject = once(function (reason) {
  7409. true && warn(
  7410. "Failed to resolve async component: " + (String(factory)) +
  7411. (reason ? ("\nReason: " + reason) : '')
  7412. );
  7413. if (isDef(factory.errorComp)) {
  7414. factory.error = true;
  7415. forceRender(true);
  7416. }
  7417. });
  7418. var res = factory(resolve, reject);
  7419. if (isObject(res)) {
  7420. if (isPromise(res)) {
  7421. // () => Promise
  7422. if (isUndef(factory.resolved)) {
  7423. res.then(resolve, reject);
  7424. }
  7425. } else if (isPromise(res.component)) {
  7426. res.component.then(resolve, reject);
  7427. if (isDef(res.error)) {
  7428. factory.errorComp = ensureCtor(res.error, baseCtor);
  7429. }
  7430. if (isDef(res.loading)) {
  7431. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  7432. if (res.delay === 0) {
  7433. factory.loading = true;
  7434. } else {
  7435. timerLoading = setTimeout(function () {
  7436. timerLoading = null;
  7437. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  7438. factory.loading = true;
  7439. forceRender(false);
  7440. }
  7441. }, res.delay || 200);
  7442. }
  7443. }
  7444. if (isDef(res.timeout)) {
  7445. timerTimeout = setTimeout(function () {
  7446. timerTimeout = null;
  7447. if (isUndef(factory.resolved)) {
  7448. reject(
  7449. true
  7450. ? ("timeout (" + (res.timeout) + "ms)")
  7451. : undefined
  7452. );
  7453. }
  7454. }, res.timeout);
  7455. }
  7456. }
  7457. }
  7458. sync = false;
  7459. // return in case resolved synchronously
  7460. return factory.loading
  7461. ? factory.loadingComp
  7462. : factory.resolved
  7463. }
  7464. }
  7465. /* */
  7466. function isAsyncPlaceholder (node) {
  7467. return node.isComment && node.asyncFactory
  7468. }
  7469. /* */
  7470. function getFirstComponentChild (children) {
  7471. if (Array.isArray(children)) {
  7472. for (var i = 0; i < children.length; i++) {
  7473. var c = children[i];
  7474. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  7475. return c
  7476. }
  7477. }
  7478. }
  7479. }
  7480. /* */
  7481. /* */
  7482. function initEvents (vm) {
  7483. vm._events = Object.create(null);
  7484. vm._hasHookEvent = false;
  7485. // init parent attached events
  7486. var listeners = vm.$options._parentListeners;
  7487. if (listeners) {
  7488. updateComponentListeners(vm, listeners);
  7489. }
  7490. }
  7491. var target;
  7492. function add (event, fn) {
  7493. target.$on(event, fn);
  7494. }
  7495. function remove$1 (event, fn) {
  7496. target.$off(event, fn);
  7497. }
  7498. function createOnceHandler (event, fn) {
  7499. var _target = target;
  7500. return function onceHandler () {
  7501. var res = fn.apply(null, arguments);
  7502. if (res !== null) {
  7503. _target.$off(event, onceHandler);
  7504. }
  7505. }
  7506. }
  7507. function updateComponentListeners (
  7508. vm,
  7509. listeners,
  7510. oldListeners
  7511. ) {
  7512. target = vm;
  7513. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  7514. target = undefined;
  7515. }
  7516. function eventsMixin (Vue) {
  7517. var hookRE = /^hook:/;
  7518. Vue.prototype.$on = function (event, fn) {
  7519. var vm = this;
  7520. if (Array.isArray(event)) {
  7521. for (var i = 0, l = event.length; i < l; i++) {
  7522. vm.$on(event[i], fn);
  7523. }
  7524. } else {
  7525. (vm._events[event] || (vm._events[event] = [])).push(fn);
  7526. // optimize hook:event cost by using a boolean flag marked at registration
  7527. // instead of a hash lookup
  7528. if (hookRE.test(event)) {
  7529. vm._hasHookEvent = true;
  7530. }
  7531. }
  7532. return vm
  7533. };
  7534. Vue.prototype.$once = function (event, fn) {
  7535. var vm = this;
  7536. function on () {
  7537. vm.$off(event, on);
  7538. fn.apply(vm, arguments);
  7539. }
  7540. on.fn = fn;
  7541. vm.$on(event, on);
  7542. return vm
  7543. };
  7544. Vue.prototype.$off = function (event, fn) {
  7545. var vm = this;
  7546. // all
  7547. if (!arguments.length) {
  7548. vm._events = Object.create(null);
  7549. return vm
  7550. }
  7551. // array of events
  7552. if (Array.isArray(event)) {
  7553. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  7554. vm.$off(event[i$1], fn);
  7555. }
  7556. return vm
  7557. }
  7558. // specific event
  7559. var cbs = vm._events[event];
  7560. if (!cbs) {
  7561. return vm
  7562. }
  7563. if (!fn) {
  7564. vm._events[event] = null;
  7565. return vm
  7566. }
  7567. // specific handler
  7568. var cb;
  7569. var i = cbs.length;
  7570. while (i--) {
  7571. cb = cbs[i];
  7572. if (cb === fn || cb.fn === fn) {
  7573. cbs.splice(i, 1);
  7574. break
  7575. }
  7576. }
  7577. return vm
  7578. };
  7579. Vue.prototype.$emit = function (event) {
  7580. var vm = this;
  7581. if (true) {
  7582. var lowerCaseEvent = event.toLowerCase();
  7583. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  7584. tip(
  7585. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  7586. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  7587. "Note that HTML attributes are case-insensitive and you cannot use " +
  7588. "v-on to listen to camelCase events when using in-DOM templates. " +
  7589. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  7590. );
  7591. }
  7592. }
  7593. var cbs = vm._events[event];
  7594. if (cbs) {
  7595. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  7596. var args = toArray(arguments, 1);
  7597. var info = "event handler for \"" + event + "\"";
  7598. for (var i = 0, l = cbs.length; i < l; i++) {
  7599. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  7600. }
  7601. }
  7602. return vm
  7603. };
  7604. }
  7605. /* */
  7606. var activeInstance = null;
  7607. var isUpdatingChildComponent = false;
  7608. function setActiveInstance(vm) {
  7609. var prevActiveInstance = activeInstance;
  7610. activeInstance = vm;
  7611. return function () {
  7612. activeInstance = prevActiveInstance;
  7613. }
  7614. }
  7615. function initLifecycle (vm) {
  7616. var options = vm.$options;
  7617. // locate first non-abstract parent
  7618. var parent = options.parent;
  7619. if (parent && !options.abstract) {
  7620. while (parent.$options.abstract && parent.$parent) {
  7621. parent = parent.$parent;
  7622. }
  7623. parent.$children.push(vm);
  7624. }
  7625. vm.$parent = parent;
  7626. vm.$root = parent ? parent.$root : vm;
  7627. vm.$children = [];
  7628. vm.$refs = {};
  7629. vm._watcher = null;
  7630. vm._inactive = null;
  7631. vm._directInactive = false;
  7632. vm._isMounted = false;
  7633. vm._isDestroyed = false;
  7634. vm._isBeingDestroyed = false;
  7635. }
  7636. function lifecycleMixin (Vue) {
  7637. Vue.prototype._update = function (vnode, hydrating) {
  7638. var vm = this;
  7639. var prevEl = vm.$el;
  7640. var prevVnode = vm._vnode;
  7641. var restoreActiveInstance = setActiveInstance(vm);
  7642. vm._vnode = vnode;
  7643. // Vue.prototype.__patch__ is injected in entry points
  7644. // based on the rendering backend used.
  7645. if (!prevVnode) {
  7646. // initial render
  7647. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  7648. } else {
  7649. // updates
  7650. vm.$el = vm.__patch__(prevVnode, vnode);
  7651. }
  7652. restoreActiveInstance();
  7653. // update __vue__ reference
  7654. if (prevEl) {
  7655. prevEl.__vue__ = null;
  7656. }
  7657. if (vm.$el) {
  7658. vm.$el.__vue__ = vm;
  7659. }
  7660. // if parent is an HOC, update its $el as well
  7661. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  7662. vm.$parent.$el = vm.$el;
  7663. }
  7664. // updated hook is called by the scheduler to ensure that children are
  7665. // updated in a parent's updated hook.
  7666. };
  7667. Vue.prototype.$forceUpdate = function () {
  7668. var vm = this;
  7669. if (vm._watcher) {
  7670. vm._watcher.update();
  7671. }
  7672. };
  7673. Vue.prototype.$destroy = function () {
  7674. var vm = this;
  7675. if (vm._isBeingDestroyed) {
  7676. return
  7677. }
  7678. callHook(vm, 'beforeDestroy');
  7679. vm._isBeingDestroyed = true;
  7680. // remove self from parent
  7681. var parent = vm.$parent;
  7682. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  7683. remove(parent.$children, vm);
  7684. }
  7685. // teardown watchers
  7686. if (vm._watcher) {
  7687. vm._watcher.teardown();
  7688. }
  7689. var i = vm._watchers.length;
  7690. while (i--) {
  7691. vm._watchers[i].teardown();
  7692. }
  7693. // remove reference from data ob
  7694. // frozen object may not have observer.
  7695. if (vm._data.__ob__) {
  7696. vm._data.__ob__.vmCount--;
  7697. }
  7698. // call the last hook...
  7699. vm._isDestroyed = true;
  7700. // invoke destroy hooks on current rendered tree
  7701. vm.__patch__(vm._vnode, null);
  7702. // fire destroyed hook
  7703. callHook(vm, 'destroyed');
  7704. // turn off all instance listeners.
  7705. vm.$off();
  7706. // remove __vue__ reference
  7707. if (vm.$el) {
  7708. vm.$el.__vue__ = null;
  7709. }
  7710. // release circular reference (#6759)
  7711. if (vm.$vnode) {
  7712. vm.$vnode.parent = null;
  7713. }
  7714. };
  7715. }
  7716. function updateChildComponent (
  7717. vm,
  7718. propsData,
  7719. listeners,
  7720. parentVnode,
  7721. renderChildren
  7722. ) {
  7723. if (true) {
  7724. isUpdatingChildComponent = true;
  7725. }
  7726. // determine whether component has slot children
  7727. // we need to do this before overwriting $options._renderChildren.
  7728. // check if there are dynamic scopedSlots (hand-written or compiled but with
  7729. // dynamic slot names). Static scoped slots compiled from template has the
  7730. // "$stable" marker.
  7731. var newScopedSlots = parentVnode.data.scopedSlots;
  7732. var oldScopedSlots = vm.$scopedSlots;
  7733. var hasDynamicScopedSlot = !!(
  7734. (newScopedSlots && !newScopedSlots.$stable) ||
  7735. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  7736. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  7737. );
  7738. // Any static slot children from the parent may have changed during parent's
  7739. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  7740. // update is necessary to ensure correctness.
  7741. var needsForceUpdate = !!(
  7742. renderChildren || // has new static slots
  7743. vm.$options._renderChildren || // has old static slots
  7744. hasDynamicScopedSlot
  7745. );
  7746. vm.$options._parentVnode = parentVnode;
  7747. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  7748. if (vm._vnode) { // update child tree's parent
  7749. vm._vnode.parent = parentVnode;
  7750. }
  7751. vm.$options._renderChildren = renderChildren;
  7752. // update $attrs and $listeners hash
  7753. // these are also reactive so they may trigger child update if the child
  7754. // used them during render
  7755. vm.$attrs = parentVnode.data.attrs || emptyObject;
  7756. vm.$listeners = listeners || emptyObject;
  7757. // update props
  7758. if (propsData && vm.$options.props) {
  7759. toggleObserving(false);
  7760. var props = vm._props;
  7761. var propKeys = vm.$options._propKeys || [];
  7762. for (var i = 0; i < propKeys.length; i++) {
  7763. var key = propKeys[i];
  7764. var propOptions = vm.$options.props; // wtf flow?
  7765. props[key] = validateProp(key, propOptions, propsData, vm);
  7766. }
  7767. toggleObserving(true);
  7768. // keep a copy of raw propsData
  7769. vm.$options.propsData = propsData;
  7770. }
  7771. // fixed by xxxxxx update properties(mp runtime)
  7772. vm._$updateProperties && vm._$updateProperties(vm);
  7773. // update listeners
  7774. listeners = listeners || emptyObject;
  7775. var oldListeners = vm.$options._parentListeners;
  7776. vm.$options._parentListeners = listeners;
  7777. updateComponentListeners(vm, listeners, oldListeners);
  7778. // resolve slots + force update if has children
  7779. if (needsForceUpdate) {
  7780. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  7781. vm.$forceUpdate();
  7782. }
  7783. if (true) {
  7784. isUpdatingChildComponent = false;
  7785. }
  7786. }
  7787. function isInInactiveTree (vm) {
  7788. while (vm && (vm = vm.$parent)) {
  7789. if (vm._inactive) { return true }
  7790. }
  7791. return false
  7792. }
  7793. function activateChildComponent (vm, direct) {
  7794. if (direct) {
  7795. vm._directInactive = false;
  7796. if (isInInactiveTree(vm)) {
  7797. return
  7798. }
  7799. } else if (vm._directInactive) {
  7800. return
  7801. }
  7802. if (vm._inactive || vm._inactive === null) {
  7803. vm._inactive = false;
  7804. for (var i = 0; i < vm.$children.length; i++) {
  7805. activateChildComponent(vm.$children[i]);
  7806. }
  7807. callHook(vm, 'activated');
  7808. }
  7809. }
  7810. function deactivateChildComponent (vm, direct) {
  7811. if (direct) {
  7812. vm._directInactive = true;
  7813. if (isInInactiveTree(vm)) {
  7814. return
  7815. }
  7816. }
  7817. if (!vm._inactive) {
  7818. vm._inactive = true;
  7819. for (var i = 0; i < vm.$children.length; i++) {
  7820. deactivateChildComponent(vm.$children[i]);
  7821. }
  7822. callHook(vm, 'deactivated');
  7823. }
  7824. }
  7825. function callHook (vm, hook) {
  7826. // #7573 disable dep collection when invoking lifecycle hooks
  7827. pushTarget();
  7828. var handlers = vm.$options[hook];
  7829. var info = hook + " hook";
  7830. if (handlers) {
  7831. for (var i = 0, j = handlers.length; i < j; i++) {
  7832. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  7833. }
  7834. }
  7835. if (vm._hasHookEvent) {
  7836. vm.$emit('hook:' + hook);
  7837. }
  7838. popTarget();
  7839. }
  7840. /* */
  7841. var MAX_UPDATE_COUNT = 100;
  7842. var queue = [];
  7843. var activatedChildren = [];
  7844. var has = {};
  7845. var circular = {};
  7846. var waiting = false;
  7847. var flushing = false;
  7848. var index = 0;
  7849. /**
  7850. * Reset the scheduler's state.
  7851. */
  7852. function resetSchedulerState () {
  7853. index = queue.length = activatedChildren.length = 0;
  7854. has = {};
  7855. if (true) {
  7856. circular = {};
  7857. }
  7858. waiting = flushing = false;
  7859. }
  7860. // Async edge case #6566 requires saving the timestamp when event listeners are
  7861. // attached. However, calling performance.now() has a perf overhead especially
  7862. // if the page has thousands of event listeners. Instead, we take a timestamp
  7863. // every time the scheduler flushes and use that for all event listeners
  7864. // attached during that flush.
  7865. var currentFlushTimestamp = 0;
  7866. // Async edge case fix requires storing an event listener's attach timestamp.
  7867. var getNow = Date.now;
  7868. // Determine what event timestamp the browser is using. Annoyingly, the
  7869. // timestamp can either be hi-res (relative to page load) or low-res
  7870. // (relative to UNIX epoch), so in order to compare time we have to use the
  7871. // same timestamp type when saving the flush timestamp.
  7872. // All IE versions use low-res event timestamps, and have problematic clock
  7873. // implementations (#9632)
  7874. if (inBrowser && !isIE) {
  7875. var performance = window.performance;
  7876. if (
  7877. performance &&
  7878. typeof performance.now === 'function' &&
  7879. getNow() > document.createEvent('Event').timeStamp
  7880. ) {
  7881. // if the event timestamp, although evaluated AFTER the Date.now(), is
  7882. // smaller than it, it means the event is using a hi-res timestamp,
  7883. // and we need to use the hi-res version for event listener timestamps as
  7884. // well.
  7885. getNow = function () { return performance.now(); };
  7886. }
  7887. }
  7888. /**
  7889. * Flush both queues and run the watchers.
  7890. */
  7891. function flushSchedulerQueue () {
  7892. currentFlushTimestamp = getNow();
  7893. flushing = true;
  7894. var watcher, id;
  7895. // Sort queue before flush.
  7896. // This ensures that:
  7897. // 1. Components are updated from parent to child. (because parent is always
  7898. // created before the child)
  7899. // 2. A component's user watchers are run before its render watcher (because
  7900. // user watchers are created before the render watcher)
  7901. // 3. If a component is destroyed during a parent component's watcher run,
  7902. // its watchers can be skipped.
  7903. queue.sort(function (a, b) { return a.id - b.id; });
  7904. // do not cache length because more watchers might be pushed
  7905. // as we run existing watchers
  7906. for (index = 0; index < queue.length; index++) {
  7907. watcher = queue[index];
  7908. if (watcher.before) {
  7909. watcher.before();
  7910. }
  7911. id = watcher.id;
  7912. has[id] = null;
  7913. watcher.run();
  7914. // in dev build, check and stop circular updates.
  7915. if ( true && has[id] != null) {
  7916. circular[id] = (circular[id] || 0) + 1;
  7917. if (circular[id] > MAX_UPDATE_COUNT) {
  7918. warn(
  7919. 'You may have an infinite update loop ' + (
  7920. watcher.user
  7921. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  7922. : "in a component render function."
  7923. ),
  7924. watcher.vm
  7925. );
  7926. break
  7927. }
  7928. }
  7929. }
  7930. // keep copies of post queues before resetting state
  7931. var activatedQueue = activatedChildren.slice();
  7932. var updatedQueue = queue.slice();
  7933. resetSchedulerState();
  7934. // call component updated and activated hooks
  7935. callActivatedHooks(activatedQueue);
  7936. callUpdatedHooks(updatedQueue);
  7937. // devtool hook
  7938. /* istanbul ignore if */
  7939. if (devtools && config.devtools) {
  7940. devtools.emit('flush');
  7941. }
  7942. }
  7943. function callUpdatedHooks (queue) {
  7944. var i = queue.length;
  7945. while (i--) {
  7946. var watcher = queue[i];
  7947. var vm = watcher.vm;
  7948. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  7949. callHook(vm, 'updated');
  7950. }
  7951. }
  7952. }
  7953. /**
  7954. * Queue a kept-alive component that was activated during patch.
  7955. * The queue will be processed after the entire tree has been patched.
  7956. */
  7957. function queueActivatedComponent (vm) {
  7958. // setting _inactive to false here so that a render function can
  7959. // rely on checking whether it's in an inactive tree (e.g. router-view)
  7960. vm._inactive = false;
  7961. activatedChildren.push(vm);
  7962. }
  7963. function callActivatedHooks (queue) {
  7964. for (var i = 0; i < queue.length; i++) {
  7965. queue[i]._inactive = true;
  7966. activateChildComponent(queue[i], true /* true */);
  7967. }
  7968. }
  7969. /**
  7970. * Push a watcher into the watcher queue.
  7971. * Jobs with duplicate IDs will be skipped unless it's
  7972. * pushed when the queue is being flushed.
  7973. */
  7974. function queueWatcher (watcher) {
  7975. var id = watcher.id;
  7976. if (has[id] == null) {
  7977. has[id] = true;
  7978. if (!flushing) {
  7979. queue.push(watcher);
  7980. } else {
  7981. // if already flushing, splice the watcher based on its id
  7982. // if already past its id, it will be run next immediately.
  7983. var i = queue.length - 1;
  7984. while (i > index && queue[i].id > watcher.id) {
  7985. i--;
  7986. }
  7987. queue.splice(i + 1, 0, watcher);
  7988. }
  7989. // queue the flush
  7990. if (!waiting) {
  7991. waiting = true;
  7992. if ( true && !config.async) {
  7993. flushSchedulerQueue();
  7994. return
  7995. }
  7996. nextTick(flushSchedulerQueue);
  7997. }
  7998. }
  7999. }
  8000. /* */
  8001. var uid$2 = 0;
  8002. /**
  8003. * A watcher parses an expression, collects dependencies,
  8004. * and fires callback when the expression value changes.
  8005. * This is used for both the $watch() api and directives.
  8006. */
  8007. var Watcher = function Watcher (
  8008. vm,
  8009. expOrFn,
  8010. cb,
  8011. options,
  8012. isRenderWatcher
  8013. ) {
  8014. this.vm = vm;
  8015. if (isRenderWatcher) {
  8016. vm._watcher = this;
  8017. }
  8018. vm._watchers.push(this);
  8019. // options
  8020. if (options) {
  8021. this.deep = !!options.deep;
  8022. this.user = !!options.user;
  8023. this.lazy = !!options.lazy;
  8024. this.sync = !!options.sync;
  8025. this.before = options.before;
  8026. } else {
  8027. this.deep = this.user = this.lazy = this.sync = false;
  8028. }
  8029. this.cb = cb;
  8030. this.id = ++uid$2; // uid for batching
  8031. this.active = true;
  8032. this.dirty = this.lazy; // for lazy watchers
  8033. this.deps = [];
  8034. this.newDeps = [];
  8035. this.depIds = new _Set();
  8036. this.newDepIds = new _Set();
  8037. this.expression = true
  8038. ? expOrFn.toString()
  8039. : undefined;
  8040. // parse expression for getter
  8041. if (typeof expOrFn === 'function') {
  8042. this.getter = expOrFn;
  8043. } else {
  8044. this.getter = parsePath(expOrFn);
  8045. if (!this.getter) {
  8046. this.getter = noop;
  8047. true && warn(
  8048. "Failed watching path: \"" + expOrFn + "\" " +
  8049. 'Watcher only accepts simple dot-delimited paths. ' +
  8050. 'For full control, use a function instead.',
  8051. vm
  8052. );
  8053. }
  8054. }
  8055. this.value = this.lazy
  8056. ? undefined
  8057. : this.get();
  8058. };
  8059. /**
  8060. * Evaluate the getter, and re-collect dependencies.
  8061. */
  8062. Watcher.prototype.get = function get () {
  8063. pushTarget(this);
  8064. var value;
  8065. var vm = this.vm;
  8066. try {
  8067. value = this.getter.call(vm, vm);
  8068. } catch (e) {
  8069. if (this.user) {
  8070. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  8071. } else {
  8072. throw e
  8073. }
  8074. } finally {
  8075. // "touch" every property so they are all tracked as
  8076. // dependencies for deep watching
  8077. if (this.deep) {
  8078. traverse(value);
  8079. }
  8080. popTarget();
  8081. this.cleanupDeps();
  8082. }
  8083. return value
  8084. };
  8085. /**
  8086. * Add a dependency to this directive.
  8087. */
  8088. Watcher.prototype.addDep = function addDep (dep) {
  8089. var id = dep.id;
  8090. if (!this.newDepIds.has(id)) {
  8091. this.newDepIds.add(id);
  8092. this.newDeps.push(dep);
  8093. if (!this.depIds.has(id)) {
  8094. dep.addSub(this);
  8095. }
  8096. }
  8097. };
  8098. /**
  8099. * Clean up for dependency collection.
  8100. */
  8101. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  8102. var i = this.deps.length;
  8103. while (i--) {
  8104. var dep = this.deps[i];
  8105. if (!this.newDepIds.has(dep.id)) {
  8106. dep.removeSub(this);
  8107. }
  8108. }
  8109. var tmp = this.depIds;
  8110. this.depIds = this.newDepIds;
  8111. this.newDepIds = tmp;
  8112. this.newDepIds.clear();
  8113. tmp = this.deps;
  8114. this.deps = this.newDeps;
  8115. this.newDeps = tmp;
  8116. this.newDeps.length = 0;
  8117. };
  8118. /**
  8119. * Subscriber interface.
  8120. * Will be called when a dependency changes.
  8121. */
  8122. Watcher.prototype.update = function update () {
  8123. /* istanbul ignore else */
  8124. if (this.lazy) {
  8125. this.dirty = true;
  8126. } else if (this.sync) {
  8127. this.run();
  8128. } else {
  8129. queueWatcher(this);
  8130. }
  8131. };
  8132. /**
  8133. * Scheduler job interface.
  8134. * Will be called by the scheduler.
  8135. */
  8136. Watcher.prototype.run = function run () {
  8137. if (this.active) {
  8138. var value = this.get();
  8139. if (
  8140. value !== this.value ||
  8141. // Deep watchers and watchers on Object/Arrays should fire even
  8142. // when the value is the same, because the value may
  8143. // have mutated.
  8144. isObject(value) ||
  8145. this.deep
  8146. ) {
  8147. // set new value
  8148. var oldValue = this.value;
  8149. this.value = value;
  8150. if (this.user) {
  8151. try {
  8152. this.cb.call(this.vm, value, oldValue);
  8153. } catch (e) {
  8154. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  8155. }
  8156. } else {
  8157. this.cb.call(this.vm, value, oldValue);
  8158. }
  8159. }
  8160. }
  8161. };
  8162. /**
  8163. * Evaluate the value of the watcher.
  8164. * This only gets called for lazy watchers.
  8165. */
  8166. Watcher.prototype.evaluate = function evaluate () {
  8167. this.value = this.get();
  8168. this.dirty = false;
  8169. };
  8170. /**
  8171. * Depend on all deps collected by this watcher.
  8172. */
  8173. Watcher.prototype.depend = function depend () {
  8174. var i = this.deps.length;
  8175. while (i--) {
  8176. this.deps[i].depend();
  8177. }
  8178. };
  8179. /**
  8180. * Remove self from all dependencies' subscriber list.
  8181. */
  8182. Watcher.prototype.teardown = function teardown () {
  8183. if (this.active) {
  8184. // remove self from vm's watcher list
  8185. // this is a somewhat expensive operation so we skip it
  8186. // if the vm is being destroyed.
  8187. if (!this.vm._isBeingDestroyed) {
  8188. remove(this.vm._watchers, this);
  8189. }
  8190. var i = this.deps.length;
  8191. while (i--) {
  8192. this.deps[i].removeSub(this);
  8193. }
  8194. this.active = false;
  8195. }
  8196. };
  8197. /* */
  8198. var sharedPropertyDefinition = {
  8199. enumerable: true,
  8200. configurable: true,
  8201. get: noop,
  8202. set: noop
  8203. };
  8204. function proxy (target, sourceKey, key) {
  8205. sharedPropertyDefinition.get = function proxyGetter () {
  8206. return this[sourceKey][key]
  8207. };
  8208. sharedPropertyDefinition.set = function proxySetter (val) {
  8209. this[sourceKey][key] = val;
  8210. };
  8211. Object.defineProperty(target, key, sharedPropertyDefinition);
  8212. }
  8213. function initState (vm) {
  8214. vm._watchers = [];
  8215. var opts = vm.$options;
  8216. if (opts.props) { initProps(vm, opts.props); }
  8217. if (opts.methods) { initMethods(vm, opts.methods); }
  8218. if (opts.data) {
  8219. initData(vm);
  8220. } else {
  8221. observe(vm._data = {}, true /* asRootData */);
  8222. }
  8223. if (opts.computed) { initComputed(vm, opts.computed); }
  8224. if (opts.watch && opts.watch !== nativeWatch) {
  8225. initWatch(vm, opts.watch);
  8226. }
  8227. }
  8228. function initProps (vm, propsOptions) {
  8229. var propsData = vm.$options.propsData || {};
  8230. var props = vm._props = {};
  8231. // cache prop keys so that future props updates can iterate using Array
  8232. // instead of dynamic object key enumeration.
  8233. var keys = vm.$options._propKeys = [];
  8234. var isRoot = !vm.$parent;
  8235. // root instance props should be converted
  8236. if (!isRoot) {
  8237. toggleObserving(false);
  8238. }
  8239. var loop = function ( key ) {
  8240. keys.push(key);
  8241. var value = validateProp(key, propsOptions, propsData, vm);
  8242. /* istanbul ignore else */
  8243. if (true) {
  8244. var hyphenatedKey = hyphenate(key);
  8245. if (isReservedAttribute(hyphenatedKey) ||
  8246. config.isReservedAttr(hyphenatedKey)) {
  8247. warn(
  8248. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  8249. vm
  8250. );
  8251. }
  8252. defineReactive$$1(props, key, value, function () {
  8253. if (!isRoot && !isUpdatingChildComponent) {
  8254. {
  8255. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  8256. return
  8257. }
  8258. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  8259. if(
  8260. key === 'value' &&
  8261. Array.isArray(vm.$options.behaviors) &&
  8262. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  8263. ){
  8264. return
  8265. }
  8266. if(vm._getFormData){
  8267. return
  8268. }
  8269. var $parent = vm.$parent;
  8270. while($parent){
  8271. if($parent.__next_tick_pending){
  8272. return
  8273. }
  8274. $parent = $parent.$parent;
  8275. }
  8276. }
  8277. warn(
  8278. "Avoid mutating a prop directly since the value will be " +
  8279. "overwritten whenever the parent component re-renders. " +
  8280. "Instead, use a data or computed property based on the prop's " +
  8281. "value. Prop being mutated: \"" + key + "\"",
  8282. vm
  8283. );
  8284. }
  8285. });
  8286. } else {}
  8287. // static props are already proxied on the component's prototype
  8288. // during Vue.extend(). We only need to proxy props defined at
  8289. // instantiation here.
  8290. if (!(key in vm)) {
  8291. proxy(vm, "_props", key);
  8292. }
  8293. };
  8294. for (var key in propsOptions) loop( key );
  8295. toggleObserving(true);
  8296. }
  8297. function initData (vm) {
  8298. var data = vm.$options.data;
  8299. data = vm._data = typeof data === 'function'
  8300. ? getData(data, vm)
  8301. : data || {};
  8302. if (!isPlainObject(data)) {
  8303. data = {};
  8304. true && warn(
  8305. 'data functions should return an object:\n' +
  8306. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  8307. vm
  8308. );
  8309. }
  8310. // proxy data on instance
  8311. var keys = Object.keys(data);
  8312. var props = vm.$options.props;
  8313. var methods = vm.$options.methods;
  8314. var i = keys.length;
  8315. while (i--) {
  8316. var key = keys[i];
  8317. if (true) {
  8318. if (methods && hasOwn(methods, key)) {
  8319. warn(
  8320. ("Method \"" + key + "\" has already been defined as a data property."),
  8321. vm
  8322. );
  8323. }
  8324. }
  8325. if (props && hasOwn(props, key)) {
  8326. true && warn(
  8327. "The data property \"" + key + "\" is already declared as a prop. " +
  8328. "Use prop default value instead.",
  8329. vm
  8330. );
  8331. } else if (!isReserved(key)) {
  8332. proxy(vm, "_data", key);
  8333. }
  8334. }
  8335. // observe data
  8336. observe(data, true /* asRootData */);
  8337. }
  8338. function getData (data, vm) {
  8339. // #7573 disable dep collection when invoking data getters
  8340. pushTarget();
  8341. try {
  8342. return data.call(vm, vm)
  8343. } catch (e) {
  8344. handleError(e, vm, "data()");
  8345. return {}
  8346. } finally {
  8347. popTarget();
  8348. }
  8349. }
  8350. var computedWatcherOptions = { lazy: true };
  8351. function initComputed (vm, computed) {
  8352. // $flow-disable-line
  8353. var watchers = vm._computedWatchers = Object.create(null);
  8354. // computed properties are just getters during SSR
  8355. var isSSR = isServerRendering();
  8356. for (var key in computed) {
  8357. var userDef = computed[key];
  8358. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  8359. if ( true && getter == null) {
  8360. warn(
  8361. ("Getter is missing for computed property \"" + key + "\"."),
  8362. vm
  8363. );
  8364. }
  8365. if (!isSSR) {
  8366. // create internal watcher for the computed property.
  8367. watchers[key] = new Watcher(
  8368. vm,
  8369. getter || noop,
  8370. noop,
  8371. computedWatcherOptions
  8372. );
  8373. }
  8374. // component-defined computed properties are already defined on the
  8375. // component prototype. We only need to define computed properties defined
  8376. // at instantiation here.
  8377. if (!(key in vm)) {
  8378. defineComputed(vm, key, userDef);
  8379. } else if (true) {
  8380. if (key in vm.$data) {
  8381. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  8382. } else if (vm.$options.props && key in vm.$options.props) {
  8383. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  8384. }
  8385. }
  8386. }
  8387. }
  8388. function defineComputed (
  8389. target,
  8390. key,
  8391. userDef
  8392. ) {
  8393. var shouldCache = !isServerRendering();
  8394. if (typeof userDef === 'function') {
  8395. sharedPropertyDefinition.get = shouldCache
  8396. ? createComputedGetter(key)
  8397. : createGetterInvoker(userDef);
  8398. sharedPropertyDefinition.set = noop;
  8399. } else {
  8400. sharedPropertyDefinition.get = userDef.get
  8401. ? shouldCache && userDef.cache !== false
  8402. ? createComputedGetter(key)
  8403. : createGetterInvoker(userDef.get)
  8404. : noop;
  8405. sharedPropertyDefinition.set = userDef.set || noop;
  8406. }
  8407. if ( true &&
  8408. sharedPropertyDefinition.set === noop) {
  8409. sharedPropertyDefinition.set = function () {
  8410. warn(
  8411. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  8412. this
  8413. );
  8414. };
  8415. }
  8416. Object.defineProperty(target, key, sharedPropertyDefinition);
  8417. }
  8418. function createComputedGetter (key) {
  8419. return function computedGetter () {
  8420. var watcher = this._computedWatchers && this._computedWatchers[key];
  8421. if (watcher) {
  8422. if (watcher.dirty) {
  8423. watcher.evaluate();
  8424. }
  8425. if (Dep.SharedObject.target) {// fixed by xxxxxx
  8426. watcher.depend();
  8427. }
  8428. return watcher.value
  8429. }
  8430. }
  8431. }
  8432. function createGetterInvoker(fn) {
  8433. return function computedGetter () {
  8434. return fn.call(this, this)
  8435. }
  8436. }
  8437. function initMethods (vm, methods) {
  8438. var props = vm.$options.props;
  8439. for (var key in methods) {
  8440. if (true) {
  8441. if (typeof methods[key] !== 'function') {
  8442. warn(
  8443. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  8444. "Did you reference the function correctly?",
  8445. vm
  8446. );
  8447. }
  8448. if (props && hasOwn(props, key)) {
  8449. warn(
  8450. ("Method \"" + key + "\" has already been defined as a prop."),
  8451. vm
  8452. );
  8453. }
  8454. if ((key in vm) && isReserved(key)) {
  8455. warn(
  8456. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  8457. "Avoid defining component methods that start with _ or $."
  8458. );
  8459. }
  8460. }
  8461. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  8462. }
  8463. }
  8464. function initWatch (vm, watch) {
  8465. for (var key in watch) {
  8466. var handler = watch[key];
  8467. if (Array.isArray(handler)) {
  8468. for (var i = 0; i < handler.length; i++) {
  8469. createWatcher(vm, key, handler[i]);
  8470. }
  8471. } else {
  8472. createWatcher(vm, key, handler);
  8473. }
  8474. }
  8475. }
  8476. function createWatcher (
  8477. vm,
  8478. expOrFn,
  8479. handler,
  8480. options
  8481. ) {
  8482. if (isPlainObject(handler)) {
  8483. options = handler;
  8484. handler = handler.handler;
  8485. }
  8486. if (typeof handler === 'string') {
  8487. handler = vm[handler];
  8488. }
  8489. return vm.$watch(expOrFn, handler, options)
  8490. }
  8491. function stateMixin (Vue) {
  8492. // flow somehow has problems with directly declared definition object
  8493. // when using Object.defineProperty, so we have to procedurally build up
  8494. // the object here.
  8495. var dataDef = {};
  8496. dataDef.get = function () { return this._data };
  8497. var propsDef = {};
  8498. propsDef.get = function () { return this._props };
  8499. if (true) {
  8500. dataDef.set = function () {
  8501. warn(
  8502. 'Avoid replacing instance root $data. ' +
  8503. 'Use nested data properties instead.',
  8504. this
  8505. );
  8506. };
  8507. propsDef.set = function () {
  8508. warn("$props is readonly.", this);
  8509. };
  8510. }
  8511. Object.defineProperty(Vue.prototype, '$data', dataDef);
  8512. Object.defineProperty(Vue.prototype, '$props', propsDef);
  8513. Vue.prototype.$set = set;
  8514. Vue.prototype.$delete = del;
  8515. Vue.prototype.$watch = function (
  8516. expOrFn,
  8517. cb,
  8518. options
  8519. ) {
  8520. var vm = this;
  8521. if (isPlainObject(cb)) {
  8522. return createWatcher(vm, expOrFn, cb, options)
  8523. }
  8524. options = options || {};
  8525. options.user = true;
  8526. var watcher = new Watcher(vm, expOrFn, cb, options);
  8527. if (options.immediate) {
  8528. try {
  8529. cb.call(vm, watcher.value);
  8530. } catch (error) {
  8531. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  8532. }
  8533. }
  8534. return function unwatchFn () {
  8535. watcher.teardown();
  8536. }
  8537. };
  8538. }
  8539. /* */
  8540. var uid$3 = 0;
  8541. function initMixin (Vue) {
  8542. Vue.prototype._init = function (options) {
  8543. var vm = this;
  8544. // a uid
  8545. vm._uid = uid$3++;
  8546. var startTag, endTag;
  8547. /* istanbul ignore if */
  8548. if ( true && config.performance && mark) {
  8549. startTag = "vue-perf-start:" + (vm._uid);
  8550. endTag = "vue-perf-end:" + (vm._uid);
  8551. mark(startTag);
  8552. }
  8553. // a flag to avoid this being observed
  8554. vm._isVue = true;
  8555. // merge options
  8556. if (options && options._isComponent) {
  8557. // optimize internal component instantiation
  8558. // since dynamic options merging is pretty slow, and none of the
  8559. // internal component options needs special treatment.
  8560. initInternalComponent(vm, options);
  8561. } else {
  8562. vm.$options = mergeOptions(
  8563. resolveConstructorOptions(vm.constructor),
  8564. options || {},
  8565. vm
  8566. );
  8567. }
  8568. /* istanbul ignore else */
  8569. if (true) {
  8570. initProxy(vm);
  8571. } else {}
  8572. // expose real self
  8573. vm._self = vm;
  8574. initLifecycle(vm);
  8575. initEvents(vm);
  8576. initRender(vm);
  8577. callHook(vm, 'beforeCreate');
  8578. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  8579. initState(vm);
  8580. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  8581. !vm._$fallback && callHook(vm, 'created');
  8582. /* istanbul ignore if */
  8583. if ( true && config.performance && mark) {
  8584. vm._name = formatComponentName(vm, false);
  8585. mark(endTag);
  8586. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  8587. }
  8588. if (vm.$options.el) {
  8589. vm.$mount(vm.$options.el);
  8590. }
  8591. };
  8592. }
  8593. function initInternalComponent (vm, options) {
  8594. var opts = vm.$options = Object.create(vm.constructor.options);
  8595. // doing this because it's faster than dynamic enumeration.
  8596. var parentVnode = options._parentVnode;
  8597. opts.parent = options.parent;
  8598. opts._parentVnode = parentVnode;
  8599. var vnodeComponentOptions = parentVnode.componentOptions;
  8600. opts.propsData = vnodeComponentOptions.propsData;
  8601. opts._parentListeners = vnodeComponentOptions.listeners;
  8602. opts._renderChildren = vnodeComponentOptions.children;
  8603. opts._componentTag = vnodeComponentOptions.tag;
  8604. if (options.render) {
  8605. opts.render = options.render;
  8606. opts.staticRenderFns = options.staticRenderFns;
  8607. }
  8608. }
  8609. function resolveConstructorOptions (Ctor) {
  8610. var options = Ctor.options;
  8611. if (Ctor.super) {
  8612. var superOptions = resolveConstructorOptions(Ctor.super);
  8613. var cachedSuperOptions = Ctor.superOptions;
  8614. if (superOptions !== cachedSuperOptions) {
  8615. // super option changed,
  8616. // need to resolve new options.
  8617. Ctor.superOptions = superOptions;
  8618. // check if there are any late-modified/attached options (#4976)
  8619. var modifiedOptions = resolveModifiedOptions(Ctor);
  8620. // update base extend options
  8621. if (modifiedOptions) {
  8622. extend(Ctor.extendOptions, modifiedOptions);
  8623. }
  8624. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  8625. if (options.name) {
  8626. options.components[options.name] = Ctor;
  8627. }
  8628. }
  8629. }
  8630. return options
  8631. }
  8632. function resolveModifiedOptions (Ctor) {
  8633. var modified;
  8634. var latest = Ctor.options;
  8635. var sealed = Ctor.sealedOptions;
  8636. for (var key in latest) {
  8637. if (latest[key] !== sealed[key]) {
  8638. if (!modified) { modified = {}; }
  8639. modified[key] = latest[key];
  8640. }
  8641. }
  8642. return modified
  8643. }
  8644. function Vue (options) {
  8645. if ( true &&
  8646. !(this instanceof Vue)
  8647. ) {
  8648. warn('Vue is a constructor and should be called with the `new` keyword');
  8649. }
  8650. this._init(options);
  8651. }
  8652. initMixin(Vue);
  8653. stateMixin(Vue);
  8654. eventsMixin(Vue);
  8655. lifecycleMixin(Vue);
  8656. renderMixin(Vue);
  8657. /* */
  8658. function initUse (Vue) {
  8659. Vue.use = function (plugin) {
  8660. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  8661. if (installedPlugins.indexOf(plugin) > -1) {
  8662. return this
  8663. }
  8664. // additional parameters
  8665. var args = toArray(arguments, 1);
  8666. args.unshift(this);
  8667. if (typeof plugin.install === 'function') {
  8668. plugin.install.apply(plugin, args);
  8669. } else if (typeof plugin === 'function') {
  8670. plugin.apply(null, args);
  8671. }
  8672. installedPlugins.push(plugin);
  8673. return this
  8674. };
  8675. }
  8676. /* */
  8677. function initMixin$1 (Vue) {
  8678. Vue.mixin = function (mixin) {
  8679. this.options = mergeOptions(this.options, mixin);
  8680. return this
  8681. };
  8682. }
  8683. /* */
  8684. function initExtend (Vue) {
  8685. /**
  8686. * Each instance constructor, including Vue, has a unique
  8687. * cid. This enables us to create wrapped "child
  8688. * constructors" for prototypal inheritance and cache them.
  8689. */
  8690. Vue.cid = 0;
  8691. var cid = 1;
  8692. /**
  8693. * Class inheritance
  8694. */
  8695. Vue.extend = function (extendOptions) {
  8696. extendOptions = extendOptions || {};
  8697. var Super = this;
  8698. var SuperId = Super.cid;
  8699. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  8700. if (cachedCtors[SuperId]) {
  8701. return cachedCtors[SuperId]
  8702. }
  8703. var name = extendOptions.name || Super.options.name;
  8704. if ( true && name) {
  8705. validateComponentName(name);
  8706. }
  8707. var Sub = function VueComponent (options) {
  8708. this._init(options);
  8709. };
  8710. Sub.prototype = Object.create(Super.prototype);
  8711. Sub.prototype.constructor = Sub;
  8712. Sub.cid = cid++;
  8713. Sub.options = mergeOptions(
  8714. Super.options,
  8715. extendOptions
  8716. );
  8717. Sub['super'] = Super;
  8718. // For props and computed properties, we define the proxy getters on
  8719. // the Vue instances at extension time, on the extended prototype. This
  8720. // avoids Object.defineProperty calls for each instance created.
  8721. if (Sub.options.props) {
  8722. initProps$1(Sub);
  8723. }
  8724. if (Sub.options.computed) {
  8725. initComputed$1(Sub);
  8726. }
  8727. // allow further extension/mixin/plugin usage
  8728. Sub.extend = Super.extend;
  8729. Sub.mixin = Super.mixin;
  8730. Sub.use = Super.use;
  8731. // create asset registers, so extended classes
  8732. // can have their private assets too.
  8733. ASSET_TYPES.forEach(function (type) {
  8734. Sub[type] = Super[type];
  8735. });
  8736. // enable recursive self-lookup
  8737. if (name) {
  8738. Sub.options.components[name] = Sub;
  8739. }
  8740. // keep a reference to the super options at extension time.
  8741. // later at instantiation we can check if Super's options have
  8742. // been updated.
  8743. Sub.superOptions = Super.options;
  8744. Sub.extendOptions = extendOptions;
  8745. Sub.sealedOptions = extend({}, Sub.options);
  8746. // cache constructor
  8747. cachedCtors[SuperId] = Sub;
  8748. return Sub
  8749. };
  8750. }
  8751. function initProps$1 (Comp) {
  8752. var props = Comp.options.props;
  8753. for (var key in props) {
  8754. proxy(Comp.prototype, "_props", key);
  8755. }
  8756. }
  8757. function initComputed$1 (Comp) {
  8758. var computed = Comp.options.computed;
  8759. for (var key in computed) {
  8760. defineComputed(Comp.prototype, key, computed[key]);
  8761. }
  8762. }
  8763. /* */
  8764. function initAssetRegisters (Vue) {
  8765. /**
  8766. * Create asset registration methods.
  8767. */
  8768. ASSET_TYPES.forEach(function (type) {
  8769. Vue[type] = function (
  8770. id,
  8771. definition
  8772. ) {
  8773. if (!definition) {
  8774. return this.options[type + 's'][id]
  8775. } else {
  8776. /* istanbul ignore if */
  8777. if ( true && type === 'component') {
  8778. validateComponentName(id);
  8779. }
  8780. if (type === 'component' && isPlainObject(definition)) {
  8781. definition.name = definition.name || id;
  8782. definition = this.options._base.extend(definition);
  8783. }
  8784. if (type === 'directive' && typeof definition === 'function') {
  8785. definition = { bind: definition, update: definition };
  8786. }
  8787. this.options[type + 's'][id] = definition;
  8788. return definition
  8789. }
  8790. };
  8791. });
  8792. }
  8793. /* */
  8794. function getComponentName (opts) {
  8795. return opts && (opts.Ctor.options.name || opts.tag)
  8796. }
  8797. function matches (pattern, name) {
  8798. if (Array.isArray(pattern)) {
  8799. return pattern.indexOf(name) > -1
  8800. } else if (typeof pattern === 'string') {
  8801. return pattern.split(',').indexOf(name) > -1
  8802. } else if (isRegExp(pattern)) {
  8803. return pattern.test(name)
  8804. }
  8805. /* istanbul ignore next */
  8806. return false
  8807. }
  8808. function pruneCache (keepAliveInstance, filter) {
  8809. var cache = keepAliveInstance.cache;
  8810. var keys = keepAliveInstance.keys;
  8811. var _vnode = keepAliveInstance._vnode;
  8812. for (var key in cache) {
  8813. var cachedNode = cache[key];
  8814. if (cachedNode) {
  8815. var name = getComponentName(cachedNode.componentOptions);
  8816. if (name && !filter(name)) {
  8817. pruneCacheEntry(cache, key, keys, _vnode);
  8818. }
  8819. }
  8820. }
  8821. }
  8822. function pruneCacheEntry (
  8823. cache,
  8824. key,
  8825. keys,
  8826. current
  8827. ) {
  8828. var cached$$1 = cache[key];
  8829. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  8830. cached$$1.componentInstance.$destroy();
  8831. }
  8832. cache[key] = null;
  8833. remove(keys, key);
  8834. }
  8835. var patternTypes = [String, RegExp, Array];
  8836. var KeepAlive = {
  8837. name: 'keep-alive',
  8838. abstract: true,
  8839. props: {
  8840. include: patternTypes,
  8841. exclude: patternTypes,
  8842. max: [String, Number]
  8843. },
  8844. created: function created () {
  8845. this.cache = Object.create(null);
  8846. this.keys = [];
  8847. },
  8848. destroyed: function destroyed () {
  8849. for (var key in this.cache) {
  8850. pruneCacheEntry(this.cache, key, this.keys);
  8851. }
  8852. },
  8853. mounted: function mounted () {
  8854. var this$1 = this;
  8855. this.$watch('include', function (val) {
  8856. pruneCache(this$1, function (name) { return matches(val, name); });
  8857. });
  8858. this.$watch('exclude', function (val) {
  8859. pruneCache(this$1, function (name) { return !matches(val, name); });
  8860. });
  8861. },
  8862. render: function render () {
  8863. var slot = this.$slots.default;
  8864. var vnode = getFirstComponentChild(slot);
  8865. var componentOptions = vnode && vnode.componentOptions;
  8866. if (componentOptions) {
  8867. // check pattern
  8868. var name = getComponentName(componentOptions);
  8869. var ref = this;
  8870. var include = ref.include;
  8871. var exclude = ref.exclude;
  8872. if (
  8873. // not included
  8874. (include && (!name || !matches(include, name))) ||
  8875. // excluded
  8876. (exclude && name && matches(exclude, name))
  8877. ) {
  8878. return vnode
  8879. }
  8880. var ref$1 = this;
  8881. var cache = ref$1.cache;
  8882. var keys = ref$1.keys;
  8883. var key = vnode.key == null
  8884. // same constructor may get registered as different local components
  8885. // so cid alone is not enough (#3269)
  8886. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  8887. : vnode.key;
  8888. if (cache[key]) {
  8889. vnode.componentInstance = cache[key].componentInstance;
  8890. // make current key freshest
  8891. remove(keys, key);
  8892. keys.push(key);
  8893. } else {
  8894. cache[key] = vnode;
  8895. keys.push(key);
  8896. // prune oldest entry
  8897. if (this.max && keys.length > parseInt(this.max)) {
  8898. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  8899. }
  8900. }
  8901. vnode.data.keepAlive = true;
  8902. }
  8903. return vnode || (slot && slot[0])
  8904. }
  8905. };
  8906. var builtInComponents = {
  8907. KeepAlive: KeepAlive
  8908. };
  8909. /* */
  8910. function initGlobalAPI (Vue) {
  8911. // config
  8912. var configDef = {};
  8913. configDef.get = function () { return config; };
  8914. if (true) {
  8915. configDef.set = function () {
  8916. warn(
  8917. 'Do not replace the Vue.config object, set individual fields instead.'
  8918. );
  8919. };
  8920. }
  8921. Object.defineProperty(Vue, 'config', configDef);
  8922. // exposed util methods.
  8923. // NOTE: these are not considered part of the public API - avoid relying on
  8924. // them unless you are aware of the risk.
  8925. Vue.util = {
  8926. warn: warn,
  8927. extend: extend,
  8928. mergeOptions: mergeOptions,
  8929. defineReactive: defineReactive$$1
  8930. };
  8931. Vue.set = set;
  8932. Vue.delete = del;
  8933. Vue.nextTick = nextTick;
  8934. // 2.6 explicit observable API
  8935. Vue.observable = function (obj) {
  8936. observe(obj);
  8937. return obj
  8938. };
  8939. Vue.options = Object.create(null);
  8940. ASSET_TYPES.forEach(function (type) {
  8941. Vue.options[type + 's'] = Object.create(null);
  8942. });
  8943. // this is used to identify the "base" constructor to extend all plain-object
  8944. // components with in Weex's multi-instance scenarios.
  8945. Vue.options._base = Vue;
  8946. extend(Vue.options.components, builtInComponents);
  8947. initUse(Vue);
  8948. initMixin$1(Vue);
  8949. initExtend(Vue);
  8950. initAssetRegisters(Vue);
  8951. }
  8952. initGlobalAPI(Vue);
  8953. Object.defineProperty(Vue.prototype, '$isServer', {
  8954. get: isServerRendering
  8955. });
  8956. Object.defineProperty(Vue.prototype, '$ssrContext', {
  8957. get: function get () {
  8958. /* istanbul ignore next */
  8959. return this.$vnode && this.$vnode.ssrContext
  8960. }
  8961. });
  8962. // expose FunctionalRenderContext for ssr runtime helper installation
  8963. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  8964. value: FunctionalRenderContext
  8965. });
  8966. Vue.version = '2.6.11';
  8967. /**
  8968. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  8969. */
  8970. var ARRAYTYPE = '[object Array]';
  8971. var OBJECTTYPE = '[object Object]';
  8972. var NULLTYPE = '[object Null]';
  8973. var UNDEFINEDTYPE = '[object Undefined]';
  8974. // const FUNCTIONTYPE = '[object Function]'
  8975. function diff(current, pre) {
  8976. var result = {};
  8977. syncKeys(current, pre);
  8978. _diff(current, pre, '', result);
  8979. return result
  8980. }
  8981. function syncKeys(current, pre) {
  8982. if (current === pre) { return }
  8983. var rootCurrentType = type(current);
  8984. var rootPreType = type(pre);
  8985. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  8986. if(Object.keys(current).length >= Object.keys(pre).length){
  8987. for (var key in pre) {
  8988. var currentValue = current[key];
  8989. if (currentValue === undefined) {
  8990. current[key] = null;
  8991. } else {
  8992. syncKeys(currentValue, pre[key]);
  8993. }
  8994. }
  8995. }
  8996. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  8997. if (current.length >= pre.length) {
  8998. pre.forEach(function (item, index) {
  8999. syncKeys(current[index], item);
  9000. });
  9001. }
  9002. }
  9003. }
  9004. function nullOrUndefined(currentType, preType) {
  9005. if(
  9006. (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
  9007. (preType === NULLTYPE || preType === UNDEFINEDTYPE)
  9008. ) {
  9009. return false
  9010. }
  9011. return true
  9012. }
  9013. function _diff(current, pre, path, result) {
  9014. if (current === pre) { return }
  9015. var rootCurrentType = type(current);
  9016. var rootPreType = type(pre);
  9017. if (rootCurrentType == OBJECTTYPE) {
  9018. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  9019. setResult(result, path, current);
  9020. } else {
  9021. var loop = function ( key ) {
  9022. var currentValue = current[key];
  9023. var preValue = pre[key];
  9024. var currentType = type(currentValue);
  9025. var preType = type(preValue);
  9026. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  9027. if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
  9028. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9029. }
  9030. } else if (currentType == ARRAYTYPE) {
  9031. if (preType != ARRAYTYPE) {
  9032. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9033. } else {
  9034. if (currentValue.length < preValue.length) {
  9035. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9036. } else {
  9037. currentValue.forEach(function (item, index) {
  9038. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  9039. });
  9040. }
  9041. }
  9042. } else if (currentType == OBJECTTYPE) {
  9043. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  9044. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9045. } else {
  9046. for (var subKey in currentValue) {
  9047. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  9048. }
  9049. }
  9050. }
  9051. };
  9052. for (var key in current) loop( key );
  9053. }
  9054. } else if (rootCurrentType == ARRAYTYPE) {
  9055. if (rootPreType != ARRAYTYPE) {
  9056. setResult(result, path, current);
  9057. } else {
  9058. if (current.length < pre.length) {
  9059. setResult(result, path, current);
  9060. } else {
  9061. current.forEach(function (item, index) {
  9062. _diff(item, pre[index], path + '[' + index + ']', result);
  9063. });
  9064. }
  9065. }
  9066. } else {
  9067. setResult(result, path, current);
  9068. }
  9069. }
  9070. function setResult(result, k, v) {
  9071. // if (type(v) != FUNCTIONTYPE) {
  9072. result[k] = v;
  9073. // }
  9074. }
  9075. function type(obj) {
  9076. return Object.prototype.toString.call(obj)
  9077. }
  9078. /* */
  9079. function flushCallbacks$1(vm) {
  9080. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  9081. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-alipay","BASE_URL":"/"}).VUE_APP_DEBUG) {
  9082. var mpInstance = vm.$scope;
  9083. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  9084. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  9085. }
  9086. var copies = vm.__next_tick_callbacks.slice(0);
  9087. vm.__next_tick_callbacks.length = 0;
  9088. for (var i = 0; i < copies.length; i++) {
  9089. copies[i]();
  9090. }
  9091. }
  9092. }
  9093. function hasRenderWatcher(vm) {
  9094. return queue.find(function (watcher) { return vm._watcher === watcher; })
  9095. }
  9096. function nextTick$1(vm, cb) {
  9097. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  9098. //2.nextTick 之前存在 render watcher
  9099. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  9100. if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-alipay","BASE_URL":"/"}).VUE_APP_DEBUG){
  9101. var mpInstance = vm.$scope;
  9102. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  9103. ']:nextVueTick');
  9104. }
  9105. return nextTick(cb, vm)
  9106. }else{
  9107. if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-alipay","BASE_URL":"/"}).VUE_APP_DEBUG){
  9108. var mpInstance$1 = vm.$scope;
  9109. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  9110. ']:nextMPTick');
  9111. }
  9112. }
  9113. var _resolve;
  9114. if (!vm.__next_tick_callbacks) {
  9115. vm.__next_tick_callbacks = [];
  9116. }
  9117. vm.__next_tick_callbacks.push(function () {
  9118. if (cb) {
  9119. try {
  9120. cb.call(vm);
  9121. } catch (e) {
  9122. handleError(e, vm, 'nextTick');
  9123. }
  9124. } else if (_resolve) {
  9125. _resolve(vm);
  9126. }
  9127. });
  9128. // $flow-disable-line
  9129. if (!cb && typeof Promise !== 'undefined') {
  9130. return new Promise(function (resolve) {
  9131. _resolve = resolve;
  9132. })
  9133. }
  9134. }
  9135. /* */
  9136. function clearInstance(key, value) {
  9137. // 简易去除 Vue 和小程序组件实例
  9138. if (value) {
  9139. if (value._isVue || value.__v_isMPComponent) {
  9140. return {}
  9141. }
  9142. }
  9143. return value
  9144. }
  9145. function cloneWithData(vm) {
  9146. // 确保当前 vm 所有数据被同步
  9147. var ret = Object.create(null);
  9148. var dataKeys = [].concat(
  9149. Object.keys(vm._data || {}),
  9150. Object.keys(vm._computedWatchers || {}));
  9151. dataKeys.reduce(function(ret, key) {
  9152. ret[key] = vm[key];
  9153. return ret
  9154. }, ret);
  9155. // vue-composition-api
  9156. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  9157. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  9158. if (rawBindings) {
  9159. Object.keys(rawBindings).forEach(function (key) {
  9160. ret[key] = vm[key];
  9161. });
  9162. }
  9163. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  9164. Object.assign(ret, vm.$mp.data || {});
  9165. if (
  9166. Array.isArray(vm.$options.behaviors) &&
  9167. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  9168. ) { //form-field
  9169. ret['name'] = vm.name;
  9170. ret['value'] = vm.value;
  9171. }
  9172. return JSON.parse(JSON.stringify(ret, clearInstance))
  9173. }
  9174. var patch = function(oldVnode, vnode) {
  9175. var this$1 = this;
  9176. if (vnode === null) { //destroy
  9177. return
  9178. }
  9179. if (this.mpType === 'page' || this.mpType === 'component') {
  9180. var mpInstance = this.$scope;
  9181. var data = Object.create(null);
  9182. try {
  9183. data = cloneWithData(this);
  9184. } catch (err) {
  9185. console.error(err);
  9186. }
  9187. data.__webviewId__ = mpInstance.data.__webviewId__;
  9188. var mpData = Object.create(null);
  9189. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  9190. mpData[key] = mpInstance.data[key];
  9191. });
  9192. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  9193. if (Object.keys(diffData).length) {
  9194. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-alipay","BASE_URL":"/"}).VUE_APP_DEBUG) {
  9195. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  9196. ']差量更新',
  9197. JSON.stringify(diffData));
  9198. }
  9199. this.__next_tick_pending = true;
  9200. mpInstance.setData(diffData, function () {
  9201. this$1.__next_tick_pending = false;
  9202. flushCallbacks$1(this$1);
  9203. });
  9204. } else {
  9205. flushCallbacks$1(this);
  9206. }
  9207. }
  9208. };
  9209. /* */
  9210. function createEmptyRender() {
  9211. }
  9212. function mountComponent$1(
  9213. vm,
  9214. el,
  9215. hydrating
  9216. ) {
  9217. if (!vm.mpType) {//main.js 中的 new Vue
  9218. return vm
  9219. }
  9220. if (vm.mpType === 'app') {
  9221. vm.$options.render = createEmptyRender;
  9222. }
  9223. if (!vm.$options.render) {
  9224. vm.$options.render = createEmptyRender;
  9225. if (true) {
  9226. /* istanbul ignore if */
  9227. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  9228. vm.$options.el || el) {
  9229. warn(
  9230. 'You are using the runtime-only build of Vue where the template ' +
  9231. 'compiler is not available. Either pre-compile the templates into ' +
  9232. 'render functions, or use the compiler-included build.',
  9233. vm
  9234. );
  9235. } else {
  9236. warn(
  9237. 'Failed to mount component: template or render function not defined.',
  9238. vm
  9239. );
  9240. }
  9241. }
  9242. }
  9243. !vm._$fallback && callHook(vm, 'beforeMount');
  9244. var updateComponent = function () {
  9245. vm._update(vm._render(), hydrating);
  9246. };
  9247. // we set this to vm._watcher inside the watcher's constructor
  9248. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  9249. // component's mounted hook), which relies on vm._watcher being already defined
  9250. new Watcher(vm, updateComponent, noop, {
  9251. before: function before() {
  9252. if (vm._isMounted && !vm._isDestroyed) {
  9253. callHook(vm, 'beforeUpdate');
  9254. }
  9255. }
  9256. }, true /* isRenderWatcher */);
  9257. hydrating = false;
  9258. return vm
  9259. }
  9260. /* */
  9261. function renderClass (
  9262. staticClass,
  9263. dynamicClass
  9264. ) {
  9265. if (isDef(staticClass) || isDef(dynamicClass)) {
  9266. return concat(staticClass, stringifyClass(dynamicClass))
  9267. }
  9268. /* istanbul ignore next */
  9269. return ''
  9270. }
  9271. function concat (a, b) {
  9272. return a ? b ? (a + ' ' + b) : a : (b || '')
  9273. }
  9274. function stringifyClass (value) {
  9275. if (Array.isArray(value)) {
  9276. return stringifyArray(value)
  9277. }
  9278. if (isObject(value)) {
  9279. return stringifyObject(value)
  9280. }
  9281. if (typeof value === 'string') {
  9282. return value
  9283. }
  9284. /* istanbul ignore next */
  9285. return ''
  9286. }
  9287. function stringifyArray (value) {
  9288. var res = '';
  9289. var stringified;
  9290. for (var i = 0, l = value.length; i < l; i++) {
  9291. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  9292. if (res) { res += ' '; }
  9293. res += stringified;
  9294. }
  9295. }
  9296. return res
  9297. }
  9298. function stringifyObject (value) {
  9299. var res = '';
  9300. for (var key in value) {
  9301. if (value[key]) {
  9302. if (res) { res += ' '; }
  9303. res += key;
  9304. }
  9305. }
  9306. return res
  9307. }
  9308. /* */
  9309. var parseStyleText = cached(function (cssText) {
  9310. var res = {};
  9311. var listDelimiter = /;(?![^(]*\))/g;
  9312. var propertyDelimiter = /:(.+)/;
  9313. cssText.split(listDelimiter).forEach(function (item) {
  9314. if (item) {
  9315. var tmp = item.split(propertyDelimiter);
  9316. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  9317. }
  9318. });
  9319. return res
  9320. });
  9321. // normalize possible array / string values into Object
  9322. function normalizeStyleBinding (bindingStyle) {
  9323. if (Array.isArray(bindingStyle)) {
  9324. return toObject(bindingStyle)
  9325. }
  9326. if (typeof bindingStyle === 'string') {
  9327. return parseStyleText(bindingStyle)
  9328. }
  9329. return bindingStyle
  9330. }
  9331. /* */
  9332. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  9333. function getTarget(obj, path) {
  9334. var parts = path.split('.');
  9335. var key = parts[0];
  9336. if (key.indexOf('__$n') === 0) { //number index
  9337. key = parseInt(key.replace('__$n', ''));
  9338. }
  9339. if (parts.length === 1) {
  9340. return obj[key]
  9341. }
  9342. return getTarget(obj[key], parts.slice(1).join('.'))
  9343. }
  9344. function internalMixin(Vue) {
  9345. Vue.config.errorHandler = function(err, vm, info) {
  9346. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  9347. console.error(err);
  9348. /* eslint-disable no-undef */
  9349. var app = typeof getApp === 'function' && getApp();
  9350. if (app && app.onError) {
  9351. app.onError(err);
  9352. }
  9353. };
  9354. var oldEmit = Vue.prototype.$emit;
  9355. Vue.prototype.$emit = function(event) {
  9356. if (this.$scope && event) {
  9357. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  9358. if (triggerEvent) {
  9359. try {
  9360. triggerEvent.call(this.$scope, event, {
  9361. __args__: toArray(arguments, 1)
  9362. });
  9363. } catch (error) {
  9364. }
  9365. }
  9366. }
  9367. return oldEmit.apply(this, arguments)
  9368. };
  9369. Vue.prototype.$nextTick = function(fn) {
  9370. return nextTick$1(this, fn)
  9371. };
  9372. MP_METHODS.forEach(function (method) {
  9373. Vue.prototype[method] = function(args) {
  9374. if (this.$scope && this.$scope[method]) {
  9375. return this.$scope[method](args)
  9376. }
  9377. // mp-alipay
  9378. if (typeof my === 'undefined') {
  9379. return
  9380. }
  9381. if (method === 'createSelectorQuery') {
  9382. /* eslint-disable no-undef */
  9383. return my.createSelectorQuery(args)
  9384. } else if (method === 'createIntersectionObserver') {
  9385. /* eslint-disable no-undef */
  9386. return my.createIntersectionObserver(args)
  9387. }
  9388. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  9389. };
  9390. });
  9391. Vue.prototype.__init_provide = initProvide;
  9392. Vue.prototype.__init_injections = initInjections;
  9393. Vue.prototype.__call_hook = function(hook, args) {
  9394. var vm = this;
  9395. // #7573 disable dep collection when invoking lifecycle hooks
  9396. pushTarget();
  9397. var handlers = vm.$options[hook];
  9398. var info = hook + " hook";
  9399. var ret;
  9400. if (handlers) {
  9401. for (var i = 0, j = handlers.length; i < j; i++) {
  9402. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  9403. }
  9404. }
  9405. if (vm._hasHookEvent) {
  9406. vm.$emit('hook:' + hook, args);
  9407. }
  9408. popTarget();
  9409. return ret
  9410. };
  9411. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  9412. if (Array.isArray(modifiers)) {
  9413. if (modifiers.indexOf('trim') !== -1) {
  9414. value = value.trim();
  9415. }
  9416. if (modifiers.indexOf('number') !== -1) {
  9417. value = this._n(value);
  9418. }
  9419. }
  9420. if (!target) {
  9421. target = this;
  9422. }
  9423. // 解决动态属性添加
  9424. Vue.set(target, key, value);
  9425. };
  9426. Vue.prototype.__set_sync = function(target, key, value) {
  9427. if (!target) {
  9428. target = this;
  9429. }
  9430. // 解决动态属性添加
  9431. Vue.set(target, key, value);
  9432. };
  9433. Vue.prototype.__get_orig = function(item) {
  9434. if (isPlainObject(item)) {
  9435. return item['$orig'] || item
  9436. }
  9437. return item
  9438. };
  9439. Vue.prototype.__get_value = function(dataPath, target) {
  9440. return getTarget(target || this, dataPath)
  9441. };
  9442. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  9443. return renderClass(staticClass, dynamicClass)
  9444. };
  9445. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  9446. if (!dynamicStyle && !staticStyle) {
  9447. return ''
  9448. }
  9449. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  9450. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  9451. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  9452. };
  9453. Vue.prototype.__map = function(val, iteratee) {
  9454. //TODO 暂不考虑 string
  9455. var ret, i, l, keys, key;
  9456. if (Array.isArray(val)) {
  9457. ret = new Array(val.length);
  9458. for (i = 0, l = val.length; i < l; i++) {
  9459. ret[i] = iteratee(val[i], i);
  9460. }
  9461. return ret
  9462. } else if (isObject(val)) {
  9463. keys = Object.keys(val);
  9464. ret = Object.create(null);
  9465. for (i = 0, l = keys.length; i < l; i++) {
  9466. key = keys[i];
  9467. ret[key] = iteratee(val[key], key, i);
  9468. }
  9469. return ret
  9470. } else if (typeof val === 'number') {
  9471. ret = new Array(val);
  9472. for (i = 0, l = val; i < l; i++) {
  9473. // 第一个参数暂时仍和小程序一致
  9474. ret[i] = iteratee(i, i);
  9475. }
  9476. return ret
  9477. }
  9478. return []
  9479. };
  9480. }
  9481. /* */
  9482. var LIFECYCLE_HOOKS$1 = [
  9483. //App
  9484. 'onLaunch',
  9485. 'onShow',
  9486. 'onHide',
  9487. 'onUniNViewMessage',
  9488. 'onPageNotFound',
  9489. 'onThemeChange',
  9490. 'onError',
  9491. 'onUnhandledRejection',
  9492. //Page
  9493. 'onInit',
  9494. 'onLoad',
  9495. // 'onShow',
  9496. 'onReady',
  9497. // 'onHide',
  9498. 'onUnload',
  9499. 'onPullDownRefresh',
  9500. 'onReachBottom',
  9501. 'onTabItemTap',
  9502. 'onAddToFavorites',
  9503. 'onShareTimeline',
  9504. 'onShareAppMessage',
  9505. 'onResize',
  9506. 'onPageScroll',
  9507. 'onNavigationBarButtonTap',
  9508. 'onBackPress',
  9509. 'onNavigationBarSearchInputChanged',
  9510. 'onNavigationBarSearchInputConfirmed',
  9511. 'onNavigationBarSearchInputClicked',
  9512. 'onUploadDouyinVideo',
  9513. 'onNFCReadMessage',
  9514. //Component
  9515. // 'onReady', // 兼容旧版本,应该移除该事件
  9516. 'onPageShow',
  9517. 'onPageHide',
  9518. 'onPageResize'
  9519. ];
  9520. function lifecycleMixin$1(Vue) {
  9521. //fixed vue-class-component
  9522. var oldExtend = Vue.extend;
  9523. Vue.extend = function(extendOptions) {
  9524. extendOptions = extendOptions || {};
  9525. var methods = extendOptions.methods;
  9526. if (methods) {
  9527. Object.keys(methods).forEach(function (methodName) {
  9528. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  9529. extendOptions[methodName] = methods[methodName];
  9530. delete methods[methodName];
  9531. }
  9532. });
  9533. }
  9534. return oldExtend.call(this, extendOptions)
  9535. };
  9536. var strategies = Vue.config.optionMergeStrategies;
  9537. var mergeHook = strategies.created;
  9538. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  9539. strategies[hook] = mergeHook;
  9540. });
  9541. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  9542. }
  9543. /* */
  9544. // install platform patch function
  9545. Vue.prototype.__patch__ = patch;
  9546. // public mount method
  9547. Vue.prototype.$mount = function(
  9548. el ,
  9549. hydrating
  9550. ) {
  9551. return mountComponent$1(this, el, hydrating)
  9552. };
  9553. lifecycleMixin$1(Vue);
  9554. internalMixin(Vue);
  9555. /* */
  9556. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  9557. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 2)))
  9558. /***/ }),
  9559. /* 22 */
  9560. /*!*************************************************************!*\
  9561. !*** E:/zswl/code/charge_miniapp/charge_miniapp/pages.json ***!
  9562. \*************************************************************/
  9563. /*! no static exports found */
  9564. /***/ (function(module, exports) {
  9565. /***/ }),
  9566. /* 23 */,
  9567. /* 24 */,
  9568. /* 25 */,
  9569. /* 26 */
  9570. /*!*******************************************************************!*\
  9571. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/api.js ***!
  9572. \*******************************************************************/
  9573. /*! no static exports found */
  9574. /***/ (function(module, exports, __webpack_require__) {
  9575. "use strict";
  9576. /* WEBPACK VAR INJECTION */(function(uni) {
  9577. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 3);
  9578. Object.defineProperty(exports, "__esModule", {
  9579. value: true
  9580. });
  9581. exports.default = void 0;
  9582. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 27));
  9583. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 10));
  9584. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 29));
  9585. var _app = _interopRequireDefault(__webpack_require__(/*! ./app */ 30));
  9586. var _config = _interopRequireDefault(__webpack_require__(/*! ./config */ 31));
  9587. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  9588. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  9589. var api = {};
  9590. // 网络请求封装
  9591. var Request = function Request(opts) {
  9592. var originalComplete = opts.complete;
  9593. return new Promise(function (resolve, reject) {
  9594. uni.request(Object.assign({}, opts, {
  9595. complete: function complete(res) {
  9596. var hasSuccess = Boolean(res.errMsg == 'request:ok' && res.statusCode >= 200 && res.statusCode < 300);
  9597. hasSuccess ? resolve(res.data) : reject(res);
  9598. if (originalComplete && typeof originalComplete == 'function') originalComplete(res);
  9599. }
  9600. }));
  9601. });
  9602. };
  9603. // 路径拼接
  9604. var pathJoin = function pathJoin() {
  9605. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  9606. args[_key] = arguments[_key];
  9607. }
  9608. return args.join('/').replace(/(?<!:)(\/{2,})/g, '/');
  9609. };
  9610. // 显示LOADING
  9611. var showLoading = function showLoading() {
  9612. uni.showLoading({
  9613. title: '',
  9614. mask: true
  9615. });
  9616. };
  9617. // 关闭LOADING
  9618. var hideLoading = function hideLoading() {
  9619. uni.hideLoading();
  9620. };
  9621. // 获取用户TOKEN
  9622. var getUserToken = function getUserToken() {
  9623. return uni.getStorageSync(_config.default.keyname.userToken);
  9624. };
  9625. /**
  9626. * 基础请求
  9627. * @param {String} method 请求类型
  9628. * @param {String} url 请求地址
  9629. * @param {Object} data 请求数据
  9630. * @param {Object} opts 配置参数
  9631. */
  9632. api.base = function (method, url, data, opts) {
  9633. return new Promise( /*#__PURE__*/function () {
  9634. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
  9635. var options;
  9636. return _regenerator.default.wrap(function _callee3$(_context3) {
  9637. while (1) {
  9638. switch (_context3.prev = _context3.next) {
  9639. case 0:
  9640. options = Object.assign({
  9641. // 请求地址
  9642. url: pathJoin(_config.default.url.request, url),
  9643. // 请求数据
  9644. data: data || {},
  9645. // 请求类型
  9646. method: method || 'post',
  9647. // 数据类型
  9648. dataType: 'json',
  9649. // 自动显示LOADING
  9650. loading: true,
  9651. // 启用错误自动拦截
  9652. error: true,
  9653. // 请求头设定
  9654. header: {
  9655. 'content-type': 'application/json',
  9656. 'token': getUserToken()
  9657. },
  9658. // 设置显示LOADING的方法
  9659. showLoading: showLoading,
  9660. // 设置关闭LOADING的方法
  9661. hideLoading: hideLoading
  9662. }, opts || {});
  9663. if (options.loading && typeof options.showLoading == 'function') {
  9664. options.showLoading();
  9665. }
  9666. Request(options).then( /*#__PURE__*/function () {
  9667. var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(res) {
  9668. var db;
  9669. return _regenerator.default.wrap(function _callee$(_context) {
  9670. while (1) {
  9671. switch (_context.prev = _context.next) {
  9672. case 0:
  9673. if (options.loading && typeof options.hideLoading == 'function') {
  9674. options.hideLoading();
  9675. }
  9676. _context.t0 = res.code;
  9677. _context.next = _context.t0 === 0 ? 4 : _context.t0 === 201 ? 6 : 26;
  9678. break;
  9679. case 4:
  9680. resolve(res);
  9681. return _context.abrupt("break", 28);
  9682. case 6:
  9683. _context.prev = 6;
  9684. _context.next = 9;
  9685. return api.login();
  9686. case 9:
  9687. _context.next = 14;
  9688. break;
  9689. case 11:
  9690. _context.prev = 11;
  9691. _context.t1 = _context["catch"](6);
  9692. reject(_context.t1);
  9693. case 14:
  9694. options.header.token = getUserToken();
  9695. _context.prev = 15;
  9696. _context.next = 18;
  9697. return Request(options);
  9698. case 18:
  9699. db = _context.sent;
  9700. resolve(db);
  9701. _context.next = 25;
  9702. break;
  9703. case 22:
  9704. _context.prev = 22;
  9705. _context.t2 = _context["catch"](15);
  9706. reject(_context.t2);
  9707. case 25:
  9708. return _context.abrupt("break", 28);
  9709. case 26:
  9710. if (options.error) {
  9711. _app.default.popup.alert(res.msg || "".concat(url, "\r\n\u672A\u77E5\u9519\u8BEF"), '数据请求');
  9712. } else {
  9713. reject(res);
  9714. }
  9715. return _context.abrupt("break", 28);
  9716. case 28:
  9717. case "end":
  9718. return _context.stop();
  9719. }
  9720. }
  9721. }, _callee, null, [[6, 11], [15, 22]]);
  9722. }));
  9723. return function (_x3) {
  9724. return _ref2.apply(this, arguments);
  9725. };
  9726. }()).catch( /*#__PURE__*/function () {
  9727. var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(err) {
  9728. return _regenerator.default.wrap(function _callee2$(_context2) {
  9729. while (1) {
  9730. switch (_context2.prev = _context2.next) {
  9731. case 0:
  9732. /*失败处理,此处为非200状态码引起的错误*/
  9733. options.hideLoading();
  9734. _app.default.popup.alert("\u670D\u52A1\u5668\u54CD\u5E94\u5931\u8D25\r\n".concat(err.errMsg), '数据请求');
  9735. case 2:
  9736. case "end":
  9737. return _context2.stop();
  9738. }
  9739. }
  9740. }, _callee2);
  9741. }));
  9742. return function (_x4) {
  9743. return _ref3.apply(this, arguments);
  9744. };
  9745. }());
  9746. case 3:
  9747. case "end":
  9748. return _context3.stop();
  9749. }
  9750. }
  9751. }, _callee3);
  9752. }));
  9753. return function (_x, _x2) {
  9754. return _ref.apply(this, arguments);
  9755. };
  9756. }());
  9757. };
  9758. /**
  9759. * POST请求
  9760. * @param {String} url 请求地址
  9761. * @param {Object} data 请求数据
  9762. * @param {Object} opts 配置参数
  9763. */
  9764. api.post = function (url, data, opts) {
  9765. return api.base('post', url, data, Object.assign({}, opts));
  9766. };
  9767. /**
  9768. * GET请求
  9769. * @param {String} url 请求地址
  9770. * @param {Object} data 请求数据
  9771. * @param {Object} opts 配置参数
  9772. */
  9773. api.get = function (url, data, opts) {
  9774. return api.base('get', url, data, Object.assign({}, opts));
  9775. };
  9776. /**
  9777. * 获取静态数据
  9778. * @param {String} url 静态文件地址
  9779. * @param {Object} data 参数数据
  9780. * @param {Object} opts 配置参数
  9781. */
  9782. api.static = function (url, data, opts) {
  9783. return new Promise( /*#__PURE__*/function () {
  9784. var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(resolve, reject) {
  9785. var _opts;
  9786. return _regenerator.default.wrap(function _callee4$(_context4) {
  9787. while (1) {
  9788. switch (_context4.prev = _context4.next) {
  9789. case 0:
  9790. // 设置选项
  9791. _opts = Object.assign({
  9792. url: /^http/.test(url) ? url : API_BASE + (url || ''),
  9793. data: Object.assign({
  9794. cache: Date.now()
  9795. }, data)
  9796. }, opts || {});
  9797. uni.request(_objectSpread(_objectSpread({}, _opts), {}, {
  9798. success: function success(res) {
  9799. resolve(res.data);
  9800. }
  9801. }));
  9802. case 2:
  9803. case "end":
  9804. return _context4.stop();
  9805. }
  9806. }
  9807. }, _callee4);
  9808. }));
  9809. return function (_x5, _x6) {
  9810. return _ref4.apply(this, arguments);
  9811. };
  9812. }());
  9813. };
  9814. /**
  9815. * 文件上传
  9816. * @param {String} file 文件临时路径
  9817. * @param {Object} opts 上传参数
  9818. */
  9819. api.upload = function (file, opts) {
  9820. return new Promise(function (resolve, reject) {
  9821. var options = Object.assign({
  9822. // 请求地址
  9823. url: pathJoin(_config.default.url.upload, (opts === null || opts === void 0 ? void 0 : opts.url) || ''),
  9824. // 请求数据
  9825. filePath: file,
  9826. // 自动显示LOADING
  9827. loading: true,
  9828. // 启用错误自动拦截
  9829. error: true,
  9830. // 请求头设定
  9831. header: {
  9832. 'token': uni.getStorageSync(_config.default.keyname.userToken)
  9833. },
  9834. // 设置显示LOADING的方法
  9835. showLoading: showLoading,
  9836. // 设置关闭LOADING的方法
  9837. hideLoading: hideLoading
  9838. }, opts || {});
  9839. });
  9840. };
  9841. /**
  9842. * 获取登录code
  9843. */
  9844. api.userCode = function () {
  9845. return new Promise(function (resolve, reject) {
  9846. uni.login({
  9847. provider: 'weixin',
  9848. success: function success(res) {
  9849. return resolve(res.code);
  9850. },
  9851. fail: function fail(err) {
  9852. return reject(err);
  9853. }
  9854. });
  9855. });
  9856. };
  9857. /**
  9858. * 自动登录
  9859. * @param {Object} data 登录数据(非必填)
  9860. */
  9861. api.login = function (data) {
  9862. return new Promise( /*#__PURE__*/function () {
  9863. var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(resolve, reject) {
  9864. var code;
  9865. return _regenerator.default.wrap(function _callee6$(_context6) {
  9866. while (1) {
  9867. switch (_context6.prev = _context6.next) {
  9868. case 0:
  9869. _context6.next = 2;
  9870. return api.userCode();
  9871. case 2:
  9872. code = _context6.sent;
  9873. api.post(_config.default.api.login, _objectSpread(_objectSpread({}, data || {}), {}, {
  9874. code: code
  9875. })).then( /*#__PURE__*/function () {
  9876. var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(res) {
  9877. return _regenerator.default.wrap(function _callee5$(_context5) {
  9878. while (1) {
  9879. switch (_context5.prev = _context5.next) {
  9880. case 0:
  9881. uni.setStorageSync(_config.default.keyname.userToken, res === null || res === void 0 ? void 0 : res.token);
  9882. uni.setStorageSync(_config.default.keyname.userInfo, res === null || res === void 0 ? void 0 : res.userInfo);
  9883. resolve(res.token);
  9884. case 3:
  9885. case "end":
  9886. return _context5.stop();
  9887. }
  9888. }
  9889. }, _callee5);
  9890. }));
  9891. return function (_x9) {
  9892. return _ref6.apply(this, arguments);
  9893. };
  9894. }()).catch(function (err) {
  9895. return reject(err);
  9896. });
  9897. case 4:
  9898. case "end":
  9899. return _context6.stop();
  9900. }
  9901. }
  9902. }, _callee6);
  9903. }));
  9904. return function (_x7, _x8) {
  9905. return _ref5.apply(this, arguments);
  9906. };
  9907. }());
  9908. };
  9909. var _default = api;
  9910. exports.default = _default;
  9911. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-alipay/dist/index.js */ 1)["default"]))
  9912. /***/ }),
  9913. /* 27 */
  9914. /*!************************************************************************************************!*\
  9915. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator/index.js ***!
  9916. \************************************************************************************************/
  9917. /*! no static exports found */
  9918. /***/ (function(module, exports, __webpack_require__) {
  9919. // TODO(Babel 8): Remove this file.
  9920. var runtime = __webpack_require__(/*! @babel/runtime/helpers/regeneratorRuntime */ 28)();
  9921. module.exports = runtime;
  9922. /***/ }),
  9923. /* 28 */
  9924. /*!*******************************************************************!*\
  9925. !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
  9926. \*******************************************************************/
  9927. /*! no static exports found */
  9928. /***/ (function(module, exports, __webpack_require__) {
  9929. var _typeof = __webpack_require__(/*! ./typeof.js */ 12)["default"];
  9930. function _regeneratorRuntime() {
  9931. "use strict";
  9932. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  9933. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  9934. return e;
  9935. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  9936. var t,
  9937. e = {},
  9938. r = Object.prototype,
  9939. n = r.hasOwnProperty,
  9940. o = Object.defineProperty || function (t, e, r) {
  9941. t[e] = r.value;
  9942. },
  9943. i = "function" == typeof Symbol ? Symbol : {},
  9944. a = i.iterator || "@@iterator",
  9945. c = i.asyncIterator || "@@asyncIterator",
  9946. u = i.toStringTag || "@@toStringTag";
  9947. function define(t, e, r) {
  9948. return Object.defineProperty(t, e, {
  9949. value: r,
  9950. enumerable: !0,
  9951. configurable: !0,
  9952. writable: !0
  9953. }), t[e];
  9954. }
  9955. try {
  9956. define({}, "");
  9957. } catch (t) {
  9958. define = function define(t, e, r) {
  9959. return t[e] = r;
  9960. };
  9961. }
  9962. function wrap(t, e, r, n) {
  9963. var i = e && e.prototype instanceof Generator ? e : Generator,
  9964. a = Object.create(i.prototype),
  9965. c = new Context(n || []);
  9966. return o(a, "_invoke", {
  9967. value: makeInvokeMethod(t, r, c)
  9968. }), a;
  9969. }
  9970. function tryCatch(t, e, r) {
  9971. try {
  9972. return {
  9973. type: "normal",
  9974. arg: t.call(e, r)
  9975. };
  9976. } catch (t) {
  9977. return {
  9978. type: "throw",
  9979. arg: t
  9980. };
  9981. }
  9982. }
  9983. e.wrap = wrap;
  9984. var h = "suspendedStart",
  9985. l = "suspendedYield",
  9986. f = "executing",
  9987. s = "completed",
  9988. y = {};
  9989. function Generator() {}
  9990. function GeneratorFunction() {}
  9991. function GeneratorFunctionPrototype() {}
  9992. var p = {};
  9993. define(p, a, function () {
  9994. return this;
  9995. });
  9996. var d = Object.getPrototypeOf,
  9997. v = d && d(d(values([])));
  9998. v && v !== r && n.call(v, a) && (p = v);
  9999. var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
  10000. function defineIteratorMethods(t) {
  10001. ["next", "throw", "return"].forEach(function (e) {
  10002. define(t, e, function (t) {
  10003. return this._invoke(e, t);
  10004. });
  10005. });
  10006. }
  10007. function AsyncIterator(t, e) {
  10008. function invoke(r, o, i, a) {
  10009. var c = tryCatch(t[r], t, o);
  10010. if ("throw" !== c.type) {
  10011. var u = c.arg,
  10012. h = u.value;
  10013. return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
  10014. invoke("next", t, i, a);
  10015. }, function (t) {
  10016. invoke("throw", t, i, a);
  10017. }) : e.resolve(h).then(function (t) {
  10018. u.value = t, i(u);
  10019. }, function (t) {
  10020. return invoke("throw", t, i, a);
  10021. });
  10022. }
  10023. a(c.arg);
  10024. }
  10025. var r;
  10026. o(this, "_invoke", {
  10027. value: function value(t, n) {
  10028. function callInvokeWithMethodAndArg() {
  10029. return new e(function (e, r) {
  10030. invoke(t, n, e, r);
  10031. });
  10032. }
  10033. return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  10034. }
  10035. });
  10036. }
  10037. function makeInvokeMethod(e, r, n) {
  10038. var o = h;
  10039. return function (i, a) {
  10040. if (o === f) throw Error("Generator is already running");
  10041. if (o === s) {
  10042. if ("throw" === i) throw a;
  10043. return {
  10044. value: t,
  10045. done: !0
  10046. };
  10047. }
  10048. for (n.method = i, n.arg = a;;) {
  10049. var c = n.delegate;
  10050. if (c) {
  10051. var u = maybeInvokeDelegate(c, n);
  10052. if (u) {
  10053. if (u === y) continue;
  10054. return u;
  10055. }
  10056. }
  10057. if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
  10058. if (o === h) throw o = s, n.arg;
  10059. n.dispatchException(n.arg);
  10060. } else "return" === n.method && n.abrupt("return", n.arg);
  10061. o = f;
  10062. var p = tryCatch(e, r, n);
  10063. if ("normal" === p.type) {
  10064. if (o = n.done ? s : l, p.arg === y) continue;
  10065. return {
  10066. value: p.arg,
  10067. done: n.done
  10068. };
  10069. }
  10070. "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
  10071. }
  10072. };
  10073. }
  10074. function maybeInvokeDelegate(e, r) {
  10075. var n = r.method,
  10076. o = e.iterator[n];
  10077. if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
  10078. var i = tryCatch(o, e.iterator, r.arg);
  10079. if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
  10080. var a = i.arg;
  10081. return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
  10082. }
  10083. function pushTryEntry(t) {
  10084. var e = {
  10085. tryLoc: t[0]
  10086. };
  10087. 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
  10088. }
  10089. function resetTryEntry(t) {
  10090. var e = t.completion || {};
  10091. e.type = "normal", delete e.arg, t.completion = e;
  10092. }
  10093. function Context(t) {
  10094. this.tryEntries = [{
  10095. tryLoc: "root"
  10096. }], t.forEach(pushTryEntry, this), this.reset(!0);
  10097. }
  10098. function values(e) {
  10099. if (e || "" === e) {
  10100. var r = e[a];
  10101. if (r) return r.call(e);
  10102. if ("function" == typeof e.next) return e;
  10103. if (!isNaN(e.length)) {
  10104. var o = -1,
  10105. i = function next() {
  10106. for (; ++o < e.length;) {
  10107. if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
  10108. }
  10109. return next.value = t, next.done = !0, next;
  10110. };
  10111. return i.next = i;
  10112. }
  10113. }
  10114. throw new TypeError(_typeof(e) + " is not iterable");
  10115. }
  10116. return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
  10117. value: GeneratorFunctionPrototype,
  10118. configurable: !0
  10119. }), o(GeneratorFunctionPrototype, "constructor", {
  10120. value: GeneratorFunction,
  10121. configurable: !0
  10122. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
  10123. var e = "function" == typeof t && t.constructor;
  10124. return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
  10125. }, e.mark = function (t) {
  10126. return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
  10127. }, e.awrap = function (t) {
  10128. return {
  10129. __await: t
  10130. };
  10131. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
  10132. return this;
  10133. }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
  10134. void 0 === i && (i = Promise);
  10135. var a = new AsyncIterator(wrap(t, r, n, o), i);
  10136. return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
  10137. return t.done ? t.value : a.next();
  10138. });
  10139. }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
  10140. return this;
  10141. }), define(g, "toString", function () {
  10142. return "[object Generator]";
  10143. }), e.keys = function (t) {
  10144. var e = Object(t),
  10145. r = [];
  10146. for (var n in e) {
  10147. r.push(n);
  10148. }
  10149. return r.reverse(), function next() {
  10150. for (; r.length;) {
  10151. var t = r.pop();
  10152. if (t in e) return next.value = t, next.done = !1, next;
  10153. }
  10154. return next.done = !0, next;
  10155. };
  10156. }, e.values = values, Context.prototype = {
  10157. constructor: Context,
  10158. reset: function reset(e) {
  10159. if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) {
  10160. "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
  10161. }
  10162. },
  10163. stop: function stop() {
  10164. this.done = !0;
  10165. var t = this.tryEntries[0].completion;
  10166. if ("throw" === t.type) throw t.arg;
  10167. return this.rval;
  10168. },
  10169. dispatchException: function dispatchException(e) {
  10170. if (this.done) throw e;
  10171. var r = this;
  10172. function handle(n, o) {
  10173. return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
  10174. }
  10175. for (var o = this.tryEntries.length - 1; o >= 0; --o) {
  10176. var i = this.tryEntries[o],
  10177. a = i.completion;
  10178. if ("root" === i.tryLoc) return handle("end");
  10179. if (i.tryLoc <= this.prev) {
  10180. var c = n.call(i, "catchLoc"),
  10181. u = n.call(i, "finallyLoc");
  10182. if (c && u) {
  10183. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  10184. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  10185. } else if (c) {
  10186. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  10187. } else {
  10188. if (!u) throw Error("try statement without catch or finally");
  10189. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  10190. }
  10191. }
  10192. }
  10193. },
  10194. abrupt: function abrupt(t, e) {
  10195. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  10196. var o = this.tryEntries[r];
  10197. if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
  10198. var i = o;
  10199. break;
  10200. }
  10201. }
  10202. i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
  10203. var a = i ? i.completion : {};
  10204. return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
  10205. },
  10206. complete: function complete(t, e) {
  10207. if ("throw" === t.type) throw t.arg;
  10208. return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
  10209. },
  10210. finish: function finish(t) {
  10211. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  10212. var r = this.tryEntries[e];
  10213. if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
  10214. }
  10215. },
  10216. "catch": function _catch(t) {
  10217. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  10218. var r = this.tryEntries[e];
  10219. if (r.tryLoc === t) {
  10220. var n = r.completion;
  10221. if ("throw" === n.type) {
  10222. var o = n.arg;
  10223. resetTryEntry(r);
  10224. }
  10225. return o;
  10226. }
  10227. }
  10228. throw Error("illegal catch attempt");
  10229. },
  10230. delegateYield: function delegateYield(e, r, n) {
  10231. return this.delegate = {
  10232. iterator: values(e),
  10233. resultName: r,
  10234. nextLoc: n
  10235. }, "next" === this.method && (this.arg = t), y;
  10236. }
  10237. }, e;
  10238. }
  10239. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
  10240. /***/ }),
  10241. /* 29 */
  10242. /*!*****************************************************************!*\
  10243. !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
  10244. \*****************************************************************/
  10245. /*! no static exports found */
  10246. /***/ (function(module, exports) {
  10247. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  10248. try {
  10249. var info = gen[key](arg);
  10250. var value = info.value;
  10251. } catch (error) {
  10252. reject(error);
  10253. return;
  10254. }
  10255. if (info.done) {
  10256. resolve(value);
  10257. } else {
  10258. Promise.resolve(value).then(_next, _throw);
  10259. }
  10260. }
  10261. function _asyncToGenerator(fn) {
  10262. return function () {
  10263. var self = this,
  10264. args = arguments;
  10265. return new Promise(function (resolve, reject) {
  10266. var gen = fn.apply(self, args);
  10267. function _next(value) {
  10268. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  10269. }
  10270. function _throw(err) {
  10271. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  10272. }
  10273. _next(undefined);
  10274. });
  10275. };
  10276. }
  10277. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  10278. /***/ }),
  10279. /* 30 */
  10280. /*!*******************************************************************!*\
  10281. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/app.js ***!
  10282. \*******************************************************************/
  10283. /*! no static exports found */
  10284. /***/ (function(module, exports, __webpack_require__) {
  10285. /* WEBPACK VAR INJECTION */(function(uni, wx) {var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 14);
  10286. var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ 15);
  10287. var app = {};
  10288. app.sys = /*#__PURE__*/function () {
  10289. "use strict";
  10290. function appSystem() {
  10291. _classCallCheck(this, appSystem);
  10292. }
  10293. _createClass(appSystem, null, [{
  10294. key: "envVersion",
  10295. value:
  10296. /**
  10297. * 环境版本判定回调
  10298. * @param {Object.Function} callbacks 回调执行方法
  10299. */
  10300. function envVersion(callbacks) {
  10301. var _uni$getAccountInfoSy, _uni$getAccountInfoSy2;
  10302. if (!uni.getAccountInfoSync) return;
  10303. var current = (_uni$getAccountInfoSy = uni.getAccountInfoSync()) === null || _uni$getAccountInfoSy === void 0 ? void 0 : (_uni$getAccountInfoSy2 = _uni$getAccountInfoSy.miniProgram) === null || _uni$getAccountInfoSy2 === void 0 ? void 0 : _uni$getAccountInfoSy2.envVersion;
  10304. var fn = callbacks[current];
  10305. if (fn && typeof fn == 'function') fn();
  10306. }
  10307. }]);
  10308. return appSystem;
  10309. }();
  10310. app.url = /*#__PURE__*/function () {
  10311. "use strict";
  10312. function appUrl() {
  10313. _classCallCheck(this, appUrl);
  10314. }
  10315. _createClass(appUrl, null, [{
  10316. key: "goto",
  10317. value:
  10318. /**
  10319. * 跳转到地址
  10320. * @param {String} url path字符串
  10321. * @param {Boolean} mode 跳转模式; false时关闭当前窗口跳转 | null时关闭所有窗口跳转 | 默认为打开新窗口跳转(最多支持10层,页面栈超过10层后默认为false模式);
  10322. */
  10323. function goto(url, mode) {
  10324. return new Promise(function (resolve, reject) {
  10325. var fail = function fail(err) {
  10326. return uni.switchTab({
  10327. url: url,
  10328. success: success
  10329. });
  10330. };
  10331. var success = function success() {
  10332. return resolve();
  10333. };
  10334. if (mode === false) return uni.redirectTo({
  10335. url: url,
  10336. fail: fail
  10337. });
  10338. if (mode === null) return uni.reLaunch({
  10339. url: url,
  10340. fail: fail
  10341. });
  10342. if (getCurrentPages().length < 10) {
  10343. uni.navigateTo({
  10344. url: url,
  10345. fail: fail,
  10346. success: success
  10347. });
  10348. } else {
  10349. uni.redirectTo({
  10350. url: url,
  10351. fail: fail,
  10352. success: success
  10353. });
  10354. }
  10355. });
  10356. }
  10357. /**
  10358. * 返回页面
  10359. * @param {int} delta 返回级数
  10360. */
  10361. }, {
  10362. key: "back",
  10363. value: function back(delta) {
  10364. return uni.navigateBack({
  10365. delta: delta || 1
  10366. });
  10367. }
  10368. /**
  10369. * 刷新页面,会触发onLoad和onShow等钩子
  10370. */
  10371. }, {
  10372. key: "refresh",
  10373. value: function refresh() {
  10374. var pages = getCurrentPages();
  10375. var current = pages[pages.length - 1];
  10376. var url = current.$page.fullPath;
  10377. app.urlGoto(url, false);
  10378. }
  10379. /**
  10380. * 打开新窗口并传递数据
  10381. * @param {String} url path字符串
  10382. * @param {any} data 传递数据
  10383. */
  10384. }, {
  10385. key: "open",
  10386. value: function open(url, data) {
  10387. var pages = getCurrentPages();
  10388. var current = pages[pages.length - 1].$page.fullPath;
  10389. uni.navigateTo({
  10390. url: url,
  10391. success: function success(res) {
  10392. res.eventChannel.emit("OPEN-DATA[".concat(current, "]"), data);
  10393. }
  10394. });
  10395. }
  10396. /**
  10397. * 获取open方法发送到数据
  10398. * @param {Component} component 组件对象
  10399. */
  10400. }, {
  10401. key: "load",
  10402. value: function load(component) {
  10403. return new Promise(function (resolve, reject) {
  10404. var _pages, _pages$$page;
  10405. if (component == undefined) return console.error("app.url.load(this);");
  10406. var pages = getCurrentPages();
  10407. var current = (_pages = pages[pages.length - 2]) === null || _pages === void 0 ? void 0 : (_pages$$page = _pages.$page) === null || _pages$$page === void 0 ? void 0 : _pages$$page.fullPath;
  10408. var caller = component === null || component === void 0 ? void 0 : component.getOpenerEventChannel;
  10409. var channel = caller && caller.call(component);
  10410. if (channel && channel.on) channel.on("OPEN-DATA[".concat(current, "]"), function (data) {
  10411. return resolve(data);
  10412. });
  10413. });
  10414. }
  10415. /**
  10416. * 打开其他小程序
  10417. * @param {String} appid 小程序APPID
  10418. * @param {String} path 要打开的程序路径
  10419. * @param {Object} data 要传递给小程序狗子的参数
  10420. */
  10421. }, {
  10422. key: "applet",
  10423. value: function applet(appid, path, data) {
  10424. return new Promise(function (resolve, reject) {
  10425. uni.navigateToMiniProgram({
  10426. appId: appid,
  10427. path: path,
  10428. extraData: data || {},
  10429. success: function success(res) {
  10430. return resolve(res);
  10431. }
  10432. });
  10433. });
  10434. }
  10435. }]);
  10436. return appUrl;
  10437. }();
  10438. app.storage = /*#__PURE__*/function () {
  10439. "use strict";
  10440. function appStorage() {
  10441. _classCallCheck(this, appStorage);
  10442. }
  10443. _createClass(appStorage, null, [{
  10444. key: "set",
  10445. value:
  10446. /**
  10447. * 设置本地缓存数据
  10448. * @param {String} key 数据键名
  10449. * @param {any} data 存储数据,支持对象
  10450. */
  10451. function set(key, data) {
  10452. try {
  10453. uni.setStorageSync(key, data);
  10454. } catch (err) {
  10455. console.error('app.setStorageSync error: ', err);
  10456. }
  10457. }
  10458. /**
  10459. * 获取本地缓存数据
  10460. * @param {String} key 数据键名
  10461. */
  10462. }, {
  10463. key: "get",
  10464. value: function get(key) {
  10465. return uni.getStorageSync(key);
  10466. }
  10467. /**
  10468. * 清除键缓存数据
  10469. * @param {Object} key 数据键名
  10470. */
  10471. }, {
  10472. key: "remove",
  10473. value: function remove(key) {
  10474. uni.removeStorageSync(key);
  10475. }
  10476. /**
  10477. * 清理所有缓存数据
  10478. */
  10479. }, {
  10480. key: "clear",
  10481. value: function clear() {
  10482. uni.clearStorageSync();
  10483. }
  10484. }]);
  10485. return appStorage;
  10486. }();
  10487. app.math = /*#__PURE__*/function () {
  10488. "use strict";
  10489. function appMath() {
  10490. _classCallCheck(this, appMath);
  10491. }
  10492. _createClass(appMath, null, [{
  10493. key: "add",
  10494. value:
  10495. /**
  10496. * 浮点精确相加
  10497. * @param {Number} arg1 参数1
  10498. * @param {Number} arg2 参数2
  10499. */
  10500. function add(arg1, arg2) {
  10501. var r1, r2, m;
  10502. try {
  10503. r1 = arg1.toString().split(".")[1].length;
  10504. } catch (e) {
  10505. r1 = 0;
  10506. }
  10507. try {
  10508. r2 = arg2.toString().split(".")[1].length;
  10509. } catch (e) {
  10510. r2 = 0;
  10511. }
  10512. m = Math.pow(10, Math.max(r1, r2));
  10513. return (arg1 * m + arg2 * m) / m;
  10514. }
  10515. /**
  10516. * 浮点精确相减
  10517. * @param {Number} arg1 参数1
  10518. * @param {Number} arg2 参数2
  10519. */
  10520. }, {
  10521. key: "sub",
  10522. value: function sub(arg1, arg2) {
  10523. var r1, r2, m, n;
  10524. try {
  10525. r1 = arg1.toString().split(".")[1].length;
  10526. } catch (e) {
  10527. r1 = 0;
  10528. }
  10529. try {
  10530. r2 = arg2.toString().split(".")[1].length;
  10531. } catch (e) {
  10532. r2 = 0;
  10533. }
  10534. m = Math.pow(10, Math.max(r1, r2));
  10535. n = (r1 = r2) ? r1 : r2;
  10536. return ((arg1 * m - arg2 * m) / m).toFixed(n);
  10537. }
  10538. /**
  10539. * 浮点精确相乘
  10540. * @param {Number} arg1 参数1
  10541. * @param {Number} arg2 参数2
  10542. */
  10543. }, {
  10544. key: "mul",
  10545. value: function mul(arg1, arg2) {
  10546. var m = 0,
  10547. s1 = arg1.toString(),
  10548. s2 = arg2.toString();
  10549. try {
  10550. m += s1.split(".")[1].length;
  10551. } catch (e) {}
  10552. try {
  10553. m += s2.split(".")[1].length;
  10554. } catch (e) {}
  10555. return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
  10556. }
  10557. /**
  10558. * 浮点精确相除
  10559. * @param {Number} arg1 参数1
  10560. * @param {Number} arg2 参数2
  10561. */
  10562. }, {
  10563. key: "div",
  10564. value: function div(arg1, arg2) {
  10565. var t1 = 0,
  10566. t2 = 0,
  10567. r1,
  10568. r2;
  10569. try {
  10570. t1 = arg1.toString().split(".")[1].length;
  10571. } catch (e) {}
  10572. ;
  10573. try {
  10574. t2 = arg2.toString().split(".")[1].length;
  10575. } catch (e) {}
  10576. ;
  10577. r1 = Number(arg1.toString().replace(".", ""));
  10578. r2 = Number(arg2.toString().replace(".", ""));
  10579. return r1 / r2 * Math.pow(10, t2 - t1);
  10580. }
  10581. }]);
  10582. return appMath;
  10583. }();
  10584. app.date = /*#__PURE__*/function () {
  10585. "use strict";
  10586. function appDate() {
  10587. _classCallCheck(this, appDate);
  10588. }
  10589. _createClass(appDate, null, [{
  10590. key: "format",
  10591. value:
  10592. /**
  10593. * 日期格式化
  10594. * @param {String} fmt 格式规则
  10595. * @param {String | Date} date 需要格式化的日期
  10596. */
  10597. function format(fmt, date) {
  10598. if (!fmt) fmt = 'yyyy-MM-dd hh:mm:sss';
  10599. if (typeof date === 'string') date = new Date(date.replaceAll('-', '/'));
  10600. if (!date) date = new Date();
  10601. var o = {
  10602. "M+": date.getMonth() + 1,
  10603. //月份
  10604. "d+": date.getDate(),
  10605. //日
  10606. "h+": date.getHours(),
  10607. //小时
  10608. "m+": date.getMinutes(),
  10609. //分
  10610. "s+": date.getSeconds(),
  10611. //秒
  10612. "q+": Math.floor((date.getMonth() + 3) / 3),
  10613. //季度
  10614. "S": date.getMilliseconds() //毫秒
  10615. };
  10616. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  10617. for (var k in o) {
  10618. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  10619. }
  10620. return fmt;
  10621. }
  10622. }]);
  10623. return appDate;
  10624. }();
  10625. app.popup = /*#__PURE__*/function () {
  10626. "use strict";
  10627. function appPopup() {
  10628. _classCallCheck(this, appPopup);
  10629. }
  10630. _createClass(appPopup, null, [{
  10631. key: "confirm",
  10632. value:
  10633. /**
  10634. * 对话框
  10635. * @param {String} content 弹窗内容
  10636. * @param {String} title 弹窗标题
  10637. * @param {Object} opts 参数
  10638. */
  10639. function confirm(content, title, opts) {
  10640. return new Promise(function (resolve, reject) {
  10641. if (!title && title == null) title = '温馨提示';
  10642. opts = Object.assign({
  10643. title: title,
  10644. content: content,
  10645. success: function success(res) {
  10646. return resolve(res.confirm == true);
  10647. },
  10648. fail: function fail(err) {
  10649. return reject(err);
  10650. }
  10651. }, opts);
  10652. uni.showModal(opts);
  10653. });
  10654. }
  10655. /**
  10656. * 提示框
  10657. * @param {String} content 弹窗内容
  10658. * @param {String} title 弹窗标题
  10659. */
  10660. }, {
  10661. key: "alert",
  10662. value: function alert(content, title) {
  10663. return appPopup.confirm(content, title || null, {
  10664. showCancel: false
  10665. });
  10666. }
  10667. }, {
  10668. key: "toast",
  10669. value:
  10670. /**
  10671. * 轻提示
  10672. * @param {String} content 提示内容
  10673. * @param {Object} opts 参数
  10674. */
  10675. function toast(content, opts) {
  10676. uni.showToast(Object.assign({
  10677. title: content,
  10678. position: 'bottom',
  10679. duration: 2000,
  10680. icon: 'none'
  10681. }, opts));
  10682. }
  10683. /**
  10684. * 加载条
  10685. * @param {Boolean} visible 显示
  10686. * @param {Object} opts 参数
  10687. */
  10688. }, {
  10689. key: "loading",
  10690. value: function loading(visible, opts) {
  10691. if (visible) {
  10692. uni.showLoading(Object.assign({
  10693. title: '载入中',
  10694. mask: true
  10695. }, opts));
  10696. var timeout = (opts === null || opts === void 0 ? void 0 : opts.timeout) || 45 * 1000;
  10697. setTimeout(function () {
  10698. return appPopup.loading(false);
  10699. }, timeout);
  10700. } else {
  10701. uni.hideLoading();
  10702. }
  10703. }
  10704. /**
  10705. * 操作菜单
  10706. * @param {Array} data 列表数据
  10707. * @param {String} key 指定显示字段
  10708. * @param {Object} opts 参数
  10709. */
  10710. }, {
  10711. key: "sheet",
  10712. value: function sheet(data, key, opts) {
  10713. return new Promise(function (resolve, reject) {
  10714. uni.showActionSheet(Object.assign({
  10715. title: '',
  10716. itemList: data.map(function (item) {
  10717. return key ? item[key] || String(item) : String(item);
  10718. }),
  10719. success: function success(res) {
  10720. return resolve({
  10721. index: res.tapIndex,
  10722. data: data[res.tapIndex]
  10723. });
  10724. }
  10725. }, opts));
  10726. });
  10727. }
  10728. }]);
  10729. return appPopup;
  10730. }();
  10731. app.map = /*#__PURE__*/function () {
  10732. "use strict";
  10733. function appMap() {
  10734. _classCallCheck(this, appMap);
  10735. }
  10736. _createClass(appMap, null, [{
  10737. key: "get",
  10738. value:
  10739. /**
  10740. * 获取当前位置坐标
  10741. * @param {Boolean} high 是否调用高精度接口
  10742. * @param {Object} opts 参数
  10743. */
  10744. function get(high, opts) {
  10745. return new Promise(function (resolve, reject) {
  10746. var OPTS = Object.assign({
  10747. success: function success(res) {
  10748. console.log(res);
  10749. },
  10750. fail: function fail(err) {
  10751. console.log(err);
  10752. }
  10753. }, opts);
  10754. high ? uni.getLocation(OPTS) : uni.getFuzzyLocation(OPTS);
  10755. });
  10756. }
  10757. }]);
  10758. return appMap;
  10759. }();
  10760. app.act = /*#__PURE__*/function () {
  10761. "use strict";
  10762. function appAct() {
  10763. _classCallCheck(this, appAct);
  10764. }
  10765. _createClass(appAct, null, [{
  10766. key: "callPhone",
  10767. value:
  10768. /**
  10769. * 拨打电话
  10770. * @param {String} phone
  10771. */
  10772. function callPhone(phone) {
  10773. uni.makePhoneCall({
  10774. phoneNumber: phone
  10775. });
  10776. }
  10777. /**
  10778. * 调用扫描
  10779. * @param {Object} opts 参数配置,详细查看 https://uniapp.dcloud.net.cn/api/system/barcode.html
  10780. */
  10781. }, {
  10782. key: "scan",
  10783. value: function scan(opts) {
  10784. return new Promise(function (resolve, reject) {
  10785. uni.scanCode(Object.assign({}, {
  10786. success: function success(res) {
  10787. return resolve(res);
  10788. }
  10789. // fail: err=>reject(err),
  10790. }, opts));
  10791. });
  10792. }
  10793. /**
  10794. * 获取节点信息
  10795. * @param {Component} component 组件
  10796. * @param {String} selector 类似于 CSS 的选择器
  10797. * @param {Boolean} multi 是否多节点
  10798. */
  10799. }, {
  10800. key: "selectorQuery",
  10801. value: function selectorQuery(component, selector, multi) {
  10802. return new Promise(function (resolve, reject) {
  10803. var query = uni.createSelectorQuery().in(component)[multi ? 'selectAll' : 'select'](selector);
  10804. query.boundingClientRect(function (data) {
  10805. if (data) resolve(data);
  10806. }).exec();
  10807. });
  10808. }
  10809. /**
  10810. * 复制文本到剪贴板
  10811. * @param {String} str 需要复制的文本
  10812. */
  10813. }, {
  10814. key: "copy",
  10815. value: function copy(str) {
  10816. return new Promise(function (resolve, reject) {
  10817. uni.setClipboardData({
  10818. data: 'hello',
  10819. success: resolve(),
  10820. fail: function fail(err) {
  10821. return reject(err);
  10822. }
  10823. });
  10824. });
  10825. }
  10826. /**
  10827. * 客服服务
  10828. * @param {Object} id
  10829. * @param {Object} url
  10830. */
  10831. }, {
  10832. key: "customerService",
  10833. value: function customerService(id, url) {
  10834. return new Promise(function (resolve, reject) {
  10835. wx.openCustomerServiceChat({
  10836. extInfo: {
  10837. url: url
  10838. },
  10839. corpId: id,
  10840. success: function success(res) {
  10841. return resolve(res);
  10842. },
  10843. fail: function fail(err) {
  10844. return reject(err);
  10845. }
  10846. });
  10847. });
  10848. }
  10849. }]);
  10850. return appAct;
  10851. }();
  10852. module.exports = app;
  10853. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-alipay/dist/index.js */ 1)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-alipay/dist/index.js */ 1)["default"]))
  10854. /***/ }),
  10855. /* 31 */
  10856. /*!**********************************************************************!*\
  10857. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/config.js ***!
  10858. \**********************************************************************/
  10859. /*! no static exports found */
  10860. /***/ (function(module, exports, __webpack_require__) {
  10861. "use strict";
  10862. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 3);
  10863. Object.defineProperty(exports, "__esModule", {
  10864. value: true
  10865. });
  10866. exports.default = void 0;
  10867. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 10));
  10868. var _app = _interopRequireDefault(__webpack_require__(/*! ./app */ 30));
  10869. var _pages = _interopRequireDefault(__webpack_require__(/*! @/pages.json */ 32));
  10870. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  10871. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  10872. var config = {};
  10873. // 地址类
  10874. config.url = {
  10875. // API请求基础URL
  10876. // request : 'https://charge.hub.zswlgz.com/',
  10877. // request : 'http://192.168.1.34:80/',
  10878. // request : 'http://120.78.228.211:8866/',
  10879. request: 'https://charge.dev.hub.zswlgz.com/',
  10880. // 上传地址
  10881. upload: 'http://127.0.0.1:3000/upload/',
  10882. // 下载地址
  10883. download: 'http://oss.aabb.com/download/',
  10884. // 静态文件服务
  10885. static: 'http://oss.aabb.com/',
  10886. //配置文件地址
  10887. configUrl: 'http://bx.eomp.cn/adp/'
  10888. };
  10889. // 接口类
  10890. config.api = {
  10891. login: '/userApi/login'
  10892. };
  10893. // 键名类
  10894. config.keyname = {
  10895. userInfo: 'USER_INFO',
  10896. userToken: 'USER_TOKEN',
  10897. logs: 'LOGS_DATA'
  10898. };
  10899. // 事件名
  10900. config.eventName = {
  10901. setResult: 'SET-HOME-RESULT'
  10902. };
  10903. // 客服
  10904. config.customerService = {
  10905. id: 'wwfb3777bf94dcfaf1',
  10906. url: 'https://work.weixin.qq.com/kfid/kfc4feac060f5c1bc7e'
  10907. };
  10908. // pages.json 页面配置文件
  10909. config.pages = _pages.default.pages.map(function (i) {
  10910. i.style = _objectSpread(_objectSpread({}, _pages.default.globalStyle), i.style);
  10911. return i;
  10912. });
  10913. // 不同版本执行器
  10914. _app.default.sys.envVersion({
  10915. // 正式版
  10916. release: function release() {},
  10917. // 体验版
  10918. trial: function trial() {},
  10919. // 开发版
  10920. develop: function develop() {}
  10921. });
  10922. var _default = config;
  10923. exports.default = _default;
  10924. /***/ }),
  10925. /* 32 */
  10926. /*!******************************************************************************************!*\
  10927. !*** E:/zswl/code/charge_miniapp/charge_miniapp/pages.json?{"type":"origin-pages-json"} ***!
  10928. \******************************************************************************************/
  10929. /*! no static exports found */
  10930. /***/ (function(module, exports, __webpack_require__) {
  10931. "use strict";
  10932. Object.defineProperty(exports, "__esModule", {
  10933. value: true
  10934. });
  10935. exports.default = void 0;
  10936. var _default = {
  10937. "pages": [{
  10938. "path": "pages/index/index",
  10939. "style": {
  10940. "navigationBarTitleText": "首页"
  10941. }
  10942. }, {
  10943. "path": "pages/map/map",
  10944. "style": {
  10945. "navigationBarTitleText": "地图模式"
  10946. }
  10947. }, {
  10948. "path": "pages/my/my",
  10949. "style": {
  10950. "navigationBarTitleText": "个人中心"
  10951. }
  10952. }, {
  10953. "path": "pages/site/site",
  10954. "style": {
  10955. "navigationBarTitleText": "站点详情"
  10956. }
  10957. }, {
  10958. "path": "pages/site-more/site-more",
  10959. "style": {
  10960. "navigationBarTitleText": "电站价格"
  10961. }
  10962. }, {
  10963. "path": "pages/charging/charging",
  10964. "style": {
  10965. "navigationBarTitleText": "正在充电"
  10966. }
  10967. }, {
  10968. "path": "pages/order-detail/order-detail",
  10969. "style": {
  10970. "navigationBarTitleText": "订单详情"
  10971. }
  10972. }, {
  10973. "path": "pages/terminal/terminal",
  10974. "style": {
  10975. "navigationBarTitleText": "充电终端"
  10976. }
  10977. }, {
  10978. "path": "pages/coupon-buy/coupon-buy",
  10979. "style": {
  10980. "navigationBarTitleText": "购券中心"
  10981. }
  10982. }, {
  10983. "path": "pages/login/login",
  10984. "style": {
  10985. "navigationBarTitleText": "用户登录"
  10986. }
  10987. }, {
  10988. "path": "pages/recharge-log/recharge-log",
  10989. "style": {
  10990. "navigationBarTitleText": "购券记录"
  10991. }
  10992. }, {
  10993. "path": "pages/feedback/feedback",
  10994. "style": {
  10995. "navigationBarTitleText": ""
  10996. }
  10997. }, {
  10998. "path": "pages/order/order",
  10999. "style": {
  11000. "navigationBarTitleText": "充电订单"
  11001. }
  11002. }, {
  11003. "path": "pages/search/search",
  11004. "style": {
  11005. "navigationBarTitleText": "站点搜索"
  11006. }
  11007. }, {
  11008. "path": "pages/Invite-staff/Invite-staff",
  11009. "style": {
  11010. "navigationBarTitleText": "邀请员工"
  11011. }
  11012. }, {
  11013. "path": "pages/web/web",
  11014. "style": {
  11015. "navigationBarTitleText": "",
  11016. "navigationStyle": "default",
  11017. "navigationBarBackgroundColor": "#fff",
  11018. "backgroundColor": "#fff"
  11019. }
  11020. }, {
  11021. "path": "pages/feedback-reply/feedback-reply",
  11022. "style": {
  11023. "navigationBarTitleText": "反馈答复"
  11024. }
  11025. }],
  11026. "globalStyle": {
  11027. "navigationBarTextStyle": "black",
  11028. "navigationBarTitleText": "中数电动",
  11029. "navigationBarBackgroundColor": "#C7FFFD",
  11030. "backgroundColor": "#C7FFFD",
  11031. "navigationStyle": "custom"
  11032. },
  11033. "uniIdRouter": {}
  11034. };
  11035. exports.default = _default;
  11036. /***/ }),
  11037. /* 33 */,
  11038. /* 34 */,
  11039. /* 35 */
  11040. /*!**********************************************************************************************************!*\
  11041. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  11042. \**********************************************************************************************************/
  11043. /*! exports provided: default */
  11044. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11045. "use strict";
  11046. __webpack_require__.r(__webpack_exports__);
  11047. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  11048. /* globals __VUE_SSR_CONTEXT__ */
  11049. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  11050. // This module is a runtime utility for cleaner component module output and will
  11051. // be included in the final webpack user bundle.
  11052. function normalizeComponent (
  11053. scriptExports,
  11054. render,
  11055. staticRenderFns,
  11056. functionalTemplate,
  11057. injectStyles,
  11058. scopeId,
  11059. moduleIdentifier, /* server only */
  11060. shadowMode, /* vue-cli only */
  11061. components, // fixed by xxxxxx auto components
  11062. renderjs // fixed by xxxxxx renderjs
  11063. ) {
  11064. // Vue.extend constructor export interop
  11065. var options = typeof scriptExports === 'function'
  11066. ? scriptExports.options
  11067. : scriptExports
  11068. // fixed by xxxxxx auto components
  11069. if (components) {
  11070. if (!options.components) {
  11071. options.components = {}
  11072. }
  11073. var hasOwn = Object.prototype.hasOwnProperty
  11074. for (var name in components) {
  11075. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  11076. options.components[name] = components[name]
  11077. }
  11078. }
  11079. }
  11080. // fixed by xxxxxx renderjs
  11081. if (renderjs) {
  11082. if(typeof renderjs.beforeCreate === 'function'){
  11083. renderjs.beforeCreate = [renderjs.beforeCreate]
  11084. }
  11085. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  11086. this[renderjs.__module] = this
  11087. });
  11088. (options.mixins || (options.mixins = [])).push(renderjs)
  11089. }
  11090. // render functions
  11091. if (render) {
  11092. options.render = render
  11093. options.staticRenderFns = staticRenderFns
  11094. options._compiled = true
  11095. }
  11096. // functional template
  11097. if (functionalTemplate) {
  11098. options.functional = true
  11099. }
  11100. // scopedId
  11101. if (scopeId) {
  11102. options._scopeId = 'data-v-' + scopeId
  11103. }
  11104. var hook
  11105. if (moduleIdentifier) { // server build
  11106. hook = function (context) {
  11107. // 2.3 injection
  11108. context =
  11109. context || // cached call
  11110. (this.$vnode && this.$vnode.ssrContext) || // stateful
  11111. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  11112. // 2.2 with runInNewContext: true
  11113. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  11114. context = __VUE_SSR_CONTEXT__
  11115. }
  11116. // inject component styles
  11117. if (injectStyles) {
  11118. injectStyles.call(this, context)
  11119. }
  11120. // register component module identifier for async chunk inferrence
  11121. if (context && context._registeredComponents) {
  11122. context._registeredComponents.add(moduleIdentifier)
  11123. }
  11124. }
  11125. // used by ssr in case component is cached and beforeCreate
  11126. // never gets called
  11127. options._ssrRegister = hook
  11128. } else if (injectStyles) {
  11129. hook = shadowMode
  11130. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  11131. : injectStyles
  11132. }
  11133. if (hook) {
  11134. if (options.functional) {
  11135. // for template-only hot-reload because in that case the render fn doesn't
  11136. // go through the normalizer
  11137. options._injectStyles = hook
  11138. // register for functioal component in vue file
  11139. var originalRender = options.render
  11140. options.render = function renderWithStyleInjection (h, context) {
  11141. hook.call(context)
  11142. return originalRender(h, context)
  11143. }
  11144. } else {
  11145. // inject component registration as beforeCreate hook
  11146. var existing = options.beforeCreate
  11147. options.beforeCreate = existing
  11148. ? [].concat(existing, hook)
  11149. : [hook]
  11150. }
  11151. }
  11152. return {
  11153. exports: scriptExports,
  11154. options: options
  11155. }
  11156. }
  11157. /***/ }),
  11158. /* 36 */
  11159. /*!***************************************************************************!*\
  11160. !*** E:/zswl/code/charge_miniapp/charge_miniapp/uni.promisify.adaptor.js ***!
  11161. \***************************************************************************/
  11162. /*! no static exports found */
  11163. /***/ (function(module, exports, __webpack_require__) {
  11164. /* WEBPACK VAR INJECTION */(function(uni) {var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 12);
  11165. uni.addInterceptor({
  11166. returnValue: function returnValue(res) {
  11167. if (!(!!res && (_typeof(res) === "object" || typeof res === "function") && typeof res.then === "function")) {
  11168. return res;
  11169. }
  11170. return new Promise(function (resolve, reject) {
  11171. res.then(function (res) {
  11172. return res[0] ? reject(res[0]) : resolve(res[1]);
  11173. });
  11174. });
  11175. }
  11176. });
  11177. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-alipay/dist/index.js */ 1)["default"]))
  11178. /***/ }),
  11179. /* 37 */
  11180. /*!*********************************************************************!*\
  11181. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/index.js ***!
  11182. \*********************************************************************/
  11183. /*! no static exports found */
  11184. /***/ (function(module, exports, __webpack_require__) {
  11185. "use strict";
  11186. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 3);
  11187. Object.defineProperty(exports, "__esModule", {
  11188. value: true
  11189. });
  11190. Object.defineProperty(exports, "$Api", {
  11191. enumerable: true,
  11192. get: function get() {
  11193. return _api.default;
  11194. }
  11195. });
  11196. Object.defineProperty(exports, "$App", {
  11197. enumerable: true,
  11198. get: function get() {
  11199. return _app.default;
  11200. }
  11201. });
  11202. Object.defineProperty(exports, "$Config", {
  11203. enumerable: true,
  11204. get: function get() {
  11205. return _config.default;
  11206. }
  11207. });
  11208. Object.defineProperty(exports, "$Qrcode", {
  11209. enumerable: true,
  11210. get: function get() {
  11211. return _wxqrcode.default;
  11212. }
  11213. });
  11214. var _app = _interopRequireDefault(__webpack_require__(/*! ./app.js */ 30));
  11215. var _api = _interopRequireDefault(__webpack_require__(/*! ./api.js */ 26));
  11216. var _config = _interopRequireDefault(__webpack_require__(/*! ./config.js */ 31));
  11217. var _wxqrcode = _interopRequireDefault(__webpack_require__(/*! ./wxqrcode.js */ 38));
  11218. /***/ }),
  11219. /* 38 */
  11220. /*!************************************************************************!*\
  11221. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/wxqrcode.js ***!
  11222. \************************************************************************/
  11223. /*! no static exports found */
  11224. /***/ (function(module, exports) {
  11225. //---------------------------------------------------------------------
  11226. //
  11227. // QR Code Generator for JavaScript
  11228. //
  11229. // Copyright (c) 2009 Kazuhiko Arase
  11230. //
  11231. // URL: http://www.d-project.com/
  11232. //
  11233. // Licensed under the MIT license:
  11234. // http://www.opensource.org/licenses/mit-license.php
  11235. //
  11236. // The word 'QR Code' is registered trademark of
  11237. // DENSO WAVE INCORPORATED
  11238. // http://www.denso-wave.com/qrcode/faqpatent-e.html
  11239. //
  11240. //---------------------------------------------------------------------
  11241. //---------------------------------------------------------------------
  11242. // qrcode
  11243. //代码第1588行为补充代码
  11244. //修改人:chenxing
  11245. //2017-02-27 16:21:32
  11246. //---------------------------------------------------------------------
  11247. /**
  11248. * qrcode
  11249. * @param typeNumber 1 to 40
  11250. * @param errorCorrectLevel 'L','M','Q','H'
  11251. */
  11252. var qrcode = function qrcode(typeNumber, errorCorrectLevel) {
  11253. var PAD0 = 0xEC;
  11254. var PAD1 = 0x11;
  11255. var _typeNumber = typeNumber;
  11256. var _errorCorrectLevel = QRErrorCorrectLevel[errorCorrectLevel];
  11257. var _modules = null;
  11258. var _moduleCount = 0;
  11259. var _dataCache = null;
  11260. var _dataList = new Array();
  11261. var _this = {};
  11262. var makeImpl = function makeImpl(test, maskPattern) {
  11263. _moduleCount = _typeNumber * 4 + 17;
  11264. _modules = function (moduleCount) {
  11265. var modules = new Array(moduleCount);
  11266. for (var row = 0; row < moduleCount; row += 1) {
  11267. modules[row] = new Array(moduleCount);
  11268. for (var col = 0; col < moduleCount; col += 1) {
  11269. modules[row][col] = null;
  11270. }
  11271. }
  11272. return modules;
  11273. }(_moduleCount);
  11274. setupPositionProbePattern(0, 0);
  11275. setupPositionProbePattern(_moduleCount - 7, 0);
  11276. setupPositionProbePattern(0, _moduleCount - 7);
  11277. setupPositionAdjustPattern();
  11278. setupTimingPattern();
  11279. setupTypeInfo(test, maskPattern);
  11280. if (_typeNumber >= 7) {
  11281. setupTypeNumber(test);
  11282. }
  11283. if (_dataCache == null) {
  11284. _dataCache = createData(_typeNumber, _errorCorrectLevel, _dataList);
  11285. }
  11286. mapData(_dataCache, maskPattern);
  11287. };
  11288. var setupPositionProbePattern = function setupPositionProbePattern(row, col) {
  11289. for (var r = -1; r <= 7; r += 1) {
  11290. if (row + r <= -1 || _moduleCount <= row + r) continue;
  11291. for (var c = -1; c <= 7; c += 1) {
  11292. if (col + c <= -1 || _moduleCount <= col + c) continue;
  11293. if (0 <= r && r <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (r == 0 || r == 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
  11294. _modules[row + r][col + c] = true;
  11295. } else {
  11296. _modules[row + r][col + c] = false;
  11297. }
  11298. }
  11299. }
  11300. };
  11301. var getBestMaskPattern = function getBestMaskPattern() {
  11302. var minLostPoint = 0;
  11303. var pattern = 0;
  11304. for (var i = 0; i < 8; i += 1) {
  11305. makeImpl(true, i);
  11306. var lostPoint = QRUtil.getLostPoint(_this);
  11307. if (i == 0 || minLostPoint > lostPoint) {
  11308. minLostPoint = lostPoint;
  11309. pattern = i;
  11310. }
  11311. }
  11312. return pattern;
  11313. };
  11314. var setupTimingPattern = function setupTimingPattern() {
  11315. for (var r = 8; r < _moduleCount - 8; r += 1) {
  11316. if (_modules[r][6] != null) {
  11317. continue;
  11318. }
  11319. _modules[r][6] = r % 2 == 0;
  11320. }
  11321. for (var c = 8; c < _moduleCount - 8; c += 1) {
  11322. if (_modules[6][c] != null) {
  11323. continue;
  11324. }
  11325. _modules[6][c] = c % 2 == 0;
  11326. }
  11327. };
  11328. var setupPositionAdjustPattern = function setupPositionAdjustPattern() {
  11329. var pos = QRUtil.getPatternPosition(_typeNumber);
  11330. for (var i = 0; i < pos.length; i += 1) {
  11331. for (var j = 0; j < pos.length; j += 1) {
  11332. var row = pos[i];
  11333. var col = pos[j];
  11334. if (_modules[row][col] != null) {
  11335. continue;
  11336. }
  11337. for (var r = -2; r <= 2; r += 1) {
  11338. for (var c = -2; c <= 2; c += 1) {
  11339. if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
  11340. _modules[row + r][col + c] = true;
  11341. } else {
  11342. _modules[row + r][col + c] = false;
  11343. }
  11344. }
  11345. }
  11346. }
  11347. }
  11348. };
  11349. var setupTypeNumber = function setupTypeNumber(test) {
  11350. var bits = QRUtil.getBCHTypeNumber(_typeNumber);
  11351. for (var i = 0; i < 18; i += 1) {
  11352. var mod = !test && (bits >> i & 1) == 1;
  11353. _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
  11354. }
  11355. for (var i = 0; i < 18; i += 1) {
  11356. var mod = !test && (bits >> i & 1) == 1;
  11357. _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
  11358. }
  11359. };
  11360. var setupTypeInfo = function setupTypeInfo(test, maskPattern) {
  11361. var data = _errorCorrectLevel << 3 | maskPattern;
  11362. var bits = QRUtil.getBCHTypeInfo(data);
  11363. // vertical
  11364. for (var i = 0; i < 15; i += 1) {
  11365. var mod = !test && (bits >> i & 1) == 1;
  11366. if (i < 6) {
  11367. _modules[i][8] = mod;
  11368. } else if (i < 8) {
  11369. _modules[i + 1][8] = mod;
  11370. } else {
  11371. _modules[_moduleCount - 15 + i][8] = mod;
  11372. }
  11373. }
  11374. // horizontal
  11375. for (var i = 0; i < 15; i += 1) {
  11376. var mod = !test && (bits >> i & 1) == 1;
  11377. if (i < 8) {
  11378. _modules[8][_moduleCount - i - 1] = mod;
  11379. } else if (i < 9) {
  11380. _modules[8][15 - i - 1 + 1] = mod;
  11381. } else {
  11382. _modules[8][15 - i - 1] = mod;
  11383. }
  11384. }
  11385. // fixed module
  11386. _modules[_moduleCount - 8][8] = !test;
  11387. };
  11388. var mapData = function mapData(data, maskPattern) {
  11389. var inc = -1;
  11390. var row = _moduleCount - 1;
  11391. var bitIndex = 7;
  11392. var byteIndex = 0;
  11393. var maskFunc = QRUtil.getMaskFunction(maskPattern);
  11394. for (var col = _moduleCount - 1; col > 0; col -= 2) {
  11395. if (col == 6) col -= 1;
  11396. while (true) {
  11397. for (var c = 0; c < 2; c += 1) {
  11398. if (_modules[row][col - c] == null) {
  11399. var dark = false;
  11400. if (byteIndex < data.length) {
  11401. dark = (data[byteIndex] >>> bitIndex & 1) == 1;
  11402. }
  11403. var mask = maskFunc(row, col - c);
  11404. if (mask) {
  11405. dark = !dark;
  11406. }
  11407. _modules[row][col - c] = dark;
  11408. bitIndex -= 1;
  11409. if (bitIndex == -1) {
  11410. byteIndex += 1;
  11411. bitIndex = 7;
  11412. }
  11413. }
  11414. }
  11415. row += inc;
  11416. if (row < 0 || _moduleCount <= row) {
  11417. row -= inc;
  11418. inc = -inc;
  11419. break;
  11420. }
  11421. }
  11422. }
  11423. };
  11424. var createBytes = function createBytes(buffer, rsBlocks) {
  11425. var offset = 0;
  11426. var maxDcCount = 0;
  11427. var maxEcCount = 0;
  11428. var dcdata = new Array(rsBlocks.length);
  11429. var ecdata = new Array(rsBlocks.length);
  11430. for (var r = 0; r < rsBlocks.length; r += 1) {
  11431. var dcCount = rsBlocks[r].dataCount;
  11432. var ecCount = rsBlocks[r].totalCount - dcCount;
  11433. maxDcCount = Math.max(maxDcCount, dcCount);
  11434. maxEcCount = Math.max(maxEcCount, ecCount);
  11435. dcdata[r] = new Array(dcCount);
  11436. for (var i = 0; i < dcdata[r].length; i += 1) {
  11437. dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
  11438. }
  11439. offset += dcCount;
  11440. var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
  11441. var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
  11442. var modPoly = rawPoly.mod(rsPoly);
  11443. ecdata[r] = new Array(rsPoly.getLength() - 1);
  11444. for (var i = 0; i < ecdata[r].length; i += 1) {
  11445. var modIndex = i + modPoly.getLength() - ecdata[r].length;
  11446. ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
  11447. }
  11448. }
  11449. var totalCodeCount = 0;
  11450. for (var i = 0; i < rsBlocks.length; i += 1) {
  11451. totalCodeCount += rsBlocks[i].totalCount;
  11452. }
  11453. var data = new Array(totalCodeCount);
  11454. var index = 0;
  11455. for (var i = 0; i < maxDcCount; i += 1) {
  11456. for (var r = 0; r < rsBlocks.length; r += 1) {
  11457. if (i < dcdata[r].length) {
  11458. data[index] = dcdata[r][i];
  11459. index += 1;
  11460. }
  11461. }
  11462. }
  11463. for (var i = 0; i < maxEcCount; i += 1) {
  11464. for (var r = 0; r < rsBlocks.length; r += 1) {
  11465. if (i < ecdata[r].length) {
  11466. data[index] = ecdata[r][i];
  11467. index += 1;
  11468. }
  11469. }
  11470. }
  11471. return data;
  11472. };
  11473. var createData = function createData(typeNumber, errorCorrectLevel, dataList) {
  11474. var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
  11475. var buffer = qrBitBuffer();
  11476. for (var i = 0; i < dataList.length; i += 1) {
  11477. var data = dataList[i];
  11478. buffer.put(data.getMode(), 4);
  11479. buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber));
  11480. data.write(buffer);
  11481. }
  11482. // calc num max data.
  11483. var totalDataCount = 0;
  11484. for (var i = 0; i < rsBlocks.length; i += 1) {
  11485. totalDataCount += rsBlocks[i].dataCount;
  11486. }
  11487. if (buffer.getLengthInBits() > totalDataCount * 8) {
  11488. throw new Error('code length overflow. (' + buffer.getLengthInBits() + '>' + totalDataCount * 8 + ')');
  11489. }
  11490. // end code
  11491. if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
  11492. buffer.put(0, 4);
  11493. }
  11494. // padding
  11495. while (buffer.getLengthInBits() % 8 != 0) {
  11496. buffer.putBit(false);
  11497. }
  11498. // padding
  11499. while (true) {
  11500. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  11501. break;
  11502. }
  11503. buffer.put(PAD0, 8);
  11504. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  11505. break;
  11506. }
  11507. buffer.put(PAD1, 8);
  11508. }
  11509. return createBytes(buffer, rsBlocks);
  11510. };
  11511. _this.addData = function (data) {
  11512. var newData = qr8BitByte(data);
  11513. _dataList.push(newData);
  11514. _dataCache = null;
  11515. };
  11516. _this.isDark = function (row, col) {
  11517. if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
  11518. throw new Error(row + ',' + col);
  11519. }
  11520. return _modules[row][col];
  11521. };
  11522. _this.getModuleCount = function () {
  11523. return _moduleCount;
  11524. };
  11525. _this.make = function () {
  11526. makeImpl(false, getBestMaskPattern());
  11527. };
  11528. _this.createTableTag = function (cellSize, margin) {
  11529. cellSize = cellSize || 2;
  11530. margin = typeof margin == 'undefined' ? cellSize * 4 : margin;
  11531. var qrHtml = '';
  11532. qrHtml += '<table style="';
  11533. qrHtml += ' border-width: 0px; border-style: none;';
  11534. qrHtml += ' border-collapse: collapse;';
  11535. qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
  11536. qrHtml += '">';
  11537. qrHtml += '<tbody>';
  11538. for (var r = 0; r < _this.getModuleCount(); r += 1) {
  11539. qrHtml += '<tr>';
  11540. for (var c = 0; c < _this.getModuleCount(); c += 1) {
  11541. qrHtml += '<td style="';
  11542. qrHtml += ' border-width: 0px; border-style: none;';
  11543. qrHtml += ' border-collapse: collapse;';
  11544. qrHtml += ' padding: 0px; margin: 0px;';
  11545. qrHtml += ' width: ' + cellSize + 'px;';
  11546. qrHtml += ' height: ' + cellSize + 'px;';
  11547. qrHtml += ' background-color: ';
  11548. qrHtml += _this.isDark(r, c) ? '#000000' : '#ffffff';
  11549. qrHtml += ';';
  11550. qrHtml += '"/>';
  11551. }
  11552. qrHtml += '</tr>';
  11553. }
  11554. qrHtml += '</tbody>';
  11555. qrHtml += '</table>';
  11556. return qrHtml;
  11557. };
  11558. _this.createImgTag = function (cellSize, margin, size) {
  11559. cellSize = cellSize || 2;
  11560. margin = typeof margin == 'undefined' ? cellSize * 4 : margin;
  11561. var min = margin;
  11562. var max = _this.getModuleCount() * cellSize + margin;
  11563. return createImgTag(size, size, function (x, y) {
  11564. if (min <= x && x < max && min <= y && y < max) {
  11565. var c = Math.floor((x - min) / cellSize);
  11566. var r = Math.floor((y - min) / cellSize);
  11567. return _this.isDark(r, c) ? 0 : 1;
  11568. } else {
  11569. return 1;
  11570. }
  11571. });
  11572. };
  11573. return _this;
  11574. };
  11575. //---------------------------------------------------------------------
  11576. // qrcode.stringToBytes
  11577. //---------------------------------------------------------------------
  11578. qrcode.stringToBytes = function (s) {
  11579. var bytes = new Array();
  11580. for (var i = 0; i < s.length; i += 1) {
  11581. var c = s.charCodeAt(i);
  11582. bytes.push(c & 0xff);
  11583. }
  11584. return bytes;
  11585. };
  11586. //---------------------------------------------------------------------
  11587. // qrcode.createStringToBytes
  11588. //---------------------------------------------------------------------
  11589. /**
  11590. * @param unicodeData base64 string of byte array.
  11591. * [16bit Unicode],[16bit Bytes], ...
  11592. * @param numChars
  11593. */
  11594. qrcode.createStringToBytes = function (unicodeData, numChars) {
  11595. // create conversion map.
  11596. var unicodeMap = function () {
  11597. var bin = base64DecodeInputStream(unicodeData);
  11598. var read = function read() {
  11599. var b = bin.read();
  11600. if (b == -1) throw new Error();
  11601. return b;
  11602. };
  11603. var count = 0;
  11604. var unicodeMap = {};
  11605. while (true) {
  11606. var b0 = bin.read();
  11607. if (b0 == -1) break;
  11608. var b1 = read();
  11609. var b2 = read();
  11610. var b3 = read();
  11611. var k = String.fromCharCode(b0 << 8 | b1);
  11612. var v = b2 << 8 | b3;
  11613. unicodeMap[k] = v;
  11614. count += 1;
  11615. }
  11616. if (count != numChars) {
  11617. throw new Error(count + ' != ' + numChars);
  11618. }
  11619. return unicodeMap;
  11620. }();
  11621. var unknownChar = '?'.charCodeAt(0);
  11622. return function (s) {
  11623. var bytes = new Array();
  11624. for (var i = 0; i < s.length; i += 1) {
  11625. var c = s.charCodeAt(i);
  11626. if (c < 128) {
  11627. bytes.push(c);
  11628. } else {
  11629. var b = unicodeMap[s.charAt(i)];
  11630. if (typeof b == 'number') {
  11631. if ((b & 0xff) == b) {
  11632. // 1byte
  11633. bytes.push(b);
  11634. } else {
  11635. // 2bytes
  11636. bytes.push(b >>> 8);
  11637. bytes.push(b & 0xff);
  11638. }
  11639. } else {
  11640. bytes.push(unknownChar);
  11641. }
  11642. }
  11643. }
  11644. return bytes;
  11645. };
  11646. };
  11647. //---------------------------------------------------------------------
  11648. // QRMode
  11649. //---------------------------------------------------------------------
  11650. var QRMode = {
  11651. MODE_NUMBER: 1 << 0,
  11652. MODE_ALPHA_NUM: 1 << 1,
  11653. MODE_8BIT_BYTE: 1 << 2,
  11654. MODE_KANJI: 1 << 3
  11655. };
  11656. //---------------------------------------------------------------------
  11657. // QRErrorCorrectLevel
  11658. //---------------------------------------------------------------------
  11659. var QRErrorCorrectLevel = {
  11660. L: 1,
  11661. M: 0,
  11662. Q: 3,
  11663. H: 2
  11664. };
  11665. //---------------------------------------------------------------------
  11666. // QRMaskPattern
  11667. //---------------------------------------------------------------------
  11668. var QRMaskPattern = {
  11669. PATTERN000: 0,
  11670. PATTERN001: 1,
  11671. PATTERN010: 2,
  11672. PATTERN011: 3,
  11673. PATTERN100: 4,
  11674. PATTERN101: 5,
  11675. PATTERN110: 6,
  11676. PATTERN111: 7
  11677. };
  11678. //---------------------------------------------------------------------
  11679. // QRUtil
  11680. //---------------------------------------------------------------------
  11681. var QRUtil = function () {
  11682. var PATTERN_POSITION_TABLE = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]];
  11683. var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
  11684. var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
  11685. var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
  11686. var _this = {};
  11687. var getBCHDigit = function getBCHDigit(data) {
  11688. var digit = 0;
  11689. while (data != 0) {
  11690. digit += 1;
  11691. data >>>= 1;
  11692. }
  11693. return digit;
  11694. };
  11695. _this.getBCHTypeInfo = function (data) {
  11696. var d = data << 10;
  11697. while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
  11698. d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
  11699. }
  11700. return (data << 10 | d) ^ G15_MASK;
  11701. };
  11702. _this.getBCHTypeNumber = function (data) {
  11703. var d = data << 12;
  11704. while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
  11705. d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
  11706. }
  11707. return data << 12 | d;
  11708. };
  11709. _this.getPatternPosition = function (typeNumber) {
  11710. return PATTERN_POSITION_TABLE[typeNumber - 1];
  11711. };
  11712. _this.getMaskFunction = function (maskPattern) {
  11713. switch (maskPattern) {
  11714. case QRMaskPattern.PATTERN000:
  11715. return function (i, j) {
  11716. return (i + j) % 2 == 0;
  11717. };
  11718. case QRMaskPattern.PATTERN001:
  11719. return function (i, j) {
  11720. return i % 2 == 0;
  11721. };
  11722. case QRMaskPattern.PATTERN010:
  11723. return function (i, j) {
  11724. return j % 3 == 0;
  11725. };
  11726. case QRMaskPattern.PATTERN011:
  11727. return function (i, j) {
  11728. return (i + j) % 3 == 0;
  11729. };
  11730. case QRMaskPattern.PATTERN100:
  11731. return function (i, j) {
  11732. return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
  11733. };
  11734. case QRMaskPattern.PATTERN101:
  11735. return function (i, j) {
  11736. return i * j % 2 + i * j % 3 == 0;
  11737. };
  11738. case QRMaskPattern.PATTERN110:
  11739. return function (i, j) {
  11740. return (i * j % 2 + i * j % 3) % 2 == 0;
  11741. };
  11742. case QRMaskPattern.PATTERN111:
  11743. return function (i, j) {
  11744. return (i * j % 3 + (i + j) % 2) % 2 == 0;
  11745. };
  11746. default:
  11747. throw new Error('bad maskPattern:' + maskPattern);
  11748. }
  11749. };
  11750. _this.getErrorCorrectPolynomial = function (errorCorrectLength) {
  11751. var a = qrPolynomial([1], 0);
  11752. for (var i = 0; i < errorCorrectLength; i += 1) {
  11753. a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
  11754. }
  11755. return a;
  11756. };
  11757. _this.getLengthInBits = function (mode, type) {
  11758. if (1 <= type && type < 10) {
  11759. // 1 - 9
  11760. switch (mode) {
  11761. case QRMode.MODE_NUMBER:
  11762. return 10;
  11763. case QRMode.MODE_ALPHA_NUM:
  11764. return 9;
  11765. case QRMode.MODE_8BIT_BYTE:
  11766. return 8;
  11767. case QRMode.MODE_KANJI:
  11768. return 8;
  11769. default:
  11770. throw new Error('mode:' + mode);
  11771. }
  11772. } else if (type < 27) {
  11773. // 10 - 26
  11774. switch (mode) {
  11775. case QRMode.MODE_NUMBER:
  11776. return 12;
  11777. case QRMode.MODE_ALPHA_NUM:
  11778. return 11;
  11779. case QRMode.MODE_8BIT_BYTE:
  11780. return 16;
  11781. case QRMode.MODE_KANJI:
  11782. return 10;
  11783. default:
  11784. throw new Error('mode:' + mode);
  11785. }
  11786. } else if (type < 41) {
  11787. // 27 - 40
  11788. switch (mode) {
  11789. case QRMode.MODE_NUMBER:
  11790. return 14;
  11791. case QRMode.MODE_ALPHA_NUM:
  11792. return 13;
  11793. case QRMode.MODE_8BIT_BYTE:
  11794. return 16;
  11795. case QRMode.MODE_KANJI:
  11796. return 12;
  11797. default:
  11798. throw new Error('mode:' + mode);
  11799. }
  11800. } else {
  11801. throw new Error('type:' + type);
  11802. }
  11803. };
  11804. _this.getLostPoint = function (qrcode) {
  11805. var moduleCount = qrcode.getModuleCount();
  11806. var lostPoint = 0;
  11807. // LEVEL1
  11808. for (var row = 0; row < moduleCount; row += 1) {
  11809. for (var col = 0; col < moduleCount; col += 1) {
  11810. var sameCount = 0;
  11811. var dark = qrcode.isDark(row, col);
  11812. for (var r = -1; r <= 1; r += 1) {
  11813. if (row + r < 0 || moduleCount <= row + r) {
  11814. continue;
  11815. }
  11816. for (var c = -1; c <= 1; c += 1) {
  11817. if (col + c < 0 || moduleCount <= col + c) {
  11818. continue;
  11819. }
  11820. if (r == 0 && c == 0) {
  11821. continue;
  11822. }
  11823. if (dark == qrcode.isDark(row + r, col + c)) {
  11824. sameCount += 1;
  11825. }
  11826. }
  11827. }
  11828. if (sameCount > 5) {
  11829. lostPoint += 3 + sameCount - 5;
  11830. }
  11831. }
  11832. }
  11833. ;
  11834. // LEVEL2
  11835. for (var row = 0; row < moduleCount - 1; row += 1) {
  11836. for (var col = 0; col < moduleCount - 1; col += 1) {
  11837. var count = 0;
  11838. if (qrcode.isDark(row, col)) count += 1;
  11839. if (qrcode.isDark(row + 1, col)) count += 1;
  11840. if (qrcode.isDark(row, col + 1)) count += 1;
  11841. if (qrcode.isDark(row + 1, col + 1)) count += 1;
  11842. if (count == 0 || count == 4) {
  11843. lostPoint += 3;
  11844. }
  11845. }
  11846. }
  11847. // LEVEL3
  11848. for (var row = 0; row < moduleCount; row += 1) {
  11849. for (var col = 0; col < moduleCount - 6; col += 1) {
  11850. if (qrcode.isDark(row, col) && !qrcode.isDark(row, col + 1) && qrcode.isDark(row, col + 2) && qrcode.isDark(row, col + 3) && qrcode.isDark(row, col + 4) && !qrcode.isDark(row, col + 5) && qrcode.isDark(row, col + 6)) {
  11851. lostPoint += 40;
  11852. }
  11853. }
  11854. }
  11855. for (var col = 0; col < moduleCount; col += 1) {
  11856. for (var row = 0; row < moduleCount - 6; row += 1) {
  11857. if (qrcode.isDark(row, col) && !qrcode.isDark(row + 1, col) && qrcode.isDark(row + 2, col) && qrcode.isDark(row + 3, col) && qrcode.isDark(row + 4, col) && !qrcode.isDark(row + 5, col) && qrcode.isDark(row + 6, col)) {
  11858. lostPoint += 40;
  11859. }
  11860. }
  11861. }
  11862. // LEVEL4
  11863. var darkCount = 0;
  11864. for (var col = 0; col < moduleCount; col += 1) {
  11865. for (var row = 0; row < moduleCount; row += 1) {
  11866. if (qrcode.isDark(row, col)) {
  11867. darkCount += 1;
  11868. }
  11869. }
  11870. }
  11871. var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
  11872. lostPoint += ratio * 10;
  11873. return lostPoint;
  11874. };
  11875. return _this;
  11876. }();
  11877. //---------------------------------------------------------------------
  11878. // QRMath
  11879. //---------------------------------------------------------------------
  11880. var QRMath = function () {
  11881. var EXP_TABLE = new Array(256);
  11882. var LOG_TABLE = new Array(256);
  11883. // initialize tables
  11884. for (var i = 0; i < 8; i += 1) {
  11885. EXP_TABLE[i] = 1 << i;
  11886. }
  11887. for (var i = 8; i < 256; i += 1) {
  11888. EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
  11889. }
  11890. for (var i = 0; i < 255; i += 1) {
  11891. LOG_TABLE[EXP_TABLE[i]] = i;
  11892. }
  11893. var _this = {};
  11894. _this.glog = function (n) {
  11895. if (n < 1) {
  11896. throw new Error('glog(' + n + ')');
  11897. }
  11898. return LOG_TABLE[n];
  11899. };
  11900. _this.gexp = function (n) {
  11901. while (n < 0) {
  11902. n += 255;
  11903. }
  11904. while (n >= 256) {
  11905. n -= 255;
  11906. }
  11907. return EXP_TABLE[n];
  11908. };
  11909. return _this;
  11910. }();
  11911. //---------------------------------------------------------------------
  11912. // qrPolynomial
  11913. //---------------------------------------------------------------------
  11914. function qrPolynomial(num, shift) {
  11915. if (typeof num.length == 'undefined') {
  11916. throw new Error(num.length + '/' + shift);
  11917. }
  11918. var _num = function () {
  11919. var offset = 0;
  11920. while (offset < num.length && num[offset] == 0) {
  11921. offset += 1;
  11922. }
  11923. var _num = new Array(num.length - offset + shift);
  11924. for (var i = 0; i < num.length - offset; i += 1) {
  11925. _num[i] = num[i + offset];
  11926. }
  11927. return _num;
  11928. }();
  11929. var _this = {};
  11930. _this.getAt = function (index) {
  11931. return _num[index];
  11932. };
  11933. _this.getLength = function () {
  11934. return _num.length;
  11935. };
  11936. _this.multiply = function (e) {
  11937. var num = new Array(_this.getLength() + e.getLength() - 1);
  11938. for (var i = 0; i < _this.getLength(); i += 1) {
  11939. for (var j = 0; j < e.getLength(); j += 1) {
  11940. num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
  11941. }
  11942. }
  11943. return qrPolynomial(num, 0);
  11944. };
  11945. _this.mod = function (e) {
  11946. if (_this.getLength() - e.getLength() < 0) {
  11947. return _this;
  11948. }
  11949. var ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
  11950. var num = new Array(_this.getLength());
  11951. for (var i = 0; i < _this.getLength(); i += 1) {
  11952. num[i] = _this.getAt(i);
  11953. }
  11954. for (var i = 0; i < e.getLength(); i += 1) {
  11955. num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
  11956. }
  11957. // recursive call
  11958. return qrPolynomial(num, 0).mod(e);
  11959. };
  11960. return _this;
  11961. }
  11962. ;
  11963. //---------------------------------------------------------------------
  11964. // QRRSBlock
  11965. //---------------------------------------------------------------------
  11966. var QRRSBlock = function () {
  11967. // [1: [L, M, Q, H], ..]
  11968. var RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]];
  11969. var qrRSBlock = function qrRSBlock(totalCount, dataCount) {
  11970. var _this = {};
  11971. _this.totalCount = totalCount;
  11972. _this.dataCount = dataCount;
  11973. return _this;
  11974. };
  11975. var _this = {};
  11976. var getRsBlockTable = function getRsBlockTable(typeNumber, errorCorrectLevel) {
  11977. switch (errorCorrectLevel) {
  11978. case QRErrorCorrectLevel.L:
  11979. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
  11980. case QRErrorCorrectLevel.M:
  11981. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
  11982. case QRErrorCorrectLevel.Q:
  11983. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
  11984. case QRErrorCorrectLevel.H:
  11985. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
  11986. default:
  11987. return undefined;
  11988. }
  11989. };
  11990. _this.getRSBlocks = function (typeNumber, errorCorrectLevel) {
  11991. var rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel);
  11992. if (typeof rsBlock == 'undefined') {
  11993. throw new Error('bad rs block @ typeNumber:' + typeNumber + '/errorCorrectLevel:' + errorCorrectLevel);
  11994. }
  11995. var length = rsBlock.length / 3;
  11996. var list = new Array();
  11997. for (var i = 0; i < length; i += 1) {
  11998. var count = rsBlock[i * 3 + 0];
  11999. var totalCount = rsBlock[i * 3 + 1];
  12000. var dataCount = rsBlock[i * 3 + 2];
  12001. for (var j = 0; j < count; j += 1) {
  12002. list.push(qrRSBlock(totalCount, dataCount));
  12003. }
  12004. }
  12005. return list;
  12006. };
  12007. return _this;
  12008. }();
  12009. //---------------------------------------------------------------------
  12010. // qrBitBuffer
  12011. //---------------------------------------------------------------------
  12012. var qrBitBuffer = function qrBitBuffer() {
  12013. var _buffer = new Array();
  12014. var _length = 0;
  12015. var _this = {};
  12016. _this.getBuffer = function () {
  12017. return _buffer;
  12018. };
  12019. _this.getAt = function (index) {
  12020. var bufIndex = Math.floor(index / 8);
  12021. return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
  12022. };
  12023. _this.put = function (num, length) {
  12024. for (var i = 0; i < length; i += 1) {
  12025. _this.putBit((num >>> length - i - 1 & 1) == 1);
  12026. }
  12027. };
  12028. _this.getLengthInBits = function () {
  12029. return _length;
  12030. };
  12031. _this.putBit = function (bit) {
  12032. var bufIndex = Math.floor(_length / 8);
  12033. if (_buffer.length <= bufIndex) {
  12034. _buffer.push(0);
  12035. }
  12036. if (bit) {
  12037. _buffer[bufIndex] |= 0x80 >>> _length % 8;
  12038. }
  12039. _length += 1;
  12040. };
  12041. return _this;
  12042. };
  12043. //---------------------------------------------------------------------
  12044. // qr8BitByte
  12045. //---------------------------------------------------------------------
  12046. var qr8BitByte = function qr8BitByte(data) {
  12047. var _mode = QRMode.MODE_8BIT_BYTE;
  12048. var _data = data;
  12049. var _parsedData = [];
  12050. var _this = {};
  12051. // Added to support UTF-8 Characters
  12052. for (var i = 0, l = _data.length; i < l; i++) {
  12053. var byteArray = [];
  12054. var code = _data.charCodeAt(i);
  12055. if (code > 0x10000) {
  12056. byteArray[0] = 0xF0 | (code & 0x1C0000) >>> 18;
  12057. byteArray[1] = 0x80 | (code & 0x3F000) >>> 12;
  12058. byteArray[2] = 0x80 | (code & 0xFC0) >>> 6;
  12059. byteArray[3] = 0x80 | code & 0x3F;
  12060. } else if (code > 0x800) {
  12061. byteArray[0] = 0xE0 | (code & 0xF000) >>> 12;
  12062. byteArray[1] = 0x80 | (code & 0xFC0) >>> 6;
  12063. byteArray[2] = 0x80 | code & 0x3F;
  12064. } else if (code > 0x80) {
  12065. byteArray[0] = 0xC0 | (code & 0x7C0) >>> 6;
  12066. byteArray[1] = 0x80 | code & 0x3F;
  12067. } else {
  12068. byteArray[0] = code;
  12069. }
  12070. // Fix Unicode corruption bug
  12071. _parsedData.push(byteArray);
  12072. }
  12073. _parsedData = Array.prototype.concat.apply([], _parsedData);
  12074. if (_parsedData.length != _data.length) {
  12075. _parsedData.unshift(191);
  12076. _parsedData.unshift(187);
  12077. _parsedData.unshift(239);
  12078. }
  12079. var _bytes = _parsedData;
  12080. _this.getMode = function () {
  12081. return _mode;
  12082. };
  12083. _this.getLength = function (buffer) {
  12084. return _bytes.length;
  12085. };
  12086. _this.write = function (buffer) {
  12087. for (var i = 0; i < _bytes.length; i += 1) {
  12088. buffer.put(_bytes[i], 8);
  12089. }
  12090. };
  12091. return _this;
  12092. };
  12093. //=====================================================================
  12094. // GIF Support etc.
  12095. //
  12096. //---------------------------------------------------------------------
  12097. // byteArrayOutputStream
  12098. //---------------------------------------------------------------------
  12099. var byteArrayOutputStream = function byteArrayOutputStream() {
  12100. var _bytes = new Array();
  12101. var _this = {};
  12102. _this.writeByte = function (b) {
  12103. _bytes.push(b & 0xff);
  12104. };
  12105. _this.writeShort = function (i) {
  12106. _this.writeByte(i);
  12107. _this.writeByte(i >>> 8);
  12108. };
  12109. _this.writeBytes = function (b, off, len) {
  12110. off = off || 0;
  12111. len = len || b.length;
  12112. for (var i = 0; i < len; i += 1) {
  12113. _this.writeByte(b[i + off]);
  12114. }
  12115. };
  12116. _this.writeString = function (s) {
  12117. for (var i = 0; i < s.length; i += 1) {
  12118. _this.writeByte(s.charCodeAt(i));
  12119. }
  12120. };
  12121. _this.toByteArray = function () {
  12122. return _bytes;
  12123. };
  12124. _this.toString = function () {
  12125. var s = '';
  12126. s += '[';
  12127. for (var i = 0; i < _bytes.length; i += 1) {
  12128. if (i > 0) {
  12129. s += ',';
  12130. }
  12131. s += _bytes[i];
  12132. }
  12133. s += ']';
  12134. return s;
  12135. };
  12136. return _this;
  12137. };
  12138. //---------------------------------------------------------------------
  12139. // base64EncodeOutputStream
  12140. //---------------------------------------------------------------------
  12141. var base64EncodeOutputStream = function base64EncodeOutputStream() {
  12142. var _buffer = 0;
  12143. var _buflen = 0;
  12144. var _length = 0;
  12145. var _base64 = '';
  12146. var _this = {};
  12147. var writeEncoded = function writeEncoded(b) {
  12148. _base64 += String.fromCharCode(encode(b & 0x3f));
  12149. };
  12150. var encode = function encode(n) {
  12151. if (n < 0) {
  12152. // error.
  12153. } else if (n < 26) {
  12154. return 0x41 + n;
  12155. } else if (n < 52) {
  12156. return 0x61 + (n - 26);
  12157. } else if (n < 62) {
  12158. return 0x30 + (n - 52);
  12159. } else if (n == 62) {
  12160. return 0x2b;
  12161. } else if (n == 63) {
  12162. return 0x2f;
  12163. }
  12164. throw new Error('n:' + n);
  12165. };
  12166. _this.writeByte = function (n) {
  12167. _buffer = _buffer << 8 | n & 0xff;
  12168. _buflen += 8;
  12169. _length += 1;
  12170. while (_buflen >= 6) {
  12171. writeEncoded(_buffer >>> _buflen - 6);
  12172. _buflen -= 6;
  12173. }
  12174. };
  12175. _this.flush = function () {
  12176. if (_buflen > 0) {
  12177. writeEncoded(_buffer << 6 - _buflen);
  12178. _buffer = 0;
  12179. _buflen = 0;
  12180. }
  12181. if (_length % 3 != 0) {
  12182. // padding
  12183. var padlen = 3 - _length % 3;
  12184. for (var i = 0; i < padlen; i += 1) {
  12185. _base64 += '=';
  12186. }
  12187. }
  12188. };
  12189. _this.toString = function () {
  12190. return _base64;
  12191. };
  12192. return _this;
  12193. };
  12194. //---------------------------------------------------------------------
  12195. // base64DecodeInputStream
  12196. //---------------------------------------------------------------------
  12197. var base64DecodeInputStream = function base64DecodeInputStream(str) {
  12198. var _str = str;
  12199. var _pos = 0;
  12200. var _buffer = 0;
  12201. var _buflen = 0;
  12202. var _this = {};
  12203. _this.read = function () {
  12204. while (_buflen < 8) {
  12205. if (_pos >= _str.length) {
  12206. if (_buflen == 0) {
  12207. return -1;
  12208. }
  12209. throw new Error('unexpected end of file./' + _buflen);
  12210. }
  12211. var c = _str.charAt(_pos);
  12212. _pos += 1;
  12213. if (c == '=') {
  12214. _buflen = 0;
  12215. return -1;
  12216. } else if (c.match(/^\s$/)) {
  12217. // ignore if whitespace.
  12218. continue;
  12219. }
  12220. _buffer = _buffer << 6 | decode(c.charCodeAt(0));
  12221. _buflen += 6;
  12222. }
  12223. var n = _buffer >>> _buflen - 8 & 0xff;
  12224. _buflen -= 8;
  12225. return n;
  12226. };
  12227. var decode = function decode(c) {
  12228. if (0x41 <= c && c <= 0x5a) {
  12229. return c - 0x41;
  12230. } else if (0x61 <= c && c <= 0x7a) {
  12231. return c - 0x61 + 26;
  12232. } else if (0x30 <= c && c <= 0x39) {
  12233. return c - 0x30 + 52;
  12234. } else if (c == 0x2b) {
  12235. return 62;
  12236. } else if (c == 0x2f) {
  12237. return 63;
  12238. } else {
  12239. throw new Error('c:' + c);
  12240. }
  12241. };
  12242. return _this;
  12243. };
  12244. //---------------------------------------------------------------------
  12245. // gifImage (B/W)
  12246. //---------------------------------------------------------------------
  12247. var gifImage = function gifImage(width, height) {
  12248. var _width = width;
  12249. var _height = height;
  12250. var _data = new Array(width * height);
  12251. var _this = {};
  12252. _this.setPixel = function (x, y, pixel) {
  12253. _data[y * _width + x] = pixel;
  12254. };
  12255. _this.write = function (out) {
  12256. //---------------------------------
  12257. // GIF Signature
  12258. out.writeString('GIF87a');
  12259. //---------------------------------
  12260. // Screen Descriptor
  12261. out.writeShort(_width);
  12262. out.writeShort(_height);
  12263. out.writeByte(0x80); // 2bit
  12264. out.writeByte(0);
  12265. out.writeByte(0);
  12266. //---------------------------------
  12267. // Global Color Map
  12268. // black
  12269. out.writeByte(0x00);
  12270. out.writeByte(0x00);
  12271. out.writeByte(0x00);
  12272. // white
  12273. out.writeByte(0xff);
  12274. out.writeByte(0xff);
  12275. out.writeByte(0xff);
  12276. //---------------------------------
  12277. // Image Descriptor
  12278. out.writeString(',');
  12279. out.writeShort(0);
  12280. out.writeShort(0);
  12281. out.writeShort(_width);
  12282. out.writeShort(_height);
  12283. out.writeByte(0);
  12284. //---------------------------------
  12285. // Local Color Map
  12286. //---------------------------------
  12287. // Raster Data
  12288. var lzwMinCodeSize = 2;
  12289. var raster = getLZWRaster(lzwMinCodeSize);
  12290. out.writeByte(lzwMinCodeSize);
  12291. var offset = 0;
  12292. while (raster.length - offset > 255) {
  12293. out.writeByte(255);
  12294. out.writeBytes(raster, offset, 255);
  12295. offset += 255;
  12296. }
  12297. out.writeByte(raster.length - offset);
  12298. out.writeBytes(raster, offset, raster.length - offset);
  12299. out.writeByte(0x00);
  12300. //---------------------------------
  12301. // GIF Terminator
  12302. out.writeString(';');
  12303. };
  12304. var bitOutputStream = function bitOutputStream(out) {
  12305. var _out = out;
  12306. var _bitLength = 0;
  12307. var _bitBuffer = 0;
  12308. var _this = {};
  12309. _this.write = function (data, length) {
  12310. if (data >>> length != 0) {
  12311. throw new Error('length over');
  12312. }
  12313. while (_bitLength + length >= 8) {
  12314. _out.writeByte(0xff & (data << _bitLength | _bitBuffer));
  12315. length -= 8 - _bitLength;
  12316. data >>>= 8 - _bitLength;
  12317. _bitBuffer = 0;
  12318. _bitLength = 0;
  12319. }
  12320. _bitBuffer = data << _bitLength | _bitBuffer;
  12321. _bitLength = _bitLength + length;
  12322. };
  12323. _this.flush = function () {
  12324. if (_bitLength > 0) {
  12325. _out.writeByte(_bitBuffer);
  12326. }
  12327. };
  12328. return _this;
  12329. };
  12330. var getLZWRaster = function getLZWRaster(lzwMinCodeSize) {
  12331. var clearCode = 1 << lzwMinCodeSize;
  12332. var endCode = (1 << lzwMinCodeSize) + 1;
  12333. var bitLength = lzwMinCodeSize + 1;
  12334. // Setup LZWTable
  12335. var table = lzwTable();
  12336. for (var i = 0; i < clearCode; i += 1) {
  12337. table.add(String.fromCharCode(i));
  12338. }
  12339. table.add(String.fromCharCode(clearCode));
  12340. table.add(String.fromCharCode(endCode));
  12341. var byteOut = byteArrayOutputStream();
  12342. var bitOut = bitOutputStream(byteOut);
  12343. // clear code
  12344. bitOut.write(clearCode, bitLength);
  12345. var dataIndex = 0;
  12346. var s = String.fromCharCode(_data[dataIndex]);
  12347. dataIndex += 1;
  12348. while (dataIndex < _data.length) {
  12349. var c = String.fromCharCode(_data[dataIndex]);
  12350. dataIndex += 1;
  12351. if (table.contains(s + c)) {
  12352. s = s + c;
  12353. } else {
  12354. bitOut.write(table.indexOf(s), bitLength);
  12355. if (table.size() < 0xfff) {
  12356. if (table.size() == 1 << bitLength) {
  12357. bitLength += 1;
  12358. }
  12359. table.add(s + c);
  12360. }
  12361. s = c;
  12362. }
  12363. }
  12364. bitOut.write(table.indexOf(s), bitLength);
  12365. // end code
  12366. bitOut.write(endCode, bitLength);
  12367. bitOut.flush();
  12368. return byteOut.toByteArray();
  12369. };
  12370. var lzwTable = function lzwTable() {
  12371. var _map = {};
  12372. var _size = 0;
  12373. var _this = {};
  12374. _this.add = function (key) {
  12375. if (_this.contains(key)) {
  12376. throw new Error('dup key:' + key);
  12377. }
  12378. _map[key] = _size;
  12379. _size += 1;
  12380. };
  12381. _this.size = function () {
  12382. return _size;
  12383. };
  12384. _this.indexOf = function (key) {
  12385. return _map[key];
  12386. };
  12387. _this.contains = function (key) {
  12388. return typeof _map[key] != 'undefined';
  12389. };
  12390. return _this;
  12391. };
  12392. return _this;
  12393. };
  12394. var createImgTag = function createImgTag(width, height, getPixel, alt) {
  12395. var gif = gifImage(width, height);
  12396. for (var y = 0; y < height; y += 1) {
  12397. for (var x = 0; x < width; x += 1) {
  12398. gif.setPixel(x, y, getPixel(x, y));
  12399. }
  12400. }
  12401. var b = byteArrayOutputStream();
  12402. gif.write(b);
  12403. var base64 = base64EncodeOutputStream();
  12404. var bytes = b.toByteArray();
  12405. for (var i = 0; i < bytes.length; i += 1) {
  12406. base64.writeByte(bytes[i]);
  12407. }
  12408. base64.flush();
  12409. var img = '';
  12410. img += 'data:image/gif;base64,';
  12411. img += base64;
  12412. return img;
  12413. };
  12414. //---------------------------------------------------------------------
  12415. // returns qrcode function.
  12416. var createQrCodeImg = function createQrCodeImg(text, options) {
  12417. options = options || {};
  12418. var typeNumber = options.typeNumber || 4;
  12419. var errorCorrectLevel = options.errorCorrectLevel || 'M';
  12420. var size = options.size || 500;
  12421. var qr;
  12422. try {
  12423. qr = qrcode(typeNumber, errorCorrectLevel || 'M');
  12424. qr.addData(text);
  12425. qr.make();
  12426. } catch (e) {
  12427. if (typeNumber >= 40) {
  12428. throw new Error('Text too long to encode');
  12429. } else {
  12430. return createQrCodeImg(text, {
  12431. size: size,
  12432. errorCorrectLevel: errorCorrectLevel,
  12433. typeNumber: typeNumber + 1
  12434. });
  12435. }
  12436. }
  12437. // calc cellsize and margin
  12438. var cellsize = parseInt(size / qr.getModuleCount());
  12439. var margin = parseInt((size - qr.getModuleCount() * cellsize) / 2);
  12440. return qr.createImgTag(cellsize, margin, size);
  12441. };
  12442. module.exports = {
  12443. create: createQrCodeImg
  12444. };
  12445. /***/ }),
  12446. /* 39 */,
  12447. /* 40 */,
  12448. /* 41 */,
  12449. /* 42 */,
  12450. /* 43 */,
  12451. /* 44 */,
  12452. /* 45 */
  12453. /*!***********************************************************************!*\
  12454. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/bmap-wx.js ***!
  12455. \***********************************************************************/
  12456. /*! no static exports found */
  12457. /***/ (function(module, exports, __webpack_require__) {
  12458. /* WEBPACK VAR INJECTION */(function(wx) {var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 14);
  12459. var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ 15);
  12460. /**
  12461. * @file 微信小程序JSAPI
  12462. * @author 崔健 cuijian03@baidu.com 2017.01.10
  12463. * @update 邓淑芳 623996689@qq.com 2019.07.03
  12464. */
  12465. /**
  12466. * 百度地图微信小程序API类
  12467. *
  12468. * @class
  12469. */
  12470. var BMapWX = /*#__PURE__*/function () {
  12471. "use strict";
  12472. /**
  12473. * 百度地图微信小程序API类
  12474. *
  12475. * @constructor
  12476. */
  12477. function BMapWX(param) {
  12478. _classCallCheck(this, BMapWX);
  12479. this.ak = param["ak"];
  12480. }
  12481. /**
  12482. * 使用微信接口进行定位
  12483. *
  12484. * @param {string} type 坐标类型
  12485. * @param {Function} success 成功执行
  12486. * @param {Function} fail 失败执行
  12487. * @param {Function} complete 完成后执行
  12488. */
  12489. _createClass(BMapWX, [{
  12490. key: "getWXLocation",
  12491. value: function getWXLocation(type, success, fail, complete) {
  12492. type = type || 'gcj02', success = success || function () {};
  12493. fail = fail || function () {};
  12494. complete = complete || function () {};
  12495. wx.getLocation({
  12496. type: type,
  12497. success: success,
  12498. fail: fail,
  12499. complete: complete
  12500. });
  12501. }
  12502. /**
  12503. * POI周边检索
  12504. *
  12505. * @param {Object} param 检索配置
  12506. * 参数对象结构可以参考
  12507. * http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-placeapi
  12508. */
  12509. }, {
  12510. key: "search",
  12511. value: function search(param) {
  12512. var that = this;
  12513. param = param || {};
  12514. var searchparam = {
  12515. query: param["query"] || '生活服务$美食&酒店',
  12516. scope: param["scope"] || 1,
  12517. filter: param["filter"] || '',
  12518. coord_type: param["coord_type"] || 2,
  12519. page_size: param["page_size"] || 10,
  12520. page_num: param["page_num"] || 0,
  12521. output: param["output"] || 'json',
  12522. ak: that.ak,
  12523. sn: param["sn"] || '',
  12524. timestamp: param["timestamp"] || '',
  12525. radius: param["radius"] || 2000,
  12526. ret_coordtype: 'gcj02ll'
  12527. };
  12528. var otherparam = {
  12529. iconPath: param["iconPath"],
  12530. iconTapPath: param["iconTapPath"],
  12531. width: param["width"],
  12532. height: param["height"],
  12533. alpha: param["alpha"] || 1,
  12534. success: param["success"] || function () {},
  12535. fail: param["fail"] || function () {}
  12536. };
  12537. var type = 'gcj02';
  12538. var locationsuccess = function locationsuccess(result) {
  12539. searchparam["location"] = result["latitude"] + ',' + result["longitude"];
  12540. wx.request({
  12541. url: 'https://api.map.baidu.com/place/v2/search',
  12542. data: searchparam,
  12543. header: {
  12544. "content-type": "application/json"
  12545. },
  12546. method: 'GET',
  12547. success: function success(data) {
  12548. var res = data["data"];
  12549. if (res["status"] === 0) {
  12550. var poiArr = res["results"];
  12551. // outputRes 包含两个对象,
  12552. // originalData为百度接口返回的原始数据
  12553. // wxMarkerData为小程序规范的marker格式
  12554. var outputRes = {};
  12555. outputRes["originalData"] = res;
  12556. outputRes["wxMarkerData"] = [];
  12557. for (var i = 0; i < poiArr.length; i++) {
  12558. outputRes["wxMarkerData"][i] = {
  12559. id: i,
  12560. latitude: poiArr[i]["location"]["lat"],
  12561. longitude: poiArr[i]["location"]["lng"],
  12562. title: poiArr[i]["name"],
  12563. iconPath: otherparam["iconPath"],
  12564. iconTapPath: otherparam["iconTapPath"],
  12565. address: poiArr[i]["address"],
  12566. telephone: poiArr[i]["telephone"],
  12567. alpha: otherparam["alpha"],
  12568. width: otherparam["width"],
  12569. height: otherparam["height"]
  12570. };
  12571. }
  12572. otherparam.success(outputRes);
  12573. } else {
  12574. otherparam.fail({
  12575. errMsg: res["message"],
  12576. statusCode: res["status"]
  12577. });
  12578. }
  12579. },
  12580. fail: function fail(data) {
  12581. otherparam.fail(data);
  12582. }
  12583. });
  12584. };
  12585. var locationfail = function locationfail(result) {
  12586. otherparam.fail(result);
  12587. };
  12588. var locationcomplete = function locationcomplete(result) {};
  12589. if (!param["location"]) {
  12590. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  12591. } else {
  12592. var longitude = param.location.split(',')[1];
  12593. var latitude = param.location.split(',')[0];
  12594. var errMsg = 'input location';
  12595. var res = {
  12596. errMsg: errMsg,
  12597. latitude: latitude,
  12598. longitude: longitude
  12599. };
  12600. locationsuccess(res);
  12601. }
  12602. }
  12603. /**
  12604. * sug模糊检索
  12605. *
  12606. * @param {Object} param 检索配置
  12607. * 参数对象结构可以参考
  12608. * http://lbsyun.baidu.com/index.php?title=webapi/place-suggestion-api
  12609. */
  12610. }, {
  12611. key: "suggestion",
  12612. value: function suggestion(param) {
  12613. var that = this;
  12614. param = param || {};
  12615. var suggestionparam = {
  12616. query: param["query"] || '',
  12617. region: param["region"] || '全国',
  12618. city_limit: param["city_limit"] || false,
  12619. output: param["output"] || 'json',
  12620. ak: that.ak,
  12621. sn: param["sn"] || '',
  12622. timestamp: param["timestamp"] || '',
  12623. ret_coordtype: 'gcj02ll'
  12624. };
  12625. var otherparam = {
  12626. success: param["success"] || function () {},
  12627. fail: param["fail"] || function () {}
  12628. };
  12629. wx.request({
  12630. url: 'https://api.map.baidu.com/place/v2/suggestion',
  12631. data: suggestionparam,
  12632. header: {
  12633. "content-type": "application/json"
  12634. },
  12635. method: 'GET',
  12636. success: function success(data) {
  12637. var res = data["data"];
  12638. if (res["status"] === 0) {
  12639. otherparam.success(res);
  12640. } else {
  12641. otherparam.fail({
  12642. errMsg: res["message"],
  12643. statusCode: res["status"]
  12644. });
  12645. }
  12646. },
  12647. fail: function fail(data) {
  12648. otherparam.fail(data);
  12649. }
  12650. });
  12651. }
  12652. /**
  12653. * rgc检索(逆地理编码:经纬度->地点描述)
  12654. *
  12655. * @param {Object} param 检索配置
  12656. * 参数对象结构可以参考
  12657. * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding-abroad
  12658. *
  12659. */
  12660. }, {
  12661. key: "regeocoding",
  12662. value: function regeocoding(param) {
  12663. var that = this;
  12664. param = param || {};
  12665. var regeocodingparam = {
  12666. coordtype: param["coordtype"] || 'gcj02ll',
  12667. ret_coordtype: 'gcj02ll',
  12668. radius: param["radius"] || 1000,
  12669. ak: that.ak,
  12670. sn: param["sn"] || '',
  12671. output: param["output"] || 'json',
  12672. callback: param["callback"] || function () {},
  12673. extensions_poi: param["extensions_poi"] || 1,
  12674. extensions_road: param["extensions_road"] || false,
  12675. extensions_town: param["extensions_town"] || false,
  12676. language: param["language"] || 'zh-CN',
  12677. language_auto: param["language_auto"] || 0
  12678. };
  12679. var otherparam = {
  12680. iconPath: param["iconPath"],
  12681. iconTapPath: param["iconTapPath"],
  12682. width: param["width"],
  12683. height: param["height"],
  12684. alpha: param["alpha"] || 1,
  12685. success: param["success"] || function () {},
  12686. fail: param["fail"] || function () {}
  12687. };
  12688. var type = 'gcj02';
  12689. var locationsuccess = function locationsuccess(result) {
  12690. regeocodingparam["location"] = result["latitude"] + ',' + result["longitude"];
  12691. wx.request({
  12692. url: 'https://api.map.baidu.com/reverse_geocoding/v3',
  12693. data: regeocodingparam,
  12694. header: {
  12695. "content-type": "application/json"
  12696. },
  12697. method: 'GET',
  12698. success: function success(data) {
  12699. var res = data["data"];
  12700. if (res["status"] === 0) {
  12701. var poiObj = res["result"];
  12702. // outputRes 包含两个对象:
  12703. // originalData为百度接口返回的原始数据
  12704. // wxMarkerData为小程序规范的marker格式
  12705. var outputRes = {};
  12706. outputRes["originalData"] = res;
  12707. outputRes["wxMarkerData"] = [];
  12708. outputRes["wxMarkerData"][0] = {
  12709. id: 0,
  12710. latitude: result["latitude"],
  12711. longitude: result["longitude"],
  12712. address: poiObj["formatted_address"],
  12713. iconPath: otherparam["iconPath"],
  12714. iconTapPath: otherparam["iconTapPath"],
  12715. desc: poiObj["sematic_description"],
  12716. business: poiObj["business"],
  12717. alpha: otherparam["alpha"],
  12718. width: otherparam["width"],
  12719. height: otherparam["height"]
  12720. };
  12721. otherparam.success(outputRes);
  12722. } else {
  12723. otherparam.fail({
  12724. errMsg: res["message"],
  12725. statusCode: res["status"]
  12726. });
  12727. }
  12728. },
  12729. fail: function fail(data) {
  12730. otherparam.fail(data);
  12731. }
  12732. });
  12733. };
  12734. var locationfail = function locationfail(result) {
  12735. otherparam.fail(result);
  12736. };
  12737. var locationcomplete = function locationcomplete(result) {};
  12738. if (!param["location"]) {
  12739. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  12740. } else {
  12741. var longitude = param.location.split(',')[1];
  12742. var latitude = param.location.split(',')[0];
  12743. var errMsg = 'input location';
  12744. var res = {
  12745. errMsg: errMsg,
  12746. latitude: latitude,
  12747. longitude: longitude
  12748. };
  12749. locationsuccess(res);
  12750. }
  12751. }
  12752. /**
  12753. * gc检索(地理编码:地点->经纬度)
  12754. *
  12755. * @param {Object} param 检索配置
  12756. * 参数对象结构可以参考
  12757. * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding
  12758. *
  12759. */
  12760. }, {
  12761. key: "geocoding",
  12762. value: function geocoding(param) {
  12763. var that = this;
  12764. param = param || {};
  12765. var geocodingparam = {
  12766. address: param["address"] || '',
  12767. city: param["city"] || '',
  12768. ret_coordtype: param["coordtype"] || 'gcj02ll',
  12769. ak: that.ak,
  12770. sn: param["sn"] || '',
  12771. output: param["output"] || 'json',
  12772. callback: param["callback"] || function () {}
  12773. };
  12774. var otherparam = {
  12775. iconPath: param["iconPath"],
  12776. iconTapPath: param["iconTapPath"],
  12777. width: param["width"],
  12778. height: param["height"],
  12779. alpha: param["alpha"] || 1,
  12780. success: param["success"] || function () {},
  12781. fail: param["fail"] || function () {}
  12782. };
  12783. if (param["address"]) {
  12784. wx.request({
  12785. url: 'https://api.map.baidu.com/geocoding/v3',
  12786. data: geocodingparam,
  12787. header: {
  12788. "content-type": "application/json"
  12789. },
  12790. method: 'GET',
  12791. success: function success(data) {
  12792. var res = data["data"];
  12793. if (res["status"] === 0) {
  12794. var poiObj = res["result"];
  12795. // outputRes 包含两个对象:
  12796. // originalData为百度接口返回的原始数据
  12797. // wxMarkerData为小程序规范的marker格式
  12798. var outputRes = res;
  12799. outputRes["originalData"] = res;
  12800. outputRes["wxMarkerData"] = [];
  12801. outputRes["wxMarkerData"][0] = {
  12802. id: 0,
  12803. latitude: poiObj["location"]["lat"],
  12804. longitude: poiObj["location"]["lng"],
  12805. iconPath: otherparam["iconPath"],
  12806. iconTapPath: otherparam["iconTapPath"],
  12807. alpha: otherparam["alpha"],
  12808. width: otherparam["width"],
  12809. height: otherparam["height"]
  12810. };
  12811. otherparam.success(outputRes);
  12812. } else {
  12813. otherparam.fail({
  12814. errMsg: res["message"],
  12815. statusCode: res["status"]
  12816. });
  12817. }
  12818. },
  12819. fail: function fail(data) {
  12820. otherparam.fail(data);
  12821. }
  12822. });
  12823. } else {
  12824. var errMsg = 'input address!';
  12825. var res = {
  12826. errMsg: errMsg
  12827. };
  12828. otherparam.fail(res);
  12829. }
  12830. }
  12831. /**
  12832. * 天气检索
  12833. *
  12834. * @param {Object} param 检索配置
  12835. */
  12836. }, {
  12837. key: "weather",
  12838. value: function weather(param) {
  12839. var that = this;
  12840. param = param || {};
  12841. var weatherparam = {
  12842. coord_type: param["coord_type"] || 'gcj02',
  12843. output: param["output"] || 'json',
  12844. ak: that.ak,
  12845. sn: param["sn"] || '',
  12846. timestamp: param["timestamp"] || ''
  12847. };
  12848. var otherparam = {
  12849. success: param["success"] || function () {},
  12850. fail: param["fail"] || function () {}
  12851. };
  12852. var type = 'gcj02';
  12853. var locationsuccess = function locationsuccess(result) {
  12854. weatherparam["location"] = result["longitude"] + ',' + result["latitude"];
  12855. wx.request({
  12856. url: 'https://api.map.baidu.com/telematics/v3/weather',
  12857. data: weatherparam,
  12858. header: {
  12859. "content-type": "application/json"
  12860. },
  12861. method: 'GET',
  12862. success: function success(data) {
  12863. var res = data["data"];
  12864. if (res["error"] === 0 && res["status"] === 'success') {
  12865. var weatherArr = res["results"];
  12866. // outputRes 包含两个对象,
  12867. // originalData为百度接口返回的原始数据
  12868. // wxMarkerData为小程序规范的marker格式
  12869. var outputRes = {};
  12870. outputRes["originalData"] = res;
  12871. outputRes["currentWeather"] = [];
  12872. outputRes["currentWeather"][0] = {
  12873. currentCity: weatherArr[0]["currentCity"],
  12874. pm25: weatherArr[0]["pm25"],
  12875. date: weatherArr[0]["weather_data"][0]["date"],
  12876. temperature: weatherArr[0]["weather_data"][0]["temperature"],
  12877. weatherDesc: weatherArr[0]["weather_data"][0]["weather"],
  12878. wind: weatherArr[0]["weather_data"][0]["wind"]
  12879. };
  12880. otherparam.success(outputRes);
  12881. } else {
  12882. otherparam.fail({
  12883. errMsg: res["message"],
  12884. statusCode: res["status"]
  12885. });
  12886. }
  12887. },
  12888. fail: function fail(data) {
  12889. otherparam.fail(data);
  12890. }
  12891. });
  12892. };
  12893. var locationfail = function locationfail(result) {
  12894. otherparam.fail(result);
  12895. };
  12896. var locationcomplete = function locationcomplete(result) {};
  12897. if (!param["location"]) {
  12898. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  12899. } else {
  12900. var longitude = param.location.split(',')[0];
  12901. var latitude = param.location.split(',')[1];
  12902. var errMsg = 'input location';
  12903. var res = {
  12904. errMsg: errMsg,
  12905. latitude: latitude,
  12906. longitude: longitude
  12907. };
  12908. locationsuccess(res);
  12909. }
  12910. }
  12911. }]);
  12912. return BMapWX;
  12913. }();
  12914. module.exports.BMapWX = BMapWX;
  12915. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-alipay/dist/index.js */ 1)["default"]))
  12916. /***/ }),
  12917. /* 46 */,
  12918. /* 47 */,
  12919. /* 48 */,
  12920. /* 49 */,
  12921. /* 50 */,
  12922. /* 51 */,
  12923. /* 52 */,
  12924. /* 53 */,
  12925. /* 54 */,
  12926. /* 55 */,
  12927. /* 56 */,
  12928. /* 57 */,
  12929. /* 58 */,
  12930. /* 59 */,
  12931. /* 60 */,
  12932. /* 61 */,
  12933. /* 62 */,
  12934. /* 63 */,
  12935. /* 64 */,
  12936. /* 65 */,
  12937. /* 66 */,
  12938. /* 67 */
  12939. /*!**********************************************************************************!*\
  12940. !*** E:/zswl/code/charge_miniapp/charge_miniapp/components/r-canvas/r-canvas.js ***!
  12941. \**********************************************************************************/
  12942. /*! no static exports found */
  12943. /***/ (function(module, exports, __webpack_require__) {
  12944. "use strict";
  12945. /* WEBPACK VAR INJECTION */(function(uni, wx) {
  12946. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 3);
  12947. Object.defineProperty(exports, "__esModule", {
  12948. value: true
  12949. });
  12950. exports.default = void 0;
  12951. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 27));
  12952. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 10));
  12953. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 29));
  12954. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  12955. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  12956. var _default = {
  12957. data: function data() {
  12958. return {
  12959. system_info: {},
  12960. //system info
  12961. canvas_width: 0,
  12962. //canvas width px
  12963. canvas_height: 0,
  12964. //canvas height px
  12965. ctx: null,
  12966. //canvas object
  12967. canvas_id: null,
  12968. //canvas id
  12969. hidden: true,
  12970. //Whether to hide canvas
  12971. scale: 1,
  12972. //canvas scale
  12973. r_canvas_scale: 1,
  12974. if_ctx: true
  12975. };
  12976. },
  12977. methods: {
  12978. /**
  12979. * save r-canvas.vue object
  12980. * @param {Object} that
  12981. */
  12982. // saveThis(that){
  12983. // rCanvasThis = that
  12984. // },
  12985. /**
  12986. * Draw round rect text
  12987. * @param {Object} config
  12988. * @param {Number} config.x x坐标
  12989. * @param {Number} config.y y坐标
  12990. * @param {Number} config.w 宽度
  12991. * @param {Number} config.h 高度
  12992. * @param {Number} config.radius 圆角弧度
  12993. * @param {String} config.fill_color 矩形颜色
  12994. */
  12995. fillRoundRect: function fillRoundRect(config) {
  12996. var _this = this;
  12997. return new Promise(function (resolve, reject) {
  12998. var x = _this.compatibilitySize(parseFloat(config.x) * _this.scale);
  12999. var y = _this.compatibilitySize(parseFloat(config.y) * _this.scale);
  13000. var w = _this.compatibilitySize(parseFloat(config.w) * _this.scale);
  13001. var h = _this.compatibilitySize(parseFloat(config.h) * _this.scale);
  13002. var radius = config.radius ? parseFloat(config.radius) * _this.scale : 10 * _this.scale;
  13003. var fill_color = config.fill_color || "black";
  13004. // The diameter of the circle must be less than the width and height of the rectangle
  13005. if (2 * radius > w || 2 * radius > h) {
  13006. reject("The diameter of the circle must be less than the width and height of the rectangle");
  13007. return false;
  13008. }
  13009. _this.ctx.save();
  13010. _this.ctx.translate(x, y);
  13011. //
  13012. _this.drawRoundRectPath({
  13013. w: w,
  13014. h: h,
  13015. radius: radius
  13016. });
  13017. _this.ctx.fillStyle = fill_color;
  13018. _this.ctx.fill();
  13019. _this.ctx.restore();
  13020. resolve();
  13021. });
  13022. },
  13023. /**
  13024. * Draws the sides of a rounded rectangle
  13025. * @param {Object} config
  13026. * @param {Number} config.w 宽度
  13027. * @param {Number} config.h 高度
  13028. * @param {Number} config.radius 圆角弧度
  13029. */
  13030. drawRoundRectPath: function drawRoundRectPath(config) {
  13031. this.ctx.beginPath(0);
  13032. this.ctx.arc(config.w - config.radius, config.h - config.radius, config.radius, 0, Math.PI / 2);
  13033. this.ctx.lineTo(config.radius, config.h);
  13034. this.ctx.arc(config.radius, config.h - config.radius, config.radius, Math.PI / 2, Math.PI);
  13035. this.ctx.lineTo(0, config.radius);
  13036. this.ctx.arc(config.radius, config.radius, config.radius, Math.PI, Math.PI * 3 / 2);
  13037. this.ctx.lineTo(config.w - config.radius, 0);
  13038. this.ctx.arc(config.w - config.radius, config.radius, config.radius, Math.PI * 3 / 2, Math.PI * 2);
  13039. this.ctx.lineTo(config.w, config.h - config.radius);
  13040. this.ctx.closePath();
  13041. },
  13042. /**
  13043. * Draw special Text,line wrapping is not supported
  13044. * @param {Object} config
  13045. * @param {String} config.text 文字
  13046. * @param {Number} config.x x坐标
  13047. * @param {Number} config.y y坐标
  13048. * @param {String} config.font_color 文字颜色
  13049. * @param {String} config.font_family 文字字体
  13050. * @param {Number} config.font_size 文字大小(px)
  13051. */
  13052. drawSpecialText: function drawSpecialText(params) {
  13053. var _this2 = this;
  13054. var general = params.general;
  13055. var list = params.list;
  13056. return new Promise( /*#__PURE__*/function () {
  13057. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(resolve, reject) {
  13058. var i, font_size;
  13059. return _regenerator.default.wrap(function _callee$(_context) {
  13060. while (1) {
  13061. switch (_context.prev = _context.next) {
  13062. case 0:
  13063. if (general) {
  13064. _context.next = 5;
  13065. break;
  13066. }
  13067. reject("general cannot be empty:101");
  13068. return _context.abrupt("return");
  13069. case 5:
  13070. if (!(list && list.length > 0)) {
  13071. _context.next = 19;
  13072. break;
  13073. }
  13074. _context.t0 = _regenerator.default.keys(list);
  13075. case 7:
  13076. if ((_context.t1 = _context.t0()).done) {
  13077. _context.next = 16;
  13078. break;
  13079. }
  13080. i = _context.t1.value;
  13081. if (i != 0) {
  13082. font_size = list[i - 1].font_size ? parseFloat(list[i - 1].font_size) : 20;
  13083. _this2.ctx.setFontSize(font_size);
  13084. general.x = parseFloat(general.x) + _this2.ctx.measureText(list[i - 1].text).width;
  13085. }
  13086. list[i].x = general.x;
  13087. list[i].y = general.y + (list[i].margin_top ? parseFloat(list[i].margin_top) : 0);
  13088. _context.next = 14;
  13089. return _this2.drawText(list[i]);
  13090. case 14:
  13091. _context.next = 7;
  13092. break;
  13093. case 16:
  13094. resolve();
  13095. _context.next = 21;
  13096. break;
  13097. case 19:
  13098. reject("The length of config arr is less than 0");
  13099. return _context.abrupt("return");
  13100. case 21:
  13101. case "end":
  13102. return _context.stop();
  13103. }
  13104. }
  13105. }, _callee);
  13106. }));
  13107. return function (_x, _x2) {
  13108. return _ref.apply(this, arguments);
  13109. };
  13110. }());
  13111. },
  13112. /**
  13113. * array delete empty
  13114. * @param {Object} arr
  13115. */
  13116. arrDeleteEmpty: function arrDeleteEmpty(arr) {
  13117. var newArr = [];
  13118. for (var i in arr) {
  13119. if (arr[i]) {
  13120. newArr.push(arr[i]);
  13121. }
  13122. }
  13123. return newArr;
  13124. },
  13125. /**
  13126. * Draw Text,support line
  13127. * @param {Object} config
  13128. * @param {String} config.text 文字
  13129. * @param {Number} config.max_width 文字最大宽度(大于宽度自动换行)
  13130. * @param {Number} config.line_height 文字上下行间距
  13131. * @param {Number} config.x x坐标
  13132. * @param {Number} config.y y坐标
  13133. * @param {String} config.font_color 文字颜色
  13134. * @param {String} config.font_family 文字字体 默认值:Arial
  13135. * @param {String} config.text_align 文字对齐方式(left/center/right)
  13136. * @param {Number} config.font_size 文字大小(px)
  13137. * @param {Boolean} config.line_through_height 中划线大小
  13138. * @param {Boolean} config.line_through_color 中划线颜色
  13139. * @param {String} config.font_style 规定文字样式
  13140. * @param {String} config.font_variant 规定字体变体
  13141. * @param {String} config.font_weight 规定字体粗细
  13142. * @param {String} config.line_through_cap 线末端类型
  13143. * @param {String} config.line_clamp 最大行数
  13144. * @param {String} config.line_clamp_hint 超过line_clamp后,尾部显示的自定义标识 如 ...
  13145. * @param {String} config.is_line_break 是否开启换行符换行
  13146. *
  13147. */
  13148. drawText: function drawText(config) {
  13149. var _this3 = this;
  13150. var configuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  13151. configuration['line_num'] = configuration.line_num ? configuration.line_num : 0;
  13152. configuration['text_width'] = configuration.text_width ? configuration.text_width : 0;
  13153. return new Promise( /*#__PURE__*/function () {
  13154. var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(resolve, reject) {
  13155. var draw_width, draw_height, draw_x, draw_y, font_size, font_color, font_family, line_height, text_align, font_weight, font_variant, font_style, line_clamp_hint, lineBreakJoinText, max_width, splitTextArr, newSplitTextArr, current_text, text_arr, i, current_text_arr, json_current_text, x, w, y;
  13156. return _regenerator.default.wrap(function _callee2$(_context2) {
  13157. while (1) {
  13158. switch (_context2.prev = _context2.next) {
  13159. case 0:
  13160. if (!config.text) {
  13161. _context2.next = 85;
  13162. break;
  13163. }
  13164. draw_width = 0, draw_height = 0, draw_x = config.x, draw_y = config.y;
  13165. font_size = config.font_size ? parseFloat(config.font_size) * _this3.scale : 20 * _this3.scale;
  13166. font_color = config.font_color || "#000";
  13167. font_family = config.font_family || "Arial";
  13168. line_height = config.line_height || config.font_size || 20;
  13169. text_align = config.text_align || "left";
  13170. font_weight = config.font_weight || "normal";
  13171. font_variant = config.font_variant || "normal";
  13172. font_style = config.font_style || "normal";
  13173. line_clamp_hint = config.line_clamp_hint || '...';
  13174. lineBreakJoinText = "";
  13175. max_width = config.max_width ? parseFloat(config.max_width) * _this3.scale : 0; // checkout is line break
  13176. if (!config.is_line_break) {
  13177. _context2.next = 28;
  13178. break;
  13179. }
  13180. splitTextArr = config.text.split(/[\n]/g);
  13181. if (!(splitTextArr && splitTextArr.length > 0)) {
  13182. _context2.next = 26;
  13183. break;
  13184. }
  13185. newSplitTextArr = _this3.arrDeleteEmpty(splitTextArr);
  13186. if (!(newSplitTextArr && newSplitTextArr.length > 0)) {
  13187. _context2.next = 22;
  13188. break;
  13189. }
  13190. lineBreakJoinText = newSplitTextArr.slice(1).join("\n");
  13191. config.text = newSplitTextArr[0];
  13192. _context2.next = 24;
  13193. break;
  13194. case 22:
  13195. reject("Text cannot be empty:103");
  13196. return _context2.abrupt("return");
  13197. case 24:
  13198. _context2.next = 28;
  13199. break;
  13200. case 26:
  13201. reject("Text cannot be empty:102");
  13202. return _context2.abrupt("return");
  13203. case 28:
  13204. _this3.ctx.setFillStyle(font_color); // color
  13205. _this3.ctx.textAlign = text_align;
  13206. _this3.ctx.font = "".concat(font_style, " ").concat(font_variant, " ").concat(font_weight, " ").concat(parseInt(font_size), "px ").concat(font_family);
  13207. if (configuration.text_width >= _this3.ctx.measureText(config.text).width) {
  13208. draw_width = configuration.text_width;
  13209. } else if (max_width > 0) {
  13210. draw_width = max_width < _this3.ctx.measureText(config.text).width ? _this3.resetCompatibilitySize(max_width) : _this3.resetCompatibilitySize(_this3.ctx.measureText(config.text).width);
  13211. } else {
  13212. draw_width = _this3.ctx.measureText(config.text).width;
  13213. }
  13214. configuration.text_width = draw_width / _this3.scale;
  13215. if (!(max_width && _this3.compatibilitySize(_this3.ctx.measureText(config.text).width) > _this3.compatibilitySize(max_width))) {
  13216. _context2.next = 72;
  13217. break;
  13218. }
  13219. current_text = "";
  13220. text_arr = config.text.split("");
  13221. _context2.t0 = _regenerator.default.keys(text_arr);
  13222. case 37:
  13223. if ((_context2.t1 = _context2.t0()).done) {
  13224. _context2.next = 70;
  13225. break;
  13226. }
  13227. i = _context2.t1.value;
  13228. if (!(_this3.compatibilitySize(_this3.ctx.measureText(current_text + text_arr[i]).width) > _this3.compatibilitySize(max_width))) {
  13229. _context2.next = 67;
  13230. break;
  13231. }
  13232. if (!(config.line_clamp && parseInt(config.line_clamp) == 1)) {
  13233. _context2.next = 56;
  13234. break;
  13235. }
  13236. // Subtracting the current_text tail width from the line_clamp_hint width
  13237. current_text_arr = current_text.split('');
  13238. json_current_text = '';
  13239. case 43:
  13240. if (false) {}
  13241. current_text_arr = current_text_arr.slice(1);
  13242. json_current_text = current_text_arr.join('');
  13243. if (!(_this3.compatibilitySize(_this3.ctx.measureText(json_current_text).width) <= _this3.compatibilitySize(_this3.ctx.measureText(line_clamp_hint).width))) {
  13244. _context2.next = 49;
  13245. break;
  13246. }
  13247. current_text = current_text.replace(json_current_text, '');
  13248. return _context2.abrupt("break", 51);
  13249. case 49:
  13250. _context2.next = 43;
  13251. break;
  13252. case 51:
  13253. configuration.line_num += 1;
  13254. _this3.ctx.setFontSize(parseInt(_this3.compatibilitySize(font_size))); // font size
  13255. _this3.ctx.fillText(current_text + line_clamp_hint, _this3.compatibilitySize(parseFloat(config.x) * _this3.scale), _this3.compatibilitySize(parseFloat(config.y) * _this3.scale));
  13256. _context2.next = 64;
  13257. break;
  13258. case 56:
  13259. configuration.line_num += 1;
  13260. _this3.ctx.setFontSize(parseInt(_this3.compatibilitySize(font_size))); // font size
  13261. _this3.ctx.fillText(current_text, _this3.compatibilitySize(parseFloat(config.x) * _this3.scale), _this3.compatibilitySize(parseFloat(config.y) * _this3.scale));
  13262. config.text = text_arr.slice(i).join("");
  13263. config.y = config.y + line_height;
  13264. if (config.line_clamp) {
  13265. config.line_clamp = parseInt(config.line_clamp) - 1;
  13266. }
  13267. _context2.next = 64;
  13268. return _this3.drawText(config, configuration);
  13269. case 64:
  13270. return _context2.abrupt("break", 70);
  13271. case 67:
  13272. current_text = current_text + text_arr[i];
  13273. case 68:
  13274. _context2.next = 37;
  13275. break;
  13276. case 70:
  13277. _context2.next = 77;
  13278. break;
  13279. case 72:
  13280. if (config.line_through_height) {
  13281. x = parseFloat(config.x) * _this3.scale;
  13282. y = parseFloat(config.y) * _this3.scale - font_size / 2.6;
  13283. if (text_align == "left") {
  13284. w = _this3.ctx.measureText(config.text).width / 1.1 + parseFloat(config.x) * _this3.scale;
  13285. } else if (text_align == "right") {
  13286. w = parseFloat(config.x) * _this3.scale - _this3.ctx.measureText(config.text).width / 1.1;
  13287. } else if (text_align == "center") {
  13288. x = parseFloat(config.x) * _this3.scale - _this3.ctx.measureText(config.text).width / 1.1 / 2;
  13289. w = parseFloat(config.x) * _this3.scale + _this3.ctx.measureText(config.text).width / 1.1 / 2;
  13290. }
  13291. _this3.drawLineTo({
  13292. x: x,
  13293. y: y,
  13294. w: w,
  13295. h: y,
  13296. line_width: config.line_through_height,
  13297. line_color: config.line_through_color,
  13298. line_cap: config.line_through_cap
  13299. });
  13300. }
  13301. configuration.line_num += 1;
  13302. _this3.ctx.setFontSize(parseInt(_this3.compatibilitySize(font_size))); // font size
  13303. _this3.ctx.fillText(config.text, _this3.compatibilitySize(parseFloat(config.x) * _this3.scale), _this3.compatibilitySize(parseFloat(config.y) * _this3.scale));
  13304. if (config.line_clamp) {
  13305. config.line_clamp = parseInt(config.line_clamp) - 1;
  13306. }
  13307. case 77:
  13308. if (!lineBreakJoinText) {
  13309. _context2.next = 80;
  13310. break;
  13311. }
  13312. _context2.next = 80;
  13313. return _this3.drawText(_objectSpread(_objectSpread({}, config), {}, {
  13314. text: lineBreakJoinText,
  13315. y: config.y + line_height
  13316. }), configuration);
  13317. case 80:
  13318. draw_height = config.font_size * configuration.line_num;
  13319. draw_width = configuration.text_width;
  13320. resolve({
  13321. draw_width: draw_width,
  13322. draw_height: draw_height,
  13323. draw_x: draw_x,
  13324. draw_y: draw_y
  13325. });
  13326. _context2.next = 86;
  13327. break;
  13328. case 85:
  13329. reject("Text cannot be empty:101");
  13330. case 86:
  13331. case "end":
  13332. return _context2.stop();
  13333. }
  13334. }
  13335. }, _callee2);
  13336. }));
  13337. return function (_x3, _x4) {
  13338. return _ref2.apply(this, arguments);
  13339. };
  13340. }());
  13341. },
  13342. /**
  13343. * Draw Line
  13344. * @param {Object} config
  13345. * @param {Object} config.x x坐标
  13346. * @param {Object} config.y y坐标
  13347. * @param {Object} config.w 线的宽度
  13348. * @param {Object} config.h 线的高度
  13349. * @param {Object} config.line_width 线的宽度
  13350. * @param {Object} config.line_color 线条颜色
  13351. */
  13352. drawLineTo: function drawLineTo(config) {
  13353. var x = this.compatibilitySize(config.x);
  13354. var y = this.compatibilitySize(config.y);
  13355. var w = this.compatibilitySize(config.w);
  13356. var h = this.compatibilitySize(config.h);
  13357. var line_width = config.line_width ? parseFloat(config.line_width) * this.scale : 1 * this.scale;
  13358. var line_color = config.line_color || "black";
  13359. var line_cap = config.line_cap || "butt";
  13360. this.ctx.beginPath();
  13361. this.ctx.lineCap = line_cap;
  13362. this.ctx.lineWidth = line_width;
  13363. this.ctx.strokeStyle = line_color;
  13364. this.ctx.moveTo(x, y);
  13365. this.ctx.lineTo(w, h);
  13366. this.ctx.stroke();
  13367. },
  13368. /**
  13369. * Compatibility px
  13370. * @param {Object} size
  13371. */
  13372. compatibilitySize: function compatibilitySize(size) {
  13373. var canvasSize = parseFloat(size) / 750 * this.system_info.windowWidth;
  13374. canvasSize = parseFloat(canvasSize * 2);
  13375. return canvasSize;
  13376. },
  13377. /**
  13378. * Restore compatibility px
  13379. * @param {Object} size
  13380. */
  13381. resetCompatibilitySize: function resetCompatibilitySize(size) {
  13382. var canvasSize = parseFloat(size / 2) / this.system_info.windowWidth * 750;
  13383. return canvasSize;
  13384. },
  13385. /**
  13386. * Init canvas
  13387. */
  13388. init: function init(config) {
  13389. var _this4 = this;
  13390. return new Promise( /*#__PURE__*/function () {
  13391. var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
  13392. var system_info;
  13393. return _regenerator.default.wrap(function _callee3$(_context3) {
  13394. while (1) {
  13395. switch (_context3.prev = _context3.next) {
  13396. case 0:
  13397. if (config.canvas_id) {
  13398. _context3.next = 3;
  13399. break;
  13400. }
  13401. reject("Canvas ID cannot be empty, please refer to the usage example");
  13402. return _context3.abrupt("return");
  13403. case 3:
  13404. _this4.hidden = config.hidden;
  13405. _this4.canvas_id = config.canvas_id;
  13406. _context3.next = 7;
  13407. return uni.getSystemInfoSync();
  13408. case 7:
  13409. system_info = _context3.sent;
  13410. _this4.system_info = system_info;
  13411. _this4.scale = config.scale && parseFloat(config.scale) > 0 ? parseInt(config.scale) : 1;
  13412. _this4.canvas_width = (config.canvas_width ? _this4.compatibilitySize(config.canvas_width) : system_info.windowWidth) * _this4.scale;
  13413. _this4.canvas_height = (config.canvas_height ? _this4.compatibilitySize(config.canvas_height) : system_info.windowHeight) * _this4.scale, _this4.r_canvas_scale = 1 / _this4.scale;
  13414. _this4.ctx = uni.createCanvasContext(_this4.canvas_id, _this4);
  13415. _this4.setCanvasConfig({
  13416. global_alpha: config.global_alpha ? parseFloat(config.global_alpha) : 1,
  13417. backgroundColor: config.background_color ? config.background_color : "transparent"
  13418. });
  13419. resolve();
  13420. case 15:
  13421. case "end":
  13422. return _context3.stop();
  13423. }
  13424. }
  13425. }, _callee3);
  13426. }));
  13427. return function (_x5, _x6) {
  13428. return _ref3.apply(this, arguments);
  13429. };
  13430. }());
  13431. },
  13432. /**
  13433. * clear canvas all path
  13434. */
  13435. clearCanvas: function clearCanvas() {
  13436. var _this5 = this;
  13437. return new Promise( /*#__PURE__*/function () {
  13438. var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(resolve, reject) {
  13439. return _regenerator.default.wrap(function _callee4$(_context4) {
  13440. while (1) {
  13441. switch (_context4.prev = _context4.next) {
  13442. case 0:
  13443. if (_this5.ctx) {
  13444. _context4.next = 5;
  13445. break;
  13446. }
  13447. reject("canvas is not initialized:101");
  13448. return _context4.abrupt("return");
  13449. case 5:
  13450. _this5.ctx.clearRect(0, 0, parseFloat(_this5.canvas_width) * _this5.scale, parseFloat(_this5.canvas_height) * _this5.scale);
  13451. _context4.next = 8;
  13452. return _this5.draw();
  13453. case 8:
  13454. resolve();
  13455. case 9:
  13456. case "end":
  13457. return _context4.stop();
  13458. }
  13459. }
  13460. }, _callee4);
  13461. }));
  13462. return function (_x7, _x8) {
  13463. return _ref4.apply(this, arguments);
  13464. };
  13465. }());
  13466. },
  13467. /**
  13468. * Set canvas config
  13469. * @param {Object} config
  13470. */
  13471. setCanvasConfig: function setCanvasConfig(config) {
  13472. this.ctx.globalAlpha = config.global_alpha;
  13473. this.ctx.fillStyle = config.backgroundColor;
  13474. this.ctx.fillRect(0, 0, parseFloat(this.canvas_width) * this.scale, parseFloat(this.canvas_height) * this.scale);
  13475. },
  13476. /**
  13477. * set canvas width
  13478. * @param {Object} width
  13479. */
  13480. setCanvasWidth: function setCanvasWidth(width) {
  13481. if (!width) {
  13482. uni.showToast({
  13483. title: 'setCanvasWidth:width error',
  13484. icon: 'none'
  13485. });
  13486. }
  13487. this.canvas_width = this.compatibilitySize(parseFloat(width)) * this.scale;
  13488. this.ctx.width = this.canvas_width;
  13489. },
  13490. /**
  13491. * set canvas height
  13492. * @param {Object} height
  13493. */
  13494. setCanvasHeight: function setCanvasHeight(height) {
  13495. if (!height) {
  13496. uni.showToast({
  13497. title: 'setCanvasWidth:height error',
  13498. icon: 'none'
  13499. });
  13500. }
  13501. this.canvas_height = this.compatibilitySize(parseFloat(height)) * this.scale;
  13502. this.ctx.height = this.canvas_height;
  13503. },
  13504. /**
  13505. * Draw to filepath
  13506. */
  13507. draw: function draw(callback) {
  13508. var _this6 = this;
  13509. return new Promise(function (resolve, reject) {
  13510. var stop = setTimeout(function () {
  13511. _this6.ctx.draw(false, setTimeout(function () {
  13512. uni.canvasToTempFilePath({
  13513. canvasId: _this6.canvas_id,
  13514. quality: 1,
  13515. success: function success(res) {
  13516. console.log('res', res);
  13517. resolve(res);
  13518. callback && callback(res);
  13519. },
  13520. fail: function fail(err) {
  13521. reject(JSON.stringify(err) || "Failed to generate poster:101");
  13522. }
  13523. }, _this6);
  13524. }, 300));
  13525. clearTimeout(stop);
  13526. }, 300);
  13527. });
  13528. },
  13529. /**
  13530. * draw rect
  13531. * @param {Number} config.x x坐标
  13532. * @param {Number} config.y y坐标
  13533. * @param {Number} config.w 图形宽度(px)
  13534. * @param {Number} config.h 图形高度(px)
  13535. * @param {Number} config.color 图形颜色
  13536. * @param {Number} config.is_radius 是否开启圆图(1.1.6及以下版本废弃,请使用border_radius)
  13537. * @param {Number} config.border_width 边框大小
  13538. * @param {Number} config.border_color 边框颜色
  13539. *
  13540. */
  13541. drawRect: function drawRect(config) {
  13542. var _this7 = this;
  13543. return new Promise( /*#__PURE__*/function () {
  13544. var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(resolve, reject) {
  13545. var sub_config, color;
  13546. return _regenerator.default.wrap(function _callee5$(_context5) {
  13547. while (1) {
  13548. switch (_context5.prev = _context5.next) {
  13549. case 0:
  13550. if (!config.border_width || config.border_width <= 0) {
  13551. config.border_width = 0;
  13552. } else {
  13553. config.border_width = parseFloat(config.border_width);
  13554. }
  13555. if (!(parseFloat(config.border_width) > 0)) {
  13556. _context5.next = 10;
  13557. break;
  13558. }
  13559. sub_config = JSON.parse(JSON.stringify(config));
  13560. sub_config.border_width = 0;
  13561. sub_config.w = config.w + config.border_width;
  13562. sub_config.h = config.h + config.border_width;
  13563. sub_config.color = config.border_color || 'black';
  13564. if (sub_config.border_radius) {
  13565. sub_config.border_radius = parseFloat(sub_config.border_radius) + parseFloat(config.border_width) / 2;
  13566. }
  13567. _context5.next = 10;
  13568. return _this7.drawRect(sub_config);
  13569. case 10:
  13570. color = config.color || 'white';
  13571. config.x = parseFloat(config.x) + config.border_width / 2;
  13572. config.y = parseFloat(config.y) + config.border_width / 2;
  13573. config['color'] = color;
  13574. _this7.ctx.fillStyle = color;
  13575. if (config.is_radius || config.border_radius) {
  13576. _this7.setNativeBorderRadius(config);
  13577. _this7.ctx.fill();
  13578. } else {
  13579. console.log('config.border_width', config.border_width);
  13580. _this7.ctx.fillRect(_this7.compatibilitySize(config.x * _this7.scale), _this7.compatibilitySize(config.y * _this7.scale), _this7.compatibilitySize(parseFloat(config.w) * _this7.scale), _this7.compatibilitySize(parseFloat(config.h) * _this7.scale));
  13581. }
  13582. resolve();
  13583. case 17:
  13584. case "end":
  13585. return _context5.stop();
  13586. }
  13587. }
  13588. }, _callee5);
  13589. }));
  13590. return function (_x9, _x10) {
  13591. return _ref5.apply(this, arguments);
  13592. };
  13593. }());
  13594. },
  13595. /**
  13596. * Draw image
  13597. * @param {Object} config
  13598. * @param {String} config.url 图片链接
  13599. * @param {Number} config.x x坐标
  13600. * @param {Number} config.y y坐标
  13601. * @param {Number} config.w 图片宽度(px)
  13602. * @param {Number} config.h 图片高度(px)
  13603. * @param {Number} config.border_width 边大小
  13604. * @param {Number} config.border_color 边颜色
  13605. * @param {Number} config.is_radius 是否开启圆图(1.1.6及以下版本废弃,请使用border_radius)
  13606. * @param {Number} config.border_radius 圆角弧度
  13607. */
  13608. drawImage: function drawImage(config) {
  13609. var _this8 = this;
  13610. return new Promise( /*#__PURE__*/function () {
  13611. var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(resolve, reject) {
  13612. var type, image_url, reg, imageInfoResult, base64, border_radius, multiple, err_msg;
  13613. return _regenerator.default.wrap(function _callee6$(_context6) {
  13614. while (1) {
  13615. switch (_context6.prev = _context6.next) {
  13616. case 0:
  13617. if (!config.url) {
  13618. _context6.next = 47;
  13619. break;
  13620. }
  13621. type = 0; // 1、network image 2、native image 3、base64 image
  13622. reg = /^https?/ig;
  13623. if (reg.test(config.url)) {
  13624. type = 1;
  13625. } else {
  13626. if (config.url.indexOf("data:image/png;base64") != -1 || config.url.indexOf("data:image/jpeg;base64") != -1 || config.url.indexOf("data:image/gif;base64") != -1) {
  13627. type = 3;
  13628. } else {
  13629. type = 2;
  13630. }
  13631. }
  13632. if (!(type == 1)) {
  13633. _context6.next = 9;
  13634. break;
  13635. }
  13636. _context6.next = 7;
  13637. return _this8.downLoadNetworkFile(config.url).then(function (res) {
  13638. // two function
  13639. image_url = res;
  13640. }).catch(function (err) {
  13641. reject(err);
  13642. return;
  13643. });
  13644. case 7:
  13645. _context6.next = 35;
  13646. break;
  13647. case 9:
  13648. if (!(type == 2)) {
  13649. _context6.next = 29;
  13650. break;
  13651. }
  13652. _context6.next = 12;
  13653. return uni.getImageInfo({
  13654. src: config.url
  13655. });
  13656. case 12:
  13657. imageInfoResult = _context6.sent;
  13658. _context6.prev = 13;
  13659. if (!(imageInfoResult.length <= 1)) {
  13660. _context6.next = 17;
  13661. break;
  13662. }
  13663. reject(imageInfoResult[0].errMsg + ':404');
  13664. return _context6.abrupt("return");
  13665. case 17:
  13666. _context6.next = 23;
  13667. break;
  13668. case 19:
  13669. _context6.prev = 19;
  13670. _context6.t0 = _context6["catch"](13);
  13671. reject(_context6.t0 + ':500');
  13672. return _context6.abrupt("return");
  13673. case 23:
  13674. _context6.next = 25;
  13675. return _this8.urlToBase64({
  13676. url: imageInfoResult[1].path
  13677. });
  13678. case 25:
  13679. base64 = _context6.sent;
  13680. image_url = base64;
  13681. _context6.next = 35;
  13682. break;
  13683. case 29:
  13684. if (!(type == 3)) {
  13685. _context6.next = 33;
  13686. break;
  13687. }
  13688. image_url = config.url;
  13689. _context6.next = 35;
  13690. break;
  13691. case 33:
  13692. reject("Other Type Errors:101");
  13693. return _context6.abrupt("return");
  13694. case 35:
  13695. if (!config.border_width) {
  13696. _context6.next = 40;
  13697. break;
  13698. }
  13699. border_radius = 0;
  13700. if (config.border_radius) {
  13701. multiple = config.w / config.border_radius;
  13702. border_radius = (parseFloat(config.w) + parseFloat(config.border_width)) / multiple;
  13703. }
  13704. // drawRect
  13705. _context6.next = 40;
  13706. return _this8.drawRect({
  13707. x: parseFloat(config.x) - parseFloat(config.border_width) / 2,
  13708. y: parseFloat(config.y) - parseFloat(config.border_width) / 2,
  13709. w: parseFloat(config.w) + parseFloat(config.border_width),
  13710. h: parseFloat(config.h) + parseFloat(config.border_width),
  13711. color: config.border_color,
  13712. border_radius: border_radius,
  13713. border_width: config.border_width,
  13714. is_radius: config.is_radius
  13715. });
  13716. case 40:
  13717. if (config.border_radius) {
  13718. config.color = config.color ? config.color : 'rgba(0,0,0,0)';
  13719. // 圆角有白边,+0.5的误差
  13720. config.w = config.w + 0.3;
  13721. config.h = config.h + 0.3;
  13722. _this8.setNativeBorderRadius(config);
  13723. } else if (config.is_radius) {
  13724. //已废弃 is_radius
  13725. _this8.ctx.setStrokeStyle("rgba(0,0,0,0)");
  13726. _this8.ctx.save();
  13727. _this8.ctx.beginPath();
  13728. _this8.ctx.arc(_this8.compatibilitySize(parseFloat(config.x) * _this8.scale + parseFloat(config.w) * _this8.scale / 2), _this8.compatibilitySize(parseFloat(config.y) * _this8.scale + parseFloat(config.h) * _this8.scale / 2), _this8.compatibilitySize(parseFloat(config.w) * _this8.scale / 2), 0, 2 * Math.PI, false);
  13729. _this8.ctx.stroke();
  13730. _this8.ctx.clip();
  13731. }
  13732. _context6.next = 43;
  13733. return _this8.ctx.drawImage(image_url, _this8.compatibilitySize(parseFloat(config.x) * _this8.scale), _this8.compatibilitySize(parseFloat(config.y) * _this8.scale), _this8.compatibilitySize(parseFloat(config.w) * _this8.scale), _this8.compatibilitySize(parseFloat(config.h) * _this8.scale));
  13734. case 43:
  13735. _this8.ctx.restore(); //Restore previously saved drawing context
  13736. resolve();
  13737. _context6.next = 49;
  13738. break;
  13739. case 47:
  13740. err_msg = "Links cannot be empty:101";
  13741. reject(err_msg);
  13742. case 49:
  13743. case "end":
  13744. return _context6.stop();
  13745. }
  13746. }
  13747. }, _callee6, null, [[13, 19]]);
  13748. }));
  13749. return function (_x11, _x12) {
  13750. return _ref6.apply(this, arguments);
  13751. };
  13752. }());
  13753. },
  13754. /**
  13755. * base64 to native available path
  13756. * @param {Object} config
  13757. */
  13758. base64ToNative: function base64ToNative(config) {
  13759. return new Promise(function (resolve, reject) {
  13760. var fileName = new Date().getTime();
  13761. var filePath = "".concat(wx.env.USER_DATA_PATH, "/").concat(fileName, "_rCanvas.png");
  13762. wx.getFileSystemManager().writeFile({
  13763. filePath: filePath,
  13764. data: config.url.replace(/^data:\S+\/\S+;base64,/, ''),
  13765. encoding: 'base64',
  13766. success: function success() {
  13767. resolve(filePath);
  13768. },
  13769. fail: function fail(error) {
  13770. reject(error);
  13771. }
  13772. });
  13773. });
  13774. },
  13775. /**
  13776. * native url to base64
  13777. * @param {Object} config
  13778. */
  13779. urlToBase64: function urlToBase64(config) {
  13780. var _this9 = this;
  13781. return new Promise( /*#__PURE__*/function () {
  13782. var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(resolve, reject) {
  13783. return _regenerator.default.wrap(function _callee7$(_context7) {
  13784. while (1) {
  13785. switch (_context7.prev = _context7.next) {
  13786. case 0:
  13787. if (!(typeof window != 'undefined')) {
  13788. _context7.next = 5;
  13789. break;
  13790. }
  13791. _context7.next = 3;
  13792. return _this9.downLoadNetworkFile(config.url).then(function (res) {
  13793. // two function
  13794. resolve(res);
  13795. }).catch(function (err) {
  13796. reject(err);
  13797. });
  13798. case 3:
  13799. _context7.next = 6;
  13800. break;
  13801. case 5:
  13802. if (typeof plus != 'undefined') {
  13803. plus.io.resolveLocalFileSystemURL(config.url, function (obj) {
  13804. obj.file(function (file) {
  13805. var fileReader = new plus.io.FileReader();
  13806. fileReader.onload = function (res) {
  13807. resolve(res.target.result);
  13808. };
  13809. fileReader.onerror = function (err) {
  13810. reject(err);
  13811. };
  13812. fileReader.readAsDataURL(file);
  13813. }, function (err) {
  13814. reject(err);
  13815. });
  13816. }, function (err) {
  13817. reject(err);
  13818. });
  13819. } else if (typeof wx != 'undefined') {
  13820. wx.getFileSystemManager().readFile({
  13821. filePath: config.url,
  13822. encoding: 'base64',
  13823. success: function success(res) {
  13824. resolve('data:image/png;base64,' + res.data);
  13825. },
  13826. fail: function fail(error) {
  13827. reject(error);
  13828. }
  13829. });
  13830. }
  13831. case 6:
  13832. case "end":
  13833. return _context7.stop();
  13834. }
  13835. }
  13836. }, _callee7);
  13837. }));
  13838. return function (_x13, _x14) {
  13839. return _ref7.apply(this, arguments);
  13840. };
  13841. }());
  13842. },
  13843. setNativeBorderRadius: function setNativeBorderRadius(config) {
  13844. var border_radius = config.border_radius ? parseFloat(config.border_radius) * this.scale : 20 * this.scale;
  13845. if (parseFloat(config.w) * this.scale < 2 * border_radius) border_radius = parseFloat(config.w) * this.scale / 2;
  13846. if (parseFloat(config.h) * this.scale < 2 * border_radius) border_radius = parseFloat(config.h) * this.scale / 2;
  13847. this.ctx.beginPath();
  13848. this.ctx.moveTo(this.compatibilitySize(parseFloat(config.x) * this.scale + border_radius), this.compatibilitySize(parseFloat(config.y) * this.scale));
  13849. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(border_radius));
  13850. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(border_radius));
  13851. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(border_radius));
  13852. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(border_radius));
  13853. this.ctx.closePath();
  13854. this.ctx.strokeStyle = config.color || config.border_color || 'rgba(0,0,0,0)'; // 设置绘制边框的颜色
  13855. this.ctx.stroke();
  13856. this.ctx.save();
  13857. this.ctx.clip();
  13858. },
  13859. /**
  13860. * Download network file
  13861. * @param {Object} url : download url
  13862. */
  13863. downLoadNetworkFile: function downLoadNetworkFile(url) {
  13864. return new Promise(function (resolve, reject) {
  13865. uni.downloadFile({
  13866. url: url,
  13867. success: function success(res) {
  13868. if (res.statusCode == 200) {
  13869. resolve(res.tempFilePath);
  13870. } else {
  13871. reject("Download Image Fail:102");
  13872. }
  13873. },
  13874. fail: function fail(err) {
  13875. reject("Download Image Fail:101");
  13876. }
  13877. });
  13878. });
  13879. },
  13880. /**
  13881. * Save image to natice
  13882. * @param {Object} filePath : native imageUrl
  13883. */
  13884. saveImage: function saveImage(filePath) {
  13885. return new Promise(function (resolve, reject) {
  13886. if (!filePath) {
  13887. reject("FilePath cannot be null:101");
  13888. return;
  13889. }
  13890. uni.saveImageToPhotosAlbum({
  13891. filePath: filePath,
  13892. success: function success(res) {
  13893. resolve(res);
  13894. },
  13895. fail: function fail(err) {
  13896. reject(err);
  13897. }
  13898. });
  13899. });
  13900. }
  13901. }
  13902. };
  13903. exports.default = _default;
  13904. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-alipay/dist/index.js */ 1)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-alipay/dist/index.js */ 1)["default"]))
  13905. /***/ })
  13906. ]]);