vendor.js 495 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],{
  2. /***/ 1:
  3. /*!*********************************************************!*\
  4. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js ***!
  5. \*********************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports, __webpack_require__) {
  8. "use strict";
  9. Object.defineProperty(exports, "__esModule", {
  10. value: true
  11. });
  12. exports.default = void 0;
  13. var objectKeys = ['qy', 'env', 'error', 'version', 'lanDebug', 'cloud', 'serviceMarket', 'router', 'worklet', '__webpack_require_UNI_MP_PLUGIN__'];
  14. var singlePageDisableKey = ['lanDebug', 'router', 'worklet'];
  15. var target = typeof globalThis !== 'undefined' ? globalThis : function () {
  16. return this;
  17. }();
  18. var key = ['w', 'x'].join('');
  19. var oldWx = target[key];
  20. var launchOption = oldWx.getLaunchOptionsSync ? oldWx.getLaunchOptionsSync() : null;
  21. function isWxKey(key) {
  22. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  23. return false;
  24. }
  25. return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function';
  26. }
  27. function initWx() {
  28. var newWx = {};
  29. for (var _key in oldWx) {
  30. if (isWxKey(_key)) {
  31. // TODO wrapper function
  32. newWx[_key] = oldWx[_key];
  33. }
  34. }
  35. return newWx;
  36. }
  37. target[key] = initWx();
  38. if (!target[key].canIUse('getAppBaseInfo')) {
  39. target[key].getAppBaseInfo = target[key].getSystemInfoSync;
  40. }
  41. if (!target[key].canIUse('getWindowInfo')) {
  42. target[key].getWindowInfo = target[key].getSystemInfoSync;
  43. }
  44. if (!target[key].canIUse('getDeviceInfo')) {
  45. target[key].getDeviceInfo = target[key].getSystemInfoSync;
  46. }
  47. var _default = target[key];
  48. exports.default = _default;
  49. /***/ }),
  50. /***/ 10:
  51. /*!****************************************************************!*\
  52. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  53. \****************************************************************/
  54. /*! no static exports found */
  55. /***/ (function(module, exports) {
  56. function _nonIterableRest() {
  57. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  58. }
  59. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  60. /***/ }),
  61. /***/ 11:
  62. /*!***************************************************************!*\
  63. !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
  64. \***************************************************************/
  65. /*! no static exports found */
  66. /***/ (function(module, exports, __webpack_require__) {
  67. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  68. function _defineProperty(obj, key, value) {
  69. key = toPropertyKey(key);
  70. if (key in obj) {
  71. Object.defineProperty(obj, key, {
  72. value: value,
  73. enumerable: true,
  74. configurable: true,
  75. writable: true
  76. });
  77. } else {
  78. obj[key] = value;
  79. }
  80. return obj;
  81. }
  82. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  83. /***/ }),
  84. /***/ 12:
  85. /*!**************************************************************!*\
  86. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  87. \**************************************************************/
  88. /*! no static exports found */
  89. /***/ (function(module, exports, __webpack_require__) {
  90. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  91. var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 14);
  92. function toPropertyKey(t) {
  93. var i = toPrimitive(t, "string");
  94. return "symbol" == _typeof(i) ? i : i + "";
  95. }
  96. module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  97. /***/ }),
  98. /***/ 13:
  99. /*!*******************************************************!*\
  100. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  101. \*******************************************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports) {
  104. function _typeof(o) {
  105. "@babel/helpers - typeof";
  106. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  107. return typeof o;
  108. } : function (o) {
  109. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  110. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
  111. }
  112. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  113. /***/ }),
  114. /***/ 14:
  115. /*!************************************************************!*\
  116. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  117. \************************************************************/
  118. /*! no static exports found */
  119. /***/ (function(module, exports, __webpack_require__) {
  120. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  121. function toPrimitive(t, r) {
  122. if ("object" != _typeof(t) || !t) return t;
  123. var e = t[Symbol.toPrimitive];
  124. if (void 0 !== e) {
  125. var i = e.call(t, r || "default");
  126. if ("object" != _typeof(i)) return i;
  127. throw new TypeError("@@toPrimitive must return a primitive value.");
  128. }
  129. return ("string" === r ? String : Number)(t);
  130. }
  131. module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  132. /***/ }),
  133. /***/ 15:
  134. /*!**********************************************************!*\
  135. !*** ./node_modules/@babel/runtime/helpers/construct.js ***!
  136. \**********************************************************/
  137. /*! no static exports found */
  138. /***/ (function(module, exports, __webpack_require__) {
  139. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  140. var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 17);
  141. function _construct(t, e, r) {
  142. if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
  143. var o = [null];
  144. o.push.apply(o, e);
  145. var p = new (t.bind.apply(t, o))();
  146. return r && setPrototypeOf(p, r.prototype), p;
  147. }
  148. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  149. /***/ }),
  150. /***/ 16:
  151. /*!***************************************************************!*\
  152. !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
  153. \***************************************************************/
  154. /*! no static exports found */
  155. /***/ (function(module, exports) {
  156. function _setPrototypeOf(o, p) {
  157. module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  158. o.__proto__ = p;
  159. return o;
  160. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  161. return _setPrototypeOf(o, p);
  162. }
  163. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  164. /***/ }),
  165. /***/ 17:
  166. /*!*************************************************************************!*\
  167. !*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
  168. \*************************************************************************/
  169. /*! no static exports found */
  170. /***/ (function(module, exports) {
  171. function _isNativeReflectConstruct() {
  172. try {
  173. var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  174. } catch (t) {}
  175. return (module.exports = _isNativeReflectConstruct = function _isNativeReflectConstruct() {
  176. return !!t;
  177. }, module.exports.__esModule = true, module.exports["default"] = module.exports)();
  178. }
  179. module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  180. /***/ }),
  181. /***/ 18:
  182. /*!******************************************************************!*\
  183. !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
  184. \******************************************************************/
  185. /*! no static exports found */
  186. /***/ (function(module, exports, __webpack_require__) {
  187. var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 19);
  188. var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 20);
  189. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  190. var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 21);
  191. function _toConsumableArray(arr) {
  192. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  193. }
  194. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  195. /***/ }),
  196. /***/ 19:
  197. /*!******************************************************************!*\
  198. !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
  199. \******************************************************************/
  200. /*! no static exports found */
  201. /***/ (function(module, exports, __webpack_require__) {
  202. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  203. function _arrayWithoutHoles(arr) {
  204. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  205. }
  206. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  207. /***/ }),
  208. /***/ 2:
  209. /*!************************************************************!*\
  210. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  211. \************************************************************/
  212. /*! no static exports found */
  213. /***/ (function(module, exports, __webpack_require__) {
  214. "use strict";
  215. /* WEBPACK VAR INJECTION */(function(wx, global) {
  216. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  217. Object.defineProperty(exports, "__esModule", {
  218. value: true
  219. });
  220. exports.createApp = createApp;
  221. exports.createComponent = createComponent;
  222. exports.createPage = createPage;
  223. exports.createPlugin = createPlugin;
  224. exports.createSubpackageApp = createSubpackageApp;
  225. exports.default = void 0;
  226. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  227. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  228. var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ 15));
  229. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  230. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  231. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
  232. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 25));
  233. 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; }
  234. 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; }
  235. var realAtob;
  236. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  237. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  238. if (typeof atob !== 'function') {
  239. realAtob = function realAtob(str) {
  240. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  241. if (!b64re.test(str)) {
  242. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  243. }
  244. // Adding the padding if missing, for semplicity
  245. str += '=='.slice(2 - (str.length & 3));
  246. var bitmap;
  247. var result = '';
  248. var r1;
  249. var r2;
  250. var i = 0;
  251. for (; i < str.length;) {
  252. 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++)));
  253. 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);
  254. }
  255. return result;
  256. };
  257. } else {
  258. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  259. realAtob = atob;
  260. }
  261. function b64DecodeUnicode(str) {
  262. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  263. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  264. }).join(''));
  265. }
  266. function getCurrentUserInfo() {
  267. var token = wx.getStorageSync('uni_id_token') || '';
  268. var tokenArr = token.split('.');
  269. if (!token || tokenArr.length !== 3) {
  270. return {
  271. uid: null,
  272. role: [],
  273. permission: [],
  274. tokenExpired: 0
  275. };
  276. }
  277. var userInfo;
  278. try {
  279. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  280. } catch (error) {
  281. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  282. }
  283. userInfo.tokenExpired = userInfo.exp * 1000;
  284. delete userInfo.exp;
  285. delete userInfo.iat;
  286. return userInfo;
  287. }
  288. function uniIdMixin(Vue) {
  289. Vue.prototype.uniIDHasRole = function (roleId) {
  290. var _getCurrentUserInfo = getCurrentUserInfo(),
  291. role = _getCurrentUserInfo.role;
  292. return role.indexOf(roleId) > -1;
  293. };
  294. Vue.prototype.uniIDHasPermission = function (permissionId) {
  295. var _getCurrentUserInfo2 = getCurrentUserInfo(),
  296. permission = _getCurrentUserInfo2.permission;
  297. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  298. };
  299. Vue.prototype.uniIDTokenValid = function () {
  300. var _getCurrentUserInfo3 = getCurrentUserInfo(),
  301. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  302. return tokenExpired > Date.now();
  303. };
  304. }
  305. var _toString = Object.prototype.toString;
  306. var hasOwnProperty = Object.prototype.hasOwnProperty;
  307. function isFn(fn) {
  308. return typeof fn === 'function';
  309. }
  310. function isStr(str) {
  311. return typeof str === 'string';
  312. }
  313. function isObject(obj) {
  314. return obj !== null && (0, _typeof2.default)(obj) === 'object';
  315. }
  316. function isPlainObject(obj) {
  317. return _toString.call(obj) === '[object Object]';
  318. }
  319. function hasOwn(obj, key) {
  320. return hasOwnProperty.call(obj, key);
  321. }
  322. function noop() {}
  323. /**
  324. * Create a cached version of a pure function.
  325. */
  326. function cached(fn) {
  327. var cache = Object.create(null);
  328. return function cachedFn(str) {
  329. var hit = cache[str];
  330. return hit || (cache[str] = fn(str));
  331. };
  332. }
  333. /**
  334. * Camelize a hyphen-delimited string.
  335. */
  336. var camelizeRE = /-(\w)/g;
  337. var camelize = cached(function (str) {
  338. return str.replace(camelizeRE, function (_, c) {
  339. return c ? c.toUpperCase() : '';
  340. });
  341. });
  342. function sortObject(obj) {
  343. var sortObj = {};
  344. if (isPlainObject(obj)) {
  345. Object.keys(obj).sort().forEach(function (key) {
  346. sortObj[key] = obj[key];
  347. });
  348. }
  349. return !Object.keys(sortObj) ? obj : sortObj;
  350. }
  351. var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
  352. var globalInterceptors = {};
  353. var scopedInterceptors = {};
  354. function mergeHook(parentVal, childVal) {
  355. var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
  356. return res ? dedupeHooks(res) : res;
  357. }
  358. function dedupeHooks(hooks) {
  359. var res = [];
  360. for (var i = 0; i < hooks.length; i++) {
  361. if (res.indexOf(hooks[i]) === -1) {
  362. res.push(hooks[i]);
  363. }
  364. }
  365. return res;
  366. }
  367. function removeHook(hooks, hook) {
  368. var index = hooks.indexOf(hook);
  369. if (index !== -1) {
  370. hooks.splice(index, 1);
  371. }
  372. }
  373. function mergeInterceptorHook(interceptor, option) {
  374. Object.keys(option).forEach(function (hook) {
  375. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  376. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  377. }
  378. });
  379. }
  380. function removeInterceptorHook(interceptor, option) {
  381. if (!interceptor || !option) {
  382. return;
  383. }
  384. Object.keys(option).forEach(function (hook) {
  385. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  386. removeHook(interceptor[hook], option[hook]);
  387. }
  388. });
  389. }
  390. function addInterceptor(method, option) {
  391. if (typeof method === 'string' && isPlainObject(option)) {
  392. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  393. } else if (isPlainObject(method)) {
  394. mergeInterceptorHook(globalInterceptors, method);
  395. }
  396. }
  397. function removeInterceptor(method, option) {
  398. if (typeof method === 'string') {
  399. if (isPlainObject(option)) {
  400. removeInterceptorHook(scopedInterceptors[method], option);
  401. } else {
  402. delete scopedInterceptors[method];
  403. }
  404. } else if (isPlainObject(method)) {
  405. removeInterceptorHook(globalInterceptors, method);
  406. }
  407. }
  408. function wrapperHook(hook, params) {
  409. return function (data) {
  410. return hook(data, params) || data;
  411. };
  412. }
  413. function isPromise(obj) {
  414. return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  415. }
  416. function queue(hooks, data, params) {
  417. var promise = false;
  418. for (var i = 0; i < hooks.length; i++) {
  419. var hook = hooks[i];
  420. if (promise) {
  421. promise = Promise.resolve(wrapperHook(hook, params));
  422. } else {
  423. var res = hook(data, params);
  424. if (isPromise(res)) {
  425. promise = Promise.resolve(res);
  426. }
  427. if (res === false) {
  428. return {
  429. then: function then() {}
  430. };
  431. }
  432. }
  433. }
  434. return promise || {
  435. then: function then(callback) {
  436. return callback(data);
  437. }
  438. };
  439. }
  440. function wrapperOptions(interceptor) {
  441. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  442. ['success', 'fail', 'complete'].forEach(function (name) {
  443. if (Array.isArray(interceptor[name])) {
  444. var oldCallback = options[name];
  445. options[name] = function callbackInterceptor(res) {
  446. queue(interceptor[name], res, options).then(function (res) {
  447. /* eslint-disable no-mixed-operators */
  448. return isFn(oldCallback) && oldCallback(res) || res;
  449. });
  450. };
  451. }
  452. });
  453. return options;
  454. }
  455. function wrapperReturnValue(method, returnValue) {
  456. var returnValueHooks = [];
  457. if (Array.isArray(globalInterceptors.returnValue)) {
  458. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
  459. }
  460. var interceptor = scopedInterceptors[method];
  461. if (interceptor && Array.isArray(interceptor.returnValue)) {
  462. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
  463. }
  464. returnValueHooks.forEach(function (hook) {
  465. returnValue = hook(returnValue) || returnValue;
  466. });
  467. return returnValue;
  468. }
  469. function getApiInterceptorHooks(method) {
  470. var interceptor = Object.create(null);
  471. Object.keys(globalInterceptors).forEach(function (hook) {
  472. if (hook !== 'returnValue') {
  473. interceptor[hook] = globalInterceptors[hook].slice();
  474. }
  475. });
  476. var scopedInterceptor = scopedInterceptors[method];
  477. if (scopedInterceptor) {
  478. Object.keys(scopedInterceptor).forEach(function (hook) {
  479. if (hook !== 'returnValue') {
  480. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  481. }
  482. });
  483. }
  484. return interceptor;
  485. }
  486. function invokeApi(method, api, options) {
  487. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  488. params[_key - 3] = arguments[_key];
  489. }
  490. var interceptor = getApiInterceptorHooks(method);
  491. if (interceptor && Object.keys(interceptor).length) {
  492. if (Array.isArray(interceptor.invoke)) {
  493. var res = queue(interceptor.invoke, options);
  494. return res.then(function (options) {
  495. // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
  496. return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
  497. });
  498. } else {
  499. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  500. }
  501. }
  502. return api.apply(void 0, [options].concat(params));
  503. }
  504. var promiseInterceptor = {
  505. returnValue: function returnValue(res) {
  506. if (!isPromise(res)) {
  507. return res;
  508. }
  509. return new Promise(function (resolve, reject) {
  510. res.then(function (res) {
  511. if (!res) {
  512. resolve(res);
  513. return;
  514. }
  515. if (res[0]) {
  516. reject(res[0]);
  517. } else {
  518. resolve(res[1]);
  519. }
  520. });
  521. });
  522. }
  523. };
  524. var SYNC_API_RE = /^\$|__f__|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|rpx2px|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting|initUTS|requireUTS|registerUTS|getFacialRecognitionMetaInfo/;
  525. var CONTEXT_API_RE = /^create|Manager$/;
  526. // Context例外情况
  527. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  528. // 同步例外情况
  529. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  530. var CALLBACK_API_RE = /^on|^off/;
  531. function isContextApi(name) {
  532. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  533. }
  534. function isSyncApi(name) {
  535. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  536. }
  537. function isCallbackApi(name) {
  538. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  539. }
  540. function handlePromise(promise) {
  541. return promise.then(function (data) {
  542. return [null, data];
  543. }).catch(function (err) {
  544. return [err];
  545. });
  546. }
  547. function shouldPromise(name) {
  548. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  549. return false;
  550. }
  551. return true;
  552. }
  553. /* eslint-disable no-extend-native */
  554. if (!Promise.prototype.finally) {
  555. Promise.prototype.finally = function (callback) {
  556. var promise = this.constructor;
  557. return this.then(function (value) {
  558. return promise.resolve(callback()).then(function () {
  559. return value;
  560. });
  561. }, function (reason) {
  562. return promise.resolve(callback()).then(function () {
  563. throw reason;
  564. });
  565. });
  566. };
  567. }
  568. function promisify(name, api) {
  569. if (!shouldPromise(name) || !isFn(api)) {
  570. return api;
  571. }
  572. return function promiseApi() {
  573. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  574. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  575. params[_key2 - 1] = arguments[_key2];
  576. }
  577. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  578. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, Object.assign({}, options)].concat(params)));
  579. }
  580. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  581. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  582. success: resolve,
  583. fail: reject
  584. })].concat(params));
  585. })));
  586. };
  587. }
  588. var EPS = 1e-4;
  589. var BASE_DEVICE_WIDTH = 750;
  590. var isIOS = false;
  591. var deviceWidth = 0;
  592. var deviceDPR = 0;
  593. function checkDeviceWidth() {
  594. var windowWidth, pixelRatio, platform;
  595. {
  596. var windowInfo = typeof wx.getWindowInfo === 'function' && wx.getWindowInfo() ? wx.getWindowInfo() : wx.getSystemInfoSync();
  597. var deviceInfo = typeof wx.getDeviceInfo === 'function' && wx.getDeviceInfo() ? wx.getDeviceInfo() : wx.getSystemInfoSync();
  598. windowWidth = windowInfo.windowWidth;
  599. pixelRatio = windowInfo.pixelRatio;
  600. platform = deviceInfo.platform;
  601. }
  602. deviceWidth = windowWidth;
  603. deviceDPR = pixelRatio;
  604. isIOS = platform === 'ios';
  605. }
  606. function upx2px(number, newDeviceWidth) {
  607. if (deviceWidth === 0) {
  608. checkDeviceWidth();
  609. }
  610. number = Number(number);
  611. if (number === 0) {
  612. return 0;
  613. }
  614. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  615. if (result < 0) {
  616. result = -result;
  617. }
  618. result = Math.floor(result + EPS);
  619. if (result === 0) {
  620. if (deviceDPR === 1 || !isIOS) {
  621. result = 1;
  622. } else {
  623. result = 0.5;
  624. }
  625. }
  626. return number < 0 ? -result : result;
  627. }
  628. var LOCALE_ZH_HANS = 'zh-Hans';
  629. var LOCALE_ZH_HANT = 'zh-Hant';
  630. var LOCALE_EN = 'en';
  631. var LOCALE_FR = 'fr';
  632. var LOCALE_ES = 'es';
  633. var messages = {};
  634. function getLocaleLanguage() {
  635. var localeLanguage = '';
  636. {
  637. var appBaseInfo = typeof wx.getAppBaseInfo === 'function' && wx.getAppBaseInfo() ? wx.getAppBaseInfo() : wx.getSystemInfoSync();
  638. var language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
  639. localeLanguage = normalizeLocale(language) || LOCALE_EN;
  640. }
  641. return localeLanguage;
  642. }
  643. var locale;
  644. {
  645. locale = getLocaleLanguage();
  646. }
  647. function initI18nMessages() {
  648. if (!isEnableLocale()) {
  649. return;
  650. }
  651. var localeKeys = Object.keys(__uniConfig.locales);
  652. if (localeKeys.length) {
  653. localeKeys.forEach(function (locale) {
  654. var curMessages = messages[locale];
  655. var userMessages = __uniConfig.locales[locale];
  656. if (curMessages) {
  657. Object.assign(curMessages, userMessages);
  658. } else {
  659. messages[locale] = userMessages;
  660. }
  661. });
  662. }
  663. }
  664. initI18nMessages();
  665. var i18n = (0, _uniI18n.initVueI18n)(locale, {});
  666. var t = i18n.t;
  667. var i18nMixin = i18n.mixin = {
  668. beforeCreate: function beforeCreate() {
  669. var _this = this;
  670. var unwatch = i18n.i18n.watchLocale(function () {
  671. _this.$forceUpdate();
  672. });
  673. this.$once('hook:beforeDestroy', function () {
  674. unwatch();
  675. });
  676. },
  677. methods: {
  678. $$t: function $$t(key, values) {
  679. return t(key, values);
  680. }
  681. }
  682. };
  683. var setLocale = i18n.setLocale;
  684. var getLocale = i18n.getLocale;
  685. function initAppLocale(Vue, appVm, locale) {
  686. var state = Vue.observable({
  687. locale: locale || i18n.getLocale()
  688. });
  689. var localeWatchers = [];
  690. appVm.$watchLocale = function (fn) {
  691. localeWatchers.push(fn);
  692. };
  693. Object.defineProperty(appVm, '$locale', {
  694. get: function get() {
  695. return state.locale;
  696. },
  697. set: function set(v) {
  698. state.locale = v;
  699. localeWatchers.forEach(function (watch) {
  700. return watch(v);
  701. });
  702. }
  703. });
  704. }
  705. function isEnableLocale() {
  706. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  707. }
  708. function include(str, parts) {
  709. return !!parts.find(function (part) {
  710. return str.indexOf(part) !== -1;
  711. });
  712. }
  713. function startsWith(str, parts) {
  714. return parts.find(function (part) {
  715. return str.indexOf(part) === 0;
  716. });
  717. }
  718. function normalizeLocale(locale, messages) {
  719. if (!locale) {
  720. return;
  721. }
  722. locale = locale.trim().replace(/_/g, '-');
  723. if (messages && messages[locale]) {
  724. return locale;
  725. }
  726. locale = locale.toLowerCase();
  727. if (locale === 'chinese') {
  728. // 支付宝
  729. return LOCALE_ZH_HANS;
  730. }
  731. if (locale.indexOf('zh') === 0) {
  732. if (locale.indexOf('-hans') > -1) {
  733. return LOCALE_ZH_HANS;
  734. }
  735. if (locale.indexOf('-hant') > -1) {
  736. return LOCALE_ZH_HANT;
  737. }
  738. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  739. return LOCALE_ZH_HANT;
  740. }
  741. return LOCALE_ZH_HANS;
  742. }
  743. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  744. if (lang) {
  745. return lang;
  746. }
  747. }
  748. // export function initI18n() {
  749. // const localeKeys = Object.keys(__uniConfig.locales || {})
  750. // if (localeKeys.length) {
  751. // localeKeys.forEach((locale) =>
  752. // i18n.add(locale, __uniConfig.locales[locale])
  753. // )
  754. // }
  755. // }
  756. function getLocale$1() {
  757. // 优先使用 $locale
  758. if (isFn(getApp)) {
  759. var app = getApp({
  760. allowDefault: true
  761. });
  762. if (app && app.$vm) {
  763. return app.$vm.$locale;
  764. }
  765. }
  766. return getLocaleLanguage();
  767. }
  768. function setLocale$1(locale) {
  769. var app = isFn(getApp) ? getApp() : false;
  770. if (!app) {
  771. return false;
  772. }
  773. var oldLocale = app.$vm.$locale;
  774. if (oldLocale !== locale) {
  775. app.$vm.$locale = locale;
  776. onLocaleChangeCallbacks.forEach(function (fn) {
  777. return fn({
  778. locale: locale
  779. });
  780. });
  781. return true;
  782. }
  783. return false;
  784. }
  785. var onLocaleChangeCallbacks = [];
  786. function onLocaleChange(fn) {
  787. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  788. onLocaleChangeCallbacks.push(fn);
  789. }
  790. }
  791. if (typeof global !== 'undefined') {
  792. global.getLocale = getLocale$1;
  793. }
  794. var interceptors = {
  795. promiseInterceptor: promiseInterceptor
  796. };
  797. var baseApi = /*#__PURE__*/Object.freeze({
  798. __proto__: null,
  799. upx2px: upx2px,
  800. rpx2px: upx2px,
  801. getLocale: getLocale$1,
  802. setLocale: setLocale$1,
  803. onLocaleChange: onLocaleChange,
  804. addInterceptor: addInterceptor,
  805. removeInterceptor: removeInterceptor,
  806. interceptors: interceptors
  807. });
  808. function findExistsPageIndex(url) {
  809. var pages = getCurrentPages();
  810. var len = pages.length;
  811. while (len--) {
  812. var page = pages[len];
  813. if (page.$page && page.$page.fullPath === url) {
  814. return len;
  815. }
  816. }
  817. return -1;
  818. }
  819. var redirectTo = {
  820. name: function name(fromArgs) {
  821. if (fromArgs.exists === 'back' && fromArgs.delta) {
  822. return 'navigateBack';
  823. }
  824. return 'redirectTo';
  825. },
  826. args: function args(fromArgs) {
  827. if (fromArgs.exists === 'back' && fromArgs.url) {
  828. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  829. if (existsPageIndex !== -1) {
  830. var delta = getCurrentPages().length - 1 - existsPageIndex;
  831. if (delta > 0) {
  832. fromArgs.delta = delta;
  833. }
  834. }
  835. }
  836. }
  837. };
  838. var previewImage = {
  839. args: function args(fromArgs) {
  840. var currentIndex = parseInt(fromArgs.current);
  841. if (isNaN(currentIndex)) {
  842. return;
  843. }
  844. var urls = fromArgs.urls;
  845. if (!Array.isArray(urls)) {
  846. return;
  847. }
  848. var len = urls.length;
  849. if (!len) {
  850. return;
  851. }
  852. if (currentIndex < 0) {
  853. currentIndex = 0;
  854. } else if (currentIndex >= len) {
  855. currentIndex = len - 1;
  856. }
  857. if (currentIndex > 0) {
  858. fromArgs.current = urls[currentIndex];
  859. fromArgs.urls = urls.filter(function (item, index) {
  860. return index < currentIndex ? item !== urls[currentIndex] : true;
  861. });
  862. } else {
  863. fromArgs.current = urls[0];
  864. }
  865. return {
  866. indicator: false,
  867. loop: false
  868. };
  869. }
  870. };
  871. var UUID_KEY = '__DC_STAT_UUID';
  872. var deviceId;
  873. function useDeviceId(result) {
  874. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  875. if (!deviceId) {
  876. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  877. wx.setStorage({
  878. key: UUID_KEY,
  879. data: deviceId
  880. });
  881. }
  882. result.deviceId = deviceId;
  883. }
  884. function addSafeAreaInsets(result) {
  885. if (result.safeArea) {
  886. var safeArea = result.safeArea;
  887. result.safeAreaInsets = {
  888. top: safeArea.top,
  889. left: safeArea.left,
  890. right: result.windowWidth - safeArea.right,
  891. bottom: result.screenHeight - safeArea.bottom
  892. };
  893. }
  894. }
  895. function getOSInfo(system, platform) {
  896. var osName = '';
  897. var osVersion = '';
  898. if (platform && "mp-weixin" === 'mp-baidu') {
  899. osName = platform;
  900. osVersion = system;
  901. } else {
  902. osName = system.split(' ')[0] || platform;
  903. osVersion = system.split(' ')[1] || '';
  904. }
  905. osName = osName.toLocaleLowerCase();
  906. switch (osName) {
  907. case 'harmony': // alipay
  908. case 'ohos': // weixin
  909. case 'openharmony':
  910. // feishu
  911. osName = 'harmonyos';
  912. break;
  913. case 'iphone os':
  914. // alipay
  915. osName = 'ios';
  916. break;
  917. case 'mac': // weixin qq
  918. case 'darwin':
  919. // feishu
  920. osName = 'macos';
  921. break;
  922. case 'windows_nt':
  923. // feishu
  924. osName = 'windows';
  925. break;
  926. }
  927. return {
  928. osName: osName,
  929. osVersion: osVersion
  930. };
  931. }
  932. function populateParameters(result) {
  933. var _result$brand = result.brand,
  934. brand = _result$brand === void 0 ? '' : _result$brand,
  935. _result$model = result.model,
  936. model = _result$model === void 0 ? '' : _result$model,
  937. _result$system = result.system,
  938. system = _result$system === void 0 ? '' : _result$system,
  939. _result$language = result.language,
  940. language = _result$language === void 0 ? '' : _result$language,
  941. theme = result.theme,
  942. version = result.version,
  943. platform = result.platform,
  944. fontSizeSetting = result.fontSizeSetting,
  945. SDKVersion = result.SDKVersion,
  946. pixelRatio = result.pixelRatio,
  947. deviceOrientation = result.deviceOrientation;
  948. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  949. var extraParam = {};
  950. // osName osVersion
  951. var _getOSInfo = getOSInfo(system, platform),
  952. osName = _getOSInfo.osName,
  953. osVersion = _getOSInfo.osVersion;
  954. var hostVersion = version;
  955. // deviceType
  956. var deviceType = getGetDeviceType(result, model);
  957. // deviceModel
  958. var deviceBrand = getDeviceBrand(brand);
  959. // hostName
  960. var _hostName = getHostName(result);
  961. // deviceOrientation
  962. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  963. // devicePixelRatio
  964. var _devicePixelRatio = pixelRatio;
  965. // SDKVersion
  966. var _SDKVersion = SDKVersion;
  967. // hostLanguage
  968. var hostLanguage = (language || '').replace(/_/g, '-');
  969. // wx.getAccountInfoSync
  970. var parameters = {
  971. appId: "__UNI__C0ABCC1",
  972. appName: "chargingPile",
  973. appVersion: "1.0.0",
  974. appVersionCode: "100",
  975. appLanguage: getAppLanguage(hostLanguage),
  976. uniCompileVersion: "4.85",
  977. uniCompilerVersion: "4.85",
  978. uniRuntimeVersion: "4.85",
  979. uniPlatform: undefined || "mp-weixin",
  980. deviceBrand: deviceBrand,
  981. deviceModel: model,
  982. deviceType: deviceType,
  983. devicePixelRatio: _devicePixelRatio,
  984. deviceOrientation: _deviceOrientation,
  985. osName: osName.toLocaleLowerCase(),
  986. osVersion: osVersion,
  987. hostTheme: theme,
  988. hostVersion: hostVersion,
  989. hostLanguage: hostLanguage,
  990. hostName: _hostName,
  991. hostSDKVersion: _SDKVersion,
  992. hostFontSizeSetting: fontSizeSetting,
  993. windowTop: 0,
  994. windowBottom: 0,
  995. // TODO
  996. osLanguage: undefined,
  997. osTheme: undefined,
  998. ua: undefined,
  999. hostPackageName: undefined,
  1000. browserName: undefined,
  1001. browserVersion: undefined,
  1002. isUniAppX: false
  1003. };
  1004. Object.assign(result, parameters, extraParam);
  1005. }
  1006. function getGetDeviceType(result, model) {
  1007. var deviceType = result.deviceType || 'phone';
  1008. {
  1009. var deviceTypeMaps = {
  1010. ipad: 'pad',
  1011. windows: 'pc',
  1012. mac: 'pc'
  1013. };
  1014. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  1015. var _model = model.toLocaleLowerCase();
  1016. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  1017. var _m = deviceTypeMapsKeys[index];
  1018. if (_model.indexOf(_m) !== -1) {
  1019. deviceType = deviceTypeMaps[_m];
  1020. break;
  1021. }
  1022. }
  1023. }
  1024. return deviceType;
  1025. }
  1026. function getDeviceBrand(brand) {
  1027. var deviceBrand = brand;
  1028. if (deviceBrand) {
  1029. deviceBrand = brand.toLocaleLowerCase();
  1030. }
  1031. return deviceBrand;
  1032. }
  1033. function getAppLanguage(defaultLanguage) {
  1034. return getLocale$1 ? getLocale$1() : defaultLanguage;
  1035. }
  1036. function getHostName(result) {
  1037. var _platform = 'WeChat';
  1038. var _hostName = result.hostName || _platform; // mp-jd
  1039. {
  1040. if (result.environment) {
  1041. _hostName = result.environment;
  1042. } else if (result.host && result.host.env) {
  1043. _hostName = result.host.env;
  1044. }
  1045. }
  1046. return _hostName;
  1047. }
  1048. var getSystemInfo = {
  1049. returnValue: function returnValue(result) {
  1050. useDeviceId(result);
  1051. addSafeAreaInsets(result);
  1052. populateParameters(result);
  1053. }
  1054. };
  1055. var showActionSheet = {
  1056. args: function args(fromArgs) {
  1057. if ((0, _typeof2.default)(fromArgs) === 'object') {
  1058. fromArgs.alertText = fromArgs.title;
  1059. }
  1060. }
  1061. };
  1062. var getAppBaseInfo = {
  1063. returnValue: function returnValue(result) {
  1064. var _result = result,
  1065. version = _result.version,
  1066. language = _result.language,
  1067. SDKVersion = _result.SDKVersion,
  1068. theme = _result.theme;
  1069. var _hostName = getHostName(result);
  1070. var hostLanguage = (language || '').replace('_', '-');
  1071. result = sortObject(Object.assign(result, {
  1072. appId: "__UNI__C0ABCC1",
  1073. appName: "chargingPile",
  1074. appVersion: "1.0.0",
  1075. appVersionCode: "100",
  1076. appLanguage: getAppLanguage(hostLanguage),
  1077. hostVersion: version,
  1078. hostLanguage: hostLanguage,
  1079. hostName: _hostName,
  1080. hostSDKVersion: SDKVersion,
  1081. hostTheme: theme,
  1082. isUniAppX: false,
  1083. uniPlatform: undefined || "mp-weixin",
  1084. uniCompileVersion: "4.85",
  1085. uniCompilerVersion: "4.85",
  1086. uniRuntimeVersion: "4.85"
  1087. }));
  1088. }
  1089. };
  1090. var getDeviceInfo = {
  1091. returnValue: function returnValue(result) {
  1092. var _result2 = result,
  1093. brand = _result2.brand,
  1094. model = _result2.model,
  1095. _result2$system = _result2.system,
  1096. system = _result2$system === void 0 ? '' : _result2$system,
  1097. _result2$platform = _result2.platform,
  1098. platform = _result2$platform === void 0 ? '' : _result2$platform;
  1099. var deviceType = getGetDeviceType(result, model);
  1100. var deviceBrand = getDeviceBrand(brand);
  1101. useDeviceId(result);
  1102. var _getOSInfo2 = getOSInfo(system, platform),
  1103. osName = _getOSInfo2.osName,
  1104. osVersion = _getOSInfo2.osVersion;
  1105. result = sortObject(Object.assign(result, {
  1106. deviceType: deviceType,
  1107. deviceBrand: deviceBrand,
  1108. deviceModel: model,
  1109. osName: osName,
  1110. osVersion: osVersion
  1111. }));
  1112. }
  1113. };
  1114. var getWindowInfo = {
  1115. returnValue: function returnValue(result) {
  1116. addSafeAreaInsets(result);
  1117. result = sortObject(Object.assign(result, {
  1118. windowTop: 0,
  1119. windowBottom: 0
  1120. }));
  1121. }
  1122. };
  1123. var getAppAuthorizeSetting = {
  1124. returnValue: function returnValue(result) {
  1125. var locationReducedAccuracy = result.locationReducedAccuracy;
  1126. result.locationAccuracy = 'unsupported';
  1127. if (locationReducedAccuracy === true) {
  1128. result.locationAccuracy = 'reduced';
  1129. } else if (locationReducedAccuracy === false) {
  1130. result.locationAccuracy = 'full';
  1131. }
  1132. }
  1133. };
  1134. // import navigateTo from 'uni-helpers/navigate-to'
  1135. var compressImage = {
  1136. args: function args(fromArgs) {
  1137. // https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
  1138. if (fromArgs.compressedHeight && !fromArgs.compressHeight) {
  1139. fromArgs.compressHeight = fromArgs.compressedHeight;
  1140. }
  1141. if (fromArgs.compressedWidth && !fromArgs.compressWidth) {
  1142. fromArgs.compressWidth = fromArgs.compressedWidth;
  1143. }
  1144. }
  1145. };
  1146. var protocols = {
  1147. redirectTo: redirectTo,
  1148. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  1149. previewImage: previewImage,
  1150. getSystemInfo: getSystemInfo,
  1151. getSystemInfoSync: getSystemInfo,
  1152. showActionSheet: showActionSheet,
  1153. getAppBaseInfo: getAppBaseInfo,
  1154. getDeviceInfo: getDeviceInfo,
  1155. getWindowInfo: getWindowInfo,
  1156. getAppAuthorizeSetting: getAppAuthorizeSetting,
  1157. compressImage: compressImage
  1158. };
  1159. var todos = ['vibrate', 'preloadPage', 'unPreloadPage', 'loadSubPackage'];
  1160. var canIUses = [];
  1161. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  1162. function processCallback(methodName, method, returnValue) {
  1163. return function (res) {
  1164. return method(processReturnValue(methodName, res, returnValue));
  1165. };
  1166. }
  1167. function processArgs(methodName, fromArgs) {
  1168. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  1169. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  1170. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  1171. if (isPlainObject(fromArgs)) {
  1172. // 一般 api 的参数解析
  1173. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  1174. if (isFn(argsOption)) {
  1175. argsOption = argsOption(fromArgs, toArgs) || {};
  1176. }
  1177. for (var key in fromArgs) {
  1178. if (hasOwn(argsOption, key)) {
  1179. var keyOption = argsOption[key];
  1180. if (isFn(keyOption)) {
  1181. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  1182. }
  1183. if (!keyOption) {
  1184. // 不支持的参数
  1185. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  1186. } else if (isStr(keyOption)) {
  1187. // 重写参数 key
  1188. toArgs[keyOption] = fromArgs[key];
  1189. } else if (isPlainObject(keyOption)) {
  1190. // {name:newName,value:value}可重新指定参数 key:value
  1191. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  1192. }
  1193. } else if (CALLBACKS.indexOf(key) !== -1) {
  1194. if (isFn(fromArgs[key])) {
  1195. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  1196. }
  1197. } else {
  1198. if (!keepFromArgs) {
  1199. toArgs[key] = fromArgs[key];
  1200. }
  1201. }
  1202. }
  1203. return toArgs;
  1204. } else if (isFn(fromArgs)) {
  1205. fromArgs = processCallback(methodName, fromArgs, returnValue);
  1206. }
  1207. return fromArgs;
  1208. }
  1209. function processReturnValue(methodName, res, returnValue) {
  1210. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  1211. if (isFn(protocols.returnValue)) {
  1212. // 处理通用 returnValue
  1213. res = protocols.returnValue(methodName, res);
  1214. }
  1215. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  1216. }
  1217. function wrapper(methodName, method) {
  1218. if (hasOwn(protocols, methodName)) {
  1219. var protocol = protocols[methodName];
  1220. if (!protocol) {
  1221. // 暂不支持的 api
  1222. return function () {
  1223. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  1224. };
  1225. }
  1226. return function (arg1, arg2) {
  1227. // 目前 api 最多两个参数
  1228. var options = protocol;
  1229. if (isFn(protocol)) {
  1230. options = protocol(arg1);
  1231. }
  1232. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  1233. var args = [arg1];
  1234. if (typeof arg2 !== 'undefined') {
  1235. args.push(arg2);
  1236. }
  1237. if (isFn(options.name)) {
  1238. methodName = options.name(arg1);
  1239. } else if (isStr(options.name)) {
  1240. methodName = options.name;
  1241. }
  1242. var returnValue = wx[methodName].apply(wx, args);
  1243. if (isSyncApi(methodName)) {
  1244. // 同步 api
  1245. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1246. }
  1247. return returnValue;
  1248. };
  1249. }
  1250. return method;
  1251. }
  1252. var todoApis = Object.create(null);
  1253. var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
  1254. function createTodoApi(name) {
  1255. return function todoApi(_ref) {
  1256. var fail = _ref.fail,
  1257. complete = _ref.complete;
  1258. var res = {
  1259. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  1260. };
  1261. isFn(fail) && fail(res);
  1262. isFn(complete) && complete(res);
  1263. };
  1264. }
  1265. TODOS.forEach(function (name) {
  1266. todoApis[name] = createTodoApi(name);
  1267. });
  1268. var providers = {
  1269. oauth: ['weixin'],
  1270. share: ['weixin'],
  1271. payment: ['wxpay'],
  1272. push: ['weixin']
  1273. };
  1274. function getProvider(_ref2) {
  1275. var service = _ref2.service,
  1276. success = _ref2.success,
  1277. fail = _ref2.fail,
  1278. complete = _ref2.complete;
  1279. var res = false;
  1280. if (providers[service]) {
  1281. res = {
  1282. errMsg: 'getProvider:ok',
  1283. service: service,
  1284. provider: providers[service]
  1285. };
  1286. isFn(success) && success(res);
  1287. } else {
  1288. res = {
  1289. errMsg: 'getProvider:fail service not found'
  1290. };
  1291. isFn(fail) && fail(res);
  1292. }
  1293. isFn(complete) && complete(res);
  1294. }
  1295. var extraApi = /*#__PURE__*/Object.freeze({
  1296. __proto__: null,
  1297. getProvider: getProvider
  1298. });
  1299. var getEmitter = function () {
  1300. var Emitter;
  1301. return function getUniEmitter() {
  1302. if (!Emitter) {
  1303. Emitter = new _vue.default();
  1304. }
  1305. return Emitter;
  1306. };
  1307. }();
  1308. function apply(ctx, method, args) {
  1309. return ctx[method].apply(ctx, args);
  1310. }
  1311. function $on() {
  1312. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  1313. }
  1314. function $off() {
  1315. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  1316. }
  1317. function $once() {
  1318. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  1319. }
  1320. function $emit() {
  1321. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  1322. }
  1323. var eventApi = /*#__PURE__*/Object.freeze({
  1324. __proto__: null,
  1325. $on: $on,
  1326. $off: $off,
  1327. $once: $once,
  1328. $emit: $emit
  1329. });
  1330. /**
  1331. * 框架内 try-catch
  1332. */
  1333. /**
  1334. * 开发者 try-catch
  1335. */
  1336. function tryCatch(fn) {
  1337. return function () {
  1338. try {
  1339. return fn.apply(fn, arguments);
  1340. } catch (e) {
  1341. // TODO
  1342. console.error(e);
  1343. }
  1344. };
  1345. }
  1346. function getApiCallbacks(params) {
  1347. var apiCallbacks = {};
  1348. for (var name in params) {
  1349. var param = params[name];
  1350. if (isFn(param)) {
  1351. apiCallbacks[name] = tryCatch(param);
  1352. delete params[name];
  1353. }
  1354. }
  1355. return apiCallbacks;
  1356. }
  1357. var cid;
  1358. var cidErrMsg;
  1359. var enabled;
  1360. function normalizePushMessage(message) {
  1361. try {
  1362. return JSON.parse(message);
  1363. } catch (e) {}
  1364. return message;
  1365. }
  1366. function invokePushCallback(args) {
  1367. if (args.type === 'enabled') {
  1368. enabled = true;
  1369. } else if (args.type === 'clientId') {
  1370. cid = args.cid;
  1371. cidErrMsg = args.errMsg;
  1372. invokeGetPushCidCallbacks(cid, args.errMsg);
  1373. } else if (args.type === 'pushMsg') {
  1374. var message = {
  1375. type: 'receive',
  1376. data: normalizePushMessage(args.message)
  1377. };
  1378. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  1379. var callback = onPushMessageCallbacks[i];
  1380. callback(message);
  1381. // 该消息已被阻止
  1382. if (message.stopped) {
  1383. break;
  1384. }
  1385. }
  1386. } else if (args.type === 'click') {
  1387. onPushMessageCallbacks.forEach(function (callback) {
  1388. callback({
  1389. type: 'click',
  1390. data: normalizePushMessage(args.message)
  1391. });
  1392. });
  1393. }
  1394. }
  1395. var getPushCidCallbacks = [];
  1396. function invokeGetPushCidCallbacks(cid, errMsg) {
  1397. getPushCidCallbacks.forEach(function (callback) {
  1398. callback(cid, errMsg);
  1399. });
  1400. getPushCidCallbacks.length = 0;
  1401. }
  1402. function getPushClientId(args) {
  1403. if (!isPlainObject(args)) {
  1404. args = {};
  1405. }
  1406. var _getApiCallbacks = getApiCallbacks(args),
  1407. success = _getApiCallbacks.success,
  1408. fail = _getApiCallbacks.fail,
  1409. complete = _getApiCallbacks.complete;
  1410. var hasSuccess = isFn(success);
  1411. var hasFail = isFn(fail);
  1412. var hasComplete = isFn(complete);
  1413. Promise.resolve().then(function () {
  1414. if (typeof enabled === 'undefined') {
  1415. enabled = false;
  1416. cid = '';
  1417. cidErrMsg = 'uniPush is not enabled';
  1418. }
  1419. getPushCidCallbacks.push(function (cid, errMsg) {
  1420. var res;
  1421. if (cid) {
  1422. res = {
  1423. errMsg: 'getPushClientId:ok',
  1424. cid: cid
  1425. };
  1426. hasSuccess && success(res);
  1427. } else {
  1428. res = {
  1429. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  1430. };
  1431. hasFail && fail(res);
  1432. }
  1433. hasComplete && complete(res);
  1434. });
  1435. if (typeof cid !== 'undefined') {
  1436. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1437. }
  1438. });
  1439. }
  1440. var onPushMessageCallbacks = [];
  1441. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1442. var onPushMessage = function onPushMessage(fn) {
  1443. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1444. onPushMessageCallbacks.push(fn);
  1445. }
  1446. };
  1447. var offPushMessage = function offPushMessage(fn) {
  1448. if (!fn) {
  1449. onPushMessageCallbacks.length = 0;
  1450. } else {
  1451. var index = onPushMessageCallbacks.indexOf(fn);
  1452. if (index > -1) {
  1453. onPushMessageCallbacks.splice(index, 1);
  1454. }
  1455. }
  1456. };
  1457. function __f__(type) {
  1458. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  1459. args[_key3 - 1] = arguments[_key3];
  1460. }
  1461. console[type].apply(console, args);
  1462. }
  1463. var baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo();
  1464. if (!baseInfo) {
  1465. baseInfo = wx.getSystemInfoSync();
  1466. }
  1467. var host = baseInfo ? baseInfo.host : null;
  1468. var shareVideoMessage = host && host.env === 'SAAASDK' ? wx.miniapp.shareVideoMessage : wx.shareVideoMessage;
  1469. var api = /*#__PURE__*/Object.freeze({
  1470. __proto__: null,
  1471. shareVideoMessage: shareVideoMessage,
  1472. getPushClientId: getPushClientId,
  1473. onPushMessage: onPushMessage,
  1474. offPushMessage: offPushMessage,
  1475. invokePushCallback: invokePushCallback,
  1476. __f__: __f__
  1477. });
  1478. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1479. function findVmByVueId(vm, vuePid) {
  1480. var $children = vm.$children;
  1481. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1482. for (var i = $children.length - 1; i >= 0; i--) {
  1483. var childVm = $children[i];
  1484. if (childVm.$scope._$vueId === vuePid) {
  1485. return childVm;
  1486. }
  1487. }
  1488. // 反向递归查找
  1489. var parentVm;
  1490. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1491. parentVm = findVmByVueId($children[_i], vuePid);
  1492. if (parentVm) {
  1493. return parentVm;
  1494. }
  1495. }
  1496. }
  1497. function initBehavior(options) {
  1498. return Behavior(options);
  1499. }
  1500. function isPage() {
  1501. return !!this.route;
  1502. }
  1503. function initRelation(detail) {
  1504. this.triggerEvent('__l', detail);
  1505. }
  1506. function selectAllComponents(mpInstance, selector, $refs) {
  1507. var components = mpInstance.selectAllComponents(selector) || [];
  1508. components.forEach(function (component) {
  1509. var ref = component.dataset.ref;
  1510. $refs[ref] = component.$vm || toSkip(component);
  1511. {
  1512. if (component.dataset.vueGeneric === 'scoped') {
  1513. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1514. selectAllComponents(scopedComponent, selector, $refs);
  1515. });
  1516. }
  1517. }
  1518. });
  1519. }
  1520. function syncRefs(refs, newRefs) {
  1521. var oldKeys = (0, _construct2.default)(Set, (0, _toConsumableArray2.default)(Object.keys(refs)));
  1522. var newKeys = Object.keys(newRefs);
  1523. newKeys.forEach(function (key) {
  1524. var oldValue = refs[key];
  1525. var newValue = newRefs[key];
  1526. if (Array.isArray(oldValue) && Array.isArray(newValue) && oldValue.length === newValue.length && newValue.every(function (value) {
  1527. return oldValue.includes(value);
  1528. })) {
  1529. return;
  1530. }
  1531. refs[key] = newValue;
  1532. oldKeys.delete(key);
  1533. });
  1534. oldKeys.forEach(function (key) {
  1535. delete refs[key];
  1536. });
  1537. return refs;
  1538. }
  1539. function initRefs(vm) {
  1540. var mpInstance = vm.$scope;
  1541. var refs = {};
  1542. Object.defineProperty(vm, '$refs', {
  1543. get: function get() {
  1544. var $refs = {};
  1545. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1546. // TODO 暂不考虑 for 中的 scoped
  1547. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for') || [];
  1548. forComponents.forEach(function (component) {
  1549. var ref = component.dataset.ref;
  1550. if (!$refs[ref]) {
  1551. $refs[ref] = [];
  1552. }
  1553. $refs[ref].push(component.$vm || toSkip(component));
  1554. });
  1555. return syncRefs(refs, $refs);
  1556. }
  1557. });
  1558. }
  1559. function handleLink(event) {
  1560. var _ref3 = event.detail || event.value,
  1561. vuePid = _ref3.vuePid,
  1562. vueOptions = _ref3.vueOptions; // detail 是微信,value 是百度(dipatch)
  1563. var parentVm;
  1564. if (vuePid) {
  1565. parentVm = findVmByVueId(this.$vm, vuePid);
  1566. }
  1567. if (!parentVm) {
  1568. parentVm = this.$vm;
  1569. }
  1570. vueOptions.parent = parentVm;
  1571. }
  1572. function markMPComponent(component) {
  1573. // 在 Vue 中标记为小程序组件
  1574. var IS_MP = '__v_isMPComponent';
  1575. Object.defineProperty(component, IS_MP, {
  1576. configurable: true,
  1577. enumerable: false,
  1578. value: true
  1579. });
  1580. return component;
  1581. }
  1582. function toSkip(obj) {
  1583. var OB = '__ob__';
  1584. var SKIP = '__v_skip';
  1585. if (isObject(obj) && Object.isExtensible(obj)) {
  1586. // 避免被 @vue/composition-api 观测
  1587. Object.defineProperty(obj, OB, {
  1588. configurable: true,
  1589. enumerable: false,
  1590. value: (0, _defineProperty2.default)({}, SKIP, true)
  1591. });
  1592. }
  1593. return obj;
  1594. }
  1595. var WORKLET_RE = /_(.*)_worklet_factory_/;
  1596. function initWorkletMethods(mpMethods, vueMethods) {
  1597. if (vueMethods) {
  1598. Object.keys(vueMethods).forEach(function (name) {
  1599. var matches = name.match(WORKLET_RE);
  1600. if (matches) {
  1601. var workletName = matches[1];
  1602. mpMethods[name] = vueMethods[name];
  1603. mpMethods[workletName] = vueMethods[workletName];
  1604. }
  1605. });
  1606. }
  1607. }
  1608. var MPPage = Page;
  1609. var MPComponent = Component;
  1610. var customizeRE = /:/g;
  1611. var customize = cached(function (str) {
  1612. return camelize(str.replace(customizeRE, '-'));
  1613. });
  1614. function initTriggerEvent(mpInstance) {
  1615. var oldTriggerEvent = mpInstance.triggerEvent;
  1616. var newTriggerEvent = function newTriggerEvent(event) {
  1617. for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
  1618. args[_key4 - 1] = arguments[_key4];
  1619. }
  1620. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  1621. if (this.$vm || this.dataset && this.dataset.comType) {
  1622. event = customize(event);
  1623. } else {
  1624. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  1625. var newEvent = customize(event);
  1626. if (newEvent !== event) {
  1627. oldTriggerEvent.apply(this, [newEvent].concat(args));
  1628. }
  1629. }
  1630. return oldTriggerEvent.apply(this, [event].concat(args));
  1631. };
  1632. try {
  1633. // 京东小程序 triggerEvent 为只读
  1634. mpInstance.triggerEvent = newTriggerEvent;
  1635. } catch (error) {
  1636. mpInstance._triggerEvent = newTriggerEvent;
  1637. }
  1638. }
  1639. function initHook(name, options, isComponent) {
  1640. var oldHook = options[name];
  1641. options[name] = function () {
  1642. markMPComponent(this);
  1643. initTriggerEvent(this);
  1644. if (oldHook) {
  1645. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  1646. args[_key5] = arguments[_key5];
  1647. }
  1648. return oldHook.apply(this, args);
  1649. }
  1650. };
  1651. }
  1652. if (!MPPage.__$wrappered) {
  1653. MPPage.__$wrappered = true;
  1654. Page = function Page() {
  1655. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1656. initHook('onLoad', options);
  1657. return MPPage(options);
  1658. };
  1659. Page.after = MPPage.after;
  1660. Component = function Component() {
  1661. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1662. initHook('created', options);
  1663. return MPComponent(options);
  1664. };
  1665. }
  1666. var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
  1667. function initMocks(vm, mocks) {
  1668. var mpInstance = vm.$mp[vm.mpType];
  1669. mocks.forEach(function (mock) {
  1670. if (hasOwn(mpInstance, mock)) {
  1671. vm[mock] = mpInstance[mock];
  1672. }
  1673. });
  1674. }
  1675. function hasHook(hook, vueOptions) {
  1676. if (!vueOptions) {
  1677. return true;
  1678. }
  1679. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1680. return true;
  1681. }
  1682. vueOptions = vueOptions.default || vueOptions;
  1683. if (isFn(vueOptions)) {
  1684. if (isFn(vueOptions.extendOptions[hook])) {
  1685. return true;
  1686. }
  1687. if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
  1688. return true;
  1689. }
  1690. return false;
  1691. }
  1692. if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
  1693. return true;
  1694. }
  1695. var mixins = vueOptions.mixins;
  1696. if (Array.isArray(mixins)) {
  1697. return !!mixins.find(function (mixin) {
  1698. return hasHook(hook, mixin);
  1699. });
  1700. }
  1701. }
  1702. function initHooks(mpOptions, hooks, vueOptions) {
  1703. hooks.forEach(function (hook) {
  1704. if (hasHook(hook, vueOptions)) {
  1705. mpOptions[hook] = function (args) {
  1706. return this.$vm && this.$vm.__call_hook(hook, args);
  1707. };
  1708. }
  1709. });
  1710. }
  1711. function initUnknownHooks(mpOptions, vueOptions) {
  1712. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1713. findHooks(vueOptions).forEach(function (hook) {
  1714. return initHook$1(mpOptions, hook, excludes);
  1715. });
  1716. }
  1717. function findHooks(vueOptions) {
  1718. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  1719. if (vueOptions) {
  1720. Object.keys(vueOptions).forEach(function (name) {
  1721. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  1722. hooks.push(name);
  1723. }
  1724. });
  1725. }
  1726. return hooks;
  1727. }
  1728. function initHook$1(mpOptions, hook, excludes) {
  1729. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  1730. mpOptions[hook] = function (args) {
  1731. return this.$vm && this.$vm.__call_hook(hook, args);
  1732. };
  1733. }
  1734. }
  1735. function initVueComponent(Vue, vueOptions) {
  1736. vueOptions = vueOptions.default || vueOptions;
  1737. var VueComponent;
  1738. if (isFn(vueOptions)) {
  1739. VueComponent = vueOptions;
  1740. } else {
  1741. VueComponent = Vue.extend(vueOptions);
  1742. }
  1743. vueOptions = VueComponent.options;
  1744. return [VueComponent, vueOptions];
  1745. }
  1746. function initSlots(vm, vueSlots) {
  1747. if (Array.isArray(vueSlots) && vueSlots.length) {
  1748. var $slots = Object.create(null);
  1749. vueSlots.forEach(function (slotName) {
  1750. $slots[slotName] = true;
  1751. });
  1752. vm.$scopedSlots = vm.$slots = $slots;
  1753. }
  1754. }
  1755. function initVueIds(vueIds, mpInstance) {
  1756. vueIds = (vueIds || '').split(',');
  1757. var len = vueIds.length;
  1758. if (len === 1) {
  1759. mpInstance._$vueId = vueIds[0];
  1760. } else if (len === 2) {
  1761. mpInstance._$vueId = vueIds[0];
  1762. mpInstance._$vuePid = vueIds[1];
  1763. }
  1764. }
  1765. function initData(vueOptions, context) {
  1766. var data = vueOptions.data || {};
  1767. var methods = vueOptions.methods || {};
  1768. if (typeof data === 'function') {
  1769. try {
  1770. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1771. } catch (e) {
  1772. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1773. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1774. }
  1775. }
  1776. } else {
  1777. try {
  1778. // 对 data 格式化
  1779. data = JSON.parse(JSON.stringify(data));
  1780. } catch (e) {}
  1781. }
  1782. if (!isPlainObject(data)) {
  1783. data = {};
  1784. }
  1785. Object.keys(methods).forEach(function (methodName) {
  1786. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1787. data[methodName] = methods[methodName];
  1788. }
  1789. });
  1790. return data;
  1791. }
  1792. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1793. function createObserver(name) {
  1794. return function observer(newVal, oldVal) {
  1795. if (this.$vm) {
  1796. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1797. }
  1798. };
  1799. }
  1800. function initBehaviors(vueOptions, initBehavior) {
  1801. var vueBehaviors = vueOptions.behaviors;
  1802. var vueExtends = vueOptions.extends;
  1803. var vueMixins = vueOptions.mixins;
  1804. var vueProps = vueOptions.props;
  1805. if (!vueProps) {
  1806. vueOptions.props = vueProps = [];
  1807. }
  1808. var behaviors = [];
  1809. if (Array.isArray(vueBehaviors)) {
  1810. vueBehaviors.forEach(function (behavior) {
  1811. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1812. if (behavior === 'uni://form-field') {
  1813. if (Array.isArray(vueProps)) {
  1814. vueProps.push('name');
  1815. vueProps.push('value');
  1816. } else {
  1817. vueProps.name = {
  1818. type: String,
  1819. default: ''
  1820. };
  1821. vueProps.value = {
  1822. type: [String, Number, Boolean, Array, Object, Date],
  1823. default: ''
  1824. };
  1825. }
  1826. }
  1827. });
  1828. }
  1829. if (isPlainObject(vueExtends) && vueExtends.props) {
  1830. behaviors.push(initBehavior({
  1831. properties: initProperties(vueExtends.props, true)
  1832. }));
  1833. }
  1834. if (Array.isArray(vueMixins)) {
  1835. vueMixins.forEach(function (vueMixin) {
  1836. if (isPlainObject(vueMixin) && vueMixin.props) {
  1837. behaviors.push(initBehavior({
  1838. properties: initProperties(vueMixin.props, true)
  1839. }));
  1840. }
  1841. });
  1842. }
  1843. return behaviors;
  1844. }
  1845. function parsePropType(key, type, defaultValue, file) {
  1846. // [String]=>String
  1847. if (Array.isArray(type) && type.length === 1) {
  1848. return type[0];
  1849. }
  1850. return type;
  1851. }
  1852. function initProperties(props) {
  1853. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1854. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  1855. var options = arguments.length > 3 ? arguments[3] : undefined;
  1856. var properties = {};
  1857. if (!isBehavior) {
  1858. properties.vueId = {
  1859. type: String,
  1860. value: ''
  1861. };
  1862. {
  1863. if (options.virtualHost) {
  1864. properties.virtualHostStyle = {
  1865. type: null,
  1866. value: ''
  1867. };
  1868. properties.virtualHostClass = {
  1869. type: null,
  1870. value: ''
  1871. };
  1872. }
  1873. }
  1874. // scopedSlotsCompiler auto
  1875. properties.scopedSlotsCompiler = {
  1876. type: String,
  1877. value: ''
  1878. };
  1879. properties.vueSlots = {
  1880. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1881. type: null,
  1882. value: [],
  1883. observer: function observer(newVal, oldVal) {
  1884. var $slots = Object.create(null);
  1885. newVal.forEach(function (slotName) {
  1886. $slots[slotName] = true;
  1887. });
  1888. this.setData({
  1889. $slots: $slots
  1890. });
  1891. }
  1892. };
  1893. }
  1894. if (Array.isArray(props)) {
  1895. // ['title']
  1896. props.forEach(function (key) {
  1897. properties[key] = {
  1898. type: null,
  1899. observer: createObserver(key)
  1900. };
  1901. });
  1902. } else if (isPlainObject(props)) {
  1903. // {title:{type:String,default:''},content:String}
  1904. Object.keys(props).forEach(function (key) {
  1905. var opts = props[key];
  1906. if (isPlainObject(opts)) {
  1907. // title:{type:String,default:''}
  1908. var value = opts.default;
  1909. if (isFn(value)) {
  1910. value = value();
  1911. }
  1912. opts.type = parsePropType(key, opts.type);
  1913. properties[key] = {
  1914. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1915. value: value,
  1916. observer: createObserver(key)
  1917. };
  1918. } else {
  1919. // content:String
  1920. var type = parsePropType(key, opts);
  1921. properties[key] = {
  1922. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1923. observer: createObserver(key)
  1924. };
  1925. }
  1926. });
  1927. }
  1928. return properties;
  1929. }
  1930. function wrapper$1(event) {
  1931. // TODO 又得兼容 mpvue 的 mp 对象
  1932. try {
  1933. event.mp = JSON.parse(JSON.stringify(event));
  1934. } catch (e) {}
  1935. event.stopPropagation = noop;
  1936. event.preventDefault = noop;
  1937. event.target = event.target || {};
  1938. if (!hasOwn(event, 'detail')) {
  1939. event.detail = {};
  1940. }
  1941. if (hasOwn(event, 'markerId')) {
  1942. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  1943. event.detail.markerId = event.markerId;
  1944. }
  1945. if (isPlainObject(event.detail)) {
  1946. event.target = Object.assign({}, event.target, event.detail);
  1947. }
  1948. return event;
  1949. }
  1950. function getExtraValue(vm, dataPathsArray) {
  1951. var context = vm;
  1952. dataPathsArray.forEach(function (dataPathArray) {
  1953. var dataPath = dataPathArray[0];
  1954. var value = dataPathArray[2];
  1955. if (dataPath || typeof value !== 'undefined') {
  1956. // ['','',index,'disable']
  1957. var propPath = dataPathArray[1];
  1958. var valuePath = dataPathArray[3];
  1959. var vFor;
  1960. if (Number.isInteger(dataPath)) {
  1961. vFor = dataPath;
  1962. } else if (!dataPath) {
  1963. vFor = context;
  1964. } else if (typeof dataPath === 'string' && dataPath) {
  1965. if (dataPath.indexOf('#s#') === 0) {
  1966. vFor = dataPath.substr(3);
  1967. } else {
  1968. vFor = vm.__get_value(dataPath, context);
  1969. }
  1970. }
  1971. if (Number.isInteger(vFor)) {
  1972. context = value;
  1973. } else if (!propPath) {
  1974. context = vFor[value];
  1975. } else {
  1976. if (Array.isArray(vFor)) {
  1977. context = vFor.find(function (vForItem) {
  1978. return vm.__get_value(propPath, vForItem) === value;
  1979. });
  1980. } else if (isPlainObject(vFor)) {
  1981. context = Object.keys(vFor).find(function (vForKey) {
  1982. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1983. });
  1984. } else {
  1985. console.error('v-for 暂不支持循环数据:', vFor);
  1986. }
  1987. }
  1988. if (valuePath) {
  1989. context = vm.__get_value(valuePath, context);
  1990. }
  1991. }
  1992. });
  1993. return context;
  1994. }
  1995. function processEventExtra(vm, extra, event, __args__) {
  1996. var extraObj = {};
  1997. if (Array.isArray(extra) && extra.length) {
  1998. /**
  1999. *[
  2000. * ['data.items', 'data.id', item.data.id],
  2001. * ['metas', 'id', meta.id]
  2002. *],
  2003. *[
  2004. * ['data.items', 'data.id', item.data.id],
  2005. * ['metas', 'id', meta.id]
  2006. *],
  2007. *'test'
  2008. */
  2009. extra.forEach(function (dataPath, index) {
  2010. if (typeof dataPath === 'string') {
  2011. if (!dataPath) {
  2012. // model,prop.sync
  2013. extraObj['$' + index] = vm;
  2014. } else {
  2015. if (dataPath === '$event') {
  2016. // $event
  2017. extraObj['$' + index] = event;
  2018. } else if (dataPath === 'arguments') {
  2019. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  2020. } else if (dataPath.indexOf('$event.') === 0) {
  2021. // $event.target.value
  2022. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  2023. } else {
  2024. extraObj['$' + index] = vm.__get_value(dataPath);
  2025. }
  2026. }
  2027. } else {
  2028. extraObj['$' + index] = getExtraValue(vm, dataPath);
  2029. }
  2030. });
  2031. }
  2032. return extraObj;
  2033. }
  2034. function getObjByArray(arr) {
  2035. var obj = {};
  2036. for (var i = 1; i < arr.length; i++) {
  2037. var element = arr[i];
  2038. obj[element[0]] = element[1];
  2039. }
  2040. return obj;
  2041. }
  2042. function processEventArgs(vm, event) {
  2043. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  2044. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  2045. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  2046. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  2047. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  2048. // fixed 用户直接触发 mpInstance.triggerEvent
  2049. var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
  2050. if (isCustom) {
  2051. // 自定义事件
  2052. isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
  2053. if (!args.length) {
  2054. // 无参数,直接传入 event 或 detail 数组
  2055. if (isCustomMPEvent) {
  2056. return [event];
  2057. }
  2058. return __args__;
  2059. }
  2060. }
  2061. var extraObj = processEventExtra(vm, extra, event, __args__);
  2062. var ret = [];
  2063. args.forEach(function (arg) {
  2064. if (arg === '$event') {
  2065. if (methodName === '__set_model' && !isCustom) {
  2066. // input v-model value
  2067. ret.push(event.target.value);
  2068. } else {
  2069. if (isCustom && !isCustomMPEvent) {
  2070. ret.push(__args__[0]);
  2071. } else {
  2072. // wxcomponent 组件或内置组件
  2073. ret.push(event);
  2074. }
  2075. }
  2076. } else {
  2077. if (Array.isArray(arg) && arg[0] === 'o') {
  2078. ret.push(getObjByArray(arg));
  2079. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  2080. ret.push(extraObj[arg]);
  2081. } else {
  2082. ret.push(arg);
  2083. }
  2084. }
  2085. });
  2086. return ret;
  2087. }
  2088. var ONCE = '~';
  2089. var CUSTOM = '^';
  2090. function isMatchEventType(eventType, optType) {
  2091. return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
  2092. }
  2093. function getContextVm(vm) {
  2094. var $parent = vm.$parent;
  2095. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  2096. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  2097. $parent = $parent.$parent;
  2098. }
  2099. return $parent && $parent.$parent;
  2100. }
  2101. function handleEvent(event) {
  2102. var _this2 = this;
  2103. event = wrapper$1(event);
  2104. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  2105. var dataset = (event.currentTarget || event.target).dataset;
  2106. if (!dataset) {
  2107. return console.warn('事件信息不存在');
  2108. }
  2109. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  2110. if (!eventOpts) {
  2111. return console.warn('事件信息不存在');
  2112. }
  2113. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  2114. var eventType = event.type;
  2115. var ret = [];
  2116. eventOpts.forEach(function (eventOpt) {
  2117. var type = eventOpt[0];
  2118. var eventsArray = eventOpt[1];
  2119. var isCustom = type.charAt(0) === CUSTOM;
  2120. type = isCustom ? type.slice(1) : type;
  2121. var isOnce = type.charAt(0) === ONCE;
  2122. type = isOnce ? type.slice(1) : type;
  2123. if (eventsArray && isMatchEventType(eventType, type)) {
  2124. eventsArray.forEach(function (eventArray) {
  2125. var methodName = eventArray[0];
  2126. if (methodName) {
  2127. var handlerCtx = _this2.$vm;
  2128. if (handlerCtx.$options.generic) {
  2129. // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  2130. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  2131. }
  2132. if (methodName === '$emit') {
  2133. handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
  2134. return;
  2135. }
  2136. var handler = handlerCtx[methodName];
  2137. if (!isFn(handler)) {
  2138. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  2139. var path = _this2.route || _this2.is;
  2140. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  2141. }
  2142. if (isOnce) {
  2143. if (handler.once) {
  2144. return;
  2145. }
  2146. handler.once = true;
  2147. }
  2148. var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
  2149. params = Array.isArray(params) ? params : [];
  2150. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  2151. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  2152. // eslint-disable-next-line no-sparse-arrays
  2153. params = params.concat([,,,,,,,,,, event]);
  2154. }
  2155. ret.push(handler.apply(handlerCtx, params));
  2156. }
  2157. });
  2158. }
  2159. });
  2160. if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
  2161. return ret[0];
  2162. }
  2163. }
  2164. var eventChannels = {};
  2165. function getEventChannel(id) {
  2166. var eventChannel = eventChannels[id];
  2167. delete eventChannels[id];
  2168. return eventChannel;
  2169. }
  2170. var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
  2171. function initEventChannel() {
  2172. _vue.default.prototype.getOpenerEventChannel = function () {
  2173. // 微信小程序使用自身getOpenerEventChannel
  2174. {
  2175. return this.$scope.getOpenerEventChannel();
  2176. }
  2177. };
  2178. var callHook = _vue.default.prototype.__call_hook;
  2179. _vue.default.prototype.__call_hook = function (hook, args) {
  2180. if (hook === 'onLoad' && args && args.__id__) {
  2181. this.__eventChannel__ = getEventChannel(args.__id__);
  2182. delete args.__id__;
  2183. }
  2184. return callHook.call(this, hook, args);
  2185. };
  2186. }
  2187. function initScopedSlotsParams() {
  2188. var center = {};
  2189. var parents = {};
  2190. function currentId(fn) {
  2191. var vueIds = this.$options.propsData.vueId;
  2192. if (vueIds) {
  2193. var vueId = vueIds.split(',')[0];
  2194. fn(vueId);
  2195. }
  2196. }
  2197. _vue.default.prototype.$hasSSP = function (vueId) {
  2198. var slot = center[vueId];
  2199. if (!slot) {
  2200. parents[vueId] = this;
  2201. this.$on('hook:destroyed', function () {
  2202. delete parents[vueId];
  2203. });
  2204. }
  2205. return slot;
  2206. };
  2207. _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
  2208. var slot = center[vueId];
  2209. if (slot) {
  2210. var params = slot[name] || [];
  2211. if (needAll) {
  2212. return params;
  2213. }
  2214. return params[0];
  2215. }
  2216. };
  2217. _vue.default.prototype.$setSSP = function (name, value) {
  2218. var index = 0;
  2219. currentId.call(this, function (vueId) {
  2220. var slot = center[vueId];
  2221. var params = slot[name] = slot[name] || [];
  2222. params.push(value);
  2223. index = params.length - 1;
  2224. });
  2225. return index;
  2226. };
  2227. _vue.default.prototype.$initSSP = function () {
  2228. currentId.call(this, function (vueId) {
  2229. center[vueId] = {};
  2230. });
  2231. };
  2232. _vue.default.prototype.$callSSP = function () {
  2233. currentId.call(this, function (vueId) {
  2234. if (parents[vueId]) {
  2235. parents[vueId].$forceUpdate();
  2236. }
  2237. });
  2238. };
  2239. _vue.default.mixin({
  2240. destroyed: function destroyed() {
  2241. var propsData = this.$options.propsData;
  2242. var vueId = propsData && propsData.vueId;
  2243. if (vueId) {
  2244. delete center[vueId];
  2245. delete parents[vueId];
  2246. }
  2247. }
  2248. });
  2249. }
  2250. function parseBaseApp(vm, _ref4) {
  2251. var mocks = _ref4.mocks,
  2252. initRefs = _ref4.initRefs;
  2253. initEventChannel();
  2254. {
  2255. initScopedSlotsParams();
  2256. }
  2257. if (vm.$options.store) {
  2258. _vue.default.prototype.$store = vm.$options.store;
  2259. }
  2260. uniIdMixin(_vue.default);
  2261. _vue.default.prototype.mpHost = "mp-weixin";
  2262. _vue.default.mixin({
  2263. beforeCreate: function beforeCreate() {
  2264. if (!this.$options.mpType) {
  2265. return;
  2266. }
  2267. this.mpType = this.$options.mpType;
  2268. this.$mp = (0, _defineProperty2.default)({
  2269. data: {}
  2270. }, this.mpType, this.$options.mpInstance);
  2271. this.$scope = this.$options.mpInstance;
  2272. delete this.$options.mpType;
  2273. delete this.$options.mpInstance;
  2274. if (this.mpType === 'page' && typeof getApp === 'function') {
  2275. // hack vue-i18n
  2276. var app = getApp();
  2277. if (app.$vm && app.$vm.$i18n) {
  2278. this._i18n = app.$vm.$i18n;
  2279. }
  2280. }
  2281. if (this.mpType !== 'app') {
  2282. initRefs(this);
  2283. initMocks(this, mocks);
  2284. }
  2285. }
  2286. });
  2287. var appOptions = {
  2288. onLaunch: function onLaunch(args) {
  2289. if (this.$vm) {
  2290. // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  2291. return;
  2292. }
  2293. {
  2294. if (wx.canIUse && !wx.canIUse('nextTick')) {
  2295. // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  2296. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  2297. }
  2298. }
  2299. this.$vm = vm;
  2300. this.$vm.$mp = {
  2301. app: this
  2302. };
  2303. this.$vm.$scope = this;
  2304. // vm 上也挂载 globalData
  2305. this.$vm.globalData = this.globalData;
  2306. this.$vm._isMounted = true;
  2307. this.$vm.__call_hook('mounted', args);
  2308. this.$vm.__call_hook('onLaunch', args);
  2309. }
  2310. };
  2311. // 兼容旧版本 globalData
  2312. appOptions.globalData = vm.$options.globalData || {};
  2313. // 将 methods 中的方法挂在 getApp() 中
  2314. var methods = vm.$options.methods;
  2315. if (methods) {
  2316. Object.keys(methods).forEach(function (name) {
  2317. appOptions[name] = methods[name];
  2318. });
  2319. }
  2320. initAppLocale(_vue.default, vm, getLocaleLanguage$1());
  2321. initHooks(appOptions, hooks);
  2322. initUnknownHooks(appOptions, vm.$options);
  2323. return appOptions;
  2324. }
  2325. function getLocaleLanguage$1() {
  2326. var localeLanguage = '';
  2327. {
  2328. var appBaseInfo = wx.getAppBaseInfo();
  2329. var language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
  2330. localeLanguage = normalizeLocale(language) || LOCALE_EN;
  2331. }
  2332. return localeLanguage;
  2333. }
  2334. function parseApp(vm) {
  2335. return parseBaseApp(vm, {
  2336. mocks: mocks,
  2337. initRefs: initRefs
  2338. });
  2339. }
  2340. function createApp(vm) {
  2341. App(parseApp(vm));
  2342. return vm;
  2343. }
  2344. var encodeReserveRE = /[!'()*]/g;
  2345. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  2346. return '%' + c.charCodeAt(0).toString(16);
  2347. };
  2348. var commaRE = /%2C/g;
  2349. // fixed encodeURIComponent which is more conformant to RFC3986:
  2350. // - escapes [!'()*]
  2351. // - preserve commas
  2352. var encode = function encode(str) {
  2353. return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
  2354. };
  2355. function stringifyQuery(obj) {
  2356. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  2357. var res = obj ? Object.keys(obj).map(function (key) {
  2358. var val = obj[key];
  2359. if (val === undefined) {
  2360. return '';
  2361. }
  2362. if (val === null) {
  2363. return encodeStr(key);
  2364. }
  2365. if (Array.isArray(val)) {
  2366. var result = [];
  2367. val.forEach(function (val2) {
  2368. if (val2 === undefined) {
  2369. return;
  2370. }
  2371. if (val2 === null) {
  2372. result.push(encodeStr(key));
  2373. } else {
  2374. result.push(encodeStr(key) + '=' + encodeStr(val2));
  2375. }
  2376. });
  2377. return result.join('&');
  2378. }
  2379. return encodeStr(key) + '=' + encodeStr(val);
  2380. }).filter(function (x) {
  2381. return x.length > 0;
  2382. }).join('&') : null;
  2383. return res ? "?".concat(res) : '';
  2384. }
  2385. function parseBaseComponent(vueComponentOptions) {
  2386. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  2387. isPage = _ref5.isPage,
  2388. initRelation = _ref5.initRelation;
  2389. var needVueOptions = arguments.length > 2 ? arguments[2] : undefined;
  2390. var _initVueComponent = initVueComponent(_vue.default, vueComponentOptions),
  2391. _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
  2392. VueComponent = _initVueComponent2[0],
  2393. vueOptions = _initVueComponent2[1];
  2394. var options = _objectSpread({
  2395. multipleSlots: true,
  2396. // styleIsolation: 'apply-shared',
  2397. addGlobalClass: true
  2398. }, vueOptions.options || {});
  2399. {
  2400. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  2401. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  2402. Object.assign(options, vueOptions['mp-weixin'].options);
  2403. }
  2404. }
  2405. var componentOptions = {
  2406. options: options,
  2407. data: initData(vueOptions, _vue.default.prototype),
  2408. behaviors: initBehaviors(vueOptions, initBehavior),
  2409. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  2410. lifetimes: {
  2411. attached: function attached() {
  2412. var properties = this.properties;
  2413. var options = {
  2414. mpType: isPage.call(this) ? 'page' : 'component',
  2415. mpInstance: this,
  2416. propsData: properties
  2417. };
  2418. initVueIds(properties.vueId, this);
  2419. // 处理父子关系
  2420. initRelation.call(this, {
  2421. vuePid: this._$vuePid,
  2422. vueOptions: options
  2423. });
  2424. // 初始化 vue 实例
  2425. this.$vm = new VueComponent(options);
  2426. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  2427. initSlots(this.$vm, properties.vueSlots);
  2428. // 触发首次 setData
  2429. this.$vm.$mount();
  2430. },
  2431. ready: function ready() {
  2432. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  2433. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  2434. if (this.$vm) {
  2435. this.$vm._isMounted = true;
  2436. this.$vm.__call_hook('mounted');
  2437. this.$vm.__call_hook('onReady');
  2438. }
  2439. },
  2440. detached: function detached() {
  2441. this.$vm && this.$vm.$destroy();
  2442. }
  2443. },
  2444. pageLifetimes: {
  2445. show: function show(args) {
  2446. this.$vm && this.$vm.__call_hook('onPageShow', args);
  2447. },
  2448. hide: function hide() {
  2449. this.$vm && this.$vm.__call_hook('onPageHide');
  2450. },
  2451. resize: function resize(size) {
  2452. this.$vm && this.$vm.__call_hook('onPageResize', size);
  2453. }
  2454. },
  2455. methods: {
  2456. __l: handleLink,
  2457. __e: handleEvent
  2458. }
  2459. };
  2460. // externalClasses
  2461. if (vueOptions.externalClasses) {
  2462. componentOptions.externalClasses = vueOptions.externalClasses;
  2463. }
  2464. if (Array.isArray(vueOptions.wxsCallMethods)) {
  2465. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  2466. componentOptions.methods[callMethod] = function (args) {
  2467. return this.$vm[callMethod](args);
  2468. };
  2469. });
  2470. }
  2471. if (needVueOptions) {
  2472. return [componentOptions, vueOptions, VueComponent];
  2473. }
  2474. if (isPage) {
  2475. return componentOptions;
  2476. }
  2477. return [componentOptions, VueComponent];
  2478. }
  2479. function parseComponent(vueComponentOptions, needVueOptions) {
  2480. return parseBaseComponent(vueComponentOptions, {
  2481. isPage: isPage,
  2482. initRelation: initRelation
  2483. }, needVueOptions);
  2484. }
  2485. var hooks$1 = ['onShow', 'onHide', 'onUnload'];
  2486. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  2487. function parseBasePage(vuePageOptions) {
  2488. var _parseComponent = parseComponent(vuePageOptions, true),
  2489. _parseComponent2 = (0, _slicedToArray2.default)(_parseComponent, 2),
  2490. pageOptions = _parseComponent2[0],
  2491. vueOptions = _parseComponent2[1];
  2492. initHooks(pageOptions.methods, hooks$1, vueOptions);
  2493. pageOptions.methods.onLoad = function (query) {
  2494. this.options = query;
  2495. var copyQuery = Object.assign({}, query);
  2496. delete copyQuery.__id__;
  2497. this.$page = {
  2498. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
  2499. };
  2500. this.$vm.$mp.query = query; // 兼容 mpvue
  2501. this.$vm.__call_hook('onLoad', query);
  2502. };
  2503. {
  2504. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  2505. }
  2506. {
  2507. initWorkletMethods(pageOptions.methods, vueOptions.methods);
  2508. }
  2509. return pageOptions;
  2510. }
  2511. function parsePage(vuePageOptions) {
  2512. return parseBasePage(vuePageOptions);
  2513. }
  2514. function createPage(vuePageOptions) {
  2515. {
  2516. return Component(parsePage(vuePageOptions));
  2517. }
  2518. }
  2519. function createComponent(vueOptions) {
  2520. {
  2521. return Component(parseComponent(vueOptions));
  2522. }
  2523. }
  2524. function createSubpackageApp(vm) {
  2525. var appOptions = parseApp(vm);
  2526. var app = getApp({
  2527. allowDefault: true
  2528. });
  2529. vm.$scope = app;
  2530. var globalData = app.globalData;
  2531. if (globalData) {
  2532. Object.keys(appOptions.globalData).forEach(function (name) {
  2533. if (!hasOwn(globalData, name)) {
  2534. globalData[name] = appOptions.globalData[name];
  2535. }
  2536. });
  2537. }
  2538. Object.keys(appOptions).forEach(function (name) {
  2539. if (!hasOwn(app, name)) {
  2540. app[name] = appOptions[name];
  2541. }
  2542. });
  2543. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2544. wx.onAppShow(function () {
  2545. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  2546. args[_key6] = arguments[_key6];
  2547. }
  2548. vm.__call_hook('onShow', args);
  2549. });
  2550. }
  2551. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2552. wx.onAppHide(function () {
  2553. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  2554. args[_key7] = arguments[_key7];
  2555. }
  2556. vm.__call_hook('onHide', args);
  2557. });
  2558. }
  2559. if (isFn(appOptions.onLaunch)) {
  2560. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2561. vm.__call_hook('onLaunch', args);
  2562. }
  2563. return vm;
  2564. }
  2565. function createPlugin(vm) {
  2566. var appOptions = parseApp(vm);
  2567. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2568. wx.onAppShow(function () {
  2569. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  2570. args[_key8] = arguments[_key8];
  2571. }
  2572. vm.__call_hook('onShow', args);
  2573. });
  2574. }
  2575. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2576. wx.onAppHide(function () {
  2577. for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
  2578. args[_key9] = arguments[_key9];
  2579. }
  2580. vm.__call_hook('onHide', args);
  2581. });
  2582. }
  2583. if (isFn(appOptions.onLaunch)) {
  2584. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2585. vm.__call_hook('onLaunch', args);
  2586. }
  2587. return vm;
  2588. }
  2589. todos.forEach(function (todoApi) {
  2590. protocols[todoApi] = false;
  2591. });
  2592. canIUses.forEach(function (canIUseApi) {
  2593. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
  2594. if (!wx.canIUse(apiName)) {
  2595. protocols[canIUseApi] = false;
  2596. }
  2597. });
  2598. var uni = {};
  2599. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2600. uni = new Proxy({}, {
  2601. get: function get(target, name) {
  2602. if (hasOwn(target, name)) {
  2603. return target[name];
  2604. }
  2605. if (baseApi[name]) {
  2606. return baseApi[name];
  2607. }
  2608. if (api[name]) {
  2609. return promisify(name, api[name]);
  2610. }
  2611. {
  2612. if (extraApi[name]) {
  2613. return promisify(name, extraApi[name]);
  2614. }
  2615. if (todoApis[name]) {
  2616. return promisify(name, todoApis[name]);
  2617. }
  2618. }
  2619. if (eventApi[name]) {
  2620. return eventApi[name];
  2621. }
  2622. return promisify(name, wrapper(name, wx[name]));
  2623. },
  2624. set: function set(target, name, value) {
  2625. target[name] = value;
  2626. return true;
  2627. }
  2628. });
  2629. } else {
  2630. Object.keys(baseApi).forEach(function (name) {
  2631. uni[name] = baseApi[name];
  2632. });
  2633. {
  2634. Object.keys(todoApis).forEach(function (name) {
  2635. uni[name] = promisify(name, todoApis[name]);
  2636. });
  2637. Object.keys(extraApi).forEach(function (name) {
  2638. uni[name] = promisify(name, extraApi[name]);
  2639. });
  2640. }
  2641. Object.keys(eventApi).forEach(function (name) {
  2642. uni[name] = eventApi[name];
  2643. });
  2644. Object.keys(api).forEach(function (name) {
  2645. uni[name] = promisify(name, api[name]);
  2646. });
  2647. Object.keys(wx).forEach(function (name) {
  2648. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2649. uni[name] = promisify(name, wrapper(name, wx[name]));
  2650. }
  2651. });
  2652. }
  2653. wx.createApp = createApp;
  2654. wx.createPage = createPage;
  2655. wx.createComponent = createComponent;
  2656. wx.createSubpackageApp = createSubpackageApp;
  2657. wx.createPlugin = createPlugin;
  2658. var uni$1 = uni;
  2659. var _default = uni$1;
  2660. exports.default = _default;
  2661. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  2662. /***/ }),
  2663. /***/ 20:
  2664. /*!****************************************************************!*\
  2665. !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
  2666. \****************************************************************/
  2667. /*! no static exports found */
  2668. /***/ (function(module, exports) {
  2669. function _iterableToArray(iter) {
  2670. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  2671. }
  2672. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2673. /***/ }),
  2674. /***/ 21:
  2675. /*!******************************************************************!*\
  2676. !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
  2677. \******************************************************************/
  2678. /*! no static exports found */
  2679. /***/ (function(module, exports) {
  2680. function _nonIterableSpread() {
  2681. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2682. }
  2683. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2684. /***/ }),
  2685. /***/ 22:
  2686. /*!*************************************************************!*\
  2687. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  2688. \*************************************************************/
  2689. /*! no static exports found */
  2690. /***/ (function(module, exports, __webpack_require__) {
  2691. "use strict";
  2692. /* WEBPACK VAR INJECTION */(function(uni, global) {
  2693. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  2694. Object.defineProperty(exports, "__esModule", {
  2695. value: true
  2696. });
  2697. exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
  2698. exports.compileI18nJsonStr = compileI18nJsonStr;
  2699. exports.hasI18nJson = hasI18nJson;
  2700. exports.initVueI18n = initVueI18n;
  2701. exports.isI18nStr = isI18nStr;
  2702. exports.isString = void 0;
  2703. exports.normalizeLocale = normalizeLocale;
  2704. exports.parseI18nJson = parseI18nJson;
  2705. exports.resolveLocale = resolveLocale;
  2706. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  2707. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  2708. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  2709. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  2710. var isObject = function isObject(val) {
  2711. return val !== null && (0, _typeof2.default)(val) === 'object';
  2712. };
  2713. var defaultDelimiters = ['{', '}'];
  2714. var BaseFormatter = /*#__PURE__*/function () {
  2715. function BaseFormatter() {
  2716. (0, _classCallCheck2.default)(this, BaseFormatter);
  2717. this._caches = Object.create(null);
  2718. }
  2719. (0, _createClass2.default)(BaseFormatter, [{
  2720. key: "interpolate",
  2721. value: function interpolate(message, values) {
  2722. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  2723. if (!values) {
  2724. return [message];
  2725. }
  2726. var tokens = this._caches[message];
  2727. if (!tokens) {
  2728. tokens = parse(message, delimiters);
  2729. this._caches[message] = tokens;
  2730. }
  2731. return compile(tokens, values);
  2732. }
  2733. }]);
  2734. return BaseFormatter;
  2735. }();
  2736. exports.Formatter = BaseFormatter;
  2737. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  2738. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  2739. function parse(format, _ref) {
  2740. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  2741. startDelimiter = _ref2[0],
  2742. endDelimiter = _ref2[1];
  2743. var tokens = [];
  2744. var position = 0;
  2745. var text = '';
  2746. while (position < format.length) {
  2747. var char = format[position++];
  2748. if (char === startDelimiter) {
  2749. if (text) {
  2750. tokens.push({
  2751. type: 'text',
  2752. value: text
  2753. });
  2754. }
  2755. text = '';
  2756. var sub = '';
  2757. char = format[position++];
  2758. while (char !== undefined && char !== endDelimiter) {
  2759. sub += char;
  2760. char = format[position++];
  2761. }
  2762. var isClosed = char === endDelimiter;
  2763. var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
  2764. tokens.push({
  2765. value: sub,
  2766. type: type
  2767. });
  2768. }
  2769. // else if (char === '%') {
  2770. // // when found rails i18n syntax, skip text capture
  2771. // if (format[position] !== '{') {
  2772. // text += char
  2773. // }
  2774. // }
  2775. else {
  2776. text += char;
  2777. }
  2778. }
  2779. text && tokens.push({
  2780. type: 'text',
  2781. value: text
  2782. });
  2783. return tokens;
  2784. }
  2785. function compile(tokens, values) {
  2786. var compiled = [];
  2787. var index = 0;
  2788. var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
  2789. if (mode === 'unknown') {
  2790. return compiled;
  2791. }
  2792. while (index < tokens.length) {
  2793. var token = tokens[index];
  2794. switch (token.type) {
  2795. case 'text':
  2796. compiled.push(token.value);
  2797. break;
  2798. case 'list':
  2799. compiled.push(values[parseInt(token.value, 10)]);
  2800. break;
  2801. case 'named':
  2802. if (mode === 'named') {
  2803. compiled.push(values[token.value]);
  2804. } else {
  2805. if (true) {
  2806. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  2807. }
  2808. }
  2809. break;
  2810. case 'unknown':
  2811. if (true) {
  2812. console.warn("Detect 'unknown' type of token!");
  2813. }
  2814. break;
  2815. }
  2816. index++;
  2817. }
  2818. return compiled;
  2819. }
  2820. var LOCALE_ZH_HANS = 'zh-Hans';
  2821. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  2822. var LOCALE_ZH_HANT = 'zh-Hant';
  2823. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  2824. var LOCALE_EN = 'en';
  2825. exports.LOCALE_EN = LOCALE_EN;
  2826. var LOCALE_FR = 'fr';
  2827. exports.LOCALE_FR = LOCALE_FR;
  2828. var LOCALE_ES = 'es';
  2829. exports.LOCALE_ES = LOCALE_ES;
  2830. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2831. var hasOwn = function hasOwn(val, key) {
  2832. return hasOwnProperty.call(val, key);
  2833. };
  2834. var defaultFormatter = new BaseFormatter();
  2835. function include(str, parts) {
  2836. return !!parts.find(function (part) {
  2837. return str.indexOf(part) !== -1;
  2838. });
  2839. }
  2840. function startsWith(str, parts) {
  2841. return parts.find(function (part) {
  2842. return str.indexOf(part) === 0;
  2843. });
  2844. }
  2845. function normalizeLocale(locale, messages) {
  2846. if (!locale) {
  2847. return;
  2848. }
  2849. locale = locale.trim().replace(/_/g, '-');
  2850. if (messages && messages[locale]) {
  2851. return locale;
  2852. }
  2853. locale = locale.toLowerCase();
  2854. if (locale === 'chinese') {
  2855. // 支付宝
  2856. return LOCALE_ZH_HANS;
  2857. }
  2858. if (locale.indexOf('zh') === 0) {
  2859. if (locale.indexOf('-hans') > -1) {
  2860. return LOCALE_ZH_HANS;
  2861. }
  2862. if (locale.indexOf('-hant') > -1) {
  2863. return LOCALE_ZH_HANT;
  2864. }
  2865. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  2866. return LOCALE_ZH_HANT;
  2867. }
  2868. return LOCALE_ZH_HANS;
  2869. }
  2870. var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  2871. if (messages && Object.keys(messages).length > 0) {
  2872. locales = Object.keys(messages);
  2873. }
  2874. var lang = startsWith(locale, locales);
  2875. if (lang) {
  2876. return lang;
  2877. }
  2878. }
  2879. var I18n = /*#__PURE__*/function () {
  2880. function I18n(_ref3) {
  2881. var locale = _ref3.locale,
  2882. fallbackLocale = _ref3.fallbackLocale,
  2883. messages = _ref3.messages,
  2884. watcher = _ref3.watcher,
  2885. formater = _ref3.formater;
  2886. (0, _classCallCheck2.default)(this, I18n);
  2887. this.locale = LOCALE_EN;
  2888. this.fallbackLocale = LOCALE_EN;
  2889. this.message = {};
  2890. this.messages = {};
  2891. this.watchers = [];
  2892. if (fallbackLocale) {
  2893. this.fallbackLocale = fallbackLocale;
  2894. }
  2895. this.formater = formater || defaultFormatter;
  2896. this.messages = messages || {};
  2897. this.setLocale(locale || LOCALE_EN);
  2898. if (watcher) {
  2899. this.watchLocale(watcher);
  2900. }
  2901. }
  2902. (0, _createClass2.default)(I18n, [{
  2903. key: "setLocale",
  2904. value: function setLocale(locale) {
  2905. var _this = this;
  2906. var oldLocale = this.locale;
  2907. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  2908. if (!this.messages[this.locale]) {
  2909. // 可能初始化时不存在
  2910. this.messages[this.locale] = {};
  2911. }
  2912. this.message = this.messages[this.locale];
  2913. // 仅发生变化时,通知
  2914. if (oldLocale !== this.locale) {
  2915. this.watchers.forEach(function (watcher) {
  2916. watcher(_this.locale, oldLocale);
  2917. });
  2918. }
  2919. }
  2920. }, {
  2921. key: "getLocale",
  2922. value: function getLocale() {
  2923. return this.locale;
  2924. }
  2925. }, {
  2926. key: "watchLocale",
  2927. value: function watchLocale(fn) {
  2928. var _this2 = this;
  2929. var index = this.watchers.push(fn) - 1;
  2930. return function () {
  2931. _this2.watchers.splice(index, 1);
  2932. };
  2933. }
  2934. }, {
  2935. key: "add",
  2936. value: function add(locale, message) {
  2937. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  2938. var curMessages = this.messages[locale];
  2939. if (curMessages) {
  2940. if (override) {
  2941. Object.assign(curMessages, message);
  2942. } else {
  2943. Object.keys(message).forEach(function (key) {
  2944. if (!hasOwn(curMessages, key)) {
  2945. curMessages[key] = message[key];
  2946. }
  2947. });
  2948. }
  2949. } else {
  2950. this.messages[locale] = message;
  2951. }
  2952. }
  2953. }, {
  2954. key: "f",
  2955. value: function f(message, values, delimiters) {
  2956. return this.formater.interpolate(message, values, delimiters).join('');
  2957. }
  2958. }, {
  2959. key: "t",
  2960. value: function t(key, locale, values) {
  2961. var message = this.message;
  2962. if (typeof locale === 'string') {
  2963. locale = normalizeLocale(locale, this.messages);
  2964. locale && (message = this.messages[locale]);
  2965. } else {
  2966. values = locale;
  2967. }
  2968. if (!hasOwn(message, key)) {
  2969. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  2970. return key;
  2971. }
  2972. return this.formater.interpolate(message[key], values).join('');
  2973. }
  2974. }]);
  2975. return I18n;
  2976. }();
  2977. exports.I18n = I18n;
  2978. function watchAppLocale(appVm, i18n) {
  2979. // 需要保证 watch 的触发在组件渲染之前
  2980. if (appVm.$watchLocale) {
  2981. // vue2
  2982. appVm.$watchLocale(function (newLocale) {
  2983. i18n.setLocale(newLocale);
  2984. });
  2985. } else {
  2986. appVm.$watch(function () {
  2987. return appVm.$locale;
  2988. }, function (newLocale) {
  2989. i18n.setLocale(newLocale);
  2990. });
  2991. }
  2992. }
  2993. function getDefaultLocale() {
  2994. if (typeof uni !== 'undefined' && uni.getLocale) {
  2995. return uni.getLocale();
  2996. }
  2997. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  2998. if (typeof global !== 'undefined' && global.getLocale) {
  2999. return global.getLocale();
  3000. }
  3001. return LOCALE_EN;
  3002. }
  3003. function initVueI18n(locale) {
  3004. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3005. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  3006. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  3007. // 兼容旧版本入参
  3008. if (typeof locale !== 'string') {
  3009. var _ref4 = [messages, locale];
  3010. locale = _ref4[0];
  3011. messages = _ref4[1];
  3012. }
  3013. if (typeof locale !== 'string') {
  3014. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  3015. locale = getDefaultLocale();
  3016. }
  3017. if (typeof fallbackLocale !== 'string') {
  3018. fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
  3019. }
  3020. var i18n = new I18n({
  3021. locale: locale,
  3022. fallbackLocale: fallbackLocale,
  3023. messages: messages,
  3024. watcher: watcher
  3025. });
  3026. var _t = function t(key, values) {
  3027. if (typeof getApp !== 'function') {
  3028. // app view
  3029. /* eslint-disable no-func-assign */
  3030. _t = function t(key, values) {
  3031. return i18n.t(key, values);
  3032. };
  3033. } else {
  3034. var isWatchedAppLocale = false;
  3035. _t = function t(key, values) {
  3036. var appVm = getApp().$vm;
  3037. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  3038. // options: {
  3039. // type: Array,
  3040. // default () {
  3041. // return [{
  3042. // icon: 'shop',
  3043. // text: t("uni-goods-nav.options.shop"),
  3044. // }, {
  3045. // icon: 'cart',
  3046. // text: t("uni-goods-nav.options.cart")
  3047. // }]
  3048. // }
  3049. // },
  3050. if (appVm) {
  3051. // 触发响应式
  3052. appVm.$locale;
  3053. if (!isWatchedAppLocale) {
  3054. isWatchedAppLocale = true;
  3055. watchAppLocale(appVm, i18n);
  3056. }
  3057. }
  3058. return i18n.t(key, values);
  3059. };
  3060. }
  3061. return _t(key, values);
  3062. };
  3063. return {
  3064. i18n: i18n,
  3065. f: function f(message, values, delimiters) {
  3066. return i18n.f(message, values, delimiters);
  3067. },
  3068. t: function t(key, values) {
  3069. return _t(key, values);
  3070. },
  3071. add: function add(locale, message) {
  3072. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3073. return i18n.add(locale, message, override);
  3074. },
  3075. watch: function watch(fn) {
  3076. return i18n.watchLocale(fn);
  3077. },
  3078. getLocale: function getLocale() {
  3079. return i18n.getLocale();
  3080. },
  3081. setLocale: function setLocale(newLocale) {
  3082. return i18n.setLocale(newLocale);
  3083. }
  3084. };
  3085. }
  3086. var isString = function isString(val) {
  3087. return typeof val === 'string';
  3088. };
  3089. exports.isString = isString;
  3090. var formater;
  3091. function hasI18nJson(jsonObj, delimiters) {
  3092. if (!formater) {
  3093. formater = new BaseFormatter();
  3094. }
  3095. return walkJsonObj(jsonObj, function (jsonObj, key) {
  3096. var value = jsonObj[key];
  3097. if (isString(value)) {
  3098. if (isI18nStr(value, delimiters)) {
  3099. return true;
  3100. }
  3101. } else {
  3102. return hasI18nJson(value, delimiters);
  3103. }
  3104. });
  3105. }
  3106. function parseI18nJson(jsonObj, values, delimiters) {
  3107. if (!formater) {
  3108. formater = new BaseFormatter();
  3109. }
  3110. walkJsonObj(jsonObj, function (jsonObj, key) {
  3111. var value = jsonObj[key];
  3112. if (isString(value)) {
  3113. if (isI18nStr(value, delimiters)) {
  3114. jsonObj[key] = compileStr(value, values, delimiters);
  3115. }
  3116. } else {
  3117. parseI18nJson(value, values, delimiters);
  3118. }
  3119. });
  3120. return jsonObj;
  3121. }
  3122. function compileI18nJsonStr(jsonStr, _ref5) {
  3123. var locale = _ref5.locale,
  3124. locales = _ref5.locales,
  3125. delimiters = _ref5.delimiters;
  3126. if (!isI18nStr(jsonStr, delimiters)) {
  3127. return jsonStr;
  3128. }
  3129. if (!formater) {
  3130. formater = new BaseFormatter();
  3131. }
  3132. var localeValues = [];
  3133. Object.keys(locales).forEach(function (name) {
  3134. if (name !== locale) {
  3135. localeValues.push({
  3136. locale: name,
  3137. values: locales[name]
  3138. });
  3139. }
  3140. });
  3141. localeValues.unshift({
  3142. locale: locale,
  3143. values: locales[locale]
  3144. });
  3145. try {
  3146. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  3147. } catch (e) {}
  3148. return jsonStr;
  3149. }
  3150. function isI18nStr(value, delimiters) {
  3151. return value.indexOf(delimiters[0]) > -1;
  3152. }
  3153. function compileStr(value, values, delimiters) {
  3154. return formater.interpolate(value, values, delimiters).join('');
  3155. }
  3156. function compileValue(jsonObj, key, localeValues, delimiters) {
  3157. var value = jsonObj[key];
  3158. if (isString(value)) {
  3159. // 存在国际化
  3160. if (isI18nStr(value, delimiters)) {
  3161. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  3162. if (localeValues.length > 1) {
  3163. // 格式化国际化语言
  3164. var valueLocales = jsonObj[key + 'Locales'] = {};
  3165. localeValues.forEach(function (localValue) {
  3166. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  3167. });
  3168. }
  3169. }
  3170. } else {
  3171. compileJsonObj(value, localeValues, delimiters);
  3172. }
  3173. }
  3174. function compileJsonObj(jsonObj, localeValues, delimiters) {
  3175. walkJsonObj(jsonObj, function (jsonObj, key) {
  3176. compileValue(jsonObj, key, localeValues, delimiters);
  3177. });
  3178. return jsonObj;
  3179. }
  3180. function walkJsonObj(jsonObj, walk) {
  3181. if (Array.isArray(jsonObj)) {
  3182. for (var i = 0; i < jsonObj.length; i++) {
  3183. if (walk(jsonObj, i)) {
  3184. return true;
  3185. }
  3186. }
  3187. } else if (isObject(jsonObj)) {
  3188. for (var key in jsonObj) {
  3189. if (walk(jsonObj, key)) {
  3190. return true;
  3191. }
  3192. }
  3193. }
  3194. return false;
  3195. }
  3196. function resolveLocale(locales) {
  3197. return function (locale) {
  3198. if (!locale) {
  3199. return locale;
  3200. }
  3201. locale = normalizeLocale(locale) || locale;
  3202. return resolveLocaleChain(locale).find(function (locale) {
  3203. return locales.indexOf(locale) > -1;
  3204. });
  3205. };
  3206. }
  3207. function resolveLocaleChain(locale) {
  3208. var chain = [];
  3209. var tokens = locale.split('-');
  3210. while (tokens.length) {
  3211. chain.push(tokens.join('-'));
  3212. tokens.pop();
  3213. }
  3214. return chain;
  3215. }
  3216. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  3217. /***/ }),
  3218. /***/ 220:
  3219. /*!*********************************************************************************************************************************!*\
  3220. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/common/relation.js ***!
  3221. \*********************************************************************************************************************************/
  3222. /*! no static exports found */
  3223. /***/ (function(module, exports, __webpack_require__) {
  3224. "use strict";
  3225. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  3226. Object.defineProperty(exports, "__esModule", {
  3227. value: true
  3228. });
  3229. exports.children = children;
  3230. exports.parent = parent;
  3231. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  3232. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  3233. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  3234. var styles = function styles() {
  3235. var v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  3236. return v.split(';').filter(function (v) {
  3237. return v && !/^[\n\s]+$/.test(v);
  3238. }).map(function (v) {
  3239. var key = v.slice(0, v.indexOf(':'));
  3240. var value = v.slice(v.indexOf(':') + 1);
  3241. return (0, _defineProperty2.default)({}, key.replace(/-([a-z])/g, function () {
  3242. return arguments[1].toUpperCase();
  3243. }).replace(/\s+/g, ''), value.replace(/^\s+/, '').replace(/\s+$/, '') || '');
  3244. });
  3245. };
  3246. function parent(parent) {
  3247. return {
  3248. provide: function provide() {
  3249. return (0, _defineProperty2.default)({}, parent, this);
  3250. },
  3251. data: function data() {
  3252. return {
  3253. el: {
  3254. id: null,
  3255. css: {},
  3256. views: []
  3257. }
  3258. };
  3259. },
  3260. watch: {
  3261. css: {
  3262. handler: function handler(v) {
  3263. if (this.canvasId) {
  3264. this.el.css = ((0, _typeof2.default)(v) == 'object' ? v : v && Object.assign.apply(Object, (0, _toConsumableArray2.default)(styles(v)))) || {};
  3265. this.canvasWidth = this.el.css && this.el.css.width || this.canvasWidth;
  3266. this.canvasHeight = this.el.css && this.el.css.height || this.canvasHeight;
  3267. }
  3268. },
  3269. immediate: true
  3270. }
  3271. }
  3272. };
  3273. }
  3274. function children(parent) {
  3275. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3276. var indexKey = options.indexKey || 'index';
  3277. return {
  3278. inject: (0, _defineProperty2.default)({}, parent, {
  3279. default: null
  3280. }),
  3281. watch: {
  3282. el: {
  3283. handler: function handler(v, o) {
  3284. if (JSON.stringify(v) != JSON.stringify(o)) this.bindRelation();
  3285. },
  3286. deep: true,
  3287. immediate: true
  3288. },
  3289. src: {
  3290. handler: function handler(v, o) {
  3291. if (v != o) this.bindRelation();
  3292. },
  3293. immediate: true
  3294. },
  3295. text: {
  3296. handler: function handler(v, o) {
  3297. if (v != o) this.bindRelation();
  3298. },
  3299. immediate: true
  3300. },
  3301. css: {
  3302. handler: function handler(v, o) {
  3303. if (v != o) this.el.css = ((0, _typeof2.default)(v) == 'object' ? v : v && Object.assign.apply(Object, (0, _toConsumableArray2.default)(styles(v)))) || {};
  3304. },
  3305. immediate: true
  3306. },
  3307. replace: {
  3308. handler: function handler(v, o) {
  3309. if (JSON.stringify(v) != JSON.stringify(o)) this.bindRelation();
  3310. },
  3311. deep: true,
  3312. immediate: true
  3313. }
  3314. },
  3315. created: function created() {
  3316. var _this = this;
  3317. if (!this._uid) {
  3318. this._uid = this._.uid;
  3319. }
  3320. Object.defineProperty(this, 'parent', {
  3321. get: function get() {
  3322. return _this[parent] || [];
  3323. }
  3324. });
  3325. Object.defineProperty(this, 'index', {
  3326. get: function get() {
  3327. _this.bindRelation();
  3328. var _this$parent = _this.parent;
  3329. _this$parent = _this$parent === void 0 ? {} : _this$parent;
  3330. var _this$parent$el = _this$parent.el;
  3331. _this$parent$el = _this$parent$el === void 0 ? {} : _this$parent$el;
  3332. var _this$parent$el$views = _this$parent$el.views,
  3333. views = _this$parent$el$views === void 0 ? [] : _this$parent$el$views;
  3334. return views.indexOf(_this.el);
  3335. }
  3336. });
  3337. this.el.type = this.type;
  3338. if (this.uid) {
  3339. this.el.uid = this.uid;
  3340. }
  3341. this.bindRelation();
  3342. },
  3343. beforeDestroy: function beforeDestroy() {
  3344. this.removeEl();
  3345. },
  3346. methods: {
  3347. removeEl: function removeEl() {
  3348. var _this2 = this;
  3349. if (this.parent) {
  3350. this.parent.el.views = this.parent.el.views.filter(function (item) {
  3351. return item._uid !== _this2._uid;
  3352. });
  3353. }
  3354. },
  3355. bindRelation: function bindRelation() {
  3356. var _this3 = this;
  3357. if (!this.el._uid) {
  3358. this.el._uid = this._uid;
  3359. }
  3360. if (['text', 'qrcode'].includes(this.type)) {
  3361. this.el.text = this.$slots && this.$slots.default && this.$slots.default[0].text || "".concat(this.text || '').replace(/\\n/g, '\n');
  3362. }
  3363. if (this.type == 'image') {
  3364. this.el.src = this.src;
  3365. }
  3366. if (!this.parent) {
  3367. return;
  3368. }
  3369. var views = this.parent.el.views || [];
  3370. if (views.indexOf(this.el) !== -1) {
  3371. this.parent.el.views = views.map(function (v) {
  3372. return v._uid == _this3._uid ? _this3.el : v;
  3373. });
  3374. } else {
  3375. this.parent.el.views = [].concat((0, _toConsumableArray2.default)(views), [this.el]);
  3376. }
  3377. }
  3378. },
  3379. mounted: function mounted() {
  3380. // this.bindRelation()
  3381. }
  3382. };
  3383. }
  3384. /***/ }),
  3385. /***/ 221:
  3386. /*!*********************************************************************************************************************************!*\
  3387. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/l-painter/props.js ***!
  3388. \*********************************************************************************************************************************/
  3389. /*! no static exports found */
  3390. /***/ (function(module, exports, __webpack_require__) {
  3391. "use strict";
  3392. Object.defineProperty(exports, "__esModule", {
  3393. value: true
  3394. });
  3395. exports.default = void 0;
  3396. var _default = {
  3397. props: {
  3398. board: Object,
  3399. pathType: String,
  3400. // 'base64'、'url'
  3401. fileType: {
  3402. type: String,
  3403. default: 'png'
  3404. },
  3405. hidden: Boolean,
  3406. quality: {
  3407. type: Number,
  3408. default: 1
  3409. },
  3410. css: [String, Object],
  3411. // styles: [String, Object],
  3412. width: [Number, String],
  3413. height: [Number, String],
  3414. pixelRatio: Number,
  3415. customStyle: String,
  3416. isCanvasToTempFilePath: Boolean,
  3417. // useCanvasToTempFilePath: Boolean,
  3418. sleep: {
  3419. type: Number,
  3420. default: 1000 / 30
  3421. },
  3422. beforeDelay: {
  3423. type: Number,
  3424. default: 100
  3425. },
  3426. afterDelay: {
  3427. type: Number,
  3428. default: 100
  3429. },
  3430. performance: Boolean,
  3431. type: {
  3432. type: String,
  3433. default: '2d'
  3434. }
  3435. }
  3436. };
  3437. exports.default = _default;
  3438. /***/ }),
  3439. /***/ 222:
  3440. /*!*********************************************************************************************************************************!*\
  3441. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/l-painter/utils.js ***!
  3442. \*********************************************************************************************************************************/
  3443. /*! no static exports found */
  3444. /***/ (function(module, exports, __webpack_require__) {
  3445. "use strict";
  3446. /* WEBPACK VAR INJECTION */(function(uni, wx) {
  3447. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  3448. Object.defineProperty(exports, "__esModule", {
  3449. value: true
  3450. });
  3451. exports.base64ToPath = base64ToPath;
  3452. exports.canIUseCanvas2d = canIUseCanvas2d;
  3453. exports.compareVersion = compareVersion;
  3454. exports.getImageInfo = getImageInfo;
  3455. exports.isBase64 = void 0;
  3456. exports.isNumber = isNumber;
  3457. exports.networkReg = exports.isPC = void 0;
  3458. exports.pathToBase64 = pathToBase64;
  3459. exports.prefix = void 0;
  3460. exports.sleep = sleep;
  3461. exports.toPx = toPx;
  3462. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 31));
  3463. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  3464. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 33));
  3465. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  3466. 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; }
  3467. 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; }
  3468. var networkReg = /^(http|\/\/)/;
  3469. exports.networkReg = networkReg;
  3470. var isBase64 = function isBase64(path) {
  3471. return /^data:image\/(\w+);base64/.test(path);
  3472. };
  3473. exports.isBase64 = isBase64;
  3474. function sleep(delay) {
  3475. return new Promise(function (resolve) {
  3476. return setTimeout(resolve, delay);
  3477. });
  3478. }
  3479. var _uni$getSystemInfoSyn = uni.getSystemInfoSync(),
  3480. platform = _uni$getSystemInfoSyn.platform,
  3481. SDKVersion = _uni$getSystemInfoSyn.SDKVersion;
  3482. var isPC = /windows|mac/.test(platform);
  3483. // 缓存图片
  3484. exports.isPC = isPC;
  3485. var cache = {};
  3486. function isNumber(value) {
  3487. return /^-?\d+(\.\d+)?$/.test(value);
  3488. }
  3489. function toPx(value, baseSize) {
  3490. var isDecimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3491. // 如果是数字
  3492. if (typeof value === 'number') {
  3493. return value;
  3494. }
  3495. // 如果是字符串数字
  3496. if (isNumber(value)) {
  3497. return value * 1;
  3498. }
  3499. // 如果有单位
  3500. if (typeof value === 'string') {
  3501. var reg = /^-?([0-9]+)?([.]{1}[0-9]+){0,1}(em|rpx|px|%)$/g;
  3502. var results = reg.exec(value);
  3503. if (!value || !results) {
  3504. return 0;
  3505. }
  3506. var unit = results[3];
  3507. value = parseFloat(value);
  3508. var res = 0;
  3509. if (unit === 'rpx') {
  3510. res = uni.upx2px(value);
  3511. } else if (unit === 'px') {
  3512. res = value * 1;
  3513. } else if (unit === '%') {
  3514. res = value * toPx(baseSize) / 100;
  3515. } else if (unit === 'em') {
  3516. res = value * toPx(baseSize || 14);
  3517. }
  3518. return isDecimal ? res.toFixed(2) * 1 : Math.round(res);
  3519. }
  3520. return 0;
  3521. }
  3522. // 计算版本
  3523. function compareVersion(v1, v2) {
  3524. v1 = v1.split('.');
  3525. v2 = v2.split('.');
  3526. var len = Math.max(v1.length, v2.length);
  3527. while (v1.length < len) {
  3528. v1.push('0');
  3529. }
  3530. while (v2.length < len) {
  3531. v2.push('0');
  3532. }
  3533. for (var i = 0; i < len; i++) {
  3534. var num1 = parseInt(v1[i], 10);
  3535. var num2 = parseInt(v2[i], 10);
  3536. if (num1 > num2) {
  3537. return 1;
  3538. } else if (num1 < num2) {
  3539. return -1;
  3540. }
  3541. }
  3542. return 0;
  3543. }
  3544. function gte(version) {
  3545. return compareVersion(SDKVersion, version) >= 0;
  3546. }
  3547. function canIUseCanvas2d() {
  3548. return gte('2.9.2');
  3549. return false;
  3550. }
  3551. var prefix = function prefix() {
  3552. return wx;
  3553. };
  3554. /**
  3555. * base64转路径
  3556. * @param {Object} base64
  3557. */
  3558. exports.prefix = prefix;
  3559. function base64ToPath(base64) {
  3560. var _ref = /^data:image\/(\w+);base64,/.exec(base64) || [],
  3561. _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  3562. format = _ref2[1];
  3563. return new Promise(function (resolve, reject) {
  3564. var fs = uni.getFileSystemManager();
  3565. //自定义文件名
  3566. if (!format) {
  3567. reject(new Error('ERROR_BASE64SRC_PARSE'));
  3568. }
  3569. var time = new Date().getTime();
  3570. var pre = prefix();
  3571. var filePath = "".concat(pre.env.USER_DATA_PATH, "/").concat(time, ".").concat(format);
  3572. fs.writeFile({
  3573. filePath: filePath,
  3574. data: base64.split(',')[1],
  3575. encoding: 'base64',
  3576. success: function success() {
  3577. resolve(filePath);
  3578. },
  3579. fail: function fail(err) {
  3580. console.error(err);
  3581. reject(err);
  3582. }
  3583. });
  3584. });
  3585. }
  3586. /**
  3587. * 路径转base64
  3588. * @param {Object} string
  3589. */
  3590. function pathToBase64(path) {
  3591. if (/^data:/.test(path)) return path;
  3592. return new Promise(function (resolve, reject) {
  3593. if (uni.canIUse('getFileSystemManager')) {
  3594. uni.getFileSystemManager().readFile({
  3595. filePath: path,
  3596. encoding: 'base64',
  3597. success: function success(res) {
  3598. resolve('data:image/png;base64,' + res.data);
  3599. },
  3600. fail: function fail(error) {
  3601. console.error({
  3602. error: error,
  3603. path: path
  3604. });
  3605. reject(error);
  3606. }
  3607. });
  3608. }
  3609. });
  3610. }
  3611. function getImageInfo(path, useCORS) {
  3612. var _this = this;
  3613. var isCanvas2D = this && this.canvas && this.canvas.createImage;
  3614. return new Promise( /*#__PURE__*/function () {
  3615. var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(resolve, reject) {
  3616. var src, img;
  3617. return _regenerator.default.wrap(function _callee$(_context) {
  3618. while (1) {
  3619. switch (_context.prev = _context.next) {
  3620. case 0:
  3621. // let time = +new Date()
  3622. src = path.replace(/^@\//, '/');
  3623. if (!(cache[path] && cache[path].errMsg)) {
  3624. _context.next = 5;
  3625. break;
  3626. }
  3627. resolve(cache[path]);
  3628. _context.next = 22;
  3629. break;
  3630. case 5:
  3631. _context.prev = 5;
  3632. if (!(isBase64(path) && (isCanvas2D ? isPC : true))) {
  3633. _context.next = 10;
  3634. break;
  3635. }
  3636. _context.next = 9;
  3637. return base64ToPath(path);
  3638. case 9:
  3639. src = _context.sent;
  3640. case 10:
  3641. _context.next = 15;
  3642. break;
  3643. case 12:
  3644. _context.prev = 12;
  3645. _context.t0 = _context["catch"](5);
  3646. reject(_objectSpread(_objectSpread({}, _context.t0), {}, {
  3647. src: src
  3648. }));
  3649. case 15:
  3650. if (!(isCanvas2D && !isPC)) {
  3651. _context.next = 21;
  3652. break;
  3653. }
  3654. img = _this.canvas.createImage();
  3655. img.onload = function () {
  3656. var image = {
  3657. path: img,
  3658. width: img.width,
  3659. height: img.height
  3660. };
  3661. cache[path] = image;
  3662. resolve(cache[path]);
  3663. };
  3664. img.onerror = function (err) {
  3665. reject({
  3666. err: err,
  3667. path: path
  3668. });
  3669. };
  3670. img.src = src;
  3671. return _context.abrupt("return");
  3672. case 21:
  3673. uni.getImageInfo({
  3674. src: src,
  3675. success: function success(image) {
  3676. var localReg = /^\.|^\/(?=[^\/])/;
  3677. image.path = localReg.test(src) ? "/".concat(image.path) : image.path;
  3678. if (isCanvas2D) {
  3679. var _img = _this.canvas.createImage();
  3680. _img.onload = function () {
  3681. image.path = _img;
  3682. cache[path] = image;
  3683. resolve(cache[path]);
  3684. };
  3685. _img.onerror = function (err) {
  3686. reject({
  3687. err: err,
  3688. path: path
  3689. });
  3690. };
  3691. _img.src = src;
  3692. return;
  3693. }
  3694. cache[path] = image;
  3695. resolve(cache[path]);
  3696. },
  3697. fail: function fail(err) {
  3698. console.error({
  3699. err: err,
  3700. path: path
  3701. });
  3702. reject({
  3703. err: err,
  3704. path: path
  3705. });
  3706. }
  3707. });
  3708. case 22:
  3709. case "end":
  3710. return _context.stop();
  3711. }
  3712. }
  3713. }, _callee, null, [[5, 12]]);
  3714. }));
  3715. return function (_x, _x2) {
  3716. return _ref3.apply(this, arguments);
  3717. };
  3718. }());
  3719. }
  3720. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  3721. /***/ }),
  3722. /***/ 223:
  3723. /*!***********************************************************************************************************************************!*\
  3724. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/l-painter/painter.js ***!
  3725. \***********************************************************************************************************************************/
  3726. /*! no static exports found */
  3727. /***/ (function(module, exports, __webpack_require__) {
  3728. "use strict";
  3729. /* WEBPACK VAR INJECTION */(function(uni, wx) {
  3730. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  3731. Object.defineProperty(exports, "__esModule", {
  3732. value: true
  3733. });
  3734. exports.default = exports.Painter = void 0;
  3735. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  3736. var _t = function t() {
  3737. return _t = Object.assign || function (t) {
  3738. for (var e, i = 1, n = arguments.length; i < n; i++) {
  3739. for (var r in e = arguments[i]) {
  3740. Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
  3741. }
  3742. }
  3743. return t;
  3744. }, _t.apply(this, arguments);
  3745. };
  3746. function e(t, e, i, n) {
  3747. return new (i || (i = Promise))(function (r, o) {
  3748. function s(t) {
  3749. try {
  3750. h(n.next(t));
  3751. } catch (t) {
  3752. o(t);
  3753. }
  3754. }
  3755. function a(t) {
  3756. try {
  3757. h(n.throw(t));
  3758. } catch (t) {
  3759. o(t);
  3760. }
  3761. }
  3762. function h(t) {
  3763. var e;
  3764. t.done ? r(t.value) : (e = t.value, e instanceof i ? e : new i(function (t) {
  3765. t(e);
  3766. })).then(s, a);
  3767. }
  3768. h((n = n.apply(t, e || [])).next());
  3769. });
  3770. }
  3771. function i(t, e) {
  3772. var i,
  3773. n,
  3774. r,
  3775. o,
  3776. s = {
  3777. label: 0,
  3778. sent: function sent() {
  3779. if (1 & r[0]) throw r[1];
  3780. return r[1];
  3781. },
  3782. trys: [],
  3783. ops: []
  3784. };
  3785. return o = {
  3786. next: a(0),
  3787. throw: a(1),
  3788. return: a(2)
  3789. }, "function" == typeof Symbol && (o[Symbol.iterator] = function () {
  3790. return this;
  3791. }), o;
  3792. function a(o) {
  3793. return function (a) {
  3794. return function (o) {
  3795. if (i) throw new TypeError("Generator is already executing.");
  3796. for (; s;) {
  3797. try {
  3798. if (i = 1, n && (r = 2 & o[0] ? n.return : o[0] ? n.throw || ((r = n.return) && r.call(n), 0) : n.next) && !(r = r.call(n, o[1])).done) return r;
  3799. switch (n = 0, r && (o = [2 & o[0], r.value]), o[0]) {
  3800. case 0:
  3801. case 1:
  3802. r = o;
  3803. break;
  3804. case 4:
  3805. return s.label++, {
  3806. value: o[1],
  3807. done: !1
  3808. };
  3809. case 5:
  3810. s.label++, n = o[1], o = [0];
  3811. continue;
  3812. case 7:
  3813. o = s.ops.pop(), s.trys.pop();
  3814. continue;
  3815. default:
  3816. if (!(r = s.trys, (r = r.length > 0 && r[r.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
  3817. s = 0;
  3818. continue;
  3819. }
  3820. if (3 === o[0] && (!r || o[1] > r[0] && o[1] < r[3])) {
  3821. s.label = o[1];
  3822. break;
  3823. }
  3824. if (6 === o[0] && s.label < r[1]) {
  3825. s.label = r[1], r = o;
  3826. break;
  3827. }
  3828. if (r && s.label < r[2]) {
  3829. s.label = r[2], s.ops.push(o);
  3830. break;
  3831. }
  3832. r[2] && s.ops.pop(), s.trys.pop();
  3833. continue;
  3834. }
  3835. o = e.call(t, s);
  3836. } catch (t) {
  3837. o = [6, t], n = 0;
  3838. } finally {
  3839. i = r = 0;
  3840. }
  3841. }
  3842. if (5 & o[0]) throw o[1];
  3843. return {
  3844. value: o[0] ? o[1] : void 0,
  3845. done: !0
  3846. };
  3847. }([o, a]);
  3848. };
  3849. }
  3850. }
  3851. var n = {
  3852. MP_WEIXIN: "mp-weixin",
  3853. MP_QQ: "mp-qq",
  3854. MP_ALIPAY: "mp-alipay",
  3855. MP_BAIDU: "mp-baidu",
  3856. MP_TOUTIAO: "mp-toutiao",
  3857. MP_DINGDING: "mp-dingding",
  3858. H5: "h5",
  3859. WEB: "web",
  3860. PLUS: "plus"
  3861. },
  3862. r = ["Top", "Right", "Bottom", "Left"],
  3863. o = "right",
  3864. s = "bottom",
  3865. a = ["contentSize", "clientSize", "borderSize", "offsetSize"],
  3866. h = "row",
  3867. c = "column",
  3868. f = {
  3869. TOP: "top",
  3870. MIDDLE: "middle",
  3871. BOTTOM: s
  3872. },
  3873. l = {
  3874. LEFT: "left",
  3875. CENTER: "center",
  3876. RIGHT: o
  3877. },
  3878. d = "view",
  3879. u = "text",
  3880. p = "image",
  3881. g = "qrcode",
  3882. v = "block",
  3883. y = "inline-block",
  3884. x = "none",
  3885. b = "flex",
  3886. w = "absolute",
  3887. m = "fixed",
  3888. S = {
  3889. display: v,
  3890. color: "#000000",
  3891. lineHeight: "1.4em",
  3892. fontSize: 14,
  3893. fontWeight: 400,
  3894. fontFamily: "sans-serif",
  3895. lineCap: "butt",
  3896. flexDirection: h,
  3897. flexWrap: "nowrap",
  3898. textAlign: "left",
  3899. alignItems: "flex-start",
  3900. justifyContent: "flex-start",
  3901. position: "static",
  3902. transformOrigin: "".concat("center", " ").concat("center")
  3903. },
  3904. z = {
  3905. upx2px: function upx2px(t) {
  3906. return window.innerWidth / 750 * t;
  3907. },
  3908. getSystemInfoSync: function getSystemInfoSync() {
  3909. return {
  3910. screenWidth: window.innerWidth,
  3911. screenHeight: window.innerHeight
  3912. };
  3913. },
  3914. getImageInfo: function getImageInfo(t) {
  3915. var e = t.src,
  3916. i = t.success,
  3917. n = t.fail,
  3918. r = new Image();
  3919. r.onload = function () {
  3920. i({
  3921. width: r.naturalWidth,
  3922. height: r.naturalHeight,
  3923. path: r.src,
  3924. src: e
  3925. });
  3926. }, r.onerror = n, r.src = e;
  3927. }
  3928. },
  3929. I = "object" == (typeof window === "undefined" ? "undefined" : (0, _typeof2.default)(window)) ? "undefined" == typeof uni || "undefined" != typeof uni && !uni.addInterceptor ? n.WEB : n.H5 : "object" == (typeof swan === "undefined" ? "undefined" : (0, _typeof2.default)(swan)) ? n.MP_BAIDU : "object" == (typeof tt === "undefined" ? "undefined" : (0, _typeof2.default)(tt)) ? n.MP_TOUTIAO : "object" == (typeof plus === "undefined" ? "undefined" : (0, _typeof2.default)(plus)) ? n.PLUS : "object" == (typeof wx === "undefined" ? "undefined" : (0, _typeof2.default)(wx)) ? n.MP_WEIXIN : void 0,
  3930. M = I == n.MP_WEIXIN ? wx : "undefined" != typeof uni ? uni.getImageInfo ? {
  3931. upx2px: function upx2px(t) {
  3932. return uni.upx2px(t);
  3933. },
  3934. getSystemInfoSync: function getSystemInfoSync() {
  3935. return uni.getSystemInfoSync();
  3936. },
  3937. getImageInfo: function getImageInfo(t) {
  3938. return uni.getImageInfo(t);
  3939. },
  3940. downloadFile: function downloadFile(t) {
  3941. return uni.downloadFile(t);
  3942. }
  3943. } : Object.assign(uni, z) : "undefined" != typeof window ? z : uni;
  3944. if (!M.upx2px) {
  3945. var k = ((M.getSystemInfoSync && M.getSystemInfoSync()).screenWidth || 375) / 750;
  3946. M.upx2px = function (t) {
  3947. return k * t;
  3948. };
  3949. }
  3950. function B(t) {
  3951. return /^-?\d+(\.\d+)?$/.test(t);
  3952. }
  3953. function W(t, e, i) {
  3954. if (B(t)) return 1 * t;
  3955. if ("string" == typeof t) {
  3956. var n = /^-?([0-9]+)?([.]{1}[0-9]+){0,1}(em|rpx|vw|vh|px|%)$/g.exec(t);
  3957. if (!t || !n) return 0;
  3958. var r = n[3];
  3959. t = parseFloat(t);
  3960. var o = 0;
  3961. if ("rpx" === r) o = M.upx2px(t);else if ("px" === r) o = 1 * t;else if ("%" === r && e) o = t * W(e) / 100;else if ("em" === r && e) o = t * W(e || 14);else if (["vw", "vh"].includes(r)) {
  3962. var s = M.getSystemInfoSync(),
  3963. a = s.screenWidth,
  3964. h = s.screenHeight;
  3965. o = t * ("vw" == r ? a : h) / 100;
  3966. }
  3967. return 1 * o.toFixed(2);
  3968. }
  3969. return 0;
  3970. }
  3971. function P(t) {
  3972. return /%$/.test(t);
  3973. }
  3974. function O(t) {
  3975. return /^-?([0-9]+)?([.]{1}[0-9]+){0,1}(rpx|px)$/.test(t);
  3976. }
  3977. var T = function T(t) {
  3978. return !(!t || !t.startsWith("linear") && !t.startsWith("radial"));
  3979. },
  3980. L = function L(t, e, i, n, r, o) {
  3981. t.startsWith("linear") ? function (t, e, i, n, r, o) {
  3982. for (var s = function (t, e, i, n, r) {
  3983. void 0 === n && (n = 0);
  3984. void 0 === r && (r = 0);
  3985. var o = t.match(/([-]?\d{1,3})deg/),
  3986. s = o && o[1] ? parseFloat(o[1]) : 0;
  3987. s >= 360 && (s -= 360);
  3988. s < 0 && (s += 360);
  3989. if (0 === (s = Math.round(s))) return {
  3990. x0: Math.round(e / 2) + n,
  3991. y0: i + r,
  3992. x1: Math.round(e / 2) + n,
  3993. y1: r
  3994. };
  3995. if (180 === s) return {
  3996. x0: Math.round(e / 2) + n,
  3997. y0: r,
  3998. x1: Math.round(e / 2) + n,
  3999. y1: i + r
  4000. };
  4001. if (90 === s) return {
  4002. x0: n,
  4003. y0: Math.round(i / 2) + r,
  4004. x1: e + n,
  4005. y1: Math.round(i / 2) + r
  4006. };
  4007. if (270 === s) return {
  4008. x0: e + n,
  4009. y0: Math.round(i / 2) + r,
  4010. x1: n,
  4011. y1: Math.round(i / 2) + r
  4012. };
  4013. var a = Math.round(180 * Math.asin(e / Math.sqrt(Math.pow(e, 2) + Math.pow(i, 2))) / Math.PI);
  4014. if (s === a) return {
  4015. x0: n,
  4016. y0: i + r,
  4017. x1: e + n,
  4018. y1: r
  4019. };
  4020. if (s === 180 - a) return {
  4021. x0: n,
  4022. y0: r,
  4023. x1: e + n,
  4024. y1: i + r
  4025. };
  4026. if (s === 180 + a) return {
  4027. x0: e + n,
  4028. y0: r,
  4029. x1: n,
  4030. y1: i + r
  4031. };
  4032. if (s === 360 - a) return {
  4033. x0: e + n,
  4034. y0: i + r,
  4035. x1: n,
  4036. y1: r
  4037. };
  4038. var h = 0,
  4039. c = 0,
  4040. f = 0,
  4041. l = 0;
  4042. if (s < a || s > 180 - a && s < 180 || s > 180 && s < 180 + a || s > 360 - a) {
  4043. var d = s * Math.PI / 180,
  4044. u = s < a || s > 360 - a ? i / 2 : -i / 2,
  4045. p = Math.tan(d) * u,
  4046. g = s < a || s > 180 - a && s < 180 ? e / 2 - p : -e / 2 - p;
  4047. h = -(f = p + (v = Math.pow(Math.sin(d), 2) * g)), c = -(l = u + v / Math.tan(d));
  4048. }
  4049. if (s > a && s < 90 || s > 90 && s < 90 + a || s > 180 + a && s < 270 || s > 270 && s < 360 - a) {
  4050. var v;
  4051. d = (90 - s) * Math.PI / 180, p = s > a && s < 90 || s > 90 && s < 90 + a ? e / 2 : -e / 2, u = Math.tan(d) * p, g = s > a && s < 90 || s > 270 && s < 360 - a ? i / 2 - u : -i / 2 - u;
  4052. h = -(f = p + (v = Math.pow(Math.sin(d), 2) * g) / Math.tan(d)), c = -(l = u + v);
  4053. }
  4054. return h = Math.round(h + e / 2) + n, c = Math.round(i / 2 - c) + r, f = Math.round(f + e / 2) + n, l = Math.round(i / 2 - l) + r, {
  4055. x0: h,
  4056. y0: c,
  4057. x1: f,
  4058. y1: l
  4059. };
  4060. }(r, t, e, i, n), a = s.x0, h = s.y0, c = s.x1, f = s.y1, l = o.createLinearGradient(a, h, c, f), d = r.match(/linear-gradient\((.+)\)/)[1], u = R(d.substring(d.indexOf(",") + 1)), p = 0; p < u.colors.length; p++) {
  4061. l.addColorStop(u.percents[p], u.colors[p]);
  4062. }
  4063. o.setFillStyle(l);
  4064. }(e, i, n, r, t, o) : t.startsWith("radial") && function (t, e, i, n, r, o) {
  4065. for (var s = R(r.match(/radial-gradient\((.+)\)/)[1]), a = Math.round(t / 2) + i, h = Math.round(e / 2) + n, c = o.createRadialGradient(a, h, 0, a, h, Math.max(t, e) / 2), f = 0; f < s.colors.length; f++) {
  4066. c.addColorStop(s.percents[f], s.colors[f]);
  4067. }
  4068. o.setFillStyle(c);
  4069. }(e, i, n, r, t, o);
  4070. };
  4071. function R(t) {
  4072. for (var e = [], i = [], n = 0, r = t.substring(0, t.length - 1).split("%,"); n < r.length; n++) {
  4073. var o = r[n];
  4074. e.push(o.substring(0, o.lastIndexOf(" ")).trim()), i.push(o.substring(o.lastIndexOf(" "), o.length) / 100);
  4075. }
  4076. return {
  4077. colors: e,
  4078. percents: i
  4079. };
  4080. }
  4081. function F(t, e, i) {
  4082. return e in t ? Object.defineProperty(t, e, {
  4083. value: i,
  4084. enumerable: !0,
  4085. configurable: !0,
  4086. writable: !0
  4087. }) : t[e] = i, t;
  4088. }
  4089. function A() {
  4090. return A = Object.assign ? Object.assign.bind() : function (t) {
  4091. for (var e = 1; e < arguments.length; e++) {
  4092. var i = arguments[e];
  4093. for (var n in i) {
  4094. Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);
  4095. }
  4096. }
  4097. return t;
  4098. }, A.apply(this, arguments);
  4099. }
  4100. function j(t, e) {
  4101. return j = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
  4102. return t.__proto__ = e, t;
  4103. }, j(t, e);
  4104. }
  4105. function E(t, e) {
  4106. (null == e || e > t.length) && (e = t.length);
  4107. for (var i = 0, n = new Array(e); i < e; i++) {
  4108. n[i] = t[i];
  4109. }
  4110. return n;
  4111. }
  4112. function C(t, e) {
  4113. var i = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
  4114. if (i) return (i = i.call(t)).next.bind(i);
  4115. if (Array.isArray(t) || (i = function (t, e) {
  4116. if (t) {
  4117. if ("string" == typeof t) return E(t, e);
  4118. var i = Object.prototype.toString.call(t).slice(8, -1);
  4119. return "Object" === i && t.constructor && (i = t.constructor.name), "Map" === i || "Set" === i ? Array.from(t) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? E(t, e) : void 0;
  4120. }
  4121. }(t)) || e && t && "number" == typeof t.length) {
  4122. i && (t = i);
  4123. var n = 0;
  4124. return function () {
  4125. return n >= t.length ? {
  4126. done: !0
  4127. } : {
  4128. done: !1,
  4129. value: t[n++]
  4130. };
  4131. };
  4132. }
  4133. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  4134. }
  4135. function H(t) {
  4136. return "number" == typeof t;
  4137. }
  4138. function D(t) {
  4139. return "auto" === t || null === t;
  4140. }
  4141. function $(t) {
  4142. return /%$/.test(t);
  4143. }
  4144. var Y = p,
  4145. U = u,
  4146. N = d,
  4147. X = g,
  4148. _ = y,
  4149. q = w,
  4150. G = m;
  4151. function V(t) {
  4152. return t.replace(/-([a-z])/g, function (t, e) {
  4153. return e.toUpperCase();
  4154. });
  4155. }
  4156. function J(t, e) {
  4157. var i,
  4158. n,
  4159. o = function (t) {
  4160. var e = t.match(/([a-z]+)/)[1];
  4161. return [e, V(t.split(e)[1])];
  4162. }(t),
  4163. s = o[0],
  4164. a = o[1],
  4165. h = e.split(" ");
  4166. if (a) return (i = {})[s + a] = e, i;
  4167. if (h.length && !a) {
  4168. var c = h[0],
  4169. f = h[1],
  4170. l = h[2],
  4171. d = h[3];
  4172. return (n = {})[s + r[0]] = c, n[s + r[1]] = f || c, n[s + r[2]] = l || c, n[s + r[3]] = d || f || c, n;
  4173. }
  4174. }
  4175. function Q(t) {
  4176. t = t.trim();
  4177. for (var e = new Array(), i = "+", n = "", r = t.length, o = 0; o < r; ++o) {
  4178. if ("." === t[o] || !isNaN(Number(t[o])) && " " !== t[o]) n += t[o];else if ("(" === t[o]) {
  4179. for (var s = 1, a = o; s > 0;) {
  4180. "(" === t[a += 1] && (s += 1), ")" === t[a] && (s -= 1);
  4181. }
  4182. n = "".concat(Q(t.slice(o + 1, a))), o = a;
  4183. }
  4184. if (isNaN(Number(t[o])) && "." !== t[o] || o === r - 1) {
  4185. var h = parseFloat(n);
  4186. switch (i) {
  4187. case "+":
  4188. e.push(h);
  4189. break;
  4190. case "-":
  4191. e.push(-h);
  4192. break;
  4193. case "*":
  4194. e.push(e.pop() * h);
  4195. break;
  4196. case "/":
  4197. e.push(e.pop() / h);
  4198. }
  4199. i = t[o], n = "";
  4200. }
  4201. }
  4202. for (var c = 0; e.length;) {
  4203. c += e.pop();
  4204. }
  4205. return c;
  4206. }
  4207. var Z,
  4208. K = 0,
  4209. et = function () {
  4210. function t() {
  4211. F(this, "elements", []), F(this, "afterElements", []), F(this, "beforeElements", []), F(this, "ids", []), F(this, "width", 0), F(this, "height", 0), F(this, "top", 0), F(this, "left", 0), F(this, "pre", null), F(this, "offsetX", 0), F(this, "offsetY", 0), K++, this.id = K;
  4212. }
  4213. var e = t.prototype;
  4214. return e.fixedBind = function (t, e) {
  4215. void 0 === e && (e = 0), this.container = e ? t.parent : t.root, this.container.fixedLine = this, this.fixedAdd(t);
  4216. }, e.fixedAdd = function (t) {
  4217. if (!this.ids.includes(t.id)) {
  4218. this.ids.push(t.id), this.elements.push(t);
  4219. var e = t.computedStyle.zIndex;
  4220. (void 0 === e ? 0 : e) >= 0 ? this.afterElements.push(t) : this.beforeElements.push(t), this.refreshLayout();
  4221. }
  4222. }, e.bind = function (t) {
  4223. this.container = t.parent, this.container.line = null, this.container.lines ? (this.container.lines.push(this), this.pre = this.getPreLine(), this.top = this.pre.top + this.pre.height, this.left = this.container.contentSize.left) : (this.top = this.container.contentSize.top, this.left = this.container.contentSize.left, this.container.lines = [this]), this.isInline = t.isInline(), this.container.line = this, this.outerWidth = t.parent && t.parent.contentSize.width ? t.parent.contentSize.width : 1 / 0, this.add(t);
  4224. }, e.getPreLine = function () {
  4225. return this.container.lines[this.container.lines.length - 2];
  4226. }, e.canIEnter = function (t) {
  4227. return !((100 * t.offsetSize.width + 100 * this.width) / 100 > this.outerWidth) || (this.closeLine(), !1);
  4228. }, e.closeLine = function () {
  4229. delete this.container.line;
  4230. }, e.add = function (t) {
  4231. this.ids.includes(t.id) || (this.ids.push(t.id), this.elements.push(t), this.refreshWidthHeight(t));
  4232. }, e.refreshWidthHeight = function (t) {
  4233. t.offsetSize.height > this.height && (this.height = t.offsetSize.height), this.width += t.offsetSize.width || 0, (this.container.lineMaxWidth || 0) < this.width && (this.container.lineMaxWidth = this.width);
  4234. }, e.refreshXAlign = function () {
  4235. if (this.isInline) {
  4236. var t = this.container.contentSize.width - this.width,
  4237. e = this.container.style.textAlign;
  4238. "center" === e ? t /= 2 : "left" === e && (t = 0), this.offsetX = t;
  4239. }
  4240. }, e.getOffsetY = function (t) {
  4241. if (!t || !t.style) return 0;
  4242. var e = (t.style || {}).verticalAlign;
  4243. return e === s ? this.height - t.contentSize.height : "middle" === e ? (this.height - t.contentSize.height) / 2 : 0;
  4244. }, e.setIndent = function (t) {
  4245. var e = t.style.textIndent;
  4246. if (e && /^calc/.test(e)) {
  4247. var i = /^calc\((.+)\)$/.exec(e);
  4248. if (i && i[1]) {
  4249. var n = i[1].replace(/([^\s\(\+\-\*\/]+)\.(left|right|bottom|top|width|height)/g, function (e) {
  4250. var i = e.split("."),
  4251. n = i[0],
  4252. r = i[1],
  4253. o = t.parent.querySelector(n);
  4254. if (o && o.offsetSize) {
  4255. var s = {
  4256. right: o.offsetSize.left + o.offsetSize.width,
  4257. bottom: o.offsetSize.top + o.offsetSize.height
  4258. };
  4259. return o.offsetSize[r] || s[r] || 0;
  4260. }
  4261. }),
  4262. r = Q(n.replace(new RegExp(/-?[0-9]+(\.[0-9]+)?(rpx|px|%)/, "g"), W));
  4263. t.style.textIndent = r;
  4264. }
  4265. }
  4266. }, e.layout = function (t, e) {
  4267. var i = this;
  4268. this.refreshXAlign(), this.pre ? (this.top = this.pre.top + this.pre.height + this.offsetY, this.left = e + this.offsetX) : (this.top = Math.max(this.top, this.container.contentSize.top, t) + this.offsetY, this.left = Math.max(this.left, this.container.contentSize.left, e) + this.offsetX), this.elements.forEach(function (t, e) {
  4269. i.setIndent(t);
  4270. var n = i.elements[e - 1],
  4271. r = i.getOffsetY(t);
  4272. t.style.top = i.top + r, t.style.left = n ? n.offsetSize.left + n.offsetSize.width : i.left, t.getBoxPosition();
  4273. });
  4274. }, e.refreshLayout = function () {
  4275. this.afterElements = this.afterElements.sort(function (t, e) {
  4276. return t.computedStyle.zIndex - e.computedStyle.zIndex;
  4277. }), this.beforeElements = this.beforeElements.sort(function (t, e) {
  4278. return t.computedStyle.zIndex - e.computedStyle.zIndex;
  4279. });
  4280. }, t;
  4281. }(),
  4282. it = ((Z = {})[h] = {
  4283. width: "width",
  4284. contentWidth: "width",
  4285. lineMaxWidth: "lineMaxWidth",
  4286. left: "left",
  4287. top: "top",
  4288. height: "height",
  4289. lineMaxHeight: "lineMaxHeight",
  4290. marginLeft: "marginLeft"
  4291. }, Z[c] = {
  4292. width: "height",
  4293. contentWidth: "height",
  4294. lineMaxWidth: "lineMaxWidth",
  4295. left: "top",
  4296. top: "left",
  4297. height: "width",
  4298. lineMaxHeight: "lineMaxHeight",
  4299. marginLeft: "marginTop"
  4300. }, Z),
  4301. nt = function (t) {
  4302. var e, i;
  4303. function n() {
  4304. var e;
  4305. return F(function (t) {
  4306. if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  4307. return t;
  4308. }(e = t.call(this) || this), "outerWidth", 0), e.exactValue = 0, e.flexTotal = 0, e.width = 0, e.key = null, e.flexDirection = "row", e;
  4309. }
  4310. i = t, (e = n).prototype = Object.create(i.prototype), e.prototype.constructor = e, j(e, i);
  4311. var r = n.prototype;
  4312. return r.bind = function (t) {
  4313. this.container = t.parent, this.container.line = this, this.container.lines ? (this.container.lines.push(this), this.pre = this.getPreLine(), this.top = this.pre.top + this.pre.height, this.left = this.container.contentSize.left) : (this.top = this.container.contentSize.top, this.left = this.container.contentSize.left, this.container.lines = [this]), t.parent && (this.flexDirection = t.parent.style.flexDirection, this.key = it[this.flexDirection]), this.initHeight(t), this.outerWidth = t.parent && t.parent.contentSize[this.key.contentWidth] ? t.parent.contentSize[this.key.contentWidth] : 1 / 0, this.add(t);
  4314. }, r.add = function (t) {
  4315. this.ids.push(t.id);
  4316. var e = t.style.flex;
  4317. H(e) ? this.flexTotal += e : H(this.getWidth(t.style)) && (this.exactValue += this.getWidth(t.offsetSize)), this.elements.push(t), this.refreshWidthHeight(t), t.next || this.closeLine();
  4318. }, r.closeLine = function () {
  4319. this.calcFlex();
  4320. }, r.initHeight = function (t) {
  4321. this[this.key.height] = 0;
  4322. }, r.getWidth = function (t) {
  4323. return t[this.key.width] || 0;
  4324. }, r.getHeight = function (t) {
  4325. return t[this.key.height] || 0;
  4326. }, r.setWidth = function (t, e) {
  4327. t[this.key.width] = e;
  4328. }, r.setHeight = function (t, e) {
  4329. t[this.key.height] = e;
  4330. }, r.calcFlex = function () {
  4331. var t = this,
  4332. e = this.container.contentSize[this.key.contentWidth],
  4333. i = 0;
  4334. this.elements.forEach(function (n) {
  4335. var r = n.style,
  4336. o = n.contentSize,
  4337. s = t.getWidth(r) || t.getWidth(o);
  4338. H(r.flex) && (s = r.flex / t.flexTotal * (e - t.exactValue)), t.setWidth(n.computedStyle, s), n.isFlexCalc = !0, delete n.line, delete n.lines, delete n.lineMaxWidth, n.getBoxWidthHeight(), i = Math.max(i, t.getHeight(n.offsetSize));
  4339. }), this.setHeight(this, i);
  4340. }, r.refreshWidthHeight = function (t) {
  4341. var e = this.container.style.alignItems;
  4342. e && !t.style.alignSelf && (t.style.alignSelf = e);
  4343. var i = this.getHeight(t.offsetSize);
  4344. i > this[this.key.height] && (this.container[this.key.lineMaxHeight] = this[this.key.height] = i), this[this.key.width] += this.getWidth(t.offsetSize);
  4345. var n = Math.min(this.getWidth(this), !this.getWidth(this.container.contentSize) && 1 / 0);
  4346. (this.container[this.key.lineMaxWidth] || 0) < n && (this.container[this.key.lineMaxWidth] = n);
  4347. }, r.refreshXAlign = function () {
  4348. var t = this,
  4349. e = this.elements.reduce(function (e, i) {
  4350. return e + t.getWidth(i.offsetSize);
  4351. }, 0),
  4352. i = (this.outerWidth == 1 / 0 ? 0 : this.outerWidth - e) || 0,
  4353. n = this.container.style.justifyContent;
  4354. "center" === n ? i /= 2 : "flex-start" === n ? i = 0 : ["space-between", "space-around"].includes(n) && (!function (e, i) {
  4355. void 0 === i && (i = 0), i /= t.elements.length + (e ? -1 : 1), t.elements.forEach(function (n, r) {
  4356. var o;
  4357. e && !r || (n.style.margin ? n.style.margin[t.key.marginLeft] += i : n.style.margin = ((o = {})[t.key.marginLeft] = i, o), n.getBoxPosition());
  4358. }), i = 0;
  4359. }("space-between" == n, i), i = 0), this.offsetX = i || 0, this.refreshYAlign();
  4360. }, r.refreshYAlign = function () {
  4361. var t = this;
  4362. if (1 == this.container.lines.length) return 0;
  4363. var e = this.container.lines.reduce(function (e, i) {
  4364. return e + t.getHeight(i);
  4365. }, 0),
  4366. i = this.container.style.alignItems,
  4367. n = this.getHeight(this.container.contentSize);
  4368. if ("center" === i) {
  4369. var r = (n - e) / (this.container.lines.length + 1);
  4370. this.container.lines.forEach(function (t) {
  4371. t.offsetY = r;
  4372. });
  4373. }
  4374. if ("flex-end" === i) {
  4375. var o = n - e;
  4376. this.container.lines[0].offsetY = o;
  4377. }
  4378. }, r.getOffsetY = function (t) {
  4379. if (this.container.lines.length > 1) return 0;
  4380. var e = t.style.alignSelf,
  4381. i = this.getHeight(this.container.contentSize),
  4382. n = i - this.getHeight(t.offsetSize);
  4383. return "flex-end" === e ? n : "center" === e ? n / 2 : "stretch" === e ? (n && t.name == d && (t.style[this.key.width] = this.getWidth(t.offsetSize), t.style[this.key.height] = i, delete t.line, delete t.lines, t.getBoxWidthHeight()), 0) : 0;
  4384. }, r.layout = function (t, e) {
  4385. var i = this;
  4386. this.refreshXAlign(), this.pre ? (this.top = this.pre.top + this.pre.height + this.offsetY, this.left = e + this.offsetX) : (this.top = Math.max(this.top, this.container.contentSize.top, t) + this.offsetY, this.left = Math.max(this.left, this.container.contentSize.left, e) + this.offsetX), this.elements.forEach(function (t, e) {
  4387. i.setIndent(t);
  4388. var n = i.elements[e - 1],
  4389. r = i.getOffsetY(t);
  4390. t.style[i.key.top] = i[i.key.top] + r, t.style[i.key.left] = n ? n.offsetSize[i.key.left] + i.getWidth(n.offsetSize) : i[i.key.left], t.getBoxPosition();
  4391. });
  4392. }, n;
  4393. }(et),
  4394. rt = p,
  4395. ot = u,
  4396. st = d,
  4397. at = v,
  4398. ht = y,
  4399. ct = b,
  4400. ft = w,
  4401. lt = m,
  4402. dt = 0,
  4403. ut = {
  4404. left: null,
  4405. top: null,
  4406. width: null,
  4407. height: null
  4408. },
  4409. pt = new Map(),
  4410. gt = function () {
  4411. function t(t, e, i, n) {
  4412. var o = this;
  4413. F(this, "id", dt++), F(this, "style", {
  4414. left: null,
  4415. top: null,
  4416. width: null,
  4417. height: null
  4418. }), F(this, "computedStyle", {}), F(this, "originStyle", {}), F(this, "children", {}), F(this, "layoutBox", A({}, ut)), F(this, "contentSize", A({}, ut)), F(this, "clientSize", A({}, ut)), F(this, "borderSize", A({}, ut)), F(this, "offsetSize", A({}, ut)), this.ctx = n, this.root = i, e && (this.parent = e), this.name = t.type || t.name, this.attributes = this.getAttributes(t);
  4419. var s = function (t, e) {
  4420. var i,
  4421. n = ["color", "fontSize", "lineHeight", "verticalAlign", "fontWeight", "textAlign"],
  4422. o = t.type,
  4423. s = void 0 === o ? N : o,
  4424. a = t.styles,
  4425. h = void 0 === a ? {} : a,
  4426. c = (e || {}).computedStyle,
  4427. f = Object.assign({}, S);
  4428. if ([U, Y, X].includes(s) && !h.display && (f.display = _), c) for (var l = 0; l < n.length; l++) {
  4429. var d = n[l];
  4430. (h[d] || c[d]) && (h[d] = h[(i = d, i.replace(/([A-Z])/g, "-$1").toLowerCase())] || h[d] || c[d]);
  4431. }
  4432. for (var u = function u(t) {
  4433. var e,
  4434. i,
  4435. n,
  4436. o,
  4437. a = h[t];
  4438. if (/-/.test(t) && (t = V(t), f[t] = a), /^(box|text)?shadow$/i.test(t)) {
  4439. var c = [];
  4440. return a.replace(/((-?\d+(rpx|px|vw|vh)?\s+?){3})(.+)/, function () {
  4441. for (var t = [], e = 0; e < arguments.length; e++) {
  4442. t[e] = arguments[e];
  4443. }
  4444. c = t[1].match(/-?\d+(rpx|px|vw|vh)?/g).map(function (t) {
  4445. return W(t);
  4446. }).concat(t[4]);
  4447. }), /^text/.test(t) ? f.textShadow = c : f.boxShadow = c, "continue";
  4448. }
  4449. if (/^border/i.test(t) && !/radius$/i.test(t)) {
  4450. var l = t.match(/^border([BTRLa-z]+)?/)[0],
  4451. d = t.match(/[W|S|C][a-z]+/),
  4452. u = a.replace(/([\(,])\s+|\s+([\),])/g, "$1$2").split(" ").map(function (t) {
  4453. return /^\d/.test(t) ? W(t, "") : t;
  4454. });
  4455. return f[l] || (f[l] = {}), 1 == u.length && d ? f[l][l + d[0]] = u[0] : f[l] = ((e = {})[l + "Width"] = B(u[0]) ? u[0] : 0, e[l + "Style"] = u[1] || "solid", e[l + "Color"] = u[2] || "black", e), "continue";
  4456. }
  4457. if (/^background(color)?$/i.test(t)) return f.backgroundColor = a, "continue";
  4458. if (/^objectPosition$/i.test(t)) return f[t] = a.split(" "), "continue";
  4459. if (/^backgroundPosition$/i.test(t)) return f[t] = a.split(" "), "continue";
  4460. if (/padding|margin|radius/i.test(t)) {
  4461. var p = /radius$/i.test(t),
  4462. g = "borderRadius",
  4463. v = p ? g : t.match(/[a-z]+/)[0],
  4464. y = function y(t, e) {
  4465. return "border".concat(t).concat(e, "Radius");
  4466. },
  4467. x = [0, 0, 0, 0].map(function (t, e) {
  4468. return p ? [y(r[0], r[3]), y(r[0], r[1]), y(r[2], r[1]), y(r[2], r[3])][e] : v + r[e];
  4469. });
  4470. if ("padding" === t || "margin" === t || /^(border)?radius$/i.test(t)) {
  4471. u = "".concat(a).split(" ").map(function (e) {
  4472. return /^-?\d+(rpx|px|vh|vw)?$/.test(e) ? W(e) : "margin" != t && /auto/.test(e) ? 0 : e;
  4473. }, []) || [0];
  4474. var b = p ? g : t,
  4475. w = u[0],
  4476. m = u[1],
  4477. S = u[2],
  4478. z = u[3];
  4479. f[b] = ((i = {})[x[0]] = D(w) ? 0 : w, i[x[1]] = B(m) || D(m) ? m : w, i[x[2]] = D(B(S) ? S : w) ? 0 : B(S) ? S : w, i[x[3]] = B(z) ? z : null != m ? m : w, i);
  4480. } else "object" == (0, _typeof2.default)(f[v]) || (f[v] = ((n = {})[x[0]] = f[v] || 0, n[x[1]] = f[v] || 0, n[x[2]] = f[v] || 0, n[x[3]] = f[v] || 0, n)), f[v][t] = "margin" == v && D(a) || $(a) ? a : W(a);
  4481. return "continue";
  4482. }
  4483. if (/^transform$/i.test(t)) return f[t] = {}, a.replace(/([a-zA-Z]+)\(([0-9,-\.%rpxdeg\s]+)\)/g, function (e, i, n) {
  4484. var r = n.split(",").map(function (t) {
  4485. return t.replace(/(^\s*)|(\s*$)/g, "");
  4486. }),
  4487. o = function o(t, e) {
  4488. return t.includes("deg") ? 1 * t : e && !$(e) ? W(t, e) : t;
  4489. };
  4490. i.includes("matrix") ? f[t][i] = r.map(function (t) {
  4491. return 1 * t;
  4492. }) : i.includes("rotate") ? f[t][i] = 1 * n.match(/^-?\d+(\.\d+)?/)[0] : /[X, Y]/.test(i) ? f[t][i] = /[X]/.test(i) ? o(r[0], h.width) : o(r[0], h.height) : (f[t][i + "X"] = o(r[0], h.width), f[t][i + "Y"] = o(r[1] || r[0], h.height));
  4493. }), "continue";
  4494. if (/^font$/i.test(t) && console.warn("font 不支持简写"), /^textindent/i.test(t) && (f[t] = /^calc/.test(a) ? a : W(a)), /^textstroke/i.test(t)) {
  4495. var I = t.match(/color|width|type$/i),
  4496. M = (l = "textStroke", a.split(" ").map(function (t) {
  4497. return /^\d+(rpx|px|vh|vw)?$/.test(t) ? W(t) : t;
  4498. }));
  4499. return I ? f[l] ? f[l][I[0]] = M[0] : f[l] = ((o = {})[I[0]] = M[0], o) : f[l] = {
  4500. width: M[0],
  4501. color: M[1],
  4502. type: M[2]
  4503. }, "continue";
  4504. }
  4505. /^left|top$/i.test(t) && ![q, G].includes(h.position) ? f[t] = 0 : f[t] = /^-?[\d\.]+(px|rpx|vw|vh)?$/.test(a) ? W(a) : /em$/.test(a) && s == U ? W(a, h.fontSize) : a;
  4506. }, p = 0, g = Object.keys(h); p < g.length; p++) {
  4507. u(g[p]);
  4508. }
  4509. return f;
  4510. }(t, e);
  4511. this.isAbsolute = s.position == ft, this.isFixed = s.position == lt, this.originStyle = s, this.styles = t.styles, Object.keys(s).forEach(function (t) {
  4512. Object.defineProperty(o.style, t, {
  4513. configurable: !0,
  4514. enumerable: !0,
  4515. get: function get() {
  4516. return s[t];
  4517. },
  4518. set: function set(e) {
  4519. s[t] = e;
  4520. }
  4521. });
  4522. });
  4523. var a = {
  4524. contentSize: A({}, this.contentSize),
  4525. clientSize: A({}, this.clientSize),
  4526. borderSize: A({}, this.borderSize),
  4527. offsetSize: A({}, this.offsetSize)
  4528. };
  4529. Object.keys(a).forEach(function (t) {
  4530. Object.keys(o[t]).forEach(function (e) {
  4531. Object.defineProperty(o[t], e, {
  4532. configurable: !0,
  4533. enumerable: !0,
  4534. get: function get() {
  4535. return a[t][e];
  4536. },
  4537. set: function set(i) {
  4538. a[t][e] = i;
  4539. }
  4540. });
  4541. });
  4542. }), this.computedStyle = this.style;
  4543. }
  4544. var e = t.prototype;
  4545. return e.add = function (t) {
  4546. t.parent = this, this.children[t.id] = t;
  4547. }, e.getChildren = function () {
  4548. var t = this;
  4549. return Object.keys(this.children).map(function (e) {
  4550. return t.children[e];
  4551. });
  4552. }, e.prev = function (t) {
  4553. void 0 === t && (t = this);
  4554. var e = t.parent.getChildren();
  4555. return e[e.findIndex(function (e) {
  4556. return e.id == t.id;
  4557. }) - 1];
  4558. }, e.querySelector = function (t) {
  4559. var e = this.getChildren();
  4560. if ("string" != typeof t) return null;
  4561. var i = e.find(function (e) {
  4562. var i = e.id,
  4563. n = e.attributes;
  4564. return i == t || n && n.uid == t;
  4565. });
  4566. return i || this.parent && this.parent.querySelector && this.parent.querySelector(t) || null;
  4567. }, e.getLineRect = function (t, e) {
  4568. var i = {
  4569. width: 0,
  4570. height: 0
  4571. },
  4572. n = e ? e.lines : this.parent && this.parent.lines;
  4573. return n && n.find(function (e) {
  4574. return e.ids.includes(t);
  4575. }) || i;
  4576. }, e.setPosition = function (t, e) {
  4577. var i = {
  4578. left: "width",
  4579. top: "height",
  4580. right: "width",
  4581. bottom: "height"
  4582. };
  4583. Object.keys(i).forEach(function (n) {
  4584. var r = n == o ? "left" : "top";
  4585. [o, s].includes(n) && void 0 !== t.style[n] && !B(t.originStyle[r]) ? t.style[r] = e[i[n]] - t.offsetSize[i[n]] - W(t.style[n], e[i[n]]) : t.style[n] = W(t.style[n], e[i[n]]);
  4586. });
  4587. }, e.getAttributes = function (t) {
  4588. var e = t.attributes,
  4589. i = void 0 === e ? {} : e,
  4590. n = t.uid,
  4591. r = t.url,
  4592. o = t.src,
  4593. s = t.replace,
  4594. a = t.text;
  4595. return n && (i.uid = n), (r || o) && (i.src = i.src || r || o), s && (i.replace = s), a && (i.text = a), i;
  4596. }, e.getOffsetSize = function (t, e, i) {
  4597. void 0 === i && (i = a[3]);
  4598. var n = e || {},
  4599. r = n.margin,
  4600. o = (r = void 0 === r ? {} : r).marginLeft,
  4601. s = void 0 === o ? 0 : o,
  4602. h = r.marginTop,
  4603. c = void 0 === h ? 0 : h,
  4604. f = r.marginRight,
  4605. l = void 0 === f ? 0 : f,
  4606. d = r.marginBottom,
  4607. u = void 0 === d ? 0 : d,
  4608. p = n.padding,
  4609. g = (p = void 0 === p ? {} : p).paddingLeft,
  4610. v = void 0 === g ? 0 : g,
  4611. y = p.paddingTop,
  4612. x = void 0 === y ? 0 : y,
  4613. b = p.paddingRight,
  4614. w = void 0 === b ? 0 : b,
  4615. m = p.paddingBottom,
  4616. S = void 0 === m ? 0 : m,
  4617. z = n.border,
  4618. I = (z = void 0 === z ? {} : z).borderWidth,
  4619. M = void 0 === I ? 0 : I,
  4620. k = n.borderTop,
  4621. B = (k = void 0 === k ? {} : k).borderTopWidth,
  4622. W = void 0 === B ? M : B,
  4623. P = n.borderBottom,
  4624. O = (P = void 0 === P ? {} : P).borderBottomWidth,
  4625. T = void 0 === O ? M : O,
  4626. L = n.borderRight,
  4627. R = (L = void 0 === L ? {} : L).borderRightWidth,
  4628. F = void 0 === R ? M : R,
  4629. A = n.borderLeft,
  4630. j = (A = void 0 === A ? {} : A).borderLeftWidth,
  4631. E = void 0 === j ? M : j,
  4632. C = s < 0 && l < 0 ? Math.abs(s + l) : 0,
  4633. H = c < 0 && u < 0 ? Math.abs(c + u) : 0,
  4634. D = s >= 0 && l < 0,
  4635. $ = c >= 0 && u < 0;
  4636. return i == a[0] && (this[i].left = t.left + s + v + E + (D ? 2 * -l : 0), this[i].top = t.top + c + x + W + ($ ? 2 * -u : 0), this[i].width = t.width + (this[i].widthAdd ? 0 : C), this[i].height = t.height + (this[i].heightAdd ? 0 : H), this[i].widthAdd = C, this[i].heightAdd = H), i == a[1] && (this[i].left = t.left + s + E + (D < 0 ? -l : 0), this[i].top = t.top + c + W + ($ ? -u : 0), this[i].width = t.width + v + w, this[i].height = t.height + x + S), i == a[2] && (this[i].left = t.left + s + E / 2 + (D < 0 ? -l : 0), this[i].top = t.top + c + W / 2 + ($ ? -u : 0), this[i].width = t.width + v + w + E / 2 + F / 2, this[i].height = t.height + x + S + T / 2 + W / 2), i == a[3] && (this[i].left = t.left + (D < 0 ? -l : 0), this[i].top = t.top + ($ ? -u : 0), this[i].width = t.width + v + w + E + F + s + l, this[i].height = t.height + x + S + T + W + u + c), this[i];
  4637. }, e.layoutBoxUpdate = function (t, e, i, n) {
  4638. var r = this;
  4639. if (void 0 === i && (i = -1), "border-box" == e.boxSizing) {
  4640. var o = e || {},
  4641. s = o.border,
  4642. h = (s = void 0 === s ? {} : s).borderWidth,
  4643. c = void 0 === h ? 0 : h,
  4644. f = o.borderTop,
  4645. l = (f = void 0 === f ? {} : f).borderTopWidth,
  4646. d = void 0 === l ? c : l,
  4647. u = o.borderBottom,
  4648. p = (u = void 0 === u ? {} : u).borderBottomWidth,
  4649. g = void 0 === p ? c : p,
  4650. v = o.borderRight,
  4651. y = (v = void 0 === v ? {} : v).borderRightWidth,
  4652. x = void 0 === y ? c : y,
  4653. b = o.borderLeft,
  4654. w = (b = void 0 === b ? {} : b).borderLeftWidth,
  4655. m = void 0 === w ? c : w,
  4656. S = o.padding,
  4657. z = (S = void 0 === S ? {} : S).paddingTop,
  4658. I = void 0 === z ? 0 : z,
  4659. M = S.paddingRight,
  4660. k = void 0 === M ? 0 : M,
  4661. B = S.paddingBottom,
  4662. W = void 0 === B ? 0 : B,
  4663. P = S.paddingLeft,
  4664. O = void 0 === P ? 0 : P;
  4665. i || (t.width -= O + k + x + m), 1 !== i || n || (t.height -= I + W + d + g);
  4666. }
  4667. this.layoutBox && (a.forEach(function (i) {
  4668. return r.layoutBox[i] = r.getOffsetSize(t, e, i);
  4669. }), this.layoutBox = Object.assign({}, this.layoutBox, this.layoutBox.borderSize));
  4670. }, e.getBoxPosition = function () {
  4671. var t = this.computedStyle,
  4672. e = this.fixedLine,
  4673. i = this.lines,
  4674. n = t.left,
  4675. r = void 0 === n ? 0 : n,
  4676. o = t.top,
  4677. s = void 0 === o ? 0 : o,
  4678. a = A({}, this.contentSize, {
  4679. left: r,
  4680. top: s
  4681. }),
  4682. h = this.contentSize.top - this.offsetSize.top,
  4683. c = this.contentSize.left - this.offsetSize.left;
  4684. if (this.root.fixedLine && !this.root.isDone) {
  4685. this.root.isDone = !0;
  4686. for (var f, l = C(this.root.fixedLine.elements); !(f = l()).done;) {
  4687. var d = f.value;
  4688. d.setPosition(d, this.root.offsetSize), d.getBoxPosition();
  4689. }
  4690. }
  4691. if (e) for (var u, p = C(e.elements); !(u = p()).done;) {
  4692. var g = u.value,
  4693. v = A({}, this.borderSize, {
  4694. left: r,
  4695. top: s
  4696. });
  4697. g.setPosition(g, v);
  4698. var y = this.borderSize.top - this.offsetSize.top,
  4699. x = this.borderSize.left - this.offsetSize.left;
  4700. g.style.left += r + x, g.style.top += s + y, g.getBoxPosition();
  4701. }
  4702. if (i) for (var b, w = C(i); !(b = w()).done;) {
  4703. b.value.layout(a.top + h, a.left + c);
  4704. }
  4705. return this.layoutBoxUpdate(a, t), this.layoutBox;
  4706. }, e.getBoxState = function (t, e) {
  4707. return this.isBlock(t) || this.isBlock(e);
  4708. }, e.isBlock = function (t) {
  4709. return void 0 === t && (t = this), t && t.style.display == at;
  4710. }, e.isFlex = function (t) {
  4711. return void 0 === t && (t = this), t && t.style.display == ct;
  4712. }, e.isInFlow = function () {
  4713. return !(this.isAbsolute || this.isFixed);
  4714. }, e.inFlexBox = function (t) {
  4715. return void 0 === t && (t = this), !!t.isInFlow() && !!t.parent && (!(!t.parent || t.parent.style.display !== ct) || void 0);
  4716. }, e.isInline = function (t) {
  4717. return void 0 === t && (t = this), t && t.style.display == ht;
  4718. }, e.contrastSize = function (t, e, i) {
  4719. var n = t;
  4720. return i && (n = Math.min(n, i)), e && (n = Math.max(n, e)), n;
  4721. }, e.measureText = function (t, e) {
  4722. var i = this.ctx.measureText(t),
  4723. n = i.width,
  4724. r = i.actualBoundingBoxAscent,
  4725. o = i.actualBoundingBoxDescent;
  4726. return {
  4727. ascent: r,
  4728. descent: o,
  4729. width: n,
  4730. fontHeight: r + o || .7 * e + 1
  4731. };
  4732. }, e.getParentSize = function (t, e) {
  4733. if (void 0 === t && (t = this), void 0 === e && (e = !1), t && t.parent) {
  4734. if (t.parent.contentSize.width) return t.parent.contentSize;
  4735. if (e) return this.getParentSize(t.parent, e);
  4736. }
  4737. return null;
  4738. }, e.getBoxWidthHeight = function () {
  4739. var t = this,
  4740. e = this.name,
  4741. i = this.computedStyle,
  4742. n = this.attributes,
  4743. r = this.parent,
  4744. o = void 0 === r ? {} : r,
  4745. s = this.ctx,
  4746. a = this.getChildren(),
  4747. h = i.left,
  4748. c = void 0 === h ? 0 : h,
  4749. f = i.top,
  4750. l = void 0 === f ? 0 : f,
  4751. d = i.bottom,
  4752. u = i.right,
  4753. p = i.width,
  4754. g = void 0 === p ? 0 : p,
  4755. v = i.minWidth,
  4756. y = i.maxWidth,
  4757. x = i.minHeight,
  4758. b = i.maxHeight,
  4759. w = i.height,
  4760. m = void 0 === w ? 0 : w,
  4761. S = i.fontSize,
  4762. z = i.fontWeight,
  4763. I = i.fontFamily,
  4764. M = i.fontStyle,
  4765. k = i.position;
  4766. i.textIndent;
  4767. var B = i.lineClamp,
  4768. P = i.lineHeight,
  4769. O = i.padding,
  4770. T = void 0 === O ? {} : O,
  4771. L = i.margin,
  4772. R = void 0 === L ? {} : L,
  4773. F = i.border,
  4774. A = (F = void 0 === F ? {} : F).borderWidth,
  4775. j = void 0 === A ? 0 : A,
  4776. E = i.borderRight,
  4777. C = (E = void 0 === E ? {} : E).borderRightWidth,
  4778. H = void 0 === C ? j : C,
  4779. Y = i.borderLeft,
  4780. U = (Y = void 0 === Y ? {} : Y).borderLeftWidth,
  4781. N = void 0 === U ? j : U,
  4782. X = o.contentSize && o.contentSize.width,
  4783. _ = o.contentSize && o.contentSize.height;
  4784. if ($(g) && X && (g = W(g, X)), $(g) && !X && (g = null), $(m) && _ && (m = W(m, _)), $(m) && !_ && (m = null), $(v) && X && (v = W(v, X)), $(y) && X && (y = W(y, X)), $(x) && _ && (x = W(x, _)), $(b) && _ && (b = W(b, _)), i.padding && X) for (var q in i.padding) {
  4785. Object.hasOwnProperty.call(T, q) && (T[q] = W(T[q], X));
  4786. }
  4787. var G = T.paddingRight,
  4788. V = void 0 === G ? 0 : G,
  4789. J = T.paddingLeft,
  4790. Q = void 0 === J ? 0 : J;
  4791. if (i.margin && [R.marginLeft, R.marginRight].includes("auto")) if (g) {
  4792. var Z = X && X - g - V - Q - N - H || 0;
  4793. R.marginLeft == R.marginRight ? R.marginLeft = R.marginRight = Z / 2 : D(R.marginLeft) ? R.marginLeft = Z : R.marginRight = Z;
  4794. } else R.marginLeft = R.marginRight = 0;
  4795. var K = R.marginRight,
  4796. tt = void 0 === K ? 0 : K,
  4797. it = R.marginLeft,
  4798. at = {
  4799. width: g,
  4800. height: m,
  4801. left: 0,
  4802. top: 0
  4803. },
  4804. ht = Q + V + N + H + (void 0 === it ? 0 : it) + tt;
  4805. if (this.offsetWidth = ht, e == ot && !this.attributes.widths) {
  4806. var ct = n.text || "";
  4807. s.save(), s.setFonts({
  4808. fontFamily: I,
  4809. fontSize: S,
  4810. fontWeight: z,
  4811. fontStyle: M
  4812. }), ct.length, "\n" == ct && (ct = "", this.isBr = !0), ("" + ct).split("\n").map(function (e) {
  4813. var i = Array.from(e).map(function (e) {
  4814. var i = "" + (/^[\u4e00-\u9fa5]+$/.test(e) ? "cn" : e) + I + S + z + M,
  4815. n = pt.get(i);
  4816. if (n) return {
  4817. width: n,
  4818. text: e
  4819. };
  4820. var r = t.measureText(e, S).width;
  4821. return pt.set(i, r), {
  4822. width: r,
  4823. text: e
  4824. };
  4825. }),
  4826. n = t.measureText(e, S),
  4827. r = n.fontHeight,
  4828. o = n.ascent,
  4829. s = n.descent;
  4830. t.attributes.fontHeight = r, t.attributes.ascent = o, t.attributes.descent = s, t.attributes.widths || (t.attributes.widths = []), t.attributes.widths.push({
  4831. widths: i,
  4832. total: i.reduce(function (t, e) {
  4833. return t + e.width;
  4834. }, 0)
  4835. });
  4836. }), s.restore();
  4837. }
  4838. if (e == rt && null == g) {
  4839. var lt = n.width,
  4840. dt = n.height;
  4841. at.width = this.contrastSize(Math.round(lt * m / dt) || 0, v, y), this.layoutBoxUpdate(at, i, 0);
  4842. }
  4843. if (e == ot && null == g) {
  4844. var ut = this.attributes.widths,
  4845. gt = Math.max.apply(Math, ut.map(function (t) {
  4846. return t.total;
  4847. }));
  4848. if (o && X > 0 && (gt > X || this.isBlock(this)) && !this.isAbsolute && !this.isFixed) gt = X;
  4849. at.width = this.contrastSize(gt, v, y), this.layoutBoxUpdate(at, i, 0);
  4850. }
  4851. if (e == ot && (o.style.flex || !this.attributes.lines)) {
  4852. var vt = this.attributes.widths.length;
  4853. this.attributes.widths.forEach(function (t) {
  4854. return t.widths.reduce(function (t, e, i) {
  4855. return t + e.width > at.width ? (vt++, e.width) : t + e.width;
  4856. }, 0);
  4857. }), vt = B && vt > B ? B : vt, this.attributes.lines = vt;
  4858. }
  4859. if (e == rt && null == m) {
  4860. var yt = n.width,
  4861. xt = n.height;
  4862. n.text, at.height = this.contrastSize(W(at.width * xt / yt) || 0, x, b), this.layoutBoxUpdate(at, i, 1);
  4863. }
  4864. e == ot && null == m && (P = W(P, S), at.height = this.contrastSize(W(this.attributes.lines * P), x, b), this.layoutBoxUpdate(at, i, 1, !0)), !g && o && o.children && X && (!this.isFlex(o) || o.isFlexCalc) && ([st, ot].includes(e) && this.isFlex() || e == st && this.isBlock(this) && this.isInFlow()) && (at.width = this.contrastSize(X - (o.isFlexCalc ? 0 : ht), v, y), this.layoutBoxUpdate(at, i)), g && !$(g) && (at.width = this.contrastSize(g, v, y), this.layoutBoxUpdate(at, i, 0)), m && !$(m) && (at.height = this.contrastSize(at.height, x, b), this.layoutBoxUpdate(at, i, 1));
  4865. var bt = 0;
  4866. if (a.length) {
  4867. var wt = null,
  4868. mt = !1;
  4869. a.forEach(function (e, n) {
  4870. e.getBoxWidthHeight();
  4871. var r = a[n + 1];
  4872. if (r && r.isInFlow() && (e.next = r), !t.line || !t.line.ids.includes(e.id)) if (e.isInFlow() && !e.inFlexBox()) {
  4873. var o = t.getBoxState(wt, e);
  4874. if (e.isBr) return mt = !0;
  4875. t.line && t.line.canIEnter(e) && !o && !mt ? t.line.add(e) : (mt = !1, new et().bind(e)), wt = e;
  4876. } else e.inFlexBox() ? t.line && (t.line.canIEnter(e) || "nowrap" == i.flexWrap) ? t.line.add(e) : new nt().bind(e) : e.isFixed ? t.root.fixedLine ? t.root.fixedLine.fixedAdd(e) : new et().fixedBind(e) : t.fixedLine ? t.fixedLine.fixedAdd(e) : new et().fixedBind(e, 1);
  4877. }), this.lines && (bt = this.lines.reduce(function (t, e) {
  4878. return t + e.height;
  4879. }, 0));
  4880. }
  4881. var St = 0,
  4882. zt = 0;
  4883. if (!g && (this.isAbsolute || this.isFixed) && X) {
  4884. var It = k == ft ? X : this.root.width,
  4885. Mt = It - ($(c) ? W(c, It) : c) - ($(u) ? W(u, It) : u);
  4886. St = i.left ? Mt : this.lineMaxWidth;
  4887. }
  4888. if (!m && (null != l ? l : this.isAbsolute || this.isFixed && _)) {
  4889. var kt = k == ft ? _ : this.root.height,
  4890. Bt = kt - ($(l) ? W(l, kt) : l) - ($(d) ? W(d, kt) : d);
  4891. zt = i.top ? Bt : 0;
  4892. }
  4893. if (g && !$(g) || at.width || (at.width = St || this.contrastSize((this.isBlock(this) && !this.isInFlow() ? X || o.lineMaxWidth : this.lineMaxWidth) || this.lineMaxWidth, v, y), this.layoutBoxUpdate(at, i, 0)), m || !bt && !zt || (at.height = zt || this.contrastSize(bt, x, b), this.layoutBoxUpdate(at, i)), i.borderRadius && this.borderSize && this.borderSize.width) for (var q in i.borderRadius) {
  4894. Object.hasOwnProperty.call(i.borderRadius, q) && (i.borderRadius[q] = W(i.borderRadius[q], this.borderSize.width));
  4895. }
  4896. return this.layoutBox;
  4897. }, e.layout = function () {
  4898. return this.getBoxWidthHeight(), this.root.offsetSize = this.offsetSize, this.root.contentSize = this.contentSize, this.getBoxPosition(), this.offsetSize;
  4899. }, t;
  4900. }(),
  4901. vt = function () {
  4902. var t,
  4903. e,
  4904. i,
  4905. n,
  4906. r,
  4907. o,
  4908. s = [0, 11, 15, 19, 23, 27, 31, 16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24, 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28],
  4909. a = [3220, 1468, 2713, 1235, 3062, 1890, 2119, 1549, 2344, 2936, 1117, 2583, 1330, 2470, 1667, 2249, 2028, 3780, 481, 4011, 142, 3098, 831, 3445, 592, 2517, 1776, 2234, 1951, 2827, 1070, 2660, 1345, 3177],
  4910. h = [30660, 29427, 32170, 30877, 26159, 25368, 27713, 26998, 21522, 20773, 24188, 23371, 17913, 16590, 20375, 19104, 13663, 12392, 16177, 14854, 9396, 8579, 11994, 11245, 5769, 5054, 7399, 6608, 1890, 597, 3340, 2107],
  4911. c = [1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17, 1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28, 1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22, 1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16, 1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22, 2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28, 2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26, 2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26, 2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24, 2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28, 4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24, 2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28, 4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22, 3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24, 5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24, 5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30, 1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28, 5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28, 3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26, 3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28, 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30, 2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24, 4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30, 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30, 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30, 10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30, 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30, 7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30, 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30, 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30, 17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30, 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30, 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, 12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30, 6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30, 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30, 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30, 20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30, 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30],
  4912. f = [255, 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175],
  4913. l = [1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 0],
  4914. d = [],
  4915. u = [],
  4916. p = [],
  4917. g = [],
  4918. v = [],
  4919. y = 2;
  4920. function x(t, e) {
  4921. var i;
  4922. t > e && (i = t, t = e, e = i), i = e, i *= e, i += e, i >>= 1, g[i += t] = 1;
  4923. }
  4924. function b(t, i) {
  4925. var n;
  4926. for (p[t + e * i] = 1, n = -2; n < 2; n++) {
  4927. p[t + n + e * (i - 2)] = 1, p[t - 2 + e * (i + n + 1)] = 1, p[t + 2 + e * (i + n)] = 1, p[t + n + 1 + e * (i + 2)] = 1;
  4928. }
  4929. for (n = 0; n < 2; n++) {
  4930. x(t - 1, i + n), x(t + 1, i - n), x(t - n, i - 1), x(t + n, i + 1);
  4931. }
  4932. }
  4933. function w(t) {
  4934. for (; t >= 255;) {
  4935. t = ((t -= 255) >> 8) + (255 & t);
  4936. }
  4937. return t;
  4938. }
  4939. var m = [];
  4940. function S(t, e, i, n) {
  4941. var r, o, s;
  4942. for (r = 0; r < n; r++) {
  4943. d[i + r] = 0;
  4944. }
  4945. for (r = 0; r < e; r++) {
  4946. if (255 != (s = f[d[t + r] ^ d[i]])) for (o = 1; o < n; o++) {
  4947. d[i + o - 1] = d[i + o] ^ l[w(s + m[n - o])];
  4948. } else for (o = i; o < i + n; o++) {
  4949. d[o] = d[o + 1];
  4950. }
  4951. d[i + n - 1] = 255 == s ? 0 : l[w(s + m[0])];
  4952. }
  4953. }
  4954. function z(t, e) {
  4955. var i;
  4956. return t > e && (i = t, t = e, e = i), i = e, i += e * e, i >>= 1, g[i += t];
  4957. }
  4958. function I(t) {
  4959. var i, n, r, o;
  4960. switch (t) {
  4961. case 0:
  4962. for (n = 0; n < e; n++) {
  4963. for (i = 0; i < e; i++) {
  4964. i + n & 1 || z(i, n) || (p[i + n * e] ^= 1);
  4965. }
  4966. }
  4967. break;
  4968. case 1:
  4969. for (n = 0; n < e; n++) {
  4970. for (i = 0; i < e; i++) {
  4971. 1 & n || z(i, n) || (p[i + n * e] ^= 1);
  4972. }
  4973. }
  4974. break;
  4975. case 2:
  4976. for (n = 0; n < e; n++) {
  4977. for (r = 0, i = 0; i < e; i++, r++) {
  4978. 3 == r && (r = 0), r || z(i, n) || (p[i + n * e] ^= 1);
  4979. }
  4980. }
  4981. break;
  4982. case 3:
  4983. for (o = 0, n = 0; n < e; n++, o++) {
  4984. for (3 == o && (o = 0), r = o, i = 0; i < e; i++, r++) {
  4985. 3 == r && (r = 0), r || z(i, n) || (p[i + n * e] ^= 1);
  4986. }
  4987. }
  4988. break;
  4989. case 4:
  4990. for (n = 0; n < e; n++) {
  4991. for (r = 0, o = n >> 1 & 1, i = 0; i < e; i++, r++) {
  4992. 3 == r && (r = 0, o = !o), o || z(i, n) || (p[i + n * e] ^= 1);
  4993. }
  4994. }
  4995. break;
  4996. case 5:
  4997. for (o = 0, n = 0; n < e; n++, o++) {
  4998. for (3 == o && (o = 0), r = 0, i = 0; i < e; i++, r++) {
  4999. 3 == r && (r = 0), (i & n & 1) + !(!r | !o) || z(i, n) || (p[i + n * e] ^= 1);
  5000. }
  5001. }
  5002. break;
  5003. case 6:
  5004. for (o = 0, n = 0; n < e; n++, o++) {
  5005. for (3 == o && (o = 0), r = 0, i = 0; i < e; i++, r++) {
  5006. 3 == r && (r = 0), (i & n & 1) + (r && r == o) & 1 || z(i, n) || (p[i + n * e] ^= 1);
  5007. }
  5008. }
  5009. break;
  5010. case 7:
  5011. for (o = 0, n = 0; n < e; n++, o++) {
  5012. for (3 == o && (o = 0), r = 0, i = 0; i < e; i++, r++) {
  5013. 3 == r && (r = 0), (r && r == o) + (i + n & 1) & 1 || z(i, n) || (p[i + n * e] ^= 1);
  5014. }
  5015. }
  5016. }
  5017. }
  5018. function M(t) {
  5019. var e,
  5020. i = 0;
  5021. for (e = 0; e <= t; e++) {
  5022. v[e] >= 5 && (i += 3 + v[e] - 5);
  5023. }
  5024. for (e = 3; e < t - 1; e += 2) {
  5025. v[e - 2] == v[e + 2] && v[e + 2] == v[e - 1] && v[e - 1] == v[e + 1] && 3 * v[e - 1] == v[e] && (0 == v[e - 3] || e + 3 > t || 3 * v[e - 3] >= 4 * v[e] || 3 * v[e + 3] >= 4 * v[e]) && (i += 40);
  5026. }
  5027. return i;
  5028. }
  5029. function k() {
  5030. var t,
  5031. i,
  5032. n,
  5033. r,
  5034. o,
  5035. s = 0,
  5036. a = 0;
  5037. for (i = 0; i < e - 1; i++) {
  5038. for (t = 0; t < e - 1; t++) {
  5039. (p[t + e * i] && p[t + 1 + e * i] && p[t + e * (i + 1)] && p[t + 1 + e * (i + 1)] || !(p[t + e * i] || p[t + 1 + e * i] || p[t + e * (i + 1)] || p[t + 1 + e * (i + 1)])) && (s += 3);
  5040. }
  5041. }
  5042. for (i = 0; i < e; i++) {
  5043. for (v[0] = 0, n = r = t = 0; t < e; t++) {
  5044. (o = p[t + e * i]) == r ? v[n]++ : v[++n] = 1, a += (r = o) ? 1 : -1;
  5045. }
  5046. s += M(n);
  5047. }
  5048. a < 0 && (a = -a);
  5049. var h = a,
  5050. c = 0;
  5051. for (h += h << 2, h <<= 1; h > e * e;) {
  5052. h -= e * e, c++;
  5053. }
  5054. for (s += 10 * c, t = 0; t < e; t++) {
  5055. for (v[0] = 0, n = r = i = 0; i < e; i++) {
  5056. (o = p[t + e * i]) == r ? v[n]++ : v[++n] = 1, r = o;
  5057. }
  5058. s += M(n);
  5059. }
  5060. return s;
  5061. }
  5062. var B = null;
  5063. return {
  5064. api: {
  5065. get ecclevel() {
  5066. return y;
  5067. },
  5068. set ecclevel(t) {
  5069. y = t;
  5070. },
  5071. get size() {
  5072. return _size;
  5073. },
  5074. set size(t) {
  5075. _size = t;
  5076. },
  5077. get canvas() {
  5078. return B;
  5079. },
  5080. set canvas(t) {
  5081. B = t;
  5082. },
  5083. getFrame: function getFrame(v) {
  5084. return function (v) {
  5085. var M, B, W, P, O, T, L, R;
  5086. P = v.length, t = 0;
  5087. do {
  5088. if (t++, W = 4 * (y - 1) + 16 * (t - 1), i = c[W++], n = c[W++], r = c[W++], o = c[W], P <= (W = r * (i + n) + n - 3 + (t <= 9))) break;
  5089. } while (t < 40);
  5090. for (e = 17 + 4 * t, O = r + (r + o) * (i + n) + n, P = 0; P < O; P++) {
  5091. u[P] = 0;
  5092. }
  5093. for (d = v.slice(0), P = 0; P < e * e; P++) {
  5094. p[P] = 0;
  5095. }
  5096. for (P = 0; P < (e * (e + 1) + 1) / 2; P++) {
  5097. g[P] = 0;
  5098. }
  5099. for (P = 0; P < 3; P++) {
  5100. for (W = 0, B = 0, 1 == P && (W = e - 7), 2 == P && (B = e - 7), p[B + 3 + e * (W + 3)] = 1, M = 0; M < 6; M++) {
  5101. p[B + M + e * W] = 1, p[B + e * (W + M + 1)] = 1, p[B + 6 + e * (W + M)] = 1, p[B + M + 1 + e * (W + 6)] = 1;
  5102. }
  5103. for (M = 1; M < 5; M++) {
  5104. x(B + M, W + 1), x(B + 1, W + M + 1), x(B + 5, W + M), x(B + M + 1, W + 5);
  5105. }
  5106. for (M = 2; M < 4; M++) {
  5107. p[B + M + e * (W + 2)] = 1, p[B + 2 + e * (W + M + 1)] = 1, p[B + 4 + e * (W + M)] = 1, p[B + M + 1 + e * (W + 4)] = 1;
  5108. }
  5109. }
  5110. if (t > 1) for (P = s[t], B = e - 7;;) {
  5111. for (M = e - 7; M > P - 3 && (b(M, B), !(M < P));) {
  5112. M -= P;
  5113. }
  5114. if (B <= P + 9) break;
  5115. b(6, B -= P), b(B, 6);
  5116. }
  5117. for (p[8 + e * (e - 8)] = 1, B = 0; B < 7; B++) {
  5118. x(7, B), x(e - 8, B), x(7, B + e - 7);
  5119. }
  5120. for (M = 0; M < 8; M++) {
  5121. x(M, 7), x(M + e - 8, 7), x(M, e - 8);
  5122. }
  5123. for (M = 0; M < 9; M++) {
  5124. x(M, 8);
  5125. }
  5126. for (M = 0; M < 8; M++) {
  5127. x(M + e - 8, 8), x(8, M);
  5128. }
  5129. for (B = 0; B < 7; B++) {
  5130. x(8, B + e - 7);
  5131. }
  5132. for (M = 0; M < e - 14; M++) {
  5133. 1 & M ? (x(8 + M, 6), x(6, 8 + M)) : (p[8 + M + 6 * e] = 1, p[6 + e * (8 + M)] = 1);
  5134. }
  5135. if (t > 6) for (P = a[t - 7], W = 17, M = 0; M < 6; M++) {
  5136. for (B = 0; B < 3; B++, W--) {
  5137. 1 & (W > 11 ? t >> W - 12 : P >> W) ? (p[5 - M + e * (2 - B + e - 11)] = 1, p[2 - B + e - 11 + e * (5 - M)] = 1) : (x(5 - M, 2 - B + e - 11), x(2 - B + e - 11, 5 - M));
  5138. }
  5139. }
  5140. for (B = 0; B < e; B++) {
  5141. for (M = 0; M <= B; M++) {
  5142. p[M + e * B] && x(M, B);
  5143. }
  5144. }
  5145. for (O = d.length, T = 0; T < O; T++) {
  5146. u[T] = d.charCodeAt(T);
  5147. }
  5148. if (d = u.slice(0), O >= (M = r * (i + n) + n) - 2 && (O = M - 2, t > 9 && O--), T = O, t > 9) {
  5149. for (d[T + 2] = 0, d[T + 3] = 0; T--;) {
  5150. P = d[T], d[T + 3] |= 255 & P << 4, d[T + 2] = P >> 4;
  5151. }
  5152. d[2] |= 255 & O << 4, d[1] = O >> 4, d[0] = 64 | O >> 12;
  5153. } else {
  5154. for (d[T + 1] = 0, d[T + 2] = 0; T--;) {
  5155. P = d[T], d[T + 2] |= 255 & P << 4, d[T + 1] = P >> 4;
  5156. }
  5157. d[1] |= 255 & O << 4, d[0] = 64 | O >> 4;
  5158. }
  5159. for (T = O + 3 - (t < 10); T < M;) {
  5160. d[T++] = 236, d[T++] = 17;
  5161. }
  5162. for (m[0] = 1, T = 0; T < o; T++) {
  5163. for (m[T + 1] = 1, L = T; L > 0; L--) {
  5164. m[L] = m[L] ? m[L - 1] ^ l[w(f[m[L]] + T)] : m[L - 1];
  5165. }
  5166. m[0] = l[w(f[m[0]] + T)];
  5167. }
  5168. for (T = 0; T <= o; T++) {
  5169. m[T] = f[m[T]];
  5170. }
  5171. for (W = M, B = 0, T = 0; T < i; T++) {
  5172. S(B, r, W, o), B += r, W += o;
  5173. }
  5174. for (T = 0; T < n; T++) {
  5175. S(B, r + 1, W, o), B += r + 1, W += o;
  5176. }
  5177. for (B = 0, T = 0; T < r; T++) {
  5178. for (L = 0; L < i; L++) {
  5179. u[B++] = d[T + L * r];
  5180. }
  5181. for (L = 0; L < n; L++) {
  5182. u[B++] = d[i * r + T + L * (r + 1)];
  5183. }
  5184. }
  5185. for (L = 0; L < n; L++) {
  5186. u[B++] = d[i * r + T + L * (r + 1)];
  5187. }
  5188. for (T = 0; T < o; T++) {
  5189. for (L = 0; L < i + n; L++) {
  5190. u[B++] = d[M + T + L * o];
  5191. }
  5192. }
  5193. for (d = u, M = B = e - 1, W = O = 1, R = (r + o) * (i + n) + n, T = 0; T < R; T++) {
  5194. for (P = d[T], L = 0; L < 8; L++, P <<= 1) {
  5195. 128 & P && (p[M + e * B] = 1);
  5196. do {
  5197. O ? M-- : (M++, W ? 0 != B ? B-- : (W = !W, 6 == (M -= 2) && (M--, B = 9)) : B != e - 1 ? B++ : (W = !W, 6 == (M -= 2) && (M--, B -= 8))), O = !O;
  5198. } while (z(M, B));
  5199. }
  5200. }
  5201. for (d = p.slice(0), P = 0, B = 3e4, W = 0; W < 8 && (I(W), (M = k()) < B && (B = M, P = W), 7 != P); W++) {
  5202. p = d.slice(0);
  5203. }
  5204. for (P != W && I(P), B = h[P + (y - 1 << 3)], W = 0; W < 8; W++, B >>= 1) {
  5205. 1 & B && (p[e - 1 - W + 8 * e] = 1, W < 6 ? p[8 + e * W] = 1 : p[8 + e * (W + 1)] = 1);
  5206. }
  5207. for (W = 0; W < 7; W++, B >>= 1) {
  5208. 1 & B && (p[8 + e * (e - 7 + W)] = 1, W ? p[6 - W + 8 * e] = 1 : p[7 + 8 * e] = 1);
  5209. }
  5210. return p;
  5211. }(v);
  5212. },
  5213. utf16to8: function utf16to8(t) {
  5214. var e, i, n, r;
  5215. for (e = "", n = t.length, i = 0; i < n; i++) {
  5216. (r = t.charCodeAt(i)) >= 1 && r <= 127 ? e += t.charAt(i) : r > 2047 ? (e += String.fromCharCode(224 | r >> 12 & 15), e += String.fromCharCode(128 | r >> 6 & 63), e += String.fromCharCode(128 | r >> 0 & 63)) : (e += String.fromCharCode(192 | r >> 6 & 31), e += String.fromCharCode(128 | r >> 0 & 63));
  5217. }
  5218. return e;
  5219. },
  5220. draw: function draw(t, i, n, r, o) {
  5221. i.drawView(n, r);
  5222. var s = i.ctx,
  5223. a = n.contentSize,
  5224. h = a.width,
  5225. c = a.height,
  5226. f = a.left,
  5227. l = a.top;
  5228. r.borderRadius, r.backgroundColor;
  5229. var d = r.color,
  5230. u = void 0 === d ? "#000000" : d;
  5231. r.border, n.contentSize.left, n.borderSize.left, n.contentSize.top, n.borderSize.top;
  5232. if (y = o || y, s) {
  5233. s.save(), i.setOpacity(r), i.setTransform(n, r);
  5234. var p = Math.min(h, c);
  5235. t = this.utf16to8(t);
  5236. var g = this.getFrame(t),
  5237. v = p / e;
  5238. s.setFillStyle(u);
  5239. for (var x = 0; x < e; x++) {
  5240. for (var b = 0; b < e; b++) {
  5241. g[b * e + x] && s.fillRect(f + v * x, l + v * b, v, v);
  5242. }
  5243. }
  5244. s.restore(), i.setBorder(n, r);
  5245. } else console.warn("No canvas provided to draw QR code in!");
  5246. }
  5247. }
  5248. };
  5249. }(),
  5250. yt = p,
  5251. xt = u,
  5252. bt = g,
  5253. wt = d,
  5254. mt = f.TOP,
  5255. St = f.MIDDLE,
  5256. zt = f.BOTTOM,
  5257. It = l.LEFT,
  5258. Mt = l.CENTER,
  5259. kt = l.RIGHT,
  5260. Bt = function () {
  5261. function r(t) {
  5262. var e,
  5263. i,
  5264. r = this;
  5265. this.v = "1.9.5.1", this.id = null, this.pixelRatio = 1, this.width = 0, this.height = 0, this.sleep = 1e3 / 30, this.count = 0, this.isRate = !1, this.isDraw = !0, this.isCache = !0, this.fixed = "", this.useCORS = !1, this.performance = !1, this.imageBus = [], this.createImage = function (t, e) {
  5266. return new Promise(function (i, n) {
  5267. var o = null;
  5268. window || r.canvas.createImage ? (o = r.canvas && r.canvas.createImage ? r.canvas.createImage() : new Image(), e && o.setAttribute("crossOrigin", "Anonymous"), o.src = t, o.onload = function () {
  5269. i({
  5270. width: o.naturalWidth || o.width,
  5271. height: o.naturalHeight || o.height,
  5272. path: o,
  5273. src: this.src
  5274. });
  5275. }, o.onerror = function (t) {
  5276. n(t);
  5277. }) : n({
  5278. fail: "getImageInfo fail",
  5279. src: t
  5280. });
  5281. });
  5282. }, this.options = t, Object.assign(this, t), this.ctx = (e = t.context, i = {
  5283. get: function get(t, i) {
  5284. if ("setFonts" === i) return function (t) {
  5285. var i = t.fontFamily,
  5286. r = void 0 === i ? "sans-serif" : i,
  5287. o = t.fontSize,
  5288. s = void 0 === o ? 14 : o,
  5289. a = t.fontWeight,
  5290. h = void 0 === a ? "normal" : a,
  5291. c = t.fontStyle,
  5292. f = void 0 === c ? "normal" : c;
  5293. I == n.MP_TOUTIAO && (h = "bold" == h ? "bold" : "", f = "italic" == f ? "italic" : ""), e.font = "".concat(f, " ").concat(h, " ").concat(Math.round(s), "px ").concat(r);
  5294. };
  5295. if (!e.draw || !e.setFillStyle) {
  5296. if ("setFillStyle" === i) return function (t) {
  5297. e.fillStyle = t;
  5298. };
  5299. if ("setStrokeStyle" === i) return function (t) {
  5300. e.strokeStyle = t;
  5301. };
  5302. if ("setLineWidth" === i) return function (t) {
  5303. e.lineWidth = t;
  5304. };
  5305. if ("setLineCap" === i) return function (t) {
  5306. e.lineCap = t;
  5307. };
  5308. if ("setFontSize" === i) return function (t) {
  5309. e.font = "".concat(String(t), "px sans-serif");
  5310. };
  5311. if ("setGlobalAlpha" === i) return function (t) {
  5312. e.globalAlpha = t;
  5313. };
  5314. if ("setLineJoin" === i) return function (t) {
  5315. e.lineJoin = t;
  5316. };
  5317. if ("setTextAlign" === i) return function (t) {
  5318. e.textAlign = t;
  5319. };
  5320. if ("setMiterLimit" === i) return function (t) {
  5321. e.miterLimit = t;
  5322. };
  5323. if ("setShadow" === i) return function (t, i, n, r) {
  5324. e.shadowOffsetX = t, e.shadowOffsetY = i, e.shadowBlur = n, e.shadowColor = r;
  5325. };
  5326. if ("setTextBaseline" === i) return function (t) {
  5327. e.textBaseline = t;
  5328. };
  5329. if ("createCircularGradient" === i) return function () {};
  5330. if ("draw" === i) return function () {};
  5331. if ("function" == typeof e[i]) return function () {
  5332. for (var t = [], n = 0; n < arguments.length; n++) {
  5333. t[n] = arguments[n];
  5334. }
  5335. return e[i].apply(e, t);
  5336. };
  5337. }
  5338. return t[i];
  5339. },
  5340. set: function set(t, i, n) {
  5341. return e[i] = n, !0;
  5342. }
  5343. }, new Proxy(e, i)), this.progress = 0, this.root = {
  5344. width: t.width,
  5345. height: t.height,
  5346. fontSizeRate: 1,
  5347. fixedLine: null
  5348. }, this.size = this.root;
  5349. var o = 0;
  5350. Object.defineProperty(this, "progress", {
  5351. configurable: !0,
  5352. set: function set(t) {
  5353. o = t, r.lifecycle("onProgress", t / r.count);
  5354. },
  5355. get: function get() {
  5356. return o || 0;
  5357. }
  5358. });
  5359. }
  5360. return r.prototype.lifecycle = function (t, e) {
  5361. this.options.listen && this.options.listen[t] && this.options.listen[t](e);
  5362. }, r.prototype.setContext = function (t) {
  5363. t && (this.ctx = t);
  5364. }, r.prototype.init = function () {
  5365. if (this.canvas.height || n.WEB == I) {
  5366. this.ctx.setTransform(1, 0, 0, 1, 0, 0);
  5367. var t = this.size.height * this.pixelRatio,
  5368. e = this.size.width * this.pixelRatio;
  5369. this.canvas.height = t, this.canvas.width = e, this.ctx.scale(this.pixelRatio, this.pixelRatio);
  5370. }
  5371. }, r.prototype.clear = function () {
  5372. this.ctx.clearRect(0, 0, this.size.width, this.size.height);
  5373. }, r.prototype.clipPath = function (t, e, i, n, r, o, s) {
  5374. void 0 === o && (o = !1), void 0 === s && (s = !1);
  5375. var a = this.ctx;
  5376. if (/polygon/.test(r)) {
  5377. var h = r.match(/-?\d+(rpx|px|%)?\s+-?\d+(rpx|px|%)?/g) || [];
  5378. a.beginPath(), h.map(function (r) {
  5379. var o = r.split(" "),
  5380. s = o[0],
  5381. a = o[1];
  5382. return [W(s, i) + t, W(a, n) + e];
  5383. }).forEach(function (t, e) {
  5384. 0 == e ? a.moveTo(t[0], t[1]) : a.lineTo(t[0], t[1]);
  5385. }), a.closePath(), s && a.stroke(), o && a.fill();
  5386. }
  5387. }, r.prototype.roundRect = function (t, e, i, n, r, o, s) {
  5388. if (void 0 === o && (o = !1), void 0 === s && (s = !1), !(r < 0)) {
  5389. var a = this.ctx;
  5390. if (a.beginPath(), r) {
  5391. var h = r || {},
  5392. c = h.borderTopLeftRadius,
  5393. f = void 0 === c ? r || 0 : c,
  5394. l = h.borderTopRightRadius,
  5395. d = void 0 === l ? r || 0 : l,
  5396. u = h.borderBottomRightRadius,
  5397. p = void 0 === u ? r || 0 : u,
  5398. g = h.borderBottomLeftRadius,
  5399. v = void 0 === g ? r || 0 : g;
  5400. a.arc(t + i - p, e + n - p, p, 0, .5 * Math.PI), a.lineTo(t + v, e + n), a.arc(t + v, e + n - v, v, .5 * Math.PI, Math.PI), a.lineTo(t, e + f), a.arc(t + f, e + f, f, Math.PI, 1.5 * Math.PI), a.lineTo(t + i - d, e), a.arc(t + i - d, e + d, d, 1.5 * Math.PI, 2 * Math.PI), a.lineTo(t + i, e + n - p);
  5401. } else a.rect(t, e, i, n);
  5402. a.closePath(), s && a.stroke(), o && a.fill();
  5403. }
  5404. }, r.prototype.setTransform = function (t, e) {
  5405. var i = e.transform,
  5406. n = e.transformOrigin,
  5407. r = this.ctx,
  5408. o = i || {},
  5409. s = o.scaleX,
  5410. a = void 0 === s ? 1 : s,
  5411. h = o.scaleY,
  5412. c = void 0 === h ? 1 : h,
  5413. f = o.translateX,
  5414. l = void 0 === f ? 0 : f,
  5415. d = o.translateY,
  5416. u = void 0 === d ? 0 : d,
  5417. p = o.rotate,
  5418. g = void 0 === p ? 0 : p,
  5419. v = o.skewX,
  5420. y = void 0 === v ? 0 : v,
  5421. x = o.skewY,
  5422. b = void 0 === x ? 0 : x,
  5423. w = t.left,
  5424. m = t.top,
  5425. S = t.width,
  5426. z = t.height;
  5427. l = W(l, S) || 0, u = W(u, z) || 0;
  5428. var I = W("0%", 1),
  5429. M = W("50%", 1),
  5430. k = W("100%", 1),
  5431. P = {
  5432. top: I,
  5433. center: M,
  5434. bottom: k
  5435. },
  5436. O = {
  5437. left: I,
  5438. center: M,
  5439. right: k
  5440. };
  5441. if (n = n.split(" ").filter(function (t, e) {
  5442. return e < 2;
  5443. }).reduce(function (t, e) {
  5444. if (/\d+/.test(e)) {
  5445. var i = W(e, 1) / (/px|rpx$/.test(e) ? B(t.x) ? z : S : 1);
  5446. return B(t.x) ? Object.assign(t, {
  5447. y: i
  5448. }) : Object.assign(t, {
  5449. x: i
  5450. });
  5451. }
  5452. return B(O[e]) && !B(t.x) ? Object.assign(t, {
  5453. x: O[e]
  5454. }) : Object.assign(t, {
  5455. y: P[e] || .5
  5456. });
  5457. }, {}), (l || u) && r.translate(l, u), (a || c) && r.scale(a, c), g) {
  5458. var T = w + S * n.x,
  5459. L = m + z * n.y;
  5460. r.translate(T, L), r.rotate(g * Math.PI / 180), r.translate(-T, -L);
  5461. }
  5462. (y || b) && r.transform(1, Math.tan(b * Math.PI / 180), Math.tan(y * Math.PI / 180), 1, 0, 0);
  5463. }, r.prototype.setBackground = function (t, e, i, r, o) {
  5464. var s = this.ctx;
  5465. t && "transparent" != t ? T(t) ? L(t, e, i, r, o, s) : s.setFillStyle(t) : [n.MP_TOUTIAO, n.MP_BAIDU].includes(I) ? s.setFillStyle("rgba(0,0,0,0)") : s.setFillStyle("transparent");
  5466. }, r.prototype.setShadow = function (t) {
  5467. var e = t.boxShadow,
  5468. i = void 0 === e ? [] : e,
  5469. n = this.ctx;
  5470. if (i.length) {
  5471. var r = i[0],
  5472. o = i[1],
  5473. s = i[2],
  5474. a = i[3];
  5475. n.setShadow(r, o, s, a);
  5476. }
  5477. }, r.prototype.setBorder = function (t, e) {
  5478. var i = this.ctx,
  5479. n = t.width,
  5480. r = t.height,
  5481. o = t.left,
  5482. s = t.top,
  5483. a = e.border,
  5484. h = e.borderBottom,
  5485. c = e.borderTop,
  5486. f = e.borderRight,
  5487. l = e.borderLeft,
  5488. d = e.borderRadius,
  5489. u = e.lineCap,
  5490. p = a || {},
  5491. g = p.borderWidth,
  5492. v = void 0 === g ? 0 : g,
  5493. y = p.borderStyle,
  5494. x = p.borderColor,
  5495. b = h || {},
  5496. w = b.borderBottomWidth,
  5497. m = void 0 === w ? v : w,
  5498. S = b.borderBottomStyle,
  5499. z = void 0 === S ? y : S,
  5500. M = b.borderBottomColor,
  5501. k = void 0 === M ? x : M,
  5502. B = c || {},
  5503. W = B.borderTopWidth,
  5504. P = void 0 === W ? v : W,
  5505. O = B.borderTopStyle,
  5506. T = void 0 === O ? y : O,
  5507. L = B.borderTopColor,
  5508. R = void 0 === L ? x : L,
  5509. F = f || {},
  5510. A = F.borderRightWidth,
  5511. j = void 0 === A ? v : A,
  5512. E = F.borderRightStyle,
  5513. C = void 0 === E ? y : E,
  5514. H = F.borderRightColor,
  5515. D = void 0 === H ? x : H,
  5516. $ = l || {},
  5517. Y = $.borderLeftWidth,
  5518. U = void 0 === Y ? v : Y,
  5519. N = $.borderLeftStyle,
  5520. X = void 0 === N ? y : N,
  5521. _ = $.borderLeftColor,
  5522. q = void 0 === _ ? x : _,
  5523. G = d || {},
  5524. V = G.borderTopLeftRadius,
  5525. J = void 0 === V ? d || 0 : V,
  5526. Q = G.borderTopRightRadius,
  5527. Z = void 0 === Q ? d || 0 : Q,
  5528. K = G.borderBottomRightRadius,
  5529. tt = void 0 === K ? d || 0 : K,
  5530. et = G.borderBottomLeftRadius,
  5531. it = void 0 === et ? d || 0 : et;
  5532. if (h || l || c || f || a) {
  5533. var nt = function nt(t, e, n) {
  5534. "dashed" == e ? /mp/.test(I) ? i.setLineDash([Math.ceil(4 * t / 3), Math.ceil(4 * t / 3)]) : i.setLineDash([Math.ceil(6 * t), Math.ceil(6 * t)]) : "dotted" == e && i.setLineDash([t, t]), i.setStrokeStyle(n);
  5535. },
  5536. rt = function rt(t, e, n, r, o, s, a, h, c, f, l, d, p, g, v) {
  5537. i.save(), i.setLineCap(v ? "square" : u), i.setLineWidth(d), nt(d, p, g), i.beginPath(), i.arc(t, e, a, Math.PI * c, Math.PI * f), i.lineTo(n, r), i.arc(o, s, h, Math.PI * f, Math.PI * l), i.stroke(), i.restore();
  5538. };
  5539. if (i.save(), a && !h && !l && !c && !f) return i.setLineWidth(v), nt(v, y, x), this.roundRect(o, s, n, r, d, !1, !!x), void i.restore();
  5540. m && rt(o + n - tt, s + r - tt, o + it, s + r, o + it, s + r - it, tt, it, .25, .5, .75, m, z, k, U && j), U && rt(o + it, s + r - it, o, s + J, o + J, s + J, it, J, .75, 1, 1.25, U, X, q, P && m), P && rt(o + J, s + J, o + n - Z, s, o + n - Z, s + Z, J, Z, 1.25, 1.5, 1.75, P, T, R, U && j), j && rt(o + n - Z, s + Z, o + n, s + r - tt, o + n - tt, s + r - tt, Z, tt, 1.75, 2, .25, j, C, D, P && m);
  5541. }
  5542. }, r.prototype.setOpacity = function (t) {
  5543. var e = t.opacity,
  5544. i = void 0 === e ? 1 : e;
  5545. this.ctx.setGlobalAlpha(i);
  5546. }, r.prototype.drawPattern = function (t, n, r) {
  5547. return e(this, void 0, void 0, function () {
  5548. var e = this;
  5549. return i(this, function (i) {
  5550. return [2, new Promise(function (i, o) {
  5551. e.drawView(n, r, !0, !1, !0);
  5552. var s = e,
  5553. a = s.ctx;
  5554. s.canvas;
  5555. var h = n.width,
  5556. c = n.height,
  5557. f = n.left,
  5558. l = n.top,
  5559. d = r || {},
  5560. u = d.borderRadius,
  5561. p = void 0 === u ? 0 : u,
  5562. g = d.backgroundImage,
  5563. v = d.backgroundRepeat,
  5564. y = void 0 === v ? "repeat" : v;
  5565. g && function (t) {
  5566. var o = a.createPattern(t.src, y);
  5567. a.setFillStyle(o), e.roundRect(f, l, h, c, p, !0, !1), e.setBorder(n, r), i();
  5568. }(t);
  5569. })];
  5570. });
  5571. });
  5572. }, r.prototype.drawView = function (t, e, i, n, r) {
  5573. void 0 === i && (i = !0), void 0 === n && (n = !0), void 0 === r && (r = !0);
  5574. var o = this.ctx,
  5575. s = t.width,
  5576. a = t.height,
  5577. h = t.left,
  5578. c = t.top,
  5579. f = e || {},
  5580. l = f.borderRadius,
  5581. d = void 0 === l ? 0 : l,
  5582. u = f.backgroundColor,
  5583. p = void 0 === u ? "transparent" : u,
  5584. g = f.overflow;
  5585. e.opacity && this.setOpacity(e), this.setTransform(t, e), r && (o.save(), this.setShadow(e)), i && this.setBackground(p, s, a, h, c), e.clipPath ? this.clipPath(h, c, s, a, e.clipPath, i, !1) : this.roundRect(h, c, s, a, d, i, !1), r && o.restore(), n && this.setBorder(t, e), "hidden" == g && o.clip();
  5586. }, r.prototype.drawImage = function (t, r, o, s) {
  5587. return void 0 === r && (r = {}), void 0 === o && (o = {}), void 0 === s && (s = !0), e(this, void 0, void 0, function () {
  5588. var a = this;
  5589. return i(this, function (h) {
  5590. switch (h.label) {
  5591. case 0:
  5592. return [4, new Promise(function (h, c) {
  5593. return e(a, void 0, void 0, function () {
  5594. var e,
  5595. a,
  5596. c,
  5597. f,
  5598. l,
  5599. d,
  5600. u,
  5601. p,
  5602. g,
  5603. v,
  5604. y,
  5605. x,
  5606. b,
  5607. w,
  5608. m,
  5609. S,
  5610. z,
  5611. M,
  5612. k,
  5613. B,
  5614. T,
  5615. L = this;
  5616. return i(this, function (i) {
  5617. return e = this.ctx, a = o.borderRadius, c = void 0 === a ? 0 : a, f = o.backgroundColor, l = void 0 === f ? "transparent" : f, d = o.objectFit, u = void 0 === d ? "fill" : d, p = o.backgroundSize, g = void 0 === p ? "fill" : p, v = o.objectPosition, y = o.backgroundPosition, x = o.boxShadow, o.backgroundImage && (u = g, v = y), x && this.drawView(r, Object.assign(o, {
  5618. backgroundColor: l || x && (l || "#ffffff")
  5619. }), !0, !1, !0), b = r.width, w = r.height, m = r.left, S = r.top, e.save(), z = r.contentSize.left - r.borderSize.left, M = r.contentSize.top - r.borderSize.top, s || (this.setOpacity(o), this.setTransform(r, o), this.setBackground(l, b, w, m, S), this.roundRect(m, S, b, w, c, !!(c || !x && l), !1)), m += z, S += M, e.clip(), k = function k(t) {
  5620. if ("fill" !== u) {
  5621. var i = function (t, e, i) {
  5622. var n = t.objectFit,
  5623. r = t.objectPosition,
  5624. o = e.width / e.height,
  5625. s = i.width / i.height,
  5626. a = 1,
  5627. h = "contain",
  5628. c = "cover";
  5629. n == h && o >= s || n == c && o < s ? a = e.height / i.height : (n == h && o < s || n == c && o >= s) && (a = e.width / i.width);
  5630. var f = i.width * a,
  5631. l = i.height * a,
  5632. d = r || [],
  5633. u = d[0],
  5634. p = d[1],
  5635. g = O(u) ? W(u, e.width) : (e.width - f) * (P(u) ? W(u, 1) : {
  5636. left: 0,
  5637. center: .5,
  5638. right: 1
  5639. }[u || "center"]),
  5640. v = O(p) ? W(p, e.height) : (e.height - l) * (P(p) ? W(p, 1) : {
  5641. top: 0,
  5642. center: .5,
  5643. bottom: 1
  5644. }[p || "center"]),
  5645. y = function y(t, e) {
  5646. return [(t - g) / a, (e - v) / a];
  5647. },
  5648. x = y(0, 0),
  5649. b = x[0],
  5650. w = x[1],
  5651. m = y(e.width, e.height),
  5652. S = m[0],
  5653. z = m[1],
  5654. I = Math.max,
  5655. M = Math.min;
  5656. return {
  5657. sx: I(b, 0),
  5658. sy: I(w, 0),
  5659. sw: M(S - b, i.width),
  5660. sh: M(z - w, i.height),
  5661. dx: I(g, 0),
  5662. dy: I(v, 0),
  5663. dw: M(f, e.width),
  5664. dh: M(l, e.height)
  5665. };
  5666. }({
  5667. objectFit: u,
  5668. objectPosition: v
  5669. }, r.contentSize, t),
  5670. o = i.sx,
  5671. s = i.sy,
  5672. a = i.sh,
  5673. h = i.sw,
  5674. c = i.dx,
  5675. f = i.dy,
  5676. l = i.dh,
  5677. d = i.dw;
  5678. I == n.MP_BAIDU ? e.drawImage(t.src, c + m, f + S, d, l, o, s, h, a) : e.drawImage(t.src, o, s, h, a, c + m, f + S, d, l);
  5679. } else e.drawImage(t.src, m, S, b, w);
  5680. }, B = function B() {
  5681. e.restore(), L.drawView(r, o, !1, !0, !1), h(1);
  5682. }, T = function T(t) {
  5683. k(t), B();
  5684. }, T(t), [2];
  5685. });
  5686. });
  5687. })];
  5688. case 1:
  5689. return h.sent(), [2];
  5690. }
  5691. });
  5692. });
  5693. }, r.prototype.drawText = function (t, e, i, n) {
  5694. var r = this,
  5695. o = this.ctx,
  5696. s = e.borderSize,
  5697. a = e.contentSize,
  5698. h = e.left,
  5699. c = e.top,
  5700. f = a.width,
  5701. l = a.height,
  5702. d = a.left - s.left || 0,
  5703. u = a.top - s.top || 0,
  5704. p = i.color,
  5705. g = i.lineHeight,
  5706. v = i.fontSize,
  5707. y = i.fontWeight,
  5708. x = i.fontFamily,
  5709. b = i.fontStyle,
  5710. w = i.textIndent,
  5711. m = void 0 === w ? 0 : w,
  5712. S = i.textAlign,
  5713. z = i.textStroke,
  5714. I = i.verticalAlign,
  5715. M = void 0 === I ? St : I,
  5716. k = i.backgroundColor,
  5717. P = i.lineClamp,
  5718. O = i.backgroundClip,
  5719. T = i.textShadow,
  5720. L = i.textDecoration;
  5721. if (m = B(m) ? m : 0, this.drawView(e, i, O != xt), g = W(g, v), t) {
  5722. o.save(), h += d, c += u;
  5723. var R = n.fontHeight,
  5724. F = n.descent,
  5725. A = void 0 === F ? 0 : F,
  5726. j = n.ascent,
  5727. E = A + (void 0 === j ? 0 : j);
  5728. switch (o.setFonts({
  5729. fontFamily: x,
  5730. fontSize: v,
  5731. fontWeight: y,
  5732. fontStyle: b
  5733. }), o.setTextBaseline(St), o.setTextAlign(S), O ? this.setBackground(k, f, l, h, c) : o.setFillStyle(p), S) {
  5734. case It:
  5735. break;
  5736. case Mt:
  5737. h += .5 * f;
  5738. break;
  5739. case kt:
  5740. h += f;
  5741. }
  5742. var C = n.lines * g,
  5743. H = Math.ceil((l - C) / 2);
  5744. switch (H < 0 && (H = 0), M) {
  5745. case mt:
  5746. break;
  5747. case St:
  5748. c += H;
  5749. break;
  5750. case zt:
  5751. c += 2 * H;
  5752. }
  5753. var D = (g - R) / 2,
  5754. $ = g / 2,
  5755. Y = function Y(t) {
  5756. var e = o.measureText(t),
  5757. i = e.actualBoundingBoxDescent,
  5758. n = void 0 === i ? 0 : i,
  5759. r = e.actualBoundingBoxAscent;
  5760. return M == mt ? {
  5761. fix: E ? void 0 === r ? 0 : r : $ - D / 2,
  5762. lineY: E ? 0 : D - D / 2
  5763. } : M == St ? {
  5764. fix: E ? $ + n / 4 : $,
  5765. lineY: E ? 0 : D
  5766. } : M == zt ? {
  5767. fix: E ? g - n : $ + D / 2,
  5768. lineY: E ? 2 * D : D + D / 2
  5769. } : {
  5770. fix: 0,
  5771. height: 0,
  5772. lineY: 0
  5773. };
  5774. },
  5775. U = function U(t, e, i) {
  5776. var r = t;
  5777. switch (S) {
  5778. case It:
  5779. r += i;
  5780. break;
  5781. case Mt:
  5782. r = (t -= i / 2) + i;
  5783. break;
  5784. case kt:
  5785. r = t, t -= i;
  5786. }
  5787. if (L) {
  5788. o.setLineWidth(v / 13), o.beginPath();
  5789. var s = .1 * n.fontHeight;
  5790. /\bunderline\b/.test(L) && (o.moveTo(t, e + n.fontHeight + s), o.lineTo(r, e + n.fontHeight + s)), /\boverline\b/.test(L) && (o.moveTo(t, e - s), o.lineTo(r, e - s)), /\bline-through\b/.test(L) && (o.moveTo(t, e + .5 * n.fontHeight), o.lineTo(r, e + .5 * n.fontHeight)), o.closePath(), o.setStrokeStyle(p), o.stroke();
  5791. }
  5792. },
  5793. N = function N(t, e, i) {
  5794. var n = function n() {
  5795. o.setLineWidth(z.width), o.setStrokeStyle(z.color), o.strokeText(t, e, i);
  5796. },
  5797. s = "outset";
  5798. z && z.type !== s ? (o.save(), r.setShadow({
  5799. boxShadow: T
  5800. }), o.fillText(t, e, i), o.restore(), n()) : z && z.type == s ? (o.save(), r.setShadow({
  5801. boxShadow: T
  5802. }), n(), o.restore(), o.save(), o.fillText(t, e, i), o.restore()) : (r.setShadow({
  5803. boxShadow: T
  5804. }), o.fillText(t, e, i));
  5805. };
  5806. if (!n.widths || 1 == n.widths.length && n.widths[0].total + m <= a.width) {
  5807. var X = Y(t),
  5808. _ = X.fix,
  5809. q = void 0 === _ ? 0 : _,
  5810. G = X.lineY;
  5811. return N(t, h + m, c + q), U(h + m, c + G, n && n.widths && n.widths[0].total || n.text), c += g, o.restore(), void this.setBorder(e, i);
  5812. }
  5813. for (var V = c, J = h, Q = "", Z = 0, K = o.measureText("...").width, tt = n.widths, et = 0; et < tt.length; et++) {
  5814. var it = tt[et].widths,
  5815. nt = 0;
  5816. Q = "", c += 1 == (Z += 1) ? 0 : g, 1 == Z && m && (nt = m, J = h + m);
  5817. for (var rt = 0; rt < it.length; rt++) {
  5818. 1 !== Z && m && (J = h);
  5819. var ot = it[rt],
  5820. st = ot.width,
  5821. at = ot.text,
  5822. ht = (it[rt + 1] || {}).width;
  5823. if (Q += at, (nt += st) + (void 0 === ht ? 0 : ht) + (0 == Z ? m : 0) + (Z == P ? K : 0) > a.width) {
  5824. Z >= P && (Q += "…"), Z++, nt = 0;
  5825. var ct = Y(Q);
  5826. q = ct.fix, G = ct.lineY;
  5827. N(Q, J, c + q), U(J, c + G, nt), c += g, Q = "";
  5828. } else if (rt == it.length - 1) {
  5829. et != tt.length - 1 && Z == P && K + nt < a.width && (Q += "…");
  5830. var ft = Y(Q);
  5831. q = ft.fix, G = ft.lineY;
  5832. N(Q, J, c + q), U(J, c + G, nt);
  5833. }
  5834. if (c > V + l || Z > P) break;
  5835. }
  5836. }
  5837. o.restore();
  5838. }
  5839. }, r.prototype.source = function (t) {
  5840. return e(this, void 0, void 0, function () {
  5841. var e,
  5842. n,
  5843. r,
  5844. o,
  5845. s = this;
  5846. return i(this, function (i) {
  5847. switch (i.label) {
  5848. case 0:
  5849. if (this.node = null, e = +new Date(), "{}" == JSON.stringify(t)) return [2];
  5850. if (t.styles = t.styles || t.css || {}, !t.type) for (n in t.type = wt, t) {
  5851. ["views", "children", "type", "css", "styles"].includes(n) || (t.styles[n] = t[n], delete t[n]);
  5852. }
  5853. return t.styles.boxSizing || (t.styles.boxSizing = "border-box"), [4, this.create(t)];
  5854. case 1:
  5855. return (r = i.sent()) ? (o = r.layout() || {}, this.size = o, this.node = r, this.onEffectFinished().then(function (t) {
  5856. return s.lifecycle("onEffectSuccess", t);
  5857. }).catch(function (t) {
  5858. return s.lifecycle("onEffectFail", t);
  5859. }), this.performance && console.log("布局用时:" + (+new Date() - e) + "ms"), [2, this.size]) : [2, console.warn("no node")];
  5860. }
  5861. });
  5862. });
  5863. }, r.prototype.getImageInfo = function (t) {
  5864. return this.imageBus[t] || (this.imageBus[t] = this.createImage(t, this.useCORS)), this.imageBus[t];
  5865. }, r.prototype.create = function (n, r) {
  5866. return e(this, void 0, void 0, function () {
  5867. function e(i, n, r) {
  5868. void 0 === n && (n = {}), void 0 === r && (r = !0);
  5869. var o = [];
  5870. return i.forEach(function (i) {
  5871. var s = i.styles,
  5872. a = void 0 === s ? {} : s,
  5873. h = i.css,
  5874. c = void 0 === h ? {} : h,
  5875. f = i.children,
  5876. l = void 0 === f ? [] : f,
  5877. d = i.views,
  5878. u = void 0 === d ? [] : d,
  5879. p = i.text,
  5880. g = void 0 === p ? "" : p,
  5881. v = i.type,
  5882. y = void 0 === v ? "" : v;
  5883. !l && u && (i.children = l = u);
  5884. var x = {};
  5885. x = _t(_t(r ? _t({}, n) : {}, a), c);
  5886. var b = {},
  5887. w = {},
  5888. m = {};
  5889. Object.keys(x).map(function (t) {
  5890. if (t.includes("padding") || t.includes("margin")) {
  5891. var e = J(t, x[t]);
  5892. Object.keys(e).map(function (t) {
  5893. t.includes("Left") ? w[t] = e[t] : t.includes("Right") ? m[t] = e[t] : b[t] = e[t];
  5894. });
  5895. }
  5896. });
  5897. if (x.textIndent && (w.textIndent = x.textIndent, delete n.textIndent), "" !== g) {
  5898. var S = Array.from(g);
  5899. S.forEach(function (t, e) {
  5900. var i = Object.assign({}, x, b);
  5901. 0 === e ? Object.assign(i, w) : e == S.length - 1 && Object.assign(i, m), delete i.padding, delete i.margin, o.push({
  5902. type: "text",
  5903. text: t,
  5904. styles: i
  5905. });
  5906. });
  5907. }
  5908. if (y == yt || y == bt) o.push(i);else if ("block" === a.display && l.length > 0) {
  5909. var z = e(l, x, !1);
  5910. i.children = z, i.flattened = !0, o.push(i);
  5911. } else if (l.length > 0) {
  5912. z = e(l, x, r);
  5913. o = o.concat(z);
  5914. }
  5915. }), o;
  5916. }
  5917. var o, s, a, h, c, f, l, d, u, p, g, v, y, b, w, m, S, z, I, M, k, B, W, P;
  5918. return i(this, function (i) {
  5919. switch (i.label) {
  5920. case 0:
  5921. if (!n) return [2];
  5922. if (n.styles || (n.styles = n.css || {}), o = n.type, s = n.show, a = void 0 === s || s, h = o == yt, c = [xt, bt].includes(o), f = "textBox" == o, l = n.styles || {}, d = l.backgroundImage, u = l.display, h && !n.src && !n.url) return [2];
  5923. if (u == x || !a) return [2];
  5924. if (c || f) {
  5925. if (p = n.children, g = n.views, !p && g && (n.children = p = g), !n.text && (!p || p && !p.length)) return [2];
  5926. p && p.length && !n.flattened && (v = e(n.children || n.views), n.type = "view", n.children = v);
  5927. }
  5928. if (!(h || n.type == wt && d)) return [3, 4];
  5929. y = h ? n.src : "", b = /url\(['"]?(.*?)['"]?\)/.exec(d), d && b && b[1] && (y = b[1] || ""), i.label = 1;
  5930. case 1:
  5931. return i.trys.push([1, 3,, 4]), [4, this.getImageInfo(y)];
  5932. case 2:
  5933. return w = i.sent(), m = w.width, S = w.height, !(z = w.path) && h ? [2] : (z && (n.attributes = Object.assign(n.attributes || {}, {
  5934. width: m,
  5935. height: S,
  5936. path: z,
  5937. src: z,
  5938. naturalSrc: y
  5939. })), [3, 4]);
  5940. case 3:
  5941. return I = i.sent(), n.type != wt ? [2] : (this.lifecycle("onEffectFail", _t(_t({}, I), {
  5942. src: y
  5943. })), [3, 4]);
  5944. case 4:
  5945. if (this.count += 1, M = new gt(n, r, this.root, this.ctx), !(k = n.children || n.views)) return [3, 8];
  5946. B = 0, i.label = 5;
  5947. case 5:
  5948. return B < k.length ? (W = k[B], [4, this.create(W, M)]) : [3, 8];
  5949. case 6:
  5950. (P = i.sent()) && M.add(P), i.label = 7;
  5951. case 7:
  5952. return B++, [3, 5];
  5953. case 8:
  5954. return [2, M];
  5955. }
  5956. });
  5957. });
  5958. }, r.prototype.drawNode = function (t, n) {
  5959. return void 0 === n && (n = !1), e(this, void 0, void 0, function () {
  5960. var e, r, o, s, a, h, c, f, l, d, u, p, g, v, y, x, b, w, m, S, z, I, M;
  5961. return i(this, function (i) {
  5962. switch (i.label) {
  5963. case 0:
  5964. return e = t.layoutBox, r = t.computedStyle, o = t.attributes, s = t.name, a = t.children, h = t.fixedLine, c = t.attributes, f = c.src, l = c.text, d = r.position, u = r.backgroundImage, p = r.backgroundRepeat, ["fixed"].includes(d) && !n ? [2] : (this.ctx.save(), s !== wt ? [3, 7] : f && u ? p ? [4, this.drawPattern(o, e, r)] : [3, 2] : [3, 5]);
  5965. case 1:
  5966. return i.sent(), [3, 4];
  5967. case 2:
  5968. return [4, this.drawImage(o, e, r, !1)];
  5969. case 3:
  5970. i.sent(), i.label = 4;
  5971. case 4:
  5972. return [3, 6];
  5973. case 5:
  5974. this.drawView(e, r), i.label = 6;
  5975. case 6:
  5976. return [3, 10];
  5977. case 7:
  5978. return s === yt && f ? [4, this.drawImage(o, e, r, !1)] : [3, 9];
  5979. case 8:
  5980. return i.sent(), [3, 10];
  5981. case 9:
  5982. s === xt ? this.drawText(l, e, r, o) : s === bt && vt.api && vt.api.draw(l, this, e, r), i.label = 10;
  5983. case 10:
  5984. if (this.progress += 1, v = (g = h || {}).beforeElements, y = g.afterElements, !v) return [3, 14];
  5985. x = 0, b = v, i.label = 11;
  5986. case 11:
  5987. return x < b.length ? (M = b[x], [4, this.drawNode(M)]) : [3, 14];
  5988. case 12:
  5989. i.sent(), i.label = 13;
  5990. case 13:
  5991. return x++, [3, 11];
  5992. case 14:
  5993. if (!a) return [3, 18];
  5994. w = Object.values ? Object.values(a) : Object.keys(a).map(function (t) {
  5995. return a[t];
  5996. }), m = 0, S = w, i.label = 15;
  5997. case 15:
  5998. return m < S.length ? "absolute" === (M = S[m]).computedStyle.position ? [3, 17] : [4, this.drawNode(M)] : [3, 18];
  5999. case 16:
  6000. i.sent(), i.label = 17;
  6001. case 17:
  6002. return m++, [3, 15];
  6003. case 18:
  6004. if (!y) return [3, 22];
  6005. z = 0, I = y, i.label = 19;
  6006. case 19:
  6007. return z < I.length ? (M = I[z], [4, this.drawNode(M)]) : [3, 22];
  6008. case 20:
  6009. i.sent(), i.label = 21;
  6010. case 21:
  6011. return z++, [3, 19];
  6012. case 22:
  6013. return this.ctx.restore(), [2];
  6014. }
  6015. });
  6016. });
  6017. }, r.prototype.render = function (t) {
  6018. var n = this;
  6019. return void 0 === t && (t = 30), new Promise(function (r, o) {
  6020. return e(n, void 0, void 0, function () {
  6021. var e, n, s, a, h, c, f, l, d, u;
  6022. return i(this, function (i) {
  6023. switch (i.label) {
  6024. case 0:
  6025. return e = +new Date(), this.init(), [4, (p = t, void 0 === p && (p = 0), new Promise(function (t) {
  6026. return setTimeout(t, p);
  6027. }))];
  6028. case 1:
  6029. i.sent(), i.label = 2;
  6030. case 2:
  6031. if (i.trys.push([2, 14,, 15]), !this.node) return [3, 12];
  6032. if (n = this.root.fixedLine || {}, s = n.beforeElements, a = n.afterElements, !s) return [3, 6];
  6033. h = 0, c = s, i.label = 3;
  6034. case 3:
  6035. return h < c.length ? (d = c[h], [4, this.drawNode(d, !0)]) : [3, 6];
  6036. case 4:
  6037. i.sent(), i.label = 5;
  6038. case 5:
  6039. return h++, [3, 3];
  6040. case 6:
  6041. return [4, this.drawNode(this.node)];
  6042. case 7:
  6043. if (i.sent(), !a) return [3, 11];
  6044. f = 0, l = a, i.label = 8;
  6045. case 8:
  6046. return f < l.length ? (d = l[f], [4, this.drawNode(d, !0)]) : [3, 11];
  6047. case 9:
  6048. i.sent(), i.label = 10;
  6049. case 10:
  6050. return f++, [3, 8];
  6051. case 11:
  6052. return r(this.node), [3, 13];
  6053. case 12:
  6054. this.lifecycle("onEffectFail", "node is empty"), i.label = 13;
  6055. case 13:
  6056. return [3, 15];
  6057. case 14:
  6058. return u = i.sent(), this.lifecycle("onEffectFail", u), o(u), [3, 15];
  6059. case 15:
  6060. return this.performance && console.log("渲染用时:" + (+new Date() - e - 30) + "ms"), [2];
  6061. }
  6062. var p;
  6063. });
  6064. });
  6065. });
  6066. }, r.prototype.onEffectFinished = function () {
  6067. var t = this,
  6068. e = Object.keys(this.imageBus).map(function (e) {
  6069. return t.imageBus[e];
  6070. });
  6071. return Promise.all(e);
  6072. }, r.prototype.destroy = function () {
  6073. this.node = [];
  6074. }, r.prototype.save = function (t) {
  6075. try {
  6076. var e = t || {},
  6077. i = e.fileType,
  6078. n = void 0 === i ? "png" : i,
  6079. r = e.quality,
  6080. o = void 0 === r ? 1 : r;
  6081. return this.canvas.toDataURL("image/".concat(n), o);
  6082. } catch (t) {
  6083. return this.lifecycle("onEffectFail", "image cross domain"), t;
  6084. }
  6085. }, r;
  6086. }();
  6087. exports.default = exports.Painter = Bt;
  6088. n.WEB == I && (window.Painter = Bt);
  6089. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  6090. /***/ }),
  6091. /***/ 23:
  6092. /*!***************************************************************!*\
  6093. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  6094. \***************************************************************/
  6095. /*! no static exports found */
  6096. /***/ (function(module, exports) {
  6097. function _classCallCheck(instance, Constructor) {
  6098. if (!(instance instanceof Constructor)) {
  6099. throw new TypeError("Cannot call a class as a function");
  6100. }
  6101. }
  6102. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  6103. /***/ }),
  6104. /***/ 24:
  6105. /*!************************************************************!*\
  6106. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  6107. \************************************************************/
  6108. /*! no static exports found */
  6109. /***/ (function(module, exports, __webpack_require__) {
  6110. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  6111. function _defineProperties(target, props) {
  6112. for (var i = 0; i < props.length; i++) {
  6113. var descriptor = props[i];
  6114. descriptor.enumerable = descriptor.enumerable || false;
  6115. descriptor.configurable = true;
  6116. if ("value" in descriptor) descriptor.writable = true;
  6117. Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
  6118. }
  6119. }
  6120. function _createClass(Constructor, protoProps, staticProps) {
  6121. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  6122. if (staticProps) _defineProperties(Constructor, staticProps);
  6123. Object.defineProperty(Constructor, "prototype", {
  6124. writable: false
  6125. });
  6126. return Constructor;
  6127. }
  6128. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  6129. /***/ }),
  6130. /***/ 25:
  6131. /*!******************************************************************************************!*\
  6132. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  6133. \******************************************************************************************/
  6134. /*! exports provided: default */
  6135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6136. "use strict";
  6137. __webpack_require__.r(__webpack_exports__);
  6138. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6139. * Vue.js v2.6.11
  6140. * (c) 2014-2024 Evan You
  6141. * Released under the MIT License.
  6142. */
  6143. /* */
  6144. var emptyObject = Object.freeze({});
  6145. // These helpers produce better VM code in JS engines due to their
  6146. // explicitness and function inlining.
  6147. function isUndef (v) {
  6148. return v === undefined || v === null
  6149. }
  6150. function isDef (v) {
  6151. return v !== undefined && v !== null
  6152. }
  6153. function isTrue (v) {
  6154. return v === true
  6155. }
  6156. function isFalse (v) {
  6157. return v === false
  6158. }
  6159. /**
  6160. * Check if value is primitive.
  6161. */
  6162. function isPrimitive (value) {
  6163. return (
  6164. typeof value === 'string' ||
  6165. typeof value === 'number' ||
  6166. // $flow-disable-line
  6167. typeof value === 'symbol' ||
  6168. typeof value === 'boolean'
  6169. )
  6170. }
  6171. /**
  6172. * Quick object check - this is primarily used to tell
  6173. * Objects from primitive values when we know the value
  6174. * is a JSON-compliant type.
  6175. */
  6176. function isObject (obj) {
  6177. return obj !== null && typeof obj === 'object'
  6178. }
  6179. /**
  6180. * Get the raw type string of a value, e.g., [object Object].
  6181. */
  6182. var _toString = Object.prototype.toString;
  6183. function toRawType (value) {
  6184. return _toString.call(value).slice(8, -1)
  6185. }
  6186. /**
  6187. * Strict object type check. Only returns true
  6188. * for plain JavaScript objects.
  6189. */
  6190. function isPlainObject (obj) {
  6191. return _toString.call(obj) === '[object Object]'
  6192. }
  6193. function isRegExp (v) {
  6194. return _toString.call(v) === '[object RegExp]'
  6195. }
  6196. /**
  6197. * Check if val is a valid array index.
  6198. */
  6199. function isValidArrayIndex (val) {
  6200. var n = parseFloat(String(val));
  6201. return n >= 0 && Math.floor(n) === n && isFinite(val)
  6202. }
  6203. function isPromise (val) {
  6204. return (
  6205. isDef(val) &&
  6206. typeof val.then === 'function' &&
  6207. typeof val.catch === 'function'
  6208. )
  6209. }
  6210. /**
  6211. * Convert a value to a string that is actually rendered.
  6212. */
  6213. function toString (val) {
  6214. return val == null
  6215. ? ''
  6216. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  6217. ? JSON.stringify(val, null, 2)
  6218. : String(val)
  6219. }
  6220. /**
  6221. * Convert an input value to a number for persistence.
  6222. * If the conversion fails, return original string.
  6223. */
  6224. function toNumber (val) {
  6225. var n = parseFloat(val);
  6226. return isNaN(n) ? val : n
  6227. }
  6228. /**
  6229. * Make a map and return a function for checking if a key
  6230. * is in that map.
  6231. */
  6232. function makeMap (
  6233. str,
  6234. expectsLowerCase
  6235. ) {
  6236. var map = Object.create(null);
  6237. var list = str.split(',');
  6238. for (var i = 0; i < list.length; i++) {
  6239. map[list[i]] = true;
  6240. }
  6241. return expectsLowerCase
  6242. ? function (val) { return map[val.toLowerCase()]; }
  6243. : function (val) { return map[val]; }
  6244. }
  6245. /**
  6246. * Check if a tag is a built-in tag.
  6247. */
  6248. var isBuiltInTag = makeMap('slot,component', true);
  6249. /**
  6250. * Check if an attribute is a reserved attribute.
  6251. */
  6252. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  6253. /**
  6254. * Remove an item from an array.
  6255. */
  6256. function remove (arr, item) {
  6257. if (arr.length) {
  6258. var index = arr.indexOf(item);
  6259. if (index > -1) {
  6260. return arr.splice(index, 1)
  6261. }
  6262. }
  6263. }
  6264. /**
  6265. * Check whether an object has the property.
  6266. */
  6267. var hasOwnProperty = Object.prototype.hasOwnProperty;
  6268. function hasOwn (obj, key) {
  6269. return hasOwnProperty.call(obj, key)
  6270. }
  6271. /**
  6272. * Create a cached version of a pure function.
  6273. */
  6274. function cached (fn) {
  6275. var cache = Object.create(null);
  6276. return (function cachedFn (str) {
  6277. var hit = cache[str];
  6278. return hit || (cache[str] = fn(str))
  6279. })
  6280. }
  6281. /**
  6282. * Camelize a hyphen-delimited string.
  6283. */
  6284. var camelizeRE = /-(\w)/g;
  6285. var camelize = cached(function (str) {
  6286. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  6287. });
  6288. /**
  6289. * Capitalize a string.
  6290. */
  6291. var capitalize = cached(function (str) {
  6292. return str.charAt(0).toUpperCase() + str.slice(1)
  6293. });
  6294. /**
  6295. * Hyphenate a camelCase string.
  6296. */
  6297. var hyphenateRE = /\B([A-Z])/g;
  6298. var hyphenate = cached(function (str) {
  6299. return str.replace(hyphenateRE, '-$1').toLowerCase()
  6300. });
  6301. /**
  6302. * Simple bind polyfill for environments that do not support it,
  6303. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  6304. * since native bind is now performant enough in most browsers.
  6305. * But removing it would mean breaking code that was able to run in
  6306. * PhantomJS 1.x, so this must be kept for backward compatibility.
  6307. */
  6308. /* istanbul ignore next */
  6309. function polyfillBind (fn, ctx) {
  6310. function boundFn (a) {
  6311. var l = arguments.length;
  6312. return l
  6313. ? l > 1
  6314. ? fn.apply(ctx, arguments)
  6315. : fn.call(ctx, a)
  6316. : fn.call(ctx)
  6317. }
  6318. boundFn._length = fn.length;
  6319. return boundFn
  6320. }
  6321. function nativeBind (fn, ctx) {
  6322. return fn.bind(ctx)
  6323. }
  6324. var bind = Function.prototype.bind
  6325. ? nativeBind
  6326. : polyfillBind;
  6327. /**
  6328. * Convert an Array-like object to a real Array.
  6329. */
  6330. function toArray (list, start) {
  6331. start = start || 0;
  6332. var i = list.length - start;
  6333. var ret = new Array(i);
  6334. while (i--) {
  6335. ret[i] = list[i + start];
  6336. }
  6337. return ret
  6338. }
  6339. /**
  6340. * Mix properties into target object.
  6341. */
  6342. function extend (to, _from) {
  6343. for (var key in _from) {
  6344. to[key] = _from[key];
  6345. }
  6346. return to
  6347. }
  6348. /**
  6349. * Merge an Array of Objects into a single Object.
  6350. */
  6351. function toObject (arr) {
  6352. var res = {};
  6353. for (var i = 0; i < arr.length; i++) {
  6354. if (arr[i]) {
  6355. extend(res, arr[i]);
  6356. }
  6357. }
  6358. return res
  6359. }
  6360. /* eslint-disable no-unused-vars */
  6361. /**
  6362. * Perform no operation.
  6363. * Stubbing args to make Flow happy without leaving useless transpiled code
  6364. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  6365. */
  6366. function noop (a, b, c) {}
  6367. /**
  6368. * Always return false.
  6369. */
  6370. var no = function (a, b, c) { return false; };
  6371. /* eslint-enable no-unused-vars */
  6372. /**
  6373. * Return the same value.
  6374. */
  6375. var identity = function (_) { return _; };
  6376. /**
  6377. * Check if two values are loosely equal - that is,
  6378. * if they are plain objects, do they have the same shape?
  6379. */
  6380. function looseEqual (a, b) {
  6381. if (a === b) { return true }
  6382. var isObjectA = isObject(a);
  6383. var isObjectB = isObject(b);
  6384. if (isObjectA && isObjectB) {
  6385. try {
  6386. var isArrayA = Array.isArray(a);
  6387. var isArrayB = Array.isArray(b);
  6388. if (isArrayA && isArrayB) {
  6389. return a.length === b.length && a.every(function (e, i) {
  6390. return looseEqual(e, b[i])
  6391. })
  6392. } else if (a instanceof Date && b instanceof Date) {
  6393. return a.getTime() === b.getTime()
  6394. } else if (!isArrayA && !isArrayB) {
  6395. var keysA = Object.keys(a);
  6396. var keysB = Object.keys(b);
  6397. return keysA.length === keysB.length && keysA.every(function (key) {
  6398. return looseEqual(a[key], b[key])
  6399. })
  6400. } else {
  6401. /* istanbul ignore next */
  6402. return false
  6403. }
  6404. } catch (e) {
  6405. /* istanbul ignore next */
  6406. return false
  6407. }
  6408. } else if (!isObjectA && !isObjectB) {
  6409. return String(a) === String(b)
  6410. } else {
  6411. return false
  6412. }
  6413. }
  6414. /**
  6415. * Return the first index at which a loosely equal value can be
  6416. * found in the array (if value is a plain object, the array must
  6417. * contain an object of the same shape), or -1 if it is not present.
  6418. */
  6419. function looseIndexOf (arr, val) {
  6420. for (var i = 0; i < arr.length; i++) {
  6421. if (looseEqual(arr[i], val)) { return i }
  6422. }
  6423. return -1
  6424. }
  6425. /**
  6426. * Ensure a function is called only once.
  6427. */
  6428. function once (fn) {
  6429. var called = false;
  6430. return function () {
  6431. if (!called) {
  6432. called = true;
  6433. fn.apply(this, arguments);
  6434. }
  6435. }
  6436. }
  6437. var ASSET_TYPES = [
  6438. 'component',
  6439. 'directive',
  6440. 'filter'
  6441. ];
  6442. var LIFECYCLE_HOOKS = [
  6443. 'beforeCreate',
  6444. 'created',
  6445. 'beforeMount',
  6446. 'mounted',
  6447. 'beforeUpdate',
  6448. 'updated',
  6449. 'beforeDestroy',
  6450. 'destroyed',
  6451. 'activated',
  6452. 'deactivated',
  6453. 'errorCaptured',
  6454. 'serverPrefetch'
  6455. ];
  6456. /* */
  6457. var config = ({
  6458. /**
  6459. * Option merge strategies (used in core/util/options)
  6460. */
  6461. // $flow-disable-line
  6462. optionMergeStrategies: Object.create(null),
  6463. /**
  6464. * Whether to suppress warnings.
  6465. */
  6466. silent: false,
  6467. /**
  6468. * Show production mode tip message on boot?
  6469. */
  6470. productionTip: "development" !== 'production',
  6471. /**
  6472. * Whether to enable devtools
  6473. */
  6474. devtools: "development" !== 'production',
  6475. /**
  6476. * Whether to record perf
  6477. */
  6478. performance: false,
  6479. /**
  6480. * Error handler for watcher errors
  6481. */
  6482. errorHandler: null,
  6483. /**
  6484. * Warn handler for watcher warns
  6485. */
  6486. warnHandler: null,
  6487. /**
  6488. * Ignore certain custom elements
  6489. */
  6490. ignoredElements: [],
  6491. /**
  6492. * Custom user key aliases for v-on
  6493. */
  6494. // $flow-disable-line
  6495. keyCodes: Object.create(null),
  6496. /**
  6497. * Check if a tag is reserved so that it cannot be registered as a
  6498. * component. This is platform-dependent and may be overwritten.
  6499. */
  6500. isReservedTag: no,
  6501. /**
  6502. * Check if an attribute is reserved so that it cannot be used as a component
  6503. * prop. This is platform-dependent and may be overwritten.
  6504. */
  6505. isReservedAttr: no,
  6506. /**
  6507. * Check if a tag is an unknown element.
  6508. * Platform-dependent.
  6509. */
  6510. isUnknownElement: no,
  6511. /**
  6512. * Get the namespace of an element
  6513. */
  6514. getTagNamespace: noop,
  6515. /**
  6516. * Parse the real tag name for the specific platform.
  6517. */
  6518. parsePlatformTagName: identity,
  6519. /**
  6520. * Check if an attribute must be bound using property, e.g. value
  6521. * Platform-dependent.
  6522. */
  6523. mustUseProp: no,
  6524. /**
  6525. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  6526. * This will significantly reduce performance if set to false.
  6527. */
  6528. async: true,
  6529. /**
  6530. * Exposed for legacy reasons
  6531. */
  6532. _lifecycleHooks: LIFECYCLE_HOOKS
  6533. });
  6534. /* */
  6535. /**
  6536. * unicode letters used for parsing html tags, component names and property paths.
  6537. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  6538. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  6539. */
  6540. 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/;
  6541. /**
  6542. * Check if a string starts with $ or _
  6543. */
  6544. function isReserved (str) {
  6545. var c = (str + '').charCodeAt(0);
  6546. return c === 0x24 || c === 0x5F
  6547. }
  6548. /**
  6549. * Define a property.
  6550. */
  6551. function def (obj, key, val, enumerable) {
  6552. Object.defineProperty(obj, key, {
  6553. value: val,
  6554. enumerable: !!enumerable,
  6555. writable: true,
  6556. configurable: true
  6557. });
  6558. }
  6559. /**
  6560. * Parse simple path.
  6561. */
  6562. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  6563. function parsePath (path) {
  6564. if (bailRE.test(path)) {
  6565. return
  6566. }
  6567. var segments = path.split('.');
  6568. return function (obj) {
  6569. for (var i = 0; i < segments.length; i++) {
  6570. if (!obj) { return }
  6571. obj = obj[segments[i]];
  6572. }
  6573. return obj
  6574. }
  6575. }
  6576. /* */
  6577. // can we use __proto__?
  6578. var hasProto = '__proto__' in {};
  6579. // Browser environment sniffing
  6580. var inBrowser = typeof window !== 'undefined';
  6581. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  6582. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  6583. var UA = inBrowser && window.navigator && window.navigator.userAgent.toLowerCase();
  6584. var isIE = UA && /msie|trident/.test(UA);
  6585. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  6586. var isEdge = UA && UA.indexOf('edge/') > 0;
  6587. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  6588. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  6589. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  6590. var isPhantomJS = UA && /phantomjs/.test(UA);
  6591. var isFF = UA && UA.match(/firefox\/(\d+)/);
  6592. // Firefox has a "watch" function on Object.prototype...
  6593. var nativeWatch = ({}).watch;
  6594. if (inBrowser) {
  6595. try {
  6596. var opts = {};
  6597. Object.defineProperty(opts, 'passive', ({
  6598. get: function get () {
  6599. }
  6600. })); // https://github.com/facebook/flow/issues/285
  6601. window.addEventListener('test-passive', null, opts);
  6602. } catch (e) {}
  6603. }
  6604. // this needs to be lazy-evaled because vue may be required before
  6605. // vue-server-renderer can set VUE_ENV
  6606. var _isServer;
  6607. var isServerRendering = function () {
  6608. if (_isServer === undefined) {
  6609. /* istanbul ignore if */
  6610. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  6611. // detect presence of vue-server-renderer and avoid
  6612. // Webpack shimming the process
  6613. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  6614. } else {
  6615. _isServer = false;
  6616. }
  6617. }
  6618. return _isServer
  6619. };
  6620. // detect devtools
  6621. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  6622. /* istanbul ignore next */
  6623. function isNative (Ctor) {
  6624. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  6625. }
  6626. var hasSymbol =
  6627. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  6628. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  6629. var _Set;
  6630. /* istanbul ignore if */ // $flow-disable-line
  6631. if (typeof Set !== 'undefined' && isNative(Set)) {
  6632. // use native Set when available.
  6633. _Set = Set;
  6634. } else {
  6635. // a non-standard Set polyfill that only works with primitive keys.
  6636. _Set = /*@__PURE__*/(function () {
  6637. function Set () {
  6638. this.set = Object.create(null);
  6639. }
  6640. Set.prototype.has = function has (key) {
  6641. return this.set[key] === true
  6642. };
  6643. Set.prototype.add = function add (key) {
  6644. this.set[key] = true;
  6645. };
  6646. Set.prototype.clear = function clear () {
  6647. this.set = Object.create(null);
  6648. };
  6649. return Set;
  6650. }());
  6651. }
  6652. /* */
  6653. var warn = noop;
  6654. var tip = noop;
  6655. var generateComponentTrace = (noop); // work around flow check
  6656. var formatComponentName = (noop);
  6657. if (true) {
  6658. var hasConsole = typeof console !== 'undefined';
  6659. var classifyRE = /(?:^|[-_])(\w)/g;
  6660. var classify = function (str) { return str
  6661. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  6662. .replace(/[-_]/g, ''); };
  6663. warn = function (msg, vm) {
  6664. var trace = vm ? generateComponentTrace(vm) : '';
  6665. if (config.warnHandler) {
  6666. config.warnHandler.call(null, msg, vm, trace);
  6667. } else if (hasConsole && (!config.silent)) {
  6668. console.error(("[Vue warn]: " + msg + trace));
  6669. }
  6670. };
  6671. tip = function (msg, vm) {
  6672. if (hasConsole && (!config.silent)) {
  6673. console.warn("[Vue tip]: " + msg + (
  6674. vm ? generateComponentTrace(vm) : ''
  6675. ));
  6676. }
  6677. };
  6678. formatComponentName = function (vm, includeFile) {
  6679. if (vm.$root === vm) {
  6680. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  6681. return ('') + vm.$options.__file
  6682. }
  6683. return '<Root>'
  6684. }
  6685. var options = typeof vm === 'function' && vm.cid != null
  6686. ? vm.options
  6687. : vm._isVue
  6688. ? vm.$options || vm.constructor.options
  6689. : vm;
  6690. var name = options.name || options._componentTag;
  6691. var file = options.__file;
  6692. if (!name && file) {
  6693. var match = file.match(/([^/\\]+)\.vue$/);
  6694. name = match && match[1];
  6695. }
  6696. return (
  6697. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  6698. (file && includeFile !== false ? (" at " + file) : '')
  6699. )
  6700. };
  6701. var repeat = function (str, n) {
  6702. var res = '';
  6703. while (n) {
  6704. if (n % 2 === 1) { res += str; }
  6705. if (n > 1) { str += str; }
  6706. n >>= 1;
  6707. }
  6708. return res
  6709. };
  6710. generateComponentTrace = function (vm) {
  6711. if (vm._isVue && vm.$parent) {
  6712. var tree = [];
  6713. var currentRecursiveSequence = 0;
  6714. while (vm && vm.$options.name !== 'PageBody') {
  6715. if (tree.length > 0) {
  6716. var last = tree[tree.length - 1];
  6717. if (last.constructor === vm.constructor) {
  6718. currentRecursiveSequence++;
  6719. vm = vm.$parent;
  6720. continue
  6721. } else if (currentRecursiveSequence > 0) {
  6722. tree[tree.length - 1] = [last, currentRecursiveSequence];
  6723. currentRecursiveSequence = 0;
  6724. }
  6725. }
  6726. !vm.$options.isReserved && tree.push(vm);
  6727. vm = vm.$parent;
  6728. }
  6729. return '\n\nfound in\n\n' + tree
  6730. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  6731. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  6732. : formatComponentName(vm))); })
  6733. .join('\n')
  6734. } else {
  6735. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  6736. }
  6737. };
  6738. }
  6739. /* */
  6740. var uid = 0;
  6741. /**
  6742. * A dep is an observable that can have multiple
  6743. * directives subscribing to it.
  6744. */
  6745. var Dep = function Dep () {
  6746. this.id = uid++;
  6747. this.subs = [];
  6748. };
  6749. Dep.prototype.addSub = function addSub (sub) {
  6750. this.subs.push(sub);
  6751. };
  6752. Dep.prototype.removeSub = function removeSub (sub) {
  6753. remove(this.subs, sub);
  6754. };
  6755. Dep.prototype.depend = function depend () {
  6756. if (Dep.SharedObject.target) {
  6757. Dep.SharedObject.target.addDep(this);
  6758. }
  6759. };
  6760. Dep.prototype.notify = function notify () {
  6761. // stabilize the subscriber list first
  6762. var subs = this.subs.slice();
  6763. if ( true && !config.async) {
  6764. // subs aren't sorted in scheduler if not running async
  6765. // we need to sort them now to make sure they fire in correct
  6766. // order
  6767. subs.sort(function (a, b) { return a.id - b.id; });
  6768. }
  6769. for (var i = 0, l = subs.length; i < l; i++) {
  6770. subs[i].update();
  6771. }
  6772. };
  6773. // The current target watcher being evaluated.
  6774. // This is globally unique because only one watcher
  6775. // can be evaluated at a time.
  6776. // fixed by xxxxxx (nvue shared vuex)
  6777. /* eslint-disable no-undef */
  6778. Dep.SharedObject = {};
  6779. Dep.SharedObject.target = null;
  6780. Dep.SharedObject.targetStack = [];
  6781. function pushTarget (target) {
  6782. Dep.SharedObject.targetStack.push(target);
  6783. Dep.SharedObject.target = target;
  6784. Dep.target = target;
  6785. }
  6786. function popTarget () {
  6787. Dep.SharedObject.targetStack.pop();
  6788. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  6789. Dep.target = Dep.SharedObject.target;
  6790. }
  6791. /* */
  6792. var VNode = function VNode (
  6793. tag,
  6794. data,
  6795. children,
  6796. text,
  6797. elm,
  6798. context,
  6799. componentOptions,
  6800. asyncFactory
  6801. ) {
  6802. this.tag = tag;
  6803. this.data = data;
  6804. this.children = children;
  6805. this.text = text;
  6806. this.elm = elm;
  6807. this.ns = undefined;
  6808. this.context = context;
  6809. this.fnContext = undefined;
  6810. this.fnOptions = undefined;
  6811. this.fnScopeId = undefined;
  6812. this.key = data && data.key;
  6813. this.componentOptions = componentOptions;
  6814. this.componentInstance = undefined;
  6815. this.parent = undefined;
  6816. this.raw = false;
  6817. this.isStatic = false;
  6818. this.isRootInsert = true;
  6819. this.isComment = false;
  6820. this.isCloned = false;
  6821. this.isOnce = false;
  6822. this.asyncFactory = asyncFactory;
  6823. this.asyncMeta = undefined;
  6824. this.isAsyncPlaceholder = false;
  6825. };
  6826. var prototypeAccessors = { child: { configurable: true } };
  6827. // DEPRECATED: alias for componentInstance for backwards compat.
  6828. /* istanbul ignore next */
  6829. prototypeAccessors.child.get = function () {
  6830. return this.componentInstance
  6831. };
  6832. Object.defineProperties( VNode.prototype, prototypeAccessors );
  6833. var createEmptyVNode = function (text) {
  6834. if ( text === void 0 ) text = '';
  6835. var node = new VNode();
  6836. node.text = text;
  6837. node.isComment = true;
  6838. return node
  6839. };
  6840. function createTextVNode (val) {
  6841. return new VNode(undefined, undefined, undefined, String(val))
  6842. }
  6843. // optimized shallow clone
  6844. // used for static nodes and slot nodes because they may be reused across
  6845. // multiple renders, cloning them avoids errors when DOM manipulations rely
  6846. // on their elm reference.
  6847. function cloneVNode (vnode) {
  6848. var cloned = new VNode(
  6849. vnode.tag,
  6850. vnode.data,
  6851. // #7975
  6852. // clone children array to avoid mutating original in case of cloning
  6853. // a child.
  6854. vnode.children && vnode.children.slice(),
  6855. vnode.text,
  6856. vnode.elm,
  6857. vnode.context,
  6858. vnode.componentOptions,
  6859. vnode.asyncFactory
  6860. );
  6861. cloned.ns = vnode.ns;
  6862. cloned.isStatic = vnode.isStatic;
  6863. cloned.key = vnode.key;
  6864. cloned.isComment = vnode.isComment;
  6865. cloned.fnContext = vnode.fnContext;
  6866. cloned.fnOptions = vnode.fnOptions;
  6867. cloned.fnScopeId = vnode.fnScopeId;
  6868. cloned.asyncMeta = vnode.asyncMeta;
  6869. cloned.isCloned = true;
  6870. return cloned
  6871. }
  6872. /*
  6873. * not type checking this file because flow doesn't play well with
  6874. * dynamically accessing methods on Array prototype
  6875. */
  6876. var arrayProto = Array.prototype;
  6877. var arrayMethods = Object.create(arrayProto);
  6878. var methodsToPatch = [
  6879. 'push',
  6880. 'pop',
  6881. 'shift',
  6882. 'unshift',
  6883. 'splice',
  6884. 'sort',
  6885. 'reverse'
  6886. ];
  6887. /**
  6888. * Intercept mutating methods and emit events
  6889. */
  6890. methodsToPatch.forEach(function (method) {
  6891. // cache original method
  6892. var original = arrayProto[method];
  6893. def(arrayMethods, method, function mutator () {
  6894. var args = [], len = arguments.length;
  6895. while ( len-- ) args[ len ] = arguments[ len ];
  6896. var result = original.apply(this, args);
  6897. var ob = this.__ob__;
  6898. var inserted;
  6899. switch (method) {
  6900. case 'push':
  6901. case 'unshift':
  6902. inserted = args;
  6903. break
  6904. case 'splice':
  6905. inserted = args.slice(2);
  6906. break
  6907. }
  6908. if (inserted) { ob.observeArray(inserted); }
  6909. // notify change
  6910. ob.dep.notify();
  6911. return result
  6912. });
  6913. });
  6914. /* */
  6915. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  6916. /**
  6917. * In some cases we may want to disable observation inside a component's
  6918. * update computation.
  6919. */
  6920. var shouldObserve = true;
  6921. function toggleObserving (value) {
  6922. shouldObserve = value;
  6923. }
  6924. /**
  6925. * Observer class that is attached to each observed
  6926. * object. Once attached, the observer converts the target
  6927. * object's property keys into getter/setters that
  6928. * collect dependencies and dispatch updates.
  6929. */
  6930. var Observer = function Observer (value) {
  6931. this.value = value;
  6932. this.dep = new Dep();
  6933. this.vmCount = 0;
  6934. def(value, '__ob__', this);
  6935. if (Array.isArray(value)) {
  6936. if (hasProto) {
  6937. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  6938. if(value.push !== value.__proto__.push){
  6939. copyAugment(value, arrayMethods, arrayKeys);
  6940. } else {
  6941. protoAugment(value, arrayMethods);
  6942. }
  6943. }
  6944. } else {
  6945. copyAugment(value, arrayMethods, arrayKeys);
  6946. }
  6947. this.observeArray(value);
  6948. } else {
  6949. this.walk(value);
  6950. }
  6951. };
  6952. /**
  6953. * Walk through all properties and convert them into
  6954. * getter/setters. This method should only be called when
  6955. * value type is Object.
  6956. */
  6957. Observer.prototype.walk = function walk (obj) {
  6958. var keys = Object.keys(obj);
  6959. for (var i = 0; i < keys.length; i++) {
  6960. defineReactive$$1(obj, keys[i]);
  6961. }
  6962. };
  6963. /**
  6964. * Observe a list of Array items.
  6965. */
  6966. Observer.prototype.observeArray = function observeArray (items) {
  6967. for (var i = 0, l = items.length; i < l; i++) {
  6968. observe(items[i]);
  6969. }
  6970. };
  6971. // helpers
  6972. /**
  6973. * Augment a target Object or Array by intercepting
  6974. * the prototype chain using __proto__
  6975. */
  6976. function protoAugment (target, src) {
  6977. /* eslint-disable no-proto */
  6978. target.__proto__ = src;
  6979. /* eslint-enable no-proto */
  6980. }
  6981. /**
  6982. * Augment a target Object or Array by defining
  6983. * hidden properties.
  6984. */
  6985. /* istanbul ignore next */
  6986. function copyAugment (target, src, keys) {
  6987. for (var i = 0, l = keys.length; i < l; i++) {
  6988. var key = keys[i];
  6989. def(target, key, src[key]);
  6990. }
  6991. }
  6992. /**
  6993. * Attempt to create an observer instance for a value,
  6994. * returns the new observer if successfully observed,
  6995. * or the existing observer if the value already has one.
  6996. */
  6997. function observe (value, asRootData) {
  6998. if (!isObject(value) || value instanceof VNode) {
  6999. return
  7000. }
  7001. var ob;
  7002. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  7003. ob = value.__ob__;
  7004. } else if (
  7005. shouldObserve &&
  7006. !isServerRendering() &&
  7007. (Array.isArray(value) || isPlainObject(value)) &&
  7008. Object.isExtensible(value) &&
  7009. !value._isVue &&
  7010. !value.__v_isMPComponent
  7011. ) {
  7012. ob = new Observer(value);
  7013. }
  7014. if (asRootData && ob) {
  7015. ob.vmCount++;
  7016. }
  7017. return ob
  7018. }
  7019. /**
  7020. * Define a reactive property on an Object.
  7021. */
  7022. function defineReactive$$1 (
  7023. obj,
  7024. key,
  7025. val,
  7026. customSetter,
  7027. shallow
  7028. ) {
  7029. var dep = new Dep();
  7030. var property = Object.getOwnPropertyDescriptor(obj, key);
  7031. if (property && property.configurable === false) {
  7032. return
  7033. }
  7034. // cater for pre-defined getter/setters
  7035. var getter = property && property.get;
  7036. var setter = property && property.set;
  7037. if ((!getter || setter) && arguments.length === 2) {
  7038. val = obj[key];
  7039. }
  7040. var childOb = !shallow && observe(val);
  7041. Object.defineProperty(obj, key, {
  7042. enumerable: true,
  7043. configurable: true,
  7044. get: function reactiveGetter () {
  7045. var value = getter ? getter.call(obj) : val;
  7046. if (Dep.SharedObject.target) { // fixed by xxxxxx
  7047. dep.depend();
  7048. if (childOb) {
  7049. childOb.dep.depend();
  7050. if (Array.isArray(value)) {
  7051. dependArray(value);
  7052. }
  7053. }
  7054. }
  7055. return value
  7056. },
  7057. set: function reactiveSetter (newVal) {
  7058. var value = getter ? getter.call(obj) : val;
  7059. /* eslint-disable no-self-compare */
  7060. if (newVal === value || (newVal !== newVal && value !== value)) {
  7061. return
  7062. }
  7063. /* eslint-enable no-self-compare */
  7064. if ( true && customSetter) {
  7065. customSetter();
  7066. }
  7067. // #7981: for accessor properties without setter
  7068. if (getter && !setter) { return }
  7069. if (setter) {
  7070. setter.call(obj, newVal);
  7071. } else {
  7072. val = newVal;
  7073. }
  7074. childOb = !shallow && observe(newVal);
  7075. dep.notify();
  7076. }
  7077. });
  7078. }
  7079. /**
  7080. * Set a property on an object. Adds the new property and
  7081. * triggers change notification if the property doesn't
  7082. * already exist.
  7083. */
  7084. function set (target, key, val) {
  7085. if ( true &&
  7086. (isUndef(target) || isPrimitive(target))
  7087. ) {
  7088. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  7089. }
  7090. if (Array.isArray(target) && isValidArrayIndex(key)) {
  7091. target.length = Math.max(target.length, key);
  7092. target.splice(key, 1, val);
  7093. return val
  7094. }
  7095. if (key in target && !(key in Object.prototype)) {
  7096. target[key] = val;
  7097. return val
  7098. }
  7099. var ob = (target).__ob__;
  7100. if (target._isVue || (ob && ob.vmCount)) {
  7101. true && warn(
  7102. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  7103. 'at runtime - declare it upfront in the data option.'
  7104. );
  7105. return val
  7106. }
  7107. if (!ob) {
  7108. target[key] = val;
  7109. return val
  7110. }
  7111. defineReactive$$1(ob.value, key, val);
  7112. ob.dep.notify();
  7113. return val
  7114. }
  7115. /**
  7116. * Delete a property and trigger change if necessary.
  7117. */
  7118. function del (target, key) {
  7119. if ( true &&
  7120. (isUndef(target) || isPrimitive(target))
  7121. ) {
  7122. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  7123. }
  7124. if (Array.isArray(target) && isValidArrayIndex(key)) {
  7125. target.splice(key, 1);
  7126. return
  7127. }
  7128. var ob = (target).__ob__;
  7129. if (target._isVue || (ob && ob.vmCount)) {
  7130. true && warn(
  7131. 'Avoid deleting properties on a Vue instance or its root $data ' +
  7132. '- just set it to null.'
  7133. );
  7134. return
  7135. }
  7136. if (!hasOwn(target, key)) {
  7137. return
  7138. }
  7139. delete target[key];
  7140. if (!ob) {
  7141. return
  7142. }
  7143. ob.dep.notify();
  7144. }
  7145. /**
  7146. * Collect dependencies on array elements when the array is touched, since
  7147. * we cannot intercept array element access like property getters.
  7148. */
  7149. function dependArray (value) {
  7150. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  7151. e = value[i];
  7152. e && e.__ob__ && e.__ob__.dep.depend();
  7153. if (Array.isArray(e)) {
  7154. dependArray(e);
  7155. }
  7156. }
  7157. }
  7158. /* */
  7159. /**
  7160. * Option overwriting strategies are functions that handle
  7161. * how to merge a parent option value and a child option
  7162. * value into the final value.
  7163. */
  7164. var strats = config.optionMergeStrategies;
  7165. /**
  7166. * Options with restrictions
  7167. */
  7168. if (true) {
  7169. strats.el = strats.propsData = function (parent, child, vm, key) {
  7170. if (!vm) {
  7171. warn(
  7172. "option \"" + key + "\" can only be used during instance " +
  7173. 'creation with the `new` keyword.'
  7174. );
  7175. }
  7176. return defaultStrat(parent, child)
  7177. };
  7178. }
  7179. /**
  7180. * Helper that recursively merges two data objects together.
  7181. */
  7182. function mergeData (to, from) {
  7183. if (!from) { return to }
  7184. var key, toVal, fromVal;
  7185. var keys = hasSymbol
  7186. ? Reflect.ownKeys(from)
  7187. : Object.keys(from);
  7188. for (var i = 0; i < keys.length; i++) {
  7189. key = keys[i];
  7190. // in case the object is already observed...
  7191. if (key === '__ob__') { continue }
  7192. toVal = to[key];
  7193. fromVal = from[key];
  7194. if (!hasOwn(to, key)) {
  7195. set(to, key, fromVal);
  7196. } else if (
  7197. toVal !== fromVal &&
  7198. isPlainObject(toVal) &&
  7199. isPlainObject(fromVal)
  7200. ) {
  7201. mergeData(toVal, fromVal);
  7202. }
  7203. }
  7204. return to
  7205. }
  7206. /**
  7207. * Data
  7208. */
  7209. function mergeDataOrFn (
  7210. parentVal,
  7211. childVal,
  7212. vm
  7213. ) {
  7214. if (!vm) {
  7215. // in a Vue.extend merge, both should be functions
  7216. if (!childVal) {
  7217. return parentVal
  7218. }
  7219. if (!parentVal) {
  7220. return childVal
  7221. }
  7222. // when parentVal & childVal are both present,
  7223. // we need to return a function that returns the
  7224. // merged result of both functions... no need to
  7225. // check if parentVal is a function here because
  7226. // it has to be a function to pass previous merges.
  7227. return function mergedDataFn () {
  7228. return mergeData(
  7229. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  7230. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  7231. )
  7232. }
  7233. } else {
  7234. return function mergedInstanceDataFn () {
  7235. // instance merge
  7236. var instanceData = typeof childVal === 'function'
  7237. ? childVal.call(vm, vm)
  7238. : childVal;
  7239. var defaultData = typeof parentVal === 'function'
  7240. ? parentVal.call(vm, vm)
  7241. : parentVal;
  7242. if (instanceData) {
  7243. return mergeData(instanceData, defaultData)
  7244. } else {
  7245. return defaultData
  7246. }
  7247. }
  7248. }
  7249. }
  7250. strats.data = function (
  7251. parentVal,
  7252. childVal,
  7253. vm
  7254. ) {
  7255. if (!vm) {
  7256. if (childVal && typeof childVal !== 'function') {
  7257. true && warn(
  7258. 'The "data" option should be a function ' +
  7259. 'that returns a per-instance value in component ' +
  7260. 'definitions.',
  7261. vm
  7262. );
  7263. return parentVal
  7264. }
  7265. return mergeDataOrFn(parentVal, childVal)
  7266. }
  7267. return mergeDataOrFn(parentVal, childVal, vm)
  7268. };
  7269. /**
  7270. * Hooks and props are merged as arrays.
  7271. */
  7272. function mergeHook (
  7273. parentVal,
  7274. childVal
  7275. ) {
  7276. var res = childVal
  7277. ? parentVal
  7278. ? parentVal.concat(childVal)
  7279. : Array.isArray(childVal)
  7280. ? childVal
  7281. : [childVal]
  7282. : parentVal;
  7283. return res
  7284. ? dedupeHooks(res)
  7285. : res
  7286. }
  7287. function dedupeHooks (hooks) {
  7288. var res = [];
  7289. for (var i = 0; i < hooks.length; i++) {
  7290. if (res.indexOf(hooks[i]) === -1) {
  7291. res.push(hooks[i]);
  7292. }
  7293. }
  7294. return res
  7295. }
  7296. LIFECYCLE_HOOKS.forEach(function (hook) {
  7297. strats[hook] = mergeHook;
  7298. });
  7299. /**
  7300. * Assets
  7301. *
  7302. * When a vm is present (instance creation), we need to do
  7303. * a three-way merge between constructor options, instance
  7304. * options and parent options.
  7305. */
  7306. function mergeAssets (
  7307. parentVal,
  7308. childVal,
  7309. vm,
  7310. key
  7311. ) {
  7312. var res = Object.create(parentVal || null);
  7313. if (childVal) {
  7314. true && assertObjectType(key, childVal, vm);
  7315. return extend(res, childVal)
  7316. } else {
  7317. return res
  7318. }
  7319. }
  7320. ASSET_TYPES.forEach(function (type) {
  7321. strats[type + 's'] = mergeAssets;
  7322. });
  7323. /**
  7324. * Watchers.
  7325. *
  7326. * Watchers hashes should not overwrite one
  7327. * another, so we merge them as arrays.
  7328. */
  7329. strats.watch = function (
  7330. parentVal,
  7331. childVal,
  7332. vm,
  7333. key
  7334. ) {
  7335. // work around Firefox's Object.prototype.watch...
  7336. if (parentVal === nativeWatch) { parentVal = undefined; }
  7337. if (childVal === nativeWatch) { childVal = undefined; }
  7338. /* istanbul ignore if */
  7339. if (!childVal) { return Object.create(parentVal || null) }
  7340. if (true) {
  7341. assertObjectType(key, childVal, vm);
  7342. }
  7343. if (!parentVal) { return childVal }
  7344. var ret = {};
  7345. extend(ret, parentVal);
  7346. for (var key$1 in childVal) {
  7347. var parent = ret[key$1];
  7348. var child = childVal[key$1];
  7349. if (parent && !Array.isArray(parent)) {
  7350. parent = [parent];
  7351. }
  7352. ret[key$1] = parent
  7353. ? parent.concat(child)
  7354. : Array.isArray(child) ? child : [child];
  7355. }
  7356. return ret
  7357. };
  7358. /**
  7359. * Other object hashes.
  7360. */
  7361. strats.props =
  7362. strats.methods =
  7363. strats.inject =
  7364. strats.computed = function (
  7365. parentVal,
  7366. childVal,
  7367. vm,
  7368. key
  7369. ) {
  7370. if (childVal && "development" !== 'production') {
  7371. assertObjectType(key, childVal, vm);
  7372. }
  7373. if (!parentVal) { return childVal }
  7374. var ret = Object.create(null);
  7375. extend(ret, parentVal);
  7376. if (childVal) { extend(ret, childVal); }
  7377. return ret
  7378. };
  7379. strats.provide = mergeDataOrFn;
  7380. /**
  7381. * Default strategy.
  7382. */
  7383. var defaultStrat = function (parentVal, childVal) {
  7384. return childVal === undefined
  7385. ? parentVal
  7386. : childVal
  7387. };
  7388. /**
  7389. * Validate component names
  7390. */
  7391. function checkComponents (options) {
  7392. for (var key in options.components) {
  7393. validateComponentName(key);
  7394. }
  7395. }
  7396. function validateComponentName (name) {
  7397. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  7398. warn(
  7399. 'Invalid component name: "' + name + '". Component names ' +
  7400. 'should conform to valid custom element name in html5 specification.'
  7401. );
  7402. }
  7403. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  7404. warn(
  7405. 'Do not use built-in or reserved HTML elements as component ' +
  7406. 'id: ' + name
  7407. );
  7408. }
  7409. }
  7410. /**
  7411. * Ensure all props option syntax are normalized into the
  7412. * Object-based format.
  7413. */
  7414. function normalizeProps (options, vm) {
  7415. var props = options.props;
  7416. if (!props) { return }
  7417. var res = {};
  7418. var i, val, name;
  7419. if (Array.isArray(props)) {
  7420. i = props.length;
  7421. while (i--) {
  7422. val = props[i];
  7423. if (typeof val === 'string') {
  7424. name = camelize(val);
  7425. res[name] = { type: null };
  7426. } else if (true) {
  7427. warn('props must be strings when using array syntax.');
  7428. }
  7429. }
  7430. } else if (isPlainObject(props)) {
  7431. for (var key in props) {
  7432. val = props[key];
  7433. name = camelize(key);
  7434. res[name] = isPlainObject(val)
  7435. ? val
  7436. : { type: val };
  7437. }
  7438. } else if (true) {
  7439. warn(
  7440. "Invalid value for option \"props\": expected an Array or an Object, " +
  7441. "but got " + (toRawType(props)) + ".",
  7442. vm
  7443. );
  7444. }
  7445. options.props = res;
  7446. }
  7447. /**
  7448. * Normalize all injections into Object-based format
  7449. */
  7450. function normalizeInject (options, vm) {
  7451. var inject = options.inject;
  7452. if (!inject) { return }
  7453. var normalized = options.inject = {};
  7454. if (Array.isArray(inject)) {
  7455. for (var i = 0; i < inject.length; i++) {
  7456. normalized[inject[i]] = { from: inject[i] };
  7457. }
  7458. } else if (isPlainObject(inject)) {
  7459. for (var key in inject) {
  7460. var val = inject[key];
  7461. normalized[key] = isPlainObject(val)
  7462. ? extend({ from: key }, val)
  7463. : { from: val };
  7464. }
  7465. } else if (true) {
  7466. warn(
  7467. "Invalid value for option \"inject\": expected an Array or an Object, " +
  7468. "but got " + (toRawType(inject)) + ".",
  7469. vm
  7470. );
  7471. }
  7472. }
  7473. /**
  7474. * Normalize raw function directives into object format.
  7475. */
  7476. function normalizeDirectives (options) {
  7477. var dirs = options.directives;
  7478. if (dirs) {
  7479. for (var key in dirs) {
  7480. var def$$1 = dirs[key];
  7481. if (typeof def$$1 === 'function') {
  7482. dirs[key] = { bind: def$$1, update: def$$1 };
  7483. }
  7484. }
  7485. }
  7486. }
  7487. function assertObjectType (name, value, vm) {
  7488. if (!isPlainObject(value)) {
  7489. warn(
  7490. "Invalid value for option \"" + name + "\": expected an Object, " +
  7491. "but got " + (toRawType(value)) + ".",
  7492. vm
  7493. );
  7494. }
  7495. }
  7496. /**
  7497. * Merge two option objects into a new one.
  7498. * Core utility used in both instantiation and inheritance.
  7499. */
  7500. function mergeOptions (
  7501. parent,
  7502. child,
  7503. vm
  7504. ) {
  7505. if (true) {
  7506. checkComponents(child);
  7507. }
  7508. if (typeof child === 'function') {
  7509. child = child.options;
  7510. }
  7511. normalizeProps(child, vm);
  7512. normalizeInject(child, vm);
  7513. normalizeDirectives(child);
  7514. // Apply extends and mixins on the child options,
  7515. // but only if it is a raw options object that isn't
  7516. // the result of another mergeOptions call.
  7517. // Only merged options has the _base property.
  7518. if (!child._base) {
  7519. if (child.extends) {
  7520. parent = mergeOptions(parent, child.extends, vm);
  7521. }
  7522. if (child.mixins) {
  7523. for (var i = 0, l = child.mixins.length; i < l; i++) {
  7524. parent = mergeOptions(parent, child.mixins[i], vm);
  7525. }
  7526. }
  7527. }
  7528. var options = {};
  7529. var key;
  7530. for (key in parent) {
  7531. mergeField(key);
  7532. }
  7533. for (key in child) {
  7534. if (!hasOwn(parent, key)) {
  7535. mergeField(key);
  7536. }
  7537. }
  7538. function mergeField (key) {
  7539. var strat = strats[key] || defaultStrat;
  7540. options[key] = strat(parent[key], child[key], vm, key);
  7541. }
  7542. return options
  7543. }
  7544. /**
  7545. * Resolve an asset.
  7546. * This function is used because child instances need access
  7547. * to assets defined in its ancestor chain.
  7548. */
  7549. function resolveAsset (
  7550. options,
  7551. type,
  7552. id,
  7553. warnMissing
  7554. ) {
  7555. /* istanbul ignore if */
  7556. if (typeof id !== 'string') {
  7557. return
  7558. }
  7559. var assets = options[type];
  7560. // check local registration variations first
  7561. if (hasOwn(assets, id)) { return assets[id] }
  7562. var camelizedId = camelize(id);
  7563. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  7564. var PascalCaseId = capitalize(camelizedId);
  7565. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  7566. // fallback to prototype chain
  7567. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  7568. if ( true && warnMissing && !res) {
  7569. warn(
  7570. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  7571. options
  7572. );
  7573. }
  7574. return res
  7575. }
  7576. /* */
  7577. function validateProp (
  7578. key,
  7579. propOptions,
  7580. propsData,
  7581. vm
  7582. ) {
  7583. var prop = propOptions[key];
  7584. var absent = !hasOwn(propsData, key);
  7585. var value = propsData[key];
  7586. // boolean casting
  7587. var booleanIndex = getTypeIndex(Boolean, prop.type);
  7588. if (booleanIndex > -1) {
  7589. if (absent && !hasOwn(prop, 'default')) {
  7590. value = false;
  7591. } else if (value === '' || value === hyphenate(key)) {
  7592. // only cast empty string / same name to boolean if
  7593. // boolean has higher priority
  7594. var stringIndex = getTypeIndex(String, prop.type);
  7595. if (stringIndex < 0 || booleanIndex < stringIndex) {
  7596. value = true;
  7597. }
  7598. }
  7599. }
  7600. // check default value
  7601. if (value === undefined) {
  7602. value = getPropDefaultValue(vm, prop, key);
  7603. // since the default value is a fresh copy,
  7604. // make sure to observe it.
  7605. var prevShouldObserve = shouldObserve;
  7606. toggleObserving(true);
  7607. observe(value);
  7608. toggleObserving(prevShouldObserve);
  7609. }
  7610. if (
  7611. true
  7612. ) {
  7613. assertProp(prop, key, value, vm, absent);
  7614. }
  7615. return value
  7616. }
  7617. /**
  7618. * Get the default value of a prop.
  7619. */
  7620. function getPropDefaultValue (vm, prop, key) {
  7621. // no default, return undefined
  7622. if (!hasOwn(prop, 'default')) {
  7623. return undefined
  7624. }
  7625. var def = prop.default;
  7626. // warn against non-factory defaults for Object & Array
  7627. if ( true && isObject(def)) {
  7628. warn(
  7629. 'Invalid default value for prop "' + key + '": ' +
  7630. 'Props with type Object/Array must use a factory function ' +
  7631. 'to return the default value.',
  7632. vm
  7633. );
  7634. }
  7635. // the raw prop value was also undefined from previous render,
  7636. // return previous default value to avoid unnecessary watcher trigger
  7637. if (vm && vm.$options.propsData &&
  7638. vm.$options.propsData[key] === undefined &&
  7639. vm._props[key] !== undefined
  7640. ) {
  7641. return vm._props[key]
  7642. }
  7643. // call factory function for non-Function types
  7644. // a value is Function if its prototype is function even across different execution context
  7645. return typeof def === 'function' && getType(prop.type) !== 'Function'
  7646. ? def.call(vm)
  7647. : def
  7648. }
  7649. /**
  7650. * Assert whether a prop is valid.
  7651. */
  7652. function assertProp (
  7653. prop,
  7654. name,
  7655. value,
  7656. vm,
  7657. absent
  7658. ) {
  7659. if (prop.required && absent) {
  7660. warn(
  7661. 'Missing required prop: "' + name + '"',
  7662. vm
  7663. );
  7664. return
  7665. }
  7666. if (value == null && !prop.required) {
  7667. return
  7668. }
  7669. var type = prop.type;
  7670. var valid = !type || type === true;
  7671. var expectedTypes = [];
  7672. if (type) {
  7673. if (!Array.isArray(type)) {
  7674. type = [type];
  7675. }
  7676. for (var i = 0; i < type.length && !valid; i++) {
  7677. var assertedType = assertType(value, type[i]);
  7678. expectedTypes.push(assertedType.expectedType || '');
  7679. valid = assertedType.valid;
  7680. }
  7681. }
  7682. if (!valid) {
  7683. warn(
  7684. getInvalidTypeMessage(name, value, expectedTypes),
  7685. vm
  7686. );
  7687. return
  7688. }
  7689. var validator = prop.validator;
  7690. if (validator) {
  7691. if (!validator(value)) {
  7692. warn(
  7693. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  7694. vm
  7695. );
  7696. }
  7697. }
  7698. }
  7699. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  7700. function assertType (value, type) {
  7701. var valid;
  7702. var expectedType = getType(type);
  7703. if (simpleCheckRE.test(expectedType)) {
  7704. var t = typeof value;
  7705. valid = t === expectedType.toLowerCase();
  7706. // for primitive wrapper objects
  7707. if (!valid && t === 'object') {
  7708. valid = value instanceof type;
  7709. }
  7710. } else if (expectedType === 'Object') {
  7711. valid = isPlainObject(value);
  7712. } else if (expectedType === 'Array') {
  7713. valid = Array.isArray(value);
  7714. } else {
  7715. valid = value instanceof type;
  7716. }
  7717. return {
  7718. valid: valid,
  7719. expectedType: expectedType
  7720. }
  7721. }
  7722. /**
  7723. * Use function string name to check built-in types,
  7724. * because a simple equality check will fail when running
  7725. * across different vms / iframes.
  7726. */
  7727. function getType (fn) {
  7728. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  7729. return match ? match[1] : ''
  7730. }
  7731. function isSameType (a, b) {
  7732. return getType(a) === getType(b)
  7733. }
  7734. function getTypeIndex (type, expectedTypes) {
  7735. if (!Array.isArray(expectedTypes)) {
  7736. return isSameType(expectedTypes, type) ? 0 : -1
  7737. }
  7738. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  7739. if (isSameType(expectedTypes[i], type)) {
  7740. return i
  7741. }
  7742. }
  7743. return -1
  7744. }
  7745. function getInvalidTypeMessage (name, value, expectedTypes) {
  7746. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  7747. " Expected " + (expectedTypes.map(capitalize).join(', '));
  7748. var expectedType = expectedTypes[0];
  7749. var receivedType = toRawType(value);
  7750. var expectedValue = styleValue(value, expectedType);
  7751. var receivedValue = styleValue(value, receivedType);
  7752. // check if we need to specify expected value
  7753. if (expectedTypes.length === 1 &&
  7754. isExplicable(expectedType) &&
  7755. !isBoolean(expectedType, receivedType)) {
  7756. message += " with value " + expectedValue;
  7757. }
  7758. message += ", got " + receivedType + " ";
  7759. // check if we need to specify received value
  7760. if (isExplicable(receivedType)) {
  7761. message += "with value " + receivedValue + ".";
  7762. }
  7763. return message
  7764. }
  7765. function styleValue (value, type) {
  7766. if (type === 'String') {
  7767. return ("\"" + value + "\"")
  7768. } else if (type === 'Number') {
  7769. return ("" + (Number(value)))
  7770. } else {
  7771. return ("" + value)
  7772. }
  7773. }
  7774. function isExplicable (value) {
  7775. var explicitTypes = ['string', 'number', 'boolean'];
  7776. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  7777. }
  7778. function isBoolean () {
  7779. var args = [], len = arguments.length;
  7780. while ( len-- ) args[ len ] = arguments[ len ];
  7781. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  7782. }
  7783. /* */
  7784. function handleError (err, vm, info) {
  7785. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  7786. // See: https://github.com/vuejs/vuex/issues/1505
  7787. pushTarget();
  7788. try {
  7789. if (vm) {
  7790. var cur = vm;
  7791. while ((cur = cur.$parent)) {
  7792. var hooks = cur.$options.errorCaptured;
  7793. if (hooks) {
  7794. for (var i = 0; i < hooks.length; i++) {
  7795. try {
  7796. var capture = hooks[i].call(cur, err, vm, info) === false;
  7797. if (capture) { return }
  7798. } catch (e) {
  7799. globalHandleError(e, cur, 'errorCaptured hook');
  7800. }
  7801. }
  7802. }
  7803. }
  7804. }
  7805. globalHandleError(err, vm, info);
  7806. } finally {
  7807. popTarget();
  7808. }
  7809. }
  7810. function invokeWithErrorHandling (
  7811. handler,
  7812. context,
  7813. args,
  7814. vm,
  7815. info
  7816. ) {
  7817. var res;
  7818. try {
  7819. res = args ? handler.apply(context, args) : handler.call(context);
  7820. if (res && !res._isVue && isPromise(res) && !res._handled) {
  7821. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  7822. // issue #9511
  7823. // avoid catch triggering multiple times when nested calls
  7824. res._handled = true;
  7825. }
  7826. } catch (e) {
  7827. handleError(e, vm, info);
  7828. }
  7829. return res
  7830. }
  7831. function globalHandleError (err, vm, info) {
  7832. if (config.errorHandler) {
  7833. try {
  7834. return config.errorHandler.call(null, err, vm, info)
  7835. } catch (e) {
  7836. // if the user intentionally throws the original error in the handler,
  7837. // do not log it twice
  7838. if (e !== err) {
  7839. logError(e, null, 'config.errorHandler');
  7840. }
  7841. }
  7842. }
  7843. logError(err, vm, info);
  7844. }
  7845. function logError (err, vm, info) {
  7846. if (true) {
  7847. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  7848. }
  7849. /* istanbul ignore else */
  7850. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  7851. console.error(err);
  7852. } else {
  7853. throw err
  7854. }
  7855. }
  7856. /* */
  7857. var callbacks = [];
  7858. var pending = false;
  7859. function flushCallbacks () {
  7860. pending = false;
  7861. var copies = callbacks.slice(0);
  7862. callbacks.length = 0;
  7863. for (var i = 0; i < copies.length; i++) {
  7864. copies[i]();
  7865. }
  7866. }
  7867. // Here we have async deferring wrappers using microtasks.
  7868. // In 2.5 we used (macro) tasks (in combination with microtasks).
  7869. // However, it has subtle problems when state is changed right before repaint
  7870. // (e.g. #6813, out-in transitions).
  7871. // Also, using (macro) tasks in event handler would cause some weird behaviors
  7872. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  7873. // So we now use microtasks everywhere, again.
  7874. // A major drawback of this tradeoff is that there are some scenarios
  7875. // where microtasks have too high a priority and fire in between supposedly
  7876. // sequential events (e.g. #4521, #6690, which have workarounds)
  7877. // or even between bubbling of the same event (#6566).
  7878. var timerFunc;
  7879. // The nextTick behavior leverages the microtask queue, which can be accessed
  7880. // via either native Promise.then or MutationObserver.
  7881. // MutationObserver has wider support, however it is seriously bugged in
  7882. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  7883. // completely stops working after triggering a few times... so, if native
  7884. // Promise is available, we will use it:
  7885. /* istanbul ignore next, $flow-disable-line */
  7886. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  7887. var p = Promise.resolve();
  7888. timerFunc = function () {
  7889. p.then(flushCallbacks);
  7890. // In problematic UIWebViews, Promise.then doesn't completely break, but
  7891. // it can get stuck in a weird state where callbacks are pushed into the
  7892. // microtask queue but the queue isn't being flushed, until the browser
  7893. // needs to do some other work, e.g. handle a timer. Therefore we can
  7894. // "force" the microtask queue to be flushed by adding an empty timer.
  7895. if (isIOS) { setTimeout(noop); }
  7896. };
  7897. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  7898. isNative(MutationObserver) ||
  7899. // PhantomJS and iOS 7.x
  7900. MutationObserver.toString() === '[object MutationObserverConstructor]'
  7901. )) {
  7902. // Use MutationObserver where native Promise is not available,
  7903. // e.g. PhantomJS, iOS7, Android 4.4
  7904. // (#6466 MutationObserver is unreliable in IE11)
  7905. var counter = 1;
  7906. var observer = new MutationObserver(flushCallbacks);
  7907. var textNode = document.createTextNode(String(counter));
  7908. observer.observe(textNode, {
  7909. characterData: true
  7910. });
  7911. timerFunc = function () {
  7912. counter = (counter + 1) % 2;
  7913. textNode.data = String(counter);
  7914. };
  7915. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  7916. // Fallback to setImmediate.
  7917. // Technically it leverages the (macro) task queue,
  7918. // but it is still a better choice than setTimeout.
  7919. timerFunc = function () {
  7920. setImmediate(flushCallbacks);
  7921. };
  7922. } else {
  7923. // Fallback to setTimeout.
  7924. timerFunc = function () {
  7925. setTimeout(flushCallbacks, 0);
  7926. };
  7927. }
  7928. function nextTick (cb, ctx) {
  7929. var _resolve;
  7930. callbacks.push(function () {
  7931. if (cb) {
  7932. try {
  7933. cb.call(ctx);
  7934. } catch (e) {
  7935. handleError(e, ctx, 'nextTick');
  7936. }
  7937. } else if (_resolve) {
  7938. _resolve(ctx);
  7939. }
  7940. });
  7941. if (!pending) {
  7942. pending = true;
  7943. timerFunc();
  7944. }
  7945. // $flow-disable-line
  7946. if (!cb && typeof Promise !== 'undefined') {
  7947. return new Promise(function (resolve) {
  7948. _resolve = resolve;
  7949. })
  7950. }
  7951. }
  7952. /* */
  7953. /* not type checking this file because flow doesn't play well with Proxy */
  7954. var initProxy;
  7955. if (true) {
  7956. var allowedGlobals = makeMap(
  7957. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  7958. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  7959. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  7960. 'require' // for Webpack/Browserify
  7961. );
  7962. var warnNonPresent = function (target, key) {
  7963. warn(
  7964. "Property or method \"" + key + "\" is not defined on the instance but " +
  7965. 'referenced during render. Make sure that this property is reactive, ' +
  7966. 'either in the data option, or for class-based components, by ' +
  7967. 'initializing the property. ' +
  7968. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  7969. target
  7970. );
  7971. };
  7972. var warnReservedPrefix = function (target, key) {
  7973. warn(
  7974. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  7975. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  7976. 'prevent conflicts with Vue internals. ' +
  7977. 'See: https://vuejs.org/v2/api/#data',
  7978. target
  7979. );
  7980. };
  7981. var hasProxy =
  7982. typeof Proxy !== 'undefined' && isNative(Proxy);
  7983. if (hasProxy) {
  7984. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  7985. config.keyCodes = new Proxy(config.keyCodes, {
  7986. set: function set (target, key, value) {
  7987. if (isBuiltInModifier(key)) {
  7988. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  7989. return false
  7990. } else {
  7991. target[key] = value;
  7992. return true
  7993. }
  7994. }
  7995. });
  7996. }
  7997. var hasHandler = {
  7998. has: function has (target, key) {
  7999. var has = key in target;
  8000. var isAllowed = allowedGlobals(key) ||
  8001. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  8002. if (!has && !isAllowed) {
  8003. if (key in target.$data) { warnReservedPrefix(target, key); }
  8004. else { warnNonPresent(target, key); }
  8005. }
  8006. return has || !isAllowed
  8007. }
  8008. };
  8009. var getHandler = {
  8010. get: function get (target, key) {
  8011. if (typeof key === 'string' && !(key in target)) {
  8012. if (key in target.$data) { warnReservedPrefix(target, key); }
  8013. else { warnNonPresent(target, key); }
  8014. }
  8015. return target[key]
  8016. }
  8017. };
  8018. initProxy = function initProxy (vm) {
  8019. if (hasProxy) {
  8020. // determine which proxy handler to use
  8021. var options = vm.$options;
  8022. var handlers = options.render && options.render._withStripped
  8023. ? getHandler
  8024. : hasHandler;
  8025. vm._renderProxy = new Proxy(vm, handlers);
  8026. } else {
  8027. vm._renderProxy = vm;
  8028. }
  8029. };
  8030. }
  8031. /* */
  8032. var seenObjects = new _Set();
  8033. /**
  8034. * Recursively traverse an object to evoke all converted
  8035. * getters, so that every nested property inside the object
  8036. * is collected as a "deep" dependency.
  8037. */
  8038. function traverse (val) {
  8039. _traverse(val, seenObjects);
  8040. seenObjects.clear();
  8041. }
  8042. function _traverse (val, seen) {
  8043. var i, keys;
  8044. var isA = Array.isArray(val);
  8045. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  8046. return
  8047. }
  8048. if (val.__ob__) {
  8049. var depId = val.__ob__.dep.id;
  8050. if (seen.has(depId)) {
  8051. return
  8052. }
  8053. seen.add(depId);
  8054. }
  8055. if (isA) {
  8056. i = val.length;
  8057. while (i--) { _traverse(val[i], seen); }
  8058. } else {
  8059. keys = Object.keys(val);
  8060. i = keys.length;
  8061. while (i--) { _traverse(val[keys[i]], seen); }
  8062. }
  8063. }
  8064. var mark;
  8065. var measure;
  8066. if (true) {
  8067. var perf = inBrowser && window.performance;
  8068. /* istanbul ignore if */
  8069. if (
  8070. perf &&
  8071. perf.mark &&
  8072. perf.measure &&
  8073. perf.clearMarks &&
  8074. perf.clearMeasures
  8075. ) {
  8076. mark = function (tag) { return perf.mark(tag); };
  8077. measure = function (name, startTag, endTag) {
  8078. perf.measure(name, startTag, endTag);
  8079. perf.clearMarks(startTag);
  8080. perf.clearMarks(endTag);
  8081. // perf.clearMeasures(name)
  8082. };
  8083. }
  8084. }
  8085. /* */
  8086. var normalizeEvent = cached(function (name) {
  8087. var passive = name.charAt(0) === '&';
  8088. name = passive ? name.slice(1) : name;
  8089. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  8090. name = once$$1 ? name.slice(1) : name;
  8091. var capture = name.charAt(0) === '!';
  8092. name = capture ? name.slice(1) : name;
  8093. return {
  8094. name: name,
  8095. once: once$$1,
  8096. capture: capture,
  8097. passive: passive
  8098. }
  8099. });
  8100. function createFnInvoker (fns, vm) {
  8101. function invoker () {
  8102. var arguments$1 = arguments;
  8103. var fns = invoker.fns;
  8104. if (Array.isArray(fns)) {
  8105. var cloned = fns.slice();
  8106. for (var i = 0; i < cloned.length; i++) {
  8107. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  8108. }
  8109. } else {
  8110. // return handler return value for single handlers
  8111. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  8112. }
  8113. }
  8114. invoker.fns = fns;
  8115. return invoker
  8116. }
  8117. function updateListeners (
  8118. on,
  8119. oldOn,
  8120. add,
  8121. remove$$1,
  8122. createOnceHandler,
  8123. vm
  8124. ) {
  8125. var name, def$$1, cur, old, event;
  8126. for (name in on) {
  8127. def$$1 = cur = on[name];
  8128. old = oldOn[name];
  8129. event = normalizeEvent(name);
  8130. if (isUndef(cur)) {
  8131. true && warn(
  8132. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  8133. vm
  8134. );
  8135. } else if (isUndef(old)) {
  8136. if (isUndef(cur.fns)) {
  8137. cur = on[name] = createFnInvoker(cur, vm);
  8138. }
  8139. if (isTrue(event.once)) {
  8140. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  8141. }
  8142. add(event.name, cur, event.capture, event.passive, event.params);
  8143. } else if (cur !== old) {
  8144. old.fns = cur;
  8145. on[name] = old;
  8146. }
  8147. }
  8148. for (name in oldOn) {
  8149. if (isUndef(on[name])) {
  8150. event = normalizeEvent(name);
  8151. remove$$1(event.name, oldOn[name], event.capture);
  8152. }
  8153. }
  8154. }
  8155. /* */
  8156. /* */
  8157. // fixed by xxxxxx (mp properties)
  8158. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  8159. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  8160. if (isUndef(propOptions)) {
  8161. return res
  8162. }
  8163. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  8164. var attrs = data.attrs;
  8165. var props = data.props;
  8166. if (isDef(attrs) || isDef(props)) {
  8167. for (var key in propOptions) {
  8168. var altKey = hyphenate(key);
  8169. var result = checkProp(res, props, key, altKey, true) ||
  8170. checkProp(res, attrs, key, altKey, false);
  8171. // externalClass
  8172. if (
  8173. result &&
  8174. res[key] &&
  8175. externalClasses.indexOf(altKey) !== -1 &&
  8176. context[camelize(res[key])]
  8177. ) {
  8178. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  8179. res[key] = context[camelize(res[key])];
  8180. }
  8181. }
  8182. }
  8183. return res
  8184. }
  8185. function extractPropsFromVNodeData (
  8186. data,
  8187. Ctor,
  8188. tag,
  8189. context// fixed by xxxxxx
  8190. ) {
  8191. // we are only extracting raw values here.
  8192. // validation and default values are handled in the child
  8193. // component itself.
  8194. var propOptions = Ctor.options.props;
  8195. if (isUndef(propOptions)) {
  8196. // fixed by xxxxxx
  8197. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  8198. }
  8199. var res = {};
  8200. var attrs = data.attrs;
  8201. var props = data.props;
  8202. if (isDef(attrs) || isDef(props)) {
  8203. for (var key in propOptions) {
  8204. var altKey = hyphenate(key);
  8205. if (true) {
  8206. var keyInLowerCase = key.toLowerCase();
  8207. if (
  8208. key !== keyInLowerCase &&
  8209. attrs && hasOwn(attrs, keyInLowerCase)
  8210. ) {
  8211. tip(
  8212. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  8213. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  8214. " \"" + key + "\". " +
  8215. "Note that HTML attributes are case-insensitive and camelCased " +
  8216. "props need to use their kebab-case equivalents when using in-DOM " +
  8217. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  8218. );
  8219. }
  8220. }
  8221. checkProp(res, props, key, altKey, true) ||
  8222. checkProp(res, attrs, key, altKey, false);
  8223. }
  8224. }
  8225. // fixed by xxxxxx
  8226. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  8227. }
  8228. function checkProp (
  8229. res,
  8230. hash,
  8231. key,
  8232. altKey,
  8233. preserve
  8234. ) {
  8235. if (isDef(hash)) {
  8236. if (hasOwn(hash, key)) {
  8237. res[key] = hash[key];
  8238. if (!preserve) {
  8239. delete hash[key];
  8240. }
  8241. return true
  8242. } else if (hasOwn(hash, altKey)) {
  8243. res[key] = hash[altKey];
  8244. if (!preserve) {
  8245. delete hash[altKey];
  8246. }
  8247. return true
  8248. }
  8249. }
  8250. return false
  8251. }
  8252. /* */
  8253. // The template compiler attempts to minimize the need for normalization by
  8254. // statically analyzing the template at compile time.
  8255. //
  8256. // For plain HTML markup, normalization can be completely skipped because the
  8257. // generated render function is guaranteed to return Array<VNode>. There are
  8258. // two cases where extra normalization is needed:
  8259. // 1. When the children contains components - because a functional component
  8260. // may return an Array instead of a single root. In this case, just a simple
  8261. // normalization is needed - if any child is an Array, we flatten the whole
  8262. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  8263. // because functional components already normalize their own children.
  8264. function simpleNormalizeChildren (children) {
  8265. for (var i = 0; i < children.length; i++) {
  8266. if (Array.isArray(children[i])) {
  8267. return Array.prototype.concat.apply([], children)
  8268. }
  8269. }
  8270. return children
  8271. }
  8272. // 2. When the children contains constructs that always generated nested Arrays,
  8273. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  8274. // with hand-written render functions / JSX. In such cases a full normalization
  8275. // is needed to cater to all possible types of children values.
  8276. function normalizeChildren (children) {
  8277. return isPrimitive(children)
  8278. ? [createTextVNode(children)]
  8279. : Array.isArray(children)
  8280. ? normalizeArrayChildren(children)
  8281. : undefined
  8282. }
  8283. function isTextNode (node) {
  8284. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  8285. }
  8286. function normalizeArrayChildren (children, nestedIndex) {
  8287. var res = [];
  8288. var i, c, lastIndex, last;
  8289. for (i = 0; i < children.length; i++) {
  8290. c = children[i];
  8291. if (isUndef(c) || typeof c === 'boolean') { continue }
  8292. lastIndex = res.length - 1;
  8293. last = res[lastIndex];
  8294. // nested
  8295. if (Array.isArray(c)) {
  8296. if (c.length > 0) {
  8297. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  8298. // merge adjacent text nodes
  8299. if (isTextNode(c[0]) && isTextNode(last)) {
  8300. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  8301. c.shift();
  8302. }
  8303. res.push.apply(res, c);
  8304. }
  8305. } else if (isPrimitive(c)) {
  8306. if (isTextNode(last)) {
  8307. // merge adjacent text nodes
  8308. // this is necessary for SSR hydration because text nodes are
  8309. // essentially merged when rendered to HTML strings
  8310. res[lastIndex] = createTextVNode(last.text + c);
  8311. } else if (c !== '') {
  8312. // convert primitive to vnode
  8313. res.push(createTextVNode(c));
  8314. }
  8315. } else {
  8316. if (isTextNode(c) && isTextNode(last)) {
  8317. // merge adjacent text nodes
  8318. res[lastIndex] = createTextVNode(last.text + c.text);
  8319. } else {
  8320. // default key for nested array children (likely generated by v-for)
  8321. if (isTrue(children._isVList) &&
  8322. isDef(c.tag) &&
  8323. isUndef(c.key) &&
  8324. isDef(nestedIndex)) {
  8325. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  8326. }
  8327. res.push(c);
  8328. }
  8329. }
  8330. }
  8331. return res
  8332. }
  8333. /* */
  8334. function initProvide (vm) {
  8335. var provide = vm.$options.provide;
  8336. if (provide) {
  8337. vm._provided = typeof provide === 'function'
  8338. ? provide.call(vm)
  8339. : provide;
  8340. }
  8341. }
  8342. function initInjections (vm) {
  8343. var result = resolveInject(vm.$options.inject, vm);
  8344. if (result) {
  8345. toggleObserving(false);
  8346. Object.keys(result).forEach(function (key) {
  8347. /* istanbul ignore else */
  8348. if (true) {
  8349. defineReactive$$1(vm, key, result[key], function () {
  8350. warn(
  8351. "Avoid mutating an injected value directly since the changes will be " +
  8352. "overwritten whenever the provided component re-renders. " +
  8353. "injection being mutated: \"" + key + "\"",
  8354. vm
  8355. );
  8356. });
  8357. } else {}
  8358. });
  8359. toggleObserving(true);
  8360. }
  8361. }
  8362. function resolveInject (inject, vm) {
  8363. if (inject) {
  8364. // inject is :any because flow is not smart enough to figure out cached
  8365. var result = Object.create(null);
  8366. var keys = hasSymbol
  8367. ? Reflect.ownKeys(inject)
  8368. : Object.keys(inject);
  8369. for (var i = 0; i < keys.length; i++) {
  8370. var key = keys[i];
  8371. // #6574 in case the inject object is observed...
  8372. if (key === '__ob__') { continue }
  8373. var provideKey = inject[key].from;
  8374. var source = vm;
  8375. while (source) {
  8376. if (source._provided && hasOwn(source._provided, provideKey)) {
  8377. result[key] = source._provided[provideKey];
  8378. break
  8379. }
  8380. source = source.$parent;
  8381. }
  8382. if (!source) {
  8383. if ('default' in inject[key]) {
  8384. var provideDefault = inject[key].default;
  8385. result[key] = typeof provideDefault === 'function'
  8386. ? provideDefault.call(vm)
  8387. : provideDefault;
  8388. } else if (true) {
  8389. warn(("Injection \"" + key + "\" not found"), vm);
  8390. }
  8391. }
  8392. }
  8393. return result
  8394. }
  8395. }
  8396. /* */
  8397. /**
  8398. * Runtime helper for resolving raw children VNodes into a slot object.
  8399. */
  8400. function resolveSlots (
  8401. children,
  8402. context
  8403. ) {
  8404. if (!children || !children.length) {
  8405. return {}
  8406. }
  8407. var slots = {};
  8408. for (var i = 0, l = children.length; i < l; i++) {
  8409. var child = children[i];
  8410. var data = child.data;
  8411. // remove slot attribute if the node is resolved as a Vue slot node
  8412. if (data && data.attrs && data.attrs.slot) {
  8413. delete data.attrs.slot;
  8414. }
  8415. // named slots should only be respected if the vnode was rendered in the
  8416. // same context.
  8417. if ((child.context === context || child.fnContext === context) &&
  8418. data && data.slot != null
  8419. ) {
  8420. var name = data.slot;
  8421. var slot = (slots[name] || (slots[name] = []));
  8422. if (child.tag === 'template') {
  8423. slot.push.apply(slot, child.children || []);
  8424. } else {
  8425. slot.push(child);
  8426. }
  8427. } else {
  8428. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  8429. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  8430. (slots['page'] || (slots['page'] = [])).push(child);
  8431. }else{
  8432. (slots.default || (slots.default = [])).push(child);
  8433. }
  8434. }
  8435. }
  8436. // ignore slots that contains only whitespace
  8437. for (var name$1 in slots) {
  8438. if (slots[name$1].every(isWhitespace)) {
  8439. delete slots[name$1];
  8440. }
  8441. }
  8442. return slots
  8443. }
  8444. function isWhitespace (node) {
  8445. return (node.isComment && !node.asyncFactory) || node.text === ' '
  8446. }
  8447. /* */
  8448. function normalizeScopedSlots (
  8449. slots,
  8450. normalSlots,
  8451. prevSlots
  8452. ) {
  8453. var res;
  8454. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  8455. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  8456. var key = slots && slots.$key;
  8457. if (!slots) {
  8458. res = {};
  8459. } else if (slots._normalized) {
  8460. // fast path 1: child component re-render only, parent did not change
  8461. return slots._normalized
  8462. } else if (
  8463. isStable &&
  8464. prevSlots &&
  8465. prevSlots !== emptyObject &&
  8466. key === prevSlots.$key &&
  8467. !hasNormalSlots &&
  8468. !prevSlots.$hasNormal
  8469. ) {
  8470. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  8471. // only need to normalize once
  8472. return prevSlots
  8473. } else {
  8474. res = {};
  8475. for (var key$1 in slots) {
  8476. if (slots[key$1] && key$1[0] !== '$') {
  8477. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  8478. }
  8479. }
  8480. }
  8481. // expose normal slots on scopedSlots
  8482. for (var key$2 in normalSlots) {
  8483. if (!(key$2 in res)) {
  8484. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  8485. }
  8486. }
  8487. // avoriaz seems to mock a non-extensible $scopedSlots object
  8488. // and when that is passed down this would cause an error
  8489. if (slots && Object.isExtensible(slots)) {
  8490. (slots)._normalized = res;
  8491. }
  8492. def(res, '$stable', isStable);
  8493. def(res, '$key', key);
  8494. def(res, '$hasNormal', hasNormalSlots);
  8495. return res
  8496. }
  8497. function normalizeScopedSlot(normalSlots, key, fn) {
  8498. var normalized = function () {
  8499. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  8500. res = res && typeof res === 'object' && !Array.isArray(res)
  8501. ? [res] // single vnode
  8502. : normalizeChildren(res);
  8503. return res && (
  8504. res.length === 0 ||
  8505. (res.length === 1 && res[0].isComment) // #9658
  8506. ) ? undefined
  8507. : res
  8508. };
  8509. // this is a slot using the new v-slot syntax without scope. although it is
  8510. // compiled as a scoped slot, render fn users would expect it to be present
  8511. // on this.$slots because the usage is semantically a normal slot.
  8512. if (fn.proxy) {
  8513. Object.defineProperty(normalSlots, key, {
  8514. get: normalized,
  8515. enumerable: true,
  8516. configurable: true
  8517. });
  8518. }
  8519. return normalized
  8520. }
  8521. function proxyNormalSlot(slots, key) {
  8522. return function () { return slots[key]; }
  8523. }
  8524. /* */
  8525. /**
  8526. * Runtime helper for rendering v-for lists.
  8527. */
  8528. function renderList (
  8529. val,
  8530. render
  8531. ) {
  8532. var ret, i, l, keys, key;
  8533. if (Array.isArray(val) || typeof val === 'string') {
  8534. ret = new Array(val.length);
  8535. for (i = 0, l = val.length; i < l; i++) {
  8536. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  8537. }
  8538. } else if (typeof val === 'number') {
  8539. ret = new Array(val);
  8540. for (i = 0; i < val; i++) {
  8541. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  8542. }
  8543. } else if (isObject(val)) {
  8544. if (hasSymbol && val[Symbol.iterator]) {
  8545. ret = [];
  8546. var iterator = val[Symbol.iterator]();
  8547. var result = iterator.next();
  8548. while (!result.done) {
  8549. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  8550. result = iterator.next();
  8551. }
  8552. } else {
  8553. keys = Object.keys(val);
  8554. ret = new Array(keys.length);
  8555. for (i = 0, l = keys.length; i < l; i++) {
  8556. key = keys[i];
  8557. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  8558. }
  8559. }
  8560. }
  8561. if (!isDef(ret)) {
  8562. ret = [];
  8563. }
  8564. (ret)._isVList = true;
  8565. return ret
  8566. }
  8567. /* */
  8568. /**
  8569. * Runtime helper for rendering <slot>
  8570. */
  8571. function renderSlot (
  8572. name,
  8573. fallback,
  8574. props,
  8575. bindObject
  8576. ) {
  8577. var scopedSlotFn = this.$scopedSlots[name];
  8578. var nodes;
  8579. if (scopedSlotFn) { // scoped slot
  8580. props = props || {};
  8581. if (bindObject) {
  8582. if ( true && !isObject(bindObject)) {
  8583. warn(
  8584. 'slot v-bind without argument expects an Object',
  8585. this
  8586. );
  8587. }
  8588. props = extend(extend({}, bindObject), props);
  8589. }
  8590. // fixed by xxxxxx app-plus scopedSlot
  8591. nodes = scopedSlotFn(props, this, props._i) || fallback;
  8592. } else {
  8593. nodes = this.$slots[name] || fallback;
  8594. }
  8595. var target = props && props.slot;
  8596. if (target) {
  8597. return this.$createElement('template', { slot: target }, nodes)
  8598. } else {
  8599. return nodes
  8600. }
  8601. }
  8602. /* */
  8603. /**
  8604. * Runtime helper for resolving filters
  8605. */
  8606. function resolveFilter (id) {
  8607. return resolveAsset(this.$options, 'filters', id, true) || identity
  8608. }
  8609. /* */
  8610. function isKeyNotMatch (expect, actual) {
  8611. if (Array.isArray(expect)) {
  8612. return expect.indexOf(actual) === -1
  8613. } else {
  8614. return expect !== actual
  8615. }
  8616. }
  8617. /**
  8618. * Runtime helper for checking keyCodes from config.
  8619. * exposed as Vue.prototype._k
  8620. * passing in eventKeyName as last argument separately for backwards compat
  8621. */
  8622. function checkKeyCodes (
  8623. eventKeyCode,
  8624. key,
  8625. builtInKeyCode,
  8626. eventKeyName,
  8627. builtInKeyName
  8628. ) {
  8629. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  8630. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  8631. return isKeyNotMatch(builtInKeyName, eventKeyName)
  8632. } else if (mappedKeyCode) {
  8633. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  8634. } else if (eventKeyName) {
  8635. return hyphenate(eventKeyName) !== key
  8636. }
  8637. }
  8638. /* */
  8639. /**
  8640. * Runtime helper for merging v-bind="object" into a VNode's data.
  8641. */
  8642. function bindObjectProps (
  8643. data,
  8644. tag,
  8645. value,
  8646. asProp,
  8647. isSync
  8648. ) {
  8649. if (value) {
  8650. if (!isObject(value)) {
  8651. true && warn(
  8652. 'v-bind without argument expects an Object or Array value',
  8653. this
  8654. );
  8655. } else {
  8656. if (Array.isArray(value)) {
  8657. value = toObject(value);
  8658. }
  8659. var hash;
  8660. var loop = function ( key ) {
  8661. if (
  8662. key === 'class' ||
  8663. key === 'style' ||
  8664. isReservedAttribute(key)
  8665. ) {
  8666. hash = data;
  8667. } else {
  8668. var type = data.attrs && data.attrs.type;
  8669. hash = asProp || config.mustUseProp(tag, type, key)
  8670. ? data.domProps || (data.domProps = {})
  8671. : data.attrs || (data.attrs = {});
  8672. }
  8673. var camelizedKey = camelize(key);
  8674. var hyphenatedKey = hyphenate(key);
  8675. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  8676. hash[key] = value[key];
  8677. if (isSync) {
  8678. var on = data.on || (data.on = {});
  8679. on[("update:" + key)] = function ($event) {
  8680. value[key] = $event;
  8681. };
  8682. }
  8683. }
  8684. };
  8685. for (var key in value) loop( key );
  8686. }
  8687. }
  8688. return data
  8689. }
  8690. /* */
  8691. /**
  8692. * Runtime helper for rendering static trees.
  8693. */
  8694. function renderStatic (
  8695. index,
  8696. isInFor
  8697. ) {
  8698. var cached = this._staticTrees || (this._staticTrees = []);
  8699. var tree = cached[index];
  8700. // if has already-rendered static tree and not inside v-for,
  8701. // we can reuse the same tree.
  8702. if (tree && !isInFor) {
  8703. return tree
  8704. }
  8705. // otherwise, render a fresh tree.
  8706. tree = cached[index] = this.$options.staticRenderFns[index].call(
  8707. this._renderProxy,
  8708. null,
  8709. this // for render fns generated for functional component templates
  8710. );
  8711. markStatic(tree, ("__static__" + index), false);
  8712. return tree
  8713. }
  8714. /**
  8715. * Runtime helper for v-once.
  8716. * Effectively it means marking the node as static with a unique key.
  8717. */
  8718. function markOnce (
  8719. tree,
  8720. index,
  8721. key
  8722. ) {
  8723. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  8724. return tree
  8725. }
  8726. function markStatic (
  8727. tree,
  8728. key,
  8729. isOnce
  8730. ) {
  8731. if (Array.isArray(tree)) {
  8732. for (var i = 0; i < tree.length; i++) {
  8733. if (tree[i] && typeof tree[i] !== 'string') {
  8734. markStaticNode(tree[i], (key + "_" + i), isOnce);
  8735. }
  8736. }
  8737. } else {
  8738. markStaticNode(tree, key, isOnce);
  8739. }
  8740. }
  8741. function markStaticNode (node, key, isOnce) {
  8742. node.isStatic = true;
  8743. node.key = key;
  8744. node.isOnce = isOnce;
  8745. }
  8746. /* */
  8747. function bindObjectListeners (data, value) {
  8748. if (value) {
  8749. if (!isPlainObject(value)) {
  8750. true && warn(
  8751. 'v-on without argument expects an Object value',
  8752. this
  8753. );
  8754. } else {
  8755. var on = data.on = data.on ? extend({}, data.on) : {};
  8756. for (var key in value) {
  8757. var existing = on[key];
  8758. var ours = value[key];
  8759. on[key] = existing ? [].concat(existing, ours) : ours;
  8760. }
  8761. }
  8762. }
  8763. return data
  8764. }
  8765. /* */
  8766. function resolveScopedSlots (
  8767. fns, // see flow/vnode
  8768. res,
  8769. // the following are added in 2.6
  8770. hasDynamicKeys,
  8771. contentHashKey
  8772. ) {
  8773. res = res || { $stable: !hasDynamicKeys };
  8774. for (var i = 0; i < fns.length; i++) {
  8775. var slot = fns[i];
  8776. if (Array.isArray(slot)) {
  8777. resolveScopedSlots(slot, res, hasDynamicKeys);
  8778. } else if (slot) {
  8779. // marker for reverse proxying v-slot without scope on this.$slots
  8780. if (slot.proxy) {
  8781. slot.fn.proxy = true;
  8782. }
  8783. res[slot.key] = slot.fn;
  8784. }
  8785. }
  8786. if (contentHashKey) {
  8787. (res).$key = contentHashKey;
  8788. }
  8789. return res
  8790. }
  8791. /* */
  8792. function bindDynamicKeys (baseObj, values) {
  8793. for (var i = 0; i < values.length; i += 2) {
  8794. var key = values[i];
  8795. if (typeof key === 'string' && key) {
  8796. baseObj[values[i]] = values[i + 1];
  8797. } else if ( true && key !== '' && key !== null) {
  8798. // null is a special value for explicitly removing a binding
  8799. warn(
  8800. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  8801. this
  8802. );
  8803. }
  8804. }
  8805. return baseObj
  8806. }
  8807. // helper to dynamically append modifier runtime markers to event names.
  8808. // ensure only append when value is already string, otherwise it will be cast
  8809. // to string and cause the type check to miss.
  8810. function prependModifier (value, symbol) {
  8811. return typeof value === 'string' ? symbol + value : value
  8812. }
  8813. /* */
  8814. function installRenderHelpers (target) {
  8815. target._o = markOnce;
  8816. target._n = toNumber;
  8817. target._s = toString;
  8818. target._l = renderList;
  8819. target._t = renderSlot;
  8820. target._q = looseEqual;
  8821. target._i = looseIndexOf;
  8822. target._m = renderStatic;
  8823. target._f = resolveFilter;
  8824. target._k = checkKeyCodes;
  8825. target._b = bindObjectProps;
  8826. target._v = createTextVNode;
  8827. target._e = createEmptyVNode;
  8828. target._u = resolveScopedSlots;
  8829. target._g = bindObjectListeners;
  8830. target._d = bindDynamicKeys;
  8831. target._p = prependModifier;
  8832. }
  8833. /* */
  8834. function FunctionalRenderContext (
  8835. data,
  8836. props,
  8837. children,
  8838. parent,
  8839. Ctor
  8840. ) {
  8841. var this$1 = this;
  8842. var options = Ctor.options;
  8843. // ensure the createElement function in functional components
  8844. // gets a unique context - this is necessary for correct named slot check
  8845. var contextVm;
  8846. if (hasOwn(parent, '_uid')) {
  8847. contextVm = Object.create(parent);
  8848. // $flow-disable-line
  8849. contextVm._original = parent;
  8850. } else {
  8851. // the context vm passed in is a functional context as well.
  8852. // in this case we want to make sure we are able to get a hold to the
  8853. // real context instance.
  8854. contextVm = parent;
  8855. // $flow-disable-line
  8856. parent = parent._original;
  8857. }
  8858. var isCompiled = isTrue(options._compiled);
  8859. var needNormalization = !isCompiled;
  8860. this.data = data;
  8861. this.props = props;
  8862. this.children = children;
  8863. this.parent = parent;
  8864. this.listeners = data.on || emptyObject;
  8865. this.injections = resolveInject(options.inject, parent);
  8866. this.slots = function () {
  8867. if (!this$1.$slots) {
  8868. normalizeScopedSlots(
  8869. data.scopedSlots,
  8870. this$1.$slots = resolveSlots(children, parent)
  8871. );
  8872. }
  8873. return this$1.$slots
  8874. };
  8875. Object.defineProperty(this, 'scopedSlots', ({
  8876. enumerable: true,
  8877. get: function get () {
  8878. return normalizeScopedSlots(data.scopedSlots, this.slots())
  8879. }
  8880. }));
  8881. // support for compiled functional template
  8882. if (isCompiled) {
  8883. // exposing $options for renderStatic()
  8884. this.$options = options;
  8885. // pre-resolve slots for renderSlot()
  8886. this.$slots = this.slots();
  8887. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  8888. }
  8889. if (options._scopeId) {
  8890. this._c = function (a, b, c, d) {
  8891. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  8892. if (vnode && !Array.isArray(vnode)) {
  8893. vnode.fnScopeId = options._scopeId;
  8894. vnode.fnContext = parent;
  8895. }
  8896. return vnode
  8897. };
  8898. } else {
  8899. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  8900. }
  8901. }
  8902. installRenderHelpers(FunctionalRenderContext.prototype);
  8903. function createFunctionalComponent (
  8904. Ctor,
  8905. propsData,
  8906. data,
  8907. contextVm,
  8908. children
  8909. ) {
  8910. var options = Ctor.options;
  8911. var props = {};
  8912. var propOptions = options.props;
  8913. if (isDef(propOptions)) {
  8914. for (var key in propOptions) {
  8915. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  8916. }
  8917. } else {
  8918. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  8919. if (isDef(data.props)) { mergeProps(props, data.props); }
  8920. }
  8921. var renderContext = new FunctionalRenderContext(
  8922. data,
  8923. props,
  8924. children,
  8925. contextVm,
  8926. Ctor
  8927. );
  8928. var vnode = options.render.call(null, renderContext._c, renderContext);
  8929. if (vnode instanceof VNode) {
  8930. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  8931. } else if (Array.isArray(vnode)) {
  8932. var vnodes = normalizeChildren(vnode) || [];
  8933. var res = new Array(vnodes.length);
  8934. for (var i = 0; i < vnodes.length; i++) {
  8935. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  8936. }
  8937. return res
  8938. }
  8939. }
  8940. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  8941. // #7817 clone node before setting fnContext, otherwise if the node is reused
  8942. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  8943. // that should not be matched to match.
  8944. var clone = cloneVNode(vnode);
  8945. clone.fnContext = contextVm;
  8946. clone.fnOptions = options;
  8947. if (true) {
  8948. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  8949. }
  8950. if (data.slot) {
  8951. (clone.data || (clone.data = {})).slot = data.slot;
  8952. }
  8953. return clone
  8954. }
  8955. function mergeProps (to, from) {
  8956. for (var key in from) {
  8957. to[camelize(key)] = from[key];
  8958. }
  8959. }
  8960. /* */
  8961. /* */
  8962. /* */
  8963. /* */
  8964. // inline hooks to be invoked on component VNodes during patch
  8965. var componentVNodeHooks = {
  8966. init: function init (vnode, hydrating) {
  8967. if (
  8968. vnode.componentInstance &&
  8969. !vnode.componentInstance._isDestroyed &&
  8970. vnode.data.keepAlive
  8971. ) {
  8972. // kept-alive components, treat as a patch
  8973. var mountedNode = vnode; // work around flow
  8974. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  8975. } else {
  8976. var child = vnode.componentInstance = createComponentInstanceForVnode(
  8977. vnode,
  8978. activeInstance
  8979. );
  8980. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  8981. }
  8982. },
  8983. prepatch: function prepatch (oldVnode, vnode) {
  8984. var options = vnode.componentOptions;
  8985. var child = vnode.componentInstance = oldVnode.componentInstance;
  8986. updateChildComponent(
  8987. child,
  8988. options.propsData, // updated props
  8989. options.listeners, // updated listeners
  8990. vnode, // new parent vnode
  8991. options.children // new children
  8992. );
  8993. },
  8994. insert: function insert (vnode) {
  8995. var context = vnode.context;
  8996. var componentInstance = vnode.componentInstance;
  8997. if (!componentInstance._isMounted) {
  8998. callHook(componentInstance, 'onServiceCreated');
  8999. callHook(componentInstance, 'onServiceAttached');
  9000. componentInstance._isMounted = true;
  9001. callHook(componentInstance, 'mounted');
  9002. }
  9003. if (vnode.data.keepAlive) {
  9004. if (context._isMounted) {
  9005. // vue-router#1212
  9006. // During updates, a kept-alive component's child components may
  9007. // change, so directly walking the tree here may call activated hooks
  9008. // on incorrect children. Instead we push them into a queue which will
  9009. // be processed after the whole patch process ended.
  9010. queueActivatedComponent(componentInstance);
  9011. } else {
  9012. activateChildComponent(componentInstance, true /* direct */);
  9013. }
  9014. }
  9015. },
  9016. destroy: function destroy (vnode) {
  9017. var componentInstance = vnode.componentInstance;
  9018. if (!componentInstance._isDestroyed) {
  9019. if (!vnode.data.keepAlive) {
  9020. componentInstance.$destroy();
  9021. } else {
  9022. deactivateChildComponent(componentInstance, true /* direct */);
  9023. }
  9024. }
  9025. }
  9026. };
  9027. var hooksToMerge = Object.keys(componentVNodeHooks);
  9028. function createComponent (
  9029. Ctor,
  9030. data,
  9031. context,
  9032. children,
  9033. tag
  9034. ) {
  9035. if (isUndef(Ctor)) {
  9036. return
  9037. }
  9038. var baseCtor = context.$options._base;
  9039. // plain options object: turn it into a constructor
  9040. if (isObject(Ctor)) {
  9041. Ctor = baseCtor.extend(Ctor);
  9042. }
  9043. // if at this stage it's not a constructor or an async component factory,
  9044. // reject.
  9045. if (typeof Ctor !== 'function') {
  9046. if (true) {
  9047. warn(("Invalid Component definition: " + (String(Ctor))), context);
  9048. }
  9049. return
  9050. }
  9051. // async component
  9052. var asyncFactory;
  9053. if (isUndef(Ctor.cid)) {
  9054. asyncFactory = Ctor;
  9055. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  9056. if (Ctor === undefined) {
  9057. // return a placeholder node for async component, which is rendered
  9058. // as a comment node but preserves all the raw information for the node.
  9059. // the information will be used for async server-rendering and hydration.
  9060. return createAsyncPlaceholder(
  9061. asyncFactory,
  9062. data,
  9063. context,
  9064. children,
  9065. tag
  9066. )
  9067. }
  9068. }
  9069. data = data || {};
  9070. // resolve constructor options in case global mixins are applied after
  9071. // component constructor creation
  9072. resolveConstructorOptions(Ctor);
  9073. // transform component v-model data into props & events
  9074. if (isDef(data.model)) {
  9075. transformModel(Ctor.options, data);
  9076. }
  9077. // extract props
  9078. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  9079. // functional component
  9080. if (isTrue(Ctor.options.functional)) {
  9081. return createFunctionalComponent(Ctor, propsData, data, context, children)
  9082. }
  9083. // extract listeners, since these needs to be treated as
  9084. // child component listeners instead of DOM listeners
  9085. var listeners = data.on;
  9086. // replace with listeners with .native modifier
  9087. // so it gets processed during parent component patch.
  9088. data.on = data.nativeOn;
  9089. if (isTrue(Ctor.options.abstract)) {
  9090. // abstract components do not keep anything
  9091. // other than props & listeners & slot
  9092. // work around flow
  9093. var slot = data.slot;
  9094. data = {};
  9095. if (slot) {
  9096. data.slot = slot;
  9097. }
  9098. }
  9099. // install component management hooks onto the placeholder node
  9100. installComponentHooks(data);
  9101. // return a placeholder vnode
  9102. var name = Ctor.options.name || tag;
  9103. var vnode = new VNode(
  9104. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  9105. data, undefined, undefined, undefined, context,
  9106. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  9107. asyncFactory
  9108. );
  9109. return vnode
  9110. }
  9111. function createComponentInstanceForVnode (
  9112. vnode, // we know it's MountedComponentVNode but flow doesn't
  9113. parent // activeInstance in lifecycle state
  9114. ) {
  9115. var options = {
  9116. _isComponent: true,
  9117. _parentVnode: vnode,
  9118. parent: parent
  9119. };
  9120. // check inline-template render functions
  9121. var inlineTemplate = vnode.data.inlineTemplate;
  9122. if (isDef(inlineTemplate)) {
  9123. options.render = inlineTemplate.render;
  9124. options.staticRenderFns = inlineTemplate.staticRenderFns;
  9125. }
  9126. return new vnode.componentOptions.Ctor(options)
  9127. }
  9128. function installComponentHooks (data) {
  9129. var hooks = data.hook || (data.hook = {});
  9130. for (var i = 0; i < hooksToMerge.length; i++) {
  9131. var key = hooksToMerge[i];
  9132. var existing = hooks[key];
  9133. var toMerge = componentVNodeHooks[key];
  9134. if (existing !== toMerge && !(existing && existing._merged)) {
  9135. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  9136. }
  9137. }
  9138. }
  9139. function mergeHook$1 (f1, f2) {
  9140. var merged = function (a, b) {
  9141. // flow complains about extra args which is why we use any
  9142. f1(a, b);
  9143. f2(a, b);
  9144. };
  9145. merged._merged = true;
  9146. return merged
  9147. }
  9148. // transform component v-model info (value and callback) into
  9149. // prop and event handler respectively.
  9150. function transformModel (options, data) {
  9151. var prop = (options.model && options.model.prop) || 'value';
  9152. var event = (options.model && options.model.event) || 'input'
  9153. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  9154. var on = data.on || (data.on = {});
  9155. var existing = on[event];
  9156. var callback = data.model.callback;
  9157. if (isDef(existing)) {
  9158. if (
  9159. Array.isArray(existing)
  9160. ? existing.indexOf(callback) === -1
  9161. : existing !== callback
  9162. ) {
  9163. on[event] = [callback].concat(existing);
  9164. }
  9165. } else {
  9166. on[event] = callback;
  9167. }
  9168. }
  9169. /* */
  9170. var SIMPLE_NORMALIZE = 1;
  9171. var ALWAYS_NORMALIZE = 2;
  9172. // wrapper function for providing a more flexible interface
  9173. // without getting yelled at by flow
  9174. function createElement (
  9175. context,
  9176. tag,
  9177. data,
  9178. children,
  9179. normalizationType,
  9180. alwaysNormalize
  9181. ) {
  9182. if (Array.isArray(data) || isPrimitive(data)) {
  9183. normalizationType = children;
  9184. children = data;
  9185. data = undefined;
  9186. }
  9187. if (isTrue(alwaysNormalize)) {
  9188. normalizationType = ALWAYS_NORMALIZE;
  9189. }
  9190. return _createElement(context, tag, data, children, normalizationType)
  9191. }
  9192. function _createElement (
  9193. context,
  9194. tag,
  9195. data,
  9196. children,
  9197. normalizationType
  9198. ) {
  9199. if (isDef(data) && isDef((data).__ob__)) {
  9200. true && warn(
  9201. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  9202. 'Always create fresh vnode data objects in each render!',
  9203. context
  9204. );
  9205. return createEmptyVNode()
  9206. }
  9207. // object syntax in v-bind
  9208. if (isDef(data) && isDef(data.is)) {
  9209. tag = data.is;
  9210. }
  9211. if (!tag) {
  9212. // in case of component :is set to falsy value
  9213. return createEmptyVNode()
  9214. }
  9215. // warn against non-primitive key
  9216. if ( true &&
  9217. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  9218. ) {
  9219. {
  9220. warn(
  9221. 'Avoid using non-primitive value as key, ' +
  9222. 'use string/number value instead.',
  9223. context
  9224. );
  9225. }
  9226. }
  9227. // support single function children as default scoped slot
  9228. if (Array.isArray(children) &&
  9229. typeof children[0] === 'function'
  9230. ) {
  9231. data = data || {};
  9232. data.scopedSlots = { default: children[0] };
  9233. children.length = 0;
  9234. }
  9235. if (normalizationType === ALWAYS_NORMALIZE) {
  9236. children = normalizeChildren(children);
  9237. } else if (normalizationType === SIMPLE_NORMALIZE) {
  9238. children = simpleNormalizeChildren(children);
  9239. }
  9240. var vnode, ns;
  9241. if (typeof tag === 'string') {
  9242. var Ctor;
  9243. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  9244. if (config.isReservedTag(tag)) {
  9245. // platform built-in elements
  9246. if ( true && isDef(data) && isDef(data.nativeOn)) {
  9247. warn(
  9248. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  9249. context
  9250. );
  9251. }
  9252. vnode = new VNode(
  9253. config.parsePlatformTagName(tag), data, children,
  9254. undefined, undefined, context
  9255. );
  9256. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  9257. // component
  9258. vnode = createComponent(Ctor, data, context, children, tag);
  9259. } else {
  9260. // unknown or unlisted namespaced elements
  9261. // check at runtime because it may get assigned a namespace when its
  9262. // parent normalizes children
  9263. vnode = new VNode(
  9264. tag, data, children,
  9265. undefined, undefined, context
  9266. );
  9267. }
  9268. } else {
  9269. // direct component options / constructor
  9270. vnode = createComponent(tag, data, context, children);
  9271. }
  9272. if (Array.isArray(vnode)) {
  9273. return vnode
  9274. } else if (isDef(vnode)) {
  9275. if (isDef(ns)) { applyNS(vnode, ns); }
  9276. if (isDef(data)) { registerDeepBindings(data); }
  9277. return vnode
  9278. } else {
  9279. return createEmptyVNode()
  9280. }
  9281. }
  9282. function applyNS (vnode, ns, force) {
  9283. vnode.ns = ns;
  9284. if (vnode.tag === 'foreignObject') {
  9285. // use default namespace inside foreignObject
  9286. ns = undefined;
  9287. force = true;
  9288. }
  9289. if (isDef(vnode.children)) {
  9290. for (var i = 0, l = vnode.children.length; i < l; i++) {
  9291. var child = vnode.children[i];
  9292. if (isDef(child.tag) && (
  9293. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  9294. applyNS(child, ns, force);
  9295. }
  9296. }
  9297. }
  9298. }
  9299. // ref #5318
  9300. // necessary to ensure parent re-render when deep bindings like :style and
  9301. // :class are used on slot nodes
  9302. function registerDeepBindings (data) {
  9303. if (isObject(data.style)) {
  9304. traverse(data.style);
  9305. }
  9306. if (isObject(data.class)) {
  9307. traverse(data.class);
  9308. }
  9309. }
  9310. /* */
  9311. function initRender (vm) {
  9312. vm._vnode = null; // the root of the child tree
  9313. vm._staticTrees = null; // v-once cached trees
  9314. var options = vm.$options;
  9315. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  9316. var renderContext = parentVnode && parentVnode.context;
  9317. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  9318. vm.$scopedSlots = emptyObject;
  9319. // bind the createElement fn to this instance
  9320. // so that we get proper render context inside it.
  9321. // args order: tag, data, children, normalizationType, alwaysNormalize
  9322. // internal version is used by render functions compiled from templates
  9323. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  9324. // normalization is always applied for the public version, used in
  9325. // user-written render functions.
  9326. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  9327. // $attrs & $listeners are exposed for easier HOC creation.
  9328. // they need to be reactive so that HOCs using them are always updated
  9329. var parentData = parentVnode && parentVnode.data;
  9330. /* istanbul ignore else */
  9331. if (true) {
  9332. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  9333. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  9334. }, true);
  9335. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  9336. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  9337. }, true);
  9338. } else {}
  9339. }
  9340. var currentRenderingInstance = null;
  9341. function renderMixin (Vue) {
  9342. // install runtime convenience helpers
  9343. installRenderHelpers(Vue.prototype);
  9344. Vue.prototype.$nextTick = function (fn) {
  9345. return nextTick(fn, this)
  9346. };
  9347. Vue.prototype._render = function () {
  9348. var vm = this;
  9349. var ref = vm.$options;
  9350. var render = ref.render;
  9351. var _parentVnode = ref._parentVnode;
  9352. if (_parentVnode) {
  9353. vm.$scopedSlots = normalizeScopedSlots(
  9354. _parentVnode.data.scopedSlots,
  9355. vm.$slots,
  9356. vm.$scopedSlots
  9357. );
  9358. }
  9359. // set parent vnode. this allows render functions to have access
  9360. // to the data on the placeholder node.
  9361. vm.$vnode = _parentVnode;
  9362. // render self
  9363. var vnode;
  9364. try {
  9365. // There's no need to maintain a stack because all render fns are called
  9366. // separately from one another. Nested component's render fns are called
  9367. // when parent component is patched.
  9368. currentRenderingInstance = vm;
  9369. vnode = render.call(vm._renderProxy, vm.$createElement);
  9370. } catch (e) {
  9371. handleError(e, vm, "render");
  9372. // return error render result,
  9373. // or previous vnode to prevent render error causing blank component
  9374. /* istanbul ignore else */
  9375. if ( true && vm.$options.renderError) {
  9376. try {
  9377. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  9378. } catch (e) {
  9379. handleError(e, vm, "renderError");
  9380. vnode = vm._vnode;
  9381. }
  9382. } else {
  9383. vnode = vm._vnode;
  9384. }
  9385. } finally {
  9386. currentRenderingInstance = null;
  9387. }
  9388. // if the returned array contains only a single node, allow it
  9389. if (Array.isArray(vnode) && vnode.length === 1) {
  9390. vnode = vnode[0];
  9391. }
  9392. // return empty vnode in case the render function errored out
  9393. if (!(vnode instanceof VNode)) {
  9394. if ( true && Array.isArray(vnode)) {
  9395. warn(
  9396. 'Multiple root nodes returned from render function. Render function ' +
  9397. 'should return a single root node.',
  9398. vm
  9399. );
  9400. }
  9401. vnode = createEmptyVNode();
  9402. }
  9403. // set parent
  9404. vnode.parent = _parentVnode;
  9405. return vnode
  9406. };
  9407. }
  9408. /* */
  9409. function ensureCtor (comp, base) {
  9410. if (
  9411. comp.__esModule ||
  9412. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  9413. ) {
  9414. comp = comp.default;
  9415. }
  9416. return isObject(comp)
  9417. ? base.extend(comp)
  9418. : comp
  9419. }
  9420. function createAsyncPlaceholder (
  9421. factory,
  9422. data,
  9423. context,
  9424. children,
  9425. tag
  9426. ) {
  9427. var node = createEmptyVNode();
  9428. node.asyncFactory = factory;
  9429. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  9430. return node
  9431. }
  9432. function resolveAsyncComponent (
  9433. factory,
  9434. baseCtor
  9435. ) {
  9436. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  9437. return factory.errorComp
  9438. }
  9439. if (isDef(factory.resolved)) {
  9440. return factory.resolved
  9441. }
  9442. var owner = currentRenderingInstance;
  9443. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  9444. // already pending
  9445. factory.owners.push(owner);
  9446. }
  9447. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  9448. return factory.loadingComp
  9449. }
  9450. if (owner && !isDef(factory.owners)) {
  9451. var owners = factory.owners = [owner];
  9452. var sync = true;
  9453. var timerLoading = null;
  9454. var timerTimeout = null
  9455. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  9456. var forceRender = function (renderCompleted) {
  9457. for (var i = 0, l = owners.length; i < l; i++) {
  9458. (owners[i]).$forceUpdate();
  9459. }
  9460. if (renderCompleted) {
  9461. owners.length = 0;
  9462. if (timerLoading !== null) {
  9463. clearTimeout(timerLoading);
  9464. timerLoading = null;
  9465. }
  9466. if (timerTimeout !== null) {
  9467. clearTimeout(timerTimeout);
  9468. timerTimeout = null;
  9469. }
  9470. }
  9471. };
  9472. var resolve = once(function (res) {
  9473. // cache resolved
  9474. factory.resolved = ensureCtor(res, baseCtor);
  9475. // invoke callbacks only if this is not a synchronous resolve
  9476. // (async resolves are shimmed as synchronous during SSR)
  9477. if (!sync) {
  9478. forceRender(true);
  9479. } else {
  9480. owners.length = 0;
  9481. }
  9482. });
  9483. var reject = once(function (reason) {
  9484. true && warn(
  9485. "Failed to resolve async component: " + (String(factory)) +
  9486. (reason ? ("\nReason: " + reason) : '')
  9487. );
  9488. if (isDef(factory.errorComp)) {
  9489. factory.error = true;
  9490. forceRender(true);
  9491. }
  9492. });
  9493. var res = factory(resolve, reject);
  9494. if (isObject(res)) {
  9495. if (isPromise(res)) {
  9496. // () => Promise
  9497. if (isUndef(factory.resolved)) {
  9498. res.then(resolve, reject);
  9499. }
  9500. } else if (isPromise(res.component)) {
  9501. res.component.then(resolve, reject);
  9502. if (isDef(res.error)) {
  9503. factory.errorComp = ensureCtor(res.error, baseCtor);
  9504. }
  9505. if (isDef(res.loading)) {
  9506. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  9507. if (res.delay === 0) {
  9508. factory.loading = true;
  9509. } else {
  9510. timerLoading = setTimeout(function () {
  9511. timerLoading = null;
  9512. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  9513. factory.loading = true;
  9514. forceRender(false);
  9515. }
  9516. }, res.delay || 200);
  9517. }
  9518. }
  9519. if (isDef(res.timeout)) {
  9520. timerTimeout = setTimeout(function () {
  9521. timerTimeout = null;
  9522. if (isUndef(factory.resolved)) {
  9523. reject(
  9524. true
  9525. ? ("timeout (" + (res.timeout) + "ms)")
  9526. : undefined
  9527. );
  9528. }
  9529. }, res.timeout);
  9530. }
  9531. }
  9532. }
  9533. sync = false;
  9534. // return in case resolved synchronously
  9535. return factory.loading
  9536. ? factory.loadingComp
  9537. : factory.resolved
  9538. }
  9539. }
  9540. /* */
  9541. function isAsyncPlaceholder (node) {
  9542. return node.isComment && node.asyncFactory
  9543. }
  9544. /* */
  9545. function getFirstComponentChild (children) {
  9546. if (Array.isArray(children)) {
  9547. for (var i = 0; i < children.length; i++) {
  9548. var c = children[i];
  9549. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  9550. return c
  9551. }
  9552. }
  9553. }
  9554. }
  9555. /* */
  9556. /* */
  9557. function initEvents (vm) {
  9558. vm._events = Object.create(null);
  9559. vm._hasHookEvent = false;
  9560. // init parent attached events
  9561. var listeners = vm.$options._parentListeners;
  9562. if (listeners) {
  9563. updateComponentListeners(vm, listeners);
  9564. }
  9565. }
  9566. var target;
  9567. function add (event, fn) {
  9568. target.$on(event, fn);
  9569. }
  9570. function remove$1 (event, fn) {
  9571. target.$off(event, fn);
  9572. }
  9573. function createOnceHandler (event, fn) {
  9574. var _target = target;
  9575. return function onceHandler () {
  9576. var res = fn.apply(null, arguments);
  9577. if (res !== null) {
  9578. _target.$off(event, onceHandler);
  9579. }
  9580. }
  9581. }
  9582. function updateComponentListeners (
  9583. vm,
  9584. listeners,
  9585. oldListeners
  9586. ) {
  9587. target = vm;
  9588. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  9589. target = undefined;
  9590. }
  9591. function eventsMixin (Vue) {
  9592. var hookRE = /^hook:/;
  9593. Vue.prototype.$on = function (event, fn) {
  9594. var vm = this;
  9595. if (Array.isArray(event)) {
  9596. for (var i = 0, l = event.length; i < l; i++) {
  9597. vm.$on(event[i], fn);
  9598. }
  9599. } else {
  9600. (vm._events[event] || (vm._events[event] = [])).push(fn);
  9601. // optimize hook:event cost by using a boolean flag marked at registration
  9602. // instead of a hash lookup
  9603. if (hookRE.test(event)) {
  9604. vm._hasHookEvent = true;
  9605. }
  9606. }
  9607. return vm
  9608. };
  9609. Vue.prototype.$once = function (event, fn) {
  9610. var vm = this;
  9611. function on () {
  9612. vm.$off(event, on);
  9613. fn.apply(vm, arguments);
  9614. }
  9615. on.fn = fn;
  9616. vm.$on(event, on);
  9617. return vm
  9618. };
  9619. Vue.prototype.$off = function (event, fn) {
  9620. var vm = this;
  9621. // all
  9622. if (!arguments.length) {
  9623. vm._events = Object.create(null);
  9624. return vm
  9625. }
  9626. // array of events
  9627. if (Array.isArray(event)) {
  9628. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  9629. vm.$off(event[i$1], fn);
  9630. }
  9631. return vm
  9632. }
  9633. // specific event
  9634. var cbs = vm._events[event];
  9635. if (!cbs) {
  9636. return vm
  9637. }
  9638. if (!fn) {
  9639. vm._events[event] = null;
  9640. return vm
  9641. }
  9642. // specific handler
  9643. var cb;
  9644. var i = cbs.length;
  9645. while (i--) {
  9646. cb = cbs[i];
  9647. if (cb === fn || cb.fn === fn) {
  9648. cbs.splice(i, 1);
  9649. break
  9650. }
  9651. }
  9652. return vm
  9653. };
  9654. Vue.prototype.$emit = function (event) {
  9655. var vm = this;
  9656. if (true) {
  9657. var lowerCaseEvent = event.toLowerCase();
  9658. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  9659. tip(
  9660. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  9661. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  9662. "Note that HTML attributes are case-insensitive and you cannot use " +
  9663. "v-on to listen to camelCase events when using in-DOM templates. " +
  9664. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  9665. );
  9666. }
  9667. }
  9668. var cbs = vm._events[event];
  9669. if (cbs) {
  9670. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  9671. var args = toArray(arguments, 1);
  9672. var info = "event handler for \"" + event + "\"";
  9673. for (var i = 0, l = cbs.length; i < l; i++) {
  9674. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  9675. }
  9676. }
  9677. return vm
  9678. };
  9679. }
  9680. /* */
  9681. var activeInstance = null;
  9682. var isUpdatingChildComponent = false;
  9683. function setActiveInstance(vm) {
  9684. var prevActiveInstance = activeInstance;
  9685. activeInstance = vm;
  9686. return function () {
  9687. activeInstance = prevActiveInstance;
  9688. }
  9689. }
  9690. function initLifecycle (vm) {
  9691. var options = vm.$options;
  9692. // locate first non-abstract parent
  9693. var parent = options.parent;
  9694. if (parent && !options.abstract) {
  9695. while (parent.$options.abstract && parent.$parent) {
  9696. parent = parent.$parent;
  9697. }
  9698. parent.$children.push(vm);
  9699. }
  9700. vm.$parent = parent;
  9701. vm.$root = parent ? parent.$root : vm;
  9702. vm.$children = [];
  9703. vm.$refs = {};
  9704. vm._watcher = null;
  9705. vm._inactive = null;
  9706. vm._directInactive = false;
  9707. vm._isMounted = false;
  9708. vm._isDestroyed = false;
  9709. vm._isBeingDestroyed = false;
  9710. }
  9711. function lifecycleMixin (Vue) {
  9712. Vue.prototype._update = function (vnode, hydrating) {
  9713. var vm = this;
  9714. var prevEl = vm.$el;
  9715. var prevVnode = vm._vnode;
  9716. var restoreActiveInstance = setActiveInstance(vm);
  9717. vm._vnode = vnode;
  9718. // Vue.prototype.__patch__ is injected in entry points
  9719. // based on the rendering backend used.
  9720. if (!prevVnode) {
  9721. // initial render
  9722. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  9723. } else {
  9724. // updates
  9725. vm.$el = vm.__patch__(prevVnode, vnode);
  9726. }
  9727. restoreActiveInstance();
  9728. // update __vue__ reference
  9729. if (prevEl) {
  9730. prevEl.__vue__ = null;
  9731. }
  9732. if (vm.$el) {
  9733. vm.$el.__vue__ = vm;
  9734. }
  9735. // if parent is an HOC, update its $el as well
  9736. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  9737. vm.$parent.$el = vm.$el;
  9738. }
  9739. // updated hook is called by the scheduler to ensure that children are
  9740. // updated in a parent's updated hook.
  9741. };
  9742. Vue.prototype.$forceUpdate = function () {
  9743. var vm = this;
  9744. if (vm._watcher) {
  9745. vm._watcher.update();
  9746. }
  9747. };
  9748. Vue.prototype.$destroy = function () {
  9749. var vm = this;
  9750. if (vm._isBeingDestroyed) {
  9751. return
  9752. }
  9753. callHook(vm, 'beforeDestroy');
  9754. vm._isBeingDestroyed = true;
  9755. // remove self from parent
  9756. var parent = vm.$parent;
  9757. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  9758. remove(parent.$children, vm);
  9759. }
  9760. // teardown watchers
  9761. if (vm._watcher) {
  9762. vm._watcher.teardown();
  9763. }
  9764. var i = vm._watchers.length;
  9765. while (i--) {
  9766. vm._watchers[i].teardown();
  9767. }
  9768. // remove reference from data ob
  9769. // frozen object may not have observer.
  9770. if (vm._data.__ob__) {
  9771. vm._data.__ob__.vmCount--;
  9772. }
  9773. // call the last hook...
  9774. vm._isDestroyed = true;
  9775. // invoke destroy hooks on current rendered tree
  9776. vm.__patch__(vm._vnode, null);
  9777. // fire destroyed hook
  9778. callHook(vm, 'destroyed');
  9779. // turn off all instance listeners.
  9780. vm.$off();
  9781. // remove __vue__ reference
  9782. if (vm.$el) {
  9783. vm.$el.__vue__ = null;
  9784. }
  9785. // release circular reference (#6759)
  9786. if (vm.$vnode) {
  9787. vm.$vnode.parent = null;
  9788. }
  9789. };
  9790. }
  9791. function updateChildComponent (
  9792. vm,
  9793. propsData,
  9794. listeners,
  9795. parentVnode,
  9796. renderChildren
  9797. ) {
  9798. if (true) {
  9799. isUpdatingChildComponent = true;
  9800. }
  9801. // determine whether component has slot children
  9802. // we need to do this before overwriting $options._renderChildren.
  9803. // check if there are dynamic scopedSlots (hand-written or compiled but with
  9804. // dynamic slot names). Static scoped slots compiled from template has the
  9805. // "$stable" marker.
  9806. var newScopedSlots = parentVnode.data.scopedSlots;
  9807. var oldScopedSlots = vm.$scopedSlots;
  9808. var hasDynamicScopedSlot = !!(
  9809. (newScopedSlots && !newScopedSlots.$stable) ||
  9810. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  9811. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  9812. );
  9813. // Any static slot children from the parent may have changed during parent's
  9814. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  9815. // update is necessary to ensure correctness.
  9816. var needsForceUpdate = !!(
  9817. renderChildren || // has new static slots
  9818. vm.$options._renderChildren || // has old static slots
  9819. hasDynamicScopedSlot
  9820. );
  9821. vm.$options._parentVnode = parentVnode;
  9822. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  9823. if (vm._vnode) { // update child tree's parent
  9824. vm._vnode.parent = parentVnode;
  9825. }
  9826. vm.$options._renderChildren = renderChildren;
  9827. // update $attrs and $listeners hash
  9828. // these are also reactive so they may trigger child update if the child
  9829. // used them during render
  9830. vm.$attrs = parentVnode.data.attrs || emptyObject;
  9831. vm.$listeners = listeners || emptyObject;
  9832. // update props
  9833. if (propsData && vm.$options.props) {
  9834. toggleObserving(false);
  9835. var props = vm._props;
  9836. var propKeys = vm.$options._propKeys || [];
  9837. for (var i = 0; i < propKeys.length; i++) {
  9838. var key = propKeys[i];
  9839. var propOptions = vm.$options.props; // wtf flow?
  9840. props[key] = validateProp(key, propOptions, propsData, vm);
  9841. }
  9842. toggleObserving(true);
  9843. // keep a copy of raw propsData
  9844. vm.$options.propsData = propsData;
  9845. }
  9846. // fixed by xxxxxx update properties(mp runtime)
  9847. vm._$updateProperties && vm._$updateProperties(vm);
  9848. // update listeners
  9849. listeners = listeners || emptyObject;
  9850. var oldListeners = vm.$options._parentListeners;
  9851. vm.$options._parentListeners = listeners;
  9852. updateComponentListeners(vm, listeners, oldListeners);
  9853. // resolve slots + force update if has children
  9854. if (needsForceUpdate) {
  9855. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  9856. vm.$forceUpdate();
  9857. }
  9858. if (true) {
  9859. isUpdatingChildComponent = false;
  9860. }
  9861. }
  9862. function isInInactiveTree (vm) {
  9863. while (vm && (vm = vm.$parent)) {
  9864. if (vm._inactive) { return true }
  9865. }
  9866. return false
  9867. }
  9868. function activateChildComponent (vm, direct) {
  9869. if (direct) {
  9870. vm._directInactive = false;
  9871. if (isInInactiveTree(vm)) {
  9872. return
  9873. }
  9874. } else if (vm._directInactive) {
  9875. return
  9876. }
  9877. if (vm._inactive || vm._inactive === null) {
  9878. vm._inactive = false;
  9879. for (var i = 0; i < vm.$children.length; i++) {
  9880. activateChildComponent(vm.$children[i]);
  9881. }
  9882. callHook(vm, 'activated');
  9883. }
  9884. }
  9885. function deactivateChildComponent (vm, direct) {
  9886. if (direct) {
  9887. vm._directInactive = true;
  9888. if (isInInactiveTree(vm)) {
  9889. return
  9890. }
  9891. }
  9892. if (!vm._inactive) {
  9893. vm._inactive = true;
  9894. for (var i = 0; i < vm.$children.length; i++) {
  9895. deactivateChildComponent(vm.$children[i]);
  9896. }
  9897. callHook(vm, 'deactivated');
  9898. }
  9899. }
  9900. function callHook (vm, hook) {
  9901. // #7573 disable dep collection when invoking lifecycle hooks
  9902. pushTarget();
  9903. var handlers = vm.$options[hook];
  9904. var info = hook + " hook";
  9905. if (handlers) {
  9906. for (var i = 0, j = handlers.length; i < j; i++) {
  9907. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  9908. }
  9909. }
  9910. if (vm._hasHookEvent) {
  9911. vm.$emit('hook:' + hook);
  9912. }
  9913. popTarget();
  9914. }
  9915. /* */
  9916. var MAX_UPDATE_COUNT = 100;
  9917. var queue = [];
  9918. var activatedChildren = [];
  9919. var has = {};
  9920. var circular = {};
  9921. var waiting = false;
  9922. var flushing = false;
  9923. var index = 0;
  9924. /**
  9925. * Reset the scheduler's state.
  9926. */
  9927. function resetSchedulerState () {
  9928. index = queue.length = activatedChildren.length = 0;
  9929. has = {};
  9930. if (true) {
  9931. circular = {};
  9932. }
  9933. waiting = flushing = false;
  9934. }
  9935. // Async edge case #6566 requires saving the timestamp when event listeners are
  9936. // attached. However, calling performance.now() has a perf overhead especially
  9937. // if the page has thousands of event listeners. Instead, we take a timestamp
  9938. // every time the scheduler flushes and use that for all event listeners
  9939. // attached during that flush.
  9940. var currentFlushTimestamp = 0;
  9941. // Async edge case fix requires storing an event listener's attach timestamp.
  9942. var getNow = Date.now;
  9943. // Determine what event timestamp the browser is using. Annoyingly, the
  9944. // timestamp can either be hi-res (relative to page load) or low-res
  9945. // (relative to UNIX epoch), so in order to compare time we have to use the
  9946. // same timestamp type when saving the flush timestamp.
  9947. // All IE versions use low-res event timestamps, and have problematic clock
  9948. // implementations (#9632)
  9949. if (inBrowser && !isIE) {
  9950. var performance = window.performance;
  9951. if (
  9952. performance &&
  9953. typeof performance.now === 'function' &&
  9954. getNow() > document.createEvent('Event').timeStamp
  9955. ) {
  9956. // if the event timestamp, although evaluated AFTER the Date.now(), is
  9957. // smaller than it, it means the event is using a hi-res timestamp,
  9958. // and we need to use the hi-res version for event listener timestamps as
  9959. // well.
  9960. getNow = function () { return performance.now(); };
  9961. }
  9962. }
  9963. /**
  9964. * Flush both queues and run the watchers.
  9965. */
  9966. function flushSchedulerQueue () {
  9967. currentFlushTimestamp = getNow();
  9968. flushing = true;
  9969. var watcher, id;
  9970. // Sort queue before flush.
  9971. // This ensures that:
  9972. // 1. Components are updated from parent to child. (because parent is always
  9973. // created before the child)
  9974. // 2. A component's user watchers are run before its render watcher (because
  9975. // user watchers are created before the render watcher)
  9976. // 3. If a component is destroyed during a parent component's watcher run,
  9977. // its watchers can be skipped.
  9978. queue.sort(function (a, b) { return a.id - b.id; });
  9979. // do not cache length because more watchers might be pushed
  9980. // as we run existing watchers
  9981. for (index = 0; index < queue.length; index++) {
  9982. watcher = queue[index];
  9983. if (watcher.before) {
  9984. watcher.before();
  9985. }
  9986. id = watcher.id;
  9987. has[id] = null;
  9988. watcher.run();
  9989. // in dev build, check and stop circular updates.
  9990. if ( true && has[id] != null) {
  9991. circular[id] = (circular[id] || 0) + 1;
  9992. if (circular[id] > MAX_UPDATE_COUNT) {
  9993. warn(
  9994. 'You may have an infinite update loop ' + (
  9995. watcher.user
  9996. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  9997. : "in a component render function."
  9998. ),
  9999. watcher.vm
  10000. );
  10001. break
  10002. }
  10003. }
  10004. }
  10005. // keep copies of post queues before resetting state
  10006. var activatedQueue = activatedChildren.slice();
  10007. var updatedQueue = queue.slice();
  10008. resetSchedulerState();
  10009. // call component updated and activated hooks
  10010. callActivatedHooks(activatedQueue);
  10011. callUpdatedHooks(updatedQueue);
  10012. // devtool hook
  10013. /* istanbul ignore if */
  10014. if (devtools && config.devtools) {
  10015. devtools.emit('flush');
  10016. }
  10017. }
  10018. function callUpdatedHooks (queue) {
  10019. var i = queue.length;
  10020. while (i--) {
  10021. var watcher = queue[i];
  10022. var vm = watcher.vm;
  10023. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  10024. callHook(vm, 'updated');
  10025. }
  10026. }
  10027. }
  10028. /**
  10029. * Queue a kept-alive component that was activated during patch.
  10030. * The queue will be processed after the entire tree has been patched.
  10031. */
  10032. function queueActivatedComponent (vm) {
  10033. // setting _inactive to false here so that a render function can
  10034. // rely on checking whether it's in an inactive tree (e.g. router-view)
  10035. vm._inactive = false;
  10036. activatedChildren.push(vm);
  10037. }
  10038. function callActivatedHooks (queue) {
  10039. for (var i = 0; i < queue.length; i++) {
  10040. queue[i]._inactive = true;
  10041. activateChildComponent(queue[i], true /* true */);
  10042. }
  10043. }
  10044. /**
  10045. * Push a watcher into the watcher queue.
  10046. * Jobs with duplicate IDs will be skipped unless it's
  10047. * pushed when the queue is being flushed.
  10048. */
  10049. function queueWatcher (watcher) {
  10050. var id = watcher.id;
  10051. if (has[id] == null) {
  10052. has[id] = true;
  10053. if (!flushing) {
  10054. queue.push(watcher);
  10055. } else {
  10056. // if already flushing, splice the watcher based on its id
  10057. // if already past its id, it will be run next immediately.
  10058. var i = queue.length - 1;
  10059. while (i > index && queue[i].id > watcher.id) {
  10060. i--;
  10061. }
  10062. queue.splice(i + 1, 0, watcher);
  10063. }
  10064. // queue the flush
  10065. if (!waiting) {
  10066. waiting = true;
  10067. if ( true && !config.async) {
  10068. flushSchedulerQueue();
  10069. return
  10070. }
  10071. nextTick(flushSchedulerQueue);
  10072. }
  10073. }
  10074. }
  10075. /* */
  10076. var uid$2 = 0;
  10077. /**
  10078. * A watcher parses an expression, collects dependencies,
  10079. * and fires callback when the expression value changes.
  10080. * This is used for both the $watch() api and directives.
  10081. */
  10082. var Watcher = function Watcher (
  10083. vm,
  10084. expOrFn,
  10085. cb,
  10086. options,
  10087. isRenderWatcher
  10088. ) {
  10089. this.vm = vm;
  10090. if (isRenderWatcher) {
  10091. vm._watcher = this;
  10092. }
  10093. vm._watchers.push(this);
  10094. // options
  10095. if (options) {
  10096. this.deep = !!options.deep;
  10097. this.user = !!options.user;
  10098. this.lazy = !!options.lazy;
  10099. this.sync = !!options.sync;
  10100. this.before = options.before;
  10101. } else {
  10102. this.deep = this.user = this.lazy = this.sync = false;
  10103. }
  10104. this.cb = cb;
  10105. this.id = ++uid$2; // uid for batching
  10106. this.active = true;
  10107. this.dirty = this.lazy; // for lazy watchers
  10108. this.deps = [];
  10109. this.newDeps = [];
  10110. this.depIds = new _Set();
  10111. this.newDepIds = new _Set();
  10112. this.expression = true
  10113. ? expOrFn.toString()
  10114. : undefined;
  10115. // parse expression for getter
  10116. if (typeof expOrFn === 'function') {
  10117. this.getter = expOrFn;
  10118. } else {
  10119. this.getter = parsePath(expOrFn);
  10120. if (!this.getter) {
  10121. this.getter = noop;
  10122. true && warn(
  10123. "Failed watching path: \"" + expOrFn + "\" " +
  10124. 'Watcher only accepts simple dot-delimited paths. ' +
  10125. 'For full control, use a function instead.',
  10126. vm
  10127. );
  10128. }
  10129. }
  10130. this.value = this.lazy
  10131. ? undefined
  10132. : this.get();
  10133. };
  10134. /**
  10135. * Evaluate the getter, and re-collect dependencies.
  10136. */
  10137. Watcher.prototype.get = function get () {
  10138. pushTarget(this);
  10139. var value;
  10140. var vm = this.vm;
  10141. try {
  10142. value = this.getter.call(vm, vm);
  10143. } catch (e) {
  10144. if (this.user) {
  10145. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  10146. } else {
  10147. throw e
  10148. }
  10149. } finally {
  10150. // "touch" every property so they are all tracked as
  10151. // dependencies for deep watching
  10152. if (this.deep) {
  10153. traverse(value);
  10154. }
  10155. popTarget();
  10156. this.cleanupDeps();
  10157. }
  10158. return value
  10159. };
  10160. /**
  10161. * Add a dependency to this directive.
  10162. */
  10163. Watcher.prototype.addDep = function addDep (dep) {
  10164. var id = dep.id;
  10165. if (!this.newDepIds.has(id)) {
  10166. this.newDepIds.add(id);
  10167. this.newDeps.push(dep);
  10168. if (!this.depIds.has(id)) {
  10169. dep.addSub(this);
  10170. }
  10171. }
  10172. };
  10173. /**
  10174. * Clean up for dependency collection.
  10175. */
  10176. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  10177. var i = this.deps.length;
  10178. while (i--) {
  10179. var dep = this.deps[i];
  10180. if (!this.newDepIds.has(dep.id)) {
  10181. dep.removeSub(this);
  10182. }
  10183. }
  10184. var tmp = this.depIds;
  10185. this.depIds = this.newDepIds;
  10186. this.newDepIds = tmp;
  10187. this.newDepIds.clear();
  10188. tmp = this.deps;
  10189. this.deps = this.newDeps;
  10190. this.newDeps = tmp;
  10191. this.newDeps.length = 0;
  10192. };
  10193. /**
  10194. * Subscriber interface.
  10195. * Will be called when a dependency changes.
  10196. */
  10197. Watcher.prototype.update = function update () {
  10198. /* istanbul ignore else */
  10199. if (this.lazy) {
  10200. this.dirty = true;
  10201. } else if (this.sync) {
  10202. this.run();
  10203. } else {
  10204. queueWatcher(this);
  10205. }
  10206. };
  10207. /**
  10208. * Scheduler job interface.
  10209. * Will be called by the scheduler.
  10210. */
  10211. Watcher.prototype.run = function run () {
  10212. if (this.active) {
  10213. var value = this.get();
  10214. if (
  10215. value !== this.value ||
  10216. // Deep watchers and watchers on Object/Arrays should fire even
  10217. // when the value is the same, because the value may
  10218. // have mutated.
  10219. isObject(value) ||
  10220. this.deep
  10221. ) {
  10222. // set new value
  10223. var oldValue = this.value;
  10224. this.value = value;
  10225. if (this.user) {
  10226. try {
  10227. this.cb.call(this.vm, value, oldValue);
  10228. } catch (e) {
  10229. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  10230. }
  10231. } else {
  10232. this.cb.call(this.vm, value, oldValue);
  10233. }
  10234. }
  10235. }
  10236. };
  10237. /**
  10238. * Evaluate the value of the watcher.
  10239. * This only gets called for lazy watchers.
  10240. */
  10241. Watcher.prototype.evaluate = function evaluate () {
  10242. this.value = this.get();
  10243. this.dirty = false;
  10244. };
  10245. /**
  10246. * Depend on all deps collected by this watcher.
  10247. */
  10248. Watcher.prototype.depend = function depend () {
  10249. var i = this.deps.length;
  10250. while (i--) {
  10251. this.deps[i].depend();
  10252. }
  10253. };
  10254. /**
  10255. * Remove self from all dependencies' subscriber list.
  10256. */
  10257. Watcher.prototype.teardown = function teardown () {
  10258. if (this.active) {
  10259. // remove self from vm's watcher list
  10260. // this is a somewhat expensive operation so we skip it
  10261. // if the vm is being destroyed.
  10262. if (!this.vm._isBeingDestroyed) {
  10263. remove(this.vm._watchers, this);
  10264. }
  10265. var i = this.deps.length;
  10266. while (i--) {
  10267. this.deps[i].removeSub(this);
  10268. }
  10269. this.active = false;
  10270. }
  10271. };
  10272. /* */
  10273. var sharedPropertyDefinition = {
  10274. enumerable: true,
  10275. configurable: true,
  10276. get: noop,
  10277. set: noop
  10278. };
  10279. function proxy (target, sourceKey, key) {
  10280. sharedPropertyDefinition.get = function proxyGetter () {
  10281. return this[sourceKey][key]
  10282. };
  10283. sharedPropertyDefinition.set = function proxySetter (val) {
  10284. this[sourceKey][key] = val;
  10285. };
  10286. Object.defineProperty(target, key, sharedPropertyDefinition);
  10287. }
  10288. function initState (vm) {
  10289. vm._watchers = [];
  10290. var opts = vm.$options;
  10291. if (opts.props) { initProps(vm, opts.props); }
  10292. if (opts.methods) { initMethods(vm, opts.methods); }
  10293. if (opts.data) {
  10294. initData(vm);
  10295. } else {
  10296. observe(vm._data = {}, true /* asRootData */);
  10297. }
  10298. if (opts.computed) { initComputed(vm, opts.computed); }
  10299. if (opts.watch && opts.watch !== nativeWatch) {
  10300. initWatch(vm, opts.watch);
  10301. }
  10302. }
  10303. function initProps (vm, propsOptions) {
  10304. var propsData = vm.$options.propsData || {};
  10305. var props = vm._props = {};
  10306. // cache prop keys so that future props updates can iterate using Array
  10307. // instead of dynamic object key enumeration.
  10308. var keys = vm.$options._propKeys = [];
  10309. var isRoot = !vm.$parent;
  10310. // root instance props should be converted
  10311. if (!isRoot) {
  10312. toggleObserving(false);
  10313. }
  10314. var loop = function ( key ) {
  10315. keys.push(key);
  10316. var value = validateProp(key, propsOptions, propsData, vm);
  10317. /* istanbul ignore else */
  10318. if (true) {
  10319. var hyphenatedKey = hyphenate(key);
  10320. if (isReservedAttribute(hyphenatedKey) ||
  10321. config.isReservedAttr(hyphenatedKey)) {
  10322. warn(
  10323. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  10324. vm
  10325. );
  10326. }
  10327. defineReactive$$1(props, key, value, function () {
  10328. if (!isRoot && !isUpdatingChildComponent) {
  10329. {
  10330. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  10331. return
  10332. }
  10333. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  10334. if(
  10335. key === 'value' &&
  10336. Array.isArray(vm.$options.behaviors) &&
  10337. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  10338. ){
  10339. return
  10340. }
  10341. if(vm._getFormData){
  10342. return
  10343. }
  10344. var $parent = vm.$parent;
  10345. while($parent){
  10346. if($parent.__next_tick_pending){
  10347. return
  10348. }
  10349. $parent = $parent.$parent;
  10350. }
  10351. }
  10352. warn(
  10353. "Avoid mutating a prop directly since the value will be " +
  10354. "overwritten whenever the parent component re-renders. " +
  10355. "Instead, use a data or computed property based on the prop's " +
  10356. "value. Prop being mutated: \"" + key + "\"",
  10357. vm
  10358. );
  10359. }
  10360. });
  10361. } else {}
  10362. // static props are already proxied on the component's prototype
  10363. // during Vue.extend(). We only need to proxy props defined at
  10364. // instantiation here.
  10365. if (!(key in vm)) {
  10366. proxy(vm, "_props", key);
  10367. }
  10368. };
  10369. for (var key in propsOptions) loop( key );
  10370. toggleObserving(true);
  10371. }
  10372. function initData (vm) {
  10373. var data = vm.$options.data;
  10374. data = vm._data = typeof data === 'function'
  10375. ? getData(data, vm)
  10376. : data || {};
  10377. if (!isPlainObject(data)) {
  10378. data = {};
  10379. true && warn(
  10380. 'data functions should return an object:\n' +
  10381. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  10382. vm
  10383. );
  10384. }
  10385. // proxy data on instance
  10386. var keys = Object.keys(data);
  10387. var props = vm.$options.props;
  10388. var methods = vm.$options.methods;
  10389. var i = keys.length;
  10390. while (i--) {
  10391. var key = keys[i];
  10392. if (true) {
  10393. if (methods && hasOwn(methods, key)) {
  10394. warn(
  10395. ("Method \"" + key + "\" has already been defined as a data property."),
  10396. vm
  10397. );
  10398. }
  10399. }
  10400. if (props && hasOwn(props, key)) {
  10401. true && warn(
  10402. "The data property \"" + key + "\" is already declared as a prop. " +
  10403. "Use prop default value instead.",
  10404. vm
  10405. );
  10406. } else if (!isReserved(key)) {
  10407. proxy(vm, "_data", key);
  10408. }
  10409. }
  10410. // observe data
  10411. observe(data, true /* asRootData */);
  10412. }
  10413. function getData (data, vm) {
  10414. // #7573 disable dep collection when invoking data getters
  10415. pushTarget();
  10416. try {
  10417. return data.call(vm, vm)
  10418. } catch (e) {
  10419. handleError(e, vm, "data()");
  10420. return {}
  10421. } finally {
  10422. popTarget();
  10423. }
  10424. }
  10425. var computedWatcherOptions = { lazy: true };
  10426. function initComputed (vm, computed) {
  10427. // $flow-disable-line
  10428. var watchers = vm._computedWatchers = Object.create(null);
  10429. // computed properties are just getters during SSR
  10430. var isSSR = isServerRendering();
  10431. for (var key in computed) {
  10432. var userDef = computed[key];
  10433. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  10434. if ( true && getter == null) {
  10435. warn(
  10436. ("Getter is missing for computed property \"" + key + "\"."),
  10437. vm
  10438. );
  10439. }
  10440. if (!isSSR) {
  10441. // create internal watcher for the computed property.
  10442. watchers[key] = new Watcher(
  10443. vm,
  10444. getter || noop,
  10445. noop,
  10446. computedWatcherOptions
  10447. );
  10448. }
  10449. // component-defined computed properties are already defined on the
  10450. // component prototype. We only need to define computed properties defined
  10451. // at instantiation here.
  10452. if (!(key in vm)) {
  10453. defineComputed(vm, key, userDef);
  10454. } else if (true) {
  10455. if (key in vm.$data) {
  10456. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  10457. } else if (vm.$options.props && key in vm.$options.props) {
  10458. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  10459. }
  10460. }
  10461. }
  10462. }
  10463. function defineComputed (
  10464. target,
  10465. key,
  10466. userDef
  10467. ) {
  10468. var shouldCache = !isServerRendering();
  10469. if (typeof userDef === 'function') {
  10470. sharedPropertyDefinition.get = shouldCache
  10471. ? createComputedGetter(key)
  10472. : createGetterInvoker(userDef);
  10473. sharedPropertyDefinition.set = noop;
  10474. } else {
  10475. sharedPropertyDefinition.get = userDef.get
  10476. ? shouldCache && userDef.cache !== false
  10477. ? createComputedGetter(key)
  10478. : createGetterInvoker(userDef.get)
  10479. : noop;
  10480. sharedPropertyDefinition.set = userDef.set || noop;
  10481. }
  10482. if ( true &&
  10483. sharedPropertyDefinition.set === noop) {
  10484. sharedPropertyDefinition.set = function () {
  10485. warn(
  10486. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  10487. this
  10488. );
  10489. };
  10490. }
  10491. Object.defineProperty(target, key, sharedPropertyDefinition);
  10492. }
  10493. function createComputedGetter (key) {
  10494. return function computedGetter () {
  10495. var watcher = this._computedWatchers && this._computedWatchers[key];
  10496. if (watcher) {
  10497. if (watcher.dirty) {
  10498. watcher.evaluate();
  10499. }
  10500. if (Dep.SharedObject.target) {// fixed by xxxxxx
  10501. watcher.depend();
  10502. }
  10503. return watcher.value
  10504. }
  10505. }
  10506. }
  10507. function createGetterInvoker(fn) {
  10508. return function computedGetter () {
  10509. return fn.call(this, this)
  10510. }
  10511. }
  10512. function initMethods (vm, methods) {
  10513. var props = vm.$options.props;
  10514. for (var key in methods) {
  10515. if (true) {
  10516. if (typeof methods[key] !== 'function') {
  10517. warn(
  10518. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  10519. "Did you reference the function correctly?",
  10520. vm
  10521. );
  10522. }
  10523. if (props && hasOwn(props, key)) {
  10524. warn(
  10525. ("Method \"" + key + "\" has already been defined as a prop."),
  10526. vm
  10527. );
  10528. }
  10529. if ((key in vm) && isReserved(key)) {
  10530. warn(
  10531. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  10532. "Avoid defining component methods that start with _ or $."
  10533. );
  10534. }
  10535. }
  10536. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  10537. }
  10538. }
  10539. function initWatch (vm, watch) {
  10540. for (var key in watch) {
  10541. var handler = watch[key];
  10542. if (Array.isArray(handler)) {
  10543. for (var i = 0; i < handler.length; i++) {
  10544. createWatcher(vm, key, handler[i]);
  10545. }
  10546. } else {
  10547. createWatcher(vm, key, handler);
  10548. }
  10549. }
  10550. }
  10551. function createWatcher (
  10552. vm,
  10553. expOrFn,
  10554. handler,
  10555. options
  10556. ) {
  10557. if (isPlainObject(handler)) {
  10558. options = handler;
  10559. handler = handler.handler;
  10560. }
  10561. if (typeof handler === 'string') {
  10562. handler = vm[handler];
  10563. }
  10564. return vm.$watch(expOrFn, handler, options)
  10565. }
  10566. function stateMixin (Vue) {
  10567. // flow somehow has problems with directly declared definition object
  10568. // when using Object.defineProperty, so we have to procedurally build up
  10569. // the object here.
  10570. var dataDef = {};
  10571. dataDef.get = function () { return this._data };
  10572. var propsDef = {};
  10573. propsDef.get = function () { return this._props };
  10574. if (true) {
  10575. dataDef.set = function () {
  10576. warn(
  10577. 'Avoid replacing instance root $data. ' +
  10578. 'Use nested data properties instead.',
  10579. this
  10580. );
  10581. };
  10582. propsDef.set = function () {
  10583. warn("$props is readonly.", this);
  10584. };
  10585. }
  10586. Object.defineProperty(Vue.prototype, '$data', dataDef);
  10587. Object.defineProperty(Vue.prototype, '$props', propsDef);
  10588. Vue.prototype.$set = set;
  10589. Vue.prototype.$delete = del;
  10590. Vue.prototype.$watch = function (
  10591. expOrFn,
  10592. cb,
  10593. options
  10594. ) {
  10595. var vm = this;
  10596. if (isPlainObject(cb)) {
  10597. return createWatcher(vm, expOrFn, cb, options)
  10598. }
  10599. options = options || {};
  10600. options.user = true;
  10601. var watcher = new Watcher(vm, expOrFn, cb, options);
  10602. if (options.immediate) {
  10603. try {
  10604. cb.call(vm, watcher.value);
  10605. } catch (error) {
  10606. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  10607. }
  10608. }
  10609. return function unwatchFn () {
  10610. watcher.teardown();
  10611. }
  10612. };
  10613. }
  10614. /* */
  10615. var uid$3 = 0;
  10616. function initMixin (Vue) {
  10617. Vue.prototype._init = function (options) {
  10618. var vm = this;
  10619. // a uid
  10620. vm._uid = uid$3++;
  10621. var startTag, endTag;
  10622. /* istanbul ignore if */
  10623. if ( true && config.performance && mark) {
  10624. startTag = "vue-perf-start:" + (vm._uid);
  10625. endTag = "vue-perf-end:" + (vm._uid);
  10626. mark(startTag);
  10627. }
  10628. // a flag to avoid this being observed
  10629. vm._isVue = true;
  10630. // merge options
  10631. if (options && options._isComponent) {
  10632. // optimize internal component instantiation
  10633. // since dynamic options merging is pretty slow, and none of the
  10634. // internal component options needs special treatment.
  10635. initInternalComponent(vm, options);
  10636. } else {
  10637. vm.$options = mergeOptions(
  10638. resolveConstructorOptions(vm.constructor),
  10639. options || {},
  10640. vm
  10641. );
  10642. }
  10643. /* istanbul ignore else */
  10644. if (true) {
  10645. initProxy(vm);
  10646. } else {}
  10647. // expose real self
  10648. vm._self = vm;
  10649. initLifecycle(vm);
  10650. initEvents(vm);
  10651. initRender(vm);
  10652. callHook(vm, 'beforeCreate');
  10653. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  10654. initState(vm);
  10655. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  10656. !vm._$fallback && callHook(vm, 'created');
  10657. /* istanbul ignore if */
  10658. if ( true && config.performance && mark) {
  10659. vm._name = formatComponentName(vm, false);
  10660. mark(endTag);
  10661. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  10662. }
  10663. if (vm.$options.el) {
  10664. vm.$mount(vm.$options.el);
  10665. }
  10666. };
  10667. }
  10668. function initInternalComponent (vm, options) {
  10669. var opts = vm.$options = Object.create(vm.constructor.options);
  10670. // doing this because it's faster than dynamic enumeration.
  10671. var parentVnode = options._parentVnode;
  10672. opts.parent = options.parent;
  10673. opts._parentVnode = parentVnode;
  10674. var vnodeComponentOptions = parentVnode.componentOptions;
  10675. opts.propsData = vnodeComponentOptions.propsData;
  10676. opts._parentListeners = vnodeComponentOptions.listeners;
  10677. opts._renderChildren = vnodeComponentOptions.children;
  10678. opts._componentTag = vnodeComponentOptions.tag;
  10679. if (options.render) {
  10680. opts.render = options.render;
  10681. opts.staticRenderFns = options.staticRenderFns;
  10682. }
  10683. }
  10684. function resolveConstructorOptions (Ctor) {
  10685. var options = Ctor.options;
  10686. if (Ctor.super) {
  10687. var superOptions = resolveConstructorOptions(Ctor.super);
  10688. var cachedSuperOptions = Ctor.superOptions;
  10689. if (superOptions !== cachedSuperOptions) {
  10690. // super option changed,
  10691. // need to resolve new options.
  10692. Ctor.superOptions = superOptions;
  10693. // check if there are any late-modified/attached options (#4976)
  10694. var modifiedOptions = resolveModifiedOptions(Ctor);
  10695. // update base extend options
  10696. if (modifiedOptions) {
  10697. extend(Ctor.extendOptions, modifiedOptions);
  10698. }
  10699. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  10700. if (options.name) {
  10701. options.components[options.name] = Ctor;
  10702. }
  10703. }
  10704. }
  10705. return options
  10706. }
  10707. function resolveModifiedOptions (Ctor) {
  10708. var modified;
  10709. var latest = Ctor.options;
  10710. var sealed = Ctor.sealedOptions;
  10711. for (var key in latest) {
  10712. if (latest[key] !== sealed[key]) {
  10713. if (!modified) { modified = {}; }
  10714. modified[key] = latest[key];
  10715. }
  10716. }
  10717. return modified
  10718. }
  10719. function Vue (options) {
  10720. if ( true &&
  10721. !(this instanceof Vue)
  10722. ) {
  10723. warn('Vue is a constructor and should be called with the `new` keyword');
  10724. }
  10725. this._init(options);
  10726. }
  10727. initMixin(Vue);
  10728. stateMixin(Vue);
  10729. eventsMixin(Vue);
  10730. lifecycleMixin(Vue);
  10731. renderMixin(Vue);
  10732. /* */
  10733. function initUse (Vue) {
  10734. Vue.use = function (plugin) {
  10735. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  10736. if (installedPlugins.indexOf(plugin) > -1) {
  10737. return this
  10738. }
  10739. // additional parameters
  10740. var args = toArray(arguments, 1);
  10741. args.unshift(this);
  10742. if (typeof plugin.install === 'function') {
  10743. plugin.install.apply(plugin, args);
  10744. } else if (typeof plugin === 'function') {
  10745. plugin.apply(null, args);
  10746. }
  10747. installedPlugins.push(plugin);
  10748. return this
  10749. };
  10750. }
  10751. /* */
  10752. function initMixin$1 (Vue) {
  10753. Vue.mixin = function (mixin) {
  10754. this.options = mergeOptions(this.options, mixin);
  10755. return this
  10756. };
  10757. }
  10758. /* */
  10759. function initExtend (Vue) {
  10760. /**
  10761. * Each instance constructor, including Vue, has a unique
  10762. * cid. This enables us to create wrapped "child
  10763. * constructors" for prototypal inheritance and cache them.
  10764. */
  10765. Vue.cid = 0;
  10766. var cid = 1;
  10767. /**
  10768. * Class inheritance
  10769. */
  10770. Vue.extend = function (extendOptions) {
  10771. extendOptions = extendOptions || {};
  10772. var Super = this;
  10773. var SuperId = Super.cid;
  10774. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  10775. if (cachedCtors[SuperId]) {
  10776. return cachedCtors[SuperId]
  10777. }
  10778. var name = extendOptions.name || Super.options.name;
  10779. if ( true && name) {
  10780. validateComponentName(name);
  10781. }
  10782. var Sub = function VueComponent (options) {
  10783. this._init(options);
  10784. };
  10785. Sub.prototype = Object.create(Super.prototype);
  10786. Sub.prototype.constructor = Sub;
  10787. Sub.cid = cid++;
  10788. Sub.options = mergeOptions(
  10789. Super.options,
  10790. extendOptions
  10791. );
  10792. Sub['super'] = Super;
  10793. // For props and computed properties, we define the proxy getters on
  10794. // the Vue instances at extension time, on the extended prototype. This
  10795. // avoids Object.defineProperty calls for each instance created.
  10796. if (Sub.options.props) {
  10797. initProps$1(Sub);
  10798. }
  10799. if (Sub.options.computed) {
  10800. initComputed$1(Sub);
  10801. }
  10802. // allow further extension/mixin/plugin usage
  10803. Sub.extend = Super.extend;
  10804. Sub.mixin = Super.mixin;
  10805. Sub.use = Super.use;
  10806. // create asset registers, so extended classes
  10807. // can have their private assets too.
  10808. ASSET_TYPES.forEach(function (type) {
  10809. Sub[type] = Super[type];
  10810. });
  10811. // enable recursive self-lookup
  10812. if (name) {
  10813. Sub.options.components[name] = Sub;
  10814. }
  10815. // keep a reference to the super options at extension time.
  10816. // later at instantiation we can check if Super's options have
  10817. // been updated.
  10818. Sub.superOptions = Super.options;
  10819. Sub.extendOptions = extendOptions;
  10820. Sub.sealedOptions = extend({}, Sub.options);
  10821. // cache constructor
  10822. cachedCtors[SuperId] = Sub;
  10823. return Sub
  10824. };
  10825. }
  10826. function initProps$1 (Comp) {
  10827. var props = Comp.options.props;
  10828. for (var key in props) {
  10829. proxy(Comp.prototype, "_props", key);
  10830. }
  10831. }
  10832. function initComputed$1 (Comp) {
  10833. var computed = Comp.options.computed;
  10834. for (var key in computed) {
  10835. defineComputed(Comp.prototype, key, computed[key]);
  10836. }
  10837. }
  10838. /* */
  10839. function initAssetRegisters (Vue) {
  10840. /**
  10841. * Create asset registration methods.
  10842. */
  10843. ASSET_TYPES.forEach(function (type) {
  10844. Vue[type] = function (
  10845. id,
  10846. definition
  10847. ) {
  10848. if (!definition) {
  10849. return this.options[type + 's'][id]
  10850. } else {
  10851. /* istanbul ignore if */
  10852. if ( true && type === 'component') {
  10853. validateComponentName(id);
  10854. }
  10855. if (type === 'component' && isPlainObject(definition)) {
  10856. definition.name = definition.name || id;
  10857. definition = this.options._base.extend(definition);
  10858. }
  10859. if (type === 'directive' && typeof definition === 'function') {
  10860. definition = { bind: definition, update: definition };
  10861. }
  10862. this.options[type + 's'][id] = definition;
  10863. return definition
  10864. }
  10865. };
  10866. });
  10867. }
  10868. /* */
  10869. function getComponentName (opts) {
  10870. return opts && (opts.Ctor.options.name || opts.tag)
  10871. }
  10872. function matches (pattern, name) {
  10873. if (Array.isArray(pattern)) {
  10874. return pattern.indexOf(name) > -1
  10875. } else if (typeof pattern === 'string') {
  10876. return pattern.split(',').indexOf(name) > -1
  10877. } else if (isRegExp(pattern)) {
  10878. return pattern.test(name)
  10879. }
  10880. /* istanbul ignore next */
  10881. return false
  10882. }
  10883. function pruneCache (keepAliveInstance, filter) {
  10884. var cache = keepAliveInstance.cache;
  10885. var keys = keepAliveInstance.keys;
  10886. var _vnode = keepAliveInstance._vnode;
  10887. for (var key in cache) {
  10888. var cachedNode = cache[key];
  10889. if (cachedNode) {
  10890. var name = getComponentName(cachedNode.componentOptions);
  10891. if (name && !filter(name)) {
  10892. pruneCacheEntry(cache, key, keys, _vnode);
  10893. }
  10894. }
  10895. }
  10896. }
  10897. function pruneCacheEntry (
  10898. cache,
  10899. key,
  10900. keys,
  10901. current
  10902. ) {
  10903. var cached$$1 = cache[key];
  10904. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  10905. cached$$1.componentInstance.$destroy();
  10906. }
  10907. cache[key] = null;
  10908. remove(keys, key);
  10909. }
  10910. var patternTypes = [String, RegExp, Array];
  10911. var KeepAlive = {
  10912. name: 'keep-alive',
  10913. abstract: true,
  10914. props: {
  10915. include: patternTypes,
  10916. exclude: patternTypes,
  10917. max: [String, Number]
  10918. },
  10919. created: function created () {
  10920. this.cache = Object.create(null);
  10921. this.keys = [];
  10922. },
  10923. destroyed: function destroyed () {
  10924. for (var key in this.cache) {
  10925. pruneCacheEntry(this.cache, key, this.keys);
  10926. }
  10927. },
  10928. mounted: function mounted () {
  10929. var this$1 = this;
  10930. this.$watch('include', function (val) {
  10931. pruneCache(this$1, function (name) { return matches(val, name); });
  10932. });
  10933. this.$watch('exclude', function (val) {
  10934. pruneCache(this$1, function (name) { return !matches(val, name); });
  10935. });
  10936. },
  10937. render: function render () {
  10938. var slot = this.$slots.default;
  10939. var vnode = getFirstComponentChild(slot);
  10940. var componentOptions = vnode && vnode.componentOptions;
  10941. if (componentOptions) {
  10942. // check pattern
  10943. var name = getComponentName(componentOptions);
  10944. var ref = this;
  10945. var include = ref.include;
  10946. var exclude = ref.exclude;
  10947. if (
  10948. // not included
  10949. (include && (!name || !matches(include, name))) ||
  10950. // excluded
  10951. (exclude && name && matches(exclude, name))
  10952. ) {
  10953. return vnode
  10954. }
  10955. var ref$1 = this;
  10956. var cache = ref$1.cache;
  10957. var keys = ref$1.keys;
  10958. var key = vnode.key == null
  10959. // same constructor may get registered as different local components
  10960. // so cid alone is not enough (#3269)
  10961. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  10962. : vnode.key;
  10963. if (cache[key]) {
  10964. vnode.componentInstance = cache[key].componentInstance;
  10965. // make current key freshest
  10966. remove(keys, key);
  10967. keys.push(key);
  10968. } else {
  10969. cache[key] = vnode;
  10970. keys.push(key);
  10971. // prune oldest entry
  10972. if (this.max && keys.length > parseInt(this.max)) {
  10973. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  10974. }
  10975. }
  10976. vnode.data.keepAlive = true;
  10977. }
  10978. return vnode || (slot && slot[0])
  10979. }
  10980. };
  10981. var builtInComponents = {
  10982. KeepAlive: KeepAlive
  10983. };
  10984. /* */
  10985. function initGlobalAPI (Vue) {
  10986. // config
  10987. var configDef = {};
  10988. configDef.get = function () { return config; };
  10989. if (true) {
  10990. configDef.set = function () {
  10991. warn(
  10992. 'Do not replace the Vue.config object, set individual fields instead.'
  10993. );
  10994. };
  10995. }
  10996. Object.defineProperty(Vue, 'config', configDef);
  10997. // exposed util methods.
  10998. // NOTE: these are not considered part of the public API - avoid relying on
  10999. // them unless you are aware of the risk.
  11000. Vue.util = {
  11001. warn: warn,
  11002. extend: extend,
  11003. mergeOptions: mergeOptions,
  11004. defineReactive: defineReactive$$1
  11005. };
  11006. Vue.set = set;
  11007. Vue.delete = del;
  11008. Vue.nextTick = nextTick;
  11009. // 2.6 explicit observable API
  11010. Vue.observable = function (obj) {
  11011. observe(obj);
  11012. return obj
  11013. };
  11014. Vue.options = Object.create(null);
  11015. ASSET_TYPES.forEach(function (type) {
  11016. Vue.options[type + 's'] = Object.create(null);
  11017. });
  11018. // this is used to identify the "base" constructor to extend all plain-object
  11019. // components with in Weex's multi-instance scenarios.
  11020. Vue.options._base = Vue;
  11021. extend(Vue.options.components, builtInComponents);
  11022. initUse(Vue);
  11023. initMixin$1(Vue);
  11024. initExtend(Vue);
  11025. initAssetRegisters(Vue);
  11026. }
  11027. initGlobalAPI(Vue);
  11028. Object.defineProperty(Vue.prototype, '$isServer', {
  11029. get: isServerRendering
  11030. });
  11031. Object.defineProperty(Vue.prototype, '$ssrContext', {
  11032. get: function get () {
  11033. /* istanbul ignore next */
  11034. return this.$vnode && this.$vnode.ssrContext
  11035. }
  11036. });
  11037. // expose FunctionalRenderContext for ssr runtime helper installation
  11038. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  11039. value: FunctionalRenderContext
  11040. });
  11041. Vue.version = '2.6.11';
  11042. /**
  11043. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  11044. */
  11045. var ARRAYTYPE = '[object Array]';
  11046. var OBJECTTYPE = '[object Object]';
  11047. var NULLTYPE = '[object Null]';
  11048. var UNDEFINEDTYPE = '[object Undefined]';
  11049. // const FUNCTIONTYPE = '[object Function]'
  11050. function diff(current, pre) {
  11051. var result = {};
  11052. syncKeys(current, pre);
  11053. _diff(current, pre, '', result);
  11054. return result
  11055. }
  11056. function syncKeys(current, pre) {
  11057. if (current === pre) { return }
  11058. var rootCurrentType = type(current);
  11059. var rootPreType = type(pre);
  11060. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  11061. if(Object.keys(current).length >= Object.keys(pre).length){
  11062. for (var key in pre) {
  11063. var currentValue = current[key];
  11064. if (currentValue === undefined) {
  11065. current[key] = null;
  11066. } else {
  11067. syncKeys(currentValue, pre[key]);
  11068. }
  11069. }
  11070. }
  11071. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  11072. if (current.length >= pre.length) {
  11073. pre.forEach(function (item, index) {
  11074. syncKeys(current[index], item);
  11075. });
  11076. }
  11077. }
  11078. }
  11079. function nullOrUndefined(currentType, preType) {
  11080. if(
  11081. (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
  11082. (preType === NULLTYPE || preType === UNDEFINEDTYPE)
  11083. ) {
  11084. return false
  11085. }
  11086. return true
  11087. }
  11088. function _diff(current, pre, path, result) {
  11089. if (current === pre) { return }
  11090. var rootCurrentType = type(current);
  11091. var rootPreType = type(pre);
  11092. if (rootCurrentType == OBJECTTYPE) {
  11093. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  11094. setResult(result, path, current);
  11095. } else {
  11096. var loop = function ( key ) {
  11097. var currentValue = current[key];
  11098. var preValue = pre[key];
  11099. var currentType = type(currentValue);
  11100. var preType = type(preValue);
  11101. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  11102. if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
  11103. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  11104. }
  11105. } else if (currentType == ARRAYTYPE) {
  11106. if (preType != ARRAYTYPE) {
  11107. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  11108. } else {
  11109. if (currentValue.length < preValue.length) {
  11110. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  11111. } else {
  11112. currentValue.forEach(function (item, index) {
  11113. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  11114. });
  11115. }
  11116. }
  11117. } else if (currentType == OBJECTTYPE) {
  11118. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  11119. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  11120. } else {
  11121. for (var subKey in currentValue) {
  11122. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  11123. }
  11124. }
  11125. }
  11126. };
  11127. for (var key in current) loop( key );
  11128. }
  11129. } else if (rootCurrentType == ARRAYTYPE) {
  11130. if (rootPreType != ARRAYTYPE) {
  11131. setResult(result, path, current);
  11132. } else {
  11133. if (current.length < pre.length) {
  11134. setResult(result, path, current);
  11135. } else {
  11136. current.forEach(function (item, index) {
  11137. _diff(item, pre[index], path + '[' + index + ']', result);
  11138. });
  11139. }
  11140. }
  11141. } else {
  11142. setResult(result, path, current);
  11143. }
  11144. }
  11145. function setResult(result, k, v) {
  11146. // if (type(v) != FUNCTIONTYPE) {
  11147. result[k] = v;
  11148. // }
  11149. }
  11150. function type(obj) {
  11151. return Object.prototype.toString.call(obj)
  11152. }
  11153. /* */
  11154. function flushCallbacks$1(vm) {
  11155. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  11156. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  11157. var mpInstance = vm.$scope;
  11158. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  11159. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  11160. }
  11161. var copies = vm.__next_tick_callbacks.slice(0);
  11162. vm.__next_tick_callbacks.length = 0;
  11163. for (var i = 0; i < copies.length; i++) {
  11164. copies[i]();
  11165. }
  11166. }
  11167. }
  11168. function hasRenderWatcher(vm) {
  11169. return queue.find(function (watcher) { return vm._watcher === watcher; })
  11170. }
  11171. function nextTick$1(vm, cb) {
  11172. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  11173. //2.nextTick 之前存在 render watcher
  11174. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  11175. if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  11176. var mpInstance = vm.$scope;
  11177. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  11178. ']:nextVueTick');
  11179. }
  11180. return nextTick(cb, vm)
  11181. }else{
  11182. if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  11183. var mpInstance$1 = vm.$scope;
  11184. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  11185. ']:nextMPTick');
  11186. }
  11187. }
  11188. var _resolve;
  11189. if (!vm.__next_tick_callbacks) {
  11190. vm.__next_tick_callbacks = [];
  11191. }
  11192. vm.__next_tick_callbacks.push(function () {
  11193. if (cb) {
  11194. try {
  11195. cb.call(vm);
  11196. } catch (e) {
  11197. handleError(e, vm, 'nextTick');
  11198. }
  11199. } else if (_resolve) {
  11200. _resolve(vm);
  11201. }
  11202. });
  11203. // $flow-disable-line
  11204. if (!cb && typeof Promise !== 'undefined') {
  11205. return new Promise(function (resolve) {
  11206. _resolve = resolve;
  11207. })
  11208. }
  11209. }
  11210. /* */
  11211. function clearInstance(key, value) {
  11212. // 简易去除 Vue 和小程序组件实例
  11213. if (value) {
  11214. if (value._isVue || value.__v_isMPComponent) {
  11215. return {}
  11216. }
  11217. }
  11218. return value
  11219. }
  11220. function cloneWithData(vm) {
  11221. // 确保当前 vm 所有数据被同步
  11222. var ret = Object.create(null);
  11223. var dataKeys = [].concat(
  11224. Object.keys(vm._data || {}),
  11225. Object.keys(vm._computedWatchers || {}));
  11226. dataKeys.reduce(function(ret, key) {
  11227. ret[key] = vm[key];
  11228. return ret
  11229. }, ret);
  11230. // vue-composition-api
  11231. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  11232. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  11233. if (rawBindings) {
  11234. Object.keys(rawBindings).forEach(function (key) {
  11235. ret[key] = vm[key];
  11236. });
  11237. }
  11238. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  11239. Object.assign(ret, vm.$mp.data || {});
  11240. if (
  11241. Array.isArray(vm.$options.behaviors) &&
  11242. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  11243. ) { //form-field
  11244. ret['name'] = vm.name;
  11245. ret['value'] = vm.value;
  11246. }
  11247. return JSON.parse(JSON.stringify(ret, clearInstance))
  11248. }
  11249. var patch = function(oldVnode, vnode) {
  11250. var this$1 = this;
  11251. if (vnode === null) { //destroy
  11252. return
  11253. }
  11254. if (this.mpType === 'page' || this.mpType === 'component') {
  11255. var mpInstance = this.$scope;
  11256. var data = Object.create(null);
  11257. try {
  11258. data = cloneWithData(this);
  11259. } catch (err) {
  11260. console.error(err);
  11261. }
  11262. data.__webviewId__ = mpInstance.data.__webviewId__;
  11263. var mpData = Object.create(null);
  11264. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  11265. mpData[key] = mpInstance.data[key];
  11266. });
  11267. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  11268. if (Object.keys(diffData).length) {
  11269. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  11270. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  11271. ']差量更新',
  11272. JSON.stringify(diffData));
  11273. }
  11274. this.__next_tick_pending = true;
  11275. mpInstance.setData(diffData, function () {
  11276. this$1.__next_tick_pending = false;
  11277. flushCallbacks$1(this$1);
  11278. });
  11279. } else {
  11280. flushCallbacks$1(this);
  11281. }
  11282. }
  11283. };
  11284. /* */
  11285. function createEmptyRender() {
  11286. }
  11287. function mountComponent$1(
  11288. vm,
  11289. el,
  11290. hydrating
  11291. ) {
  11292. if (!vm.mpType) {//main.js 中的 new Vue
  11293. return vm
  11294. }
  11295. if (vm.mpType === 'app') {
  11296. vm.$options.render = createEmptyRender;
  11297. }
  11298. if (!vm.$options.render) {
  11299. vm.$options.render = createEmptyRender;
  11300. if (true) {
  11301. /* istanbul ignore if */
  11302. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  11303. vm.$options.el || el) {
  11304. warn(
  11305. 'You are using the runtime-only build of Vue where the template ' +
  11306. 'compiler is not available. Either pre-compile the templates into ' +
  11307. 'render functions, or use the compiler-included build.',
  11308. vm
  11309. );
  11310. } else {
  11311. warn(
  11312. 'Failed to mount component: template or render function not defined.',
  11313. vm
  11314. );
  11315. }
  11316. }
  11317. }
  11318. !vm._$fallback && callHook(vm, 'beforeMount');
  11319. var updateComponent = function () {
  11320. vm._update(vm._render(), hydrating);
  11321. };
  11322. // we set this to vm._watcher inside the watcher's constructor
  11323. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  11324. // component's mounted hook), which relies on vm._watcher being already defined
  11325. new Watcher(vm, updateComponent, noop, {
  11326. before: function before() {
  11327. if (vm._isMounted && !vm._isDestroyed) {
  11328. callHook(vm, 'beforeUpdate');
  11329. }
  11330. }
  11331. }, true /* isRenderWatcher */);
  11332. hydrating = false;
  11333. return vm
  11334. }
  11335. /* */
  11336. function renderClass (
  11337. staticClass,
  11338. dynamicClass
  11339. ) {
  11340. if (isDef(staticClass) || isDef(dynamicClass)) {
  11341. return concat(staticClass, stringifyClass(dynamicClass))
  11342. }
  11343. /* istanbul ignore next */
  11344. return ''
  11345. }
  11346. function concat (a, b) {
  11347. return a ? b ? (a + ' ' + b) : a : (b || '')
  11348. }
  11349. function stringifyClass (value) {
  11350. if (Array.isArray(value)) {
  11351. return stringifyArray(value)
  11352. }
  11353. if (isObject(value)) {
  11354. return stringifyObject(value)
  11355. }
  11356. if (typeof value === 'string') {
  11357. return value
  11358. }
  11359. /* istanbul ignore next */
  11360. return ''
  11361. }
  11362. function stringifyArray (value) {
  11363. var res = '';
  11364. var stringified;
  11365. for (var i = 0, l = value.length; i < l; i++) {
  11366. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  11367. if (res) { res += ' '; }
  11368. res += stringified;
  11369. }
  11370. }
  11371. return res
  11372. }
  11373. function stringifyObject (value) {
  11374. var res = '';
  11375. for (var key in value) {
  11376. if (value[key]) {
  11377. if (res) { res += ' '; }
  11378. res += key;
  11379. }
  11380. }
  11381. return res
  11382. }
  11383. /* */
  11384. var parseStyleText = cached(function (cssText) {
  11385. var res = {};
  11386. var listDelimiter = /;(?![^(]*\))/g;
  11387. var propertyDelimiter = /:(.+)/;
  11388. cssText.split(listDelimiter).forEach(function (item) {
  11389. if (item) {
  11390. var tmp = item.split(propertyDelimiter);
  11391. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  11392. }
  11393. });
  11394. return res
  11395. });
  11396. // normalize possible array / string values into Object
  11397. function normalizeStyleBinding (bindingStyle) {
  11398. if (Array.isArray(bindingStyle)) {
  11399. return toObject(bindingStyle)
  11400. }
  11401. if (typeof bindingStyle === 'string') {
  11402. return parseStyleText(bindingStyle)
  11403. }
  11404. return bindingStyle
  11405. }
  11406. /* */
  11407. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  11408. function getTarget(obj, path) {
  11409. var parts = path.split('.');
  11410. var key = parts[0];
  11411. if (key.indexOf('__$n') === 0) { //number index
  11412. key = parseInt(key.replace('__$n', ''));
  11413. }
  11414. if (parts.length === 1) {
  11415. return obj[key]
  11416. }
  11417. return getTarget(obj[key], parts.slice(1).join('.'))
  11418. }
  11419. function internalMixin(Vue) {
  11420. Vue.config.errorHandler = function(err, vm, info) {
  11421. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  11422. console.error(err);
  11423. /* eslint-disable no-undef */
  11424. var app = typeof getApp === 'function' && getApp();
  11425. if (app && app.onError) {
  11426. app.onError(err);
  11427. }
  11428. };
  11429. var oldEmit = Vue.prototype.$emit;
  11430. Vue.prototype.$emit = function(event) {
  11431. if (this.$scope && event) {
  11432. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  11433. if (triggerEvent) {
  11434. try {
  11435. triggerEvent.call(this.$scope, event, {
  11436. __args__: toArray(arguments, 1)
  11437. });
  11438. } catch (error) {
  11439. }
  11440. }
  11441. }
  11442. return oldEmit.apply(this, arguments)
  11443. };
  11444. Vue.prototype.$nextTick = function(fn) {
  11445. return nextTick$1(this, fn)
  11446. };
  11447. MP_METHODS.forEach(function (method) {
  11448. Vue.prototype[method] = function(args) {
  11449. if (this.$scope && this.$scope[method]) {
  11450. return this.$scope[method](args)
  11451. }
  11452. // mp-alipay
  11453. if (typeof my === 'undefined') {
  11454. return
  11455. }
  11456. if (method === 'createSelectorQuery') {
  11457. /* eslint-disable no-undef */
  11458. return my.createSelectorQuery(args)
  11459. } else if (method === 'createIntersectionObserver') {
  11460. /* eslint-disable no-undef */
  11461. return my.createIntersectionObserver(args)
  11462. }
  11463. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  11464. };
  11465. });
  11466. Vue.prototype.__init_provide = initProvide;
  11467. Vue.prototype.__init_injections = initInjections;
  11468. Vue.prototype.__call_hook = function(hook, args) {
  11469. var vm = this;
  11470. // #7573 disable dep collection when invoking lifecycle hooks
  11471. pushTarget();
  11472. var handlers = vm.$options[hook];
  11473. var info = hook + " hook";
  11474. var ret;
  11475. if (handlers) {
  11476. for (var i = 0, j = handlers.length; i < j; i++) {
  11477. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  11478. }
  11479. }
  11480. if (vm._hasHookEvent) {
  11481. vm.$emit('hook:' + hook, args);
  11482. }
  11483. popTarget();
  11484. return ret
  11485. };
  11486. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  11487. if (Array.isArray(modifiers)) {
  11488. if (modifiers.indexOf('trim') !== -1) {
  11489. value = value.trim();
  11490. }
  11491. if (modifiers.indexOf('number') !== -1) {
  11492. value = this._n(value);
  11493. }
  11494. }
  11495. if (!target) {
  11496. target = this;
  11497. }
  11498. // 解决动态属性添加
  11499. Vue.set(target, key, value);
  11500. };
  11501. Vue.prototype.__set_sync = function(target, key, value) {
  11502. if (!target) {
  11503. target = this;
  11504. }
  11505. // 解决动态属性添加
  11506. Vue.set(target, key, value);
  11507. };
  11508. Vue.prototype.__get_orig = function(item) {
  11509. if (isPlainObject(item)) {
  11510. return item['$orig'] || item
  11511. }
  11512. return item
  11513. };
  11514. Vue.prototype.__get_value = function(dataPath, target) {
  11515. return getTarget(target || this, dataPath)
  11516. };
  11517. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  11518. return renderClass(staticClass, dynamicClass)
  11519. };
  11520. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  11521. if (!dynamicStyle && !staticStyle) {
  11522. return ''
  11523. }
  11524. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  11525. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  11526. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  11527. };
  11528. Vue.prototype.__map = function(val, iteratee) {
  11529. //TODO 暂不考虑 string
  11530. var ret, i, l, keys, key;
  11531. if (Array.isArray(val)) {
  11532. ret = new Array(val.length);
  11533. for (i = 0, l = val.length; i < l; i++) {
  11534. ret[i] = iteratee(val[i], i);
  11535. }
  11536. return ret
  11537. } else if (isObject(val)) {
  11538. keys = Object.keys(val);
  11539. ret = Object.create(null);
  11540. for (i = 0, l = keys.length; i < l; i++) {
  11541. key = keys[i];
  11542. ret[key] = iteratee(val[key], key, i);
  11543. }
  11544. return ret
  11545. } else if (typeof val === 'number') {
  11546. ret = new Array(val);
  11547. for (i = 0, l = val; i < l; i++) {
  11548. // 第一个参数暂时仍和小程序一致
  11549. ret[i] = iteratee(i, i);
  11550. }
  11551. return ret
  11552. }
  11553. return []
  11554. };
  11555. }
  11556. /* */
  11557. var LIFECYCLE_HOOKS$1 = [
  11558. //App
  11559. 'onLaunch',
  11560. 'onShow',
  11561. 'onHide',
  11562. 'onUniNViewMessage',
  11563. 'onPageNotFound',
  11564. 'onThemeChange',
  11565. 'onError',
  11566. 'onUnhandledRejection',
  11567. //Page
  11568. 'onInit',
  11569. 'onLoad',
  11570. // 'onShow',
  11571. 'onReady',
  11572. // 'onHide',
  11573. 'onUnload',
  11574. 'onPullDownRefresh',
  11575. 'onReachBottom',
  11576. 'onTabItemTap',
  11577. 'onAddToFavorites',
  11578. 'onShareTimeline',
  11579. 'onShareAppMessage',
  11580. 'onResize',
  11581. 'onPageScroll',
  11582. 'onNavigationBarButtonTap',
  11583. 'onBackPress',
  11584. 'onNavigationBarSearchInputChanged',
  11585. 'onNavigationBarSearchInputConfirmed',
  11586. 'onNavigationBarSearchInputClicked',
  11587. 'onUploadDouyinVideo',
  11588. 'onNFCReadMessage',
  11589. //Component
  11590. // 'onReady', // 兼容旧版本,应该移除该事件
  11591. 'onPageShow',
  11592. 'onPageHide',
  11593. 'onPageResize'
  11594. ];
  11595. function lifecycleMixin$1(Vue) {
  11596. //fixed vue-class-component
  11597. var oldExtend = Vue.extend;
  11598. Vue.extend = function(extendOptions) {
  11599. extendOptions = extendOptions || {};
  11600. var methods = extendOptions.methods;
  11601. if (methods) {
  11602. Object.keys(methods).forEach(function (methodName) {
  11603. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  11604. extendOptions[methodName] = methods[methodName];
  11605. delete methods[methodName];
  11606. }
  11607. });
  11608. }
  11609. return oldExtend.call(this, extendOptions)
  11610. };
  11611. var strategies = Vue.config.optionMergeStrategies;
  11612. var mergeHook = strategies.created;
  11613. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  11614. strategies[hook] = mergeHook;
  11615. });
  11616. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  11617. }
  11618. /* */
  11619. // install platform patch function
  11620. Vue.prototype.__patch__ = patch;
  11621. // public mount method
  11622. Vue.prototype.$mount = function(
  11623. el ,
  11624. hydrating
  11625. ) {
  11626. return mountComponent$1(this, el, hydrating)
  11627. };
  11628. lifecycleMixin$1(Vue);
  11629. internalMixin(Vue);
  11630. /* */
  11631. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  11632. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  11633. /***/ }),
  11634. /***/ 26:
  11635. /*!*************************************************************************************!*\
  11636. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/pages.json ***!
  11637. \*************************************************************************************/
  11638. /*! no static exports found */
  11639. /***/ (function(module, exports) {
  11640. /***/ }),
  11641. /***/ 3:
  11642. /*!***********************************!*\
  11643. !*** (webpack)/buildin/global.js ***!
  11644. \***********************************/
  11645. /*! no static exports found */
  11646. /***/ (function(module, exports) {
  11647. var g;
  11648. // This works in non-strict mode
  11649. g = (function() {
  11650. return this;
  11651. })();
  11652. try {
  11653. // This works if eval is allowed (see CSP)
  11654. g = g || new Function("return this")();
  11655. } catch (e) {
  11656. // This works if the window reference is available
  11657. if (typeof window === "object") g = window;
  11658. }
  11659. // g can still be undefined, but nothing to do about it...
  11660. // We return undefined, instead of nothing here, so it's
  11661. // easier to handle this case. if(!global) { ...}
  11662. module.exports = g;
  11663. /***/ }),
  11664. /***/ 30:
  11665. /*!*******************************************************************************************!*\
  11666. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/static/js/api.js ***!
  11667. \*******************************************************************************************/
  11668. /*! no static exports found */
  11669. /***/ (function(module, exports, __webpack_require__) {
  11670. "use strict";
  11671. /* WEBPACK VAR INJECTION */(function(uni) {
  11672. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11673. Object.defineProperty(exports, "__esModule", {
  11674. value: true
  11675. });
  11676. exports.default = void 0;
  11677. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 31));
  11678. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  11679. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 33));
  11680. var _app = _interopRequireDefault(__webpack_require__(/*! ./app */ 34));
  11681. var _config = _interopRequireDefault(__webpack_require__(/*! ./config */ 35));
  11682. 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; }
  11683. 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; }
  11684. var api = {};
  11685. // 网络请求封装
  11686. var Request = function Request(opts) {
  11687. var originalComplete = opts.complete;
  11688. return new Promise(function (resolve, reject) {
  11689. uni.request(Object.assign({}, opts, {
  11690. complete: function complete(res) {
  11691. var hasSuccess = Boolean(res.errMsg == "request:ok" && res.statusCode >= 200 && res.statusCode < 300);
  11692. hasSuccess ? resolve(res.data) : reject(res);
  11693. if (originalComplete && typeof originalComplete == "function") originalComplete(res);
  11694. }
  11695. }));
  11696. });
  11697. };
  11698. // 路径拼接
  11699. var pathJoin = function pathJoin() {
  11700. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  11701. args[_key] = arguments[_key];
  11702. }
  11703. return args.join("/").replace(/(?<!:)(\/{2,})/g, "/");
  11704. };
  11705. // 显示LOADING
  11706. var showLoading = function showLoading() {
  11707. uni.showLoading({
  11708. title: "",
  11709. mask: true
  11710. });
  11711. };
  11712. // 关闭LOADING
  11713. var hideLoading = function hideLoading() {
  11714. uni.hideLoading();
  11715. };
  11716. // 获取用户TOKEN
  11717. var getUserToken = function getUserToken() {
  11718. return uni.getStorageSync(_config.default.keyname.userToken);
  11719. };
  11720. /**
  11721. * 基础请求
  11722. * @param {String} method 请求类型
  11723. * @param {String} url 请求地址
  11724. * @param {Object} data 请求数据
  11725. * @param {Object} opts 配置参数
  11726. */
  11727. api.base = function (method, url, data, opts) {
  11728. return new Promise( /*#__PURE__*/function () {
  11729. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
  11730. var options;
  11731. return _regenerator.default.wrap(function _callee3$(_context3) {
  11732. while (1) {
  11733. switch (_context3.prev = _context3.next) {
  11734. case 0:
  11735. options = Object.assign({
  11736. // 请求地址
  11737. url: pathJoin(_config.default.url.request, url),
  11738. // 请求数据
  11739. data: data || {},
  11740. // 请求类型
  11741. method: method || "post",
  11742. // 数据类型
  11743. dataType: "json",
  11744. // 自动显示LOADING
  11745. loading: true,
  11746. // 启用错误自动拦截
  11747. error: true,
  11748. // 请求头设定
  11749. header: {
  11750. "content-type": "application/json",
  11751. Authorization: "Bearer " + getAccessToken() // 修改这里,使用新的获取token方法
  11752. },
  11753. // 设置显示LOADING的方法
  11754. showLoading: showLoading,
  11755. // 设置关闭LOADING的方法
  11756. hideLoading: hideLoading
  11757. }, opts || {});
  11758. if (options.loading && typeof options.showLoading == "function") {
  11759. options.showLoading();
  11760. }
  11761. Request(options).then( /*#__PURE__*/function () {
  11762. var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(res) {
  11763. var refreshResult, db, _db;
  11764. return _regenerator.default.wrap(function _callee$(_context) {
  11765. while (1) {
  11766. switch (_context.prev = _context.next) {
  11767. case 0:
  11768. if (options.loading && typeof options.hideLoading == "function") {
  11769. options.hideLoading();
  11770. }
  11771. _context.t0 = res.code;
  11772. _context.next = _context.t0 === "00000" ? 4 : _context.t0 === "A0230" ? 6 : 44;
  11773. break;
  11774. case 4:
  11775. resolve(res);
  11776. return _context.abrupt("break", 46);
  11777. case 6:
  11778. _context.prev = 6;
  11779. // 尝试刷新token
  11780. console.log("进入刷新请求");
  11781. _context.next = 10;
  11782. return refreshToken();
  11783. case 10:
  11784. refreshResult = _context.sent;
  11785. if (!refreshResult) {
  11786. _context.next = 25;
  11787. break;
  11788. }
  11789. // 刷新成功,更新header中的token并重新请求
  11790. options.header.token = getAccessToken();
  11791. _context.prev = 13;
  11792. _context.next = 16;
  11793. return Request(options);
  11794. case 16:
  11795. db = _context.sent;
  11796. resolve(db);
  11797. _context.next = 23;
  11798. break;
  11799. case 20:
  11800. _context.prev = 20;
  11801. _context.t1 = _context["catch"](13);
  11802. reject(_context.t1);
  11803. case 23:
  11804. _context.next = 38;
  11805. break;
  11806. case 25:
  11807. _context.next = 27;
  11808. return api.login();
  11809. case 27:
  11810. options.header.token = getAccessToken();
  11811. _context.prev = 28;
  11812. _context.next = 31;
  11813. return Request(options);
  11814. case 31:
  11815. _db = _context.sent;
  11816. resolve(_db);
  11817. _context.next = 38;
  11818. break;
  11819. case 35:
  11820. _context.prev = 35;
  11821. _context.t2 = _context["catch"](28);
  11822. reject(_context.t2);
  11823. case 38:
  11824. _context.next = 43;
  11825. break;
  11826. case 40:
  11827. _context.prev = 40;
  11828. _context.t3 = _context["catch"](6);
  11829. reject(_context.t3);
  11830. case 43:
  11831. return _context.abrupt("break", 46);
  11832. case 44:
  11833. if (options.error) {
  11834. _app.default.popup.alert(res.msg || "".concat(url, "\r\n\u672A\u77E5\u9519\u8BEF"), "数据请求");
  11835. } else {
  11836. reject(res);
  11837. }
  11838. return _context.abrupt("break", 46);
  11839. case 46:
  11840. case "end":
  11841. return _context.stop();
  11842. }
  11843. }
  11844. }, _callee, null, [[6, 40], [13, 20], [28, 35]]);
  11845. }));
  11846. return function (_x3) {
  11847. return _ref2.apply(this, arguments);
  11848. };
  11849. }()).catch( /*#__PURE__*/function () {
  11850. var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(err) {
  11851. var refreshResult, db;
  11852. return _regenerator.default.wrap(function _callee2$(_context2) {
  11853. while (1) {
  11854. switch (_context2.prev = _context2.next) {
  11855. case 0:
  11856. console.log("请求失败", err.data.code);
  11857. if (!(err.data.code == "A0230")) {
  11858. _context2.next = 24;
  11859. break;
  11860. }
  11861. _context2.prev = 2;
  11862. // 尝试刷新token
  11863. console.log("进入刷新请求");
  11864. _context2.next = 6;
  11865. return refreshToken();
  11866. case 6:
  11867. refreshResult = _context2.sent;
  11868. if (!refreshResult) {
  11869. _context2.next = 19;
  11870. break;
  11871. }
  11872. // 刷新成功,更新header中的token并重新请求
  11873. options.header.token = getAccessToken();
  11874. _context2.prev = 9;
  11875. _context2.next = 12;
  11876. return Request(options);
  11877. case 12:
  11878. db = _context2.sent;
  11879. resolve(db);
  11880. _context2.next = 19;
  11881. break;
  11882. case 16:
  11883. _context2.prev = 16;
  11884. _context2.t0 = _context2["catch"](9);
  11885. reject(_context2.t0);
  11886. case 19:
  11887. _context2.next = 24;
  11888. break;
  11889. case 21:
  11890. _context2.prev = 21;
  11891. _context2.t1 = _context2["catch"](2);
  11892. reject(_context2.t1);
  11893. case 24:
  11894. /*失败处理,此处为非200状态码引起的错误*/
  11895. options.hideLoading();
  11896. _app.default.popup.alert("\u670D\u52A1\u5668\u54CD\u5E94\u5931\u8D25\r\n".concat(err.msg), "数据请求");
  11897. case 26:
  11898. case "end":
  11899. return _context2.stop();
  11900. }
  11901. }
  11902. }, _callee2, null, [[2, 21], [9, 16]]);
  11903. }));
  11904. return function (_x4) {
  11905. return _ref3.apply(this, arguments);
  11906. };
  11907. }());
  11908. case 3:
  11909. case "end":
  11910. return _context3.stop();
  11911. }
  11912. }
  11913. }, _callee3);
  11914. }));
  11915. return function (_x, _x2) {
  11916. return _ref.apply(this, arguments);
  11917. };
  11918. }());
  11919. };
  11920. // 新增:获取accessToken的方法
  11921. var getAccessToken = function getAccessToken() {
  11922. return uni.getStorageSync(_config.default.keyname.accessToken);
  11923. };
  11924. // 新增:刷新token的方法
  11925. var refreshToken = /*#__PURE__*/function () {
  11926. var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
  11927. var refreshToken, res;
  11928. return _regenerator.default.wrap(function _callee4$(_context4) {
  11929. while (1) {
  11930. switch (_context4.prev = _context4.next) {
  11931. case 0:
  11932. refreshToken = uni.getStorageSync(_config.default.keyname.refreshToken);
  11933. console.log("刷新token", refreshToken);
  11934. if (refreshToken) {
  11935. _context4.next = 4;
  11936. break;
  11937. }
  11938. return _context4.abrupt("return", false);
  11939. case 4:
  11940. _context4.prev = 4;
  11941. _context4.next = 7;
  11942. return Request({
  11943. url: pathJoin(_config.default.url.request, _config.default.api.refreshToken),
  11944. method: "post",
  11945. data: {
  11946. refreshToken: refreshToken
  11947. },
  11948. header: {
  11949. "content-type": "application/json"
  11950. }
  11951. });
  11952. case 7:
  11953. res = _context4.sent;
  11954. if (!(res.code === "00000")) {
  11955. _context4.next = 12;
  11956. break;
  11957. }
  11958. uni.setStorageSync(_config.default.keyname.accessToken, res.data.accessToken);
  11959. uni.setStorageSync(_config.default.keyname.refreshToken, res.data.refreshToken);
  11960. return _context4.abrupt("return", true);
  11961. case 12:
  11962. return _context4.abrupt("return", false);
  11963. case 15:
  11964. _context4.prev = 15;
  11965. _context4.t0 = _context4["catch"](4);
  11966. return _context4.abrupt("return", false);
  11967. case 18:
  11968. case "end":
  11969. return _context4.stop();
  11970. }
  11971. }
  11972. }, _callee4, null, [[4, 15]]);
  11973. }));
  11974. return function refreshToken() {
  11975. return _ref4.apply(this, arguments);
  11976. };
  11977. }();
  11978. /**
  11979. * POST请求
  11980. * @param {String} url 请求地址
  11981. * @param {Object} data 请求数据
  11982. * @param {Object} opts 配置参数
  11983. */
  11984. api.post = function (url, data, opts) {
  11985. return api.base("post", url, data, Object.assign({}, opts));
  11986. };
  11987. /**
  11988. * GET请求
  11989. * @param {String} url 请求地址
  11990. * @param {Object} data 请求数据
  11991. * @param {Object} opts 配置参数
  11992. */
  11993. api.get = function (url, data, opts) {
  11994. return api.base("get", url, data, Object.assign({}, opts));
  11995. };
  11996. /**
  11997. * PUT请求
  11998. * @param {String} url 请求地址
  11999. * @param {Object} data 请求数据
  12000. * @param {Object} opts 配置参数
  12001. */
  12002. api.put = function (url, data, opts) {
  12003. return api.base("put", url, data, Object.assign({}, opts));
  12004. };
  12005. /**
  12006. * 获取静态数据
  12007. * @param {String} url 静态文件地址
  12008. * @param {Object} data 参数数据
  12009. * @param {Object} opts 配置参数
  12010. */
  12011. api.static = function (url, data, opts) {
  12012. return new Promise( /*#__PURE__*/function () {
  12013. var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(resolve, reject) {
  12014. var _opts;
  12015. return _regenerator.default.wrap(function _callee5$(_context5) {
  12016. while (1) {
  12017. switch (_context5.prev = _context5.next) {
  12018. case 0:
  12019. // 设置选项
  12020. _opts = Object.assign({
  12021. url: /^http/.test(url) ? url : API_BASE + (url || ""),
  12022. data: Object.assign({
  12023. cache: Date.now()
  12024. }, data)
  12025. }, opts || {});
  12026. uni.request(_objectSpread(_objectSpread({}, _opts), {}, {
  12027. success: function success(res) {
  12028. resolve(res.data);
  12029. }
  12030. }));
  12031. case 2:
  12032. case "end":
  12033. return _context5.stop();
  12034. }
  12035. }
  12036. }, _callee5);
  12037. }));
  12038. return function (_x5, _x6) {
  12039. return _ref5.apply(this, arguments);
  12040. };
  12041. }());
  12042. };
  12043. /**
  12044. * 文件上传
  12045. * @param {String} file 文件临时路径
  12046. * @param {Object} opts 上传参数
  12047. */
  12048. api.upload = function (file, opts) {
  12049. return new Promise(function (resolve, reject) {
  12050. var options = Object.assign({
  12051. // 请求地址
  12052. url: pathJoin(_config.default.url.upload, (opts === null || opts === void 0 ? void 0 : opts.url) || ""),
  12053. // 请求数据
  12054. filePath: file,
  12055. // 自动显示LOADING
  12056. loading: true,
  12057. // 启用错误自动拦截
  12058. error: true,
  12059. // 请求头设定
  12060. header: {
  12061. token: uni.getStorageSync(_config.default.keyname.userToken)
  12062. },
  12063. // 设置显示LOADING的方法
  12064. showLoading: showLoading,
  12065. // 设置关闭LOADING的方法
  12066. hideLoading: hideLoading
  12067. }, opts || {});
  12068. });
  12069. };
  12070. /**
  12071. * 获取登录code
  12072. */
  12073. api.userCode = function () {
  12074. return new Promise(function (resolve, reject) {
  12075. uni.login({
  12076. provider: "weixin",
  12077. success: function success(res) {
  12078. return resolve(res.code);
  12079. },
  12080. fail: function fail(err) {
  12081. return reject(err);
  12082. }
  12083. });
  12084. });
  12085. };
  12086. /**
  12087. * 自动登录
  12088. * @param {Object} data 登录数据(非必填)
  12089. */
  12090. api.login = function (data) {
  12091. return new Promise( /*#__PURE__*/function () {
  12092. var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(resolve, reject) {
  12093. var code;
  12094. return _regenerator.default.wrap(function _callee7$(_context7) {
  12095. while (1) {
  12096. switch (_context7.prev = _context7.next) {
  12097. case 0:
  12098. _context7.next = 2;
  12099. return api.userCode();
  12100. case 2:
  12101. code = _context7.sent;
  12102. api.post(_config.default.api.login, _objectSpread(_objectSpread({}, data || {}), {}, {
  12103. code: code
  12104. })).then( /*#__PURE__*/function () {
  12105. var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(res) {
  12106. var _res$data, _res$data2, _res$data3;
  12107. return _regenerator.default.wrap(function _callee6$(_context6) {
  12108. while (1) {
  12109. switch (_context6.prev = _context6.next) {
  12110. case 0:
  12111. // 保存 accessToken 和 refreshToken
  12112. uni.setStorageSync(_config.default.keyname.accessToken, res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.accessToken);
  12113. uni.setStorageSync(_config.default.keyname.refreshToken, res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.refreshToken);
  12114. // 保留原有的 userInfo 存储
  12115. uni.setStorageSync(_config.default.keyname.userInfo, res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.userInfo);
  12116. // 返回 accessToken 保持向后兼容
  12117. resolve(res.data.accessToken);
  12118. case 4:
  12119. case "end":
  12120. return _context6.stop();
  12121. }
  12122. }
  12123. }, _callee6);
  12124. }));
  12125. return function (_x9) {
  12126. return _ref7.apply(this, arguments);
  12127. };
  12128. }()).catch(function (err) {
  12129. return reject(err);
  12130. });
  12131. case 4:
  12132. case "end":
  12133. return _context7.stop();
  12134. }
  12135. }
  12136. }, _callee7);
  12137. }));
  12138. return function (_x7, _x8) {
  12139. return _ref6.apply(this, arguments);
  12140. };
  12141. }());
  12142. };
  12143. var _default = api;
  12144. exports.default = _default;
  12145. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  12146. /***/ }),
  12147. /***/ 31:
  12148. /*!************************************************************************************************!*\
  12149. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator/index.js ***!
  12150. \************************************************************************************************/
  12151. /*! no static exports found */
  12152. /***/ (function(module, exports, __webpack_require__) {
  12153. // TODO(Babel 8): Remove this file.
  12154. var runtime = __webpack_require__(/*! @babel/runtime/helpers/regeneratorRuntime */ 32)();
  12155. module.exports = runtime;
  12156. /***/ }),
  12157. /***/ 32:
  12158. /*!*******************************************************************!*\
  12159. !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
  12160. \*******************************************************************/
  12161. /*! no static exports found */
  12162. /***/ (function(module, exports, __webpack_require__) {
  12163. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  12164. function _regeneratorRuntime() {
  12165. "use strict";
  12166. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  12167. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  12168. return e;
  12169. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  12170. var t,
  12171. e = {},
  12172. r = Object.prototype,
  12173. n = r.hasOwnProperty,
  12174. o = Object.defineProperty || function (t, e, r) {
  12175. t[e] = r.value;
  12176. },
  12177. i = "function" == typeof Symbol ? Symbol : {},
  12178. a = i.iterator || "@@iterator",
  12179. c = i.asyncIterator || "@@asyncIterator",
  12180. u = i.toStringTag || "@@toStringTag";
  12181. function define(t, e, r) {
  12182. return Object.defineProperty(t, e, {
  12183. value: r,
  12184. enumerable: !0,
  12185. configurable: !0,
  12186. writable: !0
  12187. }), t[e];
  12188. }
  12189. try {
  12190. define({}, "");
  12191. } catch (t) {
  12192. define = function define(t, e, r) {
  12193. return t[e] = r;
  12194. };
  12195. }
  12196. function wrap(t, e, r, n) {
  12197. var i = e && e.prototype instanceof Generator ? e : Generator,
  12198. a = Object.create(i.prototype),
  12199. c = new Context(n || []);
  12200. return o(a, "_invoke", {
  12201. value: makeInvokeMethod(t, r, c)
  12202. }), a;
  12203. }
  12204. function tryCatch(t, e, r) {
  12205. try {
  12206. return {
  12207. type: "normal",
  12208. arg: t.call(e, r)
  12209. };
  12210. } catch (t) {
  12211. return {
  12212. type: "throw",
  12213. arg: t
  12214. };
  12215. }
  12216. }
  12217. e.wrap = wrap;
  12218. var h = "suspendedStart",
  12219. l = "suspendedYield",
  12220. f = "executing",
  12221. s = "completed",
  12222. y = {};
  12223. function Generator() {}
  12224. function GeneratorFunction() {}
  12225. function GeneratorFunctionPrototype() {}
  12226. var p = {};
  12227. define(p, a, function () {
  12228. return this;
  12229. });
  12230. var d = Object.getPrototypeOf,
  12231. v = d && d(d(values([])));
  12232. v && v !== r && n.call(v, a) && (p = v);
  12233. var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
  12234. function defineIteratorMethods(t) {
  12235. ["next", "throw", "return"].forEach(function (e) {
  12236. define(t, e, function (t) {
  12237. return this._invoke(e, t);
  12238. });
  12239. });
  12240. }
  12241. function AsyncIterator(t, e) {
  12242. function invoke(r, o, i, a) {
  12243. var c = tryCatch(t[r], t, o);
  12244. if ("throw" !== c.type) {
  12245. var u = c.arg,
  12246. h = u.value;
  12247. return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
  12248. invoke("next", t, i, a);
  12249. }, function (t) {
  12250. invoke("throw", t, i, a);
  12251. }) : e.resolve(h).then(function (t) {
  12252. u.value = t, i(u);
  12253. }, function (t) {
  12254. return invoke("throw", t, i, a);
  12255. });
  12256. }
  12257. a(c.arg);
  12258. }
  12259. var r;
  12260. o(this, "_invoke", {
  12261. value: function value(t, n) {
  12262. function callInvokeWithMethodAndArg() {
  12263. return new e(function (e, r) {
  12264. invoke(t, n, e, r);
  12265. });
  12266. }
  12267. return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  12268. }
  12269. });
  12270. }
  12271. function makeInvokeMethod(e, r, n) {
  12272. var o = h;
  12273. return function (i, a) {
  12274. if (o === f) throw Error("Generator is already running");
  12275. if (o === s) {
  12276. if ("throw" === i) throw a;
  12277. return {
  12278. value: t,
  12279. done: !0
  12280. };
  12281. }
  12282. for (n.method = i, n.arg = a;;) {
  12283. var c = n.delegate;
  12284. if (c) {
  12285. var u = maybeInvokeDelegate(c, n);
  12286. if (u) {
  12287. if (u === y) continue;
  12288. return u;
  12289. }
  12290. }
  12291. if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
  12292. if (o === h) throw o = s, n.arg;
  12293. n.dispatchException(n.arg);
  12294. } else "return" === n.method && n.abrupt("return", n.arg);
  12295. o = f;
  12296. var p = tryCatch(e, r, n);
  12297. if ("normal" === p.type) {
  12298. if (o = n.done ? s : l, p.arg === y) continue;
  12299. return {
  12300. value: p.arg,
  12301. done: n.done
  12302. };
  12303. }
  12304. "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
  12305. }
  12306. };
  12307. }
  12308. function maybeInvokeDelegate(e, r) {
  12309. var n = r.method,
  12310. o = e.iterator[n];
  12311. 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;
  12312. var i = tryCatch(o, e.iterator, r.arg);
  12313. if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
  12314. var a = i.arg;
  12315. 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);
  12316. }
  12317. function pushTryEntry(t) {
  12318. var e = {
  12319. tryLoc: t[0]
  12320. };
  12321. 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
  12322. }
  12323. function resetTryEntry(t) {
  12324. var e = t.completion || {};
  12325. e.type = "normal", delete e.arg, t.completion = e;
  12326. }
  12327. function Context(t) {
  12328. this.tryEntries = [{
  12329. tryLoc: "root"
  12330. }], t.forEach(pushTryEntry, this), this.reset(!0);
  12331. }
  12332. function values(e) {
  12333. if (e || "" === e) {
  12334. var r = e[a];
  12335. if (r) return r.call(e);
  12336. if ("function" == typeof e.next) return e;
  12337. if (!isNaN(e.length)) {
  12338. var o = -1,
  12339. i = function next() {
  12340. for (; ++o < e.length;) {
  12341. if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
  12342. }
  12343. return next.value = t, next.done = !0, next;
  12344. };
  12345. return i.next = i;
  12346. }
  12347. }
  12348. throw new TypeError(_typeof(e) + " is not iterable");
  12349. }
  12350. return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
  12351. value: GeneratorFunctionPrototype,
  12352. configurable: !0
  12353. }), o(GeneratorFunctionPrototype, "constructor", {
  12354. value: GeneratorFunction,
  12355. configurable: !0
  12356. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
  12357. var e = "function" == typeof t && t.constructor;
  12358. return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
  12359. }, e.mark = function (t) {
  12360. return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
  12361. }, e.awrap = function (t) {
  12362. return {
  12363. __await: t
  12364. };
  12365. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
  12366. return this;
  12367. }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
  12368. void 0 === i && (i = Promise);
  12369. var a = new AsyncIterator(wrap(t, r, n, o), i);
  12370. return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
  12371. return t.done ? t.value : a.next();
  12372. });
  12373. }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
  12374. return this;
  12375. }), define(g, "toString", function () {
  12376. return "[object Generator]";
  12377. }), e.keys = function (t) {
  12378. var e = Object(t),
  12379. r = [];
  12380. for (var n in e) {
  12381. r.push(n);
  12382. }
  12383. return r.reverse(), function next() {
  12384. for (; r.length;) {
  12385. var t = r.pop();
  12386. if (t in e) return next.value = t, next.done = !1, next;
  12387. }
  12388. return next.done = !0, next;
  12389. };
  12390. }, e.values = values, Context.prototype = {
  12391. constructor: Context,
  12392. reset: function reset(e) {
  12393. 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) {
  12394. "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
  12395. }
  12396. },
  12397. stop: function stop() {
  12398. this.done = !0;
  12399. var t = this.tryEntries[0].completion;
  12400. if ("throw" === t.type) throw t.arg;
  12401. return this.rval;
  12402. },
  12403. dispatchException: function dispatchException(e) {
  12404. if (this.done) throw e;
  12405. var r = this;
  12406. function handle(n, o) {
  12407. return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
  12408. }
  12409. for (var o = this.tryEntries.length - 1; o >= 0; --o) {
  12410. var i = this.tryEntries[o],
  12411. a = i.completion;
  12412. if ("root" === i.tryLoc) return handle("end");
  12413. if (i.tryLoc <= this.prev) {
  12414. var c = n.call(i, "catchLoc"),
  12415. u = n.call(i, "finallyLoc");
  12416. if (c && u) {
  12417. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  12418. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  12419. } else if (c) {
  12420. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  12421. } else {
  12422. if (!u) throw Error("try statement without catch or finally");
  12423. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  12424. }
  12425. }
  12426. }
  12427. },
  12428. abrupt: function abrupt(t, e) {
  12429. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  12430. var o = this.tryEntries[r];
  12431. if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
  12432. var i = o;
  12433. break;
  12434. }
  12435. }
  12436. i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
  12437. var a = i ? i.completion : {};
  12438. return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
  12439. },
  12440. complete: function complete(t, e) {
  12441. if ("throw" === t.type) throw t.arg;
  12442. 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;
  12443. },
  12444. finish: function finish(t) {
  12445. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  12446. var r = this.tryEntries[e];
  12447. if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
  12448. }
  12449. },
  12450. "catch": function _catch(t) {
  12451. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  12452. var r = this.tryEntries[e];
  12453. if (r.tryLoc === t) {
  12454. var n = r.completion;
  12455. if ("throw" === n.type) {
  12456. var o = n.arg;
  12457. resetTryEntry(r);
  12458. }
  12459. return o;
  12460. }
  12461. }
  12462. throw Error("illegal catch attempt");
  12463. },
  12464. delegateYield: function delegateYield(e, r, n) {
  12465. return this.delegate = {
  12466. iterator: values(e),
  12467. resultName: r,
  12468. nextLoc: n
  12469. }, "next" === this.method && (this.arg = t), y;
  12470. }
  12471. }, e;
  12472. }
  12473. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
  12474. /***/ }),
  12475. /***/ 33:
  12476. /*!*****************************************************************!*\
  12477. !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
  12478. \*****************************************************************/
  12479. /*! no static exports found */
  12480. /***/ (function(module, exports) {
  12481. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  12482. try {
  12483. var info = gen[key](arg);
  12484. var value = info.value;
  12485. } catch (error) {
  12486. reject(error);
  12487. return;
  12488. }
  12489. if (info.done) {
  12490. resolve(value);
  12491. } else {
  12492. Promise.resolve(value).then(_next, _throw);
  12493. }
  12494. }
  12495. function _asyncToGenerator(fn) {
  12496. return function () {
  12497. var self = this,
  12498. args = arguments;
  12499. return new Promise(function (resolve, reject) {
  12500. var gen = fn.apply(self, args);
  12501. function _next(value) {
  12502. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  12503. }
  12504. function _throw(err) {
  12505. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  12506. }
  12507. _next(undefined);
  12508. });
  12509. };
  12510. }
  12511. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  12512. /***/ }),
  12513. /***/ 34:
  12514. /*!*******************************************************************************************!*\
  12515. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/static/js/app.js ***!
  12516. \*******************************************************************************************/
  12517. /*! no static exports found */
  12518. /***/ (function(module, exports, __webpack_require__) {
  12519. /* WEBPACK VAR INJECTION */(function(uni, wx) {var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23);
  12520. var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ 24);
  12521. var app = {};
  12522. app.sys = /*#__PURE__*/function () {
  12523. "use strict";
  12524. function appSystem() {
  12525. _classCallCheck(this, appSystem);
  12526. }
  12527. _createClass(appSystem, null, [{
  12528. key: "envVersion",
  12529. value:
  12530. /**
  12531. * 环境版本判定回调
  12532. * @param {Object.Function} callbacks 回调执行方法
  12533. */
  12534. function envVersion(callbacks) {
  12535. var _uni$getAccountInfoSy, _uni$getAccountInfoSy2;
  12536. if (!uni.getAccountInfoSync) return;
  12537. 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;
  12538. var fn = callbacks[current];
  12539. if (fn && typeof fn == 'function') fn();
  12540. }
  12541. }]);
  12542. return appSystem;
  12543. }();
  12544. app.url = /*#__PURE__*/function () {
  12545. "use strict";
  12546. function appUrl() {
  12547. _classCallCheck(this, appUrl);
  12548. }
  12549. _createClass(appUrl, null, [{
  12550. key: "goto",
  12551. value:
  12552. /**
  12553. * 跳转到地址
  12554. * @param {String} url path字符串
  12555. * @param {Boolean} mode 跳转模式; false时关闭当前窗口跳转 | null时关闭所有窗口跳转 | 默认为打开新窗口跳转(最多支持10层,页面栈超过10层后默认为false模式);
  12556. */
  12557. function goto(url, mode) {
  12558. return new Promise(function (resolve, reject) {
  12559. var fail = function fail(err) {
  12560. return uni.switchTab({
  12561. url: url,
  12562. success: success
  12563. });
  12564. };
  12565. var success = function success() {
  12566. return resolve();
  12567. };
  12568. if (mode === false) return uni.redirectTo({
  12569. url: url,
  12570. fail: fail
  12571. });
  12572. if (mode === null) return uni.reLaunch({
  12573. url: url,
  12574. fail: fail
  12575. });
  12576. if (getCurrentPages().length < 10) {
  12577. uni.navigateTo({
  12578. url: url,
  12579. fail: fail,
  12580. success: success
  12581. });
  12582. } else {
  12583. uni.redirectTo({
  12584. url: url,
  12585. fail: fail,
  12586. success: success
  12587. });
  12588. }
  12589. });
  12590. }
  12591. /**
  12592. * 返回页面
  12593. * @param {int} delta 返回级数
  12594. */
  12595. }, {
  12596. key: "back",
  12597. value: function back(delta) {
  12598. return uni.navigateBack({
  12599. delta: delta || 1
  12600. });
  12601. }
  12602. /**
  12603. * 刷新页面,会触发onLoad和onShow等钩子
  12604. */
  12605. }, {
  12606. key: "refresh",
  12607. value: function refresh() {
  12608. var pages = getCurrentPages();
  12609. var current = pages[pages.length - 1];
  12610. var url = current.$page.fullPath;
  12611. app.urlGoto(url, false);
  12612. }
  12613. /**
  12614. * 打开新窗口并传递数据
  12615. * @param {String} url path字符串
  12616. * @param {any} data 传递数据
  12617. */
  12618. }, {
  12619. key: "open",
  12620. value: function open(url, data) {
  12621. var pages = getCurrentPages();
  12622. var current = pages[pages.length - 1].$page.fullPath;
  12623. uni.navigateTo({
  12624. url: url,
  12625. success: function success(res) {
  12626. res.eventChannel.emit("OPEN-DATA[".concat(current, "]"), data);
  12627. }
  12628. });
  12629. }
  12630. /**
  12631. * 获取open方法发送到数据
  12632. * @param {Component} component 组件对象
  12633. */
  12634. }, {
  12635. key: "load",
  12636. value: function load(component) {
  12637. return new Promise(function (resolve, reject) {
  12638. var _pages, _pages$$page;
  12639. if (component == undefined) return console.error("app.url.load(this);");
  12640. var pages = getCurrentPages();
  12641. 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;
  12642. var caller = component === null || component === void 0 ? void 0 : component.getOpenerEventChannel;
  12643. var channel = caller && caller.call(component);
  12644. if (channel && channel.on) channel.on("OPEN-DATA[".concat(current, "]"), function (data) {
  12645. return resolve(data);
  12646. });
  12647. });
  12648. }
  12649. /**
  12650. * 打开其他小程序
  12651. * @param {String} appid 小程序APPID
  12652. * @param {String} path 要打开的程序路径
  12653. * @param {Object} data 要传递给小程序狗子的参数
  12654. */
  12655. }, {
  12656. key: "applet",
  12657. value: function applet(appid, path, data) {
  12658. return new Promise(function (resolve, reject) {
  12659. uni.navigateToMiniProgram({
  12660. appId: appid,
  12661. path: path,
  12662. extraData: data || {},
  12663. success: function success(res) {
  12664. return resolve(res);
  12665. }
  12666. });
  12667. });
  12668. }
  12669. }]);
  12670. return appUrl;
  12671. }();
  12672. app.storage = /*#__PURE__*/function () {
  12673. "use strict";
  12674. function appStorage() {
  12675. _classCallCheck(this, appStorage);
  12676. }
  12677. _createClass(appStorage, null, [{
  12678. key: "set",
  12679. value:
  12680. /**
  12681. * 设置本地缓存数据
  12682. * @param {String} key 数据键名
  12683. * @param {any} data 存储数据,支持对象
  12684. */
  12685. function set(key, data) {
  12686. try {
  12687. uni.setStorageSync(key, data);
  12688. } catch (err) {
  12689. console.error('app.setStorageSync error: ', err);
  12690. }
  12691. }
  12692. /**
  12693. * 获取本地缓存数据
  12694. * @param {String} key 数据键名
  12695. */
  12696. }, {
  12697. key: "get",
  12698. value: function get(key) {
  12699. return uni.getStorageSync(key);
  12700. }
  12701. /**
  12702. * 清除键缓存数据
  12703. * @param {Object} key 数据键名
  12704. */
  12705. }, {
  12706. key: "remove",
  12707. value: function remove(key) {
  12708. uni.removeStorageSync(key);
  12709. }
  12710. /**
  12711. * 清理所有缓存数据
  12712. */
  12713. }, {
  12714. key: "clear",
  12715. value: function clear() {
  12716. uni.clearStorageSync();
  12717. }
  12718. }]);
  12719. return appStorage;
  12720. }();
  12721. app.math = /*#__PURE__*/function () {
  12722. "use strict";
  12723. function appMath() {
  12724. _classCallCheck(this, appMath);
  12725. }
  12726. _createClass(appMath, null, [{
  12727. key: "add",
  12728. value:
  12729. /**
  12730. * 浮点精确相加
  12731. * @param {Number} arg1 参数1
  12732. * @param {Number} arg2 参数2
  12733. */
  12734. function add(arg1, arg2) {
  12735. var r1, r2, m;
  12736. try {
  12737. r1 = arg1.toString().split(".")[1].length;
  12738. } catch (e) {
  12739. r1 = 0;
  12740. }
  12741. try {
  12742. r2 = arg2.toString().split(".")[1].length;
  12743. } catch (e) {
  12744. r2 = 0;
  12745. }
  12746. m = Math.pow(10, Math.max(r1, r2));
  12747. return (arg1 * m + arg2 * m) / m;
  12748. }
  12749. /**
  12750. * 浮点精确相减
  12751. * @param {Number} arg1 参数1
  12752. * @param {Number} arg2 参数2
  12753. */
  12754. }, {
  12755. key: "sub",
  12756. value: function sub(arg1, arg2) {
  12757. var r1, r2, m, n;
  12758. try {
  12759. r1 = arg1.toString().split(".")[1].length;
  12760. } catch (e) {
  12761. r1 = 0;
  12762. }
  12763. try {
  12764. r2 = arg2.toString().split(".")[1].length;
  12765. } catch (e) {
  12766. r2 = 0;
  12767. }
  12768. m = Math.pow(10, Math.max(r1, r2));
  12769. n = (r1 = r2) ? r1 : r2;
  12770. return ((arg1 * m - arg2 * m) / m).toFixed(n);
  12771. }
  12772. /**
  12773. * 浮点精确相乘
  12774. * @param {Number} arg1 参数1
  12775. * @param {Number} arg2 参数2
  12776. */
  12777. }, {
  12778. key: "mul",
  12779. value: function mul(arg1, arg2) {
  12780. var m = 0,
  12781. s1 = arg1.toString(),
  12782. s2 = arg2.toString();
  12783. try {
  12784. m += s1.split(".")[1].length;
  12785. } catch (e) {}
  12786. try {
  12787. m += s2.split(".")[1].length;
  12788. } catch (e) {}
  12789. return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
  12790. }
  12791. /**
  12792. * 浮点精确相除
  12793. * @param {Number} arg1 参数1
  12794. * @param {Number} arg2 参数2
  12795. */
  12796. }, {
  12797. key: "div",
  12798. value: function div(arg1, arg2) {
  12799. var t1 = 0,
  12800. t2 = 0,
  12801. r1,
  12802. r2;
  12803. try {
  12804. t1 = arg1.toString().split(".")[1].length;
  12805. } catch (e) {}
  12806. ;
  12807. try {
  12808. t2 = arg2.toString().split(".")[1].length;
  12809. } catch (e) {}
  12810. ;
  12811. r1 = Number(arg1.toString().replace(".", ""));
  12812. r2 = Number(arg2.toString().replace(".", ""));
  12813. return r1 / r2 * Math.pow(10, t2 - t1);
  12814. }
  12815. }]);
  12816. return appMath;
  12817. }();
  12818. app.date = /*#__PURE__*/function () {
  12819. "use strict";
  12820. function appDate() {
  12821. _classCallCheck(this, appDate);
  12822. }
  12823. _createClass(appDate, null, [{
  12824. key: "format",
  12825. value:
  12826. /**
  12827. * 日期格式化
  12828. * @param {String} fmt 格式规则
  12829. * @param {String | Date} date 需要格式化的日期
  12830. */
  12831. function format(fmt, date) {
  12832. if (!fmt) fmt = 'yyyy-MM-dd hh:mm:sss';
  12833. if (typeof date === 'string') date = new Date(date.replaceAll('-', '/'));
  12834. if (!date) date = new Date();
  12835. var o = {
  12836. "M+": date.getMonth() + 1,
  12837. //月份
  12838. "d+": date.getDate(),
  12839. //日
  12840. "h+": date.getHours(),
  12841. //小时
  12842. "m+": date.getMinutes(),
  12843. //分
  12844. "s+": date.getSeconds(),
  12845. //秒
  12846. "q+": Math.floor((date.getMonth() + 3) / 3),
  12847. //季度
  12848. "S": date.getMilliseconds() //毫秒
  12849. };
  12850. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  12851. for (var k in o) {
  12852. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  12853. }
  12854. return fmt;
  12855. }
  12856. }]);
  12857. return appDate;
  12858. }();
  12859. app.popup = /*#__PURE__*/function () {
  12860. "use strict";
  12861. function appPopup() {
  12862. _classCallCheck(this, appPopup);
  12863. }
  12864. _createClass(appPopup, null, [{
  12865. key: "confirm",
  12866. value:
  12867. /**
  12868. * 对话框
  12869. * @param {String} content 弹窗内容
  12870. * @param {String} title 弹窗标题
  12871. * @param {Object} opts 参数
  12872. */
  12873. function confirm(content, title, opts) {
  12874. return new Promise(function (resolve, reject) {
  12875. if (!title && title == null) title = '温馨提示';
  12876. opts = Object.assign({
  12877. title: title,
  12878. content: content,
  12879. success: function success(res) {
  12880. return resolve(res.confirm == true);
  12881. },
  12882. fail: function fail(err) {
  12883. return reject(err);
  12884. }
  12885. }, opts);
  12886. uni.showModal(opts);
  12887. });
  12888. }
  12889. /**
  12890. * 提示框
  12891. * @param {String} content 弹窗内容
  12892. * @param {String} title 弹窗标题
  12893. */
  12894. }, {
  12895. key: "alert",
  12896. value: function alert(content, title) {
  12897. return appPopup.confirm(content, title || null, {
  12898. showCancel: false
  12899. });
  12900. }
  12901. }, {
  12902. key: "toast",
  12903. value:
  12904. /**
  12905. * 轻提示
  12906. * @param {String} content 提示内容
  12907. * @param {Object} opts 参数
  12908. */
  12909. function toast(content, opts) {
  12910. uni.showToast(Object.assign({
  12911. title: content,
  12912. position: 'bottom',
  12913. duration: 2000,
  12914. icon: 'none'
  12915. }, opts));
  12916. }
  12917. /**
  12918. * 加载条
  12919. * @param {Boolean} visible 显示
  12920. * @param {Object} opts 参数
  12921. */
  12922. }, {
  12923. key: "loading",
  12924. value: function loading(visible, opts) {
  12925. if (visible) {
  12926. uni.showLoading(Object.assign({
  12927. title: '载入中',
  12928. mask: true
  12929. }, opts));
  12930. var timeout = (opts === null || opts === void 0 ? void 0 : opts.timeout) || 45 * 1000;
  12931. setTimeout(function () {
  12932. return appPopup.loading(false);
  12933. }, timeout);
  12934. } else {
  12935. uni.hideLoading();
  12936. }
  12937. }
  12938. /**
  12939. * 操作菜单
  12940. * @param {Array} data 列表数据
  12941. * @param {String} key 指定显示字段
  12942. * @param {Object} opts 参数
  12943. */
  12944. }, {
  12945. key: "sheet",
  12946. value: function sheet(data, key, opts) {
  12947. return new Promise(function (resolve, reject) {
  12948. uni.showActionSheet(Object.assign({
  12949. title: '',
  12950. itemList: data.map(function (item) {
  12951. return key ? item[key] || String(item) : String(item);
  12952. }),
  12953. success: function success(res) {
  12954. return resolve({
  12955. index: res.tapIndex,
  12956. data: data[res.tapIndex]
  12957. });
  12958. }
  12959. }, opts));
  12960. });
  12961. }
  12962. }]);
  12963. return appPopup;
  12964. }();
  12965. app.map = /*#__PURE__*/function () {
  12966. "use strict";
  12967. function appMap() {
  12968. _classCallCheck(this, appMap);
  12969. }
  12970. _createClass(appMap, null, [{
  12971. key: "get",
  12972. value:
  12973. /**
  12974. * 获取当前位置坐标
  12975. * @param {Boolean} high 是否调用高精度接口
  12976. * @param {Object} opts 参数
  12977. */
  12978. function get(high, opts) {
  12979. return new Promise(function (resolve, reject) {
  12980. var OPTS = Object.assign({
  12981. success: function success(res) {
  12982. console.log(res);
  12983. },
  12984. fail: function fail(err) {
  12985. console.log(err);
  12986. }
  12987. }, opts);
  12988. high ? uni.getLocation(OPTS) : uni.getFuzzyLocation(OPTS);
  12989. });
  12990. }
  12991. }]);
  12992. return appMap;
  12993. }();
  12994. app.act = /*#__PURE__*/function () {
  12995. "use strict";
  12996. function appAct() {
  12997. _classCallCheck(this, appAct);
  12998. }
  12999. _createClass(appAct, null, [{
  13000. key: "callPhone",
  13001. value:
  13002. /**
  13003. * 拨打电话
  13004. * @param {String} phone
  13005. */
  13006. function callPhone(phone) {
  13007. uni.makePhoneCall({
  13008. phoneNumber: phone
  13009. });
  13010. }
  13011. /**
  13012. * 调用扫描
  13013. * @param {Object} opts 参数配置,详细查看 https://uniapp.dcloud.net.cn/api/system/barcode.html
  13014. */
  13015. }, {
  13016. key: "scan",
  13017. value: function scan(opts) {
  13018. return new Promise(function (resolve, reject) {
  13019. uni.scanCode(Object.assign({}, {
  13020. success: function success(res) {
  13021. return resolve(res);
  13022. }
  13023. // fail: err=>reject(err),
  13024. }, opts));
  13025. });
  13026. }
  13027. /**
  13028. * 获取节点信息
  13029. * @param {Component} component 组件
  13030. * @param {String} selector 类似于 CSS 的选择器
  13031. * @param {Boolean} multi 是否多节点
  13032. */
  13033. }, {
  13034. key: "selectorQuery",
  13035. value: function selectorQuery(component, selector, multi) {
  13036. return new Promise(function (resolve, reject) {
  13037. var query = uni.createSelectorQuery().in(component)[multi ? 'selectAll' : 'select'](selector);
  13038. query.boundingClientRect(function (data) {
  13039. if (data) resolve(data);
  13040. }).exec();
  13041. });
  13042. }
  13043. /**
  13044. * 复制文本到剪贴板
  13045. * @param {String} str 需要复制的文本
  13046. */
  13047. }, {
  13048. key: "copy",
  13049. value: function copy(str) {
  13050. return new Promise(function (resolve, reject) {
  13051. uni.setClipboardData({
  13052. data: 'hello',
  13053. success: resolve(),
  13054. fail: function fail(err) {
  13055. return reject(err);
  13056. }
  13057. });
  13058. });
  13059. }
  13060. /**
  13061. * 客服服务
  13062. * @param {Object} id
  13063. * @param {Object} url
  13064. */
  13065. }, {
  13066. key: "customerService",
  13067. value: function customerService(id, url) {
  13068. return new Promise(function (resolve, reject) {
  13069. wx.openCustomerServiceChat({
  13070. extInfo: {
  13071. url: url
  13072. },
  13073. corpId: id,
  13074. success: function success(res) {
  13075. return resolve(res);
  13076. },
  13077. fail: function fail(err) {
  13078. return reject(err);
  13079. }
  13080. });
  13081. });
  13082. }
  13083. }]);
  13084. return appAct;
  13085. }();
  13086. module.exports = app;
  13087. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  13088. /***/ }),
  13089. /***/ 35:
  13090. /*!**********************************************************************************************!*\
  13091. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/static/js/config.js ***!
  13092. \**********************************************************************************************/
  13093. /*! no static exports found */
  13094. /***/ (function(module, exports, __webpack_require__) {
  13095. "use strict";
  13096. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  13097. Object.defineProperty(exports, "__esModule", {
  13098. value: true
  13099. });
  13100. exports.default = void 0;
  13101. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  13102. var _app = _interopRequireDefault(__webpack_require__(/*! ./app */ 34));
  13103. var _pages = _interopRequireDefault(__webpack_require__(/*! @/pages.json */ 36));
  13104. 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; }
  13105. 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; }
  13106. var config = {};
  13107. // 地址类
  13108. config.url = {
  13109. // API请求基础URL
  13110. // request : 'https://charge.hub.zswlgz.com/',
  13111. // request : '/api',
  13112. // request : 'http://192.168.110.3:80/',
  13113. // request : 'http://192.168.1.253:80/',
  13114. // request : 'http://120.78.228.211:8866/',
  13115. request: "http://192.168.0.11:8989/",
  13116. // request: "http://192.168.0.217:8989/",
  13117. // request : 'https://charge.dev.hub.zswlgz.com/',
  13118. // 上传地址
  13119. upload: "http://127.0.0.1:3000/upload/",
  13120. // 下载地址
  13121. download: "http://oss.aabb.com/download/",
  13122. // 静态文件服务
  13123. static: "http://oss.aabb.com/",
  13124. //配置文件地址
  13125. configUrl: "http://bx.eomp.cn/adp/"
  13126. };
  13127. // 接口类
  13128. config.api = {
  13129. login: "/userApi/login",
  13130. refreshToken: "/api/v1/auth/refresh-token"
  13131. };
  13132. // 键名类
  13133. config.keyname = {
  13134. userInfo: "USER_INFO",
  13135. userToken: "USER_TOKEN",
  13136. logs: "LOGS_DATA",
  13137. accessToken: "ACCESS_TOKEN",
  13138. refreshToken: "REFRESH_TOKEN"
  13139. };
  13140. // 事件名
  13141. config.eventName = {
  13142. setResult: "SET-HOME-RESULT"
  13143. };
  13144. // 客服
  13145. config.customerService = {
  13146. id: "wwfb3777bf94dcfaf1",
  13147. url: "https://work.weixin.qq.com/kfid/kfc4feac060f5c1bc7e"
  13148. };
  13149. // pages.json 页面配置文件
  13150. config.pages = _pages.default.pages.map(function (i) {
  13151. i.style = _objectSpread(_objectSpread({}, _pages.default.globalStyle), i.style);
  13152. return i;
  13153. });
  13154. // 不同版本执行器
  13155. _app.default.sys.envVersion({
  13156. // 正式版
  13157. release: function release() {},
  13158. // 体验版
  13159. trial: function trial() {},
  13160. // 开发版
  13161. develop: function develop() {}
  13162. });
  13163. var _default = config;
  13164. exports.default = _default;
  13165. /***/ }),
  13166. /***/ 36:
  13167. /*!******************************************************************************************************************!*\
  13168. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/pages.json?{"type":"origin-pages-json"} ***!
  13169. \******************************************************************************************************************/
  13170. /*! no static exports found */
  13171. /***/ (function(module, exports, __webpack_require__) {
  13172. "use strict";
  13173. Object.defineProperty(exports, "__esModule", {
  13174. value: true
  13175. });
  13176. exports.default = void 0;
  13177. var _default = {
  13178. "pages": [{
  13179. "path": "pages/index/index",
  13180. "style": {
  13181. "navigationBarTitleText": "首页"
  13182. }
  13183. }, {
  13184. "path": "pages/map/map",
  13185. "style": {
  13186. "navigationBarTitleText": "地图模式"
  13187. }
  13188. }, {
  13189. "path": "pages/my/my",
  13190. "style": {
  13191. "navigationBarTitleText": "个人中心"
  13192. }
  13193. }, {
  13194. "path": "pages/site/site",
  13195. "style": {
  13196. "navigationBarTitleText": "站点详情"
  13197. }
  13198. }, {
  13199. "path": "pages/site-more/site-more",
  13200. "style": {
  13201. "navigationBarTitleText": "电站价格"
  13202. }
  13203. }, {
  13204. "path": "pages/charging/charging",
  13205. "style": {
  13206. "navigationBarTitleText": "正在充电"
  13207. }
  13208. }, {
  13209. "path": "pages/order-detail/order-detail",
  13210. "style": {
  13211. "navigationBarTitleText": "订单详情"
  13212. }
  13213. }, {
  13214. "path": "pages/terminal/terminal",
  13215. "style": {
  13216. "navigationBarTitleText": "充电终端"
  13217. }
  13218. }, {
  13219. "path": "pages/coupon-buy/coupon-buy",
  13220. "style": {
  13221. "navigationBarTitleText": "购券中心"
  13222. }
  13223. }, {
  13224. "path": "pages/login/login",
  13225. "style": {
  13226. "navigationBarTitleText": "用户登录"
  13227. }
  13228. }, {
  13229. "path": "pages/recharge-log/recharge-log",
  13230. "style": {
  13231. "navigationBarTitleText": "购券记录"
  13232. }
  13233. }, {
  13234. "path": "pages/feedback/feedback",
  13235. "style": {
  13236. "navigationBarTitleText": ""
  13237. }
  13238. }, {
  13239. "path": "pages/order/order",
  13240. "style": {
  13241. "navigationBarTitleText": "充电订单"
  13242. }
  13243. }, {
  13244. "path": "pages/search/search",
  13245. "style": {
  13246. "navigationBarTitleText": "站点搜索"
  13247. }
  13248. }, {
  13249. "path": "pages/coupons/coupons",
  13250. "style": {
  13251. "navigationBarTitleText": "优惠券"
  13252. }
  13253. }, {
  13254. "path": "pages/web/web",
  13255. "style": {
  13256. "navigationBarTitleText": "",
  13257. "navigationStyle": "default",
  13258. "navigationBarBackgroundColor": "#fff",
  13259. "backgroundColor": "#fff"
  13260. }
  13261. }, {
  13262. "path": "pages/feedback-reply/feedback-reply",
  13263. "style": {
  13264. "navigationBarTitleText": "反馈答复"
  13265. }
  13266. }, {
  13267. "path": "pages/banner-page/banner-page",
  13268. "style": {
  13269. "navigationBarTitleText": "活动详情"
  13270. }
  13271. }, {
  13272. "path": "pages/new-site/new-site",
  13273. "style": {
  13274. "navigationBarTitleText": "站点详情"
  13275. }
  13276. }],
  13277. "globalStyle": {
  13278. "navigationBarTextStyle": "black",
  13279. "navigationBarTitleText": "中数电动",
  13280. "navigationBarBackgroundColor": "#C7FFFD",
  13281. "backgroundColor": "#C7FFFD",
  13282. "navigationStyle": "custom"
  13283. },
  13284. "uniIdRouter": {}
  13285. };
  13286. exports.default = _default;
  13287. /***/ }),
  13288. /***/ 39:
  13289. /*!**********************************************************************************************************!*\
  13290. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  13291. \**********************************************************************************************************/
  13292. /*! exports provided: default */
  13293. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  13294. "use strict";
  13295. __webpack_require__.r(__webpack_exports__);
  13296. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  13297. /* globals __VUE_SSR_CONTEXT__ */
  13298. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  13299. // This module is a runtime utility for cleaner component module output and will
  13300. // be included in the final webpack user bundle.
  13301. function normalizeComponent (
  13302. scriptExports,
  13303. render,
  13304. staticRenderFns,
  13305. functionalTemplate,
  13306. injectStyles,
  13307. scopeId,
  13308. moduleIdentifier, /* server only */
  13309. shadowMode, /* vue-cli only */
  13310. components, // fixed by xxxxxx auto components
  13311. renderjs // fixed by xxxxxx renderjs
  13312. ) {
  13313. // Vue.extend constructor export interop
  13314. var options = typeof scriptExports === 'function'
  13315. ? scriptExports.options
  13316. : scriptExports
  13317. // fixed by xxxxxx auto components
  13318. if (components) {
  13319. if (!options.components) {
  13320. options.components = {}
  13321. }
  13322. var hasOwn = Object.prototype.hasOwnProperty
  13323. for (var name in components) {
  13324. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  13325. options.components[name] = components[name]
  13326. }
  13327. }
  13328. }
  13329. // fixed by xxxxxx renderjs
  13330. if (renderjs) {
  13331. if(typeof renderjs.beforeCreate === 'function'){
  13332. renderjs.beforeCreate = [renderjs.beforeCreate]
  13333. }
  13334. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  13335. this[renderjs.__module] = this
  13336. });
  13337. (options.mixins || (options.mixins = [])).push(renderjs)
  13338. }
  13339. // render functions
  13340. if (render) {
  13341. options.render = render
  13342. options.staticRenderFns = staticRenderFns
  13343. options._compiled = true
  13344. }
  13345. // functional template
  13346. if (functionalTemplate) {
  13347. options.functional = true
  13348. }
  13349. // scopedId
  13350. if (scopeId) {
  13351. options._scopeId = 'data-v-' + scopeId
  13352. }
  13353. var hook
  13354. if (moduleIdentifier) { // server build
  13355. hook = function (context) {
  13356. // 2.3 injection
  13357. context =
  13358. context || // cached call
  13359. (this.$vnode && this.$vnode.ssrContext) || // stateful
  13360. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  13361. // 2.2 with runInNewContext: true
  13362. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  13363. context = __VUE_SSR_CONTEXT__
  13364. }
  13365. // inject component styles
  13366. if (injectStyles) {
  13367. injectStyles.call(this, context)
  13368. }
  13369. // register component module identifier for async chunk inferrence
  13370. if (context && context._registeredComponents) {
  13371. context._registeredComponents.add(moduleIdentifier)
  13372. }
  13373. }
  13374. // used by ssr in case component is cached and beforeCreate
  13375. // never gets called
  13376. options._ssrRegister = hook
  13377. } else if (injectStyles) {
  13378. hook = shadowMode
  13379. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  13380. : injectStyles
  13381. }
  13382. if (hook) {
  13383. if (options.functional) {
  13384. // for template-only hot-reload because in that case the render fn doesn't
  13385. // go through the normalizer
  13386. options._injectStyles = hook
  13387. // register for functioal component in vue file
  13388. var originalRender = options.render
  13389. options.render = function renderWithStyleInjection (h, context) {
  13390. hook.call(context)
  13391. return originalRender(h, context)
  13392. }
  13393. } else {
  13394. // inject component registration as beforeCreate hook
  13395. var existing = options.beforeCreate
  13396. options.beforeCreate = existing
  13397. ? [].concat(existing, hook)
  13398. : [hook]
  13399. }
  13400. }
  13401. return {
  13402. exports: scriptExports,
  13403. options: options
  13404. }
  13405. }
  13406. /***/ }),
  13407. /***/ 4:
  13408. /*!**********************************************************************!*\
  13409. !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
  13410. \**********************************************************************/
  13411. /*! no static exports found */
  13412. /***/ (function(module, exports) {
  13413. function _interopRequireDefault(obj) {
  13414. return obj && obj.__esModule ? obj : {
  13415. "default": obj
  13416. };
  13417. }
  13418. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  13419. /***/ }),
  13420. /***/ 40:
  13421. /*!***************************************************************************************************!*\
  13422. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni.promisify.adaptor.js ***!
  13423. \***************************************************************************************************/
  13424. /*! no static exports found */
  13425. /***/ (function(module, exports, __webpack_require__) {
  13426. /* WEBPACK VAR INJECTION */(function(uni) {var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  13427. uni.addInterceptor({
  13428. returnValue: function returnValue(res) {
  13429. if (!(!!res && (_typeof(res) === "object" || typeof res === "function") && typeof res.then === "function")) {
  13430. return res;
  13431. }
  13432. return new Promise(function (resolve, reject) {
  13433. res.then(function (res) {
  13434. return res[0] ? reject(res[0]) : resolve(res[1]);
  13435. });
  13436. });
  13437. }
  13438. });
  13439. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  13440. /***/ }),
  13441. /***/ 41:
  13442. /*!*********************************************************************************************!*\
  13443. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/static/js/index.js ***!
  13444. \*********************************************************************************************/
  13445. /*! no static exports found */
  13446. /***/ (function(module, exports, __webpack_require__) {
  13447. "use strict";
  13448. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  13449. Object.defineProperty(exports, "__esModule", {
  13450. value: true
  13451. });
  13452. Object.defineProperty(exports, "$Api", {
  13453. enumerable: true,
  13454. get: function get() {
  13455. return _api.default;
  13456. }
  13457. });
  13458. Object.defineProperty(exports, "$App", {
  13459. enumerable: true,
  13460. get: function get() {
  13461. return _app.default;
  13462. }
  13463. });
  13464. Object.defineProperty(exports, "$Config", {
  13465. enumerable: true,
  13466. get: function get() {
  13467. return _config.default;
  13468. }
  13469. });
  13470. Object.defineProperty(exports, "$Qrcode", {
  13471. enumerable: true,
  13472. get: function get() {
  13473. return _wxqrcode.default;
  13474. }
  13475. });
  13476. var _app = _interopRequireDefault(__webpack_require__(/*! ./app.js */ 34));
  13477. var _api = _interopRequireDefault(__webpack_require__(/*! ./api.js */ 30));
  13478. var _config = _interopRequireDefault(__webpack_require__(/*! ./config.js */ 35));
  13479. var _wxqrcode = _interopRequireDefault(__webpack_require__(/*! ./wxqrcode.js */ 42));
  13480. /***/ }),
  13481. /***/ 42:
  13482. /*!************************************************************************************************!*\
  13483. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/static/js/wxqrcode.js ***!
  13484. \************************************************************************************************/
  13485. /*! no static exports found */
  13486. /***/ (function(module, exports) {
  13487. //---------------------------------------------------------------------
  13488. //
  13489. // QR Code Generator for JavaScript
  13490. //
  13491. // Copyright (c) 2009 Kazuhiko Arase
  13492. //
  13493. // URL: http://www.d-project.com/
  13494. //
  13495. // Licensed under the MIT license:
  13496. // http://www.opensource.org/licenses/mit-license.php
  13497. //
  13498. // The word 'QR Code' is registered trademark of
  13499. // DENSO WAVE INCORPORATED
  13500. // http://www.denso-wave.com/qrcode/faqpatent-e.html
  13501. //
  13502. //---------------------------------------------------------------------
  13503. //---------------------------------------------------------------------
  13504. // qrcode
  13505. //代码第1588行为补充代码
  13506. //修改人:chenxing
  13507. //2017-02-27 16:21:32
  13508. //---------------------------------------------------------------------
  13509. /**
  13510. * qrcode
  13511. * @param typeNumber 1 to 40
  13512. * @param errorCorrectLevel 'L','M','Q','H'
  13513. */
  13514. var qrcode = function qrcode(typeNumber, errorCorrectLevel) {
  13515. var PAD0 = 0xEC;
  13516. var PAD1 = 0x11;
  13517. var _typeNumber = typeNumber;
  13518. var _errorCorrectLevel = QRErrorCorrectLevel[errorCorrectLevel];
  13519. var _modules = null;
  13520. var _moduleCount = 0;
  13521. var _dataCache = null;
  13522. var _dataList = new Array();
  13523. var _this = {};
  13524. var makeImpl = function makeImpl(test, maskPattern) {
  13525. _moduleCount = _typeNumber * 4 + 17;
  13526. _modules = function (moduleCount) {
  13527. var modules = new Array(moduleCount);
  13528. for (var row = 0; row < moduleCount; row += 1) {
  13529. modules[row] = new Array(moduleCount);
  13530. for (var col = 0; col < moduleCount; col += 1) {
  13531. modules[row][col] = null;
  13532. }
  13533. }
  13534. return modules;
  13535. }(_moduleCount);
  13536. setupPositionProbePattern(0, 0);
  13537. setupPositionProbePattern(_moduleCount - 7, 0);
  13538. setupPositionProbePattern(0, _moduleCount - 7);
  13539. setupPositionAdjustPattern();
  13540. setupTimingPattern();
  13541. setupTypeInfo(test, maskPattern);
  13542. if (_typeNumber >= 7) {
  13543. setupTypeNumber(test);
  13544. }
  13545. if (_dataCache == null) {
  13546. _dataCache = createData(_typeNumber, _errorCorrectLevel, _dataList);
  13547. }
  13548. mapData(_dataCache, maskPattern);
  13549. };
  13550. var setupPositionProbePattern = function setupPositionProbePattern(row, col) {
  13551. for (var r = -1; r <= 7; r += 1) {
  13552. if (row + r <= -1 || _moduleCount <= row + r) continue;
  13553. for (var c = -1; c <= 7; c += 1) {
  13554. if (col + c <= -1 || _moduleCount <= col + c) continue;
  13555. 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) {
  13556. _modules[row + r][col + c] = true;
  13557. } else {
  13558. _modules[row + r][col + c] = false;
  13559. }
  13560. }
  13561. }
  13562. };
  13563. var getBestMaskPattern = function getBestMaskPattern() {
  13564. var minLostPoint = 0;
  13565. var pattern = 0;
  13566. for (var i = 0; i < 8; i += 1) {
  13567. makeImpl(true, i);
  13568. var lostPoint = QRUtil.getLostPoint(_this);
  13569. if (i == 0 || minLostPoint > lostPoint) {
  13570. minLostPoint = lostPoint;
  13571. pattern = i;
  13572. }
  13573. }
  13574. return pattern;
  13575. };
  13576. var setupTimingPattern = function setupTimingPattern() {
  13577. for (var r = 8; r < _moduleCount - 8; r += 1) {
  13578. if (_modules[r][6] != null) {
  13579. continue;
  13580. }
  13581. _modules[r][6] = r % 2 == 0;
  13582. }
  13583. for (var c = 8; c < _moduleCount - 8; c += 1) {
  13584. if (_modules[6][c] != null) {
  13585. continue;
  13586. }
  13587. _modules[6][c] = c % 2 == 0;
  13588. }
  13589. };
  13590. var setupPositionAdjustPattern = function setupPositionAdjustPattern() {
  13591. var pos = QRUtil.getPatternPosition(_typeNumber);
  13592. for (var i = 0; i < pos.length; i += 1) {
  13593. for (var j = 0; j < pos.length; j += 1) {
  13594. var row = pos[i];
  13595. var col = pos[j];
  13596. if (_modules[row][col] != null) {
  13597. continue;
  13598. }
  13599. for (var r = -2; r <= 2; r += 1) {
  13600. for (var c = -2; c <= 2; c += 1) {
  13601. if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
  13602. _modules[row + r][col + c] = true;
  13603. } else {
  13604. _modules[row + r][col + c] = false;
  13605. }
  13606. }
  13607. }
  13608. }
  13609. }
  13610. };
  13611. var setupTypeNumber = function setupTypeNumber(test) {
  13612. var bits = QRUtil.getBCHTypeNumber(_typeNumber);
  13613. for (var i = 0; i < 18; i += 1) {
  13614. var mod = !test && (bits >> i & 1) == 1;
  13615. _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
  13616. }
  13617. for (var i = 0; i < 18; i += 1) {
  13618. var mod = !test && (bits >> i & 1) == 1;
  13619. _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
  13620. }
  13621. };
  13622. var setupTypeInfo = function setupTypeInfo(test, maskPattern) {
  13623. var data = _errorCorrectLevel << 3 | maskPattern;
  13624. var bits = QRUtil.getBCHTypeInfo(data);
  13625. // vertical
  13626. for (var i = 0; i < 15; i += 1) {
  13627. var mod = !test && (bits >> i & 1) == 1;
  13628. if (i < 6) {
  13629. _modules[i][8] = mod;
  13630. } else if (i < 8) {
  13631. _modules[i + 1][8] = mod;
  13632. } else {
  13633. _modules[_moduleCount - 15 + i][8] = mod;
  13634. }
  13635. }
  13636. // horizontal
  13637. for (var i = 0; i < 15; i += 1) {
  13638. var mod = !test && (bits >> i & 1) == 1;
  13639. if (i < 8) {
  13640. _modules[8][_moduleCount - i - 1] = mod;
  13641. } else if (i < 9) {
  13642. _modules[8][15 - i - 1 + 1] = mod;
  13643. } else {
  13644. _modules[8][15 - i - 1] = mod;
  13645. }
  13646. }
  13647. // fixed module
  13648. _modules[_moduleCount - 8][8] = !test;
  13649. };
  13650. var mapData = function mapData(data, maskPattern) {
  13651. var inc = -1;
  13652. var row = _moduleCount - 1;
  13653. var bitIndex = 7;
  13654. var byteIndex = 0;
  13655. var maskFunc = QRUtil.getMaskFunction(maskPattern);
  13656. for (var col = _moduleCount - 1; col > 0; col -= 2) {
  13657. if (col == 6) col -= 1;
  13658. while (true) {
  13659. for (var c = 0; c < 2; c += 1) {
  13660. if (_modules[row][col - c] == null) {
  13661. var dark = false;
  13662. if (byteIndex < data.length) {
  13663. dark = (data[byteIndex] >>> bitIndex & 1) == 1;
  13664. }
  13665. var mask = maskFunc(row, col - c);
  13666. if (mask) {
  13667. dark = !dark;
  13668. }
  13669. _modules[row][col - c] = dark;
  13670. bitIndex -= 1;
  13671. if (bitIndex == -1) {
  13672. byteIndex += 1;
  13673. bitIndex = 7;
  13674. }
  13675. }
  13676. }
  13677. row += inc;
  13678. if (row < 0 || _moduleCount <= row) {
  13679. row -= inc;
  13680. inc = -inc;
  13681. break;
  13682. }
  13683. }
  13684. }
  13685. };
  13686. var createBytes = function createBytes(buffer, rsBlocks) {
  13687. var offset = 0;
  13688. var maxDcCount = 0;
  13689. var maxEcCount = 0;
  13690. var dcdata = new Array(rsBlocks.length);
  13691. var ecdata = new Array(rsBlocks.length);
  13692. for (var r = 0; r < rsBlocks.length; r += 1) {
  13693. var dcCount = rsBlocks[r].dataCount;
  13694. var ecCount = rsBlocks[r].totalCount - dcCount;
  13695. maxDcCount = Math.max(maxDcCount, dcCount);
  13696. maxEcCount = Math.max(maxEcCount, ecCount);
  13697. dcdata[r] = new Array(dcCount);
  13698. for (var i = 0; i < dcdata[r].length; i += 1) {
  13699. dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
  13700. }
  13701. offset += dcCount;
  13702. var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
  13703. var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
  13704. var modPoly = rawPoly.mod(rsPoly);
  13705. ecdata[r] = new Array(rsPoly.getLength() - 1);
  13706. for (var i = 0; i < ecdata[r].length; i += 1) {
  13707. var modIndex = i + modPoly.getLength() - ecdata[r].length;
  13708. ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
  13709. }
  13710. }
  13711. var totalCodeCount = 0;
  13712. for (var i = 0; i < rsBlocks.length; i += 1) {
  13713. totalCodeCount += rsBlocks[i].totalCount;
  13714. }
  13715. var data = new Array(totalCodeCount);
  13716. var index = 0;
  13717. for (var i = 0; i < maxDcCount; i += 1) {
  13718. for (var r = 0; r < rsBlocks.length; r += 1) {
  13719. if (i < dcdata[r].length) {
  13720. data[index] = dcdata[r][i];
  13721. index += 1;
  13722. }
  13723. }
  13724. }
  13725. for (var i = 0; i < maxEcCount; i += 1) {
  13726. for (var r = 0; r < rsBlocks.length; r += 1) {
  13727. if (i < ecdata[r].length) {
  13728. data[index] = ecdata[r][i];
  13729. index += 1;
  13730. }
  13731. }
  13732. }
  13733. return data;
  13734. };
  13735. var createData = function createData(typeNumber, errorCorrectLevel, dataList) {
  13736. var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
  13737. var buffer = qrBitBuffer();
  13738. for (var i = 0; i < dataList.length; i += 1) {
  13739. var data = dataList[i];
  13740. buffer.put(data.getMode(), 4);
  13741. buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber));
  13742. data.write(buffer);
  13743. }
  13744. // calc num max data.
  13745. var totalDataCount = 0;
  13746. for (var i = 0; i < rsBlocks.length; i += 1) {
  13747. totalDataCount += rsBlocks[i].dataCount;
  13748. }
  13749. if (buffer.getLengthInBits() > totalDataCount * 8) {
  13750. throw new Error('code length overflow. (' + buffer.getLengthInBits() + '>' + totalDataCount * 8 + ')');
  13751. }
  13752. // end code
  13753. if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
  13754. buffer.put(0, 4);
  13755. }
  13756. // padding
  13757. while (buffer.getLengthInBits() % 8 != 0) {
  13758. buffer.putBit(false);
  13759. }
  13760. // padding
  13761. while (true) {
  13762. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  13763. break;
  13764. }
  13765. buffer.put(PAD0, 8);
  13766. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  13767. break;
  13768. }
  13769. buffer.put(PAD1, 8);
  13770. }
  13771. return createBytes(buffer, rsBlocks);
  13772. };
  13773. _this.addData = function (data) {
  13774. var newData = qr8BitByte(data);
  13775. _dataList.push(newData);
  13776. _dataCache = null;
  13777. };
  13778. _this.isDark = function (row, col) {
  13779. if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
  13780. throw new Error(row + ',' + col);
  13781. }
  13782. return _modules[row][col];
  13783. };
  13784. _this.getModuleCount = function () {
  13785. return _moduleCount;
  13786. };
  13787. _this.make = function () {
  13788. makeImpl(false, getBestMaskPattern());
  13789. };
  13790. _this.createTableTag = function (cellSize, margin) {
  13791. cellSize = cellSize || 2;
  13792. margin = typeof margin == 'undefined' ? cellSize * 4 : margin;
  13793. var qrHtml = '';
  13794. qrHtml += '<table style="';
  13795. qrHtml += ' border-width: 0px; border-style: none;';
  13796. qrHtml += ' border-collapse: collapse;';
  13797. qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
  13798. qrHtml += '">';
  13799. qrHtml += '<tbody>';
  13800. for (var r = 0; r < _this.getModuleCount(); r += 1) {
  13801. qrHtml += '<tr>';
  13802. for (var c = 0; c < _this.getModuleCount(); c += 1) {
  13803. qrHtml += '<td style="';
  13804. qrHtml += ' border-width: 0px; border-style: none;';
  13805. qrHtml += ' border-collapse: collapse;';
  13806. qrHtml += ' padding: 0px; margin: 0px;';
  13807. qrHtml += ' width: ' + cellSize + 'px;';
  13808. qrHtml += ' height: ' + cellSize + 'px;';
  13809. qrHtml += ' background-color: ';
  13810. qrHtml += _this.isDark(r, c) ? '#000000' : '#ffffff';
  13811. qrHtml += ';';
  13812. qrHtml += '"/>';
  13813. }
  13814. qrHtml += '</tr>';
  13815. }
  13816. qrHtml += '</tbody>';
  13817. qrHtml += '</table>';
  13818. return qrHtml;
  13819. };
  13820. _this.createImgTag = function (cellSize, margin, size) {
  13821. cellSize = cellSize || 2;
  13822. margin = typeof margin == 'undefined' ? cellSize * 4 : margin;
  13823. var min = margin;
  13824. var max = _this.getModuleCount() * cellSize + margin;
  13825. return createImgTag(size, size, function (x, y) {
  13826. if (min <= x && x < max && min <= y && y < max) {
  13827. var c = Math.floor((x - min) / cellSize);
  13828. var r = Math.floor((y - min) / cellSize);
  13829. return _this.isDark(r, c) ? 0 : 1;
  13830. } else {
  13831. return 1;
  13832. }
  13833. });
  13834. };
  13835. return _this;
  13836. };
  13837. //---------------------------------------------------------------------
  13838. // qrcode.stringToBytes
  13839. //---------------------------------------------------------------------
  13840. qrcode.stringToBytes = function (s) {
  13841. var bytes = new Array();
  13842. for (var i = 0; i < s.length; i += 1) {
  13843. var c = s.charCodeAt(i);
  13844. bytes.push(c & 0xff);
  13845. }
  13846. return bytes;
  13847. };
  13848. //---------------------------------------------------------------------
  13849. // qrcode.createStringToBytes
  13850. //---------------------------------------------------------------------
  13851. /**
  13852. * @param unicodeData base64 string of byte array.
  13853. * [16bit Unicode],[16bit Bytes], ...
  13854. * @param numChars
  13855. */
  13856. qrcode.createStringToBytes = function (unicodeData, numChars) {
  13857. // create conversion map.
  13858. var unicodeMap = function () {
  13859. var bin = base64DecodeInputStream(unicodeData);
  13860. var read = function read() {
  13861. var b = bin.read();
  13862. if (b == -1) throw new Error();
  13863. return b;
  13864. };
  13865. var count = 0;
  13866. var unicodeMap = {};
  13867. while (true) {
  13868. var b0 = bin.read();
  13869. if (b0 == -1) break;
  13870. var b1 = read();
  13871. var b2 = read();
  13872. var b3 = read();
  13873. var k = String.fromCharCode(b0 << 8 | b1);
  13874. var v = b2 << 8 | b3;
  13875. unicodeMap[k] = v;
  13876. count += 1;
  13877. }
  13878. if (count != numChars) {
  13879. throw new Error(count + ' != ' + numChars);
  13880. }
  13881. return unicodeMap;
  13882. }();
  13883. var unknownChar = '?'.charCodeAt(0);
  13884. return function (s) {
  13885. var bytes = new Array();
  13886. for (var i = 0; i < s.length; i += 1) {
  13887. var c = s.charCodeAt(i);
  13888. if (c < 128) {
  13889. bytes.push(c);
  13890. } else {
  13891. var b = unicodeMap[s.charAt(i)];
  13892. if (typeof b == 'number') {
  13893. if ((b & 0xff) == b) {
  13894. // 1byte
  13895. bytes.push(b);
  13896. } else {
  13897. // 2bytes
  13898. bytes.push(b >>> 8);
  13899. bytes.push(b & 0xff);
  13900. }
  13901. } else {
  13902. bytes.push(unknownChar);
  13903. }
  13904. }
  13905. }
  13906. return bytes;
  13907. };
  13908. };
  13909. //---------------------------------------------------------------------
  13910. // QRMode
  13911. //---------------------------------------------------------------------
  13912. var QRMode = {
  13913. MODE_NUMBER: 1 << 0,
  13914. MODE_ALPHA_NUM: 1 << 1,
  13915. MODE_8BIT_BYTE: 1 << 2,
  13916. MODE_KANJI: 1 << 3
  13917. };
  13918. //---------------------------------------------------------------------
  13919. // QRErrorCorrectLevel
  13920. //---------------------------------------------------------------------
  13921. var QRErrorCorrectLevel = {
  13922. L: 1,
  13923. M: 0,
  13924. Q: 3,
  13925. H: 2
  13926. };
  13927. //---------------------------------------------------------------------
  13928. // QRMaskPattern
  13929. //---------------------------------------------------------------------
  13930. var QRMaskPattern = {
  13931. PATTERN000: 0,
  13932. PATTERN001: 1,
  13933. PATTERN010: 2,
  13934. PATTERN011: 3,
  13935. PATTERN100: 4,
  13936. PATTERN101: 5,
  13937. PATTERN110: 6,
  13938. PATTERN111: 7
  13939. };
  13940. //---------------------------------------------------------------------
  13941. // QRUtil
  13942. //---------------------------------------------------------------------
  13943. var QRUtil = function () {
  13944. 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]];
  13945. var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
  13946. var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
  13947. var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
  13948. var _this = {};
  13949. var getBCHDigit = function getBCHDigit(data) {
  13950. var digit = 0;
  13951. while (data != 0) {
  13952. digit += 1;
  13953. data >>>= 1;
  13954. }
  13955. return digit;
  13956. };
  13957. _this.getBCHTypeInfo = function (data) {
  13958. var d = data << 10;
  13959. while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
  13960. d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
  13961. }
  13962. return (data << 10 | d) ^ G15_MASK;
  13963. };
  13964. _this.getBCHTypeNumber = function (data) {
  13965. var d = data << 12;
  13966. while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
  13967. d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
  13968. }
  13969. return data << 12 | d;
  13970. };
  13971. _this.getPatternPosition = function (typeNumber) {
  13972. return PATTERN_POSITION_TABLE[typeNumber - 1];
  13973. };
  13974. _this.getMaskFunction = function (maskPattern) {
  13975. switch (maskPattern) {
  13976. case QRMaskPattern.PATTERN000:
  13977. return function (i, j) {
  13978. return (i + j) % 2 == 0;
  13979. };
  13980. case QRMaskPattern.PATTERN001:
  13981. return function (i, j) {
  13982. return i % 2 == 0;
  13983. };
  13984. case QRMaskPattern.PATTERN010:
  13985. return function (i, j) {
  13986. return j % 3 == 0;
  13987. };
  13988. case QRMaskPattern.PATTERN011:
  13989. return function (i, j) {
  13990. return (i + j) % 3 == 0;
  13991. };
  13992. case QRMaskPattern.PATTERN100:
  13993. return function (i, j) {
  13994. return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
  13995. };
  13996. case QRMaskPattern.PATTERN101:
  13997. return function (i, j) {
  13998. return i * j % 2 + i * j % 3 == 0;
  13999. };
  14000. case QRMaskPattern.PATTERN110:
  14001. return function (i, j) {
  14002. return (i * j % 2 + i * j % 3) % 2 == 0;
  14003. };
  14004. case QRMaskPattern.PATTERN111:
  14005. return function (i, j) {
  14006. return (i * j % 3 + (i + j) % 2) % 2 == 0;
  14007. };
  14008. default:
  14009. throw new Error('bad maskPattern:' + maskPattern);
  14010. }
  14011. };
  14012. _this.getErrorCorrectPolynomial = function (errorCorrectLength) {
  14013. var a = qrPolynomial([1], 0);
  14014. for (var i = 0; i < errorCorrectLength; i += 1) {
  14015. a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
  14016. }
  14017. return a;
  14018. };
  14019. _this.getLengthInBits = function (mode, type) {
  14020. if (1 <= type && type < 10) {
  14021. // 1 - 9
  14022. switch (mode) {
  14023. case QRMode.MODE_NUMBER:
  14024. return 10;
  14025. case QRMode.MODE_ALPHA_NUM:
  14026. return 9;
  14027. case QRMode.MODE_8BIT_BYTE:
  14028. return 8;
  14029. case QRMode.MODE_KANJI:
  14030. return 8;
  14031. default:
  14032. throw new Error('mode:' + mode);
  14033. }
  14034. } else if (type < 27) {
  14035. // 10 - 26
  14036. switch (mode) {
  14037. case QRMode.MODE_NUMBER:
  14038. return 12;
  14039. case QRMode.MODE_ALPHA_NUM:
  14040. return 11;
  14041. case QRMode.MODE_8BIT_BYTE:
  14042. return 16;
  14043. case QRMode.MODE_KANJI:
  14044. return 10;
  14045. default:
  14046. throw new Error('mode:' + mode);
  14047. }
  14048. } else if (type < 41) {
  14049. // 27 - 40
  14050. switch (mode) {
  14051. case QRMode.MODE_NUMBER:
  14052. return 14;
  14053. case QRMode.MODE_ALPHA_NUM:
  14054. return 13;
  14055. case QRMode.MODE_8BIT_BYTE:
  14056. return 16;
  14057. case QRMode.MODE_KANJI:
  14058. return 12;
  14059. default:
  14060. throw new Error('mode:' + mode);
  14061. }
  14062. } else {
  14063. throw new Error('type:' + type);
  14064. }
  14065. };
  14066. _this.getLostPoint = function (qrcode) {
  14067. var moduleCount = qrcode.getModuleCount();
  14068. var lostPoint = 0;
  14069. // LEVEL1
  14070. for (var row = 0; row < moduleCount; row += 1) {
  14071. for (var col = 0; col < moduleCount; col += 1) {
  14072. var sameCount = 0;
  14073. var dark = qrcode.isDark(row, col);
  14074. for (var r = -1; r <= 1; r += 1) {
  14075. if (row + r < 0 || moduleCount <= row + r) {
  14076. continue;
  14077. }
  14078. for (var c = -1; c <= 1; c += 1) {
  14079. if (col + c < 0 || moduleCount <= col + c) {
  14080. continue;
  14081. }
  14082. if (r == 0 && c == 0) {
  14083. continue;
  14084. }
  14085. if (dark == qrcode.isDark(row + r, col + c)) {
  14086. sameCount += 1;
  14087. }
  14088. }
  14089. }
  14090. if (sameCount > 5) {
  14091. lostPoint += 3 + sameCount - 5;
  14092. }
  14093. }
  14094. }
  14095. ;
  14096. // LEVEL2
  14097. for (var row = 0; row < moduleCount - 1; row += 1) {
  14098. for (var col = 0; col < moduleCount - 1; col += 1) {
  14099. var count = 0;
  14100. if (qrcode.isDark(row, col)) count += 1;
  14101. if (qrcode.isDark(row + 1, col)) count += 1;
  14102. if (qrcode.isDark(row, col + 1)) count += 1;
  14103. if (qrcode.isDark(row + 1, col + 1)) count += 1;
  14104. if (count == 0 || count == 4) {
  14105. lostPoint += 3;
  14106. }
  14107. }
  14108. }
  14109. // LEVEL3
  14110. for (var row = 0; row < moduleCount; row += 1) {
  14111. for (var col = 0; col < moduleCount - 6; col += 1) {
  14112. 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)) {
  14113. lostPoint += 40;
  14114. }
  14115. }
  14116. }
  14117. for (var col = 0; col < moduleCount; col += 1) {
  14118. for (var row = 0; row < moduleCount - 6; row += 1) {
  14119. 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)) {
  14120. lostPoint += 40;
  14121. }
  14122. }
  14123. }
  14124. // LEVEL4
  14125. var darkCount = 0;
  14126. for (var col = 0; col < moduleCount; col += 1) {
  14127. for (var row = 0; row < moduleCount; row += 1) {
  14128. if (qrcode.isDark(row, col)) {
  14129. darkCount += 1;
  14130. }
  14131. }
  14132. }
  14133. var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
  14134. lostPoint += ratio * 10;
  14135. return lostPoint;
  14136. };
  14137. return _this;
  14138. }();
  14139. //---------------------------------------------------------------------
  14140. // QRMath
  14141. //---------------------------------------------------------------------
  14142. var QRMath = function () {
  14143. var EXP_TABLE = new Array(256);
  14144. var LOG_TABLE = new Array(256);
  14145. // initialize tables
  14146. for (var i = 0; i < 8; i += 1) {
  14147. EXP_TABLE[i] = 1 << i;
  14148. }
  14149. for (var i = 8; i < 256; i += 1) {
  14150. EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
  14151. }
  14152. for (var i = 0; i < 255; i += 1) {
  14153. LOG_TABLE[EXP_TABLE[i]] = i;
  14154. }
  14155. var _this = {};
  14156. _this.glog = function (n) {
  14157. if (n < 1) {
  14158. throw new Error('glog(' + n + ')');
  14159. }
  14160. return LOG_TABLE[n];
  14161. };
  14162. _this.gexp = function (n) {
  14163. while (n < 0) {
  14164. n += 255;
  14165. }
  14166. while (n >= 256) {
  14167. n -= 255;
  14168. }
  14169. return EXP_TABLE[n];
  14170. };
  14171. return _this;
  14172. }();
  14173. //---------------------------------------------------------------------
  14174. // qrPolynomial
  14175. //---------------------------------------------------------------------
  14176. function qrPolynomial(num, shift) {
  14177. if (typeof num.length == 'undefined') {
  14178. throw new Error(num.length + '/' + shift);
  14179. }
  14180. var _num = function () {
  14181. var offset = 0;
  14182. while (offset < num.length && num[offset] == 0) {
  14183. offset += 1;
  14184. }
  14185. var _num = new Array(num.length - offset + shift);
  14186. for (var i = 0; i < num.length - offset; i += 1) {
  14187. _num[i] = num[i + offset];
  14188. }
  14189. return _num;
  14190. }();
  14191. var _this = {};
  14192. _this.getAt = function (index) {
  14193. return _num[index];
  14194. };
  14195. _this.getLength = function () {
  14196. return _num.length;
  14197. };
  14198. _this.multiply = function (e) {
  14199. var num = new Array(_this.getLength() + e.getLength() - 1);
  14200. for (var i = 0; i < _this.getLength(); i += 1) {
  14201. for (var j = 0; j < e.getLength(); j += 1) {
  14202. num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
  14203. }
  14204. }
  14205. return qrPolynomial(num, 0);
  14206. };
  14207. _this.mod = function (e) {
  14208. if (_this.getLength() - e.getLength() < 0) {
  14209. return _this;
  14210. }
  14211. var ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
  14212. var num = new Array(_this.getLength());
  14213. for (var i = 0; i < _this.getLength(); i += 1) {
  14214. num[i] = _this.getAt(i);
  14215. }
  14216. for (var i = 0; i < e.getLength(); i += 1) {
  14217. num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
  14218. }
  14219. // recursive call
  14220. return qrPolynomial(num, 0).mod(e);
  14221. };
  14222. return _this;
  14223. }
  14224. ;
  14225. //---------------------------------------------------------------------
  14226. // QRRSBlock
  14227. //---------------------------------------------------------------------
  14228. var QRRSBlock = function () {
  14229. // [1: [L, M, Q, H], ..]
  14230. 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]];
  14231. var qrRSBlock = function qrRSBlock(totalCount, dataCount) {
  14232. var _this = {};
  14233. _this.totalCount = totalCount;
  14234. _this.dataCount = dataCount;
  14235. return _this;
  14236. };
  14237. var _this = {};
  14238. var getRsBlockTable = function getRsBlockTable(typeNumber, errorCorrectLevel) {
  14239. switch (errorCorrectLevel) {
  14240. case QRErrorCorrectLevel.L:
  14241. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
  14242. case QRErrorCorrectLevel.M:
  14243. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
  14244. case QRErrorCorrectLevel.Q:
  14245. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
  14246. case QRErrorCorrectLevel.H:
  14247. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
  14248. default:
  14249. return undefined;
  14250. }
  14251. };
  14252. _this.getRSBlocks = function (typeNumber, errorCorrectLevel) {
  14253. var rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel);
  14254. if (typeof rsBlock == 'undefined') {
  14255. throw new Error('bad rs block @ typeNumber:' + typeNumber + '/errorCorrectLevel:' + errorCorrectLevel);
  14256. }
  14257. var length = rsBlock.length / 3;
  14258. var list = new Array();
  14259. for (var i = 0; i < length; i += 1) {
  14260. var count = rsBlock[i * 3 + 0];
  14261. var totalCount = rsBlock[i * 3 + 1];
  14262. var dataCount = rsBlock[i * 3 + 2];
  14263. for (var j = 0; j < count; j += 1) {
  14264. list.push(qrRSBlock(totalCount, dataCount));
  14265. }
  14266. }
  14267. return list;
  14268. };
  14269. return _this;
  14270. }();
  14271. //---------------------------------------------------------------------
  14272. // qrBitBuffer
  14273. //---------------------------------------------------------------------
  14274. var qrBitBuffer = function qrBitBuffer() {
  14275. var _buffer = new Array();
  14276. var _length = 0;
  14277. var _this = {};
  14278. _this.getBuffer = function () {
  14279. return _buffer;
  14280. };
  14281. _this.getAt = function (index) {
  14282. var bufIndex = Math.floor(index / 8);
  14283. return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
  14284. };
  14285. _this.put = function (num, length) {
  14286. for (var i = 0; i < length; i += 1) {
  14287. _this.putBit((num >>> length - i - 1 & 1) == 1);
  14288. }
  14289. };
  14290. _this.getLengthInBits = function () {
  14291. return _length;
  14292. };
  14293. _this.putBit = function (bit) {
  14294. var bufIndex = Math.floor(_length / 8);
  14295. if (_buffer.length <= bufIndex) {
  14296. _buffer.push(0);
  14297. }
  14298. if (bit) {
  14299. _buffer[bufIndex] |= 0x80 >>> _length % 8;
  14300. }
  14301. _length += 1;
  14302. };
  14303. return _this;
  14304. };
  14305. //---------------------------------------------------------------------
  14306. // qr8BitByte
  14307. //---------------------------------------------------------------------
  14308. var qr8BitByte = function qr8BitByte(data) {
  14309. var _mode = QRMode.MODE_8BIT_BYTE;
  14310. var _data = data;
  14311. var _parsedData = [];
  14312. var _this = {};
  14313. // Added to support UTF-8 Characters
  14314. for (var i = 0, l = _data.length; i < l; i++) {
  14315. var byteArray = [];
  14316. var code = _data.charCodeAt(i);
  14317. if (code > 0x10000) {
  14318. byteArray[0] = 0xF0 | (code & 0x1C0000) >>> 18;
  14319. byteArray[1] = 0x80 | (code & 0x3F000) >>> 12;
  14320. byteArray[2] = 0x80 | (code & 0xFC0) >>> 6;
  14321. byteArray[3] = 0x80 | code & 0x3F;
  14322. } else if (code > 0x800) {
  14323. byteArray[0] = 0xE0 | (code & 0xF000) >>> 12;
  14324. byteArray[1] = 0x80 | (code & 0xFC0) >>> 6;
  14325. byteArray[2] = 0x80 | code & 0x3F;
  14326. } else if (code > 0x80) {
  14327. byteArray[0] = 0xC0 | (code & 0x7C0) >>> 6;
  14328. byteArray[1] = 0x80 | code & 0x3F;
  14329. } else {
  14330. byteArray[0] = code;
  14331. }
  14332. // Fix Unicode corruption bug
  14333. _parsedData.push(byteArray);
  14334. }
  14335. _parsedData = Array.prototype.concat.apply([], _parsedData);
  14336. if (_parsedData.length != _data.length) {
  14337. _parsedData.unshift(191);
  14338. _parsedData.unshift(187);
  14339. _parsedData.unshift(239);
  14340. }
  14341. var _bytes = _parsedData;
  14342. _this.getMode = function () {
  14343. return _mode;
  14344. };
  14345. _this.getLength = function (buffer) {
  14346. return _bytes.length;
  14347. };
  14348. _this.write = function (buffer) {
  14349. for (var i = 0; i < _bytes.length; i += 1) {
  14350. buffer.put(_bytes[i], 8);
  14351. }
  14352. };
  14353. return _this;
  14354. };
  14355. //=====================================================================
  14356. // GIF Support etc.
  14357. //
  14358. //---------------------------------------------------------------------
  14359. // byteArrayOutputStream
  14360. //---------------------------------------------------------------------
  14361. var byteArrayOutputStream = function byteArrayOutputStream() {
  14362. var _bytes = new Array();
  14363. var _this = {};
  14364. _this.writeByte = function (b) {
  14365. _bytes.push(b & 0xff);
  14366. };
  14367. _this.writeShort = function (i) {
  14368. _this.writeByte(i);
  14369. _this.writeByte(i >>> 8);
  14370. };
  14371. _this.writeBytes = function (b, off, len) {
  14372. off = off || 0;
  14373. len = len || b.length;
  14374. for (var i = 0; i < len; i += 1) {
  14375. _this.writeByte(b[i + off]);
  14376. }
  14377. };
  14378. _this.writeString = function (s) {
  14379. for (var i = 0; i < s.length; i += 1) {
  14380. _this.writeByte(s.charCodeAt(i));
  14381. }
  14382. };
  14383. _this.toByteArray = function () {
  14384. return _bytes;
  14385. };
  14386. _this.toString = function () {
  14387. var s = '';
  14388. s += '[';
  14389. for (var i = 0; i < _bytes.length; i += 1) {
  14390. if (i > 0) {
  14391. s += ',';
  14392. }
  14393. s += _bytes[i];
  14394. }
  14395. s += ']';
  14396. return s;
  14397. };
  14398. return _this;
  14399. };
  14400. //---------------------------------------------------------------------
  14401. // base64EncodeOutputStream
  14402. //---------------------------------------------------------------------
  14403. var base64EncodeOutputStream = function base64EncodeOutputStream() {
  14404. var _buffer = 0;
  14405. var _buflen = 0;
  14406. var _length = 0;
  14407. var _base64 = '';
  14408. var _this = {};
  14409. var writeEncoded = function writeEncoded(b) {
  14410. _base64 += String.fromCharCode(encode(b & 0x3f));
  14411. };
  14412. var encode = function encode(n) {
  14413. if (n < 0) {
  14414. // error.
  14415. } else if (n < 26) {
  14416. return 0x41 + n;
  14417. } else if (n < 52) {
  14418. return 0x61 + (n - 26);
  14419. } else if (n < 62) {
  14420. return 0x30 + (n - 52);
  14421. } else if (n == 62) {
  14422. return 0x2b;
  14423. } else if (n == 63) {
  14424. return 0x2f;
  14425. }
  14426. throw new Error('n:' + n);
  14427. };
  14428. _this.writeByte = function (n) {
  14429. _buffer = _buffer << 8 | n & 0xff;
  14430. _buflen += 8;
  14431. _length += 1;
  14432. while (_buflen >= 6) {
  14433. writeEncoded(_buffer >>> _buflen - 6);
  14434. _buflen -= 6;
  14435. }
  14436. };
  14437. _this.flush = function () {
  14438. if (_buflen > 0) {
  14439. writeEncoded(_buffer << 6 - _buflen);
  14440. _buffer = 0;
  14441. _buflen = 0;
  14442. }
  14443. if (_length % 3 != 0) {
  14444. // padding
  14445. var padlen = 3 - _length % 3;
  14446. for (var i = 0; i < padlen; i += 1) {
  14447. _base64 += '=';
  14448. }
  14449. }
  14450. };
  14451. _this.toString = function () {
  14452. return _base64;
  14453. };
  14454. return _this;
  14455. };
  14456. //---------------------------------------------------------------------
  14457. // base64DecodeInputStream
  14458. //---------------------------------------------------------------------
  14459. var base64DecodeInputStream = function base64DecodeInputStream(str) {
  14460. var _str = str;
  14461. var _pos = 0;
  14462. var _buffer = 0;
  14463. var _buflen = 0;
  14464. var _this = {};
  14465. _this.read = function () {
  14466. while (_buflen < 8) {
  14467. if (_pos >= _str.length) {
  14468. if (_buflen == 0) {
  14469. return -1;
  14470. }
  14471. throw new Error('unexpected end of file./' + _buflen);
  14472. }
  14473. var c = _str.charAt(_pos);
  14474. _pos += 1;
  14475. if (c == '=') {
  14476. _buflen = 0;
  14477. return -1;
  14478. } else if (c.match(/^\s$/)) {
  14479. // ignore if whitespace.
  14480. continue;
  14481. }
  14482. _buffer = _buffer << 6 | decode(c.charCodeAt(0));
  14483. _buflen += 6;
  14484. }
  14485. var n = _buffer >>> _buflen - 8 & 0xff;
  14486. _buflen -= 8;
  14487. return n;
  14488. };
  14489. var decode = function decode(c) {
  14490. if (0x41 <= c && c <= 0x5a) {
  14491. return c - 0x41;
  14492. } else if (0x61 <= c && c <= 0x7a) {
  14493. return c - 0x61 + 26;
  14494. } else if (0x30 <= c && c <= 0x39) {
  14495. return c - 0x30 + 52;
  14496. } else if (c == 0x2b) {
  14497. return 62;
  14498. } else if (c == 0x2f) {
  14499. return 63;
  14500. } else {
  14501. throw new Error('c:' + c);
  14502. }
  14503. };
  14504. return _this;
  14505. };
  14506. //---------------------------------------------------------------------
  14507. // gifImage (B/W)
  14508. //---------------------------------------------------------------------
  14509. var gifImage = function gifImage(width, height) {
  14510. var _width = width;
  14511. var _height = height;
  14512. var _data = new Array(width * height);
  14513. var _this = {};
  14514. _this.setPixel = function (x, y, pixel) {
  14515. _data[y * _width + x] = pixel;
  14516. };
  14517. _this.write = function (out) {
  14518. //---------------------------------
  14519. // GIF Signature
  14520. out.writeString('GIF87a');
  14521. //---------------------------------
  14522. // Screen Descriptor
  14523. out.writeShort(_width);
  14524. out.writeShort(_height);
  14525. out.writeByte(0x80); // 2bit
  14526. out.writeByte(0);
  14527. out.writeByte(0);
  14528. //---------------------------------
  14529. // Global Color Map
  14530. // black
  14531. out.writeByte(0x00);
  14532. out.writeByte(0x00);
  14533. out.writeByte(0x00);
  14534. // white
  14535. out.writeByte(0xff);
  14536. out.writeByte(0xff);
  14537. out.writeByte(0xff);
  14538. //---------------------------------
  14539. // Image Descriptor
  14540. out.writeString(',');
  14541. out.writeShort(0);
  14542. out.writeShort(0);
  14543. out.writeShort(_width);
  14544. out.writeShort(_height);
  14545. out.writeByte(0);
  14546. //---------------------------------
  14547. // Local Color Map
  14548. //---------------------------------
  14549. // Raster Data
  14550. var lzwMinCodeSize = 2;
  14551. var raster = getLZWRaster(lzwMinCodeSize);
  14552. out.writeByte(lzwMinCodeSize);
  14553. var offset = 0;
  14554. while (raster.length - offset > 255) {
  14555. out.writeByte(255);
  14556. out.writeBytes(raster, offset, 255);
  14557. offset += 255;
  14558. }
  14559. out.writeByte(raster.length - offset);
  14560. out.writeBytes(raster, offset, raster.length - offset);
  14561. out.writeByte(0x00);
  14562. //---------------------------------
  14563. // GIF Terminator
  14564. out.writeString(';');
  14565. };
  14566. var bitOutputStream = function bitOutputStream(out) {
  14567. var _out = out;
  14568. var _bitLength = 0;
  14569. var _bitBuffer = 0;
  14570. var _this = {};
  14571. _this.write = function (data, length) {
  14572. if (data >>> length != 0) {
  14573. throw new Error('length over');
  14574. }
  14575. while (_bitLength + length >= 8) {
  14576. _out.writeByte(0xff & (data << _bitLength | _bitBuffer));
  14577. length -= 8 - _bitLength;
  14578. data >>>= 8 - _bitLength;
  14579. _bitBuffer = 0;
  14580. _bitLength = 0;
  14581. }
  14582. _bitBuffer = data << _bitLength | _bitBuffer;
  14583. _bitLength = _bitLength + length;
  14584. };
  14585. _this.flush = function () {
  14586. if (_bitLength > 0) {
  14587. _out.writeByte(_bitBuffer);
  14588. }
  14589. };
  14590. return _this;
  14591. };
  14592. var getLZWRaster = function getLZWRaster(lzwMinCodeSize) {
  14593. var clearCode = 1 << lzwMinCodeSize;
  14594. var endCode = (1 << lzwMinCodeSize) + 1;
  14595. var bitLength = lzwMinCodeSize + 1;
  14596. // Setup LZWTable
  14597. var table = lzwTable();
  14598. for (var i = 0; i < clearCode; i += 1) {
  14599. table.add(String.fromCharCode(i));
  14600. }
  14601. table.add(String.fromCharCode(clearCode));
  14602. table.add(String.fromCharCode(endCode));
  14603. var byteOut = byteArrayOutputStream();
  14604. var bitOut = bitOutputStream(byteOut);
  14605. // clear code
  14606. bitOut.write(clearCode, bitLength);
  14607. var dataIndex = 0;
  14608. var s = String.fromCharCode(_data[dataIndex]);
  14609. dataIndex += 1;
  14610. while (dataIndex < _data.length) {
  14611. var c = String.fromCharCode(_data[dataIndex]);
  14612. dataIndex += 1;
  14613. if (table.contains(s + c)) {
  14614. s = s + c;
  14615. } else {
  14616. bitOut.write(table.indexOf(s), bitLength);
  14617. if (table.size() < 0xfff) {
  14618. if (table.size() == 1 << bitLength) {
  14619. bitLength += 1;
  14620. }
  14621. table.add(s + c);
  14622. }
  14623. s = c;
  14624. }
  14625. }
  14626. bitOut.write(table.indexOf(s), bitLength);
  14627. // end code
  14628. bitOut.write(endCode, bitLength);
  14629. bitOut.flush();
  14630. return byteOut.toByteArray();
  14631. };
  14632. var lzwTable = function lzwTable() {
  14633. var _map = {};
  14634. var _size = 0;
  14635. var _this = {};
  14636. _this.add = function (key) {
  14637. if (_this.contains(key)) {
  14638. throw new Error('dup key:' + key);
  14639. }
  14640. _map[key] = _size;
  14641. _size += 1;
  14642. };
  14643. _this.size = function () {
  14644. return _size;
  14645. };
  14646. _this.indexOf = function (key) {
  14647. return _map[key];
  14648. };
  14649. _this.contains = function (key) {
  14650. return typeof _map[key] != 'undefined';
  14651. };
  14652. return _this;
  14653. };
  14654. return _this;
  14655. };
  14656. var createImgTag = function createImgTag(width, height, getPixel, alt) {
  14657. var gif = gifImage(width, height);
  14658. for (var y = 0; y < height; y += 1) {
  14659. for (var x = 0; x < width; x += 1) {
  14660. gif.setPixel(x, y, getPixel(x, y));
  14661. }
  14662. }
  14663. var b = byteArrayOutputStream();
  14664. gif.write(b);
  14665. var base64 = base64EncodeOutputStream();
  14666. var bytes = b.toByteArray();
  14667. for (var i = 0; i < bytes.length; i += 1) {
  14668. base64.writeByte(bytes[i]);
  14669. }
  14670. base64.flush();
  14671. var img = '';
  14672. img += 'data:image/gif;base64,';
  14673. img += base64;
  14674. return img;
  14675. };
  14676. //---------------------------------------------------------------------
  14677. // returns qrcode function.
  14678. var createQrCodeImg = function createQrCodeImg(text, options) {
  14679. options = options || {};
  14680. var typeNumber = options.typeNumber || 4;
  14681. var errorCorrectLevel = options.errorCorrectLevel || 'M';
  14682. var size = options.size || 500;
  14683. var qr;
  14684. try {
  14685. qr = qrcode(typeNumber, errorCorrectLevel || 'M');
  14686. qr.addData(text);
  14687. qr.make();
  14688. } catch (e) {
  14689. if (typeNumber >= 40) {
  14690. throw new Error('Text too long to encode');
  14691. } else {
  14692. return createQrCodeImg(text, {
  14693. size: size,
  14694. errorCorrectLevel: errorCorrectLevel,
  14695. typeNumber: typeNumber + 1
  14696. });
  14697. }
  14698. }
  14699. // calc cellsize and margin
  14700. var cellsize = parseInt(size / qr.getModuleCount());
  14701. var margin = parseInt((size - qr.getModuleCount() * cellsize) / 2);
  14702. return qr.createImgTag(cellsize, margin, size);
  14703. };
  14704. module.exports = {
  14705. create: createQrCodeImg
  14706. };
  14707. /***/ }),
  14708. /***/ 49:
  14709. /*!***********************************************************************************************!*\
  14710. !*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/static/js/bmap-wx.js ***!
  14711. \***********************************************************************************************/
  14712. /*! no static exports found */
  14713. /***/ (function(module, exports, __webpack_require__) {
  14714. /* WEBPACK VAR INJECTION */(function(wx) {var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23);
  14715. var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ 24);
  14716. /**
  14717. * @file 微信小程序JSAPI
  14718. * @author 崔健 cuijian03@baidu.com 2017.01.10
  14719. * @update 邓淑芳 623996689@qq.com 2019.07.03
  14720. */
  14721. /**
  14722. * 百度地图微信小程序API类
  14723. *
  14724. * @class
  14725. */
  14726. var BMapWX = /*#__PURE__*/function () {
  14727. "use strict";
  14728. /**
  14729. * 百度地图微信小程序API类
  14730. *
  14731. * @constructor
  14732. */
  14733. function BMapWX(param) {
  14734. _classCallCheck(this, BMapWX);
  14735. this.ak = param["ak"];
  14736. }
  14737. /**
  14738. * 使用微信接口进行定位
  14739. *
  14740. * @param {string} type 坐标类型
  14741. * @param {Function} success 成功执行
  14742. * @param {Function} fail 失败执行
  14743. * @param {Function} complete 完成后执行
  14744. */
  14745. _createClass(BMapWX, [{
  14746. key: "getWXLocation",
  14747. value: function getWXLocation(type, success, fail, complete) {
  14748. type = type || 'gcj02', success = success || function () {};
  14749. fail = fail || function () {};
  14750. complete = complete || function () {};
  14751. wx.getLocation({
  14752. type: type,
  14753. success: success,
  14754. fail: fail,
  14755. complete: complete
  14756. });
  14757. }
  14758. /**
  14759. * POI周边检索
  14760. *
  14761. * @param {Object} param 检索配置
  14762. * 参数对象结构可以参考
  14763. * http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-placeapi
  14764. */
  14765. }, {
  14766. key: "search",
  14767. value: function search(param) {
  14768. var that = this;
  14769. param = param || {};
  14770. var searchparam = {
  14771. query: param["query"] || '生活服务$美食&酒店',
  14772. scope: param["scope"] || 1,
  14773. filter: param["filter"] || '',
  14774. coord_type: param["coord_type"] || 2,
  14775. page_size: param["page_size"] || 10,
  14776. page_num: param["page_num"] || 0,
  14777. output: param["output"] || 'json',
  14778. ak: that.ak,
  14779. sn: param["sn"] || '',
  14780. timestamp: param["timestamp"] || '',
  14781. radius: param["radius"] || 2000,
  14782. ret_coordtype: 'gcj02ll'
  14783. };
  14784. var otherparam = {
  14785. iconPath: param["iconPath"],
  14786. iconTapPath: param["iconTapPath"],
  14787. width: param["width"],
  14788. height: param["height"],
  14789. alpha: param["alpha"] || 1,
  14790. success: param["success"] || function () {},
  14791. fail: param["fail"] || function () {}
  14792. };
  14793. var type = 'gcj02';
  14794. var locationsuccess = function locationsuccess(result) {
  14795. searchparam["location"] = result["latitude"] + ',' + result["longitude"];
  14796. wx.request({
  14797. url: 'https://api.map.baidu.com/place/v2/search',
  14798. data: searchparam,
  14799. header: {
  14800. "content-type": "application/json"
  14801. },
  14802. method: 'GET',
  14803. success: function success(data) {
  14804. var res = data["data"];
  14805. if (res["status"] === 0) {
  14806. var poiArr = res["results"];
  14807. // outputRes 包含两个对象,
  14808. // originalData为百度接口返回的原始数据
  14809. // wxMarkerData为小程序规范的marker格式
  14810. var outputRes = {};
  14811. outputRes["originalData"] = res;
  14812. outputRes["wxMarkerData"] = [];
  14813. for (var i = 0; i < poiArr.length; i++) {
  14814. outputRes["wxMarkerData"][i] = {
  14815. id: i,
  14816. latitude: poiArr[i]["location"]["lat"],
  14817. longitude: poiArr[i]["location"]["lng"],
  14818. title: poiArr[i]["name"],
  14819. iconPath: otherparam["iconPath"],
  14820. iconTapPath: otherparam["iconTapPath"],
  14821. address: poiArr[i]["address"],
  14822. telephone: poiArr[i]["telephone"],
  14823. alpha: otherparam["alpha"],
  14824. width: otherparam["width"],
  14825. height: otherparam["height"]
  14826. };
  14827. }
  14828. otherparam.success(outputRes);
  14829. } else {
  14830. otherparam.fail({
  14831. errMsg: res["message"],
  14832. statusCode: res["status"]
  14833. });
  14834. }
  14835. },
  14836. fail: function fail(data) {
  14837. otherparam.fail(data);
  14838. }
  14839. });
  14840. };
  14841. var locationfail = function locationfail(result) {
  14842. otherparam.fail(result);
  14843. };
  14844. var locationcomplete = function locationcomplete(result) {};
  14845. if (!param["location"]) {
  14846. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  14847. } else {
  14848. var longitude = param.location.split(',')[1];
  14849. var latitude = param.location.split(',')[0];
  14850. var errMsg = 'input location';
  14851. var res = {
  14852. errMsg: errMsg,
  14853. latitude: latitude,
  14854. longitude: longitude
  14855. };
  14856. locationsuccess(res);
  14857. }
  14858. }
  14859. /**
  14860. * sug模糊检索
  14861. *
  14862. * @param {Object} param 检索配置
  14863. * 参数对象结构可以参考
  14864. * http://lbsyun.baidu.com/index.php?title=webapi/place-suggestion-api
  14865. */
  14866. }, {
  14867. key: "suggestion",
  14868. value: function suggestion(param) {
  14869. var that = this;
  14870. param = param || {};
  14871. var suggestionparam = {
  14872. query: param["query"] || '',
  14873. region: param["region"] || '全国',
  14874. city_limit: param["city_limit"] || false,
  14875. output: param["output"] || 'json',
  14876. ak: that.ak,
  14877. sn: param["sn"] || '',
  14878. timestamp: param["timestamp"] || '',
  14879. ret_coordtype: 'gcj02ll'
  14880. };
  14881. var otherparam = {
  14882. success: param["success"] || function () {},
  14883. fail: param["fail"] || function () {}
  14884. };
  14885. wx.request({
  14886. url: 'https://api.map.baidu.com/place/v2/suggestion',
  14887. data: suggestionparam,
  14888. header: {
  14889. "content-type": "application/json"
  14890. },
  14891. method: 'GET',
  14892. success: function success(data) {
  14893. var res = data["data"];
  14894. if (res["status"] === 0) {
  14895. otherparam.success(res);
  14896. } else {
  14897. otherparam.fail({
  14898. errMsg: res["message"],
  14899. statusCode: res["status"]
  14900. });
  14901. }
  14902. },
  14903. fail: function fail(data) {
  14904. otherparam.fail(data);
  14905. }
  14906. });
  14907. }
  14908. /**
  14909. * rgc检索(逆地理编码:经纬度->地点描述)
  14910. *
  14911. * @param {Object} param 检索配置
  14912. * 参数对象结构可以参考
  14913. * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding-abroad
  14914. *
  14915. */
  14916. }, {
  14917. key: "regeocoding",
  14918. value: function regeocoding(param) {
  14919. var that = this;
  14920. param = param || {};
  14921. var regeocodingparam = {
  14922. coordtype: param["coordtype"] || 'gcj02ll',
  14923. ret_coordtype: 'gcj02ll',
  14924. radius: param["radius"] || 1000,
  14925. ak: that.ak,
  14926. sn: param["sn"] || '',
  14927. output: param["output"] || 'json',
  14928. callback: param["callback"] || function () {},
  14929. extensions_poi: param["extensions_poi"] || 1,
  14930. extensions_road: param["extensions_road"] || false,
  14931. extensions_town: param["extensions_town"] || false,
  14932. language: param["language"] || 'zh-CN',
  14933. language_auto: param["language_auto"] || 0
  14934. };
  14935. var otherparam = {
  14936. iconPath: param["iconPath"],
  14937. iconTapPath: param["iconTapPath"],
  14938. width: param["width"],
  14939. height: param["height"],
  14940. alpha: param["alpha"] || 1,
  14941. success: param["success"] || function () {},
  14942. fail: param["fail"] || function () {}
  14943. };
  14944. var type = 'gcj02';
  14945. var locationsuccess = function locationsuccess(result) {
  14946. regeocodingparam["location"] = result["latitude"] + ',' + result["longitude"];
  14947. wx.request({
  14948. url: 'https://api.map.baidu.com/reverse_geocoding/v3',
  14949. data: regeocodingparam,
  14950. header: {
  14951. "content-type": "application/json"
  14952. },
  14953. method: 'GET',
  14954. success: function success(data) {
  14955. var res = data["data"];
  14956. if (res["status"] === 0) {
  14957. var poiObj = res["result"];
  14958. // outputRes 包含两个对象:
  14959. // originalData为百度接口返回的原始数据
  14960. // wxMarkerData为小程序规范的marker格式
  14961. var outputRes = {};
  14962. outputRes["originalData"] = res;
  14963. outputRes["wxMarkerData"] = [];
  14964. outputRes["wxMarkerData"][0] = {
  14965. id: 0,
  14966. latitude: result["latitude"],
  14967. longitude: result["longitude"],
  14968. address: poiObj["formatted_address"],
  14969. iconPath: otherparam["iconPath"],
  14970. iconTapPath: otherparam["iconTapPath"],
  14971. desc: poiObj["sematic_description"],
  14972. business: poiObj["business"],
  14973. alpha: otherparam["alpha"],
  14974. width: otherparam["width"],
  14975. height: otherparam["height"]
  14976. };
  14977. otherparam.success(outputRes);
  14978. } else {
  14979. otherparam.fail({
  14980. errMsg: res["message"],
  14981. statusCode: res["status"]
  14982. });
  14983. }
  14984. },
  14985. fail: function fail(data) {
  14986. otherparam.fail(data);
  14987. }
  14988. });
  14989. };
  14990. var locationfail = function locationfail(result) {
  14991. otherparam.fail(result);
  14992. };
  14993. var locationcomplete = function locationcomplete(result) {};
  14994. if (!param["location"]) {
  14995. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  14996. } else {
  14997. var longitude = param.location.split(',')[1];
  14998. var latitude = param.location.split(',')[0];
  14999. var errMsg = 'input location';
  15000. var res = {
  15001. errMsg: errMsg,
  15002. latitude: latitude,
  15003. longitude: longitude
  15004. };
  15005. locationsuccess(res);
  15006. }
  15007. }
  15008. /**
  15009. * gc检索(地理编码:地点->经纬度)
  15010. *
  15011. * @param {Object} param 检索配置
  15012. * 参数对象结构可以参考
  15013. * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding
  15014. *
  15015. */
  15016. }, {
  15017. key: "geocoding",
  15018. value: function geocoding(param) {
  15019. var that = this;
  15020. param = param || {};
  15021. var geocodingparam = {
  15022. address: param["address"] || '',
  15023. city: param["city"] || '',
  15024. ret_coordtype: param["coordtype"] || 'gcj02ll',
  15025. ak: that.ak,
  15026. sn: param["sn"] || '',
  15027. output: param["output"] || 'json',
  15028. callback: param["callback"] || function () {}
  15029. };
  15030. var otherparam = {
  15031. iconPath: param["iconPath"],
  15032. iconTapPath: param["iconTapPath"],
  15033. width: param["width"],
  15034. height: param["height"],
  15035. alpha: param["alpha"] || 1,
  15036. success: param["success"] || function () {},
  15037. fail: param["fail"] || function () {}
  15038. };
  15039. if (param["address"]) {
  15040. wx.request({
  15041. url: 'https://api.map.baidu.com/geocoding/v3',
  15042. data: geocodingparam,
  15043. header: {
  15044. "content-type": "application/json"
  15045. },
  15046. method: 'GET',
  15047. success: function success(data) {
  15048. var res = data["data"];
  15049. if (res["status"] === 0) {
  15050. var poiObj = res["result"];
  15051. // outputRes 包含两个对象:
  15052. // originalData为百度接口返回的原始数据
  15053. // wxMarkerData为小程序规范的marker格式
  15054. var outputRes = res;
  15055. outputRes["originalData"] = res;
  15056. outputRes["wxMarkerData"] = [];
  15057. outputRes["wxMarkerData"][0] = {
  15058. id: 0,
  15059. latitude: poiObj["location"]["lat"],
  15060. longitude: poiObj["location"]["lng"],
  15061. iconPath: otherparam["iconPath"],
  15062. iconTapPath: otherparam["iconTapPath"],
  15063. alpha: otherparam["alpha"],
  15064. width: otherparam["width"],
  15065. height: otherparam["height"]
  15066. };
  15067. otherparam.success(outputRes);
  15068. } else {
  15069. otherparam.fail({
  15070. errMsg: res["message"],
  15071. statusCode: res["status"]
  15072. });
  15073. }
  15074. },
  15075. fail: function fail(data) {
  15076. otherparam.fail(data);
  15077. }
  15078. });
  15079. } else {
  15080. var errMsg = 'input address!';
  15081. var res = {
  15082. errMsg: errMsg
  15083. };
  15084. otherparam.fail(res);
  15085. }
  15086. }
  15087. /**
  15088. * 天气检索
  15089. *
  15090. * @param {Object} param 检索配置
  15091. */
  15092. }, {
  15093. key: "weather",
  15094. value: function weather(param) {
  15095. var that = this;
  15096. param = param || {};
  15097. var weatherparam = {
  15098. coord_type: param["coord_type"] || 'gcj02',
  15099. output: param["output"] || 'json',
  15100. ak: that.ak,
  15101. sn: param["sn"] || '',
  15102. timestamp: param["timestamp"] || ''
  15103. };
  15104. var otherparam = {
  15105. success: param["success"] || function () {},
  15106. fail: param["fail"] || function () {}
  15107. };
  15108. var type = 'gcj02';
  15109. var locationsuccess = function locationsuccess(result) {
  15110. weatherparam["location"] = result["longitude"] + ',' + result["latitude"];
  15111. wx.request({
  15112. url: 'https://api.map.baidu.com/telematics/v3/weather',
  15113. data: weatherparam,
  15114. header: {
  15115. "content-type": "application/json"
  15116. },
  15117. method: 'GET',
  15118. success: function success(data) {
  15119. var res = data["data"];
  15120. if (res["error"] === 0 && res["status"] === 'success') {
  15121. var weatherArr = res["results"];
  15122. // outputRes 包含两个对象,
  15123. // originalData为百度接口返回的原始数据
  15124. // wxMarkerData为小程序规范的marker格式
  15125. var outputRes = {};
  15126. outputRes["originalData"] = res;
  15127. outputRes["currentWeather"] = [];
  15128. outputRes["currentWeather"][0] = {
  15129. currentCity: weatherArr[0]["currentCity"],
  15130. pm25: weatherArr[0]["pm25"],
  15131. date: weatherArr[0]["weather_data"][0]["date"],
  15132. temperature: weatherArr[0]["weather_data"][0]["temperature"],
  15133. weatherDesc: weatherArr[0]["weather_data"][0]["weather"],
  15134. wind: weatherArr[0]["weather_data"][0]["wind"]
  15135. };
  15136. otherparam.success(outputRes);
  15137. } else {
  15138. otherparam.fail({
  15139. errMsg: res["message"],
  15140. statusCode: res["status"]
  15141. });
  15142. }
  15143. },
  15144. fail: function fail(data) {
  15145. otherparam.fail(data);
  15146. }
  15147. });
  15148. };
  15149. var locationfail = function locationfail(result) {
  15150. otherparam.fail(result);
  15151. };
  15152. var locationcomplete = function locationcomplete(result) {};
  15153. if (!param["location"]) {
  15154. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  15155. } else {
  15156. var longitude = param.location.split(',')[0];
  15157. var latitude = param.location.split(',')[1];
  15158. var errMsg = 'input location';
  15159. var res = {
  15160. errMsg: errMsg,
  15161. latitude: latitude,
  15162. longitude: longitude
  15163. };
  15164. locationsuccess(res);
  15165. }
  15166. }
  15167. }]);
  15168. return BMapWX;
  15169. }();
  15170. module.exports.BMapWX = BMapWX;
  15171. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  15172. /***/ }),
  15173. /***/ 5:
  15174. /*!**************************************************************!*\
  15175. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  15176. \**************************************************************/
  15177. /*! no static exports found */
  15178. /***/ (function(module, exports, __webpack_require__) {
  15179. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 6);
  15180. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 7);
  15181. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  15182. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 10);
  15183. function _slicedToArray(arr, i) {
  15184. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  15185. }
  15186. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15187. /***/ }),
  15188. /***/ 6:
  15189. /*!***************************************************************!*\
  15190. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  15191. \***************************************************************/
  15192. /*! no static exports found */
  15193. /***/ (function(module, exports) {
  15194. function _arrayWithHoles(arr) {
  15195. if (Array.isArray(arr)) return arr;
  15196. }
  15197. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15198. /***/ }),
  15199. /***/ 7:
  15200. /*!*********************************************************************!*\
  15201. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  15202. \*********************************************************************/
  15203. /*! no static exports found */
  15204. /***/ (function(module, exports) {
  15205. function _iterableToArrayLimit(r, l) {
  15206. var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  15207. if (null != t) {
  15208. var e,
  15209. n,
  15210. i,
  15211. u,
  15212. a = [],
  15213. f = !0,
  15214. o = !1;
  15215. try {
  15216. if (i = (t = t.call(r)).next, 0 === l) {
  15217. if (Object(t) !== t) return;
  15218. f = !1;
  15219. } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) {
  15220. ;
  15221. }
  15222. } catch (r) {
  15223. o = !0, n = r;
  15224. } finally {
  15225. try {
  15226. if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
  15227. } finally {
  15228. if (o) throw n;
  15229. }
  15230. }
  15231. return a;
  15232. }
  15233. }
  15234. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15235. /***/ }),
  15236. /***/ 8:
  15237. /*!***************************************************************************!*\
  15238. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  15239. \***************************************************************************/
  15240. /*! no static exports found */
  15241. /***/ (function(module, exports, __webpack_require__) {
  15242. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  15243. function _unsupportedIterableToArray(o, minLen) {
  15244. if (!o) return;
  15245. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  15246. var n = Object.prototype.toString.call(o).slice(8, -1);
  15247. if (n === "Object" && o.constructor) n = o.constructor.name;
  15248. if (n === "Map" || n === "Set") return Array.from(o);
  15249. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  15250. }
  15251. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15252. /***/ }),
  15253. /***/ 9:
  15254. /*!*****************************************************************!*\
  15255. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  15256. \*****************************************************************/
  15257. /*! no static exports found */
  15258. /***/ (function(module, exports) {
  15259. function _arrayLikeToArray(arr, len) {
  15260. if (len == null || len > arr.length) len = arr.length;
  15261. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  15262. arr2[i] = arr[i];
  15263. }
  15264. return arr2;
  15265. }
  15266. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  15267. /***/ })
  15268. }]);
  15269. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map