vendor.js 715 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],{
  2. /***/ 1:
  3. /*!************************************************************!*\
  4. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  5. \************************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports, __webpack_require__) {
  8. "use strict";
  9. /* WEBPACK VAR INJECTION */(function(global) {Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.createPlugin = createPlugin;exports.createSubpackageApp = createSubpackageApp;exports.default = void 0;var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 3);
  10. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 4));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}
  11. var realAtob;
  12. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  13. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  14. if (typeof atob !== 'function') {
  15. realAtob = function realAtob(str) {
  16. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  17. if (!b64re.test(str)) {throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");}
  18. // Adding the padding if missing, for semplicity
  19. str += '=='.slice(2 - (str.length & 3));
  20. var bitmap;var result = '';var r1;var r2;var i = 0;
  21. for (; i < str.length;) {
  22. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 |
  23. (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  24. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) :
  25. r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) :
  26. String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  27. }
  28. return result;
  29. };
  30. } else {
  31. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  32. realAtob = atob;
  33. }
  34. function b64DecodeUnicode(str) {
  35. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  36. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  37. }).join(''));
  38. }
  39. function getCurrentUserInfo() {
  40. var token = wx.getStorageSync('uni_id_token') || '';
  41. var tokenArr = token.split('.');
  42. if (!token || tokenArr.length !== 3) {
  43. return {
  44. uid: null,
  45. role: [],
  46. permission: [],
  47. tokenExpired: 0 };
  48. }
  49. var userInfo;
  50. try {
  51. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  52. } catch (error) {
  53. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  54. }
  55. userInfo.tokenExpired = userInfo.exp * 1000;
  56. delete userInfo.exp;
  57. delete userInfo.iat;
  58. return userInfo;
  59. }
  60. function uniIdMixin(Vue) {
  61. Vue.prototype.uniIDHasRole = function (roleId) {var _getCurrentUserInfo =
  62. getCurrentUserInfo(),role = _getCurrentUserInfo.role;
  63. return role.indexOf(roleId) > -1;
  64. };
  65. Vue.prototype.uniIDHasPermission = function (permissionId) {var _getCurrentUserInfo2 =
  66. getCurrentUserInfo(),permission = _getCurrentUserInfo2.permission;
  67. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  68. };
  69. Vue.prototype.uniIDTokenValid = function () {var _getCurrentUserInfo3 =
  70. getCurrentUserInfo(),tokenExpired = _getCurrentUserInfo3.tokenExpired;
  71. return tokenExpired > Date.now();
  72. };
  73. }
  74. var _toString = Object.prototype.toString;
  75. var hasOwnProperty = Object.prototype.hasOwnProperty;
  76. function isFn(fn) {
  77. return typeof fn === 'function';
  78. }
  79. function isStr(str) {
  80. return typeof str === 'string';
  81. }
  82. function isPlainObject(obj) {
  83. return _toString.call(obj) === '[object Object]';
  84. }
  85. function hasOwn(obj, key) {
  86. return hasOwnProperty.call(obj, key);
  87. }
  88. function noop() {}
  89. /**
  90. * Create a cached version of a pure function.
  91. */
  92. function cached(fn) {
  93. var cache = Object.create(null);
  94. return function cachedFn(str) {
  95. var hit = cache[str];
  96. return hit || (cache[str] = fn(str));
  97. };
  98. }
  99. /**
  100. * Camelize a hyphen-delimited string.
  101. */
  102. var camelizeRE = /-(\w)/g;
  103. var camelize = cached(function (str) {
  104. return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';});
  105. });
  106. function sortObject(obj) {
  107. var sortObj = {};
  108. if (isPlainObject(obj)) {
  109. Object.keys(obj).sort().forEach(function (key) {
  110. sortObj[key] = obj[key];
  111. });
  112. }
  113. return !Object.keys(sortObj) ? obj : sortObj;
  114. }
  115. var HOOKS = [
  116. 'invoke',
  117. 'success',
  118. 'fail',
  119. 'complete',
  120. 'returnValue'];
  121. var globalInterceptors = {};
  122. var scopedInterceptors = {};
  123. function mergeHook(parentVal, childVal) {
  124. var res = childVal ?
  125. parentVal ?
  126. parentVal.concat(childVal) :
  127. Array.isArray(childVal) ?
  128. childVal : [childVal] :
  129. parentVal;
  130. return res ?
  131. dedupeHooks(res) :
  132. res;
  133. }
  134. function dedupeHooks(hooks) {
  135. var res = [];
  136. for (var i = 0; i < hooks.length; i++) {
  137. if (res.indexOf(hooks[i]) === -1) {
  138. res.push(hooks[i]);
  139. }
  140. }
  141. return res;
  142. }
  143. function removeHook(hooks, hook) {
  144. var index = hooks.indexOf(hook);
  145. if (index !== -1) {
  146. hooks.splice(index, 1);
  147. }
  148. }
  149. function mergeInterceptorHook(interceptor, option) {
  150. Object.keys(option).forEach(function (hook) {
  151. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  152. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  153. }
  154. });
  155. }
  156. function removeInterceptorHook(interceptor, option) {
  157. if (!interceptor || !option) {
  158. return;
  159. }
  160. Object.keys(option).forEach(function (hook) {
  161. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  162. removeHook(interceptor[hook], option[hook]);
  163. }
  164. });
  165. }
  166. function addInterceptor(method, option) {
  167. if (typeof method === 'string' && isPlainObject(option)) {
  168. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  169. } else if (isPlainObject(method)) {
  170. mergeInterceptorHook(globalInterceptors, method);
  171. }
  172. }
  173. function removeInterceptor(method, option) {
  174. if (typeof method === 'string') {
  175. if (isPlainObject(option)) {
  176. removeInterceptorHook(scopedInterceptors[method], option);
  177. } else {
  178. delete scopedInterceptors[method];
  179. }
  180. } else if (isPlainObject(method)) {
  181. removeInterceptorHook(globalInterceptors, method);
  182. }
  183. }
  184. function wrapperHook(hook) {
  185. return function (data) {
  186. return hook(data) || data;
  187. };
  188. }
  189. function isPromise(obj) {
  190. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  191. }
  192. function queue(hooks, data) {
  193. var promise = false;
  194. for (var i = 0; i < hooks.length; i++) {
  195. var hook = hooks[i];
  196. if (promise) {
  197. promise = Promise.resolve(wrapperHook(hook));
  198. } else {
  199. var res = hook(data);
  200. if (isPromise(res)) {
  201. promise = Promise.resolve(res);
  202. }
  203. if (res === false) {
  204. return {
  205. then: function then() {} };
  206. }
  207. }
  208. }
  209. return promise || {
  210. then: function then(callback) {
  211. return callback(data);
  212. } };
  213. }
  214. function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  215. ['success', 'fail', 'complete'].forEach(function (name) {
  216. if (Array.isArray(interceptor[name])) {
  217. var oldCallback = options[name];
  218. options[name] = function callbackInterceptor(res) {
  219. queue(interceptor[name], res).then(function (res) {
  220. /* eslint-disable no-mixed-operators */
  221. return isFn(oldCallback) && oldCallback(res) || res;
  222. });
  223. };
  224. }
  225. });
  226. return options;
  227. }
  228. function wrapperReturnValue(method, returnValue) {
  229. var returnValueHooks = [];
  230. if (Array.isArray(globalInterceptors.returnValue)) {
  231. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  232. }
  233. var interceptor = scopedInterceptors[method];
  234. if (interceptor && Array.isArray(interceptor.returnValue)) {
  235. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  236. }
  237. returnValueHooks.forEach(function (hook) {
  238. returnValue = hook(returnValue) || returnValue;
  239. });
  240. return returnValue;
  241. }
  242. function getApiInterceptorHooks(method) {
  243. var interceptor = Object.create(null);
  244. Object.keys(globalInterceptors).forEach(function (hook) {
  245. if (hook !== 'returnValue') {
  246. interceptor[hook] = globalInterceptors[hook].slice();
  247. }
  248. });
  249. var scopedInterceptor = scopedInterceptors[method];
  250. if (scopedInterceptor) {
  251. Object.keys(scopedInterceptor).forEach(function (hook) {
  252. if (hook !== 'returnValue') {
  253. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  254. }
  255. });
  256. }
  257. return interceptor;
  258. }
  259. function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];}
  260. var interceptor = getApiInterceptorHooks(method);
  261. if (interceptor && Object.keys(interceptor).length) {
  262. if (Array.isArray(interceptor.invoke)) {
  263. var res = queue(interceptor.invoke, options);
  264. return res.then(function (options) {
  265. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  266. });
  267. } else {
  268. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  269. }
  270. }
  271. return api.apply(void 0, [options].concat(params));
  272. }
  273. var promiseInterceptor = {
  274. returnValue: function returnValue(res) {
  275. if (!isPromise(res)) {
  276. return res;
  277. }
  278. return new Promise(function (resolve, reject) {
  279. res.then(function (res) {
  280. if (res[0]) {
  281. reject(res[0]);
  282. } else {
  283. resolve(res[1]);
  284. }
  285. });
  286. });
  287. } };
  288. var SYNC_API_RE =
  289. /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo/;
  290. var CONTEXT_API_RE = /^create|Manager$/;
  291. // Context例外情况
  292. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  293. // 同步例外情况
  294. var ASYNC_API = ['createBLEConnection'];
  295. var CALLBACK_API_RE = /^on|^off/;
  296. function isContextApi(name) {
  297. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  298. }
  299. function isSyncApi(name) {
  300. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  301. }
  302. function isCallbackApi(name) {
  303. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  304. }
  305. function handlePromise(promise) {
  306. return promise.then(function (data) {
  307. return [null, data];
  308. }).
  309. catch(function (err) {return [err];});
  310. }
  311. function shouldPromise(name) {
  312. if (
  313. isContextApi(name) ||
  314. isSyncApi(name) ||
  315. isCallbackApi(name))
  316. {
  317. return false;
  318. }
  319. return true;
  320. }
  321. /* eslint-disable no-extend-native */
  322. if (!Promise.prototype.finally) {
  323. Promise.prototype.finally = function (callback) {
  324. var promise = this.constructor;
  325. return this.then(
  326. function (value) {return promise.resolve(callback()).then(function () {return value;});},
  327. function (reason) {return promise.resolve(callback()).then(function () {
  328. throw reason;
  329. });});
  330. };
  331. }
  332. function promisify(name, api) {
  333. if (!shouldPromise(name)) {
  334. return api;
  335. }
  336. return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];}
  337. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  338. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  339. }
  340. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  341. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  342. success: resolve,
  343. fail: reject })].concat(
  344. params));
  345. })));
  346. };
  347. }
  348. var EPS = 1e-4;
  349. var BASE_DEVICE_WIDTH = 750;
  350. var isIOS = false;
  351. var deviceWidth = 0;
  352. var deviceDPR = 0;
  353. function checkDeviceWidth() {var _wx$getSystemInfoSync =
  354. wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  355. deviceWidth = windowWidth;
  356. deviceDPR = pixelRatio;
  357. isIOS = platform === 'ios';
  358. }
  359. function upx2px(number, newDeviceWidth) {
  360. if (deviceWidth === 0) {
  361. checkDeviceWidth();
  362. }
  363. number = Number(number);
  364. if (number === 0) {
  365. return 0;
  366. }
  367. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  368. if (result < 0) {
  369. result = -result;
  370. }
  371. result = Math.floor(result + EPS);
  372. if (result === 0) {
  373. if (deviceDPR === 1 || !isIOS) {
  374. result = 1;
  375. } else {
  376. result = 0.5;
  377. }
  378. }
  379. return number < 0 ? -result : result;
  380. }
  381. var LOCALE_ZH_HANS = 'zh-Hans';
  382. var LOCALE_ZH_HANT = 'zh-Hant';
  383. var LOCALE_EN = 'en';
  384. var LOCALE_FR = 'fr';
  385. var LOCALE_ES = 'es';
  386. var messages = {};
  387. var locale;
  388. {
  389. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  390. }
  391. function initI18nMessages() {
  392. if (!isEnableLocale()) {
  393. return;
  394. }
  395. var localeKeys = Object.keys(__uniConfig.locales);
  396. if (localeKeys.length) {
  397. localeKeys.forEach(function (locale) {
  398. var curMessages = messages[locale];
  399. var userMessages = __uniConfig.locales[locale];
  400. if (curMessages) {
  401. Object.assign(curMessages, userMessages);
  402. } else {
  403. messages[locale] = userMessages;
  404. }
  405. });
  406. }
  407. }
  408. initI18nMessages();
  409. var i18n = (0, _uniI18n.initVueI18n)(
  410. locale,
  411. {});
  412. var t = i18n.t;
  413. var i18nMixin = i18n.mixin = {
  414. beforeCreate: function beforeCreate() {var _this = this;
  415. var unwatch = i18n.i18n.watchLocale(function () {
  416. _this.$forceUpdate();
  417. });
  418. this.$once('hook:beforeDestroy', function () {
  419. unwatch();
  420. });
  421. },
  422. methods: {
  423. $$t: function $$t(key, values) {
  424. return t(key, values);
  425. } } };
  426. var setLocale = i18n.setLocale;
  427. var getLocale = i18n.getLocale;
  428. function initAppLocale(Vue, appVm, locale) {
  429. var state = Vue.observable({
  430. locale: locale || i18n.getLocale() });
  431. var localeWatchers = [];
  432. appVm.$watchLocale = function (fn) {
  433. localeWatchers.push(fn);
  434. };
  435. Object.defineProperty(appVm, '$locale', {
  436. get: function get() {
  437. return state.locale;
  438. },
  439. set: function set(v) {
  440. state.locale = v;
  441. localeWatchers.forEach(function (watch) {return watch(v);});
  442. } });
  443. }
  444. function isEnableLocale() {
  445. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  446. }
  447. function include(str, parts) {
  448. return !!parts.find(function (part) {return str.indexOf(part) !== -1;});
  449. }
  450. function startsWith(str, parts) {
  451. return parts.find(function (part) {return str.indexOf(part) === 0;});
  452. }
  453. function normalizeLocale(locale, messages) {
  454. if (!locale) {
  455. return;
  456. }
  457. locale = locale.trim().replace(/_/g, '-');
  458. if (messages && messages[locale]) {
  459. return locale;
  460. }
  461. locale = locale.toLowerCase();
  462. if (locale === 'chinese') {
  463. // 支付宝
  464. return LOCALE_ZH_HANS;
  465. }
  466. if (locale.indexOf('zh') === 0) {
  467. if (locale.indexOf('-hans') > -1) {
  468. return LOCALE_ZH_HANS;
  469. }
  470. if (locale.indexOf('-hant') > -1) {
  471. return LOCALE_ZH_HANT;
  472. }
  473. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  474. return LOCALE_ZH_HANT;
  475. }
  476. return LOCALE_ZH_HANS;
  477. }
  478. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  479. if (lang) {
  480. return lang;
  481. }
  482. }
  483. // export function initI18n() {
  484. // const localeKeys = Object.keys(__uniConfig.locales || {})
  485. // if (localeKeys.length) {
  486. // localeKeys.forEach((locale) =>
  487. // i18n.add(locale, __uniConfig.locales[locale])
  488. // )
  489. // }
  490. // }
  491. function getLocale$1() {
  492. // 优先使用 $locale
  493. var app = getApp({
  494. allowDefault: true });
  495. if (app && app.$vm) {
  496. return app.$vm.$locale;
  497. }
  498. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  499. }
  500. function setLocale$1(locale) {
  501. var app = getApp();
  502. if (!app) {
  503. return false;
  504. }
  505. var oldLocale = app.$vm.$locale;
  506. if (oldLocale !== locale) {
  507. app.$vm.$locale = locale;
  508. onLocaleChangeCallbacks.forEach(function (fn) {return fn({
  509. locale: locale });});
  510. return true;
  511. }
  512. return false;
  513. }
  514. var onLocaleChangeCallbacks = [];
  515. function onLocaleChange(fn) {
  516. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  517. onLocaleChangeCallbacks.push(fn);
  518. }
  519. }
  520. if (typeof global !== 'undefined') {
  521. global.getLocale = getLocale$1;
  522. }
  523. var interceptors = {
  524. promiseInterceptor: promiseInterceptor };
  525. var baseApi = /*#__PURE__*/Object.freeze({
  526. __proto__: null,
  527. upx2px: upx2px,
  528. getLocale: getLocale$1,
  529. setLocale: setLocale$1,
  530. onLocaleChange: onLocaleChange,
  531. addInterceptor: addInterceptor,
  532. removeInterceptor: removeInterceptor,
  533. interceptors: interceptors });
  534. function findExistsPageIndex(url) {
  535. var pages = getCurrentPages();
  536. var len = pages.length;
  537. while (len--) {
  538. var page = pages[len];
  539. if (page.$page && page.$page.fullPath === url) {
  540. return len;
  541. }
  542. }
  543. return -1;
  544. }
  545. var redirectTo = {
  546. name: function name(fromArgs) {
  547. if (fromArgs.exists === 'back' && fromArgs.delta) {
  548. return 'navigateBack';
  549. }
  550. return 'redirectTo';
  551. },
  552. args: function args(fromArgs) {
  553. if (fromArgs.exists === 'back' && fromArgs.url) {
  554. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  555. if (existsPageIndex !== -1) {
  556. var delta = getCurrentPages().length - 1 - existsPageIndex;
  557. if (delta > 0) {
  558. fromArgs.delta = delta;
  559. }
  560. }
  561. }
  562. } };
  563. var previewImage = {
  564. args: function args(fromArgs) {
  565. var currentIndex = parseInt(fromArgs.current);
  566. if (isNaN(currentIndex)) {
  567. return;
  568. }
  569. var urls = fromArgs.urls;
  570. if (!Array.isArray(urls)) {
  571. return;
  572. }
  573. var len = urls.length;
  574. if (!len) {
  575. return;
  576. }
  577. if (currentIndex < 0) {
  578. currentIndex = 0;
  579. } else if (currentIndex >= len) {
  580. currentIndex = len - 1;
  581. }
  582. if (currentIndex > 0) {
  583. fromArgs.current = urls[currentIndex];
  584. fromArgs.urls = urls.filter(
  585. function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;});
  586. } else {
  587. fromArgs.current = urls[0];
  588. }
  589. return {
  590. indicator: false,
  591. loop: false };
  592. } };
  593. var UUID_KEY = '__DC_STAT_UUID';
  594. var deviceId;
  595. function useDeviceId(result) {
  596. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  597. if (!deviceId) {
  598. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  599. wx.setStorage({
  600. key: UUID_KEY,
  601. data: deviceId });
  602. }
  603. result.deviceId = deviceId;
  604. }
  605. function addSafeAreaInsets(result) {
  606. if (result.safeArea) {
  607. var safeArea = result.safeArea;
  608. result.safeAreaInsets = {
  609. top: safeArea.top,
  610. left: safeArea.left,
  611. right: result.windowWidth - safeArea.right,
  612. bottom: result.screenHeight - safeArea.bottom };
  613. }
  614. }
  615. function populateParameters(result) {var _result$brand =
  616. result.brand,brand = _result$brand === void 0 ? '' : _result$brand,_result$model = result.model,model = _result$model === void 0 ? '' : _result$model,_result$system = result.system,system = _result$system === void 0 ? '' : _result$system,_result$language = result.language,language = _result$language === void 0 ? '' : _result$language,theme = result.theme,version = result.version,platform = result.platform,fontSizeSetting = result.fontSizeSetting,SDKVersion = result.SDKVersion,pixelRatio = result.pixelRatio,deviceOrientation = result.deviceOrientation;
  617. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  618. // osName osVersion
  619. var osName = '';
  620. var osVersion = '';
  621. {
  622. osName = system.split(' ')[0] || '';
  623. osVersion = system.split(' ')[1] || '';
  624. }
  625. var hostVersion = version;
  626. // deviceType
  627. var deviceType = getGetDeviceType(result, model);
  628. // deviceModel
  629. var deviceBrand = getDeviceBrand(brand);
  630. // hostName
  631. var _hostName = getHostName(result);
  632. // deviceOrientation
  633. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  634. // devicePixelRatio
  635. var _devicePixelRatio = pixelRatio;
  636. // SDKVersion
  637. var _SDKVersion = SDKVersion;
  638. // hostLanguage
  639. var hostLanguage = language.replace(/_/g, '-');
  640. // wx.getAccountInfoSync
  641. var parameters = {
  642. appId: "__UNI__C76B472",
  643. appName: "wechat",
  644. appVersion: "1.0.0",
  645. appVersionCode: "100",
  646. appLanguage: getAppLanguage(hostLanguage),
  647. uniCompileVersion: "3.4.15",
  648. uniRuntimeVersion: "3.4.15",
  649. uniPlatform: undefined || "mp-weixin",
  650. deviceBrand: deviceBrand,
  651. deviceModel: model,
  652. deviceType: deviceType,
  653. devicePixelRatio: _devicePixelRatio,
  654. deviceOrientation: _deviceOrientation,
  655. osName: osName.toLocaleLowerCase(),
  656. osVersion: osVersion,
  657. hostTheme: theme,
  658. hostVersion: hostVersion,
  659. hostLanguage: hostLanguage,
  660. hostName: _hostName,
  661. hostSDKVersion: _SDKVersion,
  662. hostFontSizeSetting: fontSizeSetting,
  663. windowTop: 0,
  664. windowBottom: 0,
  665. // TODO
  666. osLanguage: undefined,
  667. osTheme: undefined,
  668. ua: undefined,
  669. hostPackageName: undefined,
  670. browserName: undefined,
  671. browserVersion: undefined };
  672. Object.assign(result, parameters);
  673. }
  674. function getGetDeviceType(result, model) {
  675. var deviceType = result.deviceType || 'phone';
  676. {
  677. var deviceTypeMaps = {
  678. ipad: 'pad',
  679. windows: 'pc',
  680. mac: 'pc' };
  681. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  682. var _model = model.toLocaleLowerCase();
  683. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  684. var _m = deviceTypeMapsKeys[index];
  685. if (_model.indexOf(_m) !== -1) {
  686. deviceType = deviceTypeMaps[_m];
  687. break;
  688. }
  689. }
  690. }
  691. return deviceType;
  692. }
  693. function getDeviceBrand(brand) {
  694. var deviceBrand = brand;
  695. if (deviceBrand) {
  696. deviceBrand = brand.toLocaleLowerCase();
  697. }
  698. return deviceBrand;
  699. }
  700. function getAppLanguage(defaultLanguage) {
  701. return getLocale$1 ?
  702. getLocale$1() :
  703. defaultLanguage;
  704. }
  705. function getHostName(result) {
  706. var _platform = 'WeChat';
  707. var _hostName = result.hostName || _platform; // mp-jd
  708. {
  709. if (result.environment) {
  710. _hostName = result.environment;
  711. } else if (result.host && result.host.env) {
  712. _hostName = result.host.env;
  713. }
  714. }
  715. return _hostName;
  716. }
  717. var getSystemInfo = {
  718. returnValue: function returnValue(result) {
  719. useDeviceId(result);
  720. addSafeAreaInsets(result);
  721. populateParameters(result);
  722. } };
  723. var showActionSheet = {
  724. args: function args(fromArgs) {
  725. if (typeof fromArgs === 'object') {
  726. fromArgs.alertText = fromArgs.title;
  727. }
  728. } };
  729. var getAppBaseInfo = {
  730. returnValue: function returnValue(result) {var _result =
  731. result,version = _result.version,language = _result.language,SDKVersion = _result.SDKVersion,theme = _result.theme;
  732. var _hostName = getHostName(result);
  733. var hostLanguage = language.replace('_', '-');
  734. result = sortObject(Object.assign(result, {
  735. appId: "__UNI__C76B472",
  736. appName: "wechat",
  737. appVersion: "1.0.0",
  738. appVersionCode: "100",
  739. appLanguage: getAppLanguage(hostLanguage),
  740. hostVersion: version,
  741. hostLanguage: hostLanguage,
  742. hostName: _hostName,
  743. hostSDKVersion: SDKVersion,
  744. hostTheme: theme }));
  745. } };
  746. var getDeviceInfo = {
  747. returnValue: function returnValue(result) {var _result2 =
  748. result,brand = _result2.brand,model = _result2.model;
  749. var deviceType = getGetDeviceType(result, model);
  750. var deviceBrand = getDeviceBrand(brand);
  751. useDeviceId(result);
  752. result = sortObject(Object.assign(result, {
  753. deviceType: deviceType,
  754. deviceBrand: deviceBrand,
  755. deviceModel: model }));
  756. } };
  757. var getWindowInfo = {
  758. returnValue: function returnValue(result) {
  759. addSafeAreaInsets(result);
  760. result = sortObject(Object.assign(result, {
  761. windowTop: 0,
  762. windowBottom: 0 }));
  763. } };
  764. // import navigateTo from 'uni-helpers/navigate-to'
  765. var protocols = {
  766. redirectTo: redirectTo,
  767. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  768. previewImage: previewImage,
  769. getSystemInfo: getSystemInfo,
  770. getSystemInfoSync: getSystemInfo,
  771. showActionSheet: showActionSheet,
  772. getAppBaseInfo: getAppBaseInfo,
  773. getDeviceInfo: getDeviceInfo,
  774. getWindowInfo: getWindowInfo };
  775. var todos = [
  776. 'vibrate',
  777. 'preloadPage',
  778. 'unPreloadPage',
  779. 'loadSubPackage'];
  780. var canIUses = [];
  781. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  782. function processCallback(methodName, method, returnValue) {
  783. return function (res) {
  784. return method(processReturnValue(methodName, res, returnValue));
  785. };
  786. }
  787. function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  788. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  789. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  790. if (isFn(argsOption)) {
  791. argsOption = argsOption(fromArgs, toArgs) || {};
  792. }
  793. for (var key in fromArgs) {
  794. if (hasOwn(argsOption, key)) {
  795. var keyOption = argsOption[key];
  796. if (isFn(keyOption)) {
  797. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  798. }
  799. if (!keyOption) {// 不支持的参数
  800. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  801. } else if (isStr(keyOption)) {// 重写参数 key
  802. toArgs[keyOption] = fromArgs[key];
  803. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  804. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  805. }
  806. } else if (CALLBACKS.indexOf(key) !== -1) {
  807. if (isFn(fromArgs[key])) {
  808. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  809. }
  810. } else {
  811. if (!keepFromArgs) {
  812. toArgs[key] = fromArgs[key];
  813. }
  814. }
  815. }
  816. return toArgs;
  817. } else if (isFn(fromArgs)) {
  818. fromArgs = processCallback(methodName, fromArgs, returnValue);
  819. }
  820. return fromArgs;
  821. }
  822. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  823. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  824. res = protocols.returnValue(methodName, res);
  825. }
  826. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  827. }
  828. function wrapper(methodName, method) {
  829. if (hasOwn(protocols, methodName)) {
  830. var protocol = protocols[methodName];
  831. if (!protocol) {// 暂不支持的 api
  832. return function () {
  833. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  834. };
  835. }
  836. return function (arg1, arg2) {// 目前 api 最多两个参数
  837. var options = protocol;
  838. if (isFn(protocol)) {
  839. options = protocol(arg1);
  840. }
  841. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  842. var args = [arg1];
  843. if (typeof arg2 !== 'undefined') {
  844. args.push(arg2);
  845. }
  846. if (isFn(options.name)) {
  847. methodName = options.name(arg1);
  848. } else if (isStr(options.name)) {
  849. methodName = options.name;
  850. }
  851. var returnValue = wx[methodName].apply(wx, args);
  852. if (isSyncApi(methodName)) {// 同步 api
  853. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  854. }
  855. return returnValue;
  856. };
  857. }
  858. return method;
  859. }
  860. var todoApis = Object.create(null);
  861. var TODOS = [
  862. 'onTabBarMidButtonTap',
  863. 'subscribePush',
  864. 'unsubscribePush',
  865. 'onPush',
  866. 'offPush',
  867. 'share'];
  868. function createTodoApi(name) {
  869. return function todoApi(_ref)
  870. {var fail = _ref.fail,complete = _ref.complete;
  871. var res = {
  872. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported") };
  873. isFn(fail) && fail(res);
  874. isFn(complete) && complete(res);
  875. };
  876. }
  877. TODOS.forEach(function (name) {
  878. todoApis[name] = createTodoApi(name);
  879. });
  880. var providers = {
  881. oauth: ['weixin'],
  882. share: ['weixin'],
  883. payment: ['wxpay'],
  884. push: ['weixin'] };
  885. function getProvider(_ref2)
  886. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  887. var res = false;
  888. if (providers[service]) {
  889. res = {
  890. errMsg: 'getProvider:ok',
  891. service: service,
  892. provider: providers[service] };
  893. isFn(success) && success(res);
  894. } else {
  895. res = {
  896. errMsg: 'getProvider:fail service not found' };
  897. isFn(fail) && fail(res);
  898. }
  899. isFn(complete) && complete(res);
  900. }
  901. var extraApi = /*#__PURE__*/Object.freeze({
  902. __proto__: null,
  903. getProvider: getProvider });
  904. var getEmitter = function () {
  905. var Emitter;
  906. return function getUniEmitter() {
  907. if (!Emitter) {
  908. Emitter = new _vue.default();
  909. }
  910. return Emitter;
  911. };
  912. }();
  913. function apply(ctx, method, args) {
  914. return ctx[method].apply(ctx, args);
  915. }
  916. function $on() {
  917. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  918. }
  919. function $off() {
  920. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  921. }
  922. function $once() {
  923. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  924. }
  925. function $emit() {
  926. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  927. }
  928. var eventApi = /*#__PURE__*/Object.freeze({
  929. __proto__: null,
  930. $on: $on,
  931. $off: $off,
  932. $once: $once,
  933. $emit: $emit });
  934. /**
  935. * 框架内 try-catch
  936. */
  937. /**
  938. * 开发者 try-catch
  939. */
  940. function tryCatch(fn) {
  941. return function () {
  942. try {
  943. return fn.apply(fn, arguments);
  944. } catch (e) {
  945. // TODO
  946. console.error(e);
  947. }
  948. };
  949. }
  950. function getApiCallbacks(params) {
  951. var apiCallbacks = {};
  952. for (var name in params) {
  953. var param = params[name];
  954. if (isFn(param)) {
  955. apiCallbacks[name] = tryCatch(param);
  956. delete params[name];
  957. }
  958. }
  959. return apiCallbacks;
  960. }
  961. var cid;
  962. var cidErrMsg;
  963. function normalizePushMessage(message) {
  964. try {
  965. return JSON.parse(message);
  966. } catch (e) {}
  967. return message;
  968. }
  969. function invokePushCallback(
  970. args)
  971. {
  972. if (args.type === 'clientId') {
  973. cid = args.cid;
  974. cidErrMsg = args.errMsg;
  975. invokeGetPushCidCallbacks(cid, args.errMsg);
  976. } else if (args.type === 'pushMsg') {
  977. onPushMessageCallbacks.forEach(function (callback) {
  978. callback({
  979. type: 'receive',
  980. data: normalizePushMessage(args.message) });
  981. });
  982. } else if (args.type === 'click') {
  983. onPushMessageCallbacks.forEach(function (callback) {
  984. callback({
  985. type: 'click',
  986. data: normalizePushMessage(args.message) });
  987. });
  988. }
  989. }
  990. var getPushCidCallbacks = [];
  991. function invokeGetPushCidCallbacks(cid, errMsg) {
  992. getPushCidCallbacks.forEach(function (callback) {
  993. callback(cid, errMsg);
  994. });
  995. getPushCidCallbacks.length = 0;
  996. }
  997. function getPushClientid(args) {
  998. if (!isPlainObject(args)) {
  999. args = {};
  1000. }var _getApiCallbacks =
  1001. getApiCallbacks(args),success = _getApiCallbacks.success,fail = _getApiCallbacks.fail,complete = _getApiCallbacks.complete;
  1002. var hasSuccess = isFn(success);
  1003. var hasFail = isFn(fail);
  1004. var hasComplete = isFn(complete);
  1005. getPushCidCallbacks.push(function (cid, errMsg) {
  1006. var res;
  1007. if (cid) {
  1008. res = {
  1009. errMsg: 'getPushClientid:ok',
  1010. cid: cid };
  1011. hasSuccess && success(res);
  1012. } else {
  1013. res = {
  1014. errMsg: 'getPushClientid:fail' + (errMsg ? ' ' + errMsg : '') };
  1015. hasFail && fail(res);
  1016. }
  1017. hasComplete && complete(res);
  1018. });
  1019. if (typeof cid !== 'undefined') {
  1020. Promise.resolve().then(function () {return invokeGetPushCidCallbacks(cid, cidErrMsg);});
  1021. }
  1022. }
  1023. var onPushMessageCallbacks = [];
  1024. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1025. var onPushMessage = function onPushMessage(fn) {
  1026. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1027. onPushMessageCallbacks.push(fn);
  1028. }
  1029. };
  1030. var offPushMessage = function offPushMessage(fn) {
  1031. if (!fn) {
  1032. onPushMessageCallbacks.length = 0;
  1033. } else {
  1034. var index = onPushMessageCallbacks.indexOf(fn);
  1035. if (index > -1) {
  1036. onPushMessageCallbacks.splice(index, 1);
  1037. }
  1038. }
  1039. };
  1040. var api = /*#__PURE__*/Object.freeze({
  1041. __proto__: null,
  1042. getPushClientid: getPushClientid,
  1043. onPushMessage: onPushMessage,
  1044. offPushMessage: offPushMessage,
  1045. invokePushCallback: invokePushCallback });
  1046. var MPPage = Page;
  1047. var MPComponent = Component;
  1048. var customizeRE = /:/g;
  1049. var customize = cached(function (str) {
  1050. return camelize(str.replace(customizeRE, '-'));
  1051. });
  1052. function initTriggerEvent(mpInstance) {
  1053. var oldTriggerEvent = mpInstance.triggerEvent;
  1054. var newTriggerEvent = function newTriggerEvent(event) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}
  1055. return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args));
  1056. };
  1057. try {
  1058. // 京东小程序 triggerEvent 为只读
  1059. mpInstance.triggerEvent = newTriggerEvent;
  1060. } catch (error) {
  1061. mpInstance._triggerEvent = newTriggerEvent;
  1062. }
  1063. }
  1064. function initHook(name, options, isComponent) {
  1065. var oldHook = options[name];
  1066. if (!oldHook) {
  1067. options[name] = function () {
  1068. initTriggerEvent(this);
  1069. };
  1070. } else {
  1071. options[name] = function () {
  1072. initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}
  1073. return oldHook.apply(this, args);
  1074. };
  1075. }
  1076. }
  1077. if (!MPPage.__$wrappered) {
  1078. MPPage.__$wrappered = true;
  1079. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1080. initHook('onLoad', options);
  1081. return MPPage(options);
  1082. };
  1083. Page.after = MPPage.after;
  1084. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1085. initHook('created', options);
  1086. return MPComponent(options);
  1087. };
  1088. }
  1089. var PAGE_EVENT_HOOKS = [
  1090. 'onPullDownRefresh',
  1091. 'onReachBottom',
  1092. 'onAddToFavorites',
  1093. 'onShareTimeline',
  1094. 'onShareAppMessage',
  1095. 'onPageScroll',
  1096. 'onResize',
  1097. 'onTabItemTap'];
  1098. function initMocks(vm, mocks) {
  1099. var mpInstance = vm.$mp[vm.mpType];
  1100. mocks.forEach(function (mock) {
  1101. if (hasOwn(mpInstance, mock)) {
  1102. vm[mock] = mpInstance[mock];
  1103. }
  1104. });
  1105. }
  1106. function hasHook(hook, vueOptions) {
  1107. if (!vueOptions) {
  1108. return true;
  1109. }
  1110. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1111. return true;
  1112. }
  1113. vueOptions = vueOptions.default || vueOptions;
  1114. if (isFn(vueOptions)) {
  1115. if (isFn(vueOptions.extendOptions[hook])) {
  1116. return true;
  1117. }
  1118. if (vueOptions.super &&
  1119. vueOptions.super.options &&
  1120. Array.isArray(vueOptions.super.options[hook])) {
  1121. return true;
  1122. }
  1123. return false;
  1124. }
  1125. if (isFn(vueOptions[hook])) {
  1126. return true;
  1127. }
  1128. var mixins = vueOptions.mixins;
  1129. if (Array.isArray(mixins)) {
  1130. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  1131. }
  1132. }
  1133. function initHooks(mpOptions, hooks, vueOptions) {
  1134. hooks.forEach(function (hook) {
  1135. if (hasHook(hook, vueOptions)) {
  1136. mpOptions[hook] = function (args) {
  1137. return this.$vm && this.$vm.__call_hook(hook, args);
  1138. };
  1139. }
  1140. });
  1141. }
  1142. function initVueComponent(Vue, vueOptions) {
  1143. vueOptions = vueOptions.default || vueOptions;
  1144. var VueComponent;
  1145. if (isFn(vueOptions)) {
  1146. VueComponent = vueOptions;
  1147. } else {
  1148. VueComponent = Vue.extend(vueOptions);
  1149. }
  1150. vueOptions = VueComponent.options;
  1151. return [VueComponent, vueOptions];
  1152. }
  1153. function initSlots(vm, vueSlots) {
  1154. if (Array.isArray(vueSlots) && vueSlots.length) {
  1155. var $slots = Object.create(null);
  1156. vueSlots.forEach(function (slotName) {
  1157. $slots[slotName] = true;
  1158. });
  1159. vm.$scopedSlots = vm.$slots = $slots;
  1160. }
  1161. }
  1162. function initVueIds(vueIds, mpInstance) {
  1163. vueIds = (vueIds || '').split(',');
  1164. var len = vueIds.length;
  1165. if (len === 1) {
  1166. mpInstance._$vueId = vueIds[0];
  1167. } else if (len === 2) {
  1168. mpInstance._$vueId = vueIds[0];
  1169. mpInstance._$vuePid = vueIds[1];
  1170. }
  1171. }
  1172. function initData(vueOptions, context) {
  1173. var data = vueOptions.data || {};
  1174. var methods = vueOptions.methods || {};
  1175. if (typeof data === 'function') {
  1176. try {
  1177. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1178. } catch (e) {
  1179. if (Object({"NODE_ENV":"development","VUE_APP_NAME":"wechat","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1180. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1181. }
  1182. }
  1183. } else {
  1184. try {
  1185. // 对 data 格式化
  1186. data = JSON.parse(JSON.stringify(data));
  1187. } catch (e) {}
  1188. }
  1189. if (!isPlainObject(data)) {
  1190. data = {};
  1191. }
  1192. Object.keys(methods).forEach(function (methodName) {
  1193. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1194. data[methodName] = methods[methodName];
  1195. }
  1196. });
  1197. return data;
  1198. }
  1199. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1200. function createObserver(name) {
  1201. return function observer(newVal, oldVal) {
  1202. if (this.$vm) {
  1203. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1204. }
  1205. };
  1206. }
  1207. function initBehaviors(vueOptions, initBehavior) {
  1208. var vueBehaviors = vueOptions.behaviors;
  1209. var vueExtends = vueOptions.extends;
  1210. var vueMixins = vueOptions.mixins;
  1211. var vueProps = vueOptions.props;
  1212. if (!vueProps) {
  1213. vueOptions.props = vueProps = [];
  1214. }
  1215. var behaviors = [];
  1216. if (Array.isArray(vueBehaviors)) {
  1217. vueBehaviors.forEach(function (behavior) {
  1218. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1219. if (behavior === 'uni://form-field') {
  1220. if (Array.isArray(vueProps)) {
  1221. vueProps.push('name');
  1222. vueProps.push('value');
  1223. } else {
  1224. vueProps.name = {
  1225. type: String,
  1226. default: '' };
  1227. vueProps.value = {
  1228. type: [String, Number, Boolean, Array, Object, Date],
  1229. default: '' };
  1230. }
  1231. }
  1232. });
  1233. }
  1234. if (isPlainObject(vueExtends) && vueExtends.props) {
  1235. behaviors.push(
  1236. initBehavior({
  1237. properties: initProperties(vueExtends.props, true) }));
  1238. }
  1239. if (Array.isArray(vueMixins)) {
  1240. vueMixins.forEach(function (vueMixin) {
  1241. if (isPlainObject(vueMixin) && vueMixin.props) {
  1242. behaviors.push(
  1243. initBehavior({
  1244. properties: initProperties(vueMixin.props, true) }));
  1245. }
  1246. });
  1247. }
  1248. return behaviors;
  1249. }
  1250. function parsePropType(key, type, defaultValue, file) {
  1251. // [String]=>String
  1252. if (Array.isArray(type) && type.length === 1) {
  1253. return type[0];
  1254. }
  1255. return type;
  1256. }
  1257. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  1258. var properties = {};
  1259. if (!isBehavior) {
  1260. properties.vueId = {
  1261. type: String,
  1262. value: '' };
  1263. // 用于字节跳动小程序模拟抽象节点
  1264. properties.generic = {
  1265. type: Object,
  1266. value: null };
  1267. // scopedSlotsCompiler auto
  1268. properties.scopedSlotsCompiler = {
  1269. type: String,
  1270. value: '' };
  1271. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1272. type: null,
  1273. value: [],
  1274. observer: function observer(newVal, oldVal) {
  1275. var $slots = Object.create(null);
  1276. newVal.forEach(function (slotName) {
  1277. $slots[slotName] = true;
  1278. });
  1279. this.setData({
  1280. $slots: $slots });
  1281. } };
  1282. }
  1283. if (Array.isArray(props)) {// ['title']
  1284. props.forEach(function (key) {
  1285. properties[key] = {
  1286. type: null,
  1287. observer: createObserver(key) };
  1288. });
  1289. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  1290. Object.keys(props).forEach(function (key) {
  1291. var opts = props[key];
  1292. if (isPlainObject(opts)) {// title:{type:String,default:''}
  1293. var value = opts.default;
  1294. if (isFn(value)) {
  1295. value = value();
  1296. }
  1297. opts.type = parsePropType(key, opts.type);
  1298. properties[key] = {
  1299. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1300. value: value,
  1301. observer: createObserver(key) };
  1302. } else {// content:String
  1303. var type = parsePropType(key, opts);
  1304. properties[key] = {
  1305. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1306. observer: createObserver(key) };
  1307. }
  1308. });
  1309. }
  1310. return properties;
  1311. }
  1312. function wrapper$1(event) {
  1313. // TODO 又得兼容 mpvue 的 mp 对象
  1314. try {
  1315. event.mp = JSON.parse(JSON.stringify(event));
  1316. } catch (e) {}
  1317. event.stopPropagation = noop;
  1318. event.preventDefault = noop;
  1319. event.target = event.target || {};
  1320. if (!hasOwn(event, 'detail')) {
  1321. event.detail = {};
  1322. }
  1323. if (hasOwn(event, 'markerId')) {
  1324. event.detail = typeof event.detail === 'object' ? event.detail : {};
  1325. event.detail.markerId = event.markerId;
  1326. }
  1327. if (isPlainObject(event.detail)) {
  1328. event.target = Object.assign({}, event.target, event.detail);
  1329. }
  1330. return event;
  1331. }
  1332. function getExtraValue(vm, dataPathsArray) {
  1333. var context = vm;
  1334. dataPathsArray.forEach(function (dataPathArray) {
  1335. var dataPath = dataPathArray[0];
  1336. var value = dataPathArray[2];
  1337. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  1338. var propPath = dataPathArray[1];
  1339. var valuePath = dataPathArray[3];
  1340. var vFor;
  1341. if (Number.isInteger(dataPath)) {
  1342. vFor = dataPath;
  1343. } else if (!dataPath) {
  1344. vFor = context;
  1345. } else if (typeof dataPath === 'string' && dataPath) {
  1346. if (dataPath.indexOf('#s#') === 0) {
  1347. vFor = dataPath.substr(3);
  1348. } else {
  1349. vFor = vm.__get_value(dataPath, context);
  1350. }
  1351. }
  1352. if (Number.isInteger(vFor)) {
  1353. context = value;
  1354. } else if (!propPath) {
  1355. context = vFor[value];
  1356. } else {
  1357. if (Array.isArray(vFor)) {
  1358. context = vFor.find(function (vForItem) {
  1359. return vm.__get_value(propPath, vForItem) === value;
  1360. });
  1361. } else if (isPlainObject(vFor)) {
  1362. context = Object.keys(vFor).find(function (vForKey) {
  1363. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1364. });
  1365. } else {
  1366. console.error('v-for 暂不支持循环数据:', vFor);
  1367. }
  1368. }
  1369. if (valuePath) {
  1370. context = vm.__get_value(valuePath, context);
  1371. }
  1372. }
  1373. });
  1374. return context;
  1375. }
  1376. function processEventExtra(vm, extra, event) {
  1377. var extraObj = {};
  1378. if (Array.isArray(extra) && extra.length) {
  1379. /**
  1380. *[
  1381. * ['data.items', 'data.id', item.data.id],
  1382. * ['metas', 'id', meta.id]
  1383. *],
  1384. *[
  1385. * ['data.items', 'data.id', item.data.id],
  1386. * ['metas', 'id', meta.id]
  1387. *],
  1388. *'test'
  1389. */
  1390. extra.forEach(function (dataPath, index) {
  1391. if (typeof dataPath === 'string') {
  1392. if (!dataPath) {// model,prop.sync
  1393. extraObj['$' + index] = vm;
  1394. } else {
  1395. if (dataPath === '$event') {// $event
  1396. extraObj['$' + index] = event;
  1397. } else if (dataPath === 'arguments') {
  1398. if (event.detail && event.detail.__args__) {
  1399. extraObj['$' + index] = event.detail.__args__;
  1400. } else {
  1401. extraObj['$' + index] = [event];
  1402. }
  1403. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  1404. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1405. } else {
  1406. extraObj['$' + index] = vm.__get_value(dataPath);
  1407. }
  1408. }
  1409. } else {
  1410. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1411. }
  1412. });
  1413. }
  1414. return extraObj;
  1415. }
  1416. function getObjByArray(arr) {
  1417. var obj = {};
  1418. for (var i = 1; i < arr.length; i++) {
  1419. var element = arr[i];
  1420. obj[element[0]] = element[1];
  1421. }
  1422. return obj;
  1423. }
  1424. function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1425. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1426. if (isCustom) {// 自定义事件
  1427. isCustomMPEvent = event.currentTarget &&
  1428. event.currentTarget.dataset &&
  1429. event.currentTarget.dataset.comType === 'wx';
  1430. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  1431. if (isCustomMPEvent) {
  1432. return [event];
  1433. }
  1434. return event.detail.__args__ || event.detail;
  1435. }
  1436. }
  1437. var extraObj = processEventExtra(vm, extra, event);
  1438. var ret = [];
  1439. args.forEach(function (arg) {
  1440. if (arg === '$event') {
  1441. if (methodName === '__set_model' && !isCustom) {// input v-model value
  1442. ret.push(event.target.value);
  1443. } else {
  1444. if (isCustom && !isCustomMPEvent) {
  1445. ret.push(event.detail.__args__[0]);
  1446. } else {// wxcomponent 组件或内置组件
  1447. ret.push(event);
  1448. }
  1449. }
  1450. } else {
  1451. if (Array.isArray(arg) && arg[0] === 'o') {
  1452. ret.push(getObjByArray(arg));
  1453. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1454. ret.push(extraObj[arg]);
  1455. } else {
  1456. ret.push(arg);
  1457. }
  1458. }
  1459. });
  1460. return ret;
  1461. }
  1462. var ONCE = '~';
  1463. var CUSTOM = '^';
  1464. function isMatchEventType(eventType, optType) {
  1465. return eventType === optType ||
  1466. optType === 'regionchange' && (
  1467. eventType === 'begin' ||
  1468. eventType === 'end');
  1469. }
  1470. function getContextVm(vm) {
  1471. var $parent = vm.$parent;
  1472. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1473. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1474. $parent = $parent.$parent;
  1475. }
  1476. return $parent && $parent.$parent;
  1477. }
  1478. function handleEvent(event) {var _this2 = this;
  1479. event = wrapper$1(event);
  1480. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1481. var dataset = (event.currentTarget || event.target).dataset;
  1482. if (!dataset) {
  1483. return console.warn('事件信息不存在');
  1484. }
  1485. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1486. if (!eventOpts) {
  1487. return console.warn('事件信息不存在');
  1488. }
  1489. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1490. var eventType = event.type;
  1491. var ret = [];
  1492. eventOpts.forEach(function (eventOpt) {
  1493. var type = eventOpt[0];
  1494. var eventsArray = eventOpt[1];
  1495. var isCustom = type.charAt(0) === CUSTOM;
  1496. type = isCustom ? type.slice(1) : type;
  1497. var isOnce = type.charAt(0) === ONCE;
  1498. type = isOnce ? type.slice(1) : type;
  1499. if (eventsArray && isMatchEventType(eventType, type)) {
  1500. eventsArray.forEach(function (eventArray) {
  1501. var methodName = eventArray[0];
  1502. if (methodName) {
  1503. var handlerCtx = _this2.$vm;
  1504. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1505. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1506. }
  1507. if (methodName === '$emit') {
  1508. handlerCtx.$emit.apply(handlerCtx,
  1509. processEventArgs(
  1510. _this2.$vm,
  1511. event,
  1512. eventArray[1],
  1513. eventArray[2],
  1514. isCustom,
  1515. methodName));
  1516. return;
  1517. }
  1518. var handler = handlerCtx[methodName];
  1519. if (!isFn(handler)) {
  1520. throw new Error(" _vm.".concat(methodName, " is not a function"));
  1521. }
  1522. if (isOnce) {
  1523. if (handler.once) {
  1524. return;
  1525. }
  1526. handler.once = true;
  1527. }
  1528. var params = processEventArgs(
  1529. _this2.$vm,
  1530. event,
  1531. eventArray[1],
  1532. eventArray[2],
  1533. isCustom,
  1534. methodName);
  1535. params = Array.isArray(params) ? params : [];
  1536. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1537. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1538. // eslint-disable-next-line no-sparse-arrays
  1539. params = params.concat([,,,,,,,,,, event]);
  1540. }
  1541. ret.push(handler.apply(handlerCtx, params));
  1542. }
  1543. });
  1544. }
  1545. });
  1546. if (
  1547. eventType === 'input' &&
  1548. ret.length === 1 &&
  1549. typeof ret[0] !== 'undefined')
  1550. {
  1551. return ret[0];
  1552. }
  1553. }
  1554. var eventChannels = {};
  1555. var eventChannelStack = [];
  1556. function getEventChannel(id) {
  1557. if (id) {
  1558. var eventChannel = eventChannels[id];
  1559. delete eventChannels[id];
  1560. return eventChannel;
  1561. }
  1562. return eventChannelStack.shift();
  1563. }
  1564. var hooks = [
  1565. 'onShow',
  1566. 'onHide',
  1567. 'onError',
  1568. 'onPageNotFound',
  1569. 'onThemeChange',
  1570. 'onUnhandledRejection'];
  1571. function initEventChannel() {
  1572. _vue.default.prototype.getOpenerEventChannel = function () {
  1573. // 微信小程序使用自身getOpenerEventChannel
  1574. {
  1575. return this.$scope.getOpenerEventChannel();
  1576. }
  1577. };
  1578. var callHook = _vue.default.prototype.__call_hook;
  1579. _vue.default.prototype.__call_hook = function (hook, args) {
  1580. if (hook === 'onLoad' && args && args.__id__) {
  1581. this.__eventChannel__ = getEventChannel(args.__id__);
  1582. delete args.__id__;
  1583. }
  1584. return callHook.call(this, hook, args);
  1585. };
  1586. }
  1587. function initScopedSlotsParams() {
  1588. var center = {};
  1589. var parents = {};
  1590. _vue.default.prototype.$hasScopedSlotsParams = function (vueId) {
  1591. var has = center[vueId];
  1592. if (!has) {
  1593. parents[vueId] = this;
  1594. this.$on('hook:destroyed', function () {
  1595. delete parents[vueId];
  1596. });
  1597. }
  1598. return has;
  1599. };
  1600. _vue.default.prototype.$getScopedSlotsParams = function (vueId, name, key) {
  1601. var data = center[vueId];
  1602. if (data) {
  1603. var object = data[name] || {};
  1604. return key ? object[key] : object;
  1605. } else {
  1606. parents[vueId] = this;
  1607. this.$on('hook:destroyed', function () {
  1608. delete parents[vueId];
  1609. });
  1610. }
  1611. };
  1612. _vue.default.prototype.$setScopedSlotsParams = function (name, value) {
  1613. var vueIds = this.$options.propsData.vueId;
  1614. if (vueIds) {
  1615. var vueId = vueIds.split(',')[0];
  1616. var object = center[vueId] = center[vueId] || {};
  1617. object[name] = value;
  1618. if (parents[vueId]) {
  1619. parents[vueId].$forceUpdate();
  1620. }
  1621. }
  1622. };
  1623. _vue.default.mixin({
  1624. destroyed: function destroyed() {
  1625. var propsData = this.$options.propsData;
  1626. var vueId = propsData && propsData.vueId;
  1627. if (vueId) {
  1628. delete center[vueId];
  1629. delete parents[vueId];
  1630. }
  1631. } });
  1632. }
  1633. function parseBaseApp(vm, _ref3)
  1634. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1635. initEventChannel();
  1636. {
  1637. initScopedSlotsParams();
  1638. }
  1639. if (vm.$options.store) {
  1640. _vue.default.prototype.$store = vm.$options.store;
  1641. }
  1642. uniIdMixin(_vue.default);
  1643. _vue.default.prototype.mpHost = "mp-weixin";
  1644. _vue.default.mixin({
  1645. beforeCreate: function beforeCreate() {
  1646. if (!this.$options.mpType) {
  1647. return;
  1648. }
  1649. this.mpType = this.$options.mpType;
  1650. this.$mp = _defineProperty({
  1651. data: {} },
  1652. this.mpType, this.$options.mpInstance);
  1653. this.$scope = this.$options.mpInstance;
  1654. delete this.$options.mpType;
  1655. delete this.$options.mpInstance;
  1656. if (this.mpType === 'page' && typeof getApp === 'function') {// hack vue-i18n
  1657. var app = getApp();
  1658. if (app.$vm && app.$vm.$i18n) {
  1659. this._i18n = app.$vm.$i18n;
  1660. }
  1661. }
  1662. if (this.mpType !== 'app') {
  1663. initRefs(this);
  1664. initMocks(this, mocks);
  1665. }
  1666. } });
  1667. var appOptions = {
  1668. onLaunch: function onLaunch(args) {
  1669. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1670. return;
  1671. }
  1672. {
  1673. if (wx.canIUse && !wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1674. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1675. }
  1676. }
  1677. this.$vm = vm;
  1678. this.$vm.$mp = {
  1679. app: this };
  1680. this.$vm.$scope = this;
  1681. // vm 上也挂载 globalData
  1682. this.$vm.globalData = this.globalData;
  1683. this.$vm._isMounted = true;
  1684. this.$vm.__call_hook('mounted', args);
  1685. this.$vm.__call_hook('onLaunch', args);
  1686. } };
  1687. // 兼容旧版本 globalData
  1688. appOptions.globalData = vm.$options.globalData || {};
  1689. // 将 methods 中的方法挂在 getApp() 中
  1690. var methods = vm.$options.methods;
  1691. if (methods) {
  1692. Object.keys(methods).forEach(function (name) {
  1693. appOptions[name] = methods[name];
  1694. });
  1695. }
  1696. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  1697. initHooks(appOptions, hooks);
  1698. return appOptions;
  1699. }
  1700. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1701. function findVmByVueId(vm, vuePid) {
  1702. var $children = vm.$children;
  1703. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1704. for (var i = $children.length - 1; i >= 0; i--) {
  1705. var childVm = $children[i];
  1706. if (childVm.$scope._$vueId === vuePid) {
  1707. return childVm;
  1708. }
  1709. }
  1710. // 反向递归查找
  1711. var parentVm;
  1712. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1713. parentVm = findVmByVueId($children[_i], vuePid);
  1714. if (parentVm) {
  1715. return parentVm;
  1716. }
  1717. }
  1718. }
  1719. function initBehavior(options) {
  1720. return Behavior(options);
  1721. }
  1722. function isPage() {
  1723. return !!this.route;
  1724. }
  1725. function initRelation(detail) {
  1726. this.triggerEvent('__l', detail);
  1727. }
  1728. function selectAllComponents(mpInstance, selector, $refs) {
  1729. var components = mpInstance.selectAllComponents(selector);
  1730. components.forEach(function (component) {
  1731. var ref = component.dataset.ref;
  1732. $refs[ref] = component.$vm || component;
  1733. {
  1734. if (component.dataset.vueGeneric === 'scoped') {
  1735. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1736. selectAllComponents(scopedComponent, selector, $refs);
  1737. });
  1738. }
  1739. }
  1740. });
  1741. }
  1742. function initRefs(vm) {
  1743. var mpInstance = vm.$scope;
  1744. Object.defineProperty(vm, '$refs', {
  1745. get: function get() {
  1746. var $refs = {};
  1747. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1748. // TODO 暂不考虑 for 中的 scoped
  1749. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1750. forComponents.forEach(function (component) {
  1751. var ref = component.dataset.ref;
  1752. if (!$refs[ref]) {
  1753. $refs[ref] = [];
  1754. }
  1755. $refs[ref].push(component.$vm || component);
  1756. });
  1757. return $refs;
  1758. } });
  1759. }
  1760. function handleLink(event) {var _ref4 =
  1761. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1762. var parentVm;
  1763. if (vuePid) {
  1764. parentVm = findVmByVueId(this.$vm, vuePid);
  1765. }
  1766. if (!parentVm) {
  1767. parentVm = this.$vm;
  1768. }
  1769. vueOptions.parent = parentVm;
  1770. }
  1771. function parseApp(vm) {
  1772. return parseBaseApp(vm, {
  1773. mocks: mocks,
  1774. initRefs: initRefs });
  1775. }
  1776. function createApp(vm) {
  1777. App(parseApp(vm));
  1778. return vm;
  1779. }
  1780. var encodeReserveRE = /[!'()*]/g;
  1781. var encodeReserveReplacer = function encodeReserveReplacer(c) {return '%' + c.charCodeAt(0).toString(16);};
  1782. var commaRE = /%2C/g;
  1783. // fixed encodeURIComponent which is more conformant to RFC3986:
  1784. // - escapes [!'()*]
  1785. // - preserve commas
  1786. var encode = function encode(str) {return encodeURIComponent(str).
  1787. replace(encodeReserveRE, encodeReserveReplacer).
  1788. replace(commaRE, ',');};
  1789. function stringifyQuery(obj) {var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  1790. var res = obj ? Object.keys(obj).map(function (key) {
  1791. var val = obj[key];
  1792. if (val === undefined) {
  1793. return '';
  1794. }
  1795. if (val === null) {
  1796. return encodeStr(key);
  1797. }
  1798. if (Array.isArray(val)) {
  1799. var result = [];
  1800. val.forEach(function (val2) {
  1801. if (val2 === undefined) {
  1802. return;
  1803. }
  1804. if (val2 === null) {
  1805. result.push(encodeStr(key));
  1806. } else {
  1807. result.push(encodeStr(key) + '=' + encodeStr(val2));
  1808. }
  1809. });
  1810. return result.join('&');
  1811. }
  1812. return encodeStr(key) + '=' + encodeStr(val);
  1813. }).filter(function (x) {return x.length > 0;}).join('&') : null;
  1814. return res ? "?".concat(res) : '';
  1815. }
  1816. function parseBaseComponent(vueComponentOptions)
  1817. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1818. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1819. var options = _objectSpread({
  1820. multipleSlots: true,
  1821. addGlobalClass: true },
  1822. vueOptions.options || {});
  1823. {
  1824. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1825. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1826. Object.assign(options, vueOptions['mp-weixin'].options);
  1827. }
  1828. }
  1829. var componentOptions = {
  1830. options: options,
  1831. data: initData(vueOptions, _vue.default.prototype),
  1832. behaviors: initBehaviors(vueOptions, initBehavior),
  1833. properties: initProperties(vueOptions.props, false, vueOptions.__file),
  1834. lifetimes: {
  1835. attached: function attached() {
  1836. var properties = this.properties;
  1837. var options = {
  1838. mpType: isPage.call(this) ? 'page' : 'component',
  1839. mpInstance: this,
  1840. propsData: properties };
  1841. initVueIds(properties.vueId, this);
  1842. // 处理父子关系
  1843. initRelation.call(this, {
  1844. vuePid: this._$vuePid,
  1845. vueOptions: options });
  1846. // 初始化 vue 实例
  1847. this.$vm = new VueComponent(options);
  1848. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1849. initSlots(this.$vm, properties.vueSlots);
  1850. // 触发首次 setData
  1851. this.$vm.$mount();
  1852. },
  1853. ready: function ready() {
  1854. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1855. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1856. if (this.$vm) {
  1857. this.$vm._isMounted = true;
  1858. this.$vm.__call_hook('mounted');
  1859. this.$vm.__call_hook('onReady');
  1860. }
  1861. },
  1862. detached: function detached() {
  1863. this.$vm && this.$vm.$destroy();
  1864. } },
  1865. pageLifetimes: {
  1866. show: function show(args) {
  1867. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1868. },
  1869. hide: function hide() {
  1870. this.$vm && this.$vm.__call_hook('onPageHide');
  1871. },
  1872. resize: function resize(size) {
  1873. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1874. } },
  1875. methods: {
  1876. __l: handleLink,
  1877. __e: handleEvent } };
  1878. // externalClasses
  1879. if (vueOptions.externalClasses) {
  1880. componentOptions.externalClasses = vueOptions.externalClasses;
  1881. }
  1882. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1883. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1884. componentOptions.methods[callMethod] = function (args) {
  1885. return this.$vm[callMethod](args);
  1886. };
  1887. });
  1888. }
  1889. if (isPage) {
  1890. return componentOptions;
  1891. }
  1892. return [componentOptions, VueComponent];
  1893. }
  1894. function parseComponent(vueComponentOptions) {
  1895. return parseBaseComponent(vueComponentOptions, {
  1896. isPage: isPage,
  1897. initRelation: initRelation });
  1898. }
  1899. var hooks$1 = [
  1900. 'onShow',
  1901. 'onHide',
  1902. 'onUnload'];
  1903. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1904. function parseBasePage(vuePageOptions, _ref6)
  1905. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1906. var pageOptions = parseComponent(vuePageOptions);
  1907. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1908. pageOptions.methods.onLoad = function (query) {
  1909. this.options = query;
  1910. var copyQuery = Object.assign({}, query);
  1911. delete copyQuery.__id__;
  1912. this.$page = {
  1913. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery) };
  1914. this.$vm.$mp.query = query; // 兼容 mpvue
  1915. this.$vm.__call_hook('onLoad', query);
  1916. };
  1917. return pageOptions;
  1918. }
  1919. function parsePage(vuePageOptions) {
  1920. return parseBasePage(vuePageOptions, {
  1921. isPage: isPage,
  1922. initRelation: initRelation });
  1923. }
  1924. function createPage(vuePageOptions) {
  1925. {
  1926. return Component(parsePage(vuePageOptions));
  1927. }
  1928. }
  1929. function createComponent(vueOptions) {
  1930. {
  1931. return Component(parseComponent(vueOptions));
  1932. }
  1933. }
  1934. function createSubpackageApp(vm) {
  1935. var appOptions = parseApp(vm);
  1936. var app = getApp({
  1937. allowDefault: true });
  1938. vm.$scope = app;
  1939. var globalData = app.globalData;
  1940. if (globalData) {
  1941. Object.keys(appOptions.globalData).forEach(function (name) {
  1942. if (!hasOwn(globalData, name)) {
  1943. globalData[name] = appOptions.globalData[name];
  1944. }
  1945. });
  1946. }
  1947. Object.keys(appOptions).forEach(function (name) {
  1948. if (!hasOwn(app, name)) {
  1949. app[name] = appOptions[name];
  1950. }
  1951. });
  1952. if (isFn(appOptions.onShow) && wx.onAppShow) {
  1953. wx.onAppShow(function () {for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}
  1954. vm.__call_hook('onShow', args);
  1955. });
  1956. }
  1957. if (isFn(appOptions.onHide) && wx.onAppHide) {
  1958. wx.onAppHide(function () {for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}
  1959. vm.__call_hook('onHide', args);
  1960. });
  1961. }
  1962. if (isFn(appOptions.onLaunch)) {
  1963. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  1964. vm.__call_hook('onLaunch', args);
  1965. }
  1966. return vm;
  1967. }
  1968. function createPlugin(vm) {
  1969. var appOptions = parseApp(vm);
  1970. if (isFn(appOptions.onShow) && wx.onAppShow) {
  1971. wx.onAppShow(function () {for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {args[_key7] = arguments[_key7];}
  1972. vm.__call_hook('onShow', args);
  1973. });
  1974. }
  1975. if (isFn(appOptions.onHide) && wx.onAppHide) {
  1976. wx.onAppHide(function () {for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {args[_key8] = arguments[_key8];}
  1977. vm.__call_hook('onHide', args);
  1978. });
  1979. }
  1980. if (isFn(appOptions.onLaunch)) {
  1981. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  1982. vm.__call_hook('onLaunch', args);
  1983. }
  1984. return vm;
  1985. }
  1986. todos.forEach(function (todoApi) {
  1987. protocols[todoApi] = false;
  1988. });
  1989. canIUses.forEach(function (canIUseApi) {
  1990. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  1991. canIUseApi;
  1992. if (!wx.canIUse(apiName)) {
  1993. protocols[canIUseApi] = false;
  1994. }
  1995. });
  1996. var uni = {};
  1997. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  1998. uni = new Proxy({}, {
  1999. get: function get(target, name) {
  2000. if (hasOwn(target, name)) {
  2001. return target[name];
  2002. }
  2003. if (baseApi[name]) {
  2004. return baseApi[name];
  2005. }
  2006. if (api[name]) {
  2007. return promisify(name, api[name]);
  2008. }
  2009. {
  2010. if (extraApi[name]) {
  2011. return promisify(name, extraApi[name]);
  2012. }
  2013. if (todoApis[name]) {
  2014. return promisify(name, todoApis[name]);
  2015. }
  2016. }
  2017. if (eventApi[name]) {
  2018. return eventApi[name];
  2019. }
  2020. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  2021. return;
  2022. }
  2023. return promisify(name, wrapper(name, wx[name]));
  2024. },
  2025. set: function set(target, name, value) {
  2026. target[name] = value;
  2027. return true;
  2028. } });
  2029. } else {
  2030. Object.keys(baseApi).forEach(function (name) {
  2031. uni[name] = baseApi[name];
  2032. });
  2033. {
  2034. Object.keys(todoApis).forEach(function (name) {
  2035. uni[name] = promisify(name, todoApis[name]);
  2036. });
  2037. Object.keys(extraApi).forEach(function (name) {
  2038. uni[name] = promisify(name, todoApis[name]);
  2039. });
  2040. }
  2041. Object.keys(eventApi).forEach(function (name) {
  2042. uni[name] = eventApi[name];
  2043. });
  2044. Object.keys(api).forEach(function (name) {
  2045. uni[name] = promisify(name, api[name]);
  2046. });
  2047. Object.keys(wx).forEach(function (name) {
  2048. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2049. uni[name] = promisify(name, wrapper(name, wx[name]));
  2050. }
  2051. });
  2052. }
  2053. wx.createApp = createApp;
  2054. wx.createPage = createPage;
  2055. wx.createComponent = createComponent;
  2056. wx.createSubpackageApp = createSubpackageApp;
  2057. wx.createPlugin = createPlugin;
  2058. var uni$1 = uni;var _default =
  2059. uni$1;exports.default = _default;
  2060. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 2)))
  2061. /***/ }),
  2062. /***/ 106:
  2063. /*!************************************************************************************!*\
  2064. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js ***!
  2065. \************************************************************************************/
  2066. /*! no static exports found */
  2067. /***/ (function(module, exports, __webpack_require__) {
  2068. "use strict";
  2069. /* WEBPACK VAR INJECTION */(function(global, uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 107));var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 3);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _createForOfIteratorHelper(o, allowArrayLike) {var it;if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {if (it) o = it;var i = 0;var F = function F() {};return { s: F, n: function n() {if (i >= o.length) return { done: true };return { done: false, value: o[i++] };}, e: function e(_e27) {throw _e27;}, f: F };}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion = true,didErr = false,err;return { s: function s() {it = o[Symbol.iterator]();}, n: function n() {var step = it.next();normalCompletion = step.done;return step;}, e: function e(_e28) {didErr = true;err = _e28;}, f: function f() {try {if (!normalCompletion && it.return != null) it.return();} finally {if (didErr) throw err;}} };}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _createSuper(Derived) {var hasNativeReflectConstruct = _isNativeReflectConstruct();return function _createSuperInternal() {var Super = _getPrototypeOf(Derived),result;if (hasNativeReflectConstruct) {var NewTarget = _getPrototypeOf(this).constructor;result = Reflect.construct(Super, arguments, NewTarget);} else {result = Super.apply(this, arguments);}return _possibleConstructorReturn(this, result);};}function _possibleConstructorReturn(self, call) {if (call && (typeof call === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _wrapNativeSuper(Class) {var _cache = typeof Map === "function" ? new Map() : undefined;_wrapNativeSuper = function _wrapNativeSuper(Class) {if (Class === null || !_isNativeFunction(Class)) return Class;if (typeof Class !== "function") {throw new TypeError("Super expression must either be null or a function");}if (typeof _cache !== "undefined") {if (_cache.has(Class)) return _cache.get(Class);_cache.set(Class, Wrapper);}function Wrapper() {return _construct(Class, arguments, _getPrototypeOf(this).constructor);}Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } });return _setPrototypeOf(Wrapper, Class);};return _wrapNativeSuper(Class);}function _construct(Parent, args, Class) {if (_isNativeReflectConstruct()) {_construct = Reflect.construct;} else {_construct = function _construct(Parent, args, Class) {var a = [null];a.push.apply(a, args);var Constructor = Function.bind.apply(Parent, a);var instance = new Constructor();if (Class) _setPrototypeOf(instance, Class.prototype);return instance;};}return _construct.apply(null, arguments);}function _isNativeReflectConstruct() {if (typeof Reflect === "undefined" || !Reflect.construct) return false;if (Reflect.construct.sham) return false;if (typeof Proxy === "function") return true;try {Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));return true;} catch (e) {return false;}}function _isNativeFunction(fn) {return Function.toString.call(fn).indexOf("[native code]") !== -1;}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}"undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self;function t(e) {return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;}function n(e, t, n) {return e(n = { path: t, exports: {}, require: function require(e, t) {return function () {throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");}(null == t && n.path);} }, n.exports), n.exports;}var s = n(function (e, t) {var n;e.exports = (n = n || function (e, t) {var n = Object.create || function () {function e() {}return function (t) {var n;return e.prototype = t, n = new e(), e.prototype = null, n;};}(),s = {},o = s.lib = {},r = o.Base = { extend: function extend(e) {var t = n(this);return e && t.mixIn(e), t.hasOwnProperty("init") && this.init !== t.init || (t.init = function () {t.$super.init.apply(this, arguments);}), t.init.prototype = t, t.$super = this, t;}, create: function create() {var e = this.extend();return e.init.apply(e, arguments), e;}, init: function init() {}, mixIn: function mixIn(e) {for (var t in e) {e.hasOwnProperty(t) && (this[t] = e[t]);}e.hasOwnProperty("toString") && (this.toString = e.toString);}, clone: function clone() {return this.init.prototype.extend(this);} },i = o.WordArray = r.extend({ init: function init(e, n) {e = this.words = e || [], this.sigBytes = n != t ? n : 4 * e.length;}, toString: function toString(e) {return (e || c).stringify(this);}, concat: function concat(e) {var t = this.words,n = e.words,s = this.sigBytes,o = e.sigBytes;if (this.clamp(), s % 4) for (var r = 0; r < o; r++) {var i = n[r >>> 2] >>> 24 - r % 4 * 8 & 255;t[s + r >>> 2] |= i << 24 - (s + r) % 4 * 8;} else for (r = 0; r < o; r += 4) {t[s + r >>> 2] = n[r >>> 2];}return this.sigBytes += o, this;}, clamp: function clamp() {var t = this.words,n = this.sigBytes;t[n >>> 2] &= 4294967295 << 32 - n % 4 * 8, t.length = e.ceil(n / 4);}, clone: function clone() {var e = r.clone.call(this);return e.words = this.words.slice(0), e;}, random: function random(t) {for (var n, s = [], o = function o(t) {t = t;var n = 987654321,s = 4294967295;return function () {var o = ((n = 36969 * (65535 & n) + (n >> 16) & s) << 16) + (t = 18e3 * (65535 & t) + (t >> 16) & s) & s;return o /= 4294967296, (o += .5) * (e.random() > .5 ? 1 : -1);};}, r = 0; r < t; r += 4) {var a = o(4294967296 * (n || e.random()));n = 987654071 * a(), s.push(4294967296 * a() | 0);}return new i.init(s, t);} }),a = s.enc = {},c = a.Hex = { stringify: function stringify(e) {for (var t = e.words, n = e.sigBytes, s = [], o = 0; o < n; o++) {var r = t[o >>> 2] >>> 24 - o % 4 * 8 & 255;s.push((r >>> 4).toString(16)), s.push((15 & r).toString(16));}return s.join("");}, parse: function parse(e) {for (var t = e.length, n = [], s = 0; s < t; s += 2) {n[s >>> 3] |= parseInt(e.substr(s, 2), 16) << 24 - s % 8 * 4;}return new i.init(n, t / 2);} },u = a.Latin1 = { stringify: function stringify(e) {for (var t = e.words, n = e.sigBytes, s = [], o = 0; o < n; o++) {var r = t[o >>> 2] >>> 24 - o % 4 * 8 & 255;s.push(String.fromCharCode(r));}return s.join("");}, parse: function parse(e) {for (var t = e.length, n = [], s = 0; s < t; s++) {n[s >>> 2] |= (255 & e.charCodeAt(s)) << 24 - s % 4 * 8;}return new i.init(n, t);} },l = a.Utf8 = { stringify: function stringify(e) {try {return decodeURIComponent(escape(u.stringify(e)));} catch (e) {throw new Error("Malformed UTF-8 data");}}, parse: function parse(e) {return u.parse(unescape(encodeURIComponent(e)));} },h = o.BufferedBlockAlgorithm = r.extend({ reset: function reset() {this._data = new i.init(), this._nDataBytes = 0;}, _append: function _append(e) {"string" == typeof e && (e = l.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes;}, _process: function _process(t) {var n = this._data,s = n.words,o = n.sigBytes,r = this.blockSize,a = o / (4 * r),c = (a = t ? e.ceil(a) : e.max((0 | a) - this._minBufferSize, 0)) * r,u = e.min(4 * c, o);if (c) {for (var l = 0; l < c; l += r) {this._doProcessBlock(s, l);}var h = s.splice(0, c);n.sigBytes -= u;}return new i.init(h, u);}, clone: function clone() {var e = r.clone.call(this);return e._data = this._data.clone(), e;}, _minBufferSize: 0 });o.Hasher = h.extend({ cfg: r.extend(), init: function init(e) {this.cfg = this.cfg.extend(e), this.reset();}, reset: function reset() {h.reset.call(this), this._doReset();}, update: function update(e) {return this._append(e), this._process(), this;}, finalize: function finalize(e) {return e && this._append(e), this._doFinalize();}, blockSize: 16, _createHelper: function _createHelper(e) {return function (t, n) {return new e.init(n).finalize(t);};}, _createHmacHelper: function _createHmacHelper(e) {return function (t, n) {return new d.HMAC.init(e, n).finalize(t);};} });var d = s.algo = {};return s;}(Math), n);}),o = (n(function (e, t) {var n;e.exports = (n = s, function (e) {var t = n,s = t.lib,o = s.WordArray,r = s.Hasher,i = t.algo,a = [];!function () {for (var t = 0; t < 64; t++) {a[t] = 4294967296 * e.abs(e.sin(t + 1)) | 0;}}();var c = i.MD5 = r.extend({ _doReset: function _doReset() {this._hash = new o.init([1732584193, 4023233417, 2562383102, 271733878]);}, _doProcessBlock: function _doProcessBlock(e, t) {for (var n = 0; n < 16; n++) {var s = t + n,o = e[s];e[s] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8);}var r = this._hash.words,i = e[t + 0],c = e[t + 1],f = e[t + 2],p = e[t + 3],g = e[t + 4],m = e[t + 5],y = e[t + 6],_ = e[t + 7],w = e[t + 8],k = e[t + 9],S = e[t + 10],v = e[t + 11],T = e[t + 12],A = e[t + 13],P = e[t + 14],I = e[t + 15],O = r[0],b = r[1],C = r[2],E = r[3];O = u(O, b, C, E, i, 7, a[0]), E = u(E, O, b, C, c, 12, a[1]), C = u(C, E, O, b, f, 17, a[2]), b = u(b, C, E, O, p, 22, a[3]), O = u(O, b, C, E, g, 7, a[4]), E = u(E, O, b, C, m, 12, a[5]), C = u(C, E, O, b, y, 17, a[6]), b = u(b, C, E, O, _, 22, a[7]), O = u(O, b, C, E, w, 7, a[8]), E = u(E, O, b, C, k, 12, a[9]), C = u(C, E, O, b, S, 17, a[10]), b = u(b, C, E, O, v, 22, a[11]), O = u(O, b, C, E, T, 7, a[12]), E = u(E, O, b, C, A, 12, a[13]), C = u(C, E, O, b, P, 17, a[14]), O = l(O, b = u(b, C, E, O, I, 22, a[15]), C, E, c, 5, a[16]), E = l(E, O, b, C, y, 9, a[17]), C = l(C, E, O, b, v, 14, a[18]), b = l(b, C, E, O, i, 20, a[19]), O = l(O, b, C, E, m, 5, a[20]), E = l(E, O, b, C, S, 9, a[21]), C = l(C, E, O, b, I, 14, a[22]), b = l(b, C, E, O, g, 20, a[23]), O = l(O, b, C, E, k, 5, a[24]), E = l(E, O, b, C, P, 9, a[25]), C = l(C, E, O, b, p, 14, a[26]), b = l(b, C, E, O, w, 20, a[27]), O = l(O, b, C, E, A, 5, a[28]), E = l(E, O, b, C, f, 9, a[29]), C = l(C, E, O, b, _, 14, a[30]), O = h(O, b = l(b, C, E, O, T, 20, a[31]), C, E, m, 4, a[32]), E = h(E, O, b, C, w, 11, a[33]), C = h(C, E, O, b, v, 16, a[34]), b = h(b, C, E, O, P, 23, a[35]), O = h(O, b, C, E, c, 4, a[36]), E = h(E, O, b, C, g, 11, a[37]), C = h(C, E, O, b, _, 16, a[38]), b = h(b, C, E, O, S, 23, a[39]), O = h(O, b, C, E, A, 4, a[40]), E = h(E, O, b, C, i, 11, a[41]), C = h(C, E, O, b, p, 16, a[42]), b = h(b, C, E, O, y, 23, a[43]), O = h(O, b, C, E, k, 4, a[44]), E = h(E, O, b, C, T, 11, a[45]), C = h(C, E, O, b, I, 16, a[46]), O = d(O, b = h(b, C, E, O, f, 23, a[47]), C, E, i, 6, a[48]), E = d(E, O, b, C, _, 10, a[49]), C = d(C, E, O, b, P, 15, a[50]), b = d(b, C, E, O, m, 21, a[51]), O = d(O, b, C, E, T, 6, a[52]), E = d(E, O, b, C, p, 10, a[53]), C = d(C, E, O, b, S, 15, a[54]), b = d(b, C, E, O, c, 21, a[55]), O = d(O, b, C, E, w, 6, a[56]), E = d(E, O, b, C, I, 10, a[57]), C = d(C, E, O, b, y, 15, a[58]), b = d(b, C, E, O, A, 21, a[59]), O = d(O, b, C, E, g, 6, a[60]), E = d(E, O, b, C, v, 10, a[61]), C = d(C, E, O, b, f, 15, a[62]), b = d(b, C, E, O, k, 21, a[63]), r[0] = r[0] + O | 0, r[1] = r[1] + b | 0, r[2] = r[2] + C | 0, r[3] = r[3] + E | 0;}, _doFinalize: function _doFinalize() {var t = this._data,n = t.words,s = 8 * this._nDataBytes,o = 8 * t.sigBytes;n[o >>> 5] |= 128 << 24 - o % 32;var r = e.floor(s / 4294967296),i = s;n[15 + (o + 64 >>> 9 << 4)] = 16711935 & (r << 8 | r >>> 24) | 4278255360 & (r << 24 | r >>> 8), n[14 + (o + 64 >>> 9 << 4)] = 16711935 & (i << 8 | i >>> 24) | 4278255360 & (i << 24 | i >>> 8), t.sigBytes = 4 * (n.length + 1), this._process();for (var a = this._hash, c = a.words, u = 0; u < 4; u++) {var l = c[u];c[u] = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8);}return a;}, clone: function clone() {var e = r.clone.call(this);return e._hash = this._hash.clone(), e;} });function u(e, t, n, s, o, r, i) {var a = e + (t & n | ~t & s) + o + i;return (a << r | a >>> 32 - r) + t;}function l(e, t, n, s, o, r, i) {var a = e + (t & s | n & ~s) + o + i;return (a << r | a >>> 32 - r) + t;}function h(e, t, n, s, o, r, i) {var a = e + (t ^ n ^ s) + o + i;return (a << r | a >>> 32 - r) + t;}function d(e, t, n, s, o, r, i) {var a = e + (n ^ (t | ~s)) + o + i;return (a << r | a >>> 32 - r) + t;}t.MD5 = r._createHelper(c), t.HmacMD5 = r._createHmacHelper(c);}(Math), n.MD5);}), n(function (e, t) {var n, o, r;e.exports = (o = (n = s).lib.Base, r = n.enc.Utf8, void (n.algo.HMAC = o.extend({ init: function init(e, t) {e = this._hasher = new e.init(), "string" == typeof t && (t = r.parse(t));var n = e.blockSize,s = 4 * n;t.sigBytes > s && (t = e.finalize(t)), t.clamp();for (var o = this._oKey = t.clone(), i = this._iKey = t.clone(), a = o.words, c = i.words, u = 0; u < n; u++) {a[u] ^= 1549556828, c[u] ^= 909522486;}o.sigBytes = i.sigBytes = s, this.reset();}, reset: function reset() {var e = this._hasher;e.reset(), e.update(this._iKey);}, update: function update(e) {return this._hasher.update(e), this;}, finalize: function finalize(e) {var t = this._hasher,n = t.finalize(e);return t.reset(), t.finalize(this._oKey.clone().concat(n));} })));}), n(function (e, t) {e.exports = s.HmacMD5;}));var r = "FUNCTION",i = "OBJECT",a = "CLIENT_DB";function c(e) {return Object.prototype.toString.call(e).slice(8, -1).toLowerCase();}function u(e) {return "object" === c(e);}function l(e) {return e && "string" == typeof e ? JSON.parse(e) : e;}var h = "development" === "development",d = "mp-weixin",f = l(undefined),p = l([]),g = true;var m = "";try {{var _e2 = __webpack_require__(/*! uni-stat-config */ 110).default || __webpack_require__(/*! uni-stat-config */ 110);m = _e2.appid;}} catch (e) {}var y = {};function _(e) {var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var n, s;return n = y, s = e, Object.prototype.hasOwnProperty.call(n, s) || (y[e] = t), y[e];}"app-plus" === d && (y = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {});var w = ["invoke", "success", "fail", "complete"],k = _("_globalUniCloudInterceptor");function S(e, t) {k[e] || (k[e] = {}), u(t) && Object.keys(t).forEach(function (n) {w.indexOf(n) > -1 && function (e, t, n) {var s = k[e][t];s || (s = k[e][t] = []), -1 === s.indexOf(n) && "function" == typeof n && s.push(n);}(e, n, t[n]);});}function v(e, t) {k[e] || (k[e] = {}), u(t) ? Object.keys(t).forEach(function (n) {w.indexOf(n) > -1 && function (e, t, n) {var s = k[e][t];if (!s) return;var o = s.indexOf(n);o > -1 && s.splice(o, 1);}(e, n, t[n]);}) : delete k[e];}function T(e, t) {return e && 0 !== e.length ? e.reduce(function (e, n) {return e.then(function () {return n(t);});}, Promise.resolve()) : Promise.resolve();}function A(e, t) {return k[e] && k[e][t] || [];}var P = _("_globalUniCloudListener"),I = "response",O = "clientdb",b = "cloudfunction",C = "cloudobject";function E(e) {return P[e] || (P[e] = []), P[e];}function U(e, t) {var n = E(e);for (var _e3 = 0; _e3 < n.length; _e3++) {(0, n[_e3])(t);}}function R(e, t) {return t ? function (n) {var _this = this;var s = !1;if ("callFunction" === t) {var _e4 = n && n.type || r;s = _e4 !== r;}var o = "callFunction" === t && !s;var i;i = this.isReady ? Promise.resolve() : this.initUniCloud, n = n || {};var a = i.then(function () {return s ? Promise.resolve() : T(A(t, "invoke"), n);}).then(function () {return e.call(_this, n);}).then(function (e) {return s ? Promise.resolve(e) : T(A(t, "success"), e).then(function () {return T(A(t, "complete"), e);}).then(function () {return o && U(I, { type: b, content: e }), Promise.resolve(e);});}, function (e) {return s ? Promise.reject(e) : T(A(t, "fail"), e).then(function () {return T(A(t, "complete"), e);}).then(function () {return U(I, { type: b, content: e }), Promise.reject(e);});});if (!(n.success || n.fail || n.complete)) return a;a.then(function (e) {n.success && n.success(e), n.complete && n.complete(e), o && U(I, { type: b, content: e });}, function (e) {n.fail && n.fail(e), n.complete && n.complete(e), o && U(I, { type: b, content: e });});} : function (t) {if (!((t = t || {}).success || t.fail || t.complete)) return e.call(this, t);e.call(this, t).then(function (e) {t.success && t.success(e), t.complete && t.complete(e);}, function (e) {t.fail && t.fail(e), t.complete && t.complete(e);});};}var x = /*#__PURE__*/function (_Error) {_inherits(x, _Error);var _super = _createSuper(x);function x(e) {var _this2;_classCallCheck(this, x);_this2 = _super.call(this, e.message), _this2.errMsg = e.message || "", _this2.errCode = _this2.code = e.code || "SYSTEM_ERROR", _this2.requestId = e.requestId;return _this2;}return x;}( /*#__PURE__*/_wrapNativeSuper(Error));function D() {var e;try {if (uni.getLaunchOptionsSync) {if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1) return;var _uni$getLaunchOptions = uni.getLaunchOptionsSync(),_t2 = _uni$getLaunchOptions.scene,_n = _uni$getLaunchOptions.channel;e = _t2 || _n;}} catch (e) {}return e;}var q;function L() {var e = uni.getLocale && uni.getLocale() || "en";if (q) return _objectSpread(_objectSpread({}, q), {}, { locale: e, LOCALE: e });var t = uni.getSystemInfoSync(),n = t.deviceId,s = t.platform,o = t.osName,r = t.uniPlatform,i = t.appId;return q = _objectSpread({ PLATFORM: r || d, OS: o || s, APPID: i || m, DEVICEID: n, channel: D() }, t), _objectSpread(_objectSpread({}, q), {}, { locale: e, LOCALE: e });}var F = { sign: function sign(e, t) {var n = "";return Object.keys(e).sort().forEach(function (t) {e[t] && (n = n + "&" + t + "=" + e[t]);}), n = n.slice(1), o(n, t).toString();}, wrappedRequest: function wrappedRequest(e, t) {return new Promise(function (n, s) {t(Object.assign(e, { complete: function complete(e) {e || (e = {}), h && "h5" === d && e.errMsg && 0 === e.errMsg.indexOf("request:fail") && console.warn("发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5");var t = e.data && e.data.header && e.data.header["x-serverless-request-id"] || e.header && e.header["request-id"];if (!e.statusCode || e.statusCode >= 400) return s(new x({ code: "SYS_ERR", message: e.errMsg || "request:fail", requestId: t }));var o = e.data;if (o.error) return s(new x({ code: o.error.code, message: o.error.message, requestId: t }));o.result = o.data, o.requestId = t, delete o.data, n(o);} }));});} };var N = { request: function request(e) {return uni.request(e);}, uploadFile: function uploadFile(e) {return uni.uploadFile(e);}, setStorageSync: function setStorageSync(e, t) {return uni.setStorageSync(e, t);}, getStorageSync: function getStorageSync(e) {return uni.getStorageSync(e);}, removeStorageSync: function removeStorageSync(e) {return uni.removeStorageSync(e);}, clearStorageSync: function clearStorageSync() {return uni.clearStorageSync();} },M = { "uniCloud.init.paramRequired": "{param} required", "uniCloud.uploadFile.fileError": "filePath should be instance of File" };var _e5 = (0, _uniI18n.initVueI18n)({ "zh-Hans": { "uniCloud.init.paramRequired": "缺少参数:{param}", "uniCloud.uploadFile.fileError": "filePath应为File对象" }, "zh-Hant": { "uniCloud.init.paramRequired": "缺少参数:{param}", "uniCloud.uploadFile.fileError": "filePath应为File对象" }, en: M, fr: { "uniCloud.init.paramRequired": "{param} required", "uniCloud.uploadFile.fileError": "filePath should be instance of File" }, es: { "uniCloud.init.paramRequired": "{param} required", "uniCloud.uploadFile.fileError": "filePath should be instance of File" }, ja: M }, "zh-Hans"),j = _e5.t;var $ = /*#__PURE__*/function () {function $(e) {_classCallCheck(this, $);["spaceId", "clientSecret"].forEach(function (t) {if (!Object.prototype.hasOwnProperty.call(e, t)) throw new Error(j("uniCloud.init.paramRequired", { param: t }));}), this.config = Object.assign({}, { endpoint: "https://api.bspapp.com" }, e), this.config.provider = "aliyun", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.config.accessTokenKey = "access_token_" + this.config.spaceId, this.adapter = N, this._getAccessTokenPromise = null, this._getAccessTokenPromiseStatus = null;}_createClass($, [{ key: "setAccessToken", value: function setAccessToken(e) {this.accessToken = e;} }, { key: "requestWrapped", value: function requestWrapped(e) {return F.wrappedRequest(e, this.adapter.request);} }, { key: "requestAuth", value: function requestAuth(e) {return this.requestWrapped(e);} }, { key: "request", value: function request(e, t) {var _this3 = this;return Promise.resolve().then(function () {return _this3.hasAccessToken ? t ? _this3.requestWrapped(e) : _this3.requestWrapped(e).catch(function (t) {return new Promise(function (e, n) {!t || "GATEWAY_INVALID_TOKEN" !== t.code && "InvalidParameter.InvalidToken" !== t.code ? n(t) : e();}).then(function () {return _this3.getAccessToken();}).then(function () {var t = _this3.rebuildRequest(e);return _this3.request(t, !0);});}) : _this3.getAccessToken().then(function () {var t = _this3.rebuildRequest(e);return _this3.request(t, !0);});});} }, { key: "rebuildRequest", value: function rebuildRequest(e) {var t = Object.assign({}, e);return t.data.token = this.accessToken, t.header["x-basement-token"] = this.accessToken, t.header["x-serverless-sign"] = F.sign(t.data, this.config.clientSecret), t;} }, { key: "setupRequest", value: function setupRequest(e, t) {var n = Object.assign({}, e, { spaceId: this.config.spaceId, timestamp: Date.now() }),s = { "Content-Type": "application/json" };return "auth" !== t && (n.token = this.accessToken, s["x-basement-token"] = this.accessToken), s["x-serverless-sign"] = F.sign(n, this.config.clientSecret), { url: this.config.requestUrl, method: "POST", data: n, dataType: "json", header: s };} }, { key: "getAccessToken", value: function getAccessToken() {var _this4 = this;if ("pending" === this._getAccessTokenPromiseStatus) return this._getAccessTokenPromise;this._getAccessTokenPromiseStatus = "pending";return this._getAccessTokenPromise = this.requestAuth(this.setupRequest({ method: "serverless.auth.user.anonymousAuthorize", params: "{}" }, "auth")).then(function (e) {return new Promise(function (t, n) {e.result && e.result.accessToken ? (_this4.setAccessToken(e.result.accessToken), _this4._getAccessTokenPromiseStatus = "fulfilled", t(_this4.accessToken)) : (_this4._getAccessTokenPromiseStatus = "rejected", n(new x({ code: "AUTH_FAILED", message: "获取accessToken失败" })));});}, function (e) {return _this4._getAccessTokenPromiseStatus = "rejected", Promise.reject(e);}), this._getAccessTokenPromise;} }, { key: "authorize", value: function authorize() {this.getAccessToken();} }, { key: "callFunction", value: function callFunction(e) {var t = { method: "serverless.function.runtime.invoke", params: JSON.stringify({ functionTarget: e.name, functionArgs: e.data || {} }) };return this.request(this.setupRequest(t));} }, { key: "getOSSUploadOptionsFromPath", value: function getOSSUploadOptionsFromPath(e) {var t = { method: "serverless.file.resource.generateProximalSign", params: JSON.stringify(e) };return this.request(this.setupRequest(t));} }, { key: "uploadFileToOSS", value: function uploadFileToOSS(_ref) {var _this5 = this;var e = _ref.url,t = _ref.formData,n = _ref.name,s = _ref.filePath,o = _ref.fileType,r = _ref.onUploadProgress;return new Promise(function (i, a) {var c = _this5.adapter.uploadFile({ url: e, formData: t, name: n, filePath: s, fileType: o, header: { "X-OSS-server-side-encrpytion": "AES256" }, success: function success(e) {e && e.statusCode < 400 ? i(e) : a(new x({ code: "UPLOAD_FAILED", message: "文件上传失败" }));}, fail: function fail(e) {a(new x({ code: e.code || "UPLOAD_FAILED", message: e.message || e.errMsg || "文件上传失败" }));} });"function" == typeof r && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {r({ loaded: e.totalBytesSent, total: e.totalBytesExpectedToSend });});});} }, { key: "reportOSSUpload", value: function reportOSSUpload(e) {var t = { method: "serverless.file.resource.report", params: JSON.stringify(e) };return this.request(this.setupRequest(t));} }, { key: "uploadFile", value: function uploadFile(_ref2) {var _this6 = this;var e = _ref2.filePath,t = _ref2.cloudPath,_ref2$fileType = _ref2.fileType,n = _ref2$fileType === void 0 ? "image" : _ref2$fileType,s = _ref2.onUploadProgress,o = _ref2.config;if ("string" !== c(t)) throw new x({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" });if (!(t = t.trim())) throw new x({ code: "CLOUDPATH_REQUIRED", message: "cloudPath不可为空" });if (/:\/\//.test(t)) throw new x({ code: "INVALID_PARAM", message: "cloudPath不合法" });var r = o && o.envType || this.config.envType;var i, a;return this.getOSSUploadOptionsFromPath({ env: r, filename: t }).then(function (t) {var o = t.result;i = o.id, a = "https://" + o.cdnDomain + "/" + o.ossPath;var r = { url: "https://" + o.host, formData: { "Cache-Control": "max-age=2592000", "Content-Disposition": "attachment", OSSAccessKeyId: o.accessKeyId, Signature: o.signature, host: o.host, id: i, key: o.ossPath, policy: o.policy, success_action_status: 200 }, fileName: "file", name: "file", filePath: e, fileType: n };return _this6.uploadFileToOSS(Object.assign({}, r, { onUploadProgress: s }));}).then(function () {return _this6.reportOSSUpload({ id: i });}).then(function (t) {return new Promise(function (n, s) {t.success ? n({ success: !0, filePath: e, fileID: a }) : s(new x({ code: "UPLOAD_FAILED", message: "文件上传失败" }));});});} }, { key: "deleteFile", value: function deleteFile(_ref3) {var e = _ref3.fileList;var t = { method: "serverless.file.resource.delete", params: JSON.stringify({ id: e[0] }) };return this.request(this.setupRequest(t));} }, { key: "getTempFileURL", value: function getTempFileURL() {var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},e = _ref4.fileList;return new Promise(function (t, n) {Array.isArray(e) && 0 !== e.length || n(new x({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" })), t({ fileList: e.map(function (e) {return { fileID: e, tempFileURL: e };}) });});} }, { key: "hasAccessToken", get: function get() {return !!this.accessToken;} }]);return $;}();var B = { init: function init(e) {var t = new $(e),n = { signInAnonymously: function signInAnonymously() {return t.authorize();}, getLoginState: function getLoginState() {return Promise.resolve(!1);} };return t.auth = function () {return n;}, t.customAuth = t.auth, t;} };var K = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:";var H;!function (e) {e.local = "local", e.none = "none", e.session = "session";}(H || (H = {}));var W = function W() {};var z = function z() {var e;if (!Promise) {e = function e() {}, e.promise = {};var _t3 = function _t3() {throw new x({ message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.' });};return Object.defineProperty(e.promise, "then", { get: _t3 }), Object.defineProperty(e.promise, "catch", { get: _t3 }), e;}var t = new Promise(function (t, n) {e = function e(_e6, s) {return _e6 ? n(_e6) : t(s);};});return e.promise = t, e;};function J(e) {return void 0 === e;}function V(e) {return "[object Null]" === Object.prototype.toString.call(e);}var Y;function X(e) {var t = (n = e, "[object Array]" === Object.prototype.toString.call(n) ? e : [e]);var n;var _iterator = _createForOfIteratorHelper(t),_step;try {for (_iterator.s(); !(_step = _iterator.n()).done;) {var _e7 = _step.value;var _t4 = _e7.isMatch,_n2 = _e7.genAdapter,_s = _e7.runtime;if (_t4()) return { adapter: _n2(), runtime: _s };}} catch (err) {_iterator.e(err);} finally {_iterator.f();}}!function (e) {e.WEB = "web", e.WX_MP = "wx_mp";}(Y || (Y = {}));var G = { adapter: null, runtime: void 0 },Q = ["anonymousUuidKey"];var Z = /*#__PURE__*/function (_W) {_inherits(Z, _W);var _super2 = _createSuper(Z);function Z() {var _this7;_classCallCheck(this, Z);_this7 = _super2.call(this), G.adapter.root.tcbObject || (G.adapter.root.tcbObject = {});return _this7;}_createClass(Z, [{ key: "setItem", value: function setItem(e, t) {G.adapter.root.tcbObject[e] = t;} }, { key: "getItem", value: function getItem(e) {return G.adapter.root.tcbObject[e];} }, { key: "removeItem", value: function removeItem(e) {delete G.adapter.root.tcbObject[e];} }, { key: "clear", value: function clear() {delete G.adapter.root.tcbObject;} }]);return Z;}(W);function ee(e, t) {switch (e) {case "local":return t.localStorage || new Z();case "none":return new Z();default:return t.sessionStorage || new Z();}}var te = /*#__PURE__*/function () {function te(e) {_classCallCheck(this, te);if (!this._storage) {this._persistence = G.adapter.primaryStorage || e.persistence, this._storage = ee(this._persistence, G.adapter);var _t5 = "access_token_".concat(e.env),_n3 = "access_token_expire_".concat(e.env),_s2 = "refresh_token_".concat(e.env),_o = "anonymous_uuid_".concat(e.env),_r = "login_type_".concat(e.env),_i = "user_info_".concat(e.env);this.keys = { accessTokenKey: _t5, accessTokenExpireKey: _n3, refreshTokenKey: _s2, anonymousUuidKey: _o, loginTypeKey: _r, userInfoKey: _i };}}_createClass(te, [{ key: "updatePersistence", value: function updatePersistence(e) {if (e === this._persistence) return;var t = "local" === this._persistence;this._persistence = e;var n = ee(e, G.adapter);for (var _e8 in this.keys) {var _s3 = this.keys[_e8];if (t && Q.includes(_e8)) continue;var _o2 = this._storage.getItem(_s3);J(_o2) || V(_o2) || (n.setItem(_s3, _o2), this._storage.removeItem(_s3));}this._storage = n;} }, { key: "setStore", value: function setStore(e, t, n) {if (!this._storage) return;var s = { version: n || "localCachev1", content: t },o = JSON.stringify(s);try {this._storage.setItem(e, o);} catch (e) {throw e;}} }, { key: "getStore", value: function getStore(e, t) {try {if (!this._storage) return;} catch (e) {return "";}t = t || "localCachev1";var n = this._storage.getItem(e);if (!n) return "";if (n.indexOf(t) >= 0) {return JSON.parse(n).content;}return "";} }, { key: "removeStore", value: function removeStore(e) {this._storage.removeItem(e);} }]);return te;}();var ne = {},se = {};function oe(e) {return ne[e];}var re = function re(e, t) {_classCallCheck(this, re);this.data = t || null, this.name = e;};var ie = /*#__PURE__*/function (_re) {_inherits(ie, _re);var _super3 = _createSuper(ie);function ie(e, t) {var _this8;_classCallCheck(this, ie);_this8 = _super3.call(this, "error", { error: e, data: t }), _this8.error = e;return _this8;}return ie;}(re);var ae = new ( /*#__PURE__*/function () {function _class() {_classCallCheck(this, _class);this._listeners = {};}_createClass(_class, [{ key: "on", value: function on(e, t) {return function (e, t, n) {n[e] = n[e] || [], n[e].push(t);}(e, t, this._listeners), this;} }, { key: "off", value: function off(e, t) {return function (e, t, n) {if (n && n[e]) {var _s4 = n[e].indexOf(t);-1 !== _s4 && n[e].splice(_s4, 1);}}(e, t, this._listeners), this;} }, { key: "fire", value: function fire(e, t) {if (e instanceof ie) return console.error(e.error), this;var n = "string" == typeof e ? new re(e, t || {}) : e;var s = n.name;if (this._listens(s)) {n.target = this;var _e9 = this._listeners[s] ? _toConsumableArray(this._listeners[s]) : [];var _iterator2 = _createForOfIteratorHelper(_e9),_step2;try {for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {var _t6 = _step2.value;_t6.call(this, n);}} catch (err) {_iterator2.e(err);} finally {_iterator2.f();}}return this;} }, { key: "_listens", value: function _listens(e) {return this._listeners[e] && this._listeners[e].length > 0;} }]);return _class;}())();function ce(e, t) {ae.on(e, t);}function ue(e) {var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};ae.fire(e, t);}function le(e, t) {ae.off(e, t);}var he = "loginStateChanged",de = "loginStateExpire",fe = "loginTypeChanged",pe = "anonymousConverted",ge = "refreshAccessToken";var me;!function (e) {e.ANONYMOUS = "ANONYMOUS", e.WECHAT = "WECHAT", e.WECHAT_PUBLIC = "WECHAT-PUBLIC", e.WECHAT_OPEN = "WECHAT-OPEN", e.CUSTOM = "CUSTOM", e.EMAIL = "EMAIL", e.USERNAME = "USERNAME", e.NULL = "NULL";}(me || (me = {}));var ye = ["auth.getJwt", "auth.logout", "auth.signInWithTicket", "auth.signInAnonymously", "auth.signIn", "auth.fetchAccessTokenWithRefreshToken", "auth.signUpWithEmailAndPassword", "auth.activateEndUserMail", "auth.sendPasswordResetEmail", "auth.resetPasswordWithToken", "auth.isUsernameRegistered"],_e = { "X-SDK-Version": "1.3.5" };function we(e, t, n) {var s = e[t];e[t] = function (t) {var o = {},r = {};n.forEach(function (n) {var _n$call = n.call(e, t),s = _n$call.data,i = _n$call.headers;Object.assign(o, s), Object.assign(r, i);});var i = t.data;return i && function () {var e;if (e = i, "[object FormData]" !== Object.prototype.toString.call(e)) t.data = _objectSpread(_objectSpread({}, i), o);else for (var _e10 in o) {i.append(_e10, o[_e10]);}}(), t.headers = _objectSpread(_objectSpread({}, t.headers || {}), r), s.call(e, t);};}function ke() {var e = Math.random().toString(16).slice(2);return { data: { seqId: e }, headers: _objectSpread(_objectSpread({}, _e), {}, { "x-seqid": e }) };}var Se = /*#__PURE__*/function () {function Se() {var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};_classCallCheck(this, Se);var t;this.config = e, this._reqClass = new G.adapter.reqClass({ timeout: this.config.timeout, timeoutMsg: "\u8BF7\u6C42\u5728".concat(this.config.timeout / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD"), restrictedMethods: ["post"] }), this._cache = oe(this.config.env), this._localCache = (t = this.config.env, se[t]), we(this._reqClass, "post", [ke]), we(this._reqClass, "upload", [ke]), we(this._reqClass, "download", [ke]);}_createClass(Se, [{ key: "post", value: function () {var _post = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:_context.next = 2;return this._reqClass.post(e);case 2:return _context.abrupt("return", _context.sent);case 3:case "end":return _context.stop();}}}, _callee, this);}));function post(_x) {return _post.apply(this, arguments);}return post;}() }, { key: "upload", value: function () {var _upload = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee2(e) {return _regenerator.default.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:_context2.next = 2;return this._reqClass.upload(e);case 2:return _context2.abrupt("return", _context2.sent);case 3:case "end":return _context2.stop();}}}, _callee2, this);}));function upload(_x2) {return _upload.apply(this, arguments);}return upload;}() }, { key: "download", value: function () {var _download = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee3(e) {return _regenerator.default.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:_context3.next = 2;return this._reqClass.download(e);case 2:return _context3.abrupt("return", _context3.sent);case 3:case "end":return _context3.stop();}}}, _callee3, this);}));function download(_x3) {return _download.apply(this, arguments);}return download;}() }, { key: "refreshAccessToken", value: function () {var _refreshAccessToken2 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee4() {var e, t;return _regenerator.default.wrap(function _callee4$(_context4) {while (1) {switch (_context4.prev = _context4.next) {case 0:this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken());_context4.prev = 1;_context4.next = 4;return this._refreshAccessTokenPromise;case 4:e = _context4.sent;_context4.next = 10;break;case 7:_context4.prev = 7;_context4.t0 = _context4["catch"](1);t = _context4.t0;case 10:if (!(this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t)) {_context4.next = 12;break;}throw t;case 12:return _context4.abrupt("return", e);case 13:case "end":return _context4.stop();}}}, _callee4, this, [[1, 7]]);}));function refreshAccessToken() {return _refreshAccessToken2.apply(this, arguments);}return refreshAccessToken;}() }, { key: "_refreshAccessToken", value: function () {var _refreshAccessToken3 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee5() {var _this$_cache$keys, e, t, n, s, o, r, i, a, _e11, _e12, _t7, _s5;return _regenerator.default.wrap(function _callee5$(_context5) {while (1) {switch (_context5.prev = _context5.next) {case 0:_this$_cache$keys = this._cache.keys, e = _this$_cache$keys.accessTokenKey, t = _this$_cache$keys.accessTokenExpireKey, n = _this$_cache$keys.refreshTokenKey, s = _this$_cache$keys.loginTypeKey, o = _this$_cache$keys.anonymousUuidKey;this._cache.removeStore(e), this._cache.removeStore(t);r = this._cache.getStore(n);if (r) {_context5.next = 5;break;}throw new x({ message: "未登录CloudBase" });case 5:i = { refresh_token: r };_context5.next = 8;return this.request("auth.fetchAccessTokenWithRefreshToken", i);case 8:a = _context5.sent;if (!a.data.code) {_context5.next = 21;break;}_e11 = a.data.code;if (!("SIGN_PARAM_INVALID" === _e11 || "REFRESH_TOKEN_EXPIRED" === _e11 || "INVALID_REFRESH_TOKEN" === _e11)) {_context5.next = 20;break;}if (!(this._cache.getStore(s) === me.ANONYMOUS && "INVALID_REFRESH_TOKEN" === _e11)) {_context5.next = 19;break;}_e12 = this._cache.getStore(o);_t7 = this._cache.getStore(n);_context5.next = 17;return this.send("auth.signInAnonymously", { anonymous_uuid: _e12, refresh_token: _t7 });case 17:_s5 = _context5.sent;return _context5.abrupt("return", (this.setRefreshToken(_s5.refresh_token), this._refreshAccessToken()));case 19:ue(de), this._cache.removeStore(n);case 20:throw new x({ code: a.data.code, message: "\u5237\u65B0access token\u5931\u8D25\uFF1A".concat(a.data.code) });case 21:if (!a.data.access_token) {_context5.next = 23;break;}return _context5.abrupt("return", (ue(ge), this._cache.setStore(e, a.data.access_token), this._cache.setStore(t, a.data.access_token_expire + Date.now()), { accessToken: a.data.access_token, accessTokenExpire: a.data.access_token_expire }));case 23:a.data.refresh_token && (this._cache.removeStore(n), this._cache.setStore(n, a.data.refresh_token), this._refreshAccessToken());case 24:case "end":return _context5.stop();}}}, _callee5, this);}));function _refreshAccessToken() {return _refreshAccessToken3.apply(this, arguments);}return _refreshAccessToken;}() }, { key: "getAccessToken", value: function () {var _getAccessToken = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee6() {var _this$_cache$keys2, e, t, n, s, o, r;return _regenerator.default.wrap(function _callee6$(_context6) {while (1) {switch (_context6.prev = _context6.next) {case 0:_this$_cache$keys2 = this._cache.keys, e = _this$_cache$keys2.accessTokenKey, t = _this$_cache$keys2.accessTokenExpireKey, n = _this$_cache$keys2.refreshTokenKey;if (this._cache.getStore(n)) {_context6.next = 3;break;}throw new x({ message: "refresh token不存在,登录状态异常" });case 3:s = this._cache.getStore(e), o = this._cache.getStore(t), r = !0;_context6.t0 = this._shouldRefreshAccessTokenHook;if (!_context6.t0) {_context6.next = 9;break;}_context6.next = 8;return this._shouldRefreshAccessTokenHook(s, o);case 8:_context6.t0 = !_context6.sent;case 9:_context6.t1 = _context6.t0;if (!_context6.t1) {_context6.next = 12;break;}r = !1;case 12:return _context6.abrupt("return", (!s || !o || o < Date.now()) && r ? this.refreshAccessToken() : { accessToken: s, accessTokenExpire: o });case 13:case "end":return _context6.stop();}}}, _callee6, this);}));function getAccessToken() {return _getAccessToken.apply(this, arguments);}return getAccessToken;}() }, { key: "request", value: function () {var _request = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee7(e, t, n) {var s, o, r, _e13, i, _e14, _e15, a, c, u, l, h, d, f, p, g;return _regenerator.default.wrap(function _callee7$(_context7) {while (1) {switch (_context7.prev = _context7.next) {case 0:s = "x-tcb-trace_".concat(this.config.env);o = "application/x-www-form-urlencoded";r = _objectSpread({ action: e, env: this.config.env, dataVersion: "2019-08-16" }, t);if (!(-1 === ye.indexOf(e))) {_context7.next = 10;break;}_e13 = this._cache.keys.refreshTokenKey;_context7.t0 = this._cache.getStore(_e13);if (!_context7.t0) {_context7.next = 10;break;}_context7.next = 9;return this.getAccessToken();case 9:r.access_token = _context7.sent.accessToken;case 10:if ("storage.uploadFile" === e) {i = new FormData();for (_e14 in i) {i.hasOwnProperty(_e14) && void 0 !== i[_e14] && i.append(_e14, r[_e14]);}o = "multipart/form-data";} else {o = "application/json", i = {};for (_e15 in r) {void 0 !== r[_e15] && (i[_e15] = r[_e15]);}}a = { headers: { "content-type": o } };n && n.onUploadProgress && (a.onUploadProgress = n.onUploadProgress);c = this._localCache.getStore(s);c && (a.headers["X-TCB-Trace"] = c);u = t.parse, l = t.inQuery, h = t.search;d = { env: this.config.env };u && (d.parse = !0), l && (d = _objectSpread(_objectSpread({}, l), d));f = function (e, t) {var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var s = /\?/.test(t);var o = "";for (var _e16 in n) {"" === o ? !s && (t += "?") : o += "&", o += "".concat(_e16, "=").concat(encodeURIComponent(n[_e16]));}return /^http(s)?\:\/\//.test(t += o) ? t : "".concat(e).concat(t);}(K, "//tcb-api.tencentcloudapi.com/web", d);h && (f += h);_context7.next = 22;return this.post(_objectSpread({ url: f, data: i }, a));case 22:p = _context7.sent;g = p.header && p.header["x-tcb-trace"];if (!(g && this._localCache.setStore(s, g), 200 !== Number(p.status) && 200 !== Number(p.statusCode) || !p.data)) {_context7.next = 26;break;}throw new x({ code: "NETWORK_ERROR", message: "network request error" });case 26:return _context7.abrupt("return", p);case 27:case "end":return _context7.stop();}}}, _callee7, this);}));function request(_x4, _x5, _x6) {return _request.apply(this, arguments);}return request;}() }, { key: "send", value: function () {var _send = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee8(e) {var t,n,_n4,_args8 = arguments;return _regenerator.default.wrap(function _callee8$(_context8) {while (1) {switch (_context8.prev = _context8.next) {case 0:t = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};_context8.next = 3;return this.request(e, t, { onUploadProgress: t.onUploadProgress });case 3:n = _context8.sent;if (!("ACCESS_TOKEN_EXPIRED" === n.data.code && -1 === ye.indexOf(e))) {_context8.next = 13;break;}_context8.next = 7;return this.refreshAccessToken();case 7:_context8.next = 9;return this.request(e, t, { onUploadProgress: t.onUploadProgress });case 9:_n4 = _context8.sent;if (!_n4.data.code) {_context8.next = 12;break;}throw new x({ code: _n4.data.code, message: _n4.data.message });case 12:return _context8.abrupt("return", _n4.data);case 13:if (!n.data.code) {_context8.next = 15;break;}throw new x({ code: n.data.code, message: n.data.message });case 15:return _context8.abrupt("return", n.data);case 16:case "end":return _context8.stop();}}}, _callee8, this);}));function send(_x7) {return _send.apply(this, arguments);}return send;}() }, { key: "setRefreshToken", value: function setRefreshToken(e) {var _this$_cache$keys3 = this._cache.keys,t = _this$_cache$keys3.accessTokenKey,n = _this$_cache$keys3.accessTokenExpireKey,s = _this$_cache$keys3.refreshTokenKey;this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);} }]);return Se;}();var ve = {};function Te(e) {return ve[e];}var Ae = /*#__PURE__*/function () {function Ae(e) {_classCallCheck(this, Ae);this.config = e, this._cache = oe(e.env), this._request = Te(e.env);}_createClass(Ae, [{ key: "setRefreshToken", value: function setRefreshToken(e) {var _this$_cache$keys4 = this._cache.keys,t = _this$_cache$keys4.accessTokenKey,n = _this$_cache$keys4.accessTokenExpireKey,s = _this$_cache$keys4.refreshTokenKey;this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);} }, { key: "setAccessToken", value: function setAccessToken(e, t) {var _this$_cache$keys5 = this._cache.keys,n = _this$_cache$keys5.accessTokenKey,s = _this$_cache$keys5.accessTokenExpireKey;this._cache.setStore(n, e), this._cache.setStore(s, t);} }, { key: "refreshUserInfo", value: function () {var _refreshUserInfo = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee9() {var _yield$this$_request$, e;return _regenerator.default.wrap(function _callee9$(_context9) {while (1) {switch (_context9.prev = _context9.next) {case 0:_context9.next = 2;return this._request.send("auth.getUserInfo", {});case 2:_yield$this$_request$ = _context9.sent;e = _yield$this$_request$.data;return _context9.abrupt("return", (this.setLocalUserInfo(e), e));case 5:case "end":return _context9.stop();}}}, _callee9, this);}));function refreshUserInfo() {return _refreshUserInfo.apply(this, arguments);}return refreshUserInfo;}() }, { key: "setLocalUserInfo", value: function setLocalUserInfo(e) {var t = this._cache.keys.userInfoKey;this._cache.setStore(t, e);} }]);return Ae;}();var Pe = /*#__PURE__*/function () {function Pe(e) {_classCallCheck(this, Pe);if (!e) throw new x({ code: "PARAM_ERROR", message: "envId is not defined" });this._envId = e, this._cache = oe(this._envId), this._request = Te(this._envId), this.setUserInfo();}_createClass(Pe, [{ key: "linkWithTicket", value: function linkWithTicket(e) {if ("string" != typeof e) throw new x({ code: "PARAM_ERROR", message: "ticket must be string" });return this._request.send("auth.linkWithTicket", { ticket: e });} }, { key: "linkWithRedirect", value: function linkWithRedirect(e) {e.signInWithRedirect();} }, { key: "updatePassword", value: function updatePassword(e, t) {return this._request.send("auth.updatePassword", { oldPassword: t, newPassword: e });} }, { key: "updateEmail", value: function updateEmail(e) {return this._request.send("auth.updateEmail", { newEmail: e });} }, { key: "updateUsername", value: function updateUsername(e) {if ("string" != typeof e) throw new x({ code: "PARAM_ERROR", message: "username must be a string" });return this._request.send("auth.updateUsername", { username: e });} }, { key: "getLinkedUidList", value: function () {var _getLinkedUidList = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee10() {var _yield$this$_request$2, e, t, n;return _regenerator.default.wrap(function _callee10$(_context10) {while (1) {switch (_context10.prev = _context10.next) {case 0:_context10.next = 2;return this._request.send("auth.getLinkedUidList", {});case 2:_yield$this$_request$2 = _context10.sent;e = _yield$this$_request$2.data;t = !1;n = e.users;return _context10.abrupt("return", (n.forEach(function (e) {e.wxOpenId && e.wxPublicId && (t = !0);}), { users: n, hasPrimaryUid: t }));case 7:case "end":return _context10.stop();}}}, _callee10, this);}));function getLinkedUidList() {return _getLinkedUidList.apply(this, arguments);}return getLinkedUidList;}() }, { key: "setPrimaryUid", value: function setPrimaryUid(e) {return this._request.send("auth.setPrimaryUid", { uid: e });} }, { key: "unlink", value: function unlink(e) {return this._request.send("auth.unlink", { platform: e });} }, { key: "update", value: function () {var _update = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee11(e) {var t, n, s, o, r, i, _yield$this$_request$3, a;return _regenerator.default.wrap(function _callee11$(_context11) {while (1) {switch (_context11.prev = _context11.next) {case 0:t = e.nickName;n = e.gender;s = e.avatarUrl;o = e.province;r = e.country;i = e.city;_context11.next = 8;return this._request.send("auth.updateUserInfo", { nickName: t, gender: n, avatarUrl: s, province: o, country: r, city: i });case 8:_yield$this$_request$3 = _context11.sent;a = _yield$this$_request$3.data;this.setLocalUserInfo(a);case 11:case "end":return _context11.stop();}}}, _callee11, this);}));function update(_x8) {return _update.apply(this, arguments);}return update;}() }, { key: "refresh", value: function () {var _refresh = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee12() {var _yield$this$_request$4, e;return _regenerator.default.wrap(function _callee12$(_context12) {while (1) {switch (_context12.prev = _context12.next) {case 0:_context12.next = 2;return this._request.send("auth.getUserInfo", {});case 2:_yield$this$_request$4 = _context12.sent;e = _yield$this$_request$4.data;return _context12.abrupt("return", (this.setLocalUserInfo(e), e));case 5:case "end":return _context12.stop();}}}, _callee12, this);}));function refresh() {return _refresh.apply(this, arguments);}return refresh;}() }, { key: "setUserInfo", value: function setUserInfo() {var _this9 = this;var e = this._cache.keys.userInfoKey,t = this._cache.getStore(e);["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach(function (e) {_this9[e] = t[e];}), this.location = { country: t.country, province: t.province, city: t.city };} }, { key: "setLocalUserInfo", value: function setLocalUserInfo(e) {var t = this._cache.keys.userInfoKey;this._cache.setStore(t, e), this.setUserInfo();} }]);return Pe;}();var Ie = /*#__PURE__*/function () {function Ie(e) {_classCallCheck(this, Ie);if (!e) throw new x({ code: "PARAM_ERROR", message: "envId is not defined" });this._cache = oe(e);var _this$_cache$keys6 = this._cache.keys,t = _this$_cache$keys6.refreshTokenKey,n = _this$_cache$keys6.accessTokenKey,s = _this$_cache$keys6.accessTokenExpireKey,o = this._cache.getStore(t),r = this._cache.getStore(n),i = this._cache.getStore(s);this.credential = { refreshToken: o, accessToken: r, accessTokenExpire: i }, this.user = new Pe(e);}_createClass(Ie, [{ key: "isAnonymousAuth", get: function get() {return this.loginType === me.ANONYMOUS;} }, { key: "isCustomAuth", get: function get() {return this.loginType === me.CUSTOM;} }, { key: "isWeixinAuth", get: function get() {return this.loginType === me.WECHAT || this.loginType === me.WECHAT_OPEN || this.loginType === me.WECHAT_PUBLIC;} }, { key: "loginType", get: function get() {return this._cache.getStore(this._cache.keys.loginTypeKey);} }]);return Ie;}();var Oe = /*#__PURE__*/function (_Ae) {_inherits(Oe, _Ae);var _super4 = _createSuper(Oe);function Oe() {_classCallCheck(this, Oe);return _super4.apply(this, arguments);}_createClass(Oe, [{ key: "signIn", value: function () {var _signIn = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee13() {var _this$_cache$keys7, e, t, n, s, o, _e17;return _regenerator.default.wrap(function _callee13$(_context13) {while (1) {switch (_context13.prev = _context13.next) {case 0:this._cache.updatePersistence("local");_this$_cache$keys7 = this._cache.keys;e = _this$_cache$keys7.anonymousUuidKey;t = _this$_cache$keys7.refreshTokenKey;n = this._cache.getStore(e) || void 0;s = this._cache.getStore(t) || void 0;_context13.next = 8;return this._request.send("auth.signInAnonymously", { anonymous_uuid: n, refresh_token: s });case 8:o = _context13.sent;if (!(o.uuid && o.refresh_token)) {_context13.next = 20;break;}this._setAnonymousUUID(o.uuid);this.setRefreshToken(o.refresh_token);_context13.next = 14;return this._request.refreshAccessToken();case 14:ue(he);ue(fe, { env: this.config.env, loginType: me.ANONYMOUS, persistence: "local" });_e17 = new Ie(this.config.env);_context13.next = 19;return _e17.user.refresh();case 19:return _context13.abrupt("return", _e17);case 20:throw new x({ message: "匿名登录失败" });case 21:case "end":return _context13.stop();}}}, _callee13, this);}));function signIn() {return _signIn.apply(this, arguments);}return signIn;}() }, { key: "linkAndRetrieveDataWithTicket", value: function () {var _linkAndRetrieveDataWithTicket = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee14(e) {var _this$_cache$keys8, t, n, s, o, r;return _regenerator.default.wrap(function _callee14$(_context14) {while (1) {switch (_context14.prev = _context14.next) {case 0:_this$_cache$keys8 = this._cache.keys;t = _this$_cache$keys8.anonymousUuidKey;n = _this$_cache$keys8.refreshTokenKey;s = this._cache.getStore(t);o = this._cache.getStore(n);_context14.next = 7;return this._request.send("auth.linkAndRetrieveDataWithTicket", { anonymous_uuid: s, refresh_token: o, ticket: e });case 7:r = _context14.sent;if (!r.refresh_token) {_context14.next = 16;break;}this._clearAnonymousUUID();this.setRefreshToken(r.refresh_token);_context14.next = 13;return this._request.refreshAccessToken();case 13:ue(pe, { env: this.config.env });ue(fe, { loginType: me.CUSTOM, persistence: "local" });return _context14.abrupt("return", { credential: { refreshToken: r.refresh_token } });case 16:throw new x({ message: "匿名转化失败" });case 17:case "end":return _context14.stop();}}}, _callee14, this);}));function linkAndRetrieveDataWithTicket(_x9) {return _linkAndRetrieveDataWithTicket.apply(this, arguments);}return linkAndRetrieveDataWithTicket;}() }, { key: "_setAnonymousUUID", value: function _setAnonymousUUID(e) {var _this$_cache$keys9 = this._cache.keys,t = _this$_cache$keys9.anonymousUuidKey,n = _this$_cache$keys9.loginTypeKey;this._cache.removeStore(t), this._cache.setStore(t, e), this._cache.setStore(n, me.ANONYMOUS);} }, { key: "_clearAnonymousUUID", value: function _clearAnonymousUUID() {this._cache.removeStore(this._cache.keys.anonymousUuidKey);} }]);return Oe;}(Ae);var be = /*#__PURE__*/function (_Ae2) {_inherits(be, _Ae2);var _super5 = _createSuper(be);function be() {_classCallCheck(this, be);return _super5.apply(this, arguments);}_createClass(be, [{ key: "signIn", value: function () {var _signIn2 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee15(e) {var t, n;return _regenerator.default.wrap(function _callee15$(_context15) {while (1) {switch (_context15.prev = _context15.next) {case 0:if (!("string" != typeof e)) {_context15.next = 2;break;}throw new x({ param: "PARAM_ERROR", message: "ticket must be a string" });case 2:t = this._cache.keys.refreshTokenKey;_context15.next = 5;return this._request.send("auth.signInWithTicket", { ticket: e, refresh_token: this._cache.getStore(t) || "" });case 5:n = _context15.sent;if (!n.refresh_token) {_context15.next = 15;break;}this.setRefreshToken(n.refresh_token);_context15.next = 10;return this._request.refreshAccessToken();case 10:ue(he);ue(fe, { env: this.config.env, loginType: me.CUSTOM, persistence: this.config.persistence });_context15.next = 14;return this.refreshUserInfo();case 14:return _context15.abrupt("return", new Ie(this.config.env));case 15:throw new x({ message: "自定义登录失败" });case 16:case "end":return _context15.stop();}}}, _callee15, this);}));function signIn(_x10) {return _signIn2.apply(this, arguments);}return signIn;}() }]);return be;}(Ae);var Ce = /*#__PURE__*/function (_Ae3) {_inherits(Ce, _Ae3);var _super6 = _createSuper(Ce);function Ce() {_classCallCheck(this, Ce);return _super6.apply(this, arguments);}_createClass(Ce, [{ key: "signIn", value: function () {var _signIn3 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee16(e, t) {var n, s, o, r, i;return _regenerator.default.wrap(function _callee16$(_context16) {while (1) {switch (_context16.prev = _context16.next) {case 0:if (!("string" != typeof e)) {_context16.next = 2;break;}throw new x({ code: "PARAM_ERROR", message: "email must be a string" });case 2:n = this._cache.keys.refreshTokenKey;_context16.next = 5;return this._request.send("auth.signIn", { loginType: "EMAIL", email: e, password: t, refresh_token: this._cache.getStore(n) || "" });case 5:s = _context16.sent;o = s.refresh_token;r = s.access_token;i = s.access_token_expire;if (!o) {_context16.next = 22;break;}this.setRefreshToken(o);if (!(r && i)) {_context16.next = 15;break;}this.setAccessToken(r, i);_context16.next = 17;break;case 15:_context16.next = 17;return this._request.refreshAccessToken();case 17:_context16.next = 19;return this.refreshUserInfo();case 19:ue(he);ue(fe, { env: this.config.env, loginType: me.EMAIL, persistence: this.config.persistence });return _context16.abrupt("return", new Ie(this.config.env));case 22:throw s.code ? new x({ code: s.code, message: "\u90AE\u7BB1\u767B\u5F55\u5931\u8D25: ".concat(s.message) }) : new x({ message: "邮箱登录失败" });case 23:case "end":return _context16.stop();}}}, _callee16, this);}));function signIn(_x11, _x12) {return _signIn3.apply(this, arguments);}return signIn;}() }, { key: "activate", value: function () {var _activate = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee17(e) {return _regenerator.default.wrap(function _callee17$(_context17) {while (1) {switch (_context17.prev = _context17.next) {case 0:return _context17.abrupt("return", this._request.send("auth.activateEndUserMail", { token: e }));case 1:case "end":return _context17.stop();}}}, _callee17, this);}));function activate(_x13) {return _activate.apply(this, arguments);}return activate;}() }, { key: "resetPasswordWithToken", value: function () {var _resetPasswordWithToken = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee18(e, t) {return _regenerator.default.wrap(function _callee18$(_context18) {while (1) {switch (_context18.prev = _context18.next) {case 0:return _context18.abrupt("return", this._request.send("auth.resetPasswordWithToken", { token: e, newPassword: t }));case 1:case "end":return _context18.stop();}}}, _callee18, this);}));function resetPasswordWithToken(_x14, _x15) {return _resetPasswordWithToken.apply(this, arguments);}return resetPasswordWithToken;}() }]);return Ce;}(Ae);var Ee = /*#__PURE__*/function (_Ae4) {_inherits(Ee, _Ae4);var _super7 = _createSuper(Ee);function Ee() {_classCallCheck(this, Ee);return _super7.apply(this, arguments);}_createClass(Ee, [{ key: "signIn", value: function () {var _signIn4 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee19(e, t) {var n, s, o, r, i;return _regenerator.default.wrap(function _callee19$(_context19) {while (1) {switch (_context19.prev = _context19.next) {case 0:if (!("string" != typeof e)) {_context19.next = 2;break;}throw new x({ code: "PARAM_ERROR", message: "username must be a string" });case 2:"string" != typeof t && (t = "", console.warn("password is empty"));n = this._cache.keys.refreshTokenKey;_context19.next = 6;return this._request.send("auth.signIn", { loginType: me.USERNAME, username: e, password: t, refresh_token: this._cache.getStore(n) || "" });case 6:s = _context19.sent;o = s.refresh_token;r = s.access_token_expire;i = s.access_token;if (!o) {_context19.next = 23;break;}this.setRefreshToken(o);if (!(i && r)) {_context19.next = 16;break;}this.setAccessToken(i, r);_context19.next = 18;break;case 16:_context19.next = 18;return this._request.refreshAccessToken();case 18:_context19.next = 20;return this.refreshUserInfo();case 20:ue(he);ue(fe, { env: this.config.env, loginType: me.USERNAME, persistence: this.config.persistence });return _context19.abrupt("return", new Ie(this.config.env));case 23:throw s.code ? new x({ code: s.code, message: "\u7528\u6237\u540D\u5BC6\u7801\u767B\u5F55\u5931\u8D25: ".concat(s.message) }) : new x({ message: "用户名密码登录失败" });case 24:case "end":return _context19.stop();}}}, _callee19, this);}));function signIn(_x16, _x17) {return _signIn4.apply(this, arguments);}return signIn;}() }]);return Ee;}(Ae);var Ue = /*#__PURE__*/function () {function Ue(e) {_classCallCheck(this, Ue);this.config = e, this._cache = oe(e.env), this._request = Te(e.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), ce(fe, this._onLoginTypeChanged);}_createClass(Ue, [{ key: "anonymousAuthProvider", value: function anonymousAuthProvider() {return new Oe(this.config);} }, { key: "customAuthProvider", value: function customAuthProvider() {return new be(this.config);} }, { key: "emailAuthProvider", value: function emailAuthProvider() {return new Ce(this.config);} }, { key: "usernameAuthProvider", value: function usernameAuthProvider() {return new Ee(this.config);} }, { key: "signInAnonymously", value: function () {var _signInAnonymously = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee20() {return _regenerator.default.wrap(function _callee20$(_context20) {while (1) {switch (_context20.prev = _context20.next) {case 0:return _context20.abrupt("return", new Oe(this.config).signIn());case 1:case "end":return _context20.stop();}}}, _callee20, this);}));function signInAnonymously() {return _signInAnonymously.apply(this, arguments);}return signInAnonymously;}() }, { key: "signInWithEmailAndPassword", value: function () {var _signInWithEmailAndPassword = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee21(e, t) {return _regenerator.default.wrap(function _callee21$(_context21) {while (1) {switch (_context21.prev = _context21.next) {case 0:return _context21.abrupt("return", new Ce(this.config).signIn(e, t));case 1:case "end":return _context21.stop();}}}, _callee21, this);}));function signInWithEmailAndPassword(_x18, _x19) {return _signInWithEmailAndPassword.apply(this, arguments);}return signInWithEmailAndPassword;}() }, { key: "signInWithUsernameAndPassword", value: function signInWithUsernameAndPassword(e, t) {return new Ee(this.config).signIn(e, t);} }, { key: "linkAndRetrieveDataWithTicket", value: function () {var _linkAndRetrieveDataWithTicket2 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee22(e) {return _regenerator.default.wrap(function _callee22$(_context22) {while (1) {switch (_context22.prev = _context22.next) {case 0:this._anonymousAuthProvider || (this._anonymousAuthProvider = new Oe(this.config)), ce(pe, this._onAnonymousConverted);_context22.next = 3;return this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e);case 3:return _context22.abrupt("return", _context22.sent);case 4:case "end":return _context22.stop();}}}, _callee22, this);}));function linkAndRetrieveDataWithTicket(_x20) {return _linkAndRetrieveDataWithTicket2.apply(this, arguments);}return linkAndRetrieveDataWithTicket;}() }, { key: "signOut", value: function () {var _signOut = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee23() {var _this$_cache$keys10, e, t, n, s, o;return _regenerator.default.wrap(function _callee23$(_context23) {while (1) {switch (_context23.prev = _context23.next) {case 0:if (!(this.loginType === me.ANONYMOUS)) {_context23.next = 2;break;}throw new x({ message: "匿名用户不支持登出操作" });case 2:_this$_cache$keys10 = this._cache.keys, e = _this$_cache$keys10.refreshTokenKey, t = _this$_cache$keys10.accessTokenKey, n = _this$_cache$keys10.accessTokenExpireKey, s = this._cache.getStore(e);if (s) {_context23.next = 5;break;}return _context23.abrupt("return");case 5:_context23.next = 7;return this._request.send("auth.logout", { refresh_token: s });case 7:o = _context23.sent;return _context23.abrupt("return", (this._cache.removeStore(e), this._cache.removeStore(t), this._cache.removeStore(n), ue(he), ue(fe, { env: this.config.env, loginType: me.NULL, persistence: this.config.persistence }), o));case 9:case "end":return _context23.stop();}}}, _callee23, this);}));function signOut() {return _signOut.apply(this, arguments);}return signOut;}() }, { key: "signUpWithEmailAndPassword", value: function () {var _signUpWithEmailAndPassword = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee24(e, t) {return _regenerator.default.wrap(function _callee24$(_context24) {while (1) {switch (_context24.prev = _context24.next) {case 0:return _context24.abrupt("return", this._request.send("auth.signUpWithEmailAndPassword", { email: e, password: t }));case 1:case "end":return _context24.stop();}}}, _callee24, this);}));function signUpWithEmailAndPassword(_x21, _x22) {return _signUpWithEmailAndPassword.apply(this, arguments);}return signUpWithEmailAndPassword;}() }, { key: "sendPasswordResetEmail", value: function () {var _sendPasswordResetEmail = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee25(e) {return _regenerator.default.wrap(function _callee25$(_context25) {while (1) {switch (_context25.prev = _context25.next) {case 0:return _context25.abrupt("return", this._request.send("auth.sendPasswordResetEmail", { email: e }));case 1:case "end":return _context25.stop();}}}, _callee25, this);}));function sendPasswordResetEmail(_x23) {return _sendPasswordResetEmail.apply(this, arguments);}return sendPasswordResetEmail;}() }, { key: "onLoginStateChanged", value: function onLoginStateChanged(e) {var _this10 = this;ce(he, function () {var t = _this10.hasLoginState();e.call(_this10, t);});var t = this.hasLoginState();e.call(this, t);} }, { key: "onLoginStateExpired", value: function onLoginStateExpired(e) {ce(de, e.bind(this));} }, { key: "onAccessTokenRefreshed", value: function onAccessTokenRefreshed(e) {ce(ge, e.bind(this));} }, { key: "onAnonymousConverted", value: function onAnonymousConverted(e) {ce(pe, e.bind(this));} }, { key: "onLoginTypeChanged", value: function onLoginTypeChanged(e) {var _this11 = this;ce(fe, function () {var t = _this11.hasLoginState();e.call(_this11, t);});} }, { key: "getAccessToken", value: function () {var _getAccessToken2 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee26() {return _regenerator.default.wrap(function _callee26$(_context26) {while (1) {switch (_context26.prev = _context26.next) {case 0:_context26.next = 2;return this._request.getAccessToken();case 2:_context26.t0 = _context26.sent.accessToken;_context26.t1 = this.config.env;return _context26.abrupt("return", { accessToken: _context26.t0, env: _context26.t1 });case 5:case "end":return _context26.stop();}}}, _callee26, this);}));function getAccessToken() {return _getAccessToken2.apply(this, arguments);}return getAccessToken;}() }, { key: "hasLoginState", value: function hasLoginState() {var e = this._cache.keys.refreshTokenKey;return this._cache.getStore(e) ? new Ie(this.config.env) : null;} }, { key: "isUsernameRegistered", value: function () {var _isUsernameRegistered = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee27(e) {var _yield$this$_request$5, t;return _regenerator.default.wrap(function _callee27$(_context27) {while (1) {switch (_context27.prev = _context27.next) {case 0:if (!("string" != typeof e)) {_context27.next = 2;break;}throw new x({ code: "PARAM_ERROR", message: "username must be a string" });case 2:_context27.next = 4;return this._request.send("auth.isUsernameRegistered", { username: e });case 4:_yield$this$_request$5 = _context27.sent;t = _yield$this$_request$5.data;return _context27.abrupt("return", t && t.isRegistered);case 7:case "end":return _context27.stop();}}}, _callee27, this);}));function isUsernameRegistered(_x24) {return _isUsernameRegistered.apply(this, arguments);}return isUsernameRegistered;}() }, { key: "getLoginState", value: function getLoginState() {return Promise.resolve(this.hasLoginState());} }, { key: "signInWithTicket", value: function () {var _signInWithTicket = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee28(e) {return _regenerator.default.wrap(function _callee28$(_context28) {while (1) {switch (_context28.prev = _context28.next) {case 0:return _context28.abrupt("return", new be(this.config).signIn(e));case 1:case "end":return _context28.stop();}}}, _callee28, this);}));function signInWithTicket(_x25) {return _signInWithTicket.apply(this, arguments);}return signInWithTicket;}() }, { key: "shouldRefreshAccessToken", value: function shouldRefreshAccessToken(e) {this._request._shouldRefreshAccessTokenHook = e.bind(this);} }, { key: "getUserInfo", value: function getUserInfo() {return this._request.send("auth.getUserInfo", {}).then(function (e) {return e.code ? e : _objectSpread(_objectSpread({}, e.data), {}, { requestId: e.seqId });});} }, { key: "getAuthHeader", value: function getAuthHeader() {var _this$_cache$keys11 = this._cache.keys,e = _this$_cache$keys11.refreshTokenKey,t = _this$_cache$keys11.accessTokenKey,n = this._cache.getStore(e);return { "x-cloudbase-credentials": this._cache.getStore(t) + "/@@/" + n };} }, { key: "_onAnonymousConverted", value: function _onAnonymousConverted(e) {var t = e.data.env;t === this.config.env && this._cache.updatePersistence(this.config.persistence);} }, { key: "_onLoginTypeChanged", value: function _onLoginTypeChanged(e) {var _e$data = e.data,t = _e$data.loginType,n = _e$data.persistence,s = _e$data.env;s === this.config.env && (this._cache.updatePersistence(n), this._cache.setStore(this._cache.keys.loginTypeKey, t));} }, { key: "currentUser", get: function get() {var e = this.hasLoginState();return e && e.user || null;} }, { key: "loginType", get: function get() {return this._cache.getStore(this._cache.keys.loginTypeKey);} }]);return Ue;}();var Re = function Re(e, t) {t = t || z();var n = Te(this.config.env),s = e.cloudPath,o = e.filePath,r = e.onUploadProgress,_e$fileType = e.fileType,i = _e$fileType === void 0 ? "image" : _e$fileType;return n.send("storage.getUploadMetadata", { path: s }).then(function (e) {var _e$data2 = e.data,a = _e$data2.url,c = _e$data2.authorization,u = _e$data2.token,l = _e$data2.fileId,h = _e$data2.cosFileId,d = e.requestId,f = { key: s, signature: c, "x-cos-meta-fileid": h, success_action_status: "201", "x-cos-security-token": u };n.upload({ url: a, data: f, file: o, name: s, fileType: i, onUploadProgress: r }).then(function (e) {201 === e.statusCode ? t(null, { fileID: l, requestId: d }) : t(new x({ code: "STORAGE_REQUEST_FAIL", message: "STORAGE_REQUEST_FAIL: ".concat(e.data) }));}).catch(function (e) {t(e);});}).catch(function (e) {t(e);}), t.promise;},xe = function xe(e, t) {t = t || z();var n = Te(this.config.env),s = e.cloudPath;return n.send("storage.getUploadMetadata", { path: s }).then(function (e) {t(null, e);}).catch(function (e) {t(e);}), t.promise;},De = function De(_ref5, t) {var e = _ref5.fileList;if (t = t || z(), !e || !Array.isArray(e)) return { code: "INVALID_PARAM", message: "fileList必须是非空的数组" };var _iterator3 = _createForOfIteratorHelper(e),_step3;try {for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {var _t8 = _step3.value;if (!_t8 || "string" != typeof _t8) return { code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" };}} catch (err) {_iterator3.e(err);} finally {_iterator3.f();}var n = { fileid_list: e };return Te(this.config.env).send("storage.batchDeleteFile", n).then(function (e) {e.code ? t(null, e) : t(null, { fileList: e.data.delete_list, requestId: e.requestId });}).catch(function (e) {t(e);}), t.promise;},qe = function qe(_ref6, t) {var e = _ref6.fileList;t = t || z(), e && Array.isArray(e) || t(null, { code: "INVALID_PARAM", message: "fileList必须是非空的数组" });var n = [];var _iterator4 = _createForOfIteratorHelper(e),_step4;try {for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {var _s6 = _step4.value;"object" == typeof _s6 ? (_s6.hasOwnProperty("fileID") && _s6.hasOwnProperty("maxAge") || t(null, { code: "INVALID_PARAM", message: "fileList的元素必须是包含fileID和maxAge的对象" }), n.push({ fileid: _s6.fileID, max_age: _s6.maxAge })) : "string" == typeof _s6 ? n.push({ fileid: _s6 }) : t(null, { code: "INVALID_PARAM", message: "fileList的元素必须是字符串" });}} catch (err) {_iterator4.e(err);} finally {_iterator4.f();}var s = { file_list: n };return Te(this.config.env).send("storage.batchGetDownloadUrl", s).then(function (e) {e.code ? t(null, e) : t(null, { fileList: e.data.download_list, requestId: e.requestId });}).catch(function (e) {t(e);}), t.promise;},Le = /*#__PURE__*/function () {var _ref8 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee29(_ref7, t) {var e, n, s, o;return _regenerator.default.wrap(function _callee29$(_context29) {while (1) {switch (_context29.prev = _context29.next) {case 0:e = _ref7.fileID;_context29.next = 3;return qe.call(this, { fileList: [{ fileID: e, maxAge: 600 }] });case 3:n = _context29.sent.fileList[0];if (!("SUCCESS" !== n.code)) {_context29.next = 6;break;}return _context29.abrupt("return", t ? t(n) : new Promise(function (e) {e(n);}));case 6:s = Te(this.config.env);o = n.download_url;if (!(o = encodeURI(o), !t)) {_context29.next = 10;break;}return _context29.abrupt("return", s.download({ url: o }));case 10:_context29.t0 = t;_context29.next = 13;return s.download({ url: o });case 13:_context29.t1 = _context29.sent;(0, _context29.t0)(_context29.t1);case 15:case "end":return _context29.stop();}}}, _callee29, this);}));return function Le(_x26, _x27) {return _ref8.apply(this, arguments);};}(),Fe = function Fe(_ref9, r) {var e = _ref9.name,t = _ref9.data,n = _ref9.query,s = _ref9.parse,o = _ref9.search;var i = r || z();var a;try {a = t ? JSON.stringify(t) : "";} catch (e) {return Promise.reject(e);}if (!e) return Promise.reject(new x({ code: "PARAM_ERROR", message: "函数名不能为空" }));var c = { inQuery: n, parse: s, search: o, function_name: e, request_data: a };return Te(this.config.env).send("functions.invokeFunction", c).then(function (e) {if (e.code) i(null, e);else {var _t9 = e.data.response_data;if (s) i(null, { result: _t9, requestId: e.requestId });else try {_t9 = JSON.parse(e.data.response_data), i(null, { result: _t9, requestId: e.requestId });} catch (e) {i(new x({ message: "response data must be json" }));}}return i.promise;}).catch(function (e) {i(e);}), i.promise;},Ne = { timeout: 15e3, persistence: "session" },Me = {};var je = /*#__PURE__*/function () {function je(e) {_classCallCheck(this, je);this.config = e || this.config, this.authObj = void 0;}_createClass(je, [{ key: "init", value: function init(e) {switch (G.adapter || (this.requestClient = new G.adapter.reqClass({ timeout: e.timeout || 5e3, timeoutMsg: "\u8BF7\u6C42\u5728".concat((e.timeout || 5e3) / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD") })), this.config = _objectSpread(_objectSpread({}, Ne), e), !0) {case this.config.timeout > 6e5:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = 6e5;break;case this.config.timeout < 100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100;}return new je(this.config);} }, { key: "auth", value: function auth() {var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},e = _ref10.persistence;if (this.authObj) return this.authObj;var t = e || G.adapter.primaryStorage || Ne.persistence;var n;return t !== this.config.persistence && (this.config.persistence = t), function (e) {var t = e.env;ne[t] = new te(e), se[t] = new te(_objectSpread(_objectSpread({}, e), {}, { persistence: "local" }));}(this.config), n = this.config, ve[n.env] = new Se(n), this.authObj = new Ue(this.config), this.authObj;} }, { key: "on", value: function on(e, t) {return ce.apply(this, [e, t]);} }, { key: "off", value: function off(e, t) {return le.apply(this, [e, t]);} }, { key: "callFunction", value: function callFunction(e, t) {return Fe.apply(this, [e, t]);} }, { key: "deleteFile", value: function deleteFile(e, t) {return De.apply(this, [e, t]);} }, { key: "getTempFileURL", value: function getTempFileURL(e, t) {return qe.apply(this, [e, t]);} }, { key: "downloadFile", value: function downloadFile(e, t) {return Le.apply(this, [e, t]);} }, { key: "uploadFile", value: function uploadFile(e, t) {return Re.apply(this, [e, t]);} }, { key: "getUploadMetadata", value: function getUploadMetadata(e, t) {return xe.apply(this, [e, t]);} }, { key: "registerExtension", value: function registerExtension(e) {Me[e.name] = e;} }, { key: "invokeExtension", value: function () {var _invokeExtension = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee30(e, t) {var n;return _regenerator.default.wrap(function _callee30$(_context30) {while (1) {switch (_context30.prev = _context30.next) {case 0:n = Me[e];if (n) {_context30.next = 3;break;}throw new x({ message: "\u6269\u5C55".concat(e, " \u5FC5\u987B\u5148\u6CE8\u518C") });case 3:_context30.next = 5;return n.invoke(t, this);case 5:return _context30.abrupt("return", _context30.sent);case 6:case "end":return _context30.stop();}}}, _callee30, this);}));function invokeExtension(_x28, _x29) {return _invokeExtension.apply(this, arguments);}return invokeExtension;}() }, { key: "useAdapters", value: function useAdapters(e) {var _ref11 = X(e) || {},t = _ref11.adapter,n = _ref11.runtime;t && (G.adapter = t), n && (G.runtime = n);} }]);return je;}();var $e = new je();function Be(e, t, n) {void 0 === n && (n = {});var s = /\?/.test(t),o = "";for (var r in n) {"" === o ? !s && (t += "?") : o += "&", o += r + "=" + encodeURIComponent(n[r]);}return /^http(s)?:\/\//.test(t += o) ? t : "" + e + t;}var Ke = /*#__PURE__*/function () {function Ke() {_classCallCheck(this, Ke);}_createClass(Ke, [{ key: "post", value: function post(e) {var t = e.url,n = e.data,s = e.headers;return new Promise(function (e, o) {N.request({ url: Be("https:", t), data: n, method: "POST", header: s, success: function success(t) {e(t);}, fail: function fail(e) {o(e);} });});} }, { key: "upload", value: function upload(e) {return new Promise(function (t, n) {var s = e.url,o = e.file,r = e.data,i = e.headers,a = e.fileType,c = N.uploadFile({ url: Be("https:", s), name: "file", formData: Object.assign({}, r), filePath: o, fileType: a, header: i, success: function success(e) {var n = { statusCode: e.statusCode, data: e.data || {} };200 === e.statusCode && r.success_action_status && (n.statusCode = parseInt(r.success_action_status, 10)), t(n);}, fail: function fail(e) {h && "mp-alipay" === d && console.warn("支付宝小程序开发工具上传腾讯云时无法准确判断是否上传成功,请使用真机测试"), n(new Error(e.errMsg || "uploadFile:fail"));} });"function" == typeof e.onUploadProgress && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (t) {e.onUploadProgress({ loaded: t.totalBytesSent, total: t.totalBytesExpectedToSend });});});} }]);return Ke;}();var He = { setItem: function setItem(e, t) {N.setStorageSync(e, t);}, getItem: function getItem(e) {return N.getStorageSync(e);}, removeItem: function removeItem(e) {N.removeStorageSync(e);}, clear: function clear() {N.clearStorageSync();} };var We = { genAdapter: function genAdapter() {return { root: {}, reqClass: Ke, localStorage: He, primaryStorage: "local" };}, isMatch: function isMatch() {return !0;}, runtime: "uni_app" };$e.useAdapters(We);var ze = $e,Je = ze.init;ze.init = function (e) {e.env = e.spaceId;var t = Je.call(this, e);t.config.provider = "tencent", t.config.spaceId = e.spaceId;var n = t.auth;return t.auth = function (e) {var t = n.call(this, e);return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach(function (e) {t[e] = R(t[e]).bind(t);}), t;}, t.customAuth = t.auth, t;};var Ve = ze;function Ye() {return { token: N.getStorageSync("uni_id_token") || N.getStorageSync("uniIdToken"), tokenExpired: N.getStorageSync("uni_id_token_expired") };}function Xe() {var _ref12 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},e = _ref12.token,t = _ref12.tokenExpired;e && N.setStorageSync("uni_id_token", e), t && N.setStorageSync("uni_id_token_expired", t);}function Ge() {if (!h || "h5" !== d) return;uni.getStorageSync("__LAST_DCLOUD_APPID") !== m && (uni.setStorageSync("__LAST_DCLOUD_APPID", m), console.warn("检测到当前项目与上次运行到此端口的项目不一致,自动清理uni-id保存的token信息(仅开发调试时生效)"), N.removeStorageSync("uni_id_token"), N.removeStorageSync("uniIdToken"), N.removeStorageSync("uni_id_token_expired"));}var Qe = /*#__PURE__*/function (_$) {_inherits(Qe, _$);var _super8 = _createSuper(Qe);function Qe() {_classCallCheck(this, Qe);return _super8.apply(this, arguments);}_createClass(Qe, [{ key: "getAccessToken", value: function getAccessToken() {var _this12 = this;return new Promise(function (e, t) {var n = "Anonymous_Access_token";_this12.setAccessToken(n), e(n);});} }, { key: "setupRequest", value: function setupRequest(e, t) {var n = Object.assign({}, e, { spaceId: this.config.spaceId, timestamp: Date.now() }),s = { "Content-Type": "application/json" };"auth" !== t && (n.token = this.accessToken, s["x-basement-token"] = this.accessToken), s["x-serverless-sign"] = F.sign(n, this.config.clientSecret);var o = L();s["x-client-info"] = JSON.stringify(o);var _Ye = Ye(),r = _Ye.token;return s["x-client-token"] = r, { url: this.config.requestUrl, method: "POST", data: n, dataType: "json", header: JSON.parse(JSON.stringify(s)) };} }, { key: "uploadFileToOSS", value: function uploadFileToOSS(_ref13) {var _this13 = this;var e = _ref13.url,t = _ref13.formData,n = _ref13.name,s = _ref13.filePath,o = _ref13.fileType,r = _ref13.onUploadProgress;return new Promise(function (i, a) {var c = _this13.adapter.uploadFile({ url: e, formData: t, name: n, filePath: s, fileType: o, success: function success(e) {e && e.statusCode < 400 ? i(e) : a(new x({ code: "UPLOAD_FAILED", message: "文件上传失败" }));}, fail: function fail(e) {a(new x({ code: e.code || "UPLOAD_FAILED", message: e.message || e.errMsg || "文件上传失败" }));} });"function" == typeof r && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {r({ loaded: e.totalBytesSent, total: e.totalBytesExpectedToSend });});});} }, { key: "uploadFile", value: function uploadFile(_ref14) {var _this14 = this;var e = _ref14.filePath,t = _ref14.cloudPath,_ref14$fileType = _ref14.fileType,n = _ref14$fileType === void 0 ? "image" : _ref14$fileType,s = _ref14.onUploadProgress;if (!t) throw new x({ code: "CLOUDPATH_REQUIRED", message: "cloudPath不可为空" });var o;return this.getOSSUploadOptionsFromPath({ cloudPath: t }).then(function (t) {var _t$result = t.result,r = _t$result.url,i = _t$result.formData,a = _t$result.name;o = t.result.fileUrl;var c = { url: r, formData: i, name: a, filePath: e, fileType: n };return _this14.uploadFileToOSS(Object.assign({}, c, { onUploadProgress: s }));}).then(function () {return _this14.reportOSSUpload({ cloudPath: t });}).then(function (t) {return new Promise(function (n, s) {t.success ? n({ success: !0, filePath: e, fileID: o }) : s(new x({ code: "UPLOAD_FAILED", message: "文件上传失败" }));});});} }, { key: "deleteFile", value: function deleteFile(_ref15) {var e = _ref15.fileList;var t = { method: "serverless.file.resource.delete", params: JSON.stringify({ fileList: e }) };return this.request(this.setupRequest(t));} }, { key: "getTempFileURL", value: function getTempFileURL() {var _ref16 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},e = _ref16.fileList;var t = { method: "serverless.file.resource.getTempFileURL", params: JSON.stringify({ fileList: e }) };return this.request(this.setupRequest(t));} }]);return Qe;}($);var Ze = { init: function init(e) {var t = new Qe(e),n = { signInAnonymously: function signInAnonymously() {return t.authorize();}, getLoginState: function getLoginState() {return Promise.resolve(!1);} };return t.auth = function () {return n;}, t.customAuth = t.auth, t;} };function et(_ref17) {var e = _ref17.data;var t;t = L();var n = JSON.parse(JSON.stringify(e || {}));if (Object.assign(n, { clientInfo: t }), !n.uniIdToken) {var _Ye2 = Ye(),_e18 = _Ye2.token;_e18 && (n.uniIdToken = _e18);}return n;}function tt(_ref18) {var _this15 = this;var e = _ref18.name,t = _ref18.data;var n = this.localAddress,s = this.localPort,o = { aliyun: "aliyun", tencent: "tcb" }[this.config.provider],r = this.config.spaceId,i = "http://".concat(n, ":").concat(s, "/system/check-function"),a = "http://".concat(n, ":").concat(s, "/cloudfunctions/").concat(e);return new Promise(function (t, n) {N.request({ method: "POST", url: i, data: { name: e, platform: d, provider: o, spaceId: r }, timeout: 3e3, success: function success(e) {t(e);}, fail: function fail() {t({ data: { code: "NETWORK_ERROR", message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。" } });} });}).then(function () {var _ref19 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},e = _ref19.data;var _ref20 = e || {},t = _ref20.code,n = _ref20.message;return { code: 0 === t ? 0 : t || "SYS_ERR", message: n || "SYS_ERR" };}).then(function (_ref21) {var n = _ref21.code,s = _ref21.message;if (0 !== n) {switch (n) {case "MODULE_ENCRYPTED":console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e, "\uFF09\u4F9D\u8D56\u52A0\u5BC6\u516C\u5171\u6A21\u5757\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));break;case "FUNCTION_ENCRYPTED":console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e, "\uFF09\u5DF2\u52A0\u5BC6\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));break;case "ACTION_ENCRYPTED":console.error(s || "需要访问加密的uni-clientDB-action,自动切换为云端环境");break;case "NETWORK_ERROR":{var _e19 = "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下";throw console.error(_e19), new Error(_e19);}case "SWITCH_TO_CLOUD":break;default:{var _e20 = "\u68C0\u6D4B\u672C\u5730\u8C03\u8BD5\u670D\u52A1\u51FA\u73B0\u9519\u8BEF\uFF1A".concat(s, "\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u73AF\u5883\u6216\u91CD\u542F\u5BA2\u6237\u7AEF\u518D\u8BD5");throw console.error(_e20), new Error(_e20);}}return _this15._originCallFunction({ name: e, data: t });}return new Promise(function (e, n) {var s = et.call(_this15, { data: t });N.request({ method: "POST", url: a, data: { provider: o, platform: d, param: s }, success: function success() {var _ref22 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},t = _ref22.statusCode,s = _ref22.data;return !t || t >= 400 ? n(new x({ code: s.code || "SYS_ERR", message: s.message || "request:fail" })) : e({ result: s });}, fail: function fail(e) {n(new x({ code: e.code || e.errCode || "SYS_ERR", message: e.message || e.errMsg || "request:fail" }));} });});});}var nt = [{ rule: /fc_function_not_found|FUNCTION_NOT_FOUND/, content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间", mode: "append" }];var st = /[\\^$.*+?()[\]{}|]/g,ot = RegExp(st.source);function rt(e, t, n) {return e.replace(new RegExp((s = t) && ot.test(s) ? s.replace(st, "\\$&") : s, "g"), n);var s;}function it(_ref23) {var e = _ref23.functionName,t = _ref23.result,n = _ref23.logPvd;if (this.config.useDebugFunction && t && t.requestId) {var _s7 = JSON.stringify({ spaceId: this.config.spaceId, functionName: e, requestId: t.requestId });console.log("[".concat(n, "-request]").concat(_s7, "[/").concat(n, "-request]"));}}function at(e) {var t = e.callFunction,n = function n(_n5) {var _this16 = this;var s = _n5.name;_n5.data = et.call(e, { data: _n5.data });var o = { aliyun: "aliyun", tencent: "tcb", tcb: "tcb" }[this.config.provider];return t.call(this, _n5).then(function (e) {return e.errCode = 0, it.call(_this16, { functionName: s, result: e, logPvd: o }), Promise.resolve(e);}, function (e) {return it.call(_this16, { functionName: s, result: e, logPvd: o }), e && e.message && (e.message = function () {var _ref24 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},_ref24$message = _ref24.message,e = _ref24$message === void 0 ? "" : _ref24$message,_ref24$extraInfo = _ref24.extraInfo,t = _ref24$extraInfo === void 0 ? {} : _ref24$extraInfo,_ref24$formatter = _ref24.formatter,n = _ref24$formatter === void 0 ? [] : _ref24$formatter;for (var _s8 = 0; _s8 < n.length; _s8++) {var _n$_s = n[_s8],_o3 = _n$_s.rule,_r2 = _n$_s.content,i = _n$_s.mode,_a = e.match(_o3);if (!_a) continue;var _c = _r2;for (var _e21 = 1; _e21 < _a.length; _e21++) {_c = rt(_c, "{$".concat(_e21, "}"), _a[_e21]);}for (var _e22 in t) {_c = rt(_c, "{".concat(_e22, "}"), t[_e22]);}return "replace" === i ? _c : e + _c;}return e;}({ message: "[".concat(_n5.name, "]: ").concat(e.message), formatter: nt, extraInfo: { functionName: s } })), Promise.reject(e);});};e.callFunction = function (t) {var s;return h && e.debugInfo && !e.debugInfo.forceRemote && p ? (e._originCallFunction || (e._originCallFunction = n), s = tt.call(this, t)) : s = n.call(this, t), Object.defineProperty(s, "result", { get: function get() {return console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"), {};} }), s;};}var ct = Symbol("CLIENT_DB_INTERNAL");function ut(e, t) {return e.then = "DoNotReturnProxyWithAFunctionNamedThen", e._internalType = ct, e.__ob__ = void 0, new Proxy(e, { get: function get(e, n, s) {if ("_uniClient" === n) return null;if (n in e || "string" != typeof n) {var _t10 = e[n];return "function" == typeof _t10 ? _t10.bind(e) : _t10;}return t.get(e, n, s);} });}function lt(e) {return { on: function on(t, n) {e[t] = e[t] || [], e[t].indexOf(n) > -1 || e[t].push(n);}, off: function off(t, n) {e[t] = e[t] || [];var s = e[t].indexOf(n);-1 !== s && e[t].splice(s, 1);} };}var ht = ["db.Geo", "db.command", "command.aggregate"];function dt(e, t) {return ht.indexOf("".concat(e, ".").concat(t)) > -1;}function ft(e) {switch (c(e)) {case "array":return e.map(function (e) {return ft(e);});case "object":return e._internalType === ct || Object.keys(e).forEach(function (t) {e[t] = ft(e[t]);}), e;case "regexp":return { $regexp: { source: e.source, flags: e.flags } };case "date":return { $date: e.toISOString() };default:return e;}}var pt = /*#__PURE__*/function () {function pt(e, t, n) {_classCallCheck(this, pt);this.content = e, this.prevStage = t || null, this.udb = null, this._database = n;}_createClass(pt, [{ key: "toJSON", value: function toJSON() {var e = this;var t = [e.content];for (; e.prevStage;) {e = e.prevStage, t.push(e.content);}return { $db: t.reverse().map(function (e) {return { $method: e.$method, $param: ft(e.$param) };}) };} }, { key: "getAction", value: function getAction() {var e = this.toJSON().$db.find(function (e) {return "action" === e.$method;});return e && e.$param && e.$param[0];} }, { key: "getCommand", value: function getCommand() {return { $db: this.toJSON().$db.filter(function (e) {return "action" !== e.$method;}) };} }, { key: "get", value: function get() {return this._send("get", Array.from(arguments));} }, { key: "add", value: function add() {return this._send("add", Array.from(arguments));} }, { key: "remove", value: function remove() {return this._send("remove", Array.from(arguments));} }, { key: "update", value: function update() {return this._send("update", Array.from(arguments));} }, { key: "end", value: function end() {return this._send("end", Array.from(arguments));} }, { key: "set", value: function set() {throw new Error("clientDB禁止使用set方法");} }, { key: "_send", value: function _send(e, t) {var n = this.getAction(),s = this.getCommand();if (s.$db.push({ $method: e, $param: ft(t) }), h) {var _e23 = s.$db.find(function (e) {return "collection" === e.$method;}),_t11 = _e23 && _e23.$param;_t11 && 1 === _t11.length && "string" == typeof _e23.$param[0] && _e23.$param[0].indexOf(",") > -1 && console.warn("检测到使用JQL语法联表查询时,未使用getTemp先过滤主表数据,在主表数据量大的情况下可能会查询缓慢。\n- 如何优化请参考此文档:https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp \n- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。");}return this._database._callCloudFunction({ action: n, command: s });} }, { key: "useAggregate", get: function get() {var e = this,t = !1;for (; e.prevStage;) {e = e.prevStage;var _n6 = e.content.$method;if ("aggregate" === _n6 || "pipeline" === _n6) {t = !0;break;}}return t;} }, { key: "count", get: function get() {if (!this.useAggregate) return function () {return this._send("count", Array.from(arguments));};var e = this;return function () {return gt({ $method: "count", $param: ft(Array.from(arguments)) }, e, this._database);};} }]);return pt;}();function gt(e, t, n) {return ut(new pt(e, t, n), { get: function get(e, t) {var s = "db";return e && e.content && (s = e.content.$method), dt(s, t) ? gt({ $method: t }, e, n) : function () {return gt({ $method: t, $param: ft(Array.from(arguments)) }, e, n);};} });}function mt(_ref25) {var e = _ref25.path,t = _ref25.method;return /*#__PURE__*/function () {function _class2() {_classCallCheck(this, _class2);this.param = Array.from(arguments);}_createClass(_class2, [{ key: "toJSON", value: function toJSON() {return { $newDb: [].concat(_toConsumableArray(e.map(function (e) {return { $method: e };})), [{ $method: t, $param: this.param }]) };} }]);return _class2;}();}var yt = /*#__PURE__*/function (_ref26) {_inherits(yt, _ref26);var _super9 = _createSuper(yt);function yt() {_classCallCheck(this, yt);return _super9.apply(this, arguments);}_createClass(yt, [{ key: "_callCloudFunction", value: function _callCloudFunction(_ref27) {var _this17 = this;var e = _ref27.action,t = _ref27.command,n = _ref27.multiCommand,s = _ref27.queryList;function o(e, t) {if (n && s) for (var _n7 = 0; _n7 < s.length; _n7++) {var _o4 = s[_n7];_o4.udb && "function" == typeof _o4.udb.setResult && (t ? _o4.udb.setResult(t) : _o4.udb.setResult(e.result.dataList[_n7]));}}var r = this;function i(e) {return r._callback("error", [e]), T(A("database", "fail"), e).then(function () {return T(A("database", "complete"), e);}).then(function () {return o(null, e), U(I, { type: O, content: e }), Promise.reject(e);});}var c = T(A("database", "invoke")),u = this._uniClient;return c.then(function () {return u.callFunction({ name: "DCloud-clientDB", type: a, data: { action: e, command: t, multiCommand: n } });}).then(function (e) {var _e$result = e.result,t = _e$result.code,n = _e$result.message,s = _e$result.token,r = _e$result.tokenExpired,_e$result$systemInfo = _e$result.systemInfo,a = _e$result$systemInfo === void 0 ? [] : _e$result$systemInfo;if (a) for (var _e24 = 0; _e24 < a.length; _e24++) {var _a$_e = a[_e24],_t12 = _a$_e.level,_n8 = _a$_e.message,_s9 = _a$_e.detail,_o5 = console["app-plus" === d && "warn" === _t12 ? "error" : _t12] || console.log;var _r3 = "[System Info]" + _n8;_s9 && (_r3 = "".concat(_r3, "\n\u8BE6\u7EC6\u4FE1\u606F\uFF1A").concat(_s9)), _o5(_r3);}if (t) {return i(new x({ code: t, message: n, requestId: e.requestId }));}e.result.errCode = e.result.code, e.result.errMsg = e.result.message, s && r && (Xe({ token: s, tokenExpired: r }), _this17._callbackAuth("refreshToken", [{ token: s, tokenExpired: r }]), _this17._callback("refreshToken", [{ token: s, tokenExpired: r }]));var c = [{ prop: "affectedDocs", tips: "affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代" }, { prop: "code", tips: "code不再推荐使用,请使用errCode替代" }, { prop: "message", tips: "message不再推荐使用,请使用errMsg替代" }];var _loop = function _loop(_t13) {var _c$_t = c[_t13],n = _c$_t.prop,s = _c$_t.tips;if (n in e.result) {var _t14 = e.result[n];Object.defineProperty(e.result, n, { get: function get() {return console.warn(s), _t14;} });}};for (var _t13 = 0; _t13 < c.length; _t13++) {_loop(_t13);}return function (e) {return T(A("database", "success"), e).then(function () {return T(A("database", "complete"), e);}).then(function () {return o(e, null), U(I, { type: O, content: e }), Promise.resolve(e);});}(e);}, function (e) {/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message) && console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB");return i(new x({ code: e.code || "SYSTEM_ERROR", message: e.message, requestId: e.requestId }));});} }]);return yt;}( /*#__PURE__*/function () {function _class3() {var _ref28 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},_ref28$uniClient = _ref28.uniClient,e = _ref28$uniClient === void 0 ? {} : _ref28$uniClient;_classCallCheck(this, _class3);this._uniClient = e, this._authCallBacks = {}, this._dbCallBacks = {}, e.isDefault && (this._dbCallBacks = _("_globalUniCloudDatabaseCallback")), this.auth = lt(this._authCallBacks), Object.assign(this, lt(this._dbCallBacks)), this.env = ut({}, { get: function get(e, t) {return { $env: t };} }), this.Geo = ut({}, { get: function get(e, t) {return mt({ path: ["Geo"], method: t });} }), this.serverDate = mt({ path: [], method: "serverDate" }), this.RegExp = mt({ path: [], method: "RegExp" });}_createClass(_class3, [{ key: "getCloudEnv", value: function getCloudEnv(e) {if ("string" != typeof e || !e.trim()) throw new Error("getCloudEnv参数错误");return { $env: e.replace("$cloudEnv_", "") };} }, { key: "_callback", value: function _callback(e, t) {var n = this._dbCallBacks;n[e] && n[e].forEach(function (e) {e.apply(void 0, _toConsumableArray(t));});} }, { key: "_callbackAuth", value: function _callbackAuth(e, t) {var n = this._authCallBacks;n[e] && n[e].forEach(function (e) {e.apply(void 0, _toConsumableArray(t));});} }, { key: "multiSend", value: function multiSend() {var e = Array.from(arguments),t = e.map(function (e) {var t = e.getAction(),n = e.getCommand();if ("getTemp" !== n.$db[n.$db.length - 1].$method) throw new Error("multiSend只支持子命令内使用getTemp");return { action: t, command: n };});return this._callCloudFunction({ multiCommand: t, queryList: e });} }]);return _class3;}());function _t(e) {e.database = function (t) {if (t && Object.keys(t).length > 0) return e.init(t).database();if (this._database) return this._database;var n = function (e) {var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};return ut(new e(t), { get: function get(e, t) {return dt("db", t) ? gt({ $method: t }, null, e) : function () {return gt({ $method: t, $param: ft(Array.from(arguments)) }, null, e);};} });}(yt, { uniClient: e });return this._database = n, n;};}function wt(e) {e.onResponse = function (e) {!function (e, t) {var n = E(e);n.includes(t) || n.push(t);}(I, e);}, e.offResponse = function (e) {!function (e, t) {var n = E(e),s = n.indexOf(t);-1 !== s && n.splice(s, 1);}(I, e);};}var kt;var St = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",vt = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Tt() {var e = Ye().token || "",t = e.split(".");if (!e || 3 !== t.length) return { uid: null, role: [], permission: [], tokenExpired: 0 };var n;try {n = JSON.parse((s = t[1], decodeURIComponent(kt(s).split("").map(function (e) {return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);}).join(""))));} catch (e) {throw new Error("获取当前用户信息出错,详细错误信息为:" + e.message);}var s;return n.tokenExpired = 1e3 * n.exp, delete n.exp, delete n.iat, n;}kt = "function" != typeof atob ? function (e) {if (e = String(e).replace(/[\t\n\f\r ]+/g, ""), !vt.test(e)) throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e += "==".slice(2 - (3 & e.length));for (var n, s, o = "", r = 0; r < e.length;) {t = St.indexOf(e.charAt(r++)) << 18 | St.indexOf(e.charAt(r++)) << 12 | (n = St.indexOf(e.charAt(r++))) << 6 | (s = St.indexOf(e.charAt(r++))), o += 64 === n ? String.fromCharCode(t >> 16 & 255) : 64 === s ? String.fromCharCode(t >> 16 & 255, t >> 8 & 255) : String.fromCharCode(t >> 16 & 255, t >> 8 & 255, 255 & t);}return o;} : atob;var At = t(n(function (e, t) {Object.defineProperty(t, "__esModule", { value: !0 });var n = "chooseAndUploadFile:ok",s = "chooseAndUploadFile:fail";function o(e, t) {return e.tempFiles.forEach(function (e, n) {e.name || (e.name = e.path.substring(e.path.lastIndexOf("/") + 1)), t && (e.fileType = t), e.cloudPath = Date.now() + "_" + n + e.name.substring(e.name.lastIndexOf("."));}), e.tempFilePaths || (e.tempFilePaths = e.tempFiles.map(function (e) {return e.path;})), e;}function r(e, t, _ref29) {var s = _ref29.onChooseFile,o = _ref29.onUploadProgress;return t.then(function (e) {if (s) {var _t15 = s(e);if (void 0 !== _t15) return Promise.resolve(_t15).then(function (t) {return void 0 === t ? e : t;});}return e;}).then(function (t) {return !1 === t ? { errMsg: n, tempFilePaths: [], tempFiles: [] } : function (e, t) {var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;var o = arguments.length > 3 ? arguments[3] : undefined;(t = Object.assign({}, t)).errMsg = n;var r = t.tempFiles,i = r.length;var a = 0;return new Promise(function (n) {for (; a < s;) {c();}function c() {var s = a++;if (s >= i) return void (!r.find(function (e) {return !e.url && !e.errMsg;}) && n(t));var u = r[s];e.uploadFile({ filePath: u.path, cloudPath: u.cloudPath, fileType: u.fileType, onUploadProgress: function onUploadProgress(e) {e.index = s, e.tempFile = u, e.tempFilePath = u.path, o && o(e);} }).then(function (e) {u.url = e.fileID, s < i && c();}).catch(function (e) {u.errMsg = e.errMsg || e.message, s < i && c();});}});}(e, t, 5, o);});}t.initChooseAndUploadFile = function (e) {return function () {var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { type: "all" };return "image" === t.type ? r(e, function (e) {var t = e.count,n = e.sizeType,_e$sourceType = e.sourceType,r = _e$sourceType === void 0 ? ["album", "camera"] : _e$sourceType,i = e.extension;return new Promise(function (e, a) {uni.chooseImage({ count: t, sizeType: n, sourceType: r, extension: i, success: function success(t) {e(o(t, "image"));}, fail: function fail(e) {a({ errMsg: e.errMsg.replace("chooseImage:fail", s) });} });});}(t), t) : "video" === t.type ? r(e, function (e) {var t = e.camera,n = e.compressed,r = e.maxDuration,_e$sourceType2 = e.sourceType,i = _e$sourceType2 === void 0 ? ["album", "camera"] : _e$sourceType2,a = e.extension;return new Promise(function (e, c) {uni.chooseVideo({ camera: t, compressed: n, maxDuration: r, sourceType: i, extension: a, success: function success(t) {var n = t.tempFilePath,s = t.duration,r = t.size,i = t.height,a = t.width;e(o({ errMsg: "chooseVideo:ok", tempFilePaths: [n], tempFiles: [{ name: t.tempFile && t.tempFile.name || "", path: n, size: r, type: t.tempFile && t.tempFile.type || "", width: a, height: i, duration: s, fileType: "video", cloudPath: "" }] }, "video"));}, fail: function fail(e) {c({ errMsg: e.errMsg.replace("chooseVideo:fail", s) });} });});}(t), t) : r(e, function (e) {var t = e.count,n = e.extension;return new Promise(function (e, r) {var i = uni.chooseFile;if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (i = wx.chooseMessageFile), "function" != typeof i) return r({ errMsg: s + " 请指定 type 类型,该平台仅支持选择 image 或 video。" });i({ type: "all", count: t, extension: n, success: function success(t) {e(o(t));}, fail: function fail(e) {r({ errMsg: e.errMsg.replace("chooseFile:fail", s) });} });});}(t), t);};};}));var Pt = "manual";function It(e) {return { props: { localdata: { type: Array, default: function _default() {return [];} }, options: { type: [Object, Array], default: function _default() {return {};} }, spaceInfo: { type: Object, default: function _default() {return {};} }, collection: { type: [String, Array], default: "" }, action: { type: String, default: "" }, field: { type: String, default: "" }, orderby: { type: String, default: "" }, where: { type: [String, Object], default: "" }, pageData: { type: String, default: "add" }, pageCurrent: { type: Number, default: 1 }, pageSize: { type: Number, default: 20 }, getcount: { type: [Boolean, String], default: !1 }, gettree: { type: [Boolean, String], default: !1 }, gettreepath: { type: [Boolean, String], default: !1 }, startwith: { type: String, default: "" }, limitlevel: { type: Number, default: 10 }, groupby: { type: String, default: "" }, groupField: { type: String, default: "" }, distinct: { type: [Boolean, String], default: !1 }, foreignKey: { type: String, default: "" }, loadtime: { type: String, default: "auto" }, manual: { type: Boolean, default: !1 } }, data: function data() {return { mixinDatacomLoading: !1, mixinDatacomHasMore: !1, mixinDatacomResData: [], mixinDatacomErrorMessage: "", mixinDatacomPage: {} };}, created: function created() {var _this18 = this;this.mixinDatacomPage = { current: this.pageCurrent, size: this.pageSize, count: 0 }, this.$watch(function () {var e = [];return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach(function (t) {e.push(_this18[t]);}), e;}, function (e, t) {if (_this18.loadtime === Pt) return;var n = !1;var s = [];for (var _o6 = 2; _o6 < e.length; _o6++) {e[_o6] !== t[_o6] && (s.push(e[_o6]), n = !0);}e[0] !== t[0] && (_this18.mixinDatacomPage.current = _this18.pageCurrent), _this18.mixinDatacomPage.size = _this18.pageSize, _this18.onMixinDatacomPropsChange(n, s);});}, methods: { onMixinDatacomPropsChange: function onMixinDatacomPropsChange(e, t) {}, mixinDatacomEasyGet: function mixinDatacomEasyGet() {var _this19 = this;var _ref30 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},_ref30$getone = _ref30.getone,e = _ref30$getone === void 0 ? !1 : _ref30$getone,t = _ref30.success,n = _ref30.fail;this.mixinDatacomLoading || (this.mixinDatacomLoading = !0, this.mixinDatacomErrorMessage = "", this.mixinDatacomGet().then(function (n) {_this19.mixinDatacomLoading = !1;var _n$result = n.result,s = _n$result.data,o = _n$result.count;_this19.getcount && (_this19.mixinDatacomPage.count = o), _this19.mixinDatacomHasMore = s.length < _this19.pageSize;var r = e ? s.length ? s[0] : void 0 : s;_this19.mixinDatacomResData = r, t && t(r);}).catch(function (e) {_this19.mixinDatacomLoading = !1, _this19.mixinDatacomErrorMessage = e, n && n(e);}));}, mixinDatacomGet: function mixinDatacomGet() {var _n9;var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};var n = e.database(this.spaceInfo);var s = t.action || this.action;s && (n = n.action(s));var o = t.collection || this.collection;n = Array.isArray(o) ? (_n9 = n).collection.apply(_n9, _toConsumableArray(o)) : n.collection(o);var r = t.where || this.where;r && Object.keys(r).length && (n = n.where(r));var i = t.field || this.field;i && (n = n.field(i));var a = t.foreignKey || this.foreignKey;a && (n = n.foreignKey(a));var c = t.groupby || this.groupby;c && (n = n.groupBy(c));var u = t.groupField || this.groupField;u && (n = n.groupField(u));!0 === (void 0 !== t.distinct ? t.distinct : this.distinct) && (n = n.distinct());var l = t.orderby || this.orderby;l && (n = n.orderBy(l));var h = void 0 !== t.pageCurrent ? t.pageCurrent : this.mixinDatacomPage.current,d = void 0 !== t.pageSize ? t.pageSize : this.mixinDatacomPage.size,f = void 0 !== t.getcount ? t.getcount : this.getcount,p = void 0 !== t.gettree ? t.gettree : this.gettree,g = void 0 !== t.gettreepath ? t.gettreepath : this.gettreepath,m = { getCount: f },y = { limitLevel: void 0 !== t.limitlevel ? t.limitlevel : this.limitlevel, startWith: void 0 !== t.startwith ? t.startwith : this.startwith };return p && (m.getTree = y), g && (m.getTreePath = y), n = n.skip(d * (h - 1)).limit(d).get(m), n;} } };}function Ot(e) {return function (t) {var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};n = function (e) {var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};return e.customUI = t.customUI || e.customUI, Object.assign(e.loadingOptions, t.loadingOptions), Object.assign(e.errorOptions, t.errorOptions), e;}({ customUI: !1, loadingOptions: { title: "加载中...", mask: !0 }, errorOptions: { type: "modal", retry: !1 } }, n);var _n10 = n,s = _n10.customUI,o = _n10.loadingOptions,r = _n10.errorOptions,a = !s;return new Proxy({}, { get: function get(n, s) {return /*#__PURE__*/function () {var _n11 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee32() {var u,_len,c,_key,_ref31,l,h,d,_yield,_e26,_e25,_args32 = arguments;return _regenerator.default.wrap(function _callee32$(_context32) {while (1) {switch (_context32.prev = _context32.next) {case 0:a && uni.showLoading({ title: o.title, mask: o.mask });for (_len = _args32.length, c = new Array(_len), _key = 0; _key < _len; _key++) {c[_key] = _args32[_key];}_context32.prev = 2;_context32.next = 5;return e.callFunction({ name: t, type: i, data: { method: s, params: c } });case 5:u = _context32.sent;_context32.next = 11;break;case 8:_context32.prev = 8;_context32.t0 = _context32["catch"](2);u = { result: _context32.t0 };case 11:_ref31 = u.result || {}, l = _ref31.errCode, h = _ref31.errMsg, d = _ref31.newToken;if (!(a && uni.hideLoading(), d && d.token && d.tokenExpired && Xe(d), l)) {_context32.next = 28;break;}if (!a) {_context32.next = 26;break;}if (!("toast" === r.type)) {_context32.next = 18;break;}uni.showToast({ title: h, icon: "none" });_context32.next = 26;break;case 18:if (!("modal" !== r.type)) {_context32.next = 20;break;}throw new Error("Invalid errorOptions.type: ".concat(r.type));case 20:_context32.next = 22;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee31() {var _ref33,e,t,n,s,o,_args31 = arguments;return _regenerator.default.wrap(function _callee31$(_context31) {while (1) {switch (_context31.prev = _context31.next) {case 0:_ref33 = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {}, e = _ref33.title, t = _ref33.content, n = _ref33.showCancel, s = _ref33.cancelText, o = _ref33.confirmText;return _context31.abrupt("return", new Promise(function (r, i) {uni.showModal({ title: e, content: t, showCancel: n, cancelText: s, confirmText: o, success: function success(e) {r(e);}, fail: function fail() {r({ confirm: !1, cancel: !0 });} });}));case 2:case "end":return _context31.stop();}}}, _callee31);}))({ title: "提示", content: h, showCancel: r.retry, cancelText: "取消", confirmText: r.retry ? "重试" : "确定" });case 22:_yield = _context32.sent;_e26 = _yield.confirm;if (!(r.retry && _e26)) {_context32.next = 26;break;}return _context32.abrupt("return", n.apply(void 0, c));case 26:_e25 = new x({ code: l, message: h, requestId: u.requestId });throw _e25.detail = u.result, U(I, { type: C, content: _e25 }), _e25;case 28:return _context32.abrupt("return", (U(I, { type: C, content: u.result }), u.result));case 29:case "end":return _context32.stop();}}}, _callee32, null, [[2, 8]]);}));function n() {return _n11.apply(this, arguments);}return n;}();} });};}function bt(_x30, _x31) {return _bt.apply(this, arguments);}function _bt() {_bt = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee34(e, t) {var n, _e29, s;return _regenerator.default.wrap(function _callee34$(_context34) {while (1) {switch (_context34.prev = _context34.next) {case 0:n = "http://".concat(e, ":").concat(t, "/system/ping");_context34.prev = 1;_context34.next = 4;return s = { url: n, timeout: 500 }, new Promise(function (e, t) {N.request(_objectSpread(_objectSpread({}, s), {}, { success: function success(t) {e(t);}, fail: function fail(e) {t(e);} }));});case 4:_e29 = _context34.sent;return _context34.abrupt("return", !(!_e29.data || 0 !== _e29.data.code));case 8:_context34.prev = 8;_context34.t0 = _context34["catch"](1);return _context34.abrupt("return", !1);case 11:case "end":return _context34.stop();}}}, _callee34, null, [[1, 8]]);}));return _bt.apply(this, arguments);}function Ct(e) {if (e.initUniCloudStatus && "rejected" !== e.initUniCloudStatus) return;var t = Promise.resolve();var n;n = 1, t = new Promise(function (e, t) {setTimeout(function () {e();}, n);}), e.isReady = !1, e.isDefault = !1;var s = e.auth();e.initUniCloudStatus = "pending", e.initUniCloud = t.then(function () {return s.getLoginState();}).then(function (e) {return e ? Promise.resolve() : s.signInAnonymously();}).then(function () {if (!h) return Promise.resolve();if (h && e.debugInfo) {var _e$debugInfo = e.debugInfo,_t16 = _e$debugInfo.address,_n12 = _e$debugInfo.servePort;return function () {var _ref34 = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee33(e, t) {var n, _s10, _o7;return _regenerator.default.wrap(function _callee33$(_context33) {while (1) {switch (_context33.prev = _context33.next) {case 0:_s10 = 0;case 1:if (!(_s10 < e.length)) {_context33.next = 11;break;}_o7 = e[_s10];_context33.next = 5;return bt(_o7, t);case 5:if (!_context33.sent) {_context33.next = 8;break;}n = _o7;return _context33.abrupt("break", 11);case 8:_s10++;_context33.next = 1;break;case 11:return _context33.abrupt("return", { address: n, port: t });case 12:case "end":return _context33.stop();}}}, _callee33);}));return function (_x32, _x33) {return _ref34.apply(this, arguments);};}()(_t16, _n12);}}).then(function () {var _ref35 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},t = _ref35.address,n = _ref35.port;if (!h) return Promise.resolve();if (t) e.localAddress = t, e.localPort = n;else if (e.debugInfo) {var _t17 = console["app-plus" === d ? "error" : "warn"];var _n13 = "";"remote" === e.debugInfo.initialLaunchType ? (e.debugInfo.forceRemote = !0, _n13 = "当前客户端和HBuilderX不在同一局域网下(或其他网络原因无法连接HBuilderX),uniCloud本地调试服务不对当前客户端生效。\n- 如果不使用uniCloud本地调试服务,请直接忽略此信息。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。\n- 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs") : _n13 = "无法连接uniCloud本地调试服务,请检查当前客户端是否与主机在同一局域网下。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。\n- 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs", "h5" === d && (_n13 += "\n- 部分浏览器开启节流模式之后访问本地地址受限,请检查是否启用了节流模式"), _t17(_n13);}}).then(function () {Ge(), e.isReady = !0, e.initUniCloudStatus = "fulfilled";}).catch(function (t) {console.error(t), e.initUniCloudStatus = "rejected";});}var Et = new ( /*#__PURE__*/function () {function _class4() {_classCallCheck(this, _class4);}_createClass(_class4, [{ key: "init", value: function init(e) {var t = {};var n = !1 !== e.debugFunction && h && ("h5" === d && navigator.userAgent.indexOf("HBuilderX") > 0 || "app-plus" === d);switch (e.provider) {case "tcb":case "tencent":t = Ve.init(Object.assign(e, { useDebugFunction: n }));break;case "aliyun":t = B.init(Object.assign(e, { useDebugFunction: n }));break;case "private":t = Ze.init(Object.assign(e, { useDebugFunction: n }));break;default:throw new Error("未提供正确的provider参数");}var s = f;h && s && !s.code && (t.debugInfo = s), Ct(t), t.reInit = function () {Ct(this);}, at(t), function (e) {var t = e.uploadFile;e.uploadFile = function (e) {return t.call(this, e);};}(t), _t(t), function (e) {e.getCurrentUserInfo = Tt, e.chooseAndUploadFile = At.initChooseAndUploadFile(e), Object.assign(e, { get mixinDatacom() {return It(e);} }), e.importObject = Ot(e);}(t);return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach(function (e) {if (!t[e]) return;var n = t[e];t[e] = function () {return t.reInit(), n.apply(t, Array.from(arguments));}, t[e] = R(t[e], e).bind(t);}), t.init = this.init, t;} }]);return _class4;}())();(function () {{var e = p;var t = {};if (1 === e.length) t = e[0], Et = Et.init(t), Et.isDefault = !0;else {var _t18 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "database", "getCurrentUSerInfo", "importObject"];var _n14;_n14 = e && e.length > 0 ? "应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间" : g ? "应用未关联服务空间,请在uniCloud目录右键关联服务空间" : "uni-app cli项目内使用uniCloud需要使用HBuilderX的运行菜单运行项目,且需要在uniCloud目录关联服务空间", _t18.forEach(function (e) {Et[e] = function () {return console.error(_n14), Promise.reject(new x({ code: "SYS_ERR", message: _n14 }));};});}Object.assign(Et, { get mixinDatacom() {return It(Et);} }), wt(Et), Et.addInterceptor = S, Et.removeInterceptor = v, h && "h5" === d && (window.uniCloud = Et);}})();var Ut = Et;exports.default = Ut;
  2070. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 2), __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  2071. /***/ }),
  2072. /***/ 107:
  2073. /*!**********************************************************!*\
  2074. !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
  2075. \**********************************************************/
  2076. /*! no static exports found */
  2077. /***/ (function(module, exports, __webpack_require__) {
  2078. module.exports = __webpack_require__(/*! regenerator-runtime */ 108);
  2079. /***/ }),
  2080. /***/ 108:
  2081. /*!************************************************************!*\
  2082. !*** ./node_modules/regenerator-runtime/runtime-module.js ***!
  2083. \************************************************************/
  2084. /*! no static exports found */
  2085. /***/ (function(module, exports, __webpack_require__) {
  2086. /**
  2087. * Copyright (c) 2014-present, Facebook, Inc.
  2088. *
  2089. * This source code is licensed under the MIT license found in the
  2090. * LICENSE file in the root directory of this source tree.
  2091. */
  2092. // This method of obtaining a reference to the global object needs to be
  2093. // kept identical to the way it is obtained in runtime.js
  2094. var g = (function() {
  2095. return this || (typeof self === "object" && self);
  2096. })() || Function("return this")();
  2097. // Use `getOwnPropertyNames` because not all browsers support calling
  2098. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  2099. var hadRuntime = g.regeneratorRuntime &&
  2100. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  2101. // Save the old regeneratorRuntime in case it needs to be restored later.
  2102. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  2103. // Force reevalutation of runtime.js.
  2104. g.regeneratorRuntime = undefined;
  2105. module.exports = __webpack_require__(/*! ./runtime */ 109);
  2106. if (hadRuntime) {
  2107. // Restore the original runtime.
  2108. g.regeneratorRuntime = oldRuntime;
  2109. } else {
  2110. // Remove the global property added by runtime.js.
  2111. try {
  2112. delete g.regeneratorRuntime;
  2113. } catch(e) {
  2114. g.regeneratorRuntime = undefined;
  2115. }
  2116. }
  2117. /***/ }),
  2118. /***/ 109:
  2119. /*!*****************************************************!*\
  2120. !*** ./node_modules/regenerator-runtime/runtime.js ***!
  2121. \*****************************************************/
  2122. /*! no static exports found */
  2123. /***/ (function(module, exports) {
  2124. /**
  2125. * Copyright (c) 2014-present, Facebook, Inc.
  2126. *
  2127. * This source code is licensed under the MIT license found in the
  2128. * LICENSE file in the root directory of this source tree.
  2129. */
  2130. !(function(global) {
  2131. "use strict";
  2132. var Op = Object.prototype;
  2133. var hasOwn = Op.hasOwnProperty;
  2134. var undefined; // More compressible than void 0.
  2135. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  2136. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  2137. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  2138. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  2139. var inModule = typeof module === "object";
  2140. var runtime = global.regeneratorRuntime;
  2141. if (runtime) {
  2142. if (inModule) {
  2143. // If regeneratorRuntime is defined globally and we're in a module,
  2144. // make the exports object identical to regeneratorRuntime.
  2145. module.exports = runtime;
  2146. }
  2147. // Don't bother evaluating the rest of this file if the runtime was
  2148. // already defined globally.
  2149. return;
  2150. }
  2151. // Define the runtime globally (as expected by generated code) as either
  2152. // module.exports (if we're in a module) or a new, empty object.
  2153. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  2154. function wrap(innerFn, outerFn, self, tryLocsList) {
  2155. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  2156. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  2157. var generator = Object.create(protoGenerator.prototype);
  2158. var context = new Context(tryLocsList || []);
  2159. // The ._invoke method unifies the implementations of the .next,
  2160. // .throw, and .return methods.
  2161. generator._invoke = makeInvokeMethod(innerFn, self, context);
  2162. return generator;
  2163. }
  2164. runtime.wrap = wrap;
  2165. // Try/catch helper to minimize deoptimizations. Returns a completion
  2166. // record like context.tryEntries[i].completion. This interface could
  2167. // have been (and was previously) designed to take a closure to be
  2168. // invoked without arguments, but in all the cases we care about we
  2169. // already have an existing method we want to call, so there's no need
  2170. // to create a new function object. We can even get away with assuming
  2171. // the method takes exactly one argument, since that happens to be true
  2172. // in every case, so we don't have to touch the arguments object. The
  2173. // only additional allocation required is the completion record, which
  2174. // has a stable shape and so hopefully should be cheap to allocate.
  2175. function tryCatch(fn, obj, arg) {
  2176. try {
  2177. return { type: "normal", arg: fn.call(obj, arg) };
  2178. } catch (err) {
  2179. return { type: "throw", arg: err };
  2180. }
  2181. }
  2182. var GenStateSuspendedStart = "suspendedStart";
  2183. var GenStateSuspendedYield = "suspendedYield";
  2184. var GenStateExecuting = "executing";
  2185. var GenStateCompleted = "completed";
  2186. // Returning this object from the innerFn has the same effect as
  2187. // breaking out of the dispatch switch statement.
  2188. var ContinueSentinel = {};
  2189. // Dummy constructor functions that we use as the .constructor and
  2190. // .constructor.prototype properties for functions that return Generator
  2191. // objects. For full spec compliance, you may wish to configure your
  2192. // minifier not to mangle the names of these two functions.
  2193. function Generator() {}
  2194. function GeneratorFunction() {}
  2195. function GeneratorFunctionPrototype() {}
  2196. // This is a polyfill for %IteratorPrototype% for environments that
  2197. // don't natively support it.
  2198. var IteratorPrototype = {};
  2199. IteratorPrototype[iteratorSymbol] = function () {
  2200. return this;
  2201. };
  2202. var getProto = Object.getPrototypeOf;
  2203. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  2204. if (NativeIteratorPrototype &&
  2205. NativeIteratorPrototype !== Op &&
  2206. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  2207. // This environment has a native %IteratorPrototype%; use it instead
  2208. // of the polyfill.
  2209. IteratorPrototype = NativeIteratorPrototype;
  2210. }
  2211. var Gp = GeneratorFunctionPrototype.prototype =
  2212. Generator.prototype = Object.create(IteratorPrototype);
  2213. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  2214. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  2215. GeneratorFunctionPrototype[toStringTagSymbol] =
  2216. GeneratorFunction.displayName = "GeneratorFunction";
  2217. // Helper for defining the .next, .throw, and .return methods of the
  2218. // Iterator interface in terms of a single ._invoke method.
  2219. function defineIteratorMethods(prototype) {
  2220. ["next", "throw", "return"].forEach(function(method) {
  2221. prototype[method] = function(arg) {
  2222. return this._invoke(method, arg);
  2223. };
  2224. });
  2225. }
  2226. runtime.isGeneratorFunction = function(genFun) {
  2227. var ctor = typeof genFun === "function" && genFun.constructor;
  2228. return ctor
  2229. ? ctor === GeneratorFunction ||
  2230. // For the native GeneratorFunction constructor, the best we can
  2231. // do is to check its .name property.
  2232. (ctor.displayName || ctor.name) === "GeneratorFunction"
  2233. : false;
  2234. };
  2235. runtime.mark = function(genFun) {
  2236. if (Object.setPrototypeOf) {
  2237. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  2238. } else {
  2239. genFun.__proto__ = GeneratorFunctionPrototype;
  2240. if (!(toStringTagSymbol in genFun)) {
  2241. genFun[toStringTagSymbol] = "GeneratorFunction";
  2242. }
  2243. }
  2244. genFun.prototype = Object.create(Gp);
  2245. return genFun;
  2246. };
  2247. // Within the body of any async function, `await x` is transformed to
  2248. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  2249. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  2250. // meant to be awaited.
  2251. runtime.awrap = function(arg) {
  2252. return { __await: arg };
  2253. };
  2254. function AsyncIterator(generator) {
  2255. function invoke(method, arg, resolve, reject) {
  2256. var record = tryCatch(generator[method], generator, arg);
  2257. if (record.type === "throw") {
  2258. reject(record.arg);
  2259. } else {
  2260. var result = record.arg;
  2261. var value = result.value;
  2262. if (value &&
  2263. typeof value === "object" &&
  2264. hasOwn.call(value, "__await")) {
  2265. return Promise.resolve(value.__await).then(function(value) {
  2266. invoke("next", value, resolve, reject);
  2267. }, function(err) {
  2268. invoke("throw", err, resolve, reject);
  2269. });
  2270. }
  2271. return Promise.resolve(value).then(function(unwrapped) {
  2272. // When a yielded Promise is resolved, its final value becomes
  2273. // the .value of the Promise<{value,done}> result for the
  2274. // current iteration.
  2275. result.value = unwrapped;
  2276. resolve(result);
  2277. }, function(error) {
  2278. // If a rejected Promise was yielded, throw the rejection back
  2279. // into the async generator function so it can be handled there.
  2280. return invoke("throw", error, resolve, reject);
  2281. });
  2282. }
  2283. }
  2284. var previousPromise;
  2285. function enqueue(method, arg) {
  2286. function callInvokeWithMethodAndArg() {
  2287. return new Promise(function(resolve, reject) {
  2288. invoke(method, arg, resolve, reject);
  2289. });
  2290. }
  2291. return previousPromise =
  2292. // If enqueue has been called before, then we want to wait until
  2293. // all previous Promises have been resolved before calling invoke,
  2294. // so that results are always delivered in the correct order. If
  2295. // enqueue has not been called before, then it is important to
  2296. // call invoke immediately, without waiting on a callback to fire,
  2297. // so that the async generator function has the opportunity to do
  2298. // any necessary setup in a predictable way. This predictability
  2299. // is why the Promise constructor synchronously invokes its
  2300. // executor callback, and why async functions synchronously
  2301. // execute code before the first await. Since we implement simple
  2302. // async functions in terms of async generators, it is especially
  2303. // important to get this right, even though it requires care.
  2304. previousPromise ? previousPromise.then(
  2305. callInvokeWithMethodAndArg,
  2306. // Avoid propagating failures to Promises returned by later
  2307. // invocations of the iterator.
  2308. callInvokeWithMethodAndArg
  2309. ) : callInvokeWithMethodAndArg();
  2310. }
  2311. // Define the unified helper method that is used to implement .next,
  2312. // .throw, and .return (see defineIteratorMethods).
  2313. this._invoke = enqueue;
  2314. }
  2315. defineIteratorMethods(AsyncIterator.prototype);
  2316. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  2317. return this;
  2318. };
  2319. runtime.AsyncIterator = AsyncIterator;
  2320. // Note that simple async functions are implemented on top of
  2321. // AsyncIterator objects; they just return a Promise for the value of
  2322. // the final result produced by the iterator.
  2323. runtime.async = function(innerFn, outerFn, self, tryLocsList) {
  2324. var iter = new AsyncIterator(
  2325. wrap(innerFn, outerFn, self, tryLocsList)
  2326. );
  2327. return runtime.isGeneratorFunction(outerFn)
  2328. ? iter // If outerFn is a generator, return the full iterator.
  2329. : iter.next().then(function(result) {
  2330. return result.done ? result.value : iter.next();
  2331. });
  2332. };
  2333. function makeInvokeMethod(innerFn, self, context) {
  2334. var state = GenStateSuspendedStart;
  2335. return function invoke(method, arg) {
  2336. if (state === GenStateExecuting) {
  2337. throw new Error("Generator is already running");
  2338. }
  2339. if (state === GenStateCompleted) {
  2340. if (method === "throw") {
  2341. throw arg;
  2342. }
  2343. // Be forgiving, per 25.3.3.3.3 of the spec:
  2344. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  2345. return doneResult();
  2346. }
  2347. context.method = method;
  2348. context.arg = arg;
  2349. while (true) {
  2350. var delegate = context.delegate;
  2351. if (delegate) {
  2352. var delegateResult = maybeInvokeDelegate(delegate, context);
  2353. if (delegateResult) {
  2354. if (delegateResult === ContinueSentinel) continue;
  2355. return delegateResult;
  2356. }
  2357. }
  2358. if (context.method === "next") {
  2359. // Setting context._sent for legacy support of Babel's
  2360. // function.sent implementation.
  2361. context.sent = context._sent = context.arg;
  2362. } else if (context.method === "throw") {
  2363. if (state === GenStateSuspendedStart) {
  2364. state = GenStateCompleted;
  2365. throw context.arg;
  2366. }
  2367. context.dispatchException(context.arg);
  2368. } else if (context.method === "return") {
  2369. context.abrupt("return", context.arg);
  2370. }
  2371. state = GenStateExecuting;
  2372. var record = tryCatch(innerFn, self, context);
  2373. if (record.type === "normal") {
  2374. // If an exception is thrown from innerFn, we leave state ===
  2375. // GenStateExecuting and loop back for another invocation.
  2376. state = context.done
  2377. ? GenStateCompleted
  2378. : GenStateSuspendedYield;
  2379. if (record.arg === ContinueSentinel) {
  2380. continue;
  2381. }
  2382. return {
  2383. value: record.arg,
  2384. done: context.done
  2385. };
  2386. } else if (record.type === "throw") {
  2387. state = GenStateCompleted;
  2388. // Dispatch the exception by looping back around to the
  2389. // context.dispatchException(context.arg) call above.
  2390. context.method = "throw";
  2391. context.arg = record.arg;
  2392. }
  2393. }
  2394. };
  2395. }
  2396. // Call delegate.iterator[context.method](context.arg) and handle the
  2397. // result, either by returning a { value, done } result from the
  2398. // delegate iterator, or by modifying context.method and context.arg,
  2399. // setting context.delegate to null, and returning the ContinueSentinel.
  2400. function maybeInvokeDelegate(delegate, context) {
  2401. var method = delegate.iterator[context.method];
  2402. if (method === undefined) {
  2403. // A .throw or .return when the delegate iterator has no .throw
  2404. // method always terminates the yield* loop.
  2405. context.delegate = null;
  2406. if (context.method === "throw") {
  2407. if (delegate.iterator.return) {
  2408. // If the delegate iterator has a return method, give it a
  2409. // chance to clean up.
  2410. context.method = "return";
  2411. context.arg = undefined;
  2412. maybeInvokeDelegate(delegate, context);
  2413. if (context.method === "throw") {
  2414. // If maybeInvokeDelegate(context) changed context.method from
  2415. // "return" to "throw", let that override the TypeError below.
  2416. return ContinueSentinel;
  2417. }
  2418. }
  2419. context.method = "throw";
  2420. context.arg = new TypeError(
  2421. "The iterator does not provide a 'throw' method");
  2422. }
  2423. return ContinueSentinel;
  2424. }
  2425. var record = tryCatch(method, delegate.iterator, context.arg);
  2426. if (record.type === "throw") {
  2427. context.method = "throw";
  2428. context.arg = record.arg;
  2429. context.delegate = null;
  2430. return ContinueSentinel;
  2431. }
  2432. var info = record.arg;
  2433. if (! info) {
  2434. context.method = "throw";
  2435. context.arg = new TypeError("iterator result is not an object");
  2436. context.delegate = null;
  2437. return ContinueSentinel;
  2438. }
  2439. if (info.done) {
  2440. // Assign the result of the finished delegate to the temporary
  2441. // variable specified by delegate.resultName (see delegateYield).
  2442. context[delegate.resultName] = info.value;
  2443. // Resume execution at the desired location (see delegateYield).
  2444. context.next = delegate.nextLoc;
  2445. // If context.method was "throw" but the delegate handled the
  2446. // exception, let the outer generator proceed normally. If
  2447. // context.method was "next", forget context.arg since it has been
  2448. // "consumed" by the delegate iterator. If context.method was
  2449. // "return", allow the original .return call to continue in the
  2450. // outer generator.
  2451. if (context.method !== "return") {
  2452. context.method = "next";
  2453. context.arg = undefined;
  2454. }
  2455. } else {
  2456. // Re-yield the result returned by the delegate method.
  2457. return info;
  2458. }
  2459. // The delegate iterator is finished, so forget it and continue with
  2460. // the outer generator.
  2461. context.delegate = null;
  2462. return ContinueSentinel;
  2463. }
  2464. // Define Generator.prototype.{next,throw,return} in terms of the
  2465. // unified ._invoke helper method.
  2466. defineIteratorMethods(Gp);
  2467. Gp[toStringTagSymbol] = "Generator";
  2468. // A Generator should always return itself as the iterator object when the
  2469. // @@iterator function is called on it. Some browsers' implementations of the
  2470. // iterator prototype chain incorrectly implement this, causing the Generator
  2471. // object to not be returned from this call. This ensures that doesn't happen.
  2472. // See https://github.com/facebook/regenerator/issues/274 for more details.
  2473. Gp[iteratorSymbol] = function() {
  2474. return this;
  2475. };
  2476. Gp.toString = function() {
  2477. return "[object Generator]";
  2478. };
  2479. function pushTryEntry(locs) {
  2480. var entry = { tryLoc: locs[0] };
  2481. if (1 in locs) {
  2482. entry.catchLoc = locs[1];
  2483. }
  2484. if (2 in locs) {
  2485. entry.finallyLoc = locs[2];
  2486. entry.afterLoc = locs[3];
  2487. }
  2488. this.tryEntries.push(entry);
  2489. }
  2490. function resetTryEntry(entry) {
  2491. var record = entry.completion || {};
  2492. record.type = "normal";
  2493. delete record.arg;
  2494. entry.completion = record;
  2495. }
  2496. function Context(tryLocsList) {
  2497. // The root entry object (effectively a try statement without a catch
  2498. // or a finally block) gives us a place to store values thrown from
  2499. // locations where there is no enclosing try statement.
  2500. this.tryEntries = [{ tryLoc: "root" }];
  2501. tryLocsList.forEach(pushTryEntry, this);
  2502. this.reset(true);
  2503. }
  2504. runtime.keys = function(object) {
  2505. var keys = [];
  2506. for (var key in object) {
  2507. keys.push(key);
  2508. }
  2509. keys.reverse();
  2510. // Rather than returning an object with a next method, we keep
  2511. // things simple and return the next function itself.
  2512. return function next() {
  2513. while (keys.length) {
  2514. var key = keys.pop();
  2515. if (key in object) {
  2516. next.value = key;
  2517. next.done = false;
  2518. return next;
  2519. }
  2520. }
  2521. // To avoid creating an additional object, we just hang the .value
  2522. // and .done properties off the next function object itself. This
  2523. // also ensures that the minifier will not anonymize the function.
  2524. next.done = true;
  2525. return next;
  2526. };
  2527. };
  2528. function values(iterable) {
  2529. if (iterable) {
  2530. var iteratorMethod = iterable[iteratorSymbol];
  2531. if (iteratorMethod) {
  2532. return iteratorMethod.call(iterable);
  2533. }
  2534. if (typeof iterable.next === "function") {
  2535. return iterable;
  2536. }
  2537. if (!isNaN(iterable.length)) {
  2538. var i = -1, next = function next() {
  2539. while (++i < iterable.length) {
  2540. if (hasOwn.call(iterable, i)) {
  2541. next.value = iterable[i];
  2542. next.done = false;
  2543. return next;
  2544. }
  2545. }
  2546. next.value = undefined;
  2547. next.done = true;
  2548. return next;
  2549. };
  2550. return next.next = next;
  2551. }
  2552. }
  2553. // Return an iterator with no values.
  2554. return { next: doneResult };
  2555. }
  2556. runtime.values = values;
  2557. function doneResult() {
  2558. return { value: undefined, done: true };
  2559. }
  2560. Context.prototype = {
  2561. constructor: Context,
  2562. reset: function(skipTempReset) {
  2563. this.prev = 0;
  2564. this.next = 0;
  2565. // Resetting context._sent for legacy support of Babel's
  2566. // function.sent implementation.
  2567. this.sent = this._sent = undefined;
  2568. this.done = false;
  2569. this.delegate = null;
  2570. this.method = "next";
  2571. this.arg = undefined;
  2572. this.tryEntries.forEach(resetTryEntry);
  2573. if (!skipTempReset) {
  2574. for (var name in this) {
  2575. // Not sure about the optimal order of these conditions:
  2576. if (name.charAt(0) === "t" &&
  2577. hasOwn.call(this, name) &&
  2578. !isNaN(+name.slice(1))) {
  2579. this[name] = undefined;
  2580. }
  2581. }
  2582. }
  2583. },
  2584. stop: function() {
  2585. this.done = true;
  2586. var rootEntry = this.tryEntries[0];
  2587. var rootRecord = rootEntry.completion;
  2588. if (rootRecord.type === "throw") {
  2589. throw rootRecord.arg;
  2590. }
  2591. return this.rval;
  2592. },
  2593. dispatchException: function(exception) {
  2594. if (this.done) {
  2595. throw exception;
  2596. }
  2597. var context = this;
  2598. function handle(loc, caught) {
  2599. record.type = "throw";
  2600. record.arg = exception;
  2601. context.next = loc;
  2602. if (caught) {
  2603. // If the dispatched exception was caught by a catch block,
  2604. // then let that catch block handle the exception normally.
  2605. context.method = "next";
  2606. context.arg = undefined;
  2607. }
  2608. return !! caught;
  2609. }
  2610. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  2611. var entry = this.tryEntries[i];
  2612. var record = entry.completion;
  2613. if (entry.tryLoc === "root") {
  2614. // Exception thrown outside of any try block that could handle
  2615. // it, so set the completion value of the entire function to
  2616. // throw the exception.
  2617. return handle("end");
  2618. }
  2619. if (entry.tryLoc <= this.prev) {
  2620. var hasCatch = hasOwn.call(entry, "catchLoc");
  2621. var hasFinally = hasOwn.call(entry, "finallyLoc");
  2622. if (hasCatch && hasFinally) {
  2623. if (this.prev < entry.catchLoc) {
  2624. return handle(entry.catchLoc, true);
  2625. } else if (this.prev < entry.finallyLoc) {
  2626. return handle(entry.finallyLoc);
  2627. }
  2628. } else if (hasCatch) {
  2629. if (this.prev < entry.catchLoc) {
  2630. return handle(entry.catchLoc, true);
  2631. }
  2632. } else if (hasFinally) {
  2633. if (this.prev < entry.finallyLoc) {
  2634. return handle(entry.finallyLoc);
  2635. }
  2636. } else {
  2637. throw new Error("try statement without catch or finally");
  2638. }
  2639. }
  2640. }
  2641. },
  2642. abrupt: function(type, arg) {
  2643. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  2644. var entry = this.tryEntries[i];
  2645. if (entry.tryLoc <= this.prev &&
  2646. hasOwn.call(entry, "finallyLoc") &&
  2647. this.prev < entry.finallyLoc) {
  2648. var finallyEntry = entry;
  2649. break;
  2650. }
  2651. }
  2652. if (finallyEntry &&
  2653. (type === "break" ||
  2654. type === "continue") &&
  2655. finallyEntry.tryLoc <= arg &&
  2656. arg <= finallyEntry.finallyLoc) {
  2657. // Ignore the finally entry if control is not jumping to a
  2658. // location outside the try/catch block.
  2659. finallyEntry = null;
  2660. }
  2661. var record = finallyEntry ? finallyEntry.completion : {};
  2662. record.type = type;
  2663. record.arg = arg;
  2664. if (finallyEntry) {
  2665. this.method = "next";
  2666. this.next = finallyEntry.finallyLoc;
  2667. return ContinueSentinel;
  2668. }
  2669. return this.complete(record);
  2670. },
  2671. complete: function(record, afterLoc) {
  2672. if (record.type === "throw") {
  2673. throw record.arg;
  2674. }
  2675. if (record.type === "break" ||
  2676. record.type === "continue") {
  2677. this.next = record.arg;
  2678. } else if (record.type === "return") {
  2679. this.rval = this.arg = record.arg;
  2680. this.method = "return";
  2681. this.next = "end";
  2682. } else if (record.type === "normal" && afterLoc) {
  2683. this.next = afterLoc;
  2684. }
  2685. return ContinueSentinel;
  2686. },
  2687. finish: function(finallyLoc) {
  2688. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  2689. var entry = this.tryEntries[i];
  2690. if (entry.finallyLoc === finallyLoc) {
  2691. this.complete(entry.completion, entry.afterLoc);
  2692. resetTryEntry(entry);
  2693. return ContinueSentinel;
  2694. }
  2695. }
  2696. },
  2697. "catch": function(tryLoc) {
  2698. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  2699. var entry = this.tryEntries[i];
  2700. if (entry.tryLoc === tryLoc) {
  2701. var record = entry.completion;
  2702. if (record.type === "throw") {
  2703. var thrown = record.arg;
  2704. resetTryEntry(entry);
  2705. }
  2706. return thrown;
  2707. }
  2708. }
  2709. // The context.catch method must only be called with a location
  2710. // argument that corresponds to a known catch block.
  2711. throw new Error("illegal catch attempt");
  2712. },
  2713. delegateYield: function(iterable, resultName, nextLoc) {
  2714. this.delegate = {
  2715. iterator: values(iterable),
  2716. resultName: resultName,
  2717. nextLoc: nextLoc
  2718. };
  2719. if (this.method === "next") {
  2720. // Deliberately forget the last sent value so that we don't
  2721. // accidentally pass it on to the delegate.
  2722. this.arg = undefined;
  2723. }
  2724. return ContinueSentinel;
  2725. }
  2726. };
  2727. })(
  2728. // In sloppy mode, unbound `this` refers to the global object, fallback to
  2729. // Function constructor if we're in global strict mode. That is sadly a form
  2730. // of indirect eval which violates Content Security Policy.
  2731. (function() {
  2732. return this || (typeof self === "object" && self);
  2733. })() || Function("return this")()
  2734. );
  2735. /***/ }),
  2736. /***/ 11:
  2737. /*!**********************************************************************************************************!*\
  2738. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  2739. \**********************************************************************************************************/
  2740. /*! exports provided: default */
  2741. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2742. "use strict";
  2743. __webpack_require__.r(__webpack_exports__);
  2744. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  2745. /* globals __VUE_SSR_CONTEXT__ */
  2746. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  2747. // This module is a runtime utility for cleaner component module output and will
  2748. // be included in the final webpack user bundle.
  2749. function normalizeComponent (
  2750. scriptExports,
  2751. render,
  2752. staticRenderFns,
  2753. functionalTemplate,
  2754. injectStyles,
  2755. scopeId,
  2756. moduleIdentifier, /* server only */
  2757. shadowMode, /* vue-cli only */
  2758. components, // fixed by xxxxxx auto components
  2759. renderjs // fixed by xxxxxx renderjs
  2760. ) {
  2761. // Vue.extend constructor export interop
  2762. var options = typeof scriptExports === 'function'
  2763. ? scriptExports.options
  2764. : scriptExports
  2765. // fixed by xxxxxx auto components
  2766. if (components) {
  2767. if (!options.components) {
  2768. options.components = {}
  2769. }
  2770. var hasOwn = Object.prototype.hasOwnProperty
  2771. for (var name in components) {
  2772. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  2773. options.components[name] = components[name]
  2774. }
  2775. }
  2776. }
  2777. // fixed by xxxxxx renderjs
  2778. if (renderjs) {
  2779. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  2780. this[renderjs.__module] = this
  2781. });
  2782. (options.mixins || (options.mixins = [])).push(renderjs)
  2783. }
  2784. // render functions
  2785. if (render) {
  2786. options.render = render
  2787. options.staticRenderFns = staticRenderFns
  2788. options._compiled = true
  2789. }
  2790. // functional template
  2791. if (functionalTemplate) {
  2792. options.functional = true
  2793. }
  2794. // scopedId
  2795. if (scopeId) {
  2796. options._scopeId = 'data-v-' + scopeId
  2797. }
  2798. var hook
  2799. if (moduleIdentifier) { // server build
  2800. hook = function (context) {
  2801. // 2.3 injection
  2802. context =
  2803. context || // cached call
  2804. (this.$vnode && this.$vnode.ssrContext) || // stateful
  2805. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  2806. // 2.2 with runInNewContext: true
  2807. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  2808. context = __VUE_SSR_CONTEXT__
  2809. }
  2810. // inject component styles
  2811. if (injectStyles) {
  2812. injectStyles.call(this, context)
  2813. }
  2814. // register component module identifier for async chunk inferrence
  2815. if (context && context._registeredComponents) {
  2816. context._registeredComponents.add(moduleIdentifier)
  2817. }
  2818. }
  2819. // used by ssr in case component is cached and beforeCreate
  2820. // never gets called
  2821. options._ssrRegister = hook
  2822. } else if (injectStyles) {
  2823. hook = shadowMode
  2824. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  2825. : injectStyles
  2826. }
  2827. if (hook) {
  2828. if (options.functional) {
  2829. // for template-only hot-reload because in that case the render fn doesn't
  2830. // go through the normalizer
  2831. options._injectStyles = hook
  2832. // register for functioal component in vue file
  2833. var originalRender = options.render
  2834. options.render = function renderWithStyleInjection (h, context) {
  2835. hook.call(context)
  2836. return originalRender(h, context)
  2837. }
  2838. } else {
  2839. // inject component registration as beforeCreate hook
  2840. var existing = options.beforeCreate
  2841. options.beforeCreate = existing
  2842. ? [].concat(existing, hook)
  2843. : [hook]
  2844. }
  2845. }
  2846. return {
  2847. exports: scriptExports,
  2848. options: options
  2849. }
  2850. }
  2851. /***/ }),
  2852. /***/ 110:
  2853. /*!***************************************************************!*\
  2854. !*** D:/hongxing/iot-platform-app/pages.json?{"type":"stat"} ***!
  2855. \***************************************************************/
  2856. /*! no static exports found */
  2857. /***/ (function(module, exports, __webpack_require__) {
  2858. "use strict";
  2859. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _default = { "appid": "__UNI__C76B472" };exports.default = _default;
  2860. /***/ }),
  2861. /***/ 111:
  2862. /*!*********************************************************************************************!*\
  2863. !*** D:/hongxing/iot-platform-app/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js ***!
  2864. \*********************************************************************************************/
  2865. /*! no static exports found */
  2866. /***/ (function(module, exports, __webpack_require__) {
  2867. "use strict";
  2868. /*
  2869. * uCharts (R)
  2870. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360/快手)、Vue、Taro等支持canvas的框架平台
  2871. * Copyright (C) 2018-2022 QIUN (R) 秋云 https://www.ucharts.cn All rights reserved.
  2872. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  2873. * 复制使用请保留本段注释,感谢支持开源!
  2874. *
  2875. * uCharts (R) 官方网站
  2876. * https://www.uCharts.cn
  2877. *
  2878. * 开源地址:
  2879. * https://gitee.com/uCharts/uCharts
  2880. *
  2881. * uni-app插件市场地址:
  2882. * http://ext.dcloud.net.cn/plugin?id=271
  2883. *
  2884. */
  2885. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}
  2886. var config = {
  2887. version: 'v2.4.3-20220505',
  2888. yAxisWidth: 15,
  2889. xAxisHeight: 22,
  2890. xAxisTextPadding: 3,
  2891. padding: [10, 10, 10, 10],
  2892. pixelRatio: 1,
  2893. rotate: false,
  2894. fontSize: 13,
  2895. fontColor: '#666666',
  2896. dataPointShape: ['circle', 'circle', 'circle', 'circle'],
  2897. color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'],
  2898. linearColor: ['#0EE2F8', '#2BDCA8', '#FA7D8D', '#EB88E2', '#2AE3A0', '#0EE2F8', '#EB88E2', '#6773E3', '#F78A85'],
  2899. pieChartLinePadding: 15,
  2900. pieChartTextPadding: 5,
  2901. titleFontSize: 20,
  2902. subtitleFontSize: 15,
  2903. toolTipPadding: 3,
  2904. toolTipBackground: '#000000',
  2905. toolTipOpacity: 0.7,
  2906. toolTipLineHeight: 20,
  2907. radarLabelTextMargin: 13 };
  2908. var assign = function assign(target) {for (var _len2 = arguments.length, varArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {varArgs[_key2 - 1] = arguments[_key2];}
  2909. if (target == null) {
  2910. throw new TypeError('[uCharts] Cannot convert undefined or null to object');
  2911. }
  2912. if (!varArgs || varArgs.length <= 0) {
  2913. return target;
  2914. }
  2915. // 深度合并对象
  2916. function deepAssign(obj1, obj2) {
  2917. for (var key in obj2) {
  2918. obj1[key] = obj1[key] && obj1[key].toString() === "[object Object]" ?
  2919. deepAssign(obj1[key], obj2[key]) : obj1[key] = obj2[key];
  2920. }
  2921. return obj1;
  2922. }
  2923. varArgs.forEach(function (val) {
  2924. target = deepAssign(target, val);
  2925. });
  2926. return target;
  2927. };
  2928. var util = {
  2929. toFixed: function toFixed(num, limit) {
  2930. limit = limit || 2;
  2931. if (this.isFloat(num)) {
  2932. num = num.toFixed(limit);
  2933. }
  2934. return num;
  2935. },
  2936. isFloat: function isFloat(num) {
  2937. return num % 1 !== 0;
  2938. },
  2939. approximatelyEqual: function approximatelyEqual(num1, num2) {
  2940. return Math.abs(num1 - num2) < 1e-10;
  2941. },
  2942. isSameSign: function isSameSign(num1, num2) {
  2943. return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
  2944. },
  2945. isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
  2946. return this.isSameSign(p1.x, p2.x);
  2947. },
  2948. isCollision: function isCollision(obj1, obj2) {
  2949. obj1.end = {};
  2950. obj1.end.x = obj1.start.x + obj1.width;
  2951. obj1.end.y = obj1.start.y - obj1.height;
  2952. obj2.end = {};
  2953. obj2.end.x = obj2.start.x + obj2.width;
  2954. obj2.end.y = obj2.start.y - obj2.height;
  2955. var flag = obj2.start.x > obj1.end.x || obj2.end.x < obj1.start.x || obj2.end.y > obj1.start.y || obj2.start.y < obj1.end.y;
  2956. return !flag;
  2957. } };
  2958. //兼容H5点击事件
  2959. function getH5Offset(e) {
  2960. e.mp = {
  2961. changedTouches: [] };
  2962. e.mp.changedTouches.push({
  2963. x: e.offsetX,
  2964. y: e.offsetY });
  2965. return e;
  2966. }
  2967. // hex 转 rgba
  2968. function hexToRgb(hexValue, opc) {
  2969. var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  2970. var hex = hexValue.replace(rgx, function (m, r, g, b) {
  2971. return r + r + g + g + b + b;
  2972. });
  2973. var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  2974. var r = parseInt(rgb[1], 16);
  2975. var g = parseInt(rgb[2], 16);
  2976. var b = parseInt(rgb[3], 16);
  2977. return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')';
  2978. }
  2979. function findRange(num, type, limit) {
  2980. if (isNaN(num)) {
  2981. throw new Error('[uCharts] series数据需为Number格式');
  2982. }
  2983. limit = limit || 10;
  2984. type = type ? type : 'upper';
  2985. var multiple = 1;
  2986. while (limit < 1) {
  2987. limit *= 10;
  2988. multiple *= 10;
  2989. }
  2990. if (type === 'upper') {
  2991. num = Math.ceil(num * multiple);
  2992. } else {
  2993. num = Math.floor(num * multiple);
  2994. }
  2995. while (num % limit !== 0) {
  2996. if (type === 'upper') {
  2997. if (num == num + 1) {//修复数据值过大num++无效的bug by 向日葵 @xrk_jy
  2998. break;
  2999. }
  3000. num++;
  3001. } else {
  3002. num--;
  3003. }
  3004. }
  3005. return num / multiple;
  3006. }
  3007. function calCandleMA(dayArr, nameArr, colorArr, kdata) {
  3008. var seriesTemp = [];
  3009. for (var k = 0; k < dayArr.length; k++) {
  3010. var seriesItem = {
  3011. data: [],
  3012. name: nameArr[k],
  3013. color: colorArr[k] };
  3014. for (var i = 0, len = kdata.length; i < len; i++) {
  3015. if (i < dayArr[k]) {
  3016. seriesItem.data.push(null);
  3017. continue;
  3018. }
  3019. var sum = 0;
  3020. for (var j = 0; j < dayArr[k]; j++) {
  3021. sum += kdata[i - j][1];
  3022. }
  3023. seriesItem.data.push(+(sum / dayArr[k]).toFixed(3));
  3024. }
  3025. seriesTemp.push(seriesItem);
  3026. }
  3027. return seriesTemp;
  3028. }
  3029. function calValidDistance(self, distance, chartData, config, opts) {
  3030. var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
  3031. var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length - 1);
  3032. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  3033. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  3034. dataChartWidth += (opts.extra.mount.widthRatio - 1) * chartData.eachSpacing;
  3035. }
  3036. var validDistance = distance;
  3037. if (distance >= 0) {
  3038. validDistance = 0;
  3039. self.uevent.trigger('scrollLeft');
  3040. self.scrollOption.position = 'left';
  3041. opts.xAxis.scrollPosition = 'left';
  3042. } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) {
  3043. validDistance = dataChartAreaWidth - dataChartWidth;
  3044. self.uevent.trigger('scrollRight');
  3045. self.scrollOption.position = 'right';
  3046. opts.xAxis.scrollPosition = 'right';
  3047. } else {
  3048. self.scrollOption.position = distance;
  3049. opts.xAxis.scrollPosition = distance;
  3050. }
  3051. return validDistance;
  3052. }
  3053. function isInAngleRange(angle, startAngle, endAngle) {
  3054. function adjust(angle) {
  3055. while (angle < 0) {
  3056. angle += 2 * Math.PI;
  3057. }
  3058. while (angle > 2 * Math.PI) {
  3059. angle -= 2 * Math.PI;
  3060. }
  3061. return angle;
  3062. }
  3063. angle = adjust(angle);
  3064. startAngle = adjust(startAngle);
  3065. endAngle = adjust(endAngle);
  3066. if (startAngle > endAngle) {
  3067. endAngle += 2 * Math.PI;
  3068. if (angle < startAngle) {
  3069. angle += 2 * Math.PI;
  3070. }
  3071. }
  3072. return angle >= startAngle && angle <= endAngle;
  3073. }
  3074. function createCurveControlPoints(points, i) {
  3075. function isNotMiddlePoint(points, i) {
  3076. if (points[i - 1] && points[i + 1]) {
  3077. return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y,
  3078. points[i + 1].y);
  3079. } else {
  3080. return false;
  3081. }
  3082. }
  3083. function isNotMiddlePointX(points, i) {
  3084. if (points[i - 1] && points[i + 1]) {
  3085. return points[i].x >= Math.max(points[i - 1].x, points[i + 1].x) || points[i].x <= Math.min(points[i - 1].x,
  3086. points[i + 1].x);
  3087. } else {
  3088. return false;
  3089. }
  3090. }
  3091. var a = 0.2;
  3092. var b = 0.2;
  3093. var pAx = null;
  3094. var pAy = null;
  3095. var pBx = null;
  3096. var pBy = null;
  3097. if (i < 1) {
  3098. pAx = points[0].x + (points[1].x - points[0].x) * a;
  3099. pAy = points[0].y + (points[1].y - points[0].y) * a;
  3100. } else {
  3101. pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
  3102. pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
  3103. }
  3104. if (i > points.length - 3) {
  3105. var last = points.length - 1;
  3106. pBx = points[last].x - (points[last].x - points[last - 1].x) * b;
  3107. pBy = points[last].y - (points[last].y - points[last - 1].y) * b;
  3108. } else {
  3109. pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
  3110. pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
  3111. }
  3112. if (isNotMiddlePoint(points, i + 1)) {
  3113. pBy = points[i + 1].y;
  3114. }
  3115. if (isNotMiddlePoint(points, i)) {
  3116. pAy = points[i].y;
  3117. }
  3118. if (isNotMiddlePointX(points, i + 1)) {
  3119. pBx = points[i + 1].x;
  3120. }
  3121. if (isNotMiddlePointX(points, i)) {
  3122. pAx = points[i].x;
  3123. }
  3124. if (pAy >= Math.max(points[i].y, points[i + 1].y) || pAy <= Math.min(points[i].y, points[i + 1].y)) {
  3125. pAy = points[i].y;
  3126. }
  3127. if (pBy >= Math.max(points[i].y, points[i + 1].y) || pBy <= Math.min(points[i].y, points[i + 1].y)) {
  3128. pBy = points[i + 1].y;
  3129. }
  3130. if (pAx >= Math.max(points[i].x, points[i + 1].x) || pAx <= Math.min(points[i].x, points[i + 1].x)) {
  3131. pAx = points[i].x;
  3132. }
  3133. if (pBx >= Math.max(points[i].x, points[i + 1].x) || pBx <= Math.min(points[i].x, points[i + 1].x)) {
  3134. pBx = points[i + 1].x;
  3135. }
  3136. return {
  3137. ctrA: {
  3138. x: pAx,
  3139. y: pAy },
  3140. ctrB: {
  3141. x: pBx,
  3142. y: pBy } };
  3143. }
  3144. function convertCoordinateOrigin(x, y, center) {
  3145. return {
  3146. x: center.x + x,
  3147. y: center.y - y };
  3148. }
  3149. function avoidCollision(obj, target) {
  3150. if (target) {
  3151. // is collision test
  3152. while (util.isCollision(obj, target)) {
  3153. if (obj.start.x > 0) {
  3154. obj.start.y--;
  3155. } else if (obj.start.x < 0) {
  3156. obj.start.y++;
  3157. } else {
  3158. if (obj.start.y > 0) {
  3159. obj.start.y++;
  3160. } else {
  3161. obj.start.y--;
  3162. }
  3163. }
  3164. }
  3165. }
  3166. return obj;
  3167. }
  3168. function fixPieSeries(series, opts, config) {
  3169. var pieSeriesArr = [];
  3170. if (series.length > 0 && series[0].data.constructor.toString().indexOf('Array') > -1) {
  3171. opts._pieSeries_ = series;
  3172. var oldseries = series[0].data;
  3173. for (var i = 0; i < oldseries.length; i++) {
  3174. oldseries[i].formatter = series[0].formatter;
  3175. oldseries[i].data = oldseries[i].value;
  3176. pieSeriesArr.push(oldseries[i]);
  3177. }
  3178. opts.series = pieSeriesArr;
  3179. } else {
  3180. pieSeriesArr = series;
  3181. }
  3182. return pieSeriesArr;
  3183. }
  3184. function fillSeries(series, opts, config) {
  3185. var index = 0;
  3186. for (var i = 0; i < series.length; i++) {
  3187. var item = series[i];
  3188. if (!item.color) {
  3189. item.color = config.color[index];
  3190. index = (index + 1) % config.color.length;
  3191. }
  3192. if (!item.linearIndex) {
  3193. item.linearIndex = i;
  3194. }
  3195. if (!item.index) {
  3196. item.index = 0;
  3197. }
  3198. if (!item.type) {
  3199. item.type = opts.type;
  3200. }
  3201. if (typeof item.show == "undefined") {
  3202. item.show = true;
  3203. }
  3204. if (!item.type) {
  3205. item.type = opts.type;
  3206. }
  3207. if (!item.pointShape) {
  3208. item.pointShape = "circle";
  3209. }
  3210. if (!item.legendShape) {
  3211. switch (item.type) {
  3212. case 'line':
  3213. item.legendShape = "line";
  3214. break;
  3215. case 'column':
  3216. case 'bar':
  3217. item.legendShape = "rect";
  3218. break;
  3219. case 'area':
  3220. case 'mount':
  3221. item.legendShape = "triangle";
  3222. break;
  3223. default:
  3224. item.legendShape = "circle";}
  3225. }
  3226. }
  3227. return series;
  3228. }
  3229. function fillCustomColor(linearType, customColor, series, config) {
  3230. var newcolor = customColor || [];
  3231. if (linearType == 'custom' && newcolor.length == 0) {
  3232. newcolor = config.linearColor;
  3233. }
  3234. if (linearType == 'custom' && newcolor.length < series.length) {
  3235. var chazhi = series.length - newcolor.length;
  3236. for (var i = 0; i < chazhi; i++) {
  3237. newcolor.push(config.linearColor[(i + 1) % config.linearColor.length]);
  3238. }
  3239. }
  3240. return newcolor;
  3241. }
  3242. function getDataRange(minData, maxData) {
  3243. var limit = 0;
  3244. var range = maxData - minData;
  3245. if (range >= 10000) {
  3246. limit = 1000;
  3247. } else if (range >= 1000) {
  3248. limit = 100;
  3249. } else if (range >= 100) {
  3250. limit = 10;
  3251. } else if (range >= 10) {
  3252. limit = 5;
  3253. } else if (range >= 1) {
  3254. limit = 1;
  3255. } else if (range >= 0.1) {
  3256. limit = 0.1;
  3257. } else if (range >= 0.01) {
  3258. limit = 0.01;
  3259. } else if (range >= 0.001) {
  3260. limit = 0.001;
  3261. } else if (range >= 0.0001) {
  3262. limit = 0.0001;
  3263. } else if (range >= 0.00001) {
  3264. limit = 0.00001;
  3265. } else {
  3266. limit = 0.000001;
  3267. }
  3268. return {
  3269. minRange: findRange(minData, 'lower', limit),
  3270. maxRange: findRange(maxData, 'upper', limit) };
  3271. }
  3272. function measureText(text, fontSize, context) {
  3273. var width = 0;
  3274. text = String(text);
  3275. if (context !== false && context !== undefined && context.setFontSize && context.measureText) {
  3276. context.setFontSize(fontSize);
  3277. return context.measureText(text).width;
  3278. } else {
  3279. var text = text.split('');
  3280. for (var i = 0; i < text.length; i++) {
  3281. var item = text[i];
  3282. if (/[a-zA-Z]/.test(item)) {
  3283. width += 7;
  3284. } else if (/[0-9]/.test(item)) {
  3285. width += 5.5;
  3286. } else if (/\./.test(item)) {
  3287. width += 2.7;
  3288. } else if (/-/.test(item)) {
  3289. width += 3.25;
  3290. } else if (/:/.test(item)) {
  3291. width += 2.5;
  3292. } else if (/[\u4e00-\u9fa5]/.test(item)) {
  3293. width += 10;
  3294. } else if (/\(|\)/.test(item)) {
  3295. width += 3.73;
  3296. } else if (/\s/.test(item)) {
  3297. width += 2.5;
  3298. } else if (/%/.test(item)) {
  3299. width += 8;
  3300. } else {
  3301. width += 10;
  3302. }
  3303. }
  3304. return width * fontSize / 10;
  3305. }
  3306. }
  3307. function dataCombine(series) {
  3308. return series.reduce(function (a, b) {
  3309. return (a.data ? a.data : a).concat(b.data);
  3310. }, []);
  3311. }
  3312. function dataCombineStack(series, len) {
  3313. var sum = new Array(len);
  3314. for (var j = 0; j < sum.length; j++) {
  3315. sum[j] = 0;
  3316. }
  3317. for (var i = 0; i < series.length; i++) {
  3318. for (var j = 0; j < sum.length; j++) {
  3319. sum[j] += series[i].data[j];
  3320. }
  3321. }
  3322. return series.reduce(function (a, b) {
  3323. return (a.data ? a.data : a).concat(b.data).concat(sum);
  3324. }, []);
  3325. }
  3326. function getTouches(touches, opts, e) {
  3327. var x, y;
  3328. if (touches.clientX) {
  3329. if (opts.rotate) {
  3330. y = opts.height - touches.clientX * opts.pix;
  3331. x = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  3332. } else {
  3333. x = touches.clientX * opts.pix;
  3334. y = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  3335. }
  3336. } else {
  3337. if (opts.rotate) {
  3338. y = opts.height - touches.x * opts.pix;
  3339. x = touches.y * opts.pix;
  3340. } else {
  3341. x = touches.x * opts.pix;
  3342. y = touches.y * opts.pix;
  3343. }
  3344. }
  3345. return {
  3346. x: x,
  3347. y: y };
  3348. }
  3349. function getSeriesDataItem(series, index, group) {
  3350. var data = [];
  3351. var newSeries = [];
  3352. var indexIsArr = index.constructor.toString().indexOf('Array') > -1;
  3353. if (indexIsArr) {
  3354. var tempSeries = filterSeries(series);
  3355. for (var i = 0; i < group.length; i++) {
  3356. newSeries.push(tempSeries[group[i]]);
  3357. }
  3358. } else {
  3359. newSeries = series;
  3360. };
  3361. for (var _i = 0; _i < newSeries.length; _i++) {
  3362. var item = newSeries[_i];
  3363. var tmpindex = -1;
  3364. if (indexIsArr) {
  3365. tmpindex = index[_i];
  3366. } else {
  3367. tmpindex = index;
  3368. }
  3369. if (item.data[tmpindex] !== null && typeof item.data[tmpindex] !== 'undefined' && item.show) {
  3370. var seriesItem = {};
  3371. seriesItem.color = item.color;
  3372. seriesItem.type = item.type;
  3373. seriesItem.style = item.style;
  3374. seriesItem.pointShape = item.pointShape;
  3375. seriesItem.disableLegend = item.disableLegend;
  3376. seriesItem.name = item.name;
  3377. seriesItem.show = item.show;
  3378. seriesItem.data = item.formatter ? item.formatter(item.data[tmpindex]) : item.data[tmpindex];
  3379. data.push(seriesItem);
  3380. }
  3381. }
  3382. return data;
  3383. }
  3384. function getMaxTextListLength(list, fontSize, context) {
  3385. var lengthList = list.map(function (item) {
  3386. return measureText(item, fontSize, context);
  3387. });
  3388. return Math.max.apply(null, lengthList);
  3389. }
  3390. function getRadarCoordinateSeries(length) {
  3391. var eachAngle = 2 * Math.PI / length;
  3392. var CoordinateSeries = [];
  3393. for (var i = 0; i < length; i++) {
  3394. CoordinateSeries.push(eachAngle * i);
  3395. }
  3396. return CoordinateSeries.map(function (item) {
  3397. return -1 * item + Math.PI / 2;
  3398. });
  3399. }
  3400. function getToolTipData(seriesData, opts, index, group, categories) {
  3401. var option = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
  3402. var calPoints = opts.chartData.calPoints ? opts.chartData.calPoints : [];
  3403. var points = {};
  3404. if (group.length > 0) {
  3405. var filterPoints = [];
  3406. for (var i = 0; i < group.length; i++) {
  3407. filterPoints.push(calPoints[group[i]]);
  3408. }
  3409. points = filterPoints[0][index[0]];
  3410. } else {
  3411. for (var _i2 = 0; _i2 < calPoints.length; _i2++) {
  3412. if (calPoints[_i2][index]) {
  3413. points = calPoints[_i2][index];
  3414. break;
  3415. }
  3416. }
  3417. };
  3418. var textList = seriesData.map(function (item) {
  3419. var titleText = null;
  3420. if (opts.categories && opts.categories.length > 0) {
  3421. titleText = categories[index];
  3422. };
  3423. return {
  3424. text: option.formatter ? option.formatter(item, titleText, index, opts) : item.name + ': ' + item.data,
  3425. color: item.color };
  3426. });
  3427. var offset = {
  3428. x: Math.round(points.x),
  3429. y: Math.round(points.y) };
  3430. return {
  3431. textList: textList,
  3432. offset: offset };
  3433. }
  3434. function getMixToolTipData(seriesData, opts, index, categories) {
  3435. var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  3436. var points = opts.chartData.xAxisPoints[index] + opts.chartData.eachSpacing / 2;
  3437. var textList = seriesData.map(function (item) {
  3438. return {
  3439. text: option.formatter ? option.formatter(item, categories[index], index, opts) : item.name + ': ' + item.data,
  3440. color: item.color,
  3441. disableLegend: item.disableLegend ? true : false };
  3442. });
  3443. textList = textList.filter(function (item) {
  3444. if (item.disableLegend !== true) {
  3445. return item;
  3446. }
  3447. });
  3448. var offset = {
  3449. x: Math.round(points),
  3450. y: 0 };
  3451. return {
  3452. textList: textList,
  3453. offset: offset };
  3454. }
  3455. function getCandleToolTipData(series, seriesData, opts, index, categories, extra) {
  3456. var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
  3457. var calPoints = opts.chartData.calPoints;
  3458. var upColor = extra.color.upFill;
  3459. var downColor = extra.color.downFill;
  3460. //颜色顺序为开盘,收盘,最低,最高
  3461. var color = [upColor, upColor, downColor, upColor];
  3462. var textList = [];
  3463. seriesData.map(function (item) {
  3464. if (index == 0) {
  3465. if (item.data[1] - item.data[0] < 0) {
  3466. color[1] = downColor;
  3467. } else {
  3468. color[1] = upColor;
  3469. }
  3470. } else {
  3471. if (item.data[0] < series[index - 1][1]) {
  3472. color[0] = downColor;
  3473. }
  3474. if (item.data[1] < item.data[0]) {
  3475. color[1] = downColor;
  3476. }
  3477. if (item.data[2] > series[index - 1][1]) {
  3478. color[2] = upColor;
  3479. }
  3480. if (item.data[3] < series[index - 1][1]) {
  3481. color[3] = downColor;
  3482. }
  3483. }
  3484. var text1 = {
  3485. text: '开盘:' + item.data[0],
  3486. color: color[0] };
  3487. var text2 = {
  3488. text: '收盘:' + item.data[1],
  3489. color: color[1] };
  3490. var text3 = {
  3491. text: '最低:' + item.data[2],
  3492. color: color[2] };
  3493. var text4 = {
  3494. text: '最高:' + item.data[3],
  3495. color: color[3] };
  3496. textList.push(text1, text2, text3, text4);
  3497. });
  3498. var validCalPoints = [];
  3499. var offset = {
  3500. x: 0,
  3501. y: 0 };
  3502. for (var i = 0; i < calPoints.length; i++) {
  3503. var points = calPoints[i];
  3504. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  3505. validCalPoints.push(points[index]);
  3506. }
  3507. }
  3508. offset.x = Math.round(validCalPoints[0][0].x);
  3509. return {
  3510. textList: textList,
  3511. offset: offset };
  3512. }
  3513. function filterSeries(series) {
  3514. var tempSeries = [];
  3515. for (var i = 0; i < series.length; i++) {
  3516. if (series[i].show == true) {
  3517. tempSeries.push(series[i]);
  3518. }
  3519. }
  3520. return tempSeries;
  3521. }
  3522. function findCurrentIndex(currentPoints, calPoints, opts, config) {
  3523. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  3524. var current = { index: -1, group: [] };
  3525. var spacing = opts.chartData.eachSpacing / 2;
  3526. var xAxisPoints = [];
  3527. if (calPoints && calPoints.length > 0) {
  3528. if (!opts.categories) {
  3529. spacing = 0;
  3530. } else {
  3531. for (var i = 1; i < opts.chartData.xAxisPoints.length; i++) {
  3532. xAxisPoints.push(opts.chartData.xAxisPoints[i] - spacing);
  3533. }
  3534. if ((opts.type == 'line' || opts.type == 'area') && opts.xAxis.boundaryGap == 'justify') {
  3535. xAxisPoints = opts.chartData.xAxisPoints;
  3536. }
  3537. }
  3538. if (isInExactChartArea(currentPoints, opts, config)) {
  3539. if (!opts.categories) {
  3540. var timePoints = Array(calPoints.length);
  3541. for (var _i3 = 0; _i3 < calPoints.length; _i3++) {
  3542. timePoints[_i3] = Array(calPoints[_i3].length);
  3543. for (var j = 0; j < calPoints[_i3].length; j++) {
  3544. timePoints[_i3][j] = Math.abs(calPoints[_i3][j].x - currentPoints.x);
  3545. }
  3546. };
  3547. var pointValue = Array(timePoints.length);
  3548. var pointIndex = Array(timePoints.length);
  3549. for (var _i4 = 0; _i4 < timePoints.length; _i4++) {
  3550. pointValue[_i4] = Math.min.apply(null, timePoints[_i4]);
  3551. pointIndex[_i4] = timePoints[_i4].indexOf(pointValue[_i4]);
  3552. }
  3553. var minValue = Math.min.apply(null, pointValue);
  3554. current.index = [];
  3555. for (var _i5 = 0; _i5 < pointValue.length; _i5++) {
  3556. if (pointValue[_i5] == minValue) {
  3557. current.group.push(_i5);
  3558. current.index.push(pointIndex[_i5]);
  3559. }
  3560. };
  3561. } else {
  3562. xAxisPoints.forEach(function (item, index) {
  3563. if (currentPoints.x + offset + spacing > item) {
  3564. current.index = index;
  3565. }
  3566. });
  3567. }
  3568. }
  3569. }
  3570. return current;
  3571. }
  3572. function findBarChartCurrentIndex(currentPoints, calPoints, opts, config) {
  3573. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  3574. var current = { index: -1, group: [] };
  3575. var spacing = opts.chartData.eachSpacing / 2;
  3576. var yAxisPoints = opts.chartData.yAxisPoints;
  3577. if (calPoints && calPoints.length > 0) {
  3578. if (isInExactChartArea(currentPoints, opts, config)) {
  3579. yAxisPoints.forEach(function (item, index) {
  3580. if (currentPoints.y + offset + spacing > item) {
  3581. current.index = index;
  3582. }
  3583. });
  3584. }
  3585. }
  3586. return current;
  3587. }
  3588. function findLegendIndex(currentPoints, legendData, opts) {
  3589. var currentIndex = -1;
  3590. var gap = 0;
  3591. if (isInExactLegendArea(currentPoints, legendData.area)) {
  3592. var points = legendData.points;
  3593. var index = -1;
  3594. for (var i = 0, len = points.length; i < len; i++) {
  3595. var item = points[i];
  3596. for (var j = 0; j < item.length; j++) {
  3597. index += 1;
  3598. var area = item[j]['area'];
  3599. if (area && currentPoints.x > area[0] - gap && currentPoints.x < area[2] + gap && currentPoints.y > area[1] - gap && currentPoints.y < area[3] + gap) {
  3600. currentIndex = index;
  3601. break;
  3602. }
  3603. }
  3604. }
  3605. return currentIndex;
  3606. }
  3607. return currentIndex;
  3608. }
  3609. function isInExactLegendArea(currentPoints, area) {
  3610. return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y && currentPoints.y < area.end.y;
  3611. }
  3612. function isInExactChartArea(currentPoints, opts, config) {
  3613. return currentPoints.x <= opts.width - opts.area[1] + 10 && currentPoints.x >= opts.area[3] - 10 && currentPoints.y >= opts.area[0] && currentPoints.y <= opts.height - opts.area[2];
  3614. }
  3615. function findRadarChartCurrentIndex(currentPoints, radarData, count) {
  3616. var eachAngleArea = 2 * Math.PI / count;
  3617. var currentIndex = -1;
  3618. if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
  3619. var fixAngle = function fixAngle(angle) {
  3620. if (angle < 0) {
  3621. angle += 2 * Math.PI;
  3622. }
  3623. if (angle > 2 * Math.PI) {
  3624. angle -= 2 * Math.PI;
  3625. }
  3626. return angle;
  3627. };
  3628. var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x);
  3629. angle = -1 * angle;
  3630. if (angle < 0) {
  3631. angle += 2 * Math.PI;
  3632. }
  3633. var angleList = radarData.angleList.map(function (item) {
  3634. item = fixAngle(-1 * item);
  3635. return item;
  3636. });
  3637. angleList.forEach(function (item, index) {
  3638. var rangeStart = fixAngle(item - eachAngleArea / 2);
  3639. var rangeEnd = fixAngle(item + eachAngleArea / 2);
  3640. if (rangeEnd < rangeStart) {
  3641. rangeEnd += 2 * Math.PI;
  3642. }
  3643. if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <= rangeEnd) {
  3644. currentIndex = index;
  3645. }
  3646. });
  3647. }
  3648. return currentIndex;
  3649. }
  3650. function findFunnelChartCurrentIndex(currentPoints, funnelData) {
  3651. var currentIndex = -1;
  3652. for (var i = 0, len = funnelData.series.length; i < len; i++) {
  3653. var item = funnelData.series[i];
  3654. if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
  3655. currentIndex = i;
  3656. break;
  3657. }
  3658. }
  3659. return currentIndex;
  3660. }
  3661. function findWordChartCurrentIndex(currentPoints, wordData) {
  3662. var currentIndex = -1;
  3663. for (var i = 0, len = wordData.length; i < len; i++) {
  3664. var item = wordData[i];
  3665. if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
  3666. currentIndex = i;
  3667. break;
  3668. }
  3669. }
  3670. return currentIndex;
  3671. }
  3672. function findMapChartCurrentIndex(currentPoints, opts) {
  3673. var currentIndex = -1;
  3674. var cData = opts.chartData.mapData;
  3675. var data = opts.series;
  3676. var tmp = pointToCoordinate(currentPoints.y, currentPoints.x, cData.bounds, cData.scale, cData.xoffset, cData.yoffset);
  3677. var poi = [tmp.x, tmp.y];
  3678. for (var i = 0, len = data.length; i < len; i++) {
  3679. var item = data[i].geometry.coordinates;
  3680. if (isPoiWithinPoly(poi, item, opts.chartData.mapData.mercator)) {
  3681. currentIndex = i;
  3682. break;
  3683. }
  3684. }
  3685. return currentIndex;
  3686. }
  3687. function findRoseChartCurrentIndex(currentPoints, pieData, opts) {
  3688. var currentIndex = -1;
  3689. var series = getRoseDataPoints(opts._series_, opts.extra.rose.type, pieData.radius, pieData.radius);
  3690. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  3691. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  3692. angle = -angle;
  3693. if (opts.extra.rose && opts.extra.rose.offsetAngle) {
  3694. angle = angle - opts.extra.rose.offsetAngle * Math.PI / 180;
  3695. }
  3696. for (var i = 0, len = series.length; i < len; i++) {
  3697. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._rose_proportion_ * 2 * Math.PI)) {
  3698. currentIndex = i;
  3699. break;
  3700. }
  3701. }
  3702. }
  3703. return currentIndex;
  3704. }
  3705. function findPieChartCurrentIndex(currentPoints, pieData, opts) {
  3706. var currentIndex = -1;
  3707. var series = getPieDataPoints(pieData.series);
  3708. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  3709. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  3710. angle = -angle;
  3711. if (opts.extra.pie && opts.extra.pie.offsetAngle) {
  3712. angle = angle - opts.extra.pie.offsetAngle * Math.PI / 180;
  3713. }
  3714. if (opts.extra.ring && opts.extra.ring.offsetAngle) {
  3715. angle = angle - opts.extra.ring.offsetAngle * Math.PI / 180;
  3716. }
  3717. for (var i = 0, len = series.length; i < len; i++) {
  3718. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._proportion_ * 2 * Math.PI)) {
  3719. currentIndex = i;
  3720. break;
  3721. }
  3722. }
  3723. }
  3724. return currentIndex;
  3725. }
  3726. function isInExactPieChartArea(currentPoints, center, radius) {
  3727. return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2);
  3728. }
  3729. function splitPoints(points, eachSeries) {
  3730. var newPoints = [];
  3731. var items = [];
  3732. points.forEach(function (item, index) {
  3733. if (eachSeries.connectNulls) {
  3734. if (item !== null) {
  3735. items.push(item);
  3736. }
  3737. } else {
  3738. if (item !== null) {
  3739. items.push(item);
  3740. } else {
  3741. if (items.length) {
  3742. newPoints.push(items);
  3743. }
  3744. items = [];
  3745. }
  3746. }
  3747. });
  3748. if (items.length) {
  3749. newPoints.push(items);
  3750. }
  3751. return newPoints;
  3752. }
  3753. function calLegendData(series, opts, config, chartData, context) {
  3754. var legendData = {
  3755. area: {
  3756. start: {
  3757. x: 0,
  3758. y: 0 },
  3759. end: {
  3760. x: 0,
  3761. y: 0 },
  3762. width: 0,
  3763. height: 0,
  3764. wholeWidth: 0,
  3765. wholeHeight: 0 },
  3766. points: [],
  3767. widthArr: [],
  3768. heightArr: [] };
  3769. if (opts.legend.show === false) {
  3770. chartData.legendData = legendData;
  3771. return legendData;
  3772. }
  3773. var padding = opts.legend.padding * opts.pix;
  3774. var margin = opts.legend.margin * opts.pix;
  3775. var fontSize = opts.legend.fontSize ? opts.legend.fontSize * opts.pix : config.fontSize;
  3776. var shapeWidth = 15 * opts.pix;
  3777. var shapeRight = 5 * opts.pix;
  3778. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  3779. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  3780. var legendList = [];
  3781. var widthCount = 0;
  3782. var widthCountArr = [];
  3783. var currentRow = [];
  3784. for (var i = 0; i < series.length; i++) {
  3785. var item = series[i];
  3786. var legendText = item.legendText ? item.legendText : item.name;
  3787. var itemWidth = shapeWidth + shapeRight + measureText(legendText || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  3788. if (widthCount + itemWidth > opts.width - opts.area[1] - opts.area[3]) {
  3789. legendList.push(currentRow);
  3790. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  3791. widthCount = itemWidth;
  3792. currentRow = [item];
  3793. } else {
  3794. widthCount += itemWidth;
  3795. currentRow.push(item);
  3796. }
  3797. }
  3798. if (currentRow.length) {
  3799. legendList.push(currentRow);
  3800. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  3801. legendData.widthArr = widthCountArr;
  3802. var legendWidth = Math.max.apply(null, widthCountArr);
  3803. switch (opts.legend.float) {
  3804. case 'left':
  3805. legendData.area.start.x = opts.area[3];
  3806. legendData.area.end.x = opts.area[3] + legendWidth + 2 * padding;
  3807. break;
  3808. case 'right':
  3809. legendData.area.start.x = opts.width - opts.area[1] - legendWidth - 2 * padding;
  3810. legendData.area.end.x = opts.width - opts.area[1];
  3811. break;
  3812. default:
  3813. legendData.area.start.x = (opts.width - legendWidth) / 2 - padding;
  3814. legendData.area.end.x = (opts.width + legendWidth) / 2 + padding;}
  3815. legendData.area.width = legendWidth + 2 * padding;
  3816. legendData.area.wholeWidth = legendWidth + 2 * padding;
  3817. legendData.area.height = legendList.length * lineHeight + 2 * padding;
  3818. legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin;
  3819. legendData.points = legendList;
  3820. }
  3821. } else {
  3822. var len = series.length;
  3823. var maxHeight = opts.height - opts.area[0] - opts.area[2] - 2 * margin - 2 * padding;
  3824. var maxLength = Math.min(Math.floor(maxHeight / lineHeight), len);
  3825. legendData.area.height = maxLength * lineHeight + padding * 2;
  3826. legendData.area.wholeHeight = maxLength * lineHeight + padding * 2;
  3827. switch (opts.legend.float) {
  3828. case 'top':
  3829. legendData.area.start.y = opts.area[0] + margin;
  3830. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  3831. break;
  3832. case 'bottom':
  3833. legendData.area.start.y = opts.height - opts.area[2] - margin - legendData.area.height;
  3834. legendData.area.end.y = opts.height - opts.area[2] - margin;
  3835. break;
  3836. default:
  3837. legendData.area.start.y = (opts.height - legendData.area.height) / 2;
  3838. legendData.area.end.y = (opts.height + legendData.area.height) / 2;}
  3839. var lineNum = len % maxLength === 0 ? len / maxLength : Math.floor(len / maxLength + 1);
  3840. var _currentRow = [];
  3841. for (var _i6 = 0; _i6 < lineNum; _i6++) {
  3842. var temp = series.slice(_i6 * maxLength, _i6 * maxLength + maxLength);
  3843. _currentRow.push(temp);
  3844. }
  3845. legendData.points = _currentRow;
  3846. if (_currentRow.length) {
  3847. for (var _i7 = 0; _i7 < _currentRow.length; _i7++) {
  3848. var _item = _currentRow[_i7];
  3849. var maxWidth = 0;
  3850. for (var j = 0; j < _item.length; j++) {
  3851. var _itemWidth = shapeWidth + shapeRight + measureText(_item[j].name || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  3852. if (_itemWidth > maxWidth) {
  3853. maxWidth = _itemWidth;
  3854. }
  3855. }
  3856. legendData.widthArr.push(maxWidth);
  3857. legendData.heightArr.push(_item.length * lineHeight + padding * 2);
  3858. }
  3859. var _legendWidth = 0;
  3860. for (var _i8 = 0; _i8 < legendData.widthArr.length; _i8++) {
  3861. _legendWidth += legendData.widthArr[_i8];
  3862. }
  3863. legendData.area.width = _legendWidth - opts.legend.itemGap * opts.pix + 2 * padding;
  3864. legendData.area.wholeWidth = legendData.area.width + padding;
  3865. }
  3866. }
  3867. switch (opts.legend.position) {
  3868. case 'top':
  3869. legendData.area.start.y = opts.area[0] + margin;
  3870. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  3871. break;
  3872. case 'bottom':
  3873. legendData.area.start.y = opts.height - opts.area[2] - legendData.area.height - margin;
  3874. legendData.area.end.y = opts.height - opts.area[2] - margin;
  3875. break;
  3876. case 'left':
  3877. legendData.area.start.x = opts.area[3];
  3878. legendData.area.end.x = opts.area[3] + legendData.area.width;
  3879. break;
  3880. case 'right':
  3881. legendData.area.start.x = opts.width - opts.area[1] - legendData.area.width;
  3882. legendData.area.end.x = opts.width - opts.area[1];
  3883. break;}
  3884. chartData.legendData = legendData;
  3885. return legendData;
  3886. }
  3887. function calCategoriesData(categories, opts, config, eachSpacing, context) {
  3888. var result = {
  3889. angle: 0,
  3890. xAxisHeight: config.xAxisHeight };
  3891. var fontSize = opts.xAxis.fontSize * opts.pix || config.fontSize;
  3892. var categoriesTextLenth = categories.map(function (item, index) {
  3893. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  3894. return measureText(String(xitem), fontSize, context);
  3895. });
  3896. var maxTextLength = Math.max.apply(this, categoriesTextLenth);
  3897. if (opts.xAxis.rotateLabel == true) {
  3898. result.angle = opts.xAxis.rotateAngle * Math.PI / 180;
  3899. var tempHeight = 2 * config.xAxisTextPadding + Math.abs(maxTextLength * Math.sin(result.angle));
  3900. tempHeight = tempHeight < fontSize + 2 * config.xAxisTextPadding ? tempHeight + 2 * config.xAxisTextPadding : tempHeight;
  3901. if (opts.enableScroll == true && opts.xAxis.scrollShow == true) {
  3902. tempHeight += 12 * opts.pix;
  3903. }
  3904. result.xAxisHeight = tempHeight;
  3905. }
  3906. if (opts.xAxis.disabled) {
  3907. result.xAxisHeight = 0;
  3908. }
  3909. return result;
  3910. }
  3911. function getXAxisTextList(series, opts, config, stack) {
  3912. var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
  3913. var data;
  3914. if (stack == 'stack') {
  3915. data = dataCombineStack(series, opts.categories.length);
  3916. } else {
  3917. data = dataCombine(series);
  3918. }
  3919. var sorted = [];
  3920. // remove null from data
  3921. data = data.filter(function (item) {
  3922. //return item !== null;
  3923. if (typeof item === 'object' && item !== null) {
  3924. if (item.constructor.toString().indexOf('Array') > -1) {
  3925. return item !== null;
  3926. } else {
  3927. return item.value !== null;
  3928. }
  3929. } else {
  3930. return item !== null;
  3931. }
  3932. });
  3933. data.map(function (item) {
  3934. if (typeof item === 'object') {
  3935. if (item.constructor.toString().indexOf('Array') > -1) {
  3936. if (opts.type == 'candle') {
  3937. item.map(function (subitem) {
  3938. sorted.push(subitem);
  3939. });
  3940. } else {
  3941. sorted.push(item[0]);
  3942. }
  3943. } else {
  3944. sorted.push(item.value);
  3945. }
  3946. } else {
  3947. sorted.push(item);
  3948. }
  3949. });
  3950. var minData = 0;
  3951. var maxData = 0;
  3952. if (sorted.length > 0) {
  3953. minData = Math.min.apply(this, sorted);
  3954. maxData = Math.max.apply(this, sorted);
  3955. }
  3956. //为了兼容v1.9.0之前的项目
  3957. if (index > -1) {
  3958. if (typeof opts.xAxis.data[index].min === 'number') {
  3959. minData = Math.min(opts.xAxis.data[index].min, minData);
  3960. }
  3961. if (typeof opts.xAxis.data[index].max === 'number') {
  3962. maxData = Math.max(opts.xAxis.data[index].max, maxData);
  3963. }
  3964. } else {
  3965. if (typeof opts.xAxis.min === 'number') {
  3966. minData = Math.min(opts.xAxis.min, minData);
  3967. }
  3968. if (typeof opts.xAxis.max === 'number') {
  3969. maxData = Math.max(opts.xAxis.max, maxData);
  3970. }
  3971. }
  3972. if (minData === maxData) {
  3973. var rangeSpan = maxData || 10;
  3974. maxData += rangeSpan;
  3975. }
  3976. //var dataRange = getDataRange(minData, maxData);
  3977. var minRange = minData;
  3978. var maxRange = maxData;
  3979. var range = [];
  3980. var eachRange = (maxRange - minRange) / opts.xAxis.splitNumber;
  3981. for (var i = 0; i <= opts.xAxis.splitNumber; i++) {
  3982. range.push(minRange + eachRange * i);
  3983. }
  3984. return range;
  3985. }
  3986. function calXAxisData(series, opts, config, context) {
  3987. //堆叠图重算Y轴
  3988. var columnstyle = assign({}, {
  3989. type: "" },
  3990. opts.extra.bar);
  3991. var result = {
  3992. angle: 0,
  3993. xAxisHeight: config.xAxisHeight };
  3994. result.ranges = getXAxisTextList(series, opts, config, columnstyle.type);
  3995. result.rangesFormat = result.ranges.map(function (item) {
  3996. //item = opts.xAxis.formatter ? opts.xAxis.formatter(item) : util.toFixed(item, 2);
  3997. item = util.toFixed(item, 2);
  3998. return item;
  3999. });
  4000. var xAxisScaleValues = result.ranges.map(function (item) {
  4001. // 如果刻度值是浮点数,则保留两位小数
  4002. item = util.toFixed(item, 2);
  4003. // 若有自定义格式则调用自定义的格式化函数
  4004. //item = opts.xAxis.formatter ? opts.xAxis.formatter(Number(item)) : item;
  4005. return item;
  4006. });
  4007. result = Object.assign(result, getXAxisPoints(xAxisScaleValues, opts, config));
  4008. // 计算X轴刻度的属性譬如每个刻度的间隔,刻度的起始点\结束点以及总长
  4009. var eachSpacing = result.eachSpacing;
  4010. var textLength = xAxisScaleValues.map(function (item) {
  4011. return measureText(item, opts.xAxis.fontSize * opts.pix || config.fontSize, context);
  4012. });
  4013. // get max length of categories text
  4014. var maxTextLength = Math.max.apply(this, textLength);
  4015. // 如果刻度值文本内容过长,则将其逆时针旋转45°
  4016. if (maxTextLength + 2 * config.xAxisTextPadding > eachSpacing) {
  4017. result.angle = 45 * Math.PI / 180;
  4018. result.xAxisHeight = 2 * config.xAxisTextPadding + maxTextLength * Math.sin(result.angle);
  4019. }
  4020. if (opts.xAxis.disabled === true) {
  4021. result.xAxisHeight = 0;
  4022. }
  4023. return result;
  4024. }
  4025. function getRadarDataPoints(angleList, center, radius, series, opts) {
  4026. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  4027. var radarOption = opts.extra.radar || {};
  4028. radarOption.max = radarOption.max || 0;
  4029. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  4030. var data = [];var _loop2 = function _loop2(
  4031. i) {
  4032. var each = series[i];
  4033. var listItem = {};
  4034. listItem.color = each.color;
  4035. listItem.legendShape = each.legendShape;
  4036. listItem.pointShape = each.pointShape;
  4037. listItem.data = [];
  4038. each.data.forEach(function (item, index) {
  4039. var tmp = {};
  4040. tmp.angle = angleList[index];
  4041. tmp.proportion = item / maxData;
  4042. tmp.value = item;
  4043. tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion * process * Math.sin(tmp.angle), center);
  4044. listItem.data.push(tmp);
  4045. });
  4046. data.push(listItem);};for (var i = 0; i < series.length; i++) {_loop2(i);
  4047. }
  4048. return data;
  4049. }
  4050. function getPieDataPoints(series, radius) {
  4051. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  4052. var count = 0;
  4053. var _start_ = 0;
  4054. for (var i = 0; i < series.length; i++) {
  4055. var item = series[i];
  4056. item.data = item.data === null ? 0 : item.data;
  4057. count += item.data;
  4058. }
  4059. for (var _i9 = 0; _i9 < series.length; _i9++) {
  4060. var _item2 = series[_i9];
  4061. _item2.data = _item2.data === null ? 0 : _item2.data;
  4062. if (count === 0) {
  4063. _item2._proportion_ = 1 / series.length * process;
  4064. } else {
  4065. _item2._proportion_ = _item2.data / count * process;
  4066. }
  4067. _item2._radius_ = radius;
  4068. }
  4069. for (var _i10 = 0; _i10 < series.length; _i10++) {
  4070. var _item3 = series[_i10];
  4071. _item3._start_ = _start_;
  4072. _start_ += 2 * _item3._proportion_ * Math.PI;
  4073. }
  4074. return series;
  4075. }
  4076. function getFunnelDataPoints(series, radius, type, eachSpacing) {
  4077. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4078. series = series.sort(function (a, b) {
  4079. return parseInt(b.data) - parseInt(a.data);
  4080. });
  4081. for (var i = 0; i < series.length; i++) {
  4082. if (type == 'funnel') {
  4083. series[i].radius = series[i].data / series[0].data * radius * process;
  4084. } else {
  4085. series[i].radius = eachSpacing * (series.length - i) / (eachSpacing * series.length) * radius * process;
  4086. }
  4087. series[i]._proportion_ = series[i].data / series[0].data;
  4088. }
  4089. if (type !== 'pyramid') {
  4090. series.reverse();
  4091. }
  4092. return series;
  4093. }
  4094. function getRoseDataPoints(series, type, minRadius, radius) {
  4095. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4096. var count = 0;
  4097. var _start_ = 0;
  4098. var dataArr = [];
  4099. for (var i = 0; i < series.length; i++) {
  4100. var item = series[i];
  4101. item.data = item.data === null ? 0 : item.data;
  4102. count += item.data;
  4103. dataArr.push(item.data);
  4104. }
  4105. var minData = Math.min.apply(null, dataArr);
  4106. var maxData = Math.max.apply(null, dataArr);
  4107. var radiusLength = radius - minRadius;
  4108. for (var _i11 = 0; _i11 < series.length; _i11++) {
  4109. var _item4 = series[_i11];
  4110. _item4.data = _item4.data === null ? 0 : _item4.data;
  4111. if (count === 0) {
  4112. _item4._proportion_ = 1 / series.length * process;
  4113. _item4._rose_proportion_ = 1 / series.length * process;
  4114. } else {
  4115. _item4._proportion_ = _item4.data / count * process;
  4116. if (type == 'area') {
  4117. _item4._rose_proportion_ = 1 / series.length * process;
  4118. } else {
  4119. _item4._rose_proportion_ = _item4.data / count * process;
  4120. }
  4121. }
  4122. _item4._radius_ = minRadius + radiusLength * ((_item4.data - minData) / (maxData - minData)) || radius;
  4123. }
  4124. for (var _i12 = 0; _i12 < series.length; _i12++) {
  4125. var _item5 = series[_i12];
  4126. _item5._start_ = _start_;
  4127. _start_ += 2 * _item5._rose_proportion_ * Math.PI;
  4128. }
  4129. return series;
  4130. }
  4131. function getArcbarDataPoints(series, arcbarOption) {
  4132. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  4133. if (process == 1) {
  4134. process = 0.999999;
  4135. }
  4136. for (var i = 0; i < series.length; i++) {
  4137. var item = series[i];
  4138. item.data = item.data === null ? 0 : item.data;
  4139. var totalAngle = void 0;
  4140. if (arcbarOption.type == 'circle') {
  4141. totalAngle = 2;
  4142. } else {
  4143. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  4144. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  4145. } else {
  4146. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  4147. }
  4148. }
  4149. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  4150. if (item._proportion_ >= 2) {
  4151. item._proportion_ = item._proportion_ % 2;
  4152. }
  4153. }
  4154. return series;
  4155. }
  4156. function getGaugeArcbarDataPoints(series, arcbarOption) {
  4157. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  4158. if (process == 1) {
  4159. process = 0.999999;
  4160. }
  4161. for (var i = 0; i < series.length; i++) {
  4162. var item = series[i];
  4163. item.data = item.data === null ? 0 : item.data;
  4164. var totalAngle = void 0;
  4165. if (arcbarOption.type == 'circle') {
  4166. totalAngle = 2;
  4167. } else {
  4168. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  4169. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  4170. } else {
  4171. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  4172. }
  4173. }
  4174. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  4175. if (item._proportion_ >= 2) {
  4176. item._proportion_ = item._proportion_ % 2;
  4177. }
  4178. }
  4179. return series;
  4180. }
  4181. function getGaugeAxisPoints(categories, startAngle, endAngle) {
  4182. var totalAngle = startAngle - endAngle + 1;
  4183. var tempStartAngle = startAngle;
  4184. for (var i = 0; i < categories.length; i++) {
  4185. categories[i].value = categories[i].value === null ? 0 : categories[i].value;
  4186. categories[i]._startAngle_ = tempStartAngle;
  4187. categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle;
  4188. if (categories[i]._endAngle_ >= 2) {
  4189. categories[i]._endAngle_ = categories[i]._endAngle_ % 2;
  4190. }
  4191. tempStartAngle = categories[i]._endAngle_;
  4192. }
  4193. return categories;
  4194. }
  4195. function getGaugeDataPoints(series, categories, gaugeOption) {
  4196. var process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
  4197. for (var i = 0; i < series.length; i++) {
  4198. var item = series[i];
  4199. item.data = item.data === null ? 0 : item.data;
  4200. if (gaugeOption.pointer.color == 'auto') {
  4201. for (var _i13 = 0; _i13 < categories.length; _i13++) {
  4202. if (item.data <= categories[_i13].value) {
  4203. item.color = categories[_i13].color;
  4204. break;
  4205. }
  4206. }
  4207. } else {
  4208. item.color = gaugeOption.pointer.color;
  4209. }
  4210. var totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  4211. item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle;
  4212. item._oldAngle_ = gaugeOption.oldAngle;
  4213. if (gaugeOption.oldAngle < gaugeOption.endAngle) {
  4214. item._oldAngle_ += 2;
  4215. }
  4216. if (item.data >= gaugeOption.oldData) {
  4217. item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle;
  4218. } else {
  4219. item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process;
  4220. }
  4221. if (item._proportion_ >= 2) {
  4222. item._proportion_ = item._proportion_ % 2;
  4223. }
  4224. }
  4225. return series;
  4226. }
  4227. function getPieTextMaxLength(series, config, context, opts) {
  4228. series = getPieDataPoints(series);
  4229. var maxLength = 0;
  4230. for (var i = 0; i < series.length; i++) {
  4231. var item = series[i];
  4232. var text = item.formatter ? item.formatter(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
  4233. maxLength = Math.max(maxLength, measureText(text, item.textSize * opts.pix || config.fontSize, context));
  4234. }
  4235. return maxLength;
  4236. }
  4237. function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
  4238. return points.map(function (item) {
  4239. if (item === null) {
  4240. return null;
  4241. }
  4242. var seriesGap = 0;
  4243. var categoryGap = 0;
  4244. if (opts.type == 'mix') {
  4245. seriesGap = opts.extra.mix.column.seriesGap * opts.pix || 0;
  4246. categoryGap = opts.extra.mix.column.categoryGap * opts.pix || 0;
  4247. } else {
  4248. seriesGap = opts.extra.column.seriesGap * opts.pix || 0;
  4249. categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  4250. }
  4251. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  4252. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  4253. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  4254. if (opts.extra.mix && opts.extra.mix.column.width && +opts.extra.mix.column.width > 0) {
  4255. item.width = Math.min(item.width, +opts.extra.mix.column.width * opts.pix);
  4256. }
  4257. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  4258. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  4259. }
  4260. if (item.width <= 0) {
  4261. item.width = 1;
  4262. }
  4263. item.x += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  4264. return item;
  4265. });
  4266. }
  4267. function fixBarData(points, eachSpacing, columnLen, index, config, opts) {
  4268. return points.map(function (item) {
  4269. if (item === null) {
  4270. return null;
  4271. }
  4272. var seriesGap = 0;
  4273. var categoryGap = 0;
  4274. seriesGap = opts.extra.bar.seriesGap * opts.pix || 0;
  4275. categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  4276. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  4277. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  4278. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  4279. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  4280. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  4281. }
  4282. if (item.width <= 0) {
  4283. item.width = 1;
  4284. }
  4285. item.y += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  4286. return item;
  4287. });
  4288. }
  4289. function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
  4290. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  4291. return points.map(function (item) {
  4292. if (item === null) {
  4293. return null;
  4294. }
  4295. item.width = eachSpacing - 2 * categoryGap;
  4296. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  4297. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  4298. }
  4299. if (index > 0) {
  4300. item.width -= border;
  4301. }
  4302. return item;
  4303. });
  4304. }
  4305. function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  4306. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  4307. return points.map(function (item, indexn) {
  4308. if (item === null) {
  4309. return null;
  4310. }
  4311. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  4312. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  4313. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  4314. }
  4315. if (item.width <= 0) {
  4316. item.width = 1;
  4317. }
  4318. return item;
  4319. });
  4320. }
  4321. function fixBarStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  4322. var categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  4323. return points.map(function (item, indexn) {
  4324. if (item === null) {
  4325. return null;
  4326. }
  4327. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  4328. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  4329. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  4330. }
  4331. if (item.width <= 0) {
  4332. item.width = 1;
  4333. }
  4334. return item;
  4335. });
  4336. }
  4337. function getXAxisPoints(categories, opts, config) {
  4338. var spacingValid = opts.width - opts.area[1] - opts.area[3];
  4339. var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
  4340. if ((opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble' || opts.type == 'bar') && dataCount > 1 && opts.xAxis.boundaryGap == 'justify') {
  4341. dataCount -= 1;
  4342. }
  4343. var widthRatio = 0;
  4344. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  4345. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  4346. widthRatio = opts.extra.mount.widthRatio - 1;
  4347. dataCount += widthRatio;
  4348. }
  4349. var eachSpacing = spacingValid / dataCount;
  4350. var xAxisPoints = [];
  4351. var startX = opts.area[3];
  4352. var endX = opts.width - opts.area[1];
  4353. categories.forEach(function (item, index) {
  4354. xAxisPoints.push(startX + widthRatio / 2 * eachSpacing + index * eachSpacing);
  4355. });
  4356. if (opts.xAxis.boundaryGap !== 'justify') {
  4357. if (opts.enableScroll === true) {
  4358. xAxisPoints.push(startX + widthRatio * eachSpacing + categories.length * eachSpacing);
  4359. } else {
  4360. xAxisPoints.push(endX);
  4361. }
  4362. }
  4363. return {
  4364. xAxisPoints: xAxisPoints,
  4365. startX: startX,
  4366. endX: endX,
  4367. eachSpacing: eachSpacing };
  4368. }
  4369. function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  4370. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  4371. var points = [];
  4372. var validHeight = opts.height - opts.area[0] - opts.area[2];
  4373. data.forEach(function (item, index) {
  4374. if (item === null) {
  4375. points.push(null);
  4376. } else {
  4377. var cPoints = [];
  4378. item.forEach(function (items, indexs) {
  4379. var point = {};
  4380. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  4381. var value = items.value || items;
  4382. var height = validHeight * (value - minRange) / (maxRange - minRange);
  4383. height *= process;
  4384. point.y = opts.height - Math.round(height) - opts.area[2];
  4385. cPoints.push(point);
  4386. });
  4387. points.push(cPoints);
  4388. }
  4389. });
  4390. return points;
  4391. }
  4392. function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  4393. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  4394. var boundaryGap = 'center';
  4395. if (opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  4396. boundaryGap = opts.xAxis.boundaryGap;
  4397. }
  4398. var points = [];
  4399. var validHeight = opts.height - opts.area[0] - opts.area[2];
  4400. var validWidth = opts.width - opts.area[1] - opts.area[3];
  4401. data.forEach(function (item, index) {
  4402. if (item === null) {
  4403. points.push(null);
  4404. } else {
  4405. var point = {};
  4406. point.color = item.color;
  4407. point.x = xAxisPoints[index];
  4408. var value = item;
  4409. if (typeof item === 'object' && item !== null) {
  4410. if (item.constructor.toString().indexOf('Array') > -1) {
  4411. var xranges, xminRange, xmaxRange;
  4412. xranges = [].concat(opts.chartData.xAxisData.ranges);
  4413. xminRange = xranges.shift();
  4414. xmaxRange = xranges.pop();
  4415. value = item[1];
  4416. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  4417. if (opts.type == 'bubble') {
  4418. point.r = item[2];
  4419. point.t = item[3];
  4420. }
  4421. } else {
  4422. value = item.value;
  4423. }
  4424. }
  4425. if (boundaryGap == 'center') {
  4426. point.x += eachSpacing / 2;
  4427. }
  4428. var height = validHeight * (value - minRange) / (maxRange - minRange);
  4429. height *= process;
  4430. point.y = opts.height - height - opts.area[2];
  4431. points.push(point);
  4432. }
  4433. });
  4434. return points;
  4435. }
  4436. function getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption) {
  4437. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  4438. var points = [];
  4439. var validHeight = opts.height - opts.area[0] - opts.area[2];
  4440. var validWidth = opts.width - opts.area[1] - opts.area[3];
  4441. var mountWidth = eachSpacing * mountOption.widthRatio;
  4442. series.forEach(function (item, index) {
  4443. if (item === null) {
  4444. points.push(null);
  4445. } else {
  4446. var point = {};
  4447. point.color = item.color;
  4448. point.x = xAxisPoints[index];
  4449. point.x += eachSpacing / 2;
  4450. var value = item.data;
  4451. var height = validHeight * (value - minRange) / (maxRange - minRange);
  4452. height *= process;
  4453. point.y = opts.height - height - opts.area[2];
  4454. point.value = value;
  4455. point.width = mountWidth;
  4456. points.push(point);
  4457. }
  4458. });
  4459. return points;
  4460. }
  4461. function getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config) {
  4462. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  4463. var points = [];
  4464. var validHeight = opts.height - opts.area[0] - opts.area[2];
  4465. var validWidth = opts.width - opts.area[1] - opts.area[3];
  4466. data.forEach(function (item, index) {
  4467. if (item === null) {
  4468. points.push(null);
  4469. } else {
  4470. var point = {};
  4471. point.color = item.color;
  4472. point.y = yAxisPoints[index];
  4473. var value = item;
  4474. if (typeof item === 'object' && item !== null) {
  4475. value = item.value;
  4476. }
  4477. var height = validWidth * (value - minRange) / (maxRange - minRange);
  4478. height *= process;
  4479. point.height = height;
  4480. point.value = value;
  4481. point.x = height + opts.area[3];
  4482. points.push(point);
  4483. }
  4484. });
  4485. return points;
  4486. }
  4487. function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  4488. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  4489. var points = [];
  4490. var validHeight = opts.height - opts.area[0] - opts.area[2];
  4491. data.forEach(function (item, index) {
  4492. if (item === null) {
  4493. points.push(null);
  4494. } else {
  4495. var point = {};
  4496. point.color = item.color;
  4497. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  4498. if (seriesIndex > 0) {
  4499. var value = 0;
  4500. for (var i = 0; i <= seriesIndex; i++) {
  4501. value += stackSeries[i].data[index];
  4502. }
  4503. var value0 = value - item;
  4504. var height = validHeight * (value - minRange) / (maxRange - minRange);
  4505. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  4506. } else {
  4507. var value = item;
  4508. var height = validHeight * (value - minRange) / (maxRange - minRange);
  4509. var height0 = 0;
  4510. }
  4511. var heightc = height0;
  4512. height *= process;
  4513. heightc *= process;
  4514. point.y = opts.height - Math.round(height) - opts.area[2];
  4515. point.y0 = opts.height - Math.round(heightc) - opts.area[2];
  4516. points.push(point);
  4517. }
  4518. });
  4519. return points;
  4520. }
  4521. function getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  4522. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  4523. var points = [];
  4524. var validHeight = opts.width - opts.area[1] - opts.area[3];
  4525. data.forEach(function (item, index) {
  4526. if (item === null) {
  4527. points.push(null);
  4528. } else {
  4529. var point = {};
  4530. point.color = item.color;
  4531. point.y = yAxisPoints[index];
  4532. if (seriesIndex > 0) {
  4533. var value = 0;
  4534. for (var i = 0; i <= seriesIndex; i++) {
  4535. value += stackSeries[i].data[index];
  4536. }
  4537. var value0 = value - item;
  4538. var height = validHeight * (value - minRange) / (maxRange - minRange);
  4539. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  4540. } else {
  4541. var value = item;
  4542. var height = validHeight * (value - minRange) / (maxRange - minRange);
  4543. var height0 = 0;
  4544. }
  4545. var heightc = height0;
  4546. height *= process;
  4547. heightc *= process;
  4548. point.height = height - heightc;
  4549. point.x = opts.area[3] + height;
  4550. point.x0 = opts.area[3] + heightc;
  4551. points.push(point);
  4552. }
  4553. });
  4554. return points;
  4555. }
  4556. function getYAxisTextList(series, opts, config, stack, yData) {
  4557. var index = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : -1;
  4558. var data;
  4559. if (stack == 'stack') {
  4560. data = dataCombineStack(series, opts.categories.length);
  4561. } else {
  4562. data = dataCombine(series);
  4563. }
  4564. var sorted = [];
  4565. // remove null from data
  4566. data = data.filter(function (item) {
  4567. //return item !== null;
  4568. if (typeof item === 'object' && item !== null) {
  4569. if (item.constructor.toString().indexOf('Array') > -1) {
  4570. return item !== null;
  4571. } else {
  4572. return item.value !== null;
  4573. }
  4574. } else {
  4575. return item !== null;
  4576. }
  4577. });
  4578. data.map(function (item) {
  4579. if (typeof item === 'object') {
  4580. if (item.constructor.toString().indexOf('Array') > -1) {
  4581. if (opts.type == 'candle') {
  4582. item.map(function (subitem) {
  4583. sorted.push(subitem);
  4584. });
  4585. } else {
  4586. sorted.push(item[1]);
  4587. }
  4588. } else {
  4589. sorted.push(item.value);
  4590. }
  4591. } else {
  4592. sorted.push(item);
  4593. }
  4594. });
  4595. var minData = yData.min || 0;
  4596. var maxData = yData.max || 0;
  4597. if (sorted.length > 0) {
  4598. minData = Math.min.apply(this, sorted);
  4599. maxData = Math.max.apply(this, sorted);
  4600. }
  4601. if (minData === maxData) {
  4602. // var rangeSpan = maxData || 10;
  4603. // maxData += rangeSpan;
  4604. if (maxData == 0) {
  4605. maxData = 10;
  4606. } else {
  4607. minData = 0;
  4608. }
  4609. }
  4610. var dataRange = getDataRange(minData, maxData);
  4611. var minRange = yData.min === undefined || yData.min === null ? dataRange.minRange : yData.min;
  4612. var maxRange = yData.max === undefined || yData.max === null ? dataRange.maxRange : yData.max;
  4613. var range = [];
  4614. var eachRange = (maxRange - minRange) / opts.yAxis.splitNumber;
  4615. for (var i = 0; i <= opts.yAxis.splitNumber; i++) {
  4616. range.push(minRange + eachRange * i);
  4617. }
  4618. return range.reverse();
  4619. }
  4620. function calYAxisData(series, opts, config, context) {
  4621. //堆叠图重算Y轴
  4622. var columnstyle = assign({}, {
  4623. type: "" },
  4624. opts.extra.column);
  4625. //如果是多Y轴,重新计算
  4626. var YLength = opts.yAxis.data.length;
  4627. var newSeries = new Array(YLength);
  4628. if (YLength > 0) {
  4629. for (var i = 0; i < YLength; i++) {
  4630. newSeries[i] = [];
  4631. for (var j = 0; j < series.length; j++) {
  4632. if (series[j].index == i) {
  4633. newSeries[i].push(series[j]);
  4634. }
  4635. }
  4636. }
  4637. var rangesArr = new Array(YLength);
  4638. var rangesFormatArr = new Array(YLength);
  4639. var yAxisWidthArr = new Array(YLength);var _loop3 = function _loop3(
  4640. _i14) {
  4641. var yData = opts.yAxis.data[_i14];
  4642. //如果总开关不显示,强制每个Y轴为不显示
  4643. if (opts.yAxis.disabled == true) {
  4644. yData.disabled = true;
  4645. }
  4646. if (yData.type === 'categories') {
  4647. if (!yData.formatter) {
  4648. yData.formatter = function (val, index, opts) {return val + (yData.unit || '');};
  4649. }
  4650. yData.categories = yData.categories || opts.categories;
  4651. rangesArr[_i14] = yData.categories;
  4652. } else {
  4653. if (!yData.formatter) {
  4654. yData.formatter = function (val, index, opts) {return val.toFixed(yData.tofix) + (yData.unit || '');};
  4655. }
  4656. rangesArr[_i14] = getYAxisTextList(newSeries[_i14], opts, config, columnstyle.type, yData, _i14);
  4657. }
  4658. var yAxisFontSizes = yData.fontSize * opts.pix || config.fontSize;
  4659. yAxisWidthArr[_i14] = {
  4660. position: yData.position ? yData.position : 'left',
  4661. width: 0 };
  4662. rangesFormatArr[_i14] = rangesArr[_i14].map(function (items, index) {
  4663. items = yData.formatter(items, index, opts);
  4664. yAxisWidthArr[_i14].width = Math.max(yAxisWidthArr[_i14].width, measureText(items, yAxisFontSizes, context) + 5);
  4665. return items;
  4666. });
  4667. var calibration = yData.calibration ? 4 * opts.pix : 0;
  4668. yAxisWidthArr[_i14].width += calibration + 3 * opts.pix;
  4669. if (yData.disabled === true) {
  4670. yAxisWidthArr[_i14].width = 0;
  4671. }};for (var _i14 = 0; _i14 < YLength; _i14++) {_loop3(_i14);
  4672. }
  4673. } else {
  4674. var rangesArr = new Array(1);
  4675. var rangesFormatArr = new Array(1);
  4676. var yAxisWidthArr = new Array(1);
  4677. if (opts.type === 'bar') {
  4678. rangesArr[0] = opts.categories;
  4679. if (!opts.yAxis.formatter) {
  4680. opts.yAxis.formatter = function (val, index, opts) {return val + (opts.yAxis.unit || '');};
  4681. }
  4682. } else {
  4683. if (!opts.yAxis.formatter) {
  4684. opts.yAxis.formatter = function (val, index, opts) {return val.toFixed(opts.yAxis.tofix) + (opts.yAxis.unit || '');};
  4685. }
  4686. rangesArr[0] = getYAxisTextList(series, opts, config, columnstyle.type, {});
  4687. }
  4688. yAxisWidthArr[0] = {
  4689. position: 'left',
  4690. width: 0 };
  4691. var yAxisFontSize = opts.yAxis.fontSize * opts.pix || config.fontSize;
  4692. rangesFormatArr[0] = rangesArr[0].map(function (item, index) {
  4693. item = opts.yAxis.formatter(item, index, opts);
  4694. yAxisWidthArr[0].width = Math.max(yAxisWidthArr[0].width, measureText(item, yAxisFontSize, context) + 5);
  4695. return item;
  4696. });
  4697. yAxisWidthArr[0].width += 3 * opts.pix;
  4698. if (opts.yAxis.disabled === true) {
  4699. yAxisWidthArr[0] = {
  4700. position: 'left',
  4701. width: 0 };
  4702. opts.yAxis.data[0] = {
  4703. disabled: true };
  4704. } else {
  4705. opts.yAxis.data[0] = {
  4706. disabled: false,
  4707. position: 'left',
  4708. max: opts.yAxis.max,
  4709. min: opts.yAxis.min,
  4710. formatter: opts.yAxis.formatter };
  4711. if (opts.type === 'bar') {
  4712. opts.yAxis.data[0].categories = opts.categories;
  4713. opts.yAxis.data[0].type = 'categories';
  4714. }
  4715. }
  4716. }
  4717. return {
  4718. rangesFormat: rangesFormatArr,
  4719. ranges: rangesArr,
  4720. yAxisWidth: yAxisWidthArr };
  4721. }
  4722. function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
  4723. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4724. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  4725. var minAxis = opts.area[0];
  4726. var items = [];
  4727. for (var i = 0; i < ranges.length; i++) {
  4728. var maxVal = ranges[i].shift();
  4729. var minVal = ranges[i].pop();
  4730. var item = maxVal - (maxVal - minVal) * (point - minAxis) / spacingValid;
  4731. item = opts.yAxis.data[i].formatter ? opts.yAxis.data[i].formatter(item) : item.toFixed(0);
  4732. items.push(String(item));
  4733. }
  4734. return items;
  4735. }
  4736. function calMarkLineData(points, opts) {
  4737. var minRange, maxRange;
  4738. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  4739. for (var i = 0; i < points.length; i++) {
  4740. points[i].yAxisIndex = points[i].yAxisIndex ? points[i].yAxisIndex : 0;
  4741. var range = [].concat(opts.chartData.yAxisData.ranges[points[i].yAxisIndex]);
  4742. minRange = range.pop();
  4743. maxRange = range.shift();
  4744. var height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
  4745. points[i].y = opts.height - Math.round(height) - opts.area[2];
  4746. }
  4747. return points;
  4748. }
  4749. function contextRotate(context, opts) {
  4750. if (opts.rotateLock !== true) {
  4751. context.translate(opts.height, 0);
  4752. context.rotate(90 * Math.PI / 180);
  4753. } else if (opts._rotate_ !== true) {
  4754. context.translate(opts.height, 0);
  4755. context.rotate(90 * Math.PI / 180);
  4756. opts._rotate_ = true;
  4757. }
  4758. }
  4759. function drawPointShape(points, color, shape, context, opts) {
  4760. context.beginPath();
  4761. if (opts.dataPointShapeType == 'hollow') {
  4762. context.setStrokeStyle(color);
  4763. context.setFillStyle(opts.background);
  4764. context.setLineWidth(2 * opts.pix);
  4765. } else {
  4766. context.setStrokeStyle("#ffffff");
  4767. context.setFillStyle(color);
  4768. context.setLineWidth(1 * opts.pix);
  4769. }
  4770. if (shape === 'diamond') {
  4771. points.forEach(function (item, index) {
  4772. if (item !== null) {
  4773. context.moveTo(item.x, item.y - 4.5);
  4774. context.lineTo(item.x - 4.5, item.y);
  4775. context.lineTo(item.x, item.y + 4.5);
  4776. context.lineTo(item.x + 4.5, item.y);
  4777. context.lineTo(item.x, item.y - 4.5);
  4778. }
  4779. });
  4780. } else if (shape === 'circle') {
  4781. points.forEach(function (item, index) {
  4782. if (item !== null) {
  4783. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  4784. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  4785. }
  4786. });
  4787. } else if (shape === 'square') {
  4788. points.forEach(function (item, index) {
  4789. if (item !== null) {
  4790. context.moveTo(item.x - 3.5, item.y - 3.5);
  4791. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  4792. }
  4793. });
  4794. } else if (shape === 'triangle') {
  4795. points.forEach(function (item, index) {
  4796. if (item !== null) {
  4797. context.moveTo(item.x, item.y - 4.5);
  4798. context.lineTo(item.x - 4.5, item.y + 4.5);
  4799. context.lineTo(item.x + 4.5, item.y + 4.5);
  4800. context.lineTo(item.x, item.y - 4.5);
  4801. }
  4802. });
  4803. } else if (shape === 'triangle') {
  4804. return;
  4805. }
  4806. context.closePath();
  4807. context.fill();
  4808. context.stroke();
  4809. }
  4810. function drawRingTitle(opts, config, context, center) {
  4811. var titlefontSize = opts.title.fontSize || config.titleFontSize;
  4812. var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize;
  4813. var title = opts.title.name || '';
  4814. var subtitle = opts.subtitle.name || '';
  4815. var titleFontColor = opts.title.color || opts.fontColor;
  4816. var subtitleFontColor = opts.subtitle.color || opts.fontColor;
  4817. var titleHeight = title ? titlefontSize : 0;
  4818. var subtitleHeight = subtitle ? subtitlefontSize : 0;
  4819. var margin = 5;
  4820. if (subtitle) {
  4821. var textWidth = measureText(subtitle, subtitlefontSize * opts.pix, context);
  4822. var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0) * opts.pix;
  4823. var startY = center.y + subtitlefontSize * opts.pix / 2 + (opts.subtitle.offsetY || 0) * opts.pix;
  4824. if (title) {
  4825. startY += (titleHeight * opts.pix + margin) / 2;
  4826. }
  4827. context.beginPath();
  4828. context.setFontSize(subtitlefontSize * opts.pix);
  4829. context.setFillStyle(subtitleFontColor);
  4830. context.fillText(subtitle, startX, startY);
  4831. context.closePath();
  4832. context.stroke();
  4833. }
  4834. if (title) {
  4835. var _textWidth = measureText(title, titlefontSize * opts.pix, context);
  4836. var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0);
  4837. var _startY = center.y + titlefontSize * opts.pix / 2 + (opts.title.offsetY || 0) * opts.pix;
  4838. if (subtitle) {
  4839. _startY -= (subtitleHeight * opts.pix + margin) / 2;
  4840. }
  4841. context.beginPath();
  4842. context.setFontSize(titlefontSize * opts.pix);
  4843. context.setFillStyle(titleFontColor);
  4844. context.fillText(title, _startX, _startY);
  4845. context.closePath();
  4846. context.stroke();
  4847. }
  4848. }
  4849. function drawPointText(points, series, config, context, opts) {
  4850. // 绘制数据文案
  4851. var data = series.data;
  4852. var textOffset = series.textOffset ? series.textOffset : 0;
  4853. points.forEach(function (item, index) {
  4854. if (item !== null) {
  4855. context.beginPath();
  4856. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  4857. context.setFontSize(fontSize);
  4858. context.setFillStyle(series.textColor || opts.fontColor);
  4859. var value = data[index];
  4860. if (typeof data[index] === 'object' && data[index] !== null) {
  4861. if (data[index].constructor.toString().indexOf('Array') > -1) {
  4862. value = data[index][1];
  4863. } else {
  4864. value = data[index].value;
  4865. }
  4866. }
  4867. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  4868. context.setTextAlign('center');
  4869. context.fillText(String(formatVal), item.x, item.y - 4 + textOffset * opts.pix);
  4870. context.closePath();
  4871. context.stroke();
  4872. context.setTextAlign('left');
  4873. }
  4874. });
  4875. }
  4876. function drawMountPointText(points, series, config, context, opts) {
  4877. // 绘制数据文案
  4878. var data = series.data;
  4879. var textOffset = series.textOffset ? series.textOffset : 0;
  4880. points.forEach(function (item, index) {
  4881. if (item !== null) {
  4882. context.beginPath();
  4883. var fontSize = series[index].textSize ? series[index].textSize * opts.pix : config.fontSize;
  4884. context.setFontSize(fontSize);
  4885. context.setFillStyle(series[index].textColor || opts.fontColor);
  4886. var value = item.value;
  4887. var formatVal = series[index].formatter ? series[index].formatter(value, index, series, opts) : value;
  4888. context.setTextAlign('center');
  4889. context.fillText(String(formatVal), item.x, item.y - 4 + textOffset * opts.pix);
  4890. context.closePath();
  4891. context.stroke();
  4892. context.setTextAlign('left');
  4893. }
  4894. });
  4895. }
  4896. function drawBarPointText(points, series, config, context, opts) {
  4897. // 绘制数据文案
  4898. var data = series.data;
  4899. var textOffset = series.textOffset ? series.textOffset : 0;
  4900. points.forEach(function (item, index) {
  4901. if (item !== null) {
  4902. context.beginPath();
  4903. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  4904. context.setFontSize(fontSize);
  4905. context.setFillStyle(series.textColor || opts.fontColor);
  4906. var value = data[index];
  4907. if (typeof data[index] === 'object' && data[index] !== null) {
  4908. value = data[index].value;
  4909. }
  4910. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  4911. context.setTextAlign('left');
  4912. context.fillText(String(formatVal), item.x + 4 * opts.pix, item.y + fontSize / 2 - 3);
  4913. context.closePath();
  4914. context.stroke();
  4915. }
  4916. });
  4917. }
  4918. function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
  4919. radius -= gaugeOption.width / 2 + gaugeOption.labelOffset * opts.pix;
  4920. radius = radius < 10 ? 10 : radius;
  4921. var totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  4922. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  4923. var totalNumber = gaugeOption.endNumber - gaugeOption.startNumber;
  4924. var splitNumber = totalNumber / gaugeOption.splitLine.splitNumber;
  4925. var nowAngle = gaugeOption.startAngle;
  4926. var nowNumber = gaugeOption.startNumber;
  4927. for (var i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
  4928. var pos = {
  4929. x: radius * Math.cos(nowAngle * Math.PI),
  4930. y: radius * Math.sin(nowAngle * Math.PI) };
  4931. var labelText = gaugeOption.formatter ? gaugeOption.formatter(nowNumber, i, opts) : nowNumber;
  4932. pos.x += centerPosition.x - measureText(labelText, config.fontSize, context) / 2;
  4933. pos.y += centerPosition.y;
  4934. var startX = pos.x;
  4935. var startY = pos.y;
  4936. context.beginPath();
  4937. context.setFontSize(config.fontSize);
  4938. context.setFillStyle(gaugeOption.labelColor || opts.fontColor);
  4939. context.fillText(labelText, startX, startY + config.fontSize / 2);
  4940. context.closePath();
  4941. context.stroke();
  4942. nowAngle += splitAngle;
  4943. if (nowAngle >= 2) {
  4944. nowAngle = nowAngle % 2;
  4945. }
  4946. nowNumber += splitNumber;
  4947. }
  4948. }
  4949. function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
  4950. var radarOption = opts.extra.radar || {};
  4951. angleList.forEach(function (angle, index) {
  4952. if (radarOption.labelPointShow === true && opts.categories[index] !== '') {
  4953. var posPoint = {
  4954. x: radius * Math.cos(angle),
  4955. y: radius * Math.sin(angle) };
  4956. var posPointAxis = convertCoordinateOrigin(posPoint.x, posPoint.y, centerPosition);
  4957. context.setFillStyle(radarOption.labelPointColor);
  4958. context.beginPath();
  4959. context.arc(posPointAxis.x, posPointAxis.y, radarOption.labelPointRadius * opts.pix, 0, 2 * Math.PI, false);
  4960. context.closePath();
  4961. context.fill();
  4962. }
  4963. var pos = {
  4964. x: (radius + config.radarLabelTextMargin * opts.pix) * Math.cos(angle),
  4965. y: (radius + config.radarLabelTextMargin * opts.pix) * Math.sin(angle) };
  4966. var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition);
  4967. var startX = posRelativeCanvas.x;
  4968. var startY = posRelativeCanvas.y;
  4969. if (util.approximatelyEqual(pos.x, 0)) {
  4970. startX -= measureText(opts.categories[index] || '', config.fontSize, context) / 2;
  4971. } else if (pos.x < 0) {
  4972. startX -= measureText(opts.categories[index] || '', config.fontSize, context);
  4973. }
  4974. context.beginPath();
  4975. context.setFontSize(config.fontSize);
  4976. context.setFillStyle(radarOption.labelColor || opts.fontColor);
  4977. context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2);
  4978. context.closePath();
  4979. context.stroke();
  4980. });
  4981. }
  4982. function drawPieText(series, opts, config, context, radius, center) {
  4983. var lineRadius = config.pieChartLinePadding;
  4984. var textObjectCollection = [];
  4985. var lastTextObject = null;
  4986. var seriesConvert = series.map(function (item, index) {
  4987. var text = item.formatter ? item.formatter(item, index, series, opts) : util.toFixed(item._proportion_.toFixed(4) * 100) + '%';
  4988. text = item.labelText ? item.labelText : text;
  4989. var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
  4990. if (item._rose_proportion_) {
  4991. arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._rose_proportion_ / 2);
  4992. }
  4993. var color = item.color;
  4994. var radius = item._radius_;
  4995. return {
  4996. arc: arc,
  4997. text: text,
  4998. color: color,
  4999. radius: radius,
  5000. textColor: item.textColor,
  5001. textSize: item.textSize,
  5002. labelShow: item.labelShow };
  5003. });
  5004. for (var i = 0; i < seriesConvert.length; i++) {
  5005. var item = seriesConvert[i];
  5006. // line end
  5007. var orginX1 = Math.cos(item.arc) * (item.radius + lineRadius);
  5008. var orginY1 = Math.sin(item.arc) * (item.radius + lineRadius);
  5009. // line start
  5010. var orginX2 = Math.cos(item.arc) * item.radius;
  5011. var orginY2 = Math.sin(item.arc) * item.radius;
  5012. // text start
  5013. var orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding;
  5014. var orginY3 = orginY1;
  5015. var textWidth = measureText(item.text, item.textSize * opts.pix || config.fontSize, context);
  5016. var startY = orginY3;
  5017. if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
  5018. x: orginX3 }))
  5019. {
  5020. if (orginX3 > 0) {
  5021. startY = Math.min(orginY3, lastTextObject.start.y);
  5022. } else if (orginX1 < 0) {
  5023. startY = Math.max(orginY3, lastTextObject.start.y);
  5024. } else {
  5025. if (orginY3 > 0) {
  5026. startY = Math.max(orginY3, lastTextObject.start.y);
  5027. } else {
  5028. startY = Math.min(orginY3, lastTextObject.start.y);
  5029. }
  5030. }
  5031. }
  5032. if (orginX3 < 0) {
  5033. orginX3 -= textWidth;
  5034. }
  5035. var textObject = {
  5036. lineStart: {
  5037. x: orginX2,
  5038. y: orginY2 },
  5039. lineEnd: {
  5040. x: orginX1,
  5041. y: orginY1 },
  5042. start: {
  5043. x: orginX3,
  5044. y: startY },
  5045. width: textWidth,
  5046. height: config.fontSize,
  5047. text: item.text,
  5048. color: item.color,
  5049. textColor: item.textColor,
  5050. textSize: item.textSize };
  5051. lastTextObject = avoidCollision(textObject, lastTextObject);
  5052. textObjectCollection.push(lastTextObject);
  5053. }
  5054. for (var _i15 = 0; _i15 < textObjectCollection.length; _i15++) {
  5055. if (seriesConvert[_i15].labelShow === false) {
  5056. continue;
  5057. }
  5058. var _item6 = textObjectCollection[_i15];
  5059. var lineStartPoistion = convertCoordinateOrigin(_item6.lineStart.x, _item6.lineStart.y, center);
  5060. var lineEndPoistion = convertCoordinateOrigin(_item6.lineEnd.x, _item6.lineEnd.y, center);
  5061. var textPosition = convertCoordinateOrigin(_item6.start.x, _item6.start.y, center);
  5062. context.setLineWidth(1 * opts.pix);
  5063. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  5064. context.beginPath();
  5065. context.setStrokeStyle(_item6.color);
  5066. context.setFillStyle(_item6.color);
  5067. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  5068. var curveStartX = _item6.start.x < 0 ? textPosition.x + _item6.width : textPosition.x;
  5069. var textStartX = _item6.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5;
  5070. context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y);
  5071. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  5072. context.stroke();
  5073. context.closePath();
  5074. context.beginPath();
  5075. context.moveTo(textPosition.x + _item6.width, textPosition.y);
  5076. context.arc(curveStartX, textPosition.y, 2 * opts.pix, 0, 2 * Math.PI);
  5077. context.closePath();
  5078. context.fill();
  5079. context.beginPath();
  5080. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  5081. context.setFillStyle(_item6.textColor || opts.fontColor);
  5082. context.fillText(_item6.text, textStartX, textPosition.y + 3);
  5083. context.closePath();
  5084. context.stroke();
  5085. context.closePath();
  5086. }
  5087. }
  5088. function drawToolTipSplitLine(offsetX, opts, config, context) {
  5089. var toolTipOption = opts.extra.tooltip || {};
  5090. toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType;
  5091. toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength;
  5092. var startY = opts.area[0];
  5093. var endY = opts.height - opts.area[2];
  5094. if (toolTipOption.gridType == 'dash') {
  5095. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  5096. }
  5097. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  5098. context.setLineWidth(1 * opts.pix);
  5099. context.beginPath();
  5100. context.moveTo(offsetX, startY);
  5101. context.lineTo(offsetX, endY);
  5102. context.stroke();
  5103. context.setLineDash([]);
  5104. if (toolTipOption.xAxisLabel) {
  5105. var labelText = opts.categories[opts.tooltip.index];
  5106. context.setFontSize(config.fontSize);
  5107. var textWidth = measureText(labelText, config.fontSize, context);
  5108. var textX = offsetX - 0.5 * textWidth;
  5109. var textY = endY;
  5110. context.beginPath();
  5111. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  5112. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  5113. context.setLineWidth(1 * opts.pix);
  5114. context.rect(textX - config.toolTipPadding, textY, textWidth + 2 * config.toolTipPadding, config.fontSize + 2 * config.toolTipPadding);
  5115. context.closePath();
  5116. context.stroke();
  5117. context.fill();
  5118. context.beginPath();
  5119. context.setFontSize(config.fontSize);
  5120. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  5121. context.fillText(String(labelText), textX, textY + config.toolTipPadding + config.fontSize);
  5122. context.closePath();
  5123. context.stroke();
  5124. }
  5125. }
  5126. function drawMarkLine(opts, config, context) {
  5127. var markLineOption = assign({}, {
  5128. type: 'solid',
  5129. dashLength: 4,
  5130. data: [] },
  5131. opts.extra.markLine);
  5132. var startX = opts.area[3];
  5133. var endX = opts.width - opts.area[1];
  5134. var points = calMarkLineData(markLineOption.data, opts);
  5135. for (var i = 0; i < points.length; i++) {
  5136. var item = assign({}, {
  5137. lineColor: '#DE4A42',
  5138. showLabel: false,
  5139. labelFontColor: '#666666',
  5140. labelBgColor: '#DFE8FF',
  5141. labelBgOpacity: 0.8,
  5142. labelAlign: 'left',
  5143. labelOffsetX: 0,
  5144. labelOffsetY: 0 },
  5145. points[i]);
  5146. if (markLineOption.type == 'dash') {
  5147. context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
  5148. }
  5149. context.setStrokeStyle(item.lineColor);
  5150. context.setLineWidth(1 * opts.pix);
  5151. context.beginPath();
  5152. context.moveTo(startX, item.y);
  5153. context.lineTo(endX, item.y);
  5154. context.stroke();
  5155. context.setLineDash([]);
  5156. if (item.showLabel) {
  5157. var labelText = item.labelText ? item.labelText : item.value;
  5158. context.setFontSize(config.fontSize);
  5159. var textWidth = measureText(labelText, config.fontSize, context);
  5160. var bgWidth = textWidth + config.toolTipPadding * 2;
  5161. var bgStartX = item.labelAlign == 'left' ? opts.area[3] - bgWidth : opts.width - opts.area[1];
  5162. bgStartX += item.labelOffsetX;
  5163. var bgStartY = item.y - 0.5 * config.fontSize - config.toolTipPadding;
  5164. bgStartY += item.labelOffsetY;
  5165. var textX = bgStartX + config.toolTipPadding;
  5166. var textY = item.y;
  5167. context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity));
  5168. context.setStrokeStyle(item.labelBgColor);
  5169. context.setLineWidth(1 * opts.pix);
  5170. context.beginPath();
  5171. context.rect(bgStartX, bgStartY, bgWidth, config.fontSize + 2 * config.toolTipPadding);
  5172. context.closePath();
  5173. context.stroke();
  5174. context.fill();
  5175. context.setFontSize(config.fontSize);
  5176. context.setTextAlign('left');
  5177. context.setFillStyle(item.labelFontColor);
  5178. context.fillText(String(labelText), textX, bgStartY + config.fontSize + config.toolTipPadding / 2);
  5179. context.stroke();
  5180. context.setTextAlign('left');
  5181. }
  5182. }
  5183. }
  5184. function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
  5185. var toolTipOption = assign({}, {
  5186. gridType: 'solid',
  5187. dashLength: 4 },
  5188. opts.extra.tooltip);
  5189. var startX = opts.area[3];
  5190. var endX = opts.width - opts.area[1];
  5191. if (toolTipOption.gridType == 'dash') {
  5192. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  5193. }
  5194. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  5195. context.setLineWidth(1 * opts.pix);
  5196. context.beginPath();
  5197. context.moveTo(startX, opts.tooltip.offset.y);
  5198. context.lineTo(endX, opts.tooltip.offset.y);
  5199. context.stroke();
  5200. context.setLineDash([]);
  5201. if (toolTipOption.yAxisLabel) {
  5202. var labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing);
  5203. var widthArr = opts.chartData.yAxisData.yAxisWidth;
  5204. var tStartLeft = opts.area[3];
  5205. var tStartRight = opts.width - opts.area[1];
  5206. for (var i = 0; i < labelText.length; i++) {
  5207. context.setFontSize(config.fontSize);
  5208. var textWidth = measureText(labelText[i], config.fontSize, context);
  5209. var bgStartX = void 0,bgEndX = void 0,bgWidth = void 0;
  5210. if (widthArr[i].position == 'left') {
  5211. bgStartX = tStartLeft - widthArr[i].width;
  5212. bgEndX = Math.max(bgStartX, bgStartX + textWidth + config.toolTipPadding * 2);
  5213. } else {
  5214. bgStartX = tStartRight;
  5215. bgEndX = Math.max(bgStartX + widthArr[i].width, bgStartX + textWidth + config.toolTipPadding * 2);
  5216. }
  5217. bgWidth = bgEndX - bgStartX;
  5218. var textX = bgStartX + (bgWidth - textWidth) / 2;
  5219. var textY = opts.tooltip.offset.y;
  5220. context.beginPath();
  5221. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  5222. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  5223. context.setLineWidth(1 * opts.pix);
  5224. context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 *
  5225. config.toolTipPadding);
  5226. context.closePath();
  5227. context.stroke();
  5228. context.fill();
  5229. context.beginPath();
  5230. context.setFontSize(config.fontSize);
  5231. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  5232. context.fillText(labelText[i], textX, textY + 0.5 * config.fontSize);
  5233. context.closePath();
  5234. context.stroke();
  5235. if (widthArr[i].position == 'left') {
  5236. tStartLeft -= widthArr[i].width + opts.yAxis.padding * opts.pix;
  5237. } else {
  5238. tStartRight += widthArr[i].width + opts.yAxis.padding * opts.pix;
  5239. }
  5240. }
  5241. }
  5242. }
  5243. function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  5244. var toolTipOption = assign({}, {
  5245. activeBgColor: '#000000',
  5246. activeBgOpacity: 0.08,
  5247. activeWidth: eachSpacing },
  5248. opts.extra.column);
  5249. toolTipOption.activeWidth = toolTipOption.activeWidth > eachSpacing ? eachSpacing : toolTipOption.activeWidth;
  5250. var startY = opts.area[0];
  5251. var endY = opts.height - opts.area[2];
  5252. context.beginPath();
  5253. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  5254. context.rect(offsetX - toolTipOption.activeWidth / 2, startY, toolTipOption.activeWidth, endY - startY);
  5255. context.closePath();
  5256. context.fill();
  5257. context.setFillStyle("#FFFFFF");
  5258. }
  5259. function drawBarToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  5260. var toolTipOption = assign({}, {
  5261. activeBgColor: '#000000',
  5262. activeBgOpacity: 0.08 },
  5263. opts.extra.bar);
  5264. var startX = opts.area[3];
  5265. var endX = opts.width - opts.area[1];
  5266. context.beginPath();
  5267. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  5268. context.rect(startX, offsetX - eachSpacing / 2, endX - startX, eachSpacing);
  5269. context.closePath();
  5270. context.fill();
  5271. context.setFillStyle("#FFFFFF");
  5272. }
  5273. function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
  5274. var toolTipOption = assign({}, {
  5275. showBox: true,
  5276. showArrow: true,
  5277. showCategory: false,
  5278. bgColor: '#000000',
  5279. bgOpacity: 0.7,
  5280. borderColor: '#000000',
  5281. borderWidth: 0,
  5282. borderRadius: 0,
  5283. borderOpacity: 0.7,
  5284. fontColor: '#FFFFFF',
  5285. splitLine: true },
  5286. opts.extra.tooltip);
  5287. if (toolTipOption.showCategory == true && opts.categories) {
  5288. textList.unshift({ text: opts.categories[opts.tooltip.index], color: null });
  5289. }
  5290. var legendWidth = 4 * opts.pix;
  5291. var legendMarginRight = 5 * opts.pix;
  5292. var arrowWidth = toolTipOption.showArrow ? 8 * opts.pix : 0;
  5293. var isOverRightBorder = false;
  5294. if (opts.type == 'line' || opts.type == 'mount' || opts.type == 'area' || opts.type == 'candle' || opts.type == 'mix') {
  5295. if (toolTipOption.splitLine == true) {
  5296. drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
  5297. }
  5298. }
  5299. offset = assign({
  5300. x: 0,
  5301. y: 0 },
  5302. offset);
  5303. offset.y -= 8 * opts.pix;
  5304. var textWidth = textList.map(function (item) {
  5305. return measureText(item.text, config.fontSize, context);
  5306. });
  5307. var toolTipWidth = legendWidth + legendMarginRight + 4 * config.toolTipPadding + Math.max.apply(null, textWidth);
  5308. var toolTipHeight = 2 * config.toolTipPadding + textList.length * config.toolTipLineHeight;
  5309. if (toolTipOption.showBox == false) {
  5310. return;
  5311. }
  5312. // if beyond the right border
  5313. if (offset.x - Math.abs(opts._scrollDistance_ || 0) + arrowWidth + toolTipWidth > opts.width) {
  5314. isOverRightBorder = true;
  5315. }
  5316. if (toolTipHeight + offset.y > opts.height) {
  5317. offset.y = opts.height - toolTipHeight;
  5318. }
  5319. // draw background rect
  5320. context.beginPath();
  5321. context.setFillStyle(hexToRgb(toolTipOption.bgColor || config.toolTipBackground, toolTipOption.bgOpacity || config.toolTipOpacity));
  5322. context.setLineWidth(toolTipOption.borderWidth * opts.pix);
  5323. context.setStrokeStyle(hexToRgb(toolTipOption.borderColor, toolTipOption.borderOpacity));
  5324. var radius = toolTipOption.borderRadius;
  5325. if (isOverRightBorder) {
  5326. if (toolTipOption.showArrow) {
  5327. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  5328. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  5329. }
  5330. context.arc(offset.x - arrowWidth - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
  5331. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + toolTipHeight - radius, radius,
  5332. Math.PI / 2, Math.PI, false);
  5333. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  5334. context.arc(offset.x - arrowWidth - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
  5335. if (toolTipOption.showArrow) {
  5336. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  5337. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  5338. }
  5339. } else {
  5340. if (toolTipOption.showArrow) {
  5341. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  5342. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  5343. }
  5344. context.arc(offset.x + arrowWidth + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  5345. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + radius, radius, -Math.PI / 2, 0,
  5346. false);
  5347. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + toolTipHeight - radius, radius, 0,
  5348. Math.PI / 2, false);
  5349. context.arc(offset.x + arrowWidth + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
  5350. if (toolTipOption.showArrow) {
  5351. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  5352. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  5353. }
  5354. }
  5355. context.closePath();
  5356. context.fill();
  5357. if (toolTipOption.borderWidth > 0) {
  5358. context.stroke();
  5359. }
  5360. // draw legend
  5361. textList.forEach(function (item, index) {
  5362. if (item.color !== null) {
  5363. context.beginPath();
  5364. context.setFillStyle(item.color);
  5365. var startX = offset.x + arrowWidth + 2 * config.toolTipPadding;
  5366. var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index + config.toolTipPadding + 1;
  5367. if (isOverRightBorder) {
  5368. startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding;
  5369. }
  5370. context.fillRect(startX, startY, legendWidth, config.fontSize);
  5371. context.closePath();
  5372. }
  5373. });
  5374. // draw text list
  5375. textList.forEach(function (item, index) {
  5376. var startX = offset.x + arrowWidth + 2 * config.toolTipPadding + legendWidth + legendMarginRight;
  5377. if (isOverRightBorder) {
  5378. startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding + +legendWidth + legendMarginRight;
  5379. }
  5380. var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index + config.toolTipPadding;
  5381. context.beginPath();
  5382. context.setFontSize(config.fontSize);
  5383. context.setFillStyle(toolTipOption.fontColor);
  5384. context.fillText(item.text, startX, startY + config.fontSize);
  5385. context.closePath();
  5386. context.stroke();
  5387. });
  5388. }
  5389. function drawColumnDataPoints(series, opts, config, context) {
  5390. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5391. var xAxisData = opts.chartData.xAxisData,
  5392. xAxisPoints = xAxisData.xAxisPoints,
  5393. eachSpacing = xAxisData.eachSpacing;
  5394. var columnOption = assign({}, {
  5395. type: 'group',
  5396. width: eachSpacing / 2,
  5397. meterBorder: 4,
  5398. meterFillColor: '#FFFFFF',
  5399. barBorderCircle: false,
  5400. barBorderRadius: [],
  5401. seriesGap: 2,
  5402. linearType: 'none',
  5403. linearOpacity: 1,
  5404. customColor: [],
  5405. colorStop: 0 },
  5406. opts.extra.column);
  5407. var calPoints = [];
  5408. context.save();
  5409. var leftNum = -2;
  5410. var rightNum = xAxisPoints.length + 2;
  5411. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  5412. context.translate(opts._scrollDistance_, 0);
  5413. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  5414. rightNum = leftNum + opts.xAxis.itemCount + 4;
  5415. }
  5416. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  5417. drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
  5418. }
  5419. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  5420. series.forEach(function (eachSeries, seriesIndex) {
  5421. var ranges, minRange, maxRange;
  5422. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  5423. minRange = ranges.pop();
  5424. maxRange = ranges.shift();
  5425. var data = eachSeries.data;
  5426. switch (columnOption.type) {
  5427. case 'group':
  5428. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  5429. var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  5430. calPoints.push(tooltipPoints);
  5431. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  5432. for (var i = 0; i < points.length; i++) {
  5433. var item = points[i];
  5434. //fix issues/I27B1N yyoinge & Joeshu
  5435. if (item !== null && i > leftNum && i < rightNum) {
  5436. var startX = item.x - item.width / 2;
  5437. var height = opts.height - item.y - opts.area[2];
  5438. context.beginPath();
  5439. var fillColor = item.color || eachSeries.color;
  5440. var strokeColor = item.color || eachSeries.color;
  5441. if (columnOption.linearType !== 'none') {
  5442. var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]);
  5443. //透明渐变
  5444. if (columnOption.linearType == 'opacity') {
  5445. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  5446. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5447. } else {
  5448. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  5449. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  5450. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5451. }
  5452. fillColor = grd;
  5453. }
  5454. // 圆角边框
  5455. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  5456. var left = startX;
  5457. var top = item.y;
  5458. var width = item.width;
  5459. var _height = opts.height - opts.area[2] - item.y;
  5460. if (columnOption.barBorderCircle) {
  5461. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  5462. }var _columnOption$barBord = _slicedToArray(
  5463. columnOption.barBorderRadius, 4),r0 = _columnOption$barBord[0],r1 = _columnOption$barBord[1],r2 = _columnOption$barBord[2],r3 = _columnOption$barBord[3];
  5464. var minRadius = Math.min(width / 2, _height / 2);
  5465. r0 = r0 > minRadius ? minRadius : r0;
  5466. r1 = r1 > minRadius ? minRadius : r1;
  5467. r2 = r2 > minRadius ? minRadius : r2;
  5468. r3 = r3 > minRadius ? minRadius : r3;
  5469. r0 = r0 < 0 ? 0 : r0;
  5470. r1 = r1 < 0 ? 0 : r1;
  5471. r2 = r2 < 0 ? 0 : r2;
  5472. r3 = r3 < 0 ? 0 : r3;
  5473. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  5474. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  5475. context.arc(left + width - r2, top + _height - r2, r2, 0, Math.PI / 2);
  5476. context.arc(left + r3, top + _height - r3, r3, Math.PI / 2, Math.PI);
  5477. } else {
  5478. context.moveTo(startX, item.y);
  5479. context.lineTo(startX + item.width, item.y);
  5480. context.lineTo(startX + item.width, opts.height - opts.area[2]);
  5481. context.lineTo(startX, opts.height - opts.area[2]);
  5482. context.lineTo(startX, item.y);
  5483. context.setLineWidth(1);
  5484. context.setStrokeStyle(strokeColor);
  5485. }
  5486. context.setFillStyle(fillColor);
  5487. context.closePath();
  5488. //context.stroke();
  5489. context.fill();
  5490. }
  5491. };
  5492. break;
  5493. case 'stack':
  5494. // 绘制堆叠数据图
  5495. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  5496. calPoints.push(points);
  5497. points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  5498. for (var _i16 = 0; _i16 < points.length; _i16++) {
  5499. var _item7 = points[_i16];
  5500. if (_item7 !== null && _i16 > leftNum && _i16 < rightNum) {
  5501. context.beginPath();
  5502. var fillColor = _item7.color || eachSeries.color;
  5503. var startX = _item7.x - _item7.width / 2 + 1;
  5504. var height = opts.height - _item7.y - opts.area[2];
  5505. var height0 = opts.height - _item7.y0 - opts.area[2];
  5506. if (seriesIndex > 0) {
  5507. height -= height0;
  5508. }
  5509. context.setFillStyle(fillColor);
  5510. context.moveTo(startX, _item7.y);
  5511. context.fillRect(startX, _item7.y, _item7.width, height);
  5512. context.closePath();
  5513. context.fill();
  5514. }
  5515. };
  5516. break;
  5517. case 'meter':
  5518. // 绘制温度计数据图
  5519. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  5520. calPoints.push(points);
  5521. points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meterBorder);
  5522. for (var _i17 = 0; _i17 < points.length; _i17++) {
  5523. var _item8 = points[_i17];
  5524. if (_item8 !== null && _i17 > leftNum && _i17 < rightNum) {
  5525. //画背景颜色
  5526. context.beginPath();
  5527. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  5528. context.setStrokeStyle(eachSeries.color);
  5529. context.setLineWidth(columnOption.meterBorder * opts.pix);
  5530. }
  5531. if (seriesIndex == 0) {
  5532. context.setFillStyle(columnOption.meterFillColor);
  5533. } else {
  5534. context.setFillStyle(_item8.color || eachSeries.color);
  5535. }
  5536. var startX = _item8.x - _item8.width / 2;
  5537. var height = opts.height - _item8.y - opts.area[2];
  5538. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  5539. var _left = startX;
  5540. var _top = _item8.y;
  5541. var _width = _item8.width;
  5542. var _height2 = opts.height - opts.area[2] - _item8.y;
  5543. if (columnOption.barBorderCircle) {
  5544. columnOption.barBorderRadius = [_width / 2, _width / 2, 0, 0];
  5545. }var _columnOption$barBord2 = _slicedToArray(
  5546. columnOption.barBorderRadius, 4),_r = _columnOption$barBord2[0],_r2 = _columnOption$barBord2[1],_r3 = _columnOption$barBord2[2],_r4 = _columnOption$barBord2[3];
  5547. var _minRadius = Math.min(_width / 2, _height2 / 2);
  5548. _r = _r > _minRadius ? _minRadius : _r;
  5549. _r2 = _r2 > _minRadius ? _minRadius : _r2;
  5550. _r3 = _r3 > _minRadius ? _minRadius : _r3;
  5551. _r4 = _r4 > _minRadius ? _minRadius : _r4;
  5552. _r = _r < 0 ? 0 : _r;
  5553. _r2 = _r2 < 0 ? 0 : _r2;
  5554. _r3 = _r3 < 0 ? 0 : _r3;
  5555. _r4 = _r4 < 0 ? 0 : _r4;
  5556. context.arc(_left + _r, _top + _r, _r, -Math.PI, -Math.PI / 2);
  5557. context.arc(_left + _width - _r2, _top + _r2, _r2, -Math.PI / 2, 0);
  5558. context.arc(_left + _width - _r3, _top + _height2 - _r3, _r3, 0, Math.PI / 2);
  5559. context.arc(_left + _r4, _top + _height2 - _r4, _r4, Math.PI / 2, Math.PI);
  5560. context.fill();
  5561. } else {
  5562. context.moveTo(startX, _item8.y);
  5563. context.lineTo(startX + _item8.width, _item8.y);
  5564. context.lineTo(startX + _item8.width, opts.height - opts.area[2]);
  5565. context.lineTo(startX, opts.height - opts.area[2]);
  5566. context.lineTo(startX, _item8.y);
  5567. context.fill();
  5568. }
  5569. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  5570. context.closePath();
  5571. context.stroke();
  5572. }
  5573. }
  5574. }
  5575. break;}
  5576. });
  5577. if (opts.dataLabel !== false && process === 1) {
  5578. series.forEach(function (eachSeries, seriesIndex) {
  5579. var ranges, minRange, maxRange;
  5580. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  5581. minRange = ranges.pop();
  5582. maxRange = ranges.shift();
  5583. var data = eachSeries.data;
  5584. switch (columnOption.type) {
  5585. case 'group':
  5586. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  5587. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  5588. drawPointText(points, eachSeries, config, context, opts);
  5589. break;
  5590. case 'stack':
  5591. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  5592. drawPointText(points, eachSeries, config, context, opts);
  5593. break;
  5594. case 'meter':
  5595. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  5596. drawPointText(points, eachSeries, config, context, opts);
  5597. break;}
  5598. });
  5599. }
  5600. context.restore();
  5601. return {
  5602. xAxisPoints: xAxisPoints,
  5603. calPoints: calPoints,
  5604. eachSpacing: eachSpacing };
  5605. }
  5606. function drawMountDataPoints(series, opts, config, context) {
  5607. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5608. var xAxisData = opts.chartData.xAxisData,
  5609. xAxisPoints = xAxisData.xAxisPoints,
  5610. eachSpacing = xAxisData.eachSpacing;
  5611. var mountOption = assign({}, {
  5612. type: 'mount',
  5613. widthRatio: 1,
  5614. borderWidth: 1,
  5615. barBorderCircle: false,
  5616. barBorderRadius: [],
  5617. linearType: 'none',
  5618. linearOpacity: 1,
  5619. customColor: [],
  5620. colorStop: 0 },
  5621. opts.extra.mount);
  5622. mountOption.widthRatio = mountOption.widthRatio <= 0 ? 0 : mountOption.widthRatio;
  5623. mountOption.widthRatio = mountOption.widthRatio >= 2 ? 2 : mountOption.widthRatio;
  5624. var calPoints = [];
  5625. context.save();
  5626. var leftNum = -2;
  5627. var rightNum = xAxisPoints.length + 2;
  5628. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  5629. context.translate(opts._scrollDistance_, 0);
  5630. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  5631. rightNum = leftNum + opts.xAxis.itemCount + 4;
  5632. }
  5633. mountOption.customColor = fillCustomColor(mountOption.linearType, mountOption.customColor, series, config);
  5634. var ranges, minRange, maxRange;
  5635. ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  5636. minRange = ranges.pop();
  5637. maxRange = ranges.shift();
  5638. var points = getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, process);
  5639. switch (mountOption.type) {
  5640. case 'bar':
  5641. for (var i = 0; i < points.length; i++) {
  5642. var item = points[i];
  5643. if (item !== null && i > leftNum && i < rightNum) {
  5644. var startX = item.x - eachSpacing * mountOption.widthRatio / 2;
  5645. var height = opts.height - item.y - opts.area[2];
  5646. context.beginPath();
  5647. var fillColor = item.color || series[i].color;
  5648. var strokeColor = item.color || series[i].color;
  5649. if (mountOption.linearType !== 'none') {
  5650. var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]);
  5651. //透明渐变
  5652. if (mountOption.linearType == 'opacity') {
  5653. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  5654. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5655. } else {
  5656. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  5657. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  5658. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5659. }
  5660. fillColor = grd;
  5661. }
  5662. // 圆角边框
  5663. if (mountOption.barBorderRadius && mountOption.barBorderRadius.length === 4 || mountOption.barBorderCircle === true) {
  5664. var left = startX;
  5665. var top = item.y;
  5666. var width = item.width;
  5667. var _height3 = opts.height - opts.area[2] - item.y - mountOption.borderWidth * opts.pix / 2;
  5668. if (mountOption.barBorderCircle) {
  5669. mountOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  5670. }var _mountOption$barBorde = _slicedToArray(
  5671. mountOption.barBorderRadius, 4),r0 = _mountOption$barBorde[0],r1 = _mountOption$barBorde[1],r2 = _mountOption$barBorde[2],r3 = _mountOption$barBorde[3];
  5672. var minRadius = Math.min(width / 2, _height3 / 2);
  5673. r0 = r0 > minRadius ? minRadius : r0;
  5674. r1 = r1 > minRadius ? minRadius : r1;
  5675. r2 = r2 > minRadius ? minRadius : r2;
  5676. r3 = r3 > minRadius ? minRadius : r3;
  5677. r0 = r0 < 0 ? 0 : r0;
  5678. r1 = r1 < 0 ? 0 : r1;
  5679. r2 = r2 < 0 ? 0 : r2;
  5680. r3 = r3 < 0 ? 0 : r3;
  5681. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  5682. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  5683. context.arc(left + width - r2, top + _height3 - r2, r2, 0, Math.PI / 2);
  5684. context.arc(left + r3, top + _height3 - r3, r3, Math.PI / 2, Math.PI);
  5685. } else {
  5686. context.moveTo(startX, item.y);
  5687. context.lineTo(startX + item.width, item.y);
  5688. context.lineTo(startX + item.width, opts.height - opts.area[2]);
  5689. context.lineTo(startX, opts.height - opts.area[2]);
  5690. context.lineTo(startX, item.y);
  5691. }
  5692. context.setStrokeStyle(strokeColor);
  5693. context.setFillStyle(fillColor);
  5694. if (mountOption.borderWidth > 0) {
  5695. context.setLineWidth(mountOption.borderWidth * opts.pix);
  5696. context.closePath();
  5697. context.stroke();
  5698. }
  5699. context.fill();
  5700. }
  5701. };
  5702. break;
  5703. case 'triangle':
  5704. for (var _i18 = 0; _i18 < points.length; _i18++) {
  5705. var _item9 = points[_i18];
  5706. if (_item9 !== null && _i18 > leftNum && _i18 < rightNum) {
  5707. var startX = _item9.x - eachSpacing * mountOption.widthRatio / 2;
  5708. var height = opts.height - _item9.y - opts.area[2];
  5709. context.beginPath();
  5710. var fillColor = _item9.color || series[_i18].color;
  5711. var strokeColor = _item9.color || series[_i18].color;
  5712. if (mountOption.linearType !== 'none') {
  5713. var grd = context.createLinearGradient(startX, _item9.y, startX, opts.height - opts.area[2]);
  5714. //透明渐变
  5715. if (mountOption.linearType == 'opacity') {
  5716. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  5717. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5718. } else {
  5719. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  5720. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  5721. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5722. }
  5723. fillColor = grd;
  5724. }
  5725. context.moveTo(startX, opts.height - opts.area[2]);
  5726. context.lineTo(_item9.x, _item9.y);
  5727. context.lineTo(startX + _item9.width, opts.height - opts.area[2]);
  5728. context.setStrokeStyle(strokeColor);
  5729. context.setFillStyle(fillColor);
  5730. if (mountOption.borderWidth > 0) {
  5731. context.setLineWidth(mountOption.borderWidth * opts.pix);
  5732. context.stroke();
  5733. }
  5734. context.fill();
  5735. }
  5736. };
  5737. break;
  5738. case 'mount':
  5739. for (var _i19 = 0; _i19 < points.length; _i19++) {
  5740. var _item10 = points[_i19];
  5741. if (_item10 !== null && _i19 > leftNum && _i19 < rightNum) {
  5742. var startX = _item10.x - eachSpacing * mountOption.widthRatio / 2;
  5743. var height = opts.height - _item10.y - opts.area[2];
  5744. context.beginPath();
  5745. var fillColor = _item10.color || series[_i19].color;
  5746. var strokeColor = _item10.color || series[_i19].color;
  5747. if (mountOption.linearType !== 'none') {
  5748. var grd = context.createLinearGradient(startX, _item10.y, startX, opts.height - opts.area[2]);
  5749. //透明渐变
  5750. if (mountOption.linearType == 'opacity') {
  5751. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  5752. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5753. } else {
  5754. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  5755. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  5756. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5757. }
  5758. fillColor = grd;
  5759. }
  5760. context.moveTo(startX, opts.height - opts.area[2]);
  5761. context.bezierCurveTo(_item10.x - _item10.width / 4, opts.height - opts.area[2], _item10.x - _item10.width / 4, _item10.y, _item10.x, _item10.y);
  5762. context.bezierCurveTo(_item10.x + _item10.width / 4, _item10.y, _item10.x + _item10.width / 4, opts.height - opts.area[2], startX + _item10.width, opts.height - opts.area[2]);
  5763. context.setStrokeStyle(strokeColor);
  5764. context.setFillStyle(fillColor);
  5765. if (mountOption.borderWidth > 0) {
  5766. context.setLineWidth(mountOption.borderWidth * opts.pix);
  5767. context.stroke();
  5768. }
  5769. context.fill();
  5770. }
  5771. };
  5772. break;
  5773. case 'sharp':
  5774. for (var _i20 = 0; _i20 < points.length; _i20++) {
  5775. var _item11 = points[_i20];
  5776. if (_item11 !== null && _i20 > leftNum && _i20 < rightNum) {
  5777. var startX = _item11.x - eachSpacing * mountOption.widthRatio / 2;
  5778. var height = opts.height - _item11.y - opts.area[2];
  5779. context.beginPath();
  5780. var fillColor = _item11.color || series[_i20].color;
  5781. var strokeColor = _item11.color || series[_i20].color;
  5782. if (mountOption.linearType !== 'none') {
  5783. var grd = context.createLinearGradient(startX, _item11.y, startX, opts.height - opts.area[2]);
  5784. //透明渐变
  5785. if (mountOption.linearType == 'opacity') {
  5786. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  5787. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5788. } else {
  5789. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  5790. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  5791. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5792. }
  5793. fillColor = grd;
  5794. }
  5795. context.moveTo(startX, opts.height - opts.area[2]);
  5796. context.quadraticCurveTo(_item11.x - 0, opts.height - opts.area[2] - height / 4, _item11.x, _item11.y);
  5797. context.quadraticCurveTo(_item11.x + 0, opts.height - opts.area[2] - height / 4, startX + _item11.width, opts.height - opts.area[2]);
  5798. context.setStrokeStyle(strokeColor);
  5799. context.setFillStyle(fillColor);
  5800. if (mountOption.borderWidth > 0) {
  5801. context.setLineWidth(mountOption.borderWidth * opts.pix);
  5802. context.stroke();
  5803. }
  5804. context.fill();
  5805. }
  5806. };
  5807. break;}
  5808. if (opts.dataLabel !== false && process === 1) {
  5809. var _ranges, _minRange, _maxRange;
  5810. _ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  5811. _minRange = _ranges.pop();
  5812. _maxRange = _ranges.shift();
  5813. var points = getMountDataPoints(series, _minRange, _maxRange, xAxisPoints, eachSpacing, opts, mountOption, process);
  5814. drawMountPointText(points, series, config, context, opts);
  5815. }
  5816. context.restore();
  5817. return {
  5818. xAxisPoints: xAxisPoints,
  5819. calPoints: points,
  5820. eachSpacing: eachSpacing };
  5821. }
  5822. function drawBarDataPoints(series, opts, config, context) {
  5823. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5824. var yAxisPoints = [];
  5825. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / opts.categories.length;
  5826. for (var i = 0; i < opts.categories.length; i++) {
  5827. yAxisPoints.push(opts.area[0] + eachSpacing / 2 + eachSpacing * i);
  5828. }
  5829. var columnOption = assign({}, {
  5830. type: 'group',
  5831. width: eachSpacing / 2,
  5832. meterBorder: 4,
  5833. meterFillColor: '#FFFFFF',
  5834. barBorderCircle: false,
  5835. barBorderRadius: [],
  5836. seriesGap: 2,
  5837. linearType: 'none',
  5838. linearOpacity: 1,
  5839. customColor: [],
  5840. colorStop: 0 },
  5841. opts.extra.bar);
  5842. var calPoints = [];
  5843. context.save();
  5844. var leftNum = -2;
  5845. var rightNum = yAxisPoints.length + 2;
  5846. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  5847. drawBarToolTipSplitArea(opts.tooltip.offset.y, opts, config, context, eachSpacing);
  5848. }
  5849. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  5850. series.forEach(function (eachSeries, seriesIndex) {
  5851. var ranges, minRange, maxRange;
  5852. ranges = [].concat(opts.chartData.xAxisData.ranges);
  5853. maxRange = ranges.pop();
  5854. minRange = ranges.shift();
  5855. var data = eachSeries.data;
  5856. switch (columnOption.type) {
  5857. case 'group':
  5858. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  5859. var tooltipPoints = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  5860. calPoints.push(tooltipPoints);
  5861. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  5862. for (var _i21 = 0; _i21 < points.length; _i21++) {
  5863. var item = points[_i21];
  5864. //fix issues/I27B1N yyoinge & Joeshu
  5865. if (item !== null && _i21 > leftNum && _i21 < rightNum) {
  5866. //var startX = item.x - item.width / 2;
  5867. var startX = opts.area[3];
  5868. var startY = item.y - item.width / 2;
  5869. var height = item.height;
  5870. context.beginPath();
  5871. var fillColor = item.color || eachSeries.color;
  5872. var strokeColor = item.color || eachSeries.color;
  5873. if (columnOption.linearType !== 'none') {
  5874. var grd = context.createLinearGradient(startX, item.y, item.x, item.y);
  5875. //透明渐变
  5876. if (columnOption.linearType == 'opacity') {
  5877. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  5878. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5879. } else {
  5880. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  5881. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  5882. grd.addColorStop(1, hexToRgb(fillColor, 1));
  5883. }
  5884. fillColor = grd;
  5885. }
  5886. // 圆角边框
  5887. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  5888. var left = startX;
  5889. var width = item.width;
  5890. var top = item.y - item.width / 2;
  5891. var _height4 = item.height;
  5892. if (columnOption.barBorderCircle) {
  5893. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  5894. }var _columnOption$barBord3 = _slicedToArray(
  5895. columnOption.barBorderRadius, 4),r0 = _columnOption$barBord3[0],r1 = _columnOption$barBord3[1],r2 = _columnOption$barBord3[2],r3 = _columnOption$barBord3[3];
  5896. var minRadius = Math.min(width / 2, _height4 / 2);
  5897. r0 = r0 > minRadius ? minRadius : r0;
  5898. r1 = r1 > minRadius ? minRadius : r1;
  5899. r2 = r2 > minRadius ? minRadius : r2;
  5900. r3 = r3 > minRadius ? minRadius : r3;
  5901. r0 = r0 < 0 ? 0 : r0;
  5902. r1 = r1 < 0 ? 0 : r1;
  5903. r2 = r2 < 0 ? 0 : r2;
  5904. r3 = r3 < 0 ? 0 : r3;
  5905. context.arc(left + r3, top + r3, r3, -Math.PI, -Math.PI / 2);
  5906. context.arc(item.x - r0, top + r0, r0, -Math.PI / 2, 0);
  5907. context.arc(item.x - r1, top + width - r1, r1, 0, Math.PI / 2);
  5908. context.arc(left + r2, top + width - r2, r2, Math.PI / 2, Math.PI);
  5909. } else {
  5910. context.moveTo(startX, startY);
  5911. context.lineTo(item.x, startY);
  5912. context.lineTo(item.x, startY + item.width);
  5913. context.lineTo(startX, startY + item.width);
  5914. context.lineTo(startX, startY);
  5915. context.setLineWidth(1);
  5916. context.setStrokeStyle(strokeColor);
  5917. }
  5918. context.setFillStyle(fillColor);
  5919. context.closePath();
  5920. //context.stroke();
  5921. context.fill();
  5922. }
  5923. };
  5924. break;
  5925. case 'stack':
  5926. // 绘制堆叠数据图
  5927. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  5928. calPoints.push(points);
  5929. points = fixBarStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  5930. for (var _i22 = 0; _i22 < points.length; _i22++) {
  5931. var _item12 = points[_i22];
  5932. if (_item12 !== null && _i22 > leftNum && _i22 < rightNum) {
  5933. context.beginPath();
  5934. var fillColor = _item12.color || eachSeries.color;
  5935. var startX = _item12.x0;
  5936. context.setFillStyle(fillColor);
  5937. context.moveTo(startX, _item12.y - _item12.width / 2);
  5938. context.fillRect(startX, _item12.y - _item12.width / 2, _item12.height, _item12.width);
  5939. context.closePath();
  5940. context.fill();
  5941. }
  5942. };
  5943. break;}
  5944. });
  5945. if (opts.dataLabel !== false && process === 1) {
  5946. series.forEach(function (eachSeries, seriesIndex) {
  5947. var ranges, minRange, maxRange;
  5948. ranges = [].concat(opts.chartData.xAxisData.ranges);
  5949. maxRange = ranges.pop();
  5950. minRange = ranges.shift();
  5951. var data = eachSeries.data;
  5952. switch (columnOption.type) {
  5953. case 'group':
  5954. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  5955. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  5956. drawBarPointText(points, eachSeries, config, context, opts);
  5957. break;
  5958. case 'stack':
  5959. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  5960. drawBarPointText(points, eachSeries, config, context, opts);
  5961. break;}
  5962. });
  5963. }
  5964. return {
  5965. yAxisPoints: yAxisPoints,
  5966. calPoints: calPoints,
  5967. eachSpacing: eachSpacing };
  5968. }
  5969. function drawCandleDataPoints(series, seriesMA, opts, config, context) {
  5970. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  5971. var candleOption = assign({}, {
  5972. color: {},
  5973. average: {} },
  5974. opts.extra.candle);
  5975. candleOption.color = assign({}, {
  5976. upLine: '#f04864',
  5977. upFill: '#f04864',
  5978. downLine: '#2fc25b',
  5979. downFill: '#2fc25b' },
  5980. candleOption.color);
  5981. candleOption.average = assign({}, {
  5982. show: false,
  5983. name: [],
  5984. day: [],
  5985. color: config.color },
  5986. candleOption.average);
  5987. opts.extra.candle = candleOption;
  5988. var xAxisData = opts.chartData.xAxisData,
  5989. xAxisPoints = xAxisData.xAxisPoints,
  5990. eachSpacing = xAxisData.eachSpacing;
  5991. var calPoints = [];
  5992. context.save();
  5993. var leftNum = -2;
  5994. var rightNum = xAxisPoints.length + 2;
  5995. var leftSpace = 0;
  5996. var rightSpace = opts.width + eachSpacing;
  5997. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  5998. context.translate(opts._scrollDistance_, 0);
  5999. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  6000. rightNum = leftNum + opts.xAxis.itemCount + 4;
  6001. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  6002. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  6003. }
  6004. //画均线
  6005. if (candleOption.average.show || seriesMA) {//Merge pull request !12 from 邱贵翔
  6006. seriesMA.forEach(function (eachSeries, seriesIndex) {
  6007. var ranges, minRange, maxRange;
  6008. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6009. minRange = ranges.pop();
  6010. maxRange = ranges.shift();
  6011. var data = eachSeries.data;
  6012. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6013. var splitPointList = splitPoints(points, eachSeries);
  6014. for (var i = 0; i < splitPointList.length; i++) {
  6015. var _points = splitPointList[i];
  6016. context.beginPath();
  6017. context.setStrokeStyle(eachSeries.color);
  6018. context.setLineWidth(1);
  6019. if (_points.length === 1) {
  6020. context.moveTo(_points[0].x, _points[0].y);
  6021. context.arc(_points[0].x, _points[0].y, 1, 0, 2 * Math.PI);
  6022. } else {
  6023. context.moveTo(_points[0].x, _points[0].y);
  6024. var startPoint = 0;
  6025. for (var j = 0; j < _points.length; j++) {
  6026. var item = _points[j];
  6027. if (startPoint == 0 && item.x > leftSpace) {
  6028. context.moveTo(item.x, item.y);
  6029. startPoint = 1;
  6030. }
  6031. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  6032. var ctrlPoint = createCurveControlPoints(_points, j - 1);
  6033. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x,
  6034. item.y);
  6035. }
  6036. }
  6037. context.moveTo(_points[0].x, _points[0].y);
  6038. }
  6039. context.closePath();
  6040. context.stroke();
  6041. }
  6042. });
  6043. }
  6044. //画K线
  6045. series.forEach(function (eachSeries, seriesIndex) {
  6046. var ranges, minRange, maxRange;
  6047. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6048. minRange = ranges.pop();
  6049. maxRange = ranges.shift();
  6050. var data = eachSeries.data;
  6051. var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6052. calPoints.push(points);
  6053. var splitPointList = splitPoints(points, eachSeries);
  6054. for (var i = 0; i < splitPointList[0].length; i++) {
  6055. if (i > leftNum && i < rightNum) {
  6056. var item = splitPointList[0][i];
  6057. context.beginPath();
  6058. //如果上涨
  6059. if (data[i][1] - data[i][0] > 0) {
  6060. context.setStrokeStyle(candleOption.color.upLine);
  6061. context.setFillStyle(candleOption.color.upFill);
  6062. context.setLineWidth(1 * opts.pix);
  6063. context.moveTo(item[3].x, item[3].y); //顶点
  6064. context.lineTo(item[1].x, item[1].y); //收盘中间点
  6065. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  6066. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  6067. context.lineTo(item[0].x, item[0].y); //开盘中间点
  6068. context.lineTo(item[2].x, item[2].y); //底点
  6069. context.lineTo(item[0].x, item[0].y); //开盘中间点
  6070. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  6071. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  6072. context.lineTo(item[1].x, item[1].y); //收盘中间点
  6073. context.moveTo(item[3].x, item[3].y); //顶点
  6074. } else {
  6075. context.setStrokeStyle(candleOption.color.downLine);
  6076. context.setFillStyle(candleOption.color.downFill);
  6077. context.setLineWidth(1 * opts.pix);
  6078. context.moveTo(item[3].x, item[3].y); //顶点
  6079. context.lineTo(item[0].x, item[0].y); //开盘中间点
  6080. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  6081. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  6082. context.lineTo(item[1].x, item[1].y); //收盘中间点
  6083. context.lineTo(item[2].x, item[2].y); //底点
  6084. context.lineTo(item[1].x, item[1].y); //收盘中间点
  6085. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  6086. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  6087. context.lineTo(item[0].x, item[0].y); //开盘中间点
  6088. context.moveTo(item[3].x, item[3].y); //顶点
  6089. }
  6090. context.closePath();
  6091. context.fill();
  6092. context.stroke();
  6093. }
  6094. }
  6095. });
  6096. context.restore();
  6097. return {
  6098. xAxisPoints: xAxisPoints,
  6099. calPoints: calPoints,
  6100. eachSpacing: eachSpacing };
  6101. }
  6102. function drawAreaDataPoints(series, opts, config, context) {
  6103. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  6104. var areaOption = assign({}, {
  6105. type: 'straight',
  6106. opacity: 0.2,
  6107. addLine: false,
  6108. width: 2,
  6109. gradient: false },
  6110. opts.extra.area);
  6111. var xAxisData = opts.chartData.xAxisData,
  6112. xAxisPoints = xAxisData.xAxisPoints,
  6113. eachSpacing = xAxisData.eachSpacing;
  6114. var endY = opts.height - opts.area[2];
  6115. var calPoints = [];
  6116. context.save();
  6117. var leftSpace = 0;
  6118. var rightSpace = opts.width + eachSpacing;
  6119. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  6120. context.translate(opts._scrollDistance_, 0);
  6121. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  6122. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  6123. }
  6124. series.forEach(function (eachSeries, seriesIndex) {
  6125. var ranges, minRange, maxRange;
  6126. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6127. minRange = ranges.pop();
  6128. maxRange = ranges.shift();
  6129. var data = eachSeries.data;
  6130. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6131. calPoints.push(points);
  6132. var splitPointList = splitPoints(points, eachSeries);
  6133. for (var i = 0; i < splitPointList.length; i++) {
  6134. var _points2 = splitPointList[i];
  6135. // 绘制区域数
  6136. context.beginPath();
  6137. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  6138. if (areaOption.gradient) {
  6139. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  6140. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  6141. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  6142. context.setFillStyle(gradient);
  6143. } else {
  6144. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  6145. }
  6146. context.setLineWidth(areaOption.width * opts.pix);
  6147. if (_points2.length > 1) {
  6148. var firstPoint = _points2[0];
  6149. var lastPoint = _points2[_points2.length - 1];
  6150. context.moveTo(firstPoint.x, firstPoint.y);
  6151. var startPoint = 0;
  6152. if (areaOption.type === 'curve') {
  6153. for (var j = 0; j < _points2.length; j++) {
  6154. var item = _points2[j];
  6155. if (startPoint == 0 && item.x > leftSpace) {
  6156. context.moveTo(item.x, item.y);
  6157. startPoint = 1;
  6158. }
  6159. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  6160. var ctrlPoint = createCurveControlPoints(_points2, j - 1);
  6161. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  6162. }
  6163. };
  6164. }
  6165. if (areaOption.type === 'straight') {
  6166. for (var _j = 0; _j < _points2.length; _j++) {
  6167. var _item13 = _points2[_j];
  6168. if (startPoint == 0 && _item13.x > leftSpace) {
  6169. context.moveTo(_item13.x, _item13.y);
  6170. startPoint = 1;
  6171. }
  6172. if (_j > 0 && _item13.x > leftSpace && _item13.x < rightSpace) {
  6173. context.lineTo(_item13.x, _item13.y);
  6174. }
  6175. };
  6176. }
  6177. if (areaOption.type === 'step') {
  6178. for (var _j2 = 0; _j2 < _points2.length; _j2++) {
  6179. var _item14 = _points2[_j2];
  6180. if (startPoint == 0 && _item14.x > leftSpace) {
  6181. context.moveTo(_item14.x, _item14.y);
  6182. startPoint = 1;
  6183. }
  6184. if (_j2 > 0 && _item14.x > leftSpace && _item14.x < rightSpace) {
  6185. context.lineTo(_item14.x, _points2[_j2 - 1].y);
  6186. context.lineTo(_item14.x, _item14.y);
  6187. }
  6188. };
  6189. }
  6190. context.lineTo(lastPoint.x, endY);
  6191. context.lineTo(firstPoint.x, endY);
  6192. context.lineTo(firstPoint.x, firstPoint.y);
  6193. } else {
  6194. var _item15 = _points2[0];
  6195. context.moveTo(_item15.x - eachSpacing / 2, _item15.y);
  6196. context.lineTo(_item15.x + eachSpacing / 2, _item15.y);
  6197. context.lineTo(_item15.x + eachSpacing / 2, endY);
  6198. context.lineTo(_item15.x - eachSpacing / 2, endY);
  6199. context.moveTo(_item15.x - eachSpacing / 2, _item15.y);
  6200. }
  6201. context.closePath();
  6202. context.fill();
  6203. //画连线
  6204. if (areaOption.addLine) {
  6205. if (eachSeries.lineType == 'dash') {
  6206. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  6207. dashLength *= opts.pix;
  6208. context.setLineDash([dashLength, dashLength]);
  6209. }
  6210. context.beginPath();
  6211. context.setStrokeStyle(eachSeries.color);
  6212. context.setLineWidth(areaOption.width * opts.pix);
  6213. if (_points2.length === 1) {
  6214. context.moveTo(_points2[0].x, _points2[0].y);
  6215. context.arc(_points2[0].x, _points2[0].y, 1, 0, 2 * Math.PI);
  6216. } else {
  6217. context.moveTo(_points2[0].x, _points2[0].y);
  6218. var _startPoint = 0;
  6219. if (areaOption.type === 'curve') {
  6220. for (var _j3 = 0; _j3 < _points2.length; _j3++) {
  6221. var _item16 = _points2[_j3];
  6222. if (_startPoint == 0 && _item16.x > leftSpace) {
  6223. context.moveTo(_item16.x, _item16.y);
  6224. _startPoint = 1;
  6225. }
  6226. if (_j3 > 0 && _item16.x > leftSpace && _item16.x < rightSpace) {
  6227. var _ctrlPoint = createCurveControlPoints(_points2, _j3 - 1);
  6228. context.bezierCurveTo(_ctrlPoint.ctrA.x, _ctrlPoint.ctrA.y, _ctrlPoint.ctrB.x, _ctrlPoint.ctrB.y, _item16.x, _item16.y);
  6229. }
  6230. };
  6231. }
  6232. if (areaOption.type === 'straight') {
  6233. for (var _j4 = 0; _j4 < _points2.length; _j4++) {
  6234. var _item17 = _points2[_j4];
  6235. if (_startPoint == 0 && _item17.x > leftSpace) {
  6236. context.moveTo(_item17.x, _item17.y);
  6237. _startPoint = 1;
  6238. }
  6239. if (_j4 > 0 && _item17.x > leftSpace && _item17.x < rightSpace) {
  6240. context.lineTo(_item17.x, _item17.y);
  6241. }
  6242. };
  6243. }
  6244. if (areaOption.type === 'step') {
  6245. for (var _j5 = 0; _j5 < _points2.length; _j5++) {
  6246. var _item18 = _points2[_j5];
  6247. if (_startPoint == 0 && _item18.x > leftSpace) {
  6248. context.moveTo(_item18.x, _item18.y);
  6249. _startPoint = 1;
  6250. }
  6251. if (_j5 > 0 && _item18.x > leftSpace && _item18.x < rightSpace) {
  6252. context.lineTo(_item18.x, _points2[_j5 - 1].y);
  6253. context.lineTo(_item18.x, _item18.y);
  6254. }
  6255. };
  6256. }
  6257. context.moveTo(_points2[0].x, _points2[0].y);
  6258. }
  6259. context.stroke();
  6260. context.setLineDash([]);
  6261. }
  6262. }
  6263. //画点
  6264. if (opts.dataPointShape !== false) {
  6265. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  6266. }
  6267. });
  6268. if (opts.dataLabel !== false && process === 1) {
  6269. series.forEach(function (eachSeries, seriesIndex) {
  6270. var ranges, minRange, maxRange;
  6271. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6272. minRange = ranges.pop();
  6273. maxRange = ranges.shift();
  6274. var data = eachSeries.data;
  6275. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6276. drawPointText(points, eachSeries, config, context, opts);
  6277. });
  6278. }
  6279. context.restore();
  6280. return {
  6281. xAxisPoints: xAxisPoints,
  6282. calPoints: calPoints,
  6283. eachSpacing: eachSpacing };
  6284. }
  6285. function drawScatterDataPoints(series, opts, config, context) {
  6286. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  6287. var scatterOption = assign({}, {
  6288. type: 'circle' },
  6289. opts.extra.scatter);
  6290. var xAxisData = opts.chartData.xAxisData,
  6291. xAxisPoints = xAxisData.xAxisPoints,
  6292. eachSpacing = xAxisData.eachSpacing;
  6293. var calPoints = [];
  6294. context.save();
  6295. var leftSpace = 0;
  6296. var rightSpace = opts.width + eachSpacing;
  6297. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  6298. context.translate(opts._scrollDistance_, 0);
  6299. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  6300. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  6301. }
  6302. series.forEach(function (eachSeries, seriesIndex) {
  6303. var ranges, minRange, maxRange;
  6304. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6305. minRange = ranges.pop();
  6306. maxRange = ranges.shift();
  6307. var data = eachSeries.data;
  6308. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6309. context.beginPath();
  6310. context.setStrokeStyle(eachSeries.color);
  6311. context.setFillStyle(eachSeries.color);
  6312. context.setLineWidth(1 * opts.pix);
  6313. var shape = eachSeries.pointShape;
  6314. if (shape === 'diamond') {
  6315. points.forEach(function (item, index) {
  6316. if (item !== null) {
  6317. context.moveTo(item.x, item.y - 4.5);
  6318. context.lineTo(item.x - 4.5, item.y);
  6319. context.lineTo(item.x, item.y + 4.5);
  6320. context.lineTo(item.x + 4.5, item.y);
  6321. context.lineTo(item.x, item.y - 4.5);
  6322. }
  6323. });
  6324. } else if (shape === 'circle') {
  6325. points.forEach(function (item, index) {
  6326. if (item !== null) {
  6327. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  6328. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  6329. }
  6330. });
  6331. } else if (shape === 'square') {
  6332. points.forEach(function (item, index) {
  6333. if (item !== null) {
  6334. context.moveTo(item.x - 3.5, item.y - 3.5);
  6335. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  6336. }
  6337. });
  6338. } else if (shape === 'triangle') {
  6339. points.forEach(function (item, index) {
  6340. if (item !== null) {
  6341. context.moveTo(item.x, item.y - 4.5);
  6342. context.lineTo(item.x - 4.5, item.y + 4.5);
  6343. context.lineTo(item.x + 4.5, item.y + 4.5);
  6344. context.lineTo(item.x, item.y - 4.5);
  6345. }
  6346. });
  6347. } else if (shape === 'triangle') {
  6348. return;
  6349. }
  6350. context.closePath();
  6351. context.fill();
  6352. context.stroke();
  6353. });
  6354. if (opts.dataLabel !== false && process === 1) {
  6355. series.forEach(function (eachSeries, seriesIndex) {
  6356. var ranges, minRange, maxRange;
  6357. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6358. minRange = ranges.pop();
  6359. maxRange = ranges.shift();
  6360. var data = eachSeries.data;
  6361. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6362. drawPointText(points, eachSeries, config, context, opts);
  6363. });
  6364. }
  6365. context.restore();
  6366. return {
  6367. xAxisPoints: xAxisPoints,
  6368. calPoints: calPoints,
  6369. eachSpacing: eachSpacing };
  6370. }
  6371. function drawBubbleDataPoints(series, opts, config, context) {
  6372. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  6373. var bubbleOption = assign({}, {
  6374. opacity: 1,
  6375. border: 2 },
  6376. opts.extra.bubble);
  6377. var xAxisData = opts.chartData.xAxisData,
  6378. xAxisPoints = xAxisData.xAxisPoints,
  6379. eachSpacing = xAxisData.eachSpacing;
  6380. var calPoints = [];
  6381. context.save();
  6382. var leftSpace = 0;
  6383. var rightSpace = opts.width + eachSpacing;
  6384. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  6385. context.translate(opts._scrollDistance_, 0);
  6386. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  6387. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  6388. }
  6389. series.forEach(function (eachSeries, seriesIndex) {
  6390. var ranges, minRange, maxRange;
  6391. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6392. minRange = ranges.pop();
  6393. maxRange = ranges.shift();
  6394. var data = eachSeries.data;
  6395. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6396. context.beginPath();
  6397. context.setStrokeStyle(eachSeries.color);
  6398. context.setLineWidth(bubbleOption.border * opts.pix);
  6399. context.setFillStyle(hexToRgb(eachSeries.color, bubbleOption.opacity));
  6400. points.forEach(function (item, index) {
  6401. context.moveTo(item.x + item.r, item.y);
  6402. context.arc(item.x, item.y, item.r * opts.pix, 0, 2 * Math.PI, false);
  6403. });
  6404. context.closePath();
  6405. context.fill();
  6406. context.stroke();
  6407. if (opts.dataLabel !== false && process === 1) {
  6408. points.forEach(function (item, index) {
  6409. context.beginPath();
  6410. var fontSize = series.textSize * opts.pix || config.fontSize;
  6411. context.setFontSize(fontSize);
  6412. context.setFillStyle(series.textColor || "#FFFFFF");
  6413. context.setTextAlign('center');
  6414. context.fillText(String(item.t), item.x, item.y + fontSize / 2);
  6415. context.closePath();
  6416. context.stroke();
  6417. context.setTextAlign('left');
  6418. });
  6419. }
  6420. });
  6421. context.restore();
  6422. return {
  6423. xAxisPoints: xAxisPoints,
  6424. calPoints: calPoints,
  6425. eachSpacing: eachSpacing };
  6426. }
  6427. function drawLineDataPoints(series, opts, config, context) {
  6428. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  6429. var lineOption = assign({}, {
  6430. type: 'straight',
  6431. width: 2 },
  6432. opts.extra.line);
  6433. lineOption.width *= opts.pix;
  6434. var xAxisData = opts.chartData.xAxisData,
  6435. xAxisPoints = xAxisData.xAxisPoints,
  6436. eachSpacing = xAxisData.eachSpacing;
  6437. var calPoints = [];
  6438. context.save();
  6439. var leftSpace = 0;
  6440. var rightSpace = opts.width + eachSpacing;
  6441. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  6442. context.translate(opts._scrollDistance_, 0);
  6443. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  6444. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  6445. }
  6446. series.forEach(function (eachSeries, seriesIndex) {
  6447. var ranges, minRange, maxRange;
  6448. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6449. minRange = ranges.pop();
  6450. maxRange = ranges.shift();
  6451. var data = eachSeries.data;
  6452. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6453. calPoints.push(points);
  6454. var splitPointList = splitPoints(points, eachSeries);
  6455. if (eachSeries.lineType == 'dash') {
  6456. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  6457. dashLength *= opts.pix;
  6458. context.setLineDash([dashLength, dashLength]);
  6459. }
  6460. context.beginPath();
  6461. context.setStrokeStyle(eachSeries.color);
  6462. context.setLineWidth(lineOption.width);
  6463. splitPointList.forEach(function (points, index) {
  6464. if (points.length === 1) {
  6465. context.moveTo(points[0].x, points[0].y);
  6466. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  6467. } else {
  6468. context.moveTo(points[0].x, points[0].y);
  6469. var startPoint = 0;
  6470. if (lineOption.type === 'curve') {
  6471. for (var j = 0; j < points.length; j++) {
  6472. var item = points[j];
  6473. if (startPoint == 0 && item.x > leftSpace) {
  6474. context.moveTo(item.x, item.y);
  6475. startPoint = 1;
  6476. }
  6477. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  6478. var ctrlPoint = createCurveControlPoints(points, j - 1);
  6479. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  6480. }
  6481. };
  6482. }
  6483. if (lineOption.type === 'straight') {
  6484. for (var _j6 = 0; _j6 < points.length; _j6++) {
  6485. var _item19 = points[_j6];
  6486. if (startPoint == 0 && _item19.x > leftSpace) {
  6487. context.moveTo(_item19.x, _item19.y);
  6488. startPoint = 1;
  6489. }
  6490. if (_j6 > 0 && _item19.x > leftSpace && _item19.x < rightSpace) {
  6491. context.lineTo(_item19.x, _item19.y);
  6492. }
  6493. };
  6494. }
  6495. if (lineOption.type === 'step') {
  6496. for (var _j7 = 0; _j7 < points.length; _j7++) {
  6497. var _item20 = points[_j7];
  6498. if (startPoint == 0 && _item20.x > leftSpace) {
  6499. context.moveTo(_item20.x, _item20.y);
  6500. startPoint = 1;
  6501. }
  6502. if (_j7 > 0 && _item20.x > leftSpace && _item20.x < rightSpace) {
  6503. context.lineTo(_item20.x, points[_j7 - 1].y);
  6504. context.lineTo(_item20.x, _item20.y);
  6505. }
  6506. };
  6507. }
  6508. context.moveTo(points[0].x, points[0].y);
  6509. }
  6510. });
  6511. context.stroke();
  6512. context.setLineDash([]);
  6513. if (opts.dataPointShape !== false) {
  6514. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  6515. }
  6516. });
  6517. if (opts.dataLabel !== false && process === 1) {
  6518. series.forEach(function (eachSeries, seriesIndex) {
  6519. var ranges, minRange, maxRange;
  6520. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6521. minRange = ranges.pop();
  6522. maxRange = ranges.shift();
  6523. var data = eachSeries.data;
  6524. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6525. drawPointText(points, eachSeries, config, context, opts);
  6526. });
  6527. }
  6528. context.restore();
  6529. return {
  6530. xAxisPoints: xAxisPoints,
  6531. calPoints: calPoints,
  6532. eachSpacing: eachSpacing };
  6533. }
  6534. function drawMixDataPoints(series, opts, config, context) {
  6535. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  6536. var xAxisData = opts.chartData.xAxisData,
  6537. xAxisPoints = xAxisData.xAxisPoints,
  6538. eachSpacing = xAxisData.eachSpacing;
  6539. var columnOption = assign({}, {
  6540. width: eachSpacing / 2,
  6541. barBorderCircle: false,
  6542. barBorderRadius: [],
  6543. seriesGap: 2,
  6544. linearType: 'none',
  6545. linearOpacity: 1,
  6546. customColor: [],
  6547. colorStop: 0 },
  6548. opts.extra.mix.column);
  6549. var areaOption = assign({}, {
  6550. opacity: 0.2,
  6551. gradient: false },
  6552. opts.extra.mix.area);
  6553. var endY = opts.height - opts.area[2];
  6554. var calPoints = [];
  6555. var columnIndex = 0;
  6556. var columnLength = 0;
  6557. series.forEach(function (eachSeries, seriesIndex) {
  6558. if (eachSeries.type == 'column') {
  6559. columnLength += 1;
  6560. }
  6561. });
  6562. context.save();
  6563. var leftNum = -2;
  6564. var rightNum = xAxisPoints.length + 2;
  6565. var leftSpace = 0;
  6566. var rightSpace = opts.width + eachSpacing;
  6567. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  6568. context.translate(opts._scrollDistance_, 0);
  6569. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  6570. rightNum = leftNum + opts.xAxis.itemCount + 4;
  6571. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  6572. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  6573. }
  6574. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  6575. series.forEach(function (eachSeries, seriesIndex) {
  6576. var ranges, minRange, maxRange;
  6577. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6578. minRange = ranges.pop();
  6579. maxRange = ranges.shift();
  6580. var data = eachSeries.data;
  6581. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6582. calPoints.push(points);
  6583. // 绘制柱状数据图
  6584. if (eachSeries.type == 'column') {
  6585. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  6586. for (var i = 0; i < points.length; i++) {
  6587. var item = points[i];
  6588. if (item !== null && i > leftNum && i < rightNum) {
  6589. var startX = item.x - item.width / 2;
  6590. var height = opts.height - item.y - opts.area[2];
  6591. context.beginPath();
  6592. var fillColor = item.color || eachSeries.color;
  6593. var strokeColor = item.color || eachSeries.color;
  6594. if (columnOption.linearType !== 'none') {
  6595. var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]);
  6596. //透明渐变
  6597. if (columnOption.linearType == 'opacity') {
  6598. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  6599. grd.addColorStop(1, hexToRgb(fillColor, 1));
  6600. } else {
  6601. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  6602. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  6603. grd.addColorStop(1, hexToRgb(fillColor, 1));
  6604. }
  6605. fillColor = grd;
  6606. }
  6607. // 圆角边框
  6608. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle) {
  6609. var left = startX;
  6610. var top = item.y;
  6611. var width = item.width;
  6612. var _height5 = opts.height - opts.area[2] - item.y;
  6613. if (columnOption.barBorderCircle) {
  6614. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  6615. }var _columnOption$barBord4 = _slicedToArray(
  6616. columnOption.barBorderRadius, 4),r0 = _columnOption$barBord4[0],r1 = _columnOption$barBord4[1],r2 = _columnOption$barBord4[2],r3 = _columnOption$barBord4[3];
  6617. var minRadius = Math.min(width / 2, _height5 / 2);
  6618. r0 = r0 > minRadius ? minRadius : r0;
  6619. r1 = r1 > minRadius ? minRadius : r1;
  6620. r2 = r2 > minRadius ? minRadius : r2;
  6621. r3 = r3 > minRadius ? minRadius : r3;
  6622. r0 = r0 < 0 ? 0 : r0;
  6623. r1 = r1 < 0 ? 0 : r1;
  6624. r2 = r2 < 0 ? 0 : r2;
  6625. r3 = r3 < 0 ? 0 : r3;
  6626. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  6627. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  6628. context.arc(left + width - r2, top + _height5 - r2, r2, 0, Math.PI / 2);
  6629. context.arc(left + r3, top + _height5 - r3, r3, Math.PI / 2, Math.PI);
  6630. } else {
  6631. context.moveTo(startX, item.y);
  6632. context.lineTo(startX + item.width, item.y);
  6633. context.lineTo(startX + item.width, opts.height - opts.area[2]);
  6634. context.lineTo(startX, opts.height - opts.area[2]);
  6635. context.lineTo(startX, item.y);
  6636. context.setLineWidth(1);
  6637. context.setStrokeStyle(strokeColor);
  6638. }
  6639. context.setFillStyle(fillColor);
  6640. context.closePath();
  6641. context.fill();
  6642. }
  6643. }
  6644. columnIndex += 1;
  6645. }
  6646. //绘制区域图数据
  6647. if (eachSeries.type == 'area') {
  6648. var _splitPointList = splitPoints(points, eachSeries);
  6649. for (var _i23 = 0; _i23 < _splitPointList.length; _i23++) {
  6650. var _points3 = _splitPointList[_i23];
  6651. // 绘制区域数据
  6652. context.beginPath();
  6653. context.setStrokeStyle(eachSeries.color);
  6654. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  6655. if (areaOption.gradient) {
  6656. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  6657. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  6658. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  6659. context.setFillStyle(gradient);
  6660. } else {
  6661. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  6662. }
  6663. context.setLineWidth(2 * opts.pix);
  6664. if (_points3.length > 1) {
  6665. var firstPoint = _points3[0];
  6666. var lastPoint = _points3[_points3.length - 1];
  6667. context.moveTo(firstPoint.x, firstPoint.y);
  6668. var startPoint = 0;
  6669. if (eachSeries.style === 'curve') {
  6670. for (var j = 0; j < _points3.length; j++) {
  6671. var _item21 = _points3[j];
  6672. if (startPoint == 0 && _item21.x > leftSpace) {
  6673. context.moveTo(_item21.x, _item21.y);
  6674. startPoint = 1;
  6675. }
  6676. if (j > 0 && _item21.x > leftSpace && _item21.x < rightSpace) {
  6677. var ctrlPoint = createCurveControlPoints(_points3, j - 1);
  6678. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item21.x, _item21.y);
  6679. }
  6680. };
  6681. } else {
  6682. for (var _j8 = 0; _j8 < _points3.length; _j8++) {
  6683. var _item22 = _points3[_j8];
  6684. if (startPoint == 0 && _item22.x > leftSpace) {
  6685. context.moveTo(_item22.x, _item22.y);
  6686. startPoint = 1;
  6687. }
  6688. if (_j8 > 0 && _item22.x > leftSpace && _item22.x < rightSpace) {
  6689. context.lineTo(_item22.x, _item22.y);
  6690. }
  6691. };
  6692. }
  6693. context.lineTo(lastPoint.x, endY);
  6694. context.lineTo(firstPoint.x, endY);
  6695. context.lineTo(firstPoint.x, firstPoint.y);
  6696. } else {
  6697. var _item23 = _points3[0];
  6698. context.moveTo(_item23.x - eachSpacing / 2, _item23.y);
  6699. context.lineTo(_item23.x + eachSpacing / 2, _item23.y);
  6700. context.lineTo(_item23.x + eachSpacing / 2, endY);
  6701. context.lineTo(_item23.x - eachSpacing / 2, endY);
  6702. context.moveTo(_item23.x - eachSpacing / 2, _item23.y);
  6703. }
  6704. context.closePath();
  6705. context.fill();
  6706. }
  6707. }
  6708. // 绘制折线数据图
  6709. if (eachSeries.type == 'line') {
  6710. var splitPointList = splitPoints(points, eachSeries);
  6711. splitPointList.forEach(function (points, index) {
  6712. if (eachSeries.lineType == 'dash') {
  6713. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  6714. dashLength *= opts.pix;
  6715. context.setLineDash([dashLength, dashLength]);
  6716. }
  6717. context.beginPath();
  6718. context.setStrokeStyle(eachSeries.color);
  6719. context.setLineWidth(2 * opts.pix);
  6720. if (points.length === 1) {
  6721. context.moveTo(points[0].x, points[0].y);
  6722. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  6723. } else {
  6724. context.moveTo(points[0].x, points[0].y);
  6725. var _startPoint2 = 0;
  6726. if (eachSeries.style == 'curve') {
  6727. for (var _j9 = 0; _j9 < points.length; _j9++) {
  6728. var _item24 = points[_j9];
  6729. if (_startPoint2 == 0 && _item24.x > leftSpace) {
  6730. context.moveTo(_item24.x, _item24.y);
  6731. _startPoint2 = 1;
  6732. }
  6733. if (_j9 > 0 && _item24.x > leftSpace && _item24.x < rightSpace) {
  6734. var ctrlPoint = createCurveControlPoints(points, _j9 - 1);
  6735. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
  6736. _item24.x, _item24.y);
  6737. }
  6738. }
  6739. } else {
  6740. for (var _j10 = 0; _j10 < points.length; _j10++) {
  6741. var _item25 = points[_j10];
  6742. if (_startPoint2 == 0 && _item25.x > leftSpace) {
  6743. context.moveTo(_item25.x, _item25.y);
  6744. _startPoint2 = 1;
  6745. }
  6746. if (_j10 > 0 && _item25.x > leftSpace && _item25.x < rightSpace) {
  6747. context.lineTo(_item25.x, _item25.y);
  6748. }
  6749. }
  6750. }
  6751. context.moveTo(points[0].x, points[0].y);
  6752. }
  6753. context.stroke();
  6754. context.setLineDash([]);
  6755. });
  6756. }
  6757. // 绘制点数据图
  6758. if (eachSeries.type == 'point') {
  6759. eachSeries.addPoint = true;
  6760. }
  6761. if (eachSeries.addPoint == true && eachSeries.type !== 'column') {
  6762. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  6763. }
  6764. });
  6765. if (opts.dataLabel !== false && process === 1) {
  6766. var columnIndex = 0;
  6767. series.forEach(function (eachSeries, seriesIndex) {
  6768. var ranges, minRange, maxRange;
  6769. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  6770. minRange = ranges.pop();
  6771. maxRange = ranges.shift();
  6772. var data = eachSeries.data;
  6773. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  6774. if (eachSeries.type !== 'column') {
  6775. drawPointText(points, eachSeries, config, context, opts);
  6776. } else {
  6777. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  6778. drawPointText(points, eachSeries, config, context, opts);
  6779. columnIndex += 1;
  6780. }
  6781. });
  6782. }
  6783. context.restore();
  6784. return {
  6785. xAxisPoints: xAxisPoints,
  6786. calPoints: calPoints,
  6787. eachSpacing: eachSpacing };
  6788. }
  6789. function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
  6790. var toolTipOption = opts.extra.tooltip || {};
  6791. if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'mount' || opts.type == 'candle' || opts.type == 'mix')) {
  6792. drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints);
  6793. }
  6794. context.save();
  6795. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  6796. context.translate(opts._scrollDistance_, 0);
  6797. }
  6798. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  6799. drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
  6800. }
  6801. context.restore();
  6802. }
  6803. function drawXAxis(categories, opts, config, context) {
  6804. var xAxisData = opts.chartData.xAxisData,
  6805. xAxisPoints = xAxisData.xAxisPoints,
  6806. startX = xAxisData.startX,
  6807. endX = xAxisData.endX,
  6808. eachSpacing = xAxisData.eachSpacing;
  6809. var boundaryGap = 'center';
  6810. if (opts.type == 'bar' || opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  6811. boundaryGap = opts.xAxis.boundaryGap;
  6812. }
  6813. var startY = opts.height - opts.area[2];
  6814. var endY = opts.area[0];
  6815. //绘制滚动条
  6816. if (opts.enableScroll && opts.xAxis.scrollShow) {
  6817. var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
  6818. var scrollScreenWidth = endX - startX;
  6819. var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
  6820. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  6821. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  6822. scrollTotalWidth += (opts.extra.mount.widthRatio - 1) * eachSpacing;
  6823. }
  6824. var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
  6825. var scrollLeft = 0;
  6826. if (opts._scrollDistance_) {
  6827. scrollLeft = -opts._scrollDistance_ * scrollScreenWidth / scrollTotalWidth;
  6828. }
  6829. context.beginPath();
  6830. context.setLineCap('round');
  6831. context.setLineWidth(6 * opts.pix);
  6832. context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
  6833. context.moveTo(startX, scrollY);
  6834. context.lineTo(endX, scrollY);
  6835. context.stroke();
  6836. context.closePath();
  6837. context.beginPath();
  6838. context.setLineCap('round');
  6839. context.setLineWidth(6 * opts.pix);
  6840. context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
  6841. context.moveTo(startX + scrollLeft, scrollY);
  6842. context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
  6843. context.stroke();
  6844. context.closePath();
  6845. context.setLineCap('butt');
  6846. }
  6847. context.save();
  6848. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  6849. context.translate(opts._scrollDistance_, 0);
  6850. }
  6851. //绘制X轴刻度线
  6852. if (opts.xAxis.calibration === true) {
  6853. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  6854. context.setLineCap('butt');
  6855. context.setLineWidth(1 * opts.pix);
  6856. xAxisPoints.forEach(function (item, index) {
  6857. if (index > 0) {
  6858. context.beginPath();
  6859. context.moveTo(item - eachSpacing / 2, startY);
  6860. context.lineTo(item - eachSpacing / 2, startY + 3 * opts.pix);
  6861. context.closePath();
  6862. context.stroke();
  6863. }
  6864. });
  6865. }
  6866. //绘制X轴网格
  6867. if (opts.xAxis.disableGrid !== true) {
  6868. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  6869. context.setLineCap('butt');
  6870. context.setLineWidth(1 * opts.pix);
  6871. if (opts.xAxis.gridType == 'dash') {
  6872. context.setLineDash([opts.xAxis.dashLength * opts.pix, opts.xAxis.dashLength * opts.pix]);
  6873. }
  6874. opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
  6875. xAxisPoints.forEach(function (item, index) {
  6876. if (index % opts.xAxis.gridEval == 0) {
  6877. context.beginPath();
  6878. context.moveTo(item, startY);
  6879. context.lineTo(item, endY);
  6880. context.stroke();
  6881. }
  6882. });
  6883. context.setLineDash([]);
  6884. }
  6885. //绘制X轴文案
  6886. if (opts.xAxis.disabled !== true) {
  6887. // 对X轴列表做抽稀处理
  6888. //默认全部显示X轴标签
  6889. var maxXAxisListLength = categories.length;
  6890. //如果设置了X轴单屏数量
  6891. if (opts.xAxis.labelCount) {
  6892. //如果设置X轴密度
  6893. if (opts.xAxis.itemCount) {
  6894. maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
  6895. } else {
  6896. maxXAxisListLength = opts.xAxis.labelCount;
  6897. }
  6898. maxXAxisListLength -= 1;
  6899. }
  6900. var ratio = Math.ceil(categories.length / maxXAxisListLength);
  6901. var newCategories = [];
  6902. var cgLength = categories.length;
  6903. for (var i = 0; i < cgLength; i++) {
  6904. if (i % ratio !== 0) {
  6905. newCategories.push("");
  6906. } else {
  6907. newCategories.push(categories[i]);
  6908. }
  6909. }
  6910. newCategories[cgLength - 1] = categories[cgLength - 1];
  6911. var xAxisFontSize = opts.xAxis.fontSize * opts.pix || config.fontSize;
  6912. if (config._xAxisTextAngle_ === 0) {
  6913. newCategories.forEach(function (item, index) {
  6914. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  6915. var offset = -measureText(String(xitem), xAxisFontSize, context) / 2;
  6916. if (boundaryGap == 'center') {
  6917. offset += eachSpacing / 2;
  6918. }
  6919. var scrollHeight = 0;
  6920. if (opts.xAxis.scrollShow) {
  6921. scrollHeight = 6 * opts.pix;
  6922. }
  6923. context.beginPath();
  6924. context.setFontSize(xAxisFontSize);
  6925. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  6926. context.fillText(String(xitem), xAxisPoints[index] + offset, startY + xAxisFontSize + (config.xAxisHeight - scrollHeight - xAxisFontSize) / 2);
  6927. context.closePath();
  6928. context.stroke();
  6929. });
  6930. } else {
  6931. newCategories.forEach(function (item, index) {
  6932. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item) : item;
  6933. context.save();
  6934. context.beginPath();
  6935. context.setFontSize(xAxisFontSize);
  6936. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  6937. var textWidth = measureText(String(xitem), xAxisFontSize, context);
  6938. var offsetX = xAxisPoints[index];
  6939. if (boundaryGap == 'center') {
  6940. offsetX = xAxisPoints[index] + eachSpacing / 2;
  6941. }
  6942. var scrollHeight = 0;
  6943. if (opts.xAxis.scrollShow) {
  6944. scrollHeight = 6 * opts.pix;
  6945. }
  6946. var offsetY = startY + 6 * opts.pix + xAxisFontSize - xAxisFontSize * Math.abs(Math.sin(config._xAxisTextAngle_));
  6947. if (opts.xAxis.rotateAngle < 0) {
  6948. offsetX -= xAxisFontSize / 2;
  6949. textWidth = 0;
  6950. } else {
  6951. offsetX += xAxisFontSize / 2;
  6952. textWidth = -textWidth;
  6953. }
  6954. context.translate(offsetX, offsetY);
  6955. context.rotate(-1 * config._xAxisTextAngle_);
  6956. context.fillText(String(xitem), textWidth, 0);
  6957. context.closePath();
  6958. context.stroke();
  6959. context.restore();
  6960. });
  6961. }
  6962. }
  6963. context.restore();
  6964. //绘制X轴轴线
  6965. if (opts.xAxis.axisLine) {
  6966. context.beginPath();
  6967. context.setStrokeStyle(opts.xAxis.axisLineColor);
  6968. context.setLineWidth(1 * opts.pix);
  6969. context.moveTo(startX, opts.height - opts.area[2]);
  6970. context.lineTo(endX, opts.height - opts.area[2]);
  6971. context.stroke();
  6972. }
  6973. }
  6974. function drawYAxisGrid(categories, opts, config, context) {
  6975. if (opts.yAxis.disableGrid === true) {
  6976. return;
  6977. }
  6978. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  6979. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  6980. var startX = opts.area[3];
  6981. var xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  6982. xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing;
  6983. var TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1);
  6984. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  6985. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  6986. TotalWidth += (opts.extra.mount.widthRatio - 1) * xAxiseachSpacing;
  6987. }
  6988. var endX = startX + TotalWidth;
  6989. var points = [];
  6990. var startY = 1;
  6991. if (opts.xAxis.axisLine === false) {
  6992. startY = 0;
  6993. }
  6994. for (var i = startY; i < opts.yAxis.splitNumber + 1; i++) {
  6995. points.push(opts.height - opts.area[2] - eachSpacing * i);
  6996. }
  6997. context.save();
  6998. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  6999. context.translate(opts._scrollDistance_, 0);
  7000. }
  7001. if (opts.yAxis.gridType == 'dash') {
  7002. context.setLineDash([opts.yAxis.dashLength * opts.pix, opts.yAxis.dashLength * opts.pix]);
  7003. }
  7004. context.setStrokeStyle(opts.yAxis.gridColor);
  7005. context.setLineWidth(1 * opts.pix);
  7006. points.forEach(function (item, index) {
  7007. context.beginPath();
  7008. context.moveTo(startX, item);
  7009. context.lineTo(endX, item);
  7010. context.stroke();
  7011. });
  7012. context.setLineDash([]);
  7013. context.restore();
  7014. }
  7015. function drawYAxis(series, opts, config, context) {
  7016. if (opts.yAxis.disabled === true) {
  7017. return;
  7018. }
  7019. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  7020. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  7021. var startX = opts.area[3];
  7022. var endX = opts.width - opts.area[1];
  7023. var endY = opts.height - opts.area[2];
  7024. var fillEndY = endY + config.xAxisHeight;
  7025. if (opts.xAxis.scrollShow) {
  7026. fillEndY -= 3 * opts.pix;
  7027. }
  7028. if (opts.xAxis.rotateLabel) {
  7029. fillEndY = opts.height - opts.area[2] + opts.fontSize * opts.pix / 2;
  7030. }
  7031. // set YAxis background
  7032. context.beginPath();
  7033. context.setFillStyle(opts.background);
  7034. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'left') {
  7035. context.fillRect(0, 0, startX, fillEndY);
  7036. }
  7037. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'right') {
  7038. context.fillRect(endX, 0, opts.width, fillEndY);
  7039. }
  7040. context.closePath();
  7041. context.stroke();
  7042. var tStartLeft = opts.area[3];
  7043. var tStartRight = opts.width - opts.area[1];
  7044. var tStartCenter = opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2;
  7045. if (opts.yAxis.data) {var _loop4 = function _loop4(
  7046. i) {
  7047. var yData = opts.yAxis.data[i];
  7048. points = [];
  7049. if (yData.type === 'categories') {
  7050. for (var _i24 = 0; _i24 <= yData.categories.length; _i24++) {
  7051. points.push(opts.area[0] + spacingValid / yData.categories.length / 2 + spacingValid / yData.categories.length * _i24);
  7052. }
  7053. } else {
  7054. for (var _i25 = 0; _i25 <= opts.yAxis.splitNumber; _i25++) {
  7055. points.push(opts.area[0] + eachSpacing * _i25);
  7056. }
  7057. }
  7058. if (yData.disabled !== true) {
  7059. var rangesFormat = opts.chartData.yAxisData.rangesFormat[i];
  7060. var yAxisFontSize = yData.fontSize ? yData.fontSize * opts.pix : config.fontSize;
  7061. var yAxisWidth = opts.chartData.yAxisData.yAxisWidth[i];
  7062. var textAlign = yData.textAlign || "right";
  7063. //画Y轴刻度及文案
  7064. rangesFormat.forEach(function (item, index) {
  7065. var pos = points[index];
  7066. context.beginPath();
  7067. context.setFontSize(yAxisFontSize);
  7068. context.setLineWidth(1 * opts.pix);
  7069. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  7070. context.setFillStyle(yData.fontColor || opts.fontColor);
  7071. var tmpstrat = 0;
  7072. var gapwidth = 4 * opts.pix;
  7073. if (yAxisWidth.position == 'left') {
  7074. //画刻度线
  7075. if (yData.calibration == true) {
  7076. context.moveTo(tStartLeft, pos);
  7077. context.lineTo(tStartLeft - 3 * opts.pix, pos);
  7078. gapwidth += 3 * opts.pix;
  7079. }
  7080. //画文字
  7081. switch (textAlign) {
  7082. case "left":
  7083. context.setTextAlign('left');
  7084. tmpstrat = tStartLeft - yAxisWidth.width;
  7085. break;
  7086. case "right":
  7087. context.setTextAlign('right');
  7088. tmpstrat = tStartLeft - gapwidth;
  7089. break;
  7090. default:
  7091. context.setTextAlign('center');
  7092. tmpstrat = tStartLeft - yAxisWidth.width / 2;}
  7093. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  7094. } else if (yAxisWidth.position == 'right') {
  7095. //画刻度线
  7096. if (yData.calibration == true) {
  7097. context.moveTo(tStartRight, pos);
  7098. context.lineTo(tStartRight + 3 * opts.pix, pos);
  7099. gapwidth += 3 * opts.pix;
  7100. }
  7101. switch (textAlign) {
  7102. case "left":
  7103. context.setTextAlign('left');
  7104. tmpstrat = tStartRight + gapwidth;
  7105. break;
  7106. case "right":
  7107. context.setTextAlign('right');
  7108. tmpstrat = tStartRight + yAxisWidth.width;
  7109. break;
  7110. default:
  7111. context.setTextAlign('center');
  7112. tmpstrat = tStartRight + yAxisWidth.width / 2;}
  7113. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  7114. } else if (yAxisWidth.position == 'center') {
  7115. //画刻度线
  7116. if (yData.calibration == true) {
  7117. context.moveTo(tStartCenter, pos);
  7118. context.lineTo(tStartCenter - 3 * opts.pix, pos);
  7119. gapwidth += 3 * opts.pix;
  7120. }
  7121. //画文字
  7122. switch (textAlign) {
  7123. case "left":
  7124. context.setTextAlign('left');
  7125. tmpstrat = tStartCenter - yAxisWidth.width;
  7126. break;
  7127. case "right":
  7128. context.setTextAlign('right');
  7129. tmpstrat = tStartCenter - gapwidth;
  7130. break;
  7131. default:
  7132. context.setTextAlign('center');
  7133. tmpstrat = tStartCenter - yAxisWidth.width / 2;}
  7134. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  7135. }
  7136. context.closePath();
  7137. context.stroke();
  7138. context.setTextAlign('left');
  7139. });
  7140. //画Y轴轴线
  7141. if (yData.axisLine !== false) {
  7142. context.beginPath();
  7143. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  7144. context.setLineWidth(1 * opts.pix);
  7145. if (yAxisWidth.position == 'left') {
  7146. context.moveTo(tStartLeft, opts.height - opts.area[2]);
  7147. context.lineTo(tStartLeft, opts.area[0]);
  7148. } else if (yAxisWidth.position == 'right') {
  7149. context.moveTo(tStartRight, opts.height - opts.area[2]);
  7150. context.lineTo(tStartRight, opts.area[0]);
  7151. } else if (yAxisWidth.position == 'center') {
  7152. context.moveTo(tStartCenter, opts.height - opts.area[2]);
  7153. context.lineTo(tStartCenter, opts.area[0]);
  7154. }
  7155. context.stroke();
  7156. }
  7157. //画Y轴标题
  7158. if (opts.yAxis.showTitle) {
  7159. var titleFontSize = yData.titleFontSize * opts.pix || config.fontSize;
  7160. var title = yData.title;
  7161. context.beginPath();
  7162. context.setFontSize(titleFontSize);
  7163. context.setFillStyle(yData.titleFontColor || opts.fontColor);
  7164. if (yAxisWidth.position == 'left') {
  7165. context.fillText(title, tStartLeft - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  7166. } else if (yAxisWidth.position == 'right') {
  7167. context.fillText(title, tStartRight - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  7168. } else if (yAxisWidth.position == 'center') {
  7169. context.fillText(title, tStartCenter - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  7170. }
  7171. context.closePath();
  7172. context.stroke();
  7173. }
  7174. if (yAxisWidth.position == 'left') {
  7175. tStartLeft -= yAxisWidth.width + opts.yAxis.padding * opts.pix;
  7176. } else {
  7177. tStartRight += yAxisWidth.width + opts.yAxis.padding * opts.pix;
  7178. }
  7179. }};for (var i = 0; i < opts.yAxis.data.length; i++) {var points;_loop4(i);
  7180. }
  7181. }
  7182. }
  7183. function drawLegend(series, opts, config, context, chartData) {
  7184. if (opts.legend.show === false) {
  7185. return;
  7186. }
  7187. var legendData = chartData.legendData;
  7188. var legendList = legendData.points;
  7189. var legendArea = legendData.area;
  7190. var padding = opts.legend.padding * opts.pix;
  7191. var fontSize = opts.legend.fontSize * opts.pix;
  7192. var shapeWidth = 15 * opts.pix;
  7193. var shapeRight = 5 * opts.pix;
  7194. var itemGap = opts.legend.itemGap * opts.pix;
  7195. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  7196. //画背景及边框
  7197. context.beginPath();
  7198. context.setLineWidth(opts.legend.borderWidth * opts.pix);
  7199. context.setStrokeStyle(opts.legend.borderColor);
  7200. context.setFillStyle(opts.legend.backgroundColor);
  7201. context.moveTo(legendArea.start.x, legendArea.start.y);
  7202. context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height);
  7203. context.closePath();
  7204. context.fill();
  7205. context.stroke();
  7206. legendList.forEach(function (itemList, listIndex) {
  7207. var width = 0;
  7208. var height = 0;
  7209. width = legendData.widthArr[listIndex];
  7210. height = legendData.heightArr[listIndex];
  7211. var startX = 0;
  7212. var startY = 0;
  7213. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  7214. switch (opts.legend.float) {
  7215. case 'left':
  7216. startX = legendArea.start.x + padding;
  7217. break;
  7218. case 'right':
  7219. startX = legendArea.start.x + legendArea.width - width;
  7220. break;
  7221. default:
  7222. startX = legendArea.start.x + (legendArea.width - width) / 2;}
  7223. startY = legendArea.start.y + padding + listIndex * lineHeight;
  7224. } else {
  7225. if (listIndex == 0) {
  7226. width = 0;
  7227. } else {
  7228. width = legendData.widthArr[listIndex - 1];
  7229. }
  7230. startX = legendArea.start.x + padding + width;
  7231. startY = legendArea.start.y + padding + (legendArea.height - height) / 2;
  7232. }
  7233. context.setFontSize(config.fontSize);
  7234. for (var i = 0; i < itemList.length; i++) {
  7235. var item = itemList[i];
  7236. item.area = [0, 0, 0, 0];
  7237. item.area[0] = startX;
  7238. item.area[1] = startY;
  7239. item.area[3] = startY + lineHeight;
  7240. context.beginPath();
  7241. context.setLineWidth(1 * opts.pix);
  7242. context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor);
  7243. context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor);
  7244. switch (item.legendShape) {
  7245. case 'line':
  7246. context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pix);
  7247. context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pix, 15 * opts.pix, 4 * opts.pix);
  7248. break;
  7249. case 'triangle':
  7250. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  7251. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  7252. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  7253. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  7254. break;
  7255. case 'diamond':
  7256. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  7257. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight);
  7258. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  7259. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight);
  7260. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  7261. break;
  7262. case 'circle':
  7263. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight);
  7264. context.arc(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight, 5 * opts.pix, 0, 2 * Math.PI);
  7265. break;
  7266. case 'rect':
  7267. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  7268. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  7269. break;
  7270. case 'square':
  7271. context.moveTo(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  7272. context.fillRect(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
  7273. break;
  7274. case 'none':
  7275. break;
  7276. default:
  7277. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  7278. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);}
  7279. context.closePath();
  7280. context.fill();
  7281. context.stroke();
  7282. startX += shapeWidth + shapeRight;
  7283. var fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2;
  7284. var legendText = item.legendText ? item.legendText : item.name;
  7285. context.beginPath();
  7286. context.setFontSize(fontSize);
  7287. context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor);
  7288. context.fillText(legendText, startX, startY + fontTrans);
  7289. context.closePath();
  7290. context.stroke();
  7291. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  7292. startX += measureText(legendText, fontSize, context) + itemGap;
  7293. item.area[2] = startX;
  7294. } else {
  7295. item.area[2] = startX + measureText(legendText, fontSize, context) + itemGap;;
  7296. startX -= shapeWidth + shapeRight;
  7297. startY += lineHeight;
  7298. }
  7299. }
  7300. });
  7301. }
  7302. function drawPieDataPoints(series, opts, config, context) {
  7303. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  7304. var pieOption = assign({}, {
  7305. activeOpacity: 0.5,
  7306. activeRadius: 10,
  7307. offsetAngle: 0,
  7308. labelWidth: 15,
  7309. ringWidth: 30,
  7310. customRadius: 0,
  7311. border: false,
  7312. borderWidth: 2,
  7313. borderColor: '#FFFFFF',
  7314. centerColor: '#FFFFFF',
  7315. linearType: 'none',
  7316. customColor: [] },
  7317. opts.type == "pie" ? opts.extra.pie : opts.extra.ring);
  7318. var centerPosition = {
  7319. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  7320. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 };
  7321. if (config.pieChartLinePadding == 0) {
  7322. config.pieChartLinePadding = pieOption.activeRadius * opts.pix;
  7323. }
  7324. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
  7325. radius = radius < 10 ? 10 : radius;
  7326. if (pieOption.customRadius > 0) {
  7327. radius = pieOption.customRadius * opts.pix;
  7328. }
  7329. series = getPieDataPoints(series, radius, process);
  7330. var activeRadius = pieOption.activeRadius * opts.pix;
  7331. pieOption.customColor = fillCustomColor(pieOption.linearType, pieOption.customColor, series, config);
  7332. series = series.map(function (eachSeries) {
  7333. eachSeries._start_ += pieOption.offsetAngle * Math.PI / 180;
  7334. return eachSeries;
  7335. });
  7336. series.forEach(function (eachSeries, seriesIndex) {
  7337. if (opts.tooltip) {
  7338. if (opts.tooltip.index == seriesIndex) {
  7339. context.beginPath();
  7340. context.setFillStyle(hexToRgb(eachSeries.color, pieOption.activeOpacity || 0.5));
  7341. context.moveTo(centerPosition.x, centerPosition.y);
  7342. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  7343. context.closePath();
  7344. context.fill();
  7345. }
  7346. }
  7347. context.beginPath();
  7348. context.setLineWidth(pieOption.borderWidth * opts.pix);
  7349. context.lineJoin = "round";
  7350. context.setStrokeStyle(pieOption.borderColor);
  7351. var fillcolor = eachSeries.color;
  7352. if (pieOption.linearType == 'custom') {
  7353. var grd;
  7354. if (context.createCircularGradient) {
  7355. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  7356. } else {
  7357. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  7358. }
  7359. grd.addColorStop(0, hexToRgb(pieOption.customColor[eachSeries.linearIndex], 1));
  7360. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  7361. fillcolor = grd;
  7362. }
  7363. context.setFillStyle(fillcolor);
  7364. context.moveTo(centerPosition.x, centerPosition.y);
  7365. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  7366. context.closePath();
  7367. context.fill();
  7368. if (pieOption.border == true) {
  7369. context.stroke();
  7370. }
  7371. });
  7372. if (opts.type === 'ring') {
  7373. var innerPieWidth = radius * 0.6;
  7374. if (typeof pieOption.ringWidth === 'number' && pieOption.ringWidth > 0) {
  7375. innerPieWidth = Math.max(0, radius - pieOption.ringWidth * opts.pix);
  7376. }
  7377. context.beginPath();
  7378. context.setFillStyle(pieOption.centerColor);
  7379. context.moveTo(centerPosition.x, centerPosition.y);
  7380. context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI);
  7381. context.closePath();
  7382. context.fill();
  7383. }
  7384. if (opts.dataLabel !== false && process === 1) {
  7385. drawPieText(series, opts, config, context, radius, centerPosition);
  7386. }
  7387. if (process === 1 && opts.type === 'ring') {
  7388. drawRingTitle(opts, config, context, centerPosition);
  7389. }
  7390. return {
  7391. center: centerPosition,
  7392. radius: radius,
  7393. series: series };
  7394. }
  7395. function drawRoseDataPoints(series, opts, config, context) {
  7396. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  7397. var roseOption = assign({}, {
  7398. type: 'area',
  7399. activeOpacity: 0.5,
  7400. activeRadius: 10,
  7401. offsetAngle: 0,
  7402. labelWidth: 15,
  7403. border: false,
  7404. borderWidth: 2,
  7405. borderColor: '#FFFFFF',
  7406. linearType: 'none',
  7407. customColor: [] },
  7408. opts.extra.rose);
  7409. if (config.pieChartLinePadding == 0) {
  7410. config.pieChartLinePadding = roseOption.activeRadius * opts.pix;
  7411. }
  7412. var centerPosition = {
  7413. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  7414. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 };
  7415. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
  7416. radius = radius < 10 ? 10 : radius;
  7417. var minRadius = roseOption.minRadius || radius * 0.5;
  7418. series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
  7419. var activeRadius = roseOption.activeRadius * opts.pix;
  7420. roseOption.customColor = fillCustomColor(roseOption.linearType, roseOption.customColor, series, config);
  7421. series = series.map(function (eachSeries) {
  7422. eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
  7423. return eachSeries;
  7424. });
  7425. series.forEach(function (eachSeries, seriesIndex) {
  7426. if (opts.tooltip) {
  7427. if (opts.tooltip.index == seriesIndex) {
  7428. context.beginPath();
  7429. context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
  7430. context.moveTo(centerPosition.x, centerPosition.y);
  7431. context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  7432. context.closePath();
  7433. context.fill();
  7434. }
  7435. }
  7436. context.beginPath();
  7437. context.setLineWidth(roseOption.borderWidth * opts.pix);
  7438. context.lineJoin = "round";
  7439. context.setStrokeStyle(roseOption.borderColor);
  7440. var fillcolor = eachSeries.color;
  7441. if (roseOption.linearType == 'custom') {
  7442. var grd;
  7443. if (context.createCircularGradient) {
  7444. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  7445. } else {
  7446. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  7447. }
  7448. grd.addColorStop(0, hexToRgb(roseOption.customColor[eachSeries.linearIndex], 1));
  7449. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  7450. fillcolor = grd;
  7451. }
  7452. context.setFillStyle(fillcolor);
  7453. context.moveTo(centerPosition.x, centerPosition.y);
  7454. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  7455. context.closePath();
  7456. context.fill();
  7457. if (roseOption.border == true) {
  7458. context.stroke();
  7459. }
  7460. });
  7461. if (opts.dataLabel !== false && process === 1) {
  7462. drawPieText(series, opts, config, context, radius, centerPosition);
  7463. }
  7464. return {
  7465. center: centerPosition,
  7466. radius: radius,
  7467. series: series };
  7468. }
  7469. function drawArcbarDataPoints(series, opts, config, context) {
  7470. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  7471. var arcbarOption = assign({}, {
  7472. startAngle: 0.75,
  7473. endAngle: 0.25,
  7474. type: 'default',
  7475. lineCap: 'round',
  7476. width: 12,
  7477. gap: 2,
  7478. linearType: 'none',
  7479. customColor: [] },
  7480. opts.extra.arcbar);
  7481. series = getArcbarDataPoints(series, arcbarOption, process);
  7482. var centerPosition;
  7483. if (arcbarOption.centerX || arcbarOption.centerY) {
  7484. centerPosition = {
  7485. x: arcbarOption.centerX ? arcbarOption.centerX : opts.width / 2,
  7486. y: arcbarOption.centerY ? arcbarOption.centerY : opts.height / 2 };
  7487. } else {
  7488. centerPosition = {
  7489. x: opts.width / 2,
  7490. y: opts.height / 2 };
  7491. }
  7492. var radius;
  7493. if (arcbarOption.radius) {
  7494. radius = arcbarOption.radius;
  7495. } else {
  7496. radius = Math.min(centerPosition.x, centerPosition.y);
  7497. radius -= 5 * opts.pix;
  7498. radius -= arcbarOption.width / 2;
  7499. }
  7500. radius = radius < 10 ? 10 : radius;
  7501. arcbarOption.customColor = fillCustomColor(arcbarOption.linearType, arcbarOption.customColor, series, config);
  7502. for (var i = 0; i < series.length; i++) {
  7503. var eachSeries = series[i];
  7504. //背景颜色
  7505. context.setLineWidth(arcbarOption.width * opts.pix);
  7506. context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9');
  7507. context.setLineCap(arcbarOption.lineCap);
  7508. context.beginPath();
  7509. if (arcbarOption.type == 'default') {
  7510. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle * Math.PI, false);
  7511. } else {
  7512. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, 0, 2 * Math.PI, false);
  7513. }
  7514. context.stroke();
  7515. //进度条
  7516. var fillColor = eachSeries.color;
  7517. if (arcbarOption.linearType == 'custom') {
  7518. var grd = context.createLinearGradient(centerPosition.x - radius, centerPosition.y, centerPosition.x + radius, centerPosition.y);
  7519. grd.addColorStop(1, hexToRgb(arcbarOption.customColor[eachSeries.linearIndex], 1));
  7520. grd.addColorStop(0, hexToRgb(eachSeries.color, 1));
  7521. fillColor = grd;
  7522. }
  7523. context.setLineWidth(arcbarOption.width * opts.pix);
  7524. context.setStrokeStyle(fillColor);
  7525. context.setLineCap(arcbarOption.lineCap);
  7526. context.beginPath();
  7527. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ * Math.PI, false);
  7528. context.stroke();
  7529. }
  7530. drawRingTitle(opts, config, context, centerPosition);
  7531. return {
  7532. center: centerPosition,
  7533. radius: radius,
  7534. series: series };
  7535. }
  7536. function drawGaugeDataPoints(categories, series, opts, config, context) {
  7537. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  7538. var gaugeOption = assign({}, {
  7539. type: 'default',
  7540. startAngle: 0.75,
  7541. endAngle: 0.25,
  7542. width: 15,
  7543. labelOffset: 13,
  7544. splitLine: {
  7545. fixRadius: 0,
  7546. splitNumber: 10,
  7547. width: 15,
  7548. color: '#FFFFFF',
  7549. childNumber: 5,
  7550. childWidth: 5 },
  7551. pointer: {
  7552. width: 15,
  7553. color: 'auto' } },
  7554. opts.extra.gauge);
  7555. if (gaugeOption.oldAngle == undefined) {
  7556. gaugeOption.oldAngle = gaugeOption.startAngle;
  7557. }
  7558. if (gaugeOption.oldData == undefined) {
  7559. gaugeOption.oldData = 0;
  7560. }
  7561. categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle);
  7562. var centerPosition = {
  7563. x: opts.width / 2,
  7564. y: opts.height / 2 };
  7565. var radius = Math.min(centerPosition.x, centerPosition.y);
  7566. radius -= 5 * opts.pix;
  7567. radius -= gaugeOption.width / 2;
  7568. radius = radius < 10 ? 10 : radius;
  7569. var innerRadius = radius - gaugeOption.width;
  7570. var totalAngle = 0;
  7571. //判断仪表盘的样式:default百度样式,progress新样式
  7572. if (gaugeOption.type == 'progress') {
  7573. //## 第一步画中心圆形背景和进度条背景
  7574. //中心圆形背景
  7575. var pieRadius = radius - gaugeOption.width * 3;
  7576. context.beginPath();
  7577. var gradient = context.createLinearGradient(centerPosition.x, centerPosition.y - pieRadius, centerPosition.x, centerPosition.y + pieRadius);
  7578. //配置渐变填充(起点:中心点向上减半径;结束点中心点向下加半径)
  7579. gradient.addColorStop('0', hexToRgb(series[0].color, 0.3));
  7580. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  7581. context.setFillStyle(gradient);
  7582. context.arc(centerPosition.x, centerPosition.y, pieRadius, 0, 2 * Math.PI, false);
  7583. context.fill();
  7584. //画进度条背景
  7585. context.setLineWidth(gaugeOption.width);
  7586. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  7587. context.setLineCap('round');
  7588. context.beginPath();
  7589. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, gaugeOption.endAngle * Math.PI, false);
  7590. context.stroke();
  7591. //## 第二步画刻度线
  7592. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  7593. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  7594. var childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  7595. var startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  7596. var endX = -radius - gaugeOption.width - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  7597. context.save();
  7598. context.translate(centerPosition.x, centerPosition.y);
  7599. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  7600. var len = gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1;
  7601. var proc = series[0].data * process;
  7602. for (var i = 0; i < len; i++) {
  7603. context.beginPath();
  7604. //刻度线随进度变色
  7605. if (proc > i / len) {
  7606. context.setStrokeStyle(hexToRgb(series[0].color, 1));
  7607. } else {
  7608. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  7609. }
  7610. context.setLineWidth(3 * opts.pix);
  7611. context.moveTo(startX, 0);
  7612. context.lineTo(endX, 0);
  7613. context.stroke();
  7614. context.rotate(childAngle * Math.PI);
  7615. }
  7616. context.restore();
  7617. //## 第三步画进度条
  7618. series = getGaugeArcbarDataPoints(series, gaugeOption, process);
  7619. context.setLineWidth(gaugeOption.width);
  7620. context.setStrokeStyle(series[0].color);
  7621. context.setLineCap('round');
  7622. context.beginPath();
  7623. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, series[0]._proportion_ * Math.PI, false);
  7624. context.stroke();
  7625. //## 第四步画指针
  7626. var pointerRadius = radius - gaugeOption.width * 2.5;
  7627. context.save();
  7628. context.translate(centerPosition.x, centerPosition.y);
  7629. context.rotate((series[0]._proportion_ - 1) * Math.PI);
  7630. context.beginPath();
  7631. context.setLineWidth(gaugeOption.width / 3);
  7632. var gradient3 = context.createLinearGradient(0, -pointerRadius * 0.6, 0, pointerRadius * 0.6);
  7633. gradient3.addColorStop('0', hexToRgb('#FFFFFF', 0));
  7634. gradient3.addColorStop('0.5', hexToRgb(series[0].color, 1));
  7635. gradient3.addColorStop('1.0', hexToRgb('#FFFFFF', 0));
  7636. context.setStrokeStyle(gradient3);
  7637. context.arc(0, 0, pointerRadius, 0.85 * Math.PI, 1.15 * Math.PI, false);
  7638. context.stroke();
  7639. context.beginPath();
  7640. context.setLineWidth(1);
  7641. context.setStrokeStyle(series[0].color);
  7642. context.setFillStyle(series[0].color);
  7643. context.moveTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  7644. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2 - 4, 0);
  7645. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, 4);
  7646. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  7647. context.stroke();
  7648. context.fill();
  7649. context.restore();
  7650. //default百度样式
  7651. } else {
  7652. //画背景
  7653. context.setLineWidth(gaugeOption.width);
  7654. context.setLineCap('butt');
  7655. for (var _i26 = 0; _i26 < categories.length; _i26++) {
  7656. var eachCategories = categories[_i26];
  7657. context.beginPath();
  7658. context.setStrokeStyle(eachCategories.color);
  7659. context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ * Math.PI, false);
  7660. context.stroke();
  7661. }
  7662. context.save();
  7663. //画刻度线
  7664. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  7665. var _splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  7666. var _childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  7667. var _startX2 = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  7668. var _endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  7669. var childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.childWidth;
  7670. context.translate(centerPosition.x, centerPosition.y);
  7671. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  7672. for (var _i27 = 0; _i27 < gaugeOption.splitLine.splitNumber + 1; _i27++) {
  7673. context.beginPath();
  7674. context.setStrokeStyle(gaugeOption.splitLine.color);
  7675. context.setLineWidth(2 * opts.pix);
  7676. context.moveTo(_startX2, 0);
  7677. context.lineTo(_endX, 0);
  7678. context.stroke();
  7679. context.rotate(_splitAngle * Math.PI);
  7680. }
  7681. context.restore();
  7682. context.save();
  7683. context.translate(centerPosition.x, centerPosition.y);
  7684. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  7685. for (var _i28 = 0; _i28 < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; _i28++) {
  7686. context.beginPath();
  7687. context.setStrokeStyle(gaugeOption.splitLine.color);
  7688. context.setLineWidth(1 * opts.pix);
  7689. context.moveTo(_startX2, 0);
  7690. context.lineTo(childendX, 0);
  7691. context.stroke();
  7692. context.rotate(_childAngle * Math.PI);
  7693. }
  7694. context.restore();
  7695. //画指针
  7696. series = getGaugeDataPoints(series, categories, gaugeOption, process);
  7697. for (var _i29 = 0; _i29 < series.length; _i29++) {
  7698. var eachSeries = series[_i29];
  7699. context.save();
  7700. context.translate(centerPosition.x, centerPosition.y);
  7701. context.rotate((eachSeries._proportion_ - 1) * Math.PI);
  7702. context.beginPath();
  7703. context.setFillStyle(eachSeries.color);
  7704. context.moveTo(gaugeOption.pointer.width, 0);
  7705. context.lineTo(0, -gaugeOption.pointer.width / 2);
  7706. context.lineTo(-innerRadius, 0);
  7707. context.lineTo(0, gaugeOption.pointer.width / 2);
  7708. context.lineTo(gaugeOption.pointer.width, 0);
  7709. context.closePath();
  7710. context.fill();
  7711. context.beginPath();
  7712. context.setFillStyle('#FFFFFF');
  7713. context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false);
  7714. context.fill();
  7715. context.restore();
  7716. }
  7717. if (opts.dataLabel !== false) {
  7718. drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context);
  7719. }
  7720. }
  7721. //画仪表盘标题,副标题
  7722. drawRingTitle(opts, config, context, centerPosition);
  7723. if (process === 1 && opts.type === 'gauge') {
  7724. opts.extra.gauge.oldAngle = series[0]._proportion_;
  7725. opts.extra.gauge.oldData = series[0].data;
  7726. }
  7727. return {
  7728. center: centerPosition,
  7729. radius: radius,
  7730. innerRadius: innerRadius,
  7731. categories: categories,
  7732. totalAngle: totalAngle };
  7733. }
  7734. function drawRadarDataPoints(series, opts, config, context) {
  7735. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  7736. var radarOption = assign({}, {
  7737. gridColor: '#cccccc',
  7738. gridType: 'radar',
  7739. gridEval: 1,
  7740. axisLabel: false,
  7741. axisLabelTofix: 0,
  7742. labelColor: '#666666',
  7743. labelPointShow: false,
  7744. labelPointRadius: 3,
  7745. labelPointColor: '#cccccc',
  7746. opacity: 0.2,
  7747. gridCount: 3,
  7748. border: false,
  7749. borderWidth: 2,
  7750. linearType: 'none',
  7751. customColor: [] },
  7752. opts.extra.radar);
  7753. var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
  7754. var centerPosition = {
  7755. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  7756. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 };
  7757. var xr = (opts.width - opts.area[1] - opts.area[3]) / 2;
  7758. var yr = (opts.height - opts.area[0] - opts.area[2]) / 2;
  7759. var radius = Math.min(xr - (getMaxTextListLength(opts.categories, config.fontSize, context) + config.radarLabelTextMargin), yr - config.radarLabelTextMargin);
  7760. radius -= config.radarLabelTextMargin * opts.pix;
  7761. radius = radius < 10 ? 10 : radius;
  7762. // 画分割线
  7763. context.beginPath();
  7764. context.setLineWidth(1 * opts.pix);
  7765. context.setStrokeStyle(radarOption.gridColor);
  7766. coordinateAngle.forEach(function (angle, index) {
  7767. var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
  7768. context.moveTo(centerPosition.x, centerPosition.y);
  7769. if (index % radarOption.gridEval == 0) {
  7770. context.lineTo(pos.x, pos.y);
  7771. }
  7772. });
  7773. context.stroke();
  7774. context.closePath();
  7775. // 画背景网格
  7776. var _loop = function _loop(i) {
  7777. var startPos = {};
  7778. context.beginPath();
  7779. context.setLineWidth(1 * opts.pix);
  7780. context.setStrokeStyle(radarOption.gridColor);
  7781. if (radarOption.gridType == 'radar') {
  7782. coordinateAngle.forEach(function (angle, index) {
  7783. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(angle), radius /
  7784. radarOption.gridCount * i * Math.sin(angle), centerPosition);
  7785. if (index === 0) {
  7786. startPos = pos;
  7787. context.moveTo(pos.x, pos.y);
  7788. } else {
  7789. context.lineTo(pos.x, pos.y);
  7790. }
  7791. });
  7792. context.lineTo(startPos.x, startPos.y);
  7793. } else {
  7794. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(1.5), radius / radarOption.gridCount * i * Math.sin(1.5), centerPosition);
  7795. context.arc(centerPosition.x, centerPosition.y, centerPosition.y - pos.y, 0, 2 * Math.PI, false);
  7796. }
  7797. context.stroke();
  7798. context.closePath();
  7799. };
  7800. for (var i = 1; i <= radarOption.gridCount; i++) {
  7801. _loop(i);
  7802. }
  7803. radarOption.customColor = fillCustomColor(radarOption.linearType, radarOption.customColor, series, config);
  7804. var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
  7805. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  7806. // 绘制区域数据
  7807. context.beginPath();
  7808. context.setLineWidth(radarOption.borderWidth * opts.pix);
  7809. context.setStrokeStyle(eachSeries.color);
  7810. var fillcolor = hexToRgb(eachSeries.color, radarOption.opacity);
  7811. if (radarOption.linearType == 'custom') {
  7812. var grd;
  7813. if (context.createCircularGradient) {
  7814. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, radius);
  7815. } else {
  7816. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, radius);
  7817. }
  7818. grd.addColorStop(0, hexToRgb(radarOption.customColor[series[seriesIndex].linearIndex], radarOption.opacity));
  7819. grd.addColorStop(1, hexToRgb(eachSeries.color, radarOption.opacity));
  7820. fillcolor = grd;
  7821. }
  7822. context.setFillStyle(fillcolor);
  7823. eachSeries.data.forEach(function (item, index) {
  7824. if (index === 0) {
  7825. context.moveTo(item.position.x, item.position.y);
  7826. } else {
  7827. context.lineTo(item.position.x, item.position.y);
  7828. }
  7829. });
  7830. context.closePath();
  7831. context.fill();
  7832. if (radarOption.border === true) {
  7833. context.stroke();
  7834. }
  7835. context.closePath();
  7836. if (opts.dataPointShape !== false) {
  7837. var points = eachSeries.data.map(function (item) {
  7838. return item.position;
  7839. });
  7840. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  7841. }
  7842. });
  7843. // 画刻度值
  7844. if (radarOption.axisLabel === true) {
  7845. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  7846. var stepLength = radius / radarOption.gridCount;
  7847. var fontSize = opts.fontSize * opts.pix;
  7848. context.setFontSize(fontSize);
  7849. context.setFillStyle(opts.fontColor);
  7850. context.setTextAlign('left');
  7851. for (var i = 0; i < radarOption.gridCount + 1; i++) {
  7852. var label = i * maxData / radarOption.gridCount;
  7853. label = label.toFixed(radarOption.axisLabelTofix);
  7854. context.fillText(String(label), centerPosition.x + 3 * opts.pix, centerPosition.y - i * stepLength + fontSize / 2);
  7855. }
  7856. }
  7857. // draw label text
  7858. drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context);
  7859. // draw dataLabel
  7860. if (opts.dataLabel !== false && process === 1) {
  7861. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  7862. context.beginPath();
  7863. var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
  7864. context.setFontSize(fontSize);
  7865. context.setFillStyle(eachSeries.textColor || opts.fontColor);
  7866. eachSeries.data.forEach(function (item, index) {
  7867. //如果是中心点垂直的上下点位
  7868. if (Math.abs(item.position.x - centerPosition.x) < 2) {
  7869. //如果在上面
  7870. if (item.position.y < centerPosition.y) {
  7871. context.setTextAlign('center');
  7872. context.fillText(item.value, item.position.x, item.position.y - 4);
  7873. } else {
  7874. context.setTextAlign('center');
  7875. context.fillText(item.value, item.position.x, item.position.y + fontSize + 2);
  7876. }
  7877. } else {
  7878. //如果在左侧
  7879. if (item.position.x < centerPosition.x) {
  7880. context.setTextAlign('right');
  7881. context.fillText(item.value, item.position.x - 4, item.position.y + fontSize / 2 - 2);
  7882. } else {
  7883. context.setTextAlign('left');
  7884. context.fillText(item.value, item.position.x + 4, item.position.y + fontSize / 2 - 2);
  7885. }
  7886. }
  7887. });
  7888. context.closePath();
  7889. context.stroke();
  7890. });
  7891. context.setTextAlign('left');
  7892. }
  7893. return {
  7894. center: centerPosition,
  7895. radius: radius,
  7896. angleList: coordinateAngle };
  7897. }
  7898. // 经纬度转墨卡托
  7899. function lonlat2mercator(longitude, latitude) {
  7900. var mercator = Array(2);
  7901. var x = longitude * 20037508.34 / 180;
  7902. var y = Math.log(Math.tan((90 + latitude) * Math.PI / 360)) / (Math.PI / 180);
  7903. y = y * 20037508.34 / 180;
  7904. mercator[0] = x;
  7905. mercator[1] = y;
  7906. return mercator;
  7907. }
  7908. // 墨卡托转经纬度
  7909. function mercator2lonlat(longitude, latitude) {
  7910. var lonlat = Array(2);
  7911. var x = longitude / 20037508.34 * 180;
  7912. var y = latitude / 20037508.34 * 180;
  7913. y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2);
  7914. lonlat[0] = x;
  7915. lonlat[1] = y;
  7916. return lonlat;
  7917. }
  7918. function getBoundingBox(data) {
  7919. var bounds = {},coords;
  7920. bounds.xMin = 180;
  7921. bounds.xMax = 0;
  7922. bounds.yMin = 90;
  7923. bounds.yMax = 0;
  7924. for (var i = 0; i < data.length; i++) {
  7925. var coorda = data[i].geometry.coordinates;
  7926. for (var k = 0; k < coorda.length; k++) {
  7927. coords = coorda[k];
  7928. if (coords.length == 1) {
  7929. coords = coords[0];
  7930. }
  7931. for (var j = 0; j < coords.length; j++) {
  7932. var longitude = coords[j][0];
  7933. var latitude = coords[j][1];
  7934. var point = {
  7935. x: longitude,
  7936. y: latitude };
  7937. bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
  7938. bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
  7939. bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
  7940. bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
  7941. }
  7942. }
  7943. }
  7944. return bounds;
  7945. }
  7946. function coordinateToPoint(latitude, longitude, bounds, scale, xoffset, yoffset) {
  7947. return {
  7948. x: (longitude - bounds.xMin) * scale + xoffset,
  7949. y: (bounds.yMax - latitude) * scale + yoffset };
  7950. }
  7951. function pointToCoordinate(pointY, pointX, bounds, scale, xoffset, yoffset) {
  7952. return {
  7953. x: (pointX - xoffset) / scale + bounds.xMin,
  7954. y: bounds.yMax - (pointY - yoffset) / scale };
  7955. }
  7956. function isRayIntersectsSegment(poi, s_poi, e_poi) {
  7957. if (s_poi[1] == e_poi[1]) {
  7958. return false;
  7959. }
  7960. if (s_poi[1] > poi[1] && e_poi[1] > poi[1]) {
  7961. return false;
  7962. }
  7963. if (s_poi[1] < poi[1] && e_poi[1] < poi[1]) {
  7964. return false;
  7965. }
  7966. if (s_poi[1] == poi[1] && e_poi[1] > poi[1]) {
  7967. return false;
  7968. }
  7969. if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) {
  7970. return false;
  7971. }
  7972. if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) {
  7973. return false;
  7974. }
  7975. var xseg = e_poi[0] - (e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1]) / (e_poi[1] - s_poi[1]);
  7976. if (xseg < poi[0]) {
  7977. return false;
  7978. } else {
  7979. return true;
  7980. }
  7981. }
  7982. function isPoiWithinPoly(poi, poly, mercator) {
  7983. var sinsc = 0;
  7984. for (var i = 0; i < poly.length; i++) {
  7985. var epoly = poly[i][0];
  7986. if (poly.length == 1) {
  7987. epoly = poly[i][0];
  7988. }
  7989. for (var j = 0; j < epoly.length - 1; j++) {
  7990. var s_poi = epoly[j];
  7991. var e_poi = epoly[j + 1];
  7992. if (mercator) {
  7993. s_poi = lonlat2mercator(epoly[j][0], epoly[j][1]);
  7994. e_poi = lonlat2mercator(epoly[j + 1][0], epoly[j + 1][1]);
  7995. }
  7996. if (isRayIntersectsSegment(poi, s_poi, e_poi)) {
  7997. sinsc += 1;
  7998. }
  7999. }
  8000. }
  8001. if (sinsc % 2 == 1) {
  8002. return true;
  8003. } else {
  8004. return false;
  8005. }
  8006. }
  8007. function drawMapDataPoints(series, opts, config, context) {
  8008. var mapOption = assign({}, {
  8009. border: true,
  8010. mercator: false,
  8011. borderWidth: 1,
  8012. borderColor: '#666666',
  8013. fillOpacity: 0.6,
  8014. activeBorderColor: '#f04864',
  8015. activeFillColor: '#facc14',
  8016. activeFillOpacity: 1 },
  8017. opts.extra.map);
  8018. var coords, point;
  8019. var data = series;
  8020. var bounds = getBoundingBox(data);
  8021. if (mapOption.mercator) {
  8022. var max = lonlat2mercator(bounds.xMax, bounds.yMax);
  8023. var min = lonlat2mercator(bounds.xMin, bounds.yMin);
  8024. bounds.xMax = max[0];
  8025. bounds.yMax = max[1];
  8026. bounds.xMin = min[0];
  8027. bounds.yMin = min[1];
  8028. }
  8029. var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
  8030. var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
  8031. var scale = xScale < yScale ? xScale : yScale;
  8032. var xoffset = opts.width / 2 - Math.abs(bounds.xMax - bounds.xMin) / 2 * scale;
  8033. var yoffset = opts.height / 2 - Math.abs(bounds.yMax - bounds.yMin) / 2 * scale;
  8034. for (var i = 0; i < data.length; i++) {
  8035. context.beginPath();
  8036. context.setLineWidth(mapOption.borderWidth * opts.pix);
  8037. context.setStrokeStyle(mapOption.borderColor);
  8038. context.setFillStyle(hexToRgb(series[i].color, mapOption.fillOpacity));
  8039. if (opts.tooltip) {
  8040. if (opts.tooltip.index == i) {
  8041. context.setStrokeStyle(mapOption.activeBorderColor);
  8042. context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
  8043. }
  8044. }
  8045. var coorda = data[i].geometry.coordinates;
  8046. for (var k = 0; k < coorda.length; k++) {
  8047. coords = coorda[k];
  8048. if (coords.length == 1) {
  8049. coords = coords[0];
  8050. }
  8051. for (var j = 0; j < coords.length; j++) {
  8052. var gaosi = Array(2);
  8053. if (mapOption.mercator) {
  8054. gaosi = lonlat2mercator(coords[j][0], coords[j][1]);
  8055. } else {
  8056. gaosi = coords[j];
  8057. }
  8058. point = coordinateToPoint(gaosi[1], gaosi[0], bounds, scale, xoffset, yoffset);
  8059. if (j === 0) {
  8060. context.beginPath();
  8061. context.moveTo(point.x, point.y);
  8062. } else {
  8063. context.lineTo(point.x, point.y);
  8064. }
  8065. }
  8066. context.fill();
  8067. if (mapOption.border == true) {
  8068. context.stroke();
  8069. }
  8070. }
  8071. }
  8072. if (opts.dataLabel == true) {
  8073. for (var i = 0; i < data.length; i++) {
  8074. var centerPoint = data[i].properties.centroid;
  8075. if (centerPoint) {
  8076. if (mapOption.mercator) {
  8077. centerPoint = lonlat2mercator(data[i].properties.centroid[0], data[i].properties.centroid[1]);
  8078. }
  8079. point = coordinateToPoint(centerPoint[1], centerPoint[0], bounds, scale, xoffset, yoffset);
  8080. var fontSize = data[i].textSize * opts.pix || config.fontSize;
  8081. var text = data[i].properties.name;
  8082. context.beginPath();
  8083. context.setFontSize(fontSize);
  8084. context.setFillStyle(data[i].textColor || opts.fontColor);
  8085. context.fillText(text, point.x - measureText(text, fontSize, context) / 2, point.y + fontSize / 2);
  8086. context.closePath();
  8087. context.stroke();
  8088. }
  8089. }
  8090. }
  8091. opts.chartData.mapData = {
  8092. bounds: bounds,
  8093. scale: scale,
  8094. xoffset: xoffset,
  8095. yoffset: yoffset,
  8096. mercator: mapOption.mercator };
  8097. drawToolTipBridge(opts, config, context, 1);
  8098. context.draw();
  8099. }
  8100. function normalInt(min, max, iter) {
  8101. iter = iter == 0 ? 1 : iter;
  8102. var arr = [];
  8103. for (var i = 0; i < iter; i++) {
  8104. arr[i] = Math.random();
  8105. };
  8106. return Math.floor(arr.reduce(function (i, j) {
  8107. return i + j;
  8108. }) / iter * (max - min)) + min;
  8109. };
  8110. function collisionNew(area, points, width, height) {
  8111. var isIn = false;
  8112. for (var i = 0; i < points.length; i++) {
  8113. if (points[i].area) {
  8114. if (area[3] < points[i].area[1] || area[0] > points[i].area[2] || area[1] > points[i].area[3] || area[2] < points[i].area[0]) {
  8115. if (area[0] < 0 || area[1] < 0 || area[2] > width || area[3] > height) {
  8116. isIn = true;
  8117. break;
  8118. } else {
  8119. isIn = false;
  8120. }
  8121. } else {
  8122. isIn = true;
  8123. break;
  8124. }
  8125. }
  8126. }
  8127. return isIn;
  8128. };
  8129. function getWordCloudPoint(opts, type, context) {
  8130. var points = opts.series;
  8131. switch (type) {
  8132. case 'normal':
  8133. for (var i = 0; i < points.length; i++) {
  8134. var text = points[i].name;
  8135. var tHeight = points[i].textSize * opts.pix;
  8136. var tWidth = measureText(text, tHeight, context);
  8137. var x = void 0,y = void 0;
  8138. var area = void 0;
  8139. var breaknum = 0;
  8140. while (true) {
  8141. breaknum++;
  8142. x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2;
  8143. y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2;
  8144. area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / 2, y + 5 +
  8145. opts.height / 2];
  8146. var isCollision = collisionNew(area, points, opts.width, opts.height);
  8147. if (!isCollision) break;
  8148. if (breaknum == 1000) {
  8149. area = [-100, -100, -100, -100];
  8150. break;
  8151. }
  8152. };
  8153. points[i].area = area;
  8154. }
  8155. break;
  8156. case 'vertical':var
  8157. Spin = function Spin() {
  8158. //获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
  8159. if (Math.random() > 0.7) {
  8160. return true;
  8161. } else {
  8162. return false;
  8163. };
  8164. };;
  8165. for (var _i30 = 0; _i30 < points.length; _i30++) {
  8166. var _text = points[_i30].name;
  8167. var _tHeight = points[_i30].textSize * opts.pix;
  8168. var _tWidth = measureText(_text, _tHeight, context);
  8169. var isSpin = Spin();
  8170. var _x = void 0,_y = void 0,_area = void 0,areav = void 0;
  8171. var _breaknum = 0;
  8172. while (true) {
  8173. _breaknum++;
  8174. var _isCollision = void 0;
  8175. if (isSpin) {
  8176. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  8177. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  8178. _area = [_y - 5 - _tWidth + opts.width / 2, -_x - 5 + opts.height / 2, _y + 5 + opts.width / 2, -_x + _tHeight + 5 + opts.height / 2];
  8179. areav = [opts.width - (opts.width / 2 - opts.height / 2) - (-_x + _tHeight + 5 + opts.height / 2) - 5, opts.height / 2 - opts.width / 2 + (_y - 5 - _tWidth + opts.width / 2) - 5, opts.width - (opts.width / 2 - opts.height / 2) - (-_x + _tHeight + 5 + opts.height / 2) + _tHeight, opts.height / 2 - opts.width / 2 + (_y - 5 - _tWidth + opts.width / 2) + _tWidth + 5];
  8180. _isCollision = collisionNew(areav, points, opts.height, opts.width);
  8181. } else {
  8182. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  8183. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  8184. _area = [_x - 5 + opts.width / 2, _y - 5 - _tHeight + opts.height / 2, _x + _tWidth + 5 + opts.width / 2, _y + 5 + opts.height / 2];
  8185. _isCollision = collisionNew(_area, points, opts.width, opts.height);
  8186. }
  8187. if (!_isCollision) break;
  8188. if (_breaknum == 1000) {
  8189. _area = [-1000, -1000, -1000, -1000];
  8190. break;
  8191. }
  8192. };
  8193. if (isSpin) {
  8194. points[_i30].area = areav;
  8195. points[_i30].areav = _area;
  8196. } else {
  8197. points[_i30].area = _area;
  8198. }
  8199. points[_i30].rotate = isSpin;
  8200. };
  8201. break;}
  8202. return points;
  8203. }
  8204. function drawWordCloudDataPoints(series, opts, config, context) {
  8205. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  8206. var wordOption = assign({}, {
  8207. type: 'normal',
  8208. autoColors: true },
  8209. opts.extra.word);
  8210. if (!opts.chartData.wordCloudData) {
  8211. opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type, context);
  8212. }
  8213. context.beginPath();
  8214. context.setFillStyle(opts.background);
  8215. context.rect(0, 0, opts.width, opts.height);
  8216. context.fill();
  8217. context.save();
  8218. var points = opts.chartData.wordCloudData;
  8219. context.translate(opts.width / 2, opts.height / 2);
  8220. for (var i = 0; i < points.length; i++) {
  8221. context.save();
  8222. if (points[i].rotate) {
  8223. context.rotate(90 * Math.PI / 180);
  8224. }
  8225. var text = points[i].name;
  8226. var tHeight = points[i].textSize * opts.pix;
  8227. var tWidth = measureText(text, tHeight, context);
  8228. context.beginPath();
  8229. context.setStrokeStyle(points[i].color);
  8230. context.setFillStyle(points[i].color);
  8231. context.setFontSize(tHeight);
  8232. if (points[i].rotate) {
  8233. if (points[i].areav[0] > 0) {
  8234. if (opts.tooltip) {
  8235. if (opts.tooltip.index == i) {
  8236. context.strokeText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
  8237. } else {
  8238. context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
  8239. }
  8240. } else {
  8241. context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
  8242. }
  8243. }
  8244. } else {
  8245. if (points[i].area[0] > 0) {
  8246. if (opts.tooltip) {
  8247. if (opts.tooltip.index == i) {
  8248. context.strokeText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
  8249. } else {
  8250. context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
  8251. }
  8252. } else {
  8253. context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
  8254. }
  8255. }
  8256. }
  8257. context.stroke();
  8258. context.restore();
  8259. }
  8260. context.restore();
  8261. }
  8262. function drawFunnelDataPoints(series, opts, config, context) {
  8263. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  8264. var funnelOption = assign({}, {
  8265. type: 'funnel',
  8266. activeWidth: 10,
  8267. activeOpacity: 0.3,
  8268. border: false,
  8269. borderWidth: 2,
  8270. borderColor: '#FFFFFF',
  8271. fillOpacity: 1,
  8272. labelAlign: 'right',
  8273. linearType: 'none',
  8274. customColor: [] },
  8275. opts.extra.funnel);
  8276. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length;
  8277. var centerPosition = {
  8278. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  8279. y: opts.height - opts.area[2] };
  8280. var activeWidth = funnelOption.activeWidth * opts.pix;
  8281. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
  8282. series = getFunnelDataPoints(series, radius, funnelOption.type, eachSpacing, process);
  8283. context.save();
  8284. context.translate(centerPosition.x, centerPosition.y);
  8285. funnelOption.customColor = fillCustomColor(funnelOption.linearType, funnelOption.customColor, series, config);
  8286. if (funnelOption.type == 'pyramid') {
  8287. for (var i = 0; i < series.length; i++) {
  8288. if (i == series.length - 1) {
  8289. if (opts.tooltip) {
  8290. if (opts.tooltip.index == i) {
  8291. context.beginPath();
  8292. context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
  8293. context.moveTo(-activeWidth, -eachSpacing);
  8294. context.lineTo(-series[i].radius - activeWidth, 0);
  8295. context.lineTo(series[i].radius + activeWidth, 0);
  8296. context.lineTo(activeWidth, -eachSpacing);
  8297. context.lineTo(-activeWidth, -eachSpacing);
  8298. context.closePath();
  8299. context.fill();
  8300. }
  8301. }
  8302. series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + series[i].radius, centerPosition.y - eachSpacing * i];
  8303. context.beginPath();
  8304. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  8305. context.setStrokeStyle(funnelOption.borderColor);
  8306. var fillColor = hexToRgb(series[i].color, funnelOption.fillOpacity);
  8307. if (funnelOption.linearType == 'custom') {
  8308. var grd = context.createLinearGradient(series[i].radius, -eachSpacing, -series[i].radius, -eachSpacing);
  8309. grd.addColorStop(0, hexToRgb(series[i].color, funnelOption.fillOpacity));
  8310. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[series[i].linearIndex], funnelOption.fillOpacity));
  8311. grd.addColorStop(1, hexToRgb(series[i].color, funnelOption.fillOpacity));
  8312. fillColor = grd;
  8313. }
  8314. context.setFillStyle(fillColor);
  8315. context.moveTo(0, -eachSpacing);
  8316. context.lineTo(-series[i].radius, 0);
  8317. context.lineTo(series[i].radius, 0);
  8318. context.lineTo(0, -eachSpacing);
  8319. context.closePath();
  8320. context.fill();
  8321. if (funnelOption.border == true) {
  8322. context.stroke();
  8323. }
  8324. } else {
  8325. if (opts.tooltip) {
  8326. if (opts.tooltip.index == i) {
  8327. context.beginPath();
  8328. context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
  8329. context.moveTo(0, 0);
  8330. context.lineTo(-series[i].radius - activeWidth, 0);
  8331. context.lineTo(-series[i + 1].radius - activeWidth, -eachSpacing);
  8332. context.lineTo(series[i + 1].radius + activeWidth, -eachSpacing);
  8333. context.lineTo(series[i].radius + activeWidth, 0);
  8334. context.lineTo(0, 0);
  8335. context.closePath();
  8336. context.fill();
  8337. }
  8338. }
  8339. series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + series[i].radius, centerPosition.y - eachSpacing * i];
  8340. context.beginPath();
  8341. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  8342. context.setStrokeStyle(funnelOption.borderColor);
  8343. var fillColor = hexToRgb(series[i].color, funnelOption.fillOpacity);
  8344. if (funnelOption.linearType == 'custom') {
  8345. var grd = context.createLinearGradient(series[i].radius, -eachSpacing, -series[i].radius, -eachSpacing);
  8346. grd.addColorStop(0, hexToRgb(series[i].color, funnelOption.fillOpacity));
  8347. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[series[i].linearIndex], funnelOption.fillOpacity));
  8348. grd.addColorStop(1, hexToRgb(series[i].color, funnelOption.fillOpacity));
  8349. fillColor = grd;
  8350. }
  8351. context.setFillStyle(fillColor);
  8352. context.moveTo(0, 0);
  8353. context.lineTo(-series[i].radius, 0);
  8354. context.lineTo(-series[i + 1].radius, -eachSpacing);
  8355. context.lineTo(series[i + 1].radius, -eachSpacing);
  8356. context.lineTo(series[i].radius, 0);
  8357. context.lineTo(0, 0);
  8358. context.closePath();
  8359. context.fill();
  8360. if (funnelOption.border == true) {
  8361. context.stroke();
  8362. }
  8363. }
  8364. context.translate(0, -eachSpacing);
  8365. }
  8366. } else {
  8367. for (var _i31 = 0; _i31 < series.length; _i31++) {
  8368. if (_i31 == 0) {
  8369. if (opts.tooltip) {
  8370. if (opts.tooltip.index == _i31) {
  8371. context.beginPath();
  8372. context.setFillStyle(hexToRgb(series[_i31].color, funnelOption.activeOpacity));
  8373. context.moveTo(-activeWidth, 0);
  8374. context.lineTo(-series[_i31].radius - activeWidth, -eachSpacing);
  8375. context.lineTo(series[_i31].radius + activeWidth, -eachSpacing);
  8376. context.lineTo(activeWidth, 0);
  8377. context.lineTo(-activeWidth, 0);
  8378. context.closePath();
  8379. context.fill();
  8380. }
  8381. }
  8382. series[_i31].funnelArea = [centerPosition.x - series[_i31].radius, centerPosition.y - eachSpacing, centerPosition.x + series[_i31].radius, centerPosition.y];
  8383. context.beginPath();
  8384. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  8385. context.setStrokeStyle(funnelOption.borderColor);
  8386. var fillColor = hexToRgb(series[_i31].color, funnelOption.fillOpacity);
  8387. if (funnelOption.linearType == 'custom') {
  8388. var grd = context.createLinearGradient(series[_i31].radius, -eachSpacing, -series[_i31].radius, -eachSpacing);
  8389. grd.addColorStop(0, hexToRgb(series[_i31].color, funnelOption.fillOpacity));
  8390. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[series[_i31].linearIndex], funnelOption.fillOpacity));
  8391. grd.addColorStop(1, hexToRgb(series[_i31].color, funnelOption.fillOpacity));
  8392. fillColor = grd;
  8393. }
  8394. context.setFillStyle(fillColor);
  8395. context.moveTo(0, 0);
  8396. context.lineTo(-series[_i31].radius, -eachSpacing);
  8397. context.lineTo(series[_i31].radius, -eachSpacing);
  8398. context.lineTo(0, 0);
  8399. context.closePath();
  8400. context.fill();
  8401. if (funnelOption.border == true) {
  8402. context.stroke();
  8403. }
  8404. } else {
  8405. if (opts.tooltip) {
  8406. if (opts.tooltip.index == _i31) {
  8407. context.beginPath();
  8408. context.setFillStyle(hexToRgb(series[_i31].color, funnelOption.activeOpacity));
  8409. context.moveTo(0, 0);
  8410. context.lineTo(-series[_i31 - 1].radius - activeWidth, 0);
  8411. context.lineTo(-series[_i31].radius - activeWidth, -eachSpacing);
  8412. context.lineTo(series[_i31].radius + activeWidth, -eachSpacing);
  8413. context.lineTo(series[_i31 - 1].radius + activeWidth, 0);
  8414. context.lineTo(0, 0);
  8415. context.closePath();
  8416. context.fill();
  8417. }
  8418. }
  8419. series[_i31].funnelArea = [centerPosition.x - series[_i31].radius, centerPosition.y - eachSpacing * (_i31 + 1), centerPosition.x + series[_i31].radius, centerPosition.y - eachSpacing * _i31];
  8420. context.beginPath();
  8421. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  8422. context.setStrokeStyle(funnelOption.borderColor);
  8423. var fillColor = hexToRgb(series[_i31].color, funnelOption.fillOpacity);
  8424. if (funnelOption.linearType == 'custom') {
  8425. var grd = context.createLinearGradient(series[_i31].radius, -eachSpacing, -series[_i31].radius, -eachSpacing);
  8426. grd.addColorStop(0, hexToRgb(series[_i31].color, funnelOption.fillOpacity));
  8427. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[series[_i31].linearIndex], funnelOption.fillOpacity));
  8428. grd.addColorStop(1, hexToRgb(series[_i31].color, funnelOption.fillOpacity));
  8429. fillColor = grd;
  8430. }
  8431. context.setFillStyle(fillColor);
  8432. context.moveTo(0, 0);
  8433. context.lineTo(-series[_i31 - 1].radius, 0);
  8434. context.lineTo(-series[_i31].radius, -eachSpacing);
  8435. context.lineTo(series[_i31].radius, -eachSpacing);
  8436. context.lineTo(series[_i31 - 1].radius, 0);
  8437. context.lineTo(0, 0);
  8438. context.closePath();
  8439. context.fill();
  8440. if (funnelOption.border == true) {
  8441. context.stroke();
  8442. }
  8443. }
  8444. context.translate(0, -eachSpacing);
  8445. }
  8446. }
  8447. context.restore();
  8448. if (opts.dataLabel !== false && process === 1) {
  8449. drawFunnelText(series, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  8450. }
  8451. return {
  8452. center: centerPosition,
  8453. radius: radius,
  8454. series: series };
  8455. }
  8456. function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  8457. for (var i = 0; i < series.length; i++) {
  8458. var item = series[i];
  8459. if (item.labelShow === false) {
  8460. continue;
  8461. }
  8462. var startX = void 0,endX = void 0,startY = void 0,fontSize = void 0;
  8463. var text = item.formatter ? item.formatter(item, i, series, opts) : util.toFixed(item._proportion_ * 100) + '%';
  8464. text = item.labelText ? item.labelText : text;
  8465. if (labelAlign == 'right') {
  8466. if (opts.extra.funnel.type === 'pyramid') {
  8467. if (i == series.length - 1) {
  8468. startX = (item.funnelArea[2] + centerPosition.x) / 2;
  8469. } else {
  8470. startX = (item.funnelArea[2] + series[i + 1].funnelArea[2]) / 2;
  8471. }
  8472. } else {
  8473. if (i == 0) {
  8474. startX = (item.funnelArea[2] + centerPosition.x) / 2;
  8475. } else {
  8476. startX = (item.funnelArea[2] + series[i - 1].funnelArea[2]) / 2;
  8477. }
  8478. }
  8479. endX = startX + activeWidth * 2;
  8480. startY = item.funnelArea[1] + eachSpacing / 2;
  8481. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  8482. context.setLineWidth(1 * opts.pix);
  8483. context.setStrokeStyle(item.color);
  8484. context.setFillStyle(item.color);
  8485. context.beginPath();
  8486. context.moveTo(startX, startY);
  8487. context.lineTo(endX, startY);
  8488. context.stroke();
  8489. context.closePath();
  8490. context.beginPath();
  8491. context.moveTo(endX, startY);
  8492. context.arc(endX, startY, 2 * opts.pix, 0, 2 * Math.PI);
  8493. context.closePath();
  8494. context.fill();
  8495. context.beginPath();
  8496. context.setFontSize(fontSize);
  8497. context.setFillStyle(item.textColor || opts.fontColor);
  8498. context.fillText(text, endX + 5, startY + fontSize / 2 - 2);
  8499. context.closePath();
  8500. context.stroke();
  8501. context.closePath();
  8502. } else {
  8503. if (opts.extra.funnel.type === 'pyramid') {
  8504. if (i == series.length - 1) {
  8505. startX = (item.funnelArea[0] + centerPosition.x) / 2;
  8506. } else {
  8507. startX = (item.funnelArea[0] + series[i + 1].funnelArea[0]) / 2;
  8508. }
  8509. } else {
  8510. if (i == 0) {
  8511. startX = (item.funnelArea[0] + centerPosition.x) / 2;
  8512. } else {
  8513. startX = (item.funnelArea[0] + series[i - 1].funnelArea[0]) / 2;
  8514. }
  8515. }
  8516. endX = startX - activeWidth * 2;
  8517. startY = item.funnelArea[1] + eachSpacing / 2;
  8518. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  8519. context.setLineWidth(1 * opts.pix);
  8520. context.setStrokeStyle(item.color);
  8521. context.setFillStyle(item.color);
  8522. context.beginPath();
  8523. context.moveTo(startX, startY);
  8524. context.lineTo(endX, startY);
  8525. context.stroke();
  8526. context.closePath();
  8527. context.beginPath();
  8528. context.moveTo(endX, startY);
  8529. context.arc(endX, startY, 2, 0, 2 * Math.PI);
  8530. context.closePath();
  8531. context.fill();
  8532. context.beginPath();
  8533. context.setFontSize(fontSize);
  8534. context.setFillStyle(item.textColor || opts.fontColor);
  8535. context.fillText(text, endX - 5 - measureText(text, fontSize, context), startY + fontSize / 2 - 2);
  8536. context.closePath();
  8537. context.stroke();
  8538. context.closePath();
  8539. }
  8540. }
  8541. }
  8542. function drawCanvas(opts, context) {
  8543. context.draw();
  8544. }
  8545. var Timing = {
  8546. easeIn: function easeIn(pos) {
  8547. return Math.pow(pos, 3);
  8548. },
  8549. easeOut: function easeOut(pos) {
  8550. return Math.pow(pos - 1, 3) + 1;
  8551. },
  8552. easeInOut: function easeInOut(pos) {
  8553. if ((pos /= 0.5) < 1) {
  8554. return 0.5 * Math.pow(pos, 3);
  8555. } else {
  8556. return 0.5 * (Math.pow(pos - 2, 3) + 2);
  8557. }
  8558. },
  8559. linear: function linear(pos) {
  8560. return pos;
  8561. } };
  8562. function Animation(opts) {
  8563. this.isStop = false;
  8564. opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
  8565. opts.timing = opts.timing || 'easeInOut';
  8566. var delay = 17;
  8567. function createAnimationFrame() {
  8568. if (typeof setTimeout !== 'undefined') {
  8569. return function (step, delay) {
  8570. setTimeout(function () {
  8571. var timeStamp = +new Date();
  8572. step(timeStamp);
  8573. }, delay);
  8574. };
  8575. } else if (typeof requestAnimationFrame !== 'undefined') {
  8576. return requestAnimationFrame;
  8577. } else {
  8578. return function (step) {
  8579. step(null);
  8580. };
  8581. }
  8582. };
  8583. var animationFrame = createAnimationFrame();
  8584. var startTimeStamp = null;
  8585. var _step = function step(timestamp) {
  8586. if (timestamp === null || this.isStop === true) {
  8587. opts.onProcess && opts.onProcess(1);
  8588. opts.onAnimationFinish && opts.onAnimationFinish();
  8589. return;
  8590. }
  8591. if (startTimeStamp === null) {
  8592. startTimeStamp = timestamp;
  8593. }
  8594. if (timestamp - startTimeStamp < opts.duration) {
  8595. var process = (timestamp - startTimeStamp) / opts.duration;
  8596. var timingFunction = Timing[opts.timing];
  8597. process = timingFunction(process);
  8598. opts.onProcess && opts.onProcess(process);
  8599. animationFrame(_step, delay);
  8600. } else {
  8601. opts.onProcess && opts.onProcess(1);
  8602. opts.onAnimationFinish && opts.onAnimationFinish();
  8603. }
  8604. };
  8605. _step = _step.bind(this);
  8606. animationFrame(_step, delay);
  8607. }
  8608. Animation.prototype.stop = function () {
  8609. this.isStop = true;
  8610. };
  8611. function drawCharts(type, opts, config, context) {
  8612. var _this = this;
  8613. var series = opts.series;
  8614. //兼容ECharts饼图类数据格式
  8615. if (type === 'pie' || type === 'ring' || type === 'mount' || type === 'rose' || type === 'funnel') {
  8616. series = fixPieSeries(series, opts, config);
  8617. }
  8618. var categories = opts.categories;
  8619. if (type === 'mount') {
  8620. categories = [];
  8621. for (var j = 0; j < series.length; j++) {
  8622. if (series[j].show !== false) categories.push(series[j].name);
  8623. }
  8624. opts.categories = categories;
  8625. }
  8626. series = fillSeries(series, opts, config);
  8627. var duration = opts.animation ? opts.duration : 0;
  8628. _this.animationInstance && _this.animationInstance.stop();
  8629. var seriesMA = null;
  8630. if (type == 'candle') {
  8631. var average = assign({}, opts.extra.candle.average);
  8632. if (average.show) {
  8633. seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data);
  8634. seriesMA = fillSeries(seriesMA, opts, config);
  8635. opts.seriesMA = seriesMA;
  8636. } else if (opts.seriesMA) {
  8637. seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config);
  8638. } else {
  8639. seriesMA = series;
  8640. }
  8641. } else {
  8642. seriesMA = series;
  8643. }
  8644. /* 过滤掉show=false的series */
  8645. opts._series_ = series = filterSeries(series);
  8646. //重新计算图表区域
  8647. opts.area = new Array(4);
  8648. //复位绘图区域
  8649. for (var _j11 = 0; _j11 < 4; _j11++) {
  8650. opts.area[_j11] = opts.padding[_j11] * opts.pix;
  8651. }
  8652. //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域
  8653. var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData, context),
  8654. legendHeight = _calLegendData.area.wholeHeight,
  8655. legendWidth = _calLegendData.area.wholeWidth;
  8656. switch (opts.legend.position) {
  8657. case 'top':
  8658. opts.area[0] += legendHeight;
  8659. break;
  8660. case 'bottom':
  8661. opts.area[2] += legendHeight;
  8662. break;
  8663. case 'left':
  8664. opts.area[3] += legendWidth;
  8665. break;
  8666. case 'right':
  8667. opts.area[1] += legendWidth;
  8668. break;}
  8669. var _calYAxisData = {},
  8670. yAxisWidth = 0;
  8671. if (opts.type === 'line' || opts.type === 'column' || opts.type === 'mount' || opts.type === 'area' || opts.type === 'mix' || opts.type === 'candle' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
  8672. _calYAxisData = calYAxisData(series, opts, config, context);
  8673. yAxisWidth = _calYAxisData.yAxisWidth;
  8674. //如果显示Y轴标题
  8675. if (opts.yAxis.showTitle) {
  8676. var maxTitleHeight = 0;
  8677. for (var i = 0; i < opts.yAxis.data.length; i++) {
  8678. maxTitleHeight = Math.max(maxTitleHeight, opts.yAxis.data[i].titleFontSize ? opts.yAxis.data[i].titleFontSize * opts.pix : config.fontSize);
  8679. }
  8680. opts.area[0] += maxTitleHeight;
  8681. }
  8682. var rightIndex = 0,
  8683. leftIndex = 0;
  8684. //计算主绘图区域左右位置
  8685. for (var _i32 = 0; _i32 < yAxisWidth.length; _i32++) {
  8686. if (yAxisWidth[_i32].position == 'left') {
  8687. if (leftIndex > 0) {
  8688. opts.area[3] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  8689. } else {
  8690. opts.area[3] += yAxisWidth[_i32].width;
  8691. }
  8692. leftIndex += 1;
  8693. } else if (yAxisWidth[_i32].position == 'right') {
  8694. if (rightIndex > 0) {
  8695. opts.area[1] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  8696. } else {
  8697. opts.area[1] += yAxisWidth[_i32].width;
  8698. }
  8699. rightIndex += 1;
  8700. }
  8701. }
  8702. } else {
  8703. config.yAxisWidth = yAxisWidth;
  8704. }
  8705. opts.chartData.yAxisData = _calYAxisData;
  8706. if (opts.categories && opts.categories.length && opts.type !== 'radar' && opts.type !== 'gauge' && opts.type !== 'bar') {
  8707. opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config);
  8708. var _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  8709. xAxisHeight = _calCategoriesData.xAxisHeight,
  8710. angle = _calCategoriesData.angle;
  8711. config.xAxisHeight = xAxisHeight;
  8712. config._xAxisTextAngle_ = angle;
  8713. opts.area[2] += xAxisHeight;
  8714. opts.chartData.categoriesData = _calCategoriesData;
  8715. } else {
  8716. if (opts.type === 'line' || opts.type === 'area' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
  8717. opts.chartData.xAxisData = calXAxisData(series, opts, config, context);
  8718. categories = opts.chartData.xAxisData.rangesFormat;
  8719. var _calCategoriesData2 = calCategoriesData(categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  8720. _xAxisHeight = _calCategoriesData2.xAxisHeight,
  8721. _angle = _calCategoriesData2.angle;
  8722. config.xAxisHeight = _xAxisHeight;
  8723. config._xAxisTextAngle_ = _angle;
  8724. opts.area[2] += _xAxisHeight;
  8725. opts.chartData.categoriesData = _calCategoriesData2;
  8726. } else {
  8727. opts.chartData.xAxisData = {
  8728. xAxisPoints: [] };
  8729. }
  8730. }
  8731. //计算右对齐偏移距离
  8732. if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) {
  8733. var offsetLeft = 0,
  8734. xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  8735. startX = opts.chartData.xAxisData.startX,
  8736. endX = opts.chartData.xAxisData.endX,
  8737. eachSpacing = opts.chartData.xAxisData.eachSpacing;
  8738. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  8739. var screenWidth = endX - startX;
  8740. offsetLeft = screenWidth - totalWidth;
  8741. _this.scrollOption.currentOffset = offsetLeft;
  8742. _this.scrollOption.startTouchX = offsetLeft;
  8743. _this.scrollOption.distance = 0;
  8744. _this.scrollOption.lastMoveTime = 0;
  8745. opts._scrollDistance_ = offsetLeft;
  8746. }
  8747. if (type === 'pie' || type === 'ring' || type === 'rose') {
  8748. config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA, config, context, opts);
  8749. }
  8750. switch (type) {
  8751. case 'word':
  8752. this.animationInstance = new Animation({
  8753. timing: opts.timing,
  8754. duration: duration,
  8755. onProcess: function onProcess(process) {
  8756. context.clearRect(0, 0, opts.width, opts.height);
  8757. if (opts.rotate) {
  8758. contextRotate(context, opts);
  8759. }
  8760. drawWordCloudDataPoints(series, opts, config, context, process);
  8761. drawCanvas(opts, context);
  8762. },
  8763. onAnimationFinish: function onAnimationFinish() {
  8764. _this.uevent.trigger('renderComplete');
  8765. } });
  8766. break;
  8767. case 'map':
  8768. context.clearRect(0, 0, opts.width, opts.height);
  8769. drawMapDataPoints(series, opts, config, context);
  8770. break;
  8771. case 'funnel':
  8772. this.animationInstance = new Animation({
  8773. timing: opts.timing,
  8774. duration: duration,
  8775. onProcess: function onProcess(process) {
  8776. context.clearRect(0, 0, opts.width, opts.height);
  8777. if (opts.rotate) {
  8778. contextRotate(context, opts);
  8779. }
  8780. opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, process);
  8781. drawLegend(opts.series, opts, config, context, opts.chartData);
  8782. drawToolTipBridge(opts, config, context, process);
  8783. drawCanvas(opts, context);
  8784. },
  8785. onAnimationFinish: function onAnimationFinish() {
  8786. _this.uevent.trigger('renderComplete');
  8787. } });
  8788. break;
  8789. case 'line':
  8790. this.animationInstance = new Animation({
  8791. timing: opts.timing,
  8792. duration: duration,
  8793. onProcess: function onProcess(process) {
  8794. context.clearRect(0, 0, opts.width, opts.height);
  8795. if (opts.rotate) {
  8796. contextRotate(context, opts);
  8797. }
  8798. drawYAxisGrid(categories, opts, config, context);
  8799. drawXAxis(categories, opts, config, context);
  8800. var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process),
  8801. xAxisPoints = _drawLineDataPoints.xAxisPoints,
  8802. calPoints = _drawLineDataPoints.calPoints,
  8803. eachSpacing = _drawLineDataPoints.eachSpacing;
  8804. opts.chartData.xAxisPoints = xAxisPoints;
  8805. opts.chartData.calPoints = calPoints;
  8806. opts.chartData.eachSpacing = eachSpacing;
  8807. drawYAxis(series, opts, config, context);
  8808. if (opts.enableMarkLine !== false && process === 1) {
  8809. drawMarkLine(opts, config, context);
  8810. }
  8811. drawLegend(opts.series, opts, config, context, opts.chartData);
  8812. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  8813. drawCanvas(opts, context);
  8814. },
  8815. onAnimationFinish: function onAnimationFinish() {
  8816. _this.uevent.trigger('renderComplete');
  8817. } });
  8818. break;
  8819. case 'scatter':
  8820. this.animationInstance = new Animation({
  8821. timing: opts.timing,
  8822. duration: duration,
  8823. onProcess: function onProcess(process) {
  8824. context.clearRect(0, 0, opts.width, opts.height);
  8825. if (opts.rotate) {
  8826. contextRotate(context, opts);
  8827. }
  8828. drawYAxisGrid(categories, opts, config, context);
  8829. drawXAxis(categories, opts, config, context);
  8830. var _drawScatterDataPoints = drawScatterDataPoints(series, opts, config, context, process),
  8831. xAxisPoints = _drawScatterDataPoints.xAxisPoints,
  8832. calPoints = _drawScatterDataPoints.calPoints,
  8833. eachSpacing = _drawScatterDataPoints.eachSpacing;
  8834. opts.chartData.xAxisPoints = xAxisPoints;
  8835. opts.chartData.calPoints = calPoints;
  8836. opts.chartData.eachSpacing = eachSpacing;
  8837. drawYAxis(series, opts, config, context);
  8838. if (opts.enableMarkLine !== false && process === 1) {
  8839. drawMarkLine(opts, config, context);
  8840. }
  8841. drawLegend(opts.series, opts, config, context, opts.chartData);
  8842. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  8843. drawCanvas(opts, context);
  8844. },
  8845. onAnimationFinish: function onAnimationFinish() {
  8846. _this.uevent.trigger('renderComplete');
  8847. } });
  8848. break;
  8849. case 'bubble':
  8850. this.animationInstance = new Animation({
  8851. timing: opts.timing,
  8852. duration: duration,
  8853. onProcess: function onProcess(process) {
  8854. context.clearRect(0, 0, opts.width, opts.height);
  8855. if (opts.rotate) {
  8856. contextRotate(context, opts);
  8857. }
  8858. drawYAxisGrid(categories, opts, config, context);
  8859. drawXAxis(categories, opts, config, context);
  8860. var _drawBubbleDataPoints = drawBubbleDataPoints(series, opts, config, context, process),
  8861. xAxisPoints = _drawBubbleDataPoints.xAxisPoints,
  8862. calPoints = _drawBubbleDataPoints.calPoints,
  8863. eachSpacing = _drawBubbleDataPoints.eachSpacing;
  8864. opts.chartData.xAxisPoints = xAxisPoints;
  8865. opts.chartData.calPoints = calPoints;
  8866. opts.chartData.eachSpacing = eachSpacing;
  8867. drawYAxis(series, opts, config, context);
  8868. if (opts.enableMarkLine !== false && process === 1) {
  8869. drawMarkLine(opts, config, context);
  8870. }
  8871. drawLegend(opts.series, opts, config, context, opts.chartData);
  8872. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  8873. drawCanvas(opts, context);
  8874. },
  8875. onAnimationFinish: function onAnimationFinish() {
  8876. _this.uevent.trigger('renderComplete');
  8877. } });
  8878. break;
  8879. case 'mix':
  8880. this.animationInstance = new Animation({
  8881. timing: opts.timing,
  8882. duration: duration,
  8883. onProcess: function onProcess(process) {
  8884. context.clearRect(0, 0, opts.width, opts.height);
  8885. if (opts.rotate) {
  8886. contextRotate(context, opts);
  8887. }
  8888. drawYAxisGrid(categories, opts, config, context);
  8889. drawXAxis(categories, opts, config, context);
  8890. var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process),
  8891. xAxisPoints = _drawMixDataPoints.xAxisPoints,
  8892. calPoints = _drawMixDataPoints.calPoints,
  8893. eachSpacing = _drawMixDataPoints.eachSpacing;
  8894. opts.chartData.xAxisPoints = xAxisPoints;
  8895. opts.chartData.calPoints = calPoints;
  8896. opts.chartData.eachSpacing = eachSpacing;
  8897. drawYAxis(series, opts, config, context);
  8898. if (opts.enableMarkLine !== false && process === 1) {
  8899. drawMarkLine(opts, config, context);
  8900. }
  8901. drawLegend(opts.series, opts, config, context, opts.chartData);
  8902. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  8903. drawCanvas(opts, context);
  8904. },
  8905. onAnimationFinish: function onAnimationFinish() {
  8906. _this.uevent.trigger('renderComplete');
  8907. } });
  8908. break;
  8909. case 'column':
  8910. this.animationInstance = new Animation({
  8911. timing: opts.timing,
  8912. duration: duration,
  8913. onProcess: function onProcess(process) {
  8914. context.clearRect(0, 0, opts.width, opts.height);
  8915. if (opts.rotate) {
  8916. contextRotate(context, opts);
  8917. }
  8918. drawYAxisGrid(categories, opts, config, context);
  8919. drawXAxis(categories, opts, config, context);
  8920. var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process),
  8921. xAxisPoints = _drawColumnDataPoints.xAxisPoints,
  8922. calPoints = _drawColumnDataPoints.calPoints,
  8923. eachSpacing = _drawColumnDataPoints.eachSpacing;
  8924. opts.chartData.xAxisPoints = xAxisPoints;
  8925. opts.chartData.calPoints = calPoints;
  8926. opts.chartData.eachSpacing = eachSpacing;
  8927. drawYAxis(series, opts, config, context);
  8928. if (opts.enableMarkLine !== false && process === 1) {
  8929. drawMarkLine(opts, config, context);
  8930. }
  8931. drawLegend(opts.series, opts, config, context, opts.chartData);
  8932. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  8933. drawCanvas(opts, context);
  8934. },
  8935. onAnimationFinish: function onAnimationFinish() {
  8936. _this.uevent.trigger('renderComplete');
  8937. } });
  8938. break;
  8939. case 'mount':
  8940. this.animationInstance = new Animation({
  8941. timing: opts.timing,
  8942. duration: duration,
  8943. onProcess: function onProcess(process) {
  8944. context.clearRect(0, 0, opts.width, opts.height);
  8945. if (opts.rotate) {
  8946. contextRotate(context, opts);
  8947. }
  8948. drawYAxisGrid(categories, opts, config, context);
  8949. drawXAxis(categories, opts, config, context);
  8950. var _drawMountDataPoints = drawMountDataPoints(series, opts, config, context, process),
  8951. xAxisPoints = _drawMountDataPoints.xAxisPoints,
  8952. calPoints = _drawMountDataPoints.calPoints,
  8953. eachSpacing = _drawMountDataPoints.eachSpacing;
  8954. opts.chartData.xAxisPoints = xAxisPoints;
  8955. opts.chartData.calPoints = calPoints;
  8956. opts.chartData.eachSpacing = eachSpacing;
  8957. drawYAxis(series, opts, config, context);
  8958. if (opts.enableMarkLine !== false && process === 1) {
  8959. drawMarkLine(opts, config, context);
  8960. }
  8961. drawLegend(opts.series, opts, config, context, opts.chartData);
  8962. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  8963. drawCanvas(opts, context);
  8964. },
  8965. onAnimationFinish: function onAnimationFinish() {
  8966. _this.uevent.trigger('renderComplete');
  8967. } });
  8968. break;
  8969. case 'bar':
  8970. this.animationInstance = new Animation({
  8971. timing: opts.timing,
  8972. duration: duration,
  8973. onProcess: function onProcess(process) {
  8974. context.clearRect(0, 0, opts.width, opts.height);
  8975. if (opts.rotate) {
  8976. contextRotate(context, opts);
  8977. }
  8978. drawXAxis(categories, opts, config, context);
  8979. var _drawBarDataPoints = drawBarDataPoints(series, opts, config, context, process),
  8980. yAxisPoints = _drawBarDataPoints.yAxisPoints,
  8981. calPoints = _drawBarDataPoints.calPoints,
  8982. eachSpacing = _drawBarDataPoints.eachSpacing;
  8983. opts.chartData.yAxisPoints = yAxisPoints;
  8984. opts.chartData.xAxisPoints = opts.chartData.xAxisData.xAxisPoints;
  8985. opts.chartData.calPoints = calPoints;
  8986. opts.chartData.eachSpacing = eachSpacing;
  8987. drawYAxis(series, opts, config, context);
  8988. if (opts.enableMarkLine !== false && process === 1) {
  8989. drawMarkLine(opts, config, context);
  8990. }
  8991. drawLegend(opts.series, opts, config, context, opts.chartData);
  8992. drawToolTipBridge(opts, config, context, process, eachSpacing, yAxisPoints);
  8993. drawCanvas(opts, context);
  8994. },
  8995. onAnimationFinish: function onAnimationFinish() {
  8996. _this.uevent.trigger('renderComplete');
  8997. } });
  8998. break;
  8999. case 'area':
  9000. this.animationInstance = new Animation({
  9001. timing: opts.timing,
  9002. duration: duration,
  9003. onProcess: function onProcess(process) {
  9004. context.clearRect(0, 0, opts.width, opts.height);
  9005. if (opts.rotate) {
  9006. contextRotate(context, opts);
  9007. }
  9008. drawYAxisGrid(categories, opts, config, context);
  9009. drawXAxis(categories, opts, config, context);
  9010. var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process),
  9011. xAxisPoints = _drawAreaDataPoints.xAxisPoints,
  9012. calPoints = _drawAreaDataPoints.calPoints,
  9013. eachSpacing = _drawAreaDataPoints.eachSpacing;
  9014. opts.chartData.xAxisPoints = xAxisPoints;
  9015. opts.chartData.calPoints = calPoints;
  9016. opts.chartData.eachSpacing = eachSpacing;
  9017. drawYAxis(series, opts, config, context);
  9018. if (opts.enableMarkLine !== false && process === 1) {
  9019. drawMarkLine(opts, config, context);
  9020. }
  9021. drawLegend(opts.series, opts, config, context, opts.chartData);
  9022. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  9023. drawCanvas(opts, context);
  9024. },
  9025. onAnimationFinish: function onAnimationFinish() {
  9026. _this.uevent.trigger('renderComplete');
  9027. } });
  9028. break;
  9029. case 'ring':
  9030. this.animationInstance = new Animation({
  9031. timing: opts.timing,
  9032. duration: duration,
  9033. onProcess: function onProcess(process) {
  9034. context.clearRect(0, 0, opts.width, opts.height);
  9035. if (opts.rotate) {
  9036. contextRotate(context, opts);
  9037. }
  9038. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  9039. drawLegend(opts.series, opts, config, context, opts.chartData);
  9040. drawToolTipBridge(opts, config, context, process);
  9041. drawCanvas(opts, context);
  9042. },
  9043. onAnimationFinish: function onAnimationFinish() {
  9044. _this.uevent.trigger('renderComplete');
  9045. } });
  9046. break;
  9047. case 'pie':
  9048. this.animationInstance = new Animation({
  9049. timing: opts.timing,
  9050. duration: duration,
  9051. onProcess: function onProcess(process) {
  9052. context.clearRect(0, 0, opts.width, opts.height);
  9053. if (opts.rotate) {
  9054. contextRotate(context, opts);
  9055. }
  9056. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  9057. drawLegend(opts.series, opts, config, context, opts.chartData);
  9058. drawToolTipBridge(opts, config, context, process);
  9059. drawCanvas(opts, context);
  9060. },
  9061. onAnimationFinish: function onAnimationFinish() {
  9062. _this.uevent.trigger('renderComplete');
  9063. } });
  9064. break;
  9065. case 'rose':
  9066. this.animationInstance = new Animation({
  9067. timing: opts.timing,
  9068. duration: duration,
  9069. onProcess: function onProcess(process) {
  9070. context.clearRect(0, 0, opts.width, opts.height);
  9071. if (opts.rotate) {
  9072. contextRotate(context, opts);
  9073. }
  9074. opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process);
  9075. drawLegend(opts.series, opts, config, context, opts.chartData);
  9076. drawToolTipBridge(opts, config, context, process);
  9077. drawCanvas(opts, context);
  9078. },
  9079. onAnimationFinish: function onAnimationFinish() {
  9080. _this.uevent.trigger('renderComplete');
  9081. } });
  9082. break;
  9083. case 'radar':
  9084. this.animationInstance = new Animation({
  9085. timing: opts.timing,
  9086. duration: duration,
  9087. onProcess: function onProcess(process) {
  9088. context.clearRect(0, 0, opts.width, opts.height);
  9089. if (opts.rotate) {
  9090. contextRotate(context, opts);
  9091. }
  9092. opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process);
  9093. drawLegend(opts.series, opts, config, context, opts.chartData);
  9094. drawToolTipBridge(opts, config, context, process);
  9095. drawCanvas(opts, context);
  9096. },
  9097. onAnimationFinish: function onAnimationFinish() {
  9098. _this.uevent.trigger('renderComplete');
  9099. } });
  9100. break;
  9101. case 'arcbar':
  9102. this.animationInstance = new Animation({
  9103. timing: opts.timing,
  9104. duration: duration,
  9105. onProcess: function onProcess(process) {
  9106. context.clearRect(0, 0, opts.width, opts.height);
  9107. if (opts.rotate) {
  9108. contextRotate(context, opts);
  9109. }
  9110. opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, process);
  9111. drawCanvas(opts, context);
  9112. },
  9113. onAnimationFinish: function onAnimationFinish() {
  9114. _this.uevent.trigger('renderComplete');
  9115. } });
  9116. break;
  9117. case 'gauge':
  9118. this.animationInstance = new Animation({
  9119. timing: opts.timing,
  9120. duration: duration,
  9121. onProcess: function onProcess(process) {
  9122. context.clearRect(0, 0, opts.width, opts.height);
  9123. if (opts.rotate) {
  9124. contextRotate(context, opts);
  9125. }
  9126. opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, context, process);
  9127. drawCanvas(opts, context);
  9128. },
  9129. onAnimationFinish: function onAnimationFinish() {
  9130. _this.uevent.trigger('renderComplete');
  9131. } });
  9132. break;
  9133. case 'candle':
  9134. this.animationInstance = new Animation({
  9135. timing: opts.timing,
  9136. duration: duration,
  9137. onProcess: function onProcess(process) {
  9138. context.clearRect(0, 0, opts.width, opts.height);
  9139. if (opts.rotate) {
  9140. contextRotate(context, opts);
  9141. }
  9142. drawYAxisGrid(categories, opts, config, context);
  9143. drawXAxis(categories, opts, config, context);
  9144. var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, context, process),
  9145. xAxisPoints = _drawCandleDataPoints.xAxisPoints,
  9146. calPoints = _drawCandleDataPoints.calPoints,
  9147. eachSpacing = _drawCandleDataPoints.eachSpacing;
  9148. opts.chartData.xAxisPoints = xAxisPoints;
  9149. opts.chartData.calPoints = calPoints;
  9150. opts.chartData.eachSpacing = eachSpacing;
  9151. drawYAxis(series, opts, config, context);
  9152. if (opts.enableMarkLine !== false && process === 1) {
  9153. drawMarkLine(opts, config, context);
  9154. }
  9155. if (seriesMA) {
  9156. drawLegend(seriesMA, opts, config, context, opts.chartData);
  9157. } else {
  9158. drawLegend(opts.series, opts, config, context, opts.chartData);
  9159. }
  9160. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  9161. drawCanvas(opts, context);
  9162. },
  9163. onAnimationFinish: function onAnimationFinish() {
  9164. _this.uevent.trigger('renderComplete');
  9165. } });
  9166. break;}
  9167. }
  9168. function uChartsEvent() {
  9169. this.events = {};
  9170. }
  9171. uChartsEvent.prototype.addEventListener = function (type, listener) {
  9172. this.events[type] = this.events[type] || [];
  9173. this.events[type].push(listener);
  9174. };
  9175. uChartsEvent.prototype.delEventListener = function (type) {
  9176. this.events[type] = [];
  9177. };
  9178. uChartsEvent.prototype.trigger = function () {
  9179. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  9180. args[_key] = arguments[_key];
  9181. }
  9182. var type = args[0];
  9183. var params = args.slice(1);
  9184. if (!!this.events[type]) {
  9185. this.events[type].forEach(function (listener) {
  9186. try {
  9187. listener.apply(null, params);
  9188. } catch (e) {
  9189. //console.log('[uCharts] '+e);
  9190. }
  9191. });
  9192. }
  9193. };
  9194. var uCharts = function uCharts(opts) {
  9195. opts.pix = opts.pixelRatio ? opts.pixelRatio : 1;
  9196. opts.fontSize = opts.fontSize ? opts.fontSize : 13;
  9197. opts.fontColor = opts.fontColor ? opts.fontColor : config.fontColor;
  9198. if (opts.background == "" || opts.background == "none") {
  9199. opts.background = "#FFFFFF";
  9200. }
  9201. opts.title = assign({}, opts.title);
  9202. opts.subtitle = assign({}, opts.subtitle);
  9203. opts.duration = opts.duration ? opts.duration : 1000;
  9204. opts.yAxis = assign({}, {
  9205. data: [],
  9206. showTitle: false,
  9207. disabled: false,
  9208. disableGrid: false,
  9209. splitNumber: 5,
  9210. gridType: 'solid',
  9211. dashLength: 4 * opts.pix,
  9212. gridColor: '#cccccc',
  9213. padding: 10,
  9214. fontColor: '#666666' },
  9215. opts.yAxis);
  9216. opts.xAxis = assign({}, {
  9217. rotateLabel: false,
  9218. rotateAngle: 45,
  9219. disabled: false,
  9220. disableGrid: false,
  9221. splitNumber: 5,
  9222. calibration: false,
  9223. gridType: 'solid',
  9224. dashLength: 4,
  9225. scrollAlign: 'left',
  9226. boundaryGap: 'center',
  9227. axisLine: true,
  9228. axisLineColor: '#cccccc' },
  9229. opts.xAxis);
  9230. opts.xAxis.scrollPosition = opts.xAxis.scrollAlign;
  9231. opts.legend = assign({}, {
  9232. show: true,
  9233. position: 'bottom',
  9234. float: 'center',
  9235. backgroundColor: 'rgba(0,0,0,0)',
  9236. borderColor: 'rgba(0,0,0,0)',
  9237. borderWidth: 0,
  9238. padding: 5,
  9239. margin: 5,
  9240. itemGap: 10,
  9241. fontSize: opts.fontSize,
  9242. lineHeight: opts.fontSize,
  9243. fontColor: opts.fontColor,
  9244. formatter: {},
  9245. hiddenColor: '#CECECE' },
  9246. opts.legend);
  9247. opts.extra = assign({}, opts.extra);
  9248. opts.rotate = opts.rotate ? true : false;
  9249. opts.animation = opts.animation ? true : false;
  9250. opts.rotate = opts.rotate ? true : false;
  9251. opts.canvas2d = opts.canvas2d ? true : false;
  9252. var config$$1 = assign({}, config);
  9253. config$$1.color = opts.color ? opts.color : config$$1.color;
  9254. if (opts.type == 'pie') {
  9255. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  9256. }
  9257. if (opts.type == 'ring') {
  9258. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.ring.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  9259. }
  9260. if (opts.type == 'rose') {
  9261. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  9262. }
  9263. config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pix;
  9264. //屏幕旋转
  9265. config$$1.rotate = opts.rotate;
  9266. if (opts.rotate) {
  9267. var tempWidth = opts.width;
  9268. var tempHeight = opts.height;
  9269. opts.width = tempHeight;
  9270. opts.height = tempWidth;
  9271. }
  9272. //适配高分屏
  9273. opts.padding = opts.padding ? opts.padding : config$$1.padding;
  9274. config$$1.yAxisWidth = config.yAxisWidth * opts.pix;
  9275. config$$1.xAxisHeight = config.xAxisHeight * opts.pix;
  9276. if (opts.enableScroll && opts.xAxis.scrollShow) {
  9277. config$$1.xAxisHeight += 6 * opts.pix;
  9278. }
  9279. config$$1.fontSize = opts.fontSize * opts.pix;
  9280. config$$1.titleFontSize = config.titleFontSize * opts.pix;
  9281. config$$1.subtitleFontSize = config.subtitleFontSize * opts.pix;
  9282. config$$1.toolTipPadding = config.toolTipPadding * opts.pix;
  9283. config$$1.toolTipLineHeight = config.toolTipLineHeight * opts.pix;
  9284. if (!opts.context) {
  9285. throw new Error('[uCharts] 未获取到context!注意:v2.0版本后,需要自行获取canvas的绘图上下文并传入opts.context!');
  9286. }
  9287. this.context = opts.context;
  9288. if (!this.context.setTextAlign) {
  9289. this.context.setStrokeStyle = function (e) {
  9290. return this.strokeStyle = e;
  9291. };
  9292. this.context.setLineWidth = function (e) {
  9293. return this.lineWidth = e;
  9294. };
  9295. this.context.setLineCap = function (e) {
  9296. return this.lineCap = e;
  9297. };
  9298. this.context.setFontSize = function (e) {
  9299. return this.font = e + "px sans-serif";
  9300. };
  9301. this.context.setFillStyle = function (e) {
  9302. return this.fillStyle = e;
  9303. };
  9304. this.context.setTextAlign = function (e) {
  9305. return this.textAlign = e;
  9306. };
  9307. this.context.draw = function () {};
  9308. }
  9309. //兼容NVUEsetLineDash
  9310. if (!this.context.setLineDash) {
  9311. this.context.setLineDash = function (e) {};
  9312. }
  9313. opts.chartData = {};
  9314. this.uevent = new uChartsEvent();
  9315. this.scrollOption = {
  9316. currentOffset: 0,
  9317. startTouchX: 0,
  9318. distance: 0,
  9319. lastMoveTime: 0 };
  9320. this.opts = opts;
  9321. this.config = config$$1;
  9322. drawCharts.call(this, opts.type, opts, config$$1, this.context);
  9323. };
  9324. uCharts.prototype.updateData = function () {
  9325. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  9326. this.opts = assign({}, this.opts, data);
  9327. this.opts.updateData = true;
  9328. var scrollPosition = data.scrollPosition || 'current';
  9329. switch (scrollPosition) {
  9330. case 'current':
  9331. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  9332. break;
  9333. case 'left':
  9334. this.opts._scrollDistance_ = 0;
  9335. this.scrollOption = {
  9336. currentOffset: 0,
  9337. startTouchX: 0,
  9338. distance: 0,
  9339. lastMoveTime: 0 };
  9340. break;
  9341. case 'right':
  9342. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),yAxisWidth = _calYAxisData.yAxisWidth;
  9343. this.config.yAxisWidth = yAxisWidth;
  9344. var offsetLeft = 0;
  9345. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),xAxisPoints = _getXAxisPoints0.xAxisPoints,
  9346. startX = _getXAxisPoints0.startX,
  9347. endX = _getXAxisPoints0.endX,
  9348. eachSpacing = _getXAxisPoints0.eachSpacing;
  9349. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  9350. var screenWidth = endX - startX;
  9351. offsetLeft = screenWidth - totalWidth;
  9352. this.scrollOption = {
  9353. currentOffset: offsetLeft,
  9354. startTouchX: offsetLeft,
  9355. distance: 0,
  9356. lastMoveTime: 0 };
  9357. this.opts._scrollDistance_ = offsetLeft;
  9358. break;}
  9359. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  9360. };
  9361. uCharts.prototype.zoom = function () {
  9362. var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
  9363. if (this.opts.enableScroll !== true) {
  9364. console.log('[uCharts] 请启用滚动条后使用');
  9365. return;
  9366. }
  9367. //当前屏幕中间点
  9368. var centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(this.opts.xAxis.itemCount / 2);
  9369. this.opts.animation = false;
  9370. this.opts.xAxis.itemCount = val.itemCount;
  9371. //重新计算x轴偏移距离
  9372. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
  9373. yAxisWidth = _calYAxisData.yAxisWidth;
  9374. this.config.yAxisWidth = yAxisWidth;
  9375. var offsetLeft = 0;
  9376. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  9377. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  9378. startX = _getXAxisPoints0.startX,
  9379. endX = _getXAxisPoints0.endX,
  9380. eachSpacing = _getXAxisPoints0.eachSpacing;
  9381. var centerLeft = eachSpacing * centerPoint;
  9382. var screenWidth = endX - startX;
  9383. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  9384. offsetLeft = screenWidth / 2 - centerLeft;
  9385. if (offsetLeft > 0) {
  9386. offsetLeft = 0;
  9387. }
  9388. if (offsetLeft < MaxLeft) {
  9389. offsetLeft = MaxLeft;
  9390. }
  9391. this.scrollOption = {
  9392. currentOffset: offsetLeft,
  9393. startTouchX: 0,
  9394. distance: 0,
  9395. lastMoveTime: 0 };
  9396. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  9397. this.opts._scrollDistance_ = offsetLeft;
  9398. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  9399. };
  9400. uCharts.prototype.dobuleZoom = function (e) {
  9401. if (this.opts.enableScroll !== true) {
  9402. console.log('[uCharts] 请启用滚动条后使用');
  9403. return;
  9404. }
  9405. var tcs = e.changedTouches;
  9406. if (tcs.length < 2) {
  9407. return;
  9408. }
  9409. for (var i = 0; i < tcs.length; i++) {
  9410. tcs[i].x = tcs[i].x ? tcs[i].x : tcs[i].clientX;
  9411. tcs[i].y = tcs[i].y ? tcs[i].y : tcs[i].clientY;
  9412. }
  9413. var ntcs = [getTouches(tcs[0], this.opts, e), getTouches(tcs[1], this.opts, e)];
  9414. var xlength = Math.abs(ntcs[0].x - ntcs[1].x);
  9415. // 记录初始的两指之间的数据
  9416. if (!this.scrollOption.moveCount) {
  9417. var cts0 = { changedTouches: [{ x: tcs[0].x, y: this.opts.area[0] / this.opts.pix + 2 }] };
  9418. var cts1 = { changedTouches: [{ x: tcs[1].x, y: this.opts.area[0] / this.opts.pix + 2 }] };
  9419. if (this.opts.rotate) {
  9420. cts0 = { changedTouches: [{ x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2, y: tcs[0].y }] };
  9421. cts1 = { changedTouches: [{ x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2, y: tcs[1].y }] };
  9422. }
  9423. var moveCurrent1 = this.getCurrentDataIndex(cts0).index;
  9424. var moveCurrent2 = this.getCurrentDataIndex(cts1).index;
  9425. var moveCount = Math.abs(moveCurrent1 - moveCurrent2);
  9426. this.scrollOption.moveCount = moveCount;
  9427. this.scrollOption.moveCurrent1 = Math.min(moveCurrent1, moveCurrent2);
  9428. this.scrollOption.moveCurrent2 = Math.max(moveCurrent1, moveCurrent2);
  9429. return;
  9430. }
  9431. var currentEachSpacing = xlength / this.scrollOption.moveCount;
  9432. var itemCount = (this.opts.width - this.opts.area[1] - this.opts.area[3]) / currentEachSpacing;
  9433. itemCount = itemCount <= 2 ? 2 : itemCount;
  9434. itemCount = itemCount >= this.opts.categories.length ? this.opts.categories.length : itemCount;
  9435. this.opts.animation = false;
  9436. this.opts.xAxis.itemCount = itemCount;
  9437. // 重新计算滚动条偏移距离
  9438. var offsetLeft = 0;
  9439. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  9440. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  9441. startX = _getXAxisPoints0.startX,
  9442. endX = _getXAxisPoints0.endX,
  9443. eachSpacing = _getXAxisPoints0.eachSpacing;
  9444. var currentLeft = eachSpacing * this.scrollOption.moveCurrent1;
  9445. var screenWidth = endX - startX;
  9446. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  9447. offsetLeft = -currentLeft + Math.min(ntcs[0].x, ntcs[1].x) - this.opts.area[3] - eachSpacing;
  9448. if (offsetLeft > 0) {
  9449. offsetLeft = 0;
  9450. }
  9451. if (offsetLeft < MaxLeft) {
  9452. offsetLeft = MaxLeft;
  9453. }
  9454. this.scrollOption.currentOffset = offsetLeft;
  9455. this.scrollOption.startTouchX = 0;
  9456. this.scrollOption.distance = 0;
  9457. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  9458. this.opts._scrollDistance_ = offsetLeft;
  9459. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  9460. };
  9461. uCharts.prototype.stopAnimation = function () {
  9462. this.animationInstance && this.animationInstance.stop();
  9463. };
  9464. uCharts.prototype.addEventListener = function (type, listener) {
  9465. this.uevent.addEventListener(type, listener);
  9466. };
  9467. uCharts.prototype.delEventListener = function (type) {
  9468. this.uevent.delEventListener(type);
  9469. };
  9470. uCharts.prototype.getCurrentDataIndex = function (e) {
  9471. var touches = null;
  9472. if (e.changedTouches) {
  9473. touches = e.changedTouches[0];
  9474. } else {
  9475. touches = e.mp.changedTouches[0];
  9476. }
  9477. if (touches) {
  9478. var _touches$ = getTouches(touches, this.opts, e);
  9479. if (this.opts.type === 'pie' || this.opts.type === 'ring') {
  9480. return findPieChartCurrentIndex({
  9481. x: _touches$.x,
  9482. y: _touches$.y },
  9483. this.opts.chartData.pieData, this.opts);
  9484. } else if (this.opts.type === 'rose') {
  9485. return findRoseChartCurrentIndex({
  9486. x: _touches$.x,
  9487. y: _touches$.y },
  9488. this.opts.chartData.pieData, this.opts);
  9489. } else if (this.opts.type === 'radar') {
  9490. return findRadarChartCurrentIndex({
  9491. x: _touches$.x,
  9492. y: _touches$.y },
  9493. this.opts.chartData.radarData, this.opts.categories.length);
  9494. } else if (this.opts.type === 'funnel') {
  9495. return findFunnelChartCurrentIndex({
  9496. x: _touches$.x,
  9497. y: _touches$.y },
  9498. this.opts.chartData.funnelData);
  9499. } else if (this.opts.type === 'map') {
  9500. return findMapChartCurrentIndex({
  9501. x: _touches$.x,
  9502. y: _touches$.y },
  9503. this.opts);
  9504. } else if (this.opts.type === 'word') {
  9505. return findWordChartCurrentIndex({
  9506. x: _touches$.x,
  9507. y: _touches$.y },
  9508. this.opts.chartData.wordCloudData);
  9509. } else if (this.opts.type === 'bar') {
  9510. return findBarChartCurrentIndex({
  9511. x: _touches$.x,
  9512. y: _touches$.y },
  9513. this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  9514. } else {
  9515. return findCurrentIndex({
  9516. x: _touches$.x,
  9517. y: _touches$.y },
  9518. this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  9519. }
  9520. }
  9521. return -1;
  9522. };
  9523. uCharts.prototype.getLegendDataIndex = function (e) {
  9524. var touches = null;
  9525. if (e.changedTouches) {
  9526. touches = e.changedTouches[0];
  9527. } else {
  9528. touches = e.mp.changedTouches[0];
  9529. }
  9530. if (touches) {
  9531. var _touches$ = getTouches(touches, this.opts, e);
  9532. return findLegendIndex({
  9533. x: _touches$.x,
  9534. y: _touches$.y },
  9535. this.opts.chartData.legendData);
  9536. }
  9537. return -1;
  9538. };
  9539. uCharts.prototype.touchLegend = function (e) {
  9540. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  9541. var touches = null;
  9542. if (e.changedTouches) {
  9543. touches = e.changedTouches[0];
  9544. } else {
  9545. touches = e.mp.changedTouches[0];
  9546. }
  9547. if (touches) {
  9548. var _touches$ = getTouches(touches, this.opts, e);
  9549. var index = this.getLegendDataIndex(e);
  9550. if (index >= 0) {
  9551. if (this.opts.type == 'candle') {
  9552. this.opts.seriesMA[index].show = !this.opts.seriesMA[index].show;
  9553. } else {
  9554. this.opts.series[index].show = !this.opts.series[index].show;
  9555. }
  9556. this.opts.animation = option.animation ? true : false;
  9557. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  9558. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  9559. }
  9560. }
  9561. };
  9562. uCharts.prototype.showToolTip = function (e) {var _this2 = this;
  9563. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  9564. var touches = null;
  9565. if (e.changedTouches) {
  9566. touches = e.changedTouches[0];
  9567. } else {
  9568. touches = e.mp.changedTouches[0];
  9569. }
  9570. if (!touches) {
  9571. console.log("[uCharts] 未获取到event坐标信息");
  9572. }
  9573. var _touches$ = getTouches(touches, this.opts, e);
  9574. var currentOffset = this.scrollOption.currentOffset;
  9575. var opts = assign({}, this.opts, {
  9576. _scrollDistance_: currentOffset,
  9577. animation: false });
  9578. if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column' || this.opts.type === 'scatter' || this.opts.type === 'bubble') {
  9579. var current = this.getCurrentDataIndex(e);
  9580. var index = option.index == undefined ? current.index : option.index;
  9581. if (index > -1 || index.length > 0) {
  9582. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  9583. if (seriesData.length !== 0) {
  9584. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  9585. textList = _getToolTipData.textList,
  9586. offset = _getToolTipData.offset;
  9587. offset.y = _touches$.y;
  9588. opts.tooltip = {
  9589. textList: option.textList !== undefined ? option.textList : textList,
  9590. offset: option.offset !== undefined ? option.offset : offset,
  9591. option: option,
  9592. index: index };
  9593. }
  9594. }
  9595. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9596. }
  9597. if (this.opts.type === 'mount') {
  9598. var index = option.index == undefined ? this.getCurrentDataIndex(e).index : option.index;
  9599. if (index > -1) {
  9600. var opts = assign({}, this.opts, { animation: false });
  9601. var seriesData = assign({}, opts._series_[index]);
  9602. var textList = [{
  9603. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  9604. color: seriesData.color }];
  9605. var offset = {
  9606. x: opts.chartData.calPoints[index].x,
  9607. y: _touches$.y };
  9608. opts.tooltip = {
  9609. textList: option.textList ? option.textList : textList,
  9610. offset: option.offset !== undefined ? option.offset : offset,
  9611. option: option,
  9612. index: index };
  9613. }
  9614. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9615. }
  9616. if (this.opts.type === 'bar') {
  9617. var current = this.getCurrentDataIndex(e);
  9618. var index = option.index == undefined ? current.index : option.index;
  9619. if (index > -1 || index.length > 0) {
  9620. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  9621. if (seriesData.length !== 0) {
  9622. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  9623. textList = _getToolTipData.textList,
  9624. offset = _getToolTipData.offset;
  9625. offset.x = _touches$.x;
  9626. opts.tooltip = {
  9627. textList: option.textList !== undefined ? option.textList : textList,
  9628. offset: option.offset !== undefined ? option.offset : offset,
  9629. option: option,
  9630. index: index };
  9631. }
  9632. }
  9633. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9634. }
  9635. if (this.opts.type === 'mix') {
  9636. var current = this.getCurrentDataIndex(e);
  9637. var index = option.index == undefined ? current.index : option.index;
  9638. if (index > -1) {
  9639. var currentOffset = this.scrollOption.currentOffset;
  9640. var opts = assign({}, this.opts, {
  9641. _scrollDistance_: currentOffset,
  9642. animation: false });
  9643. var seriesData = getSeriesDataItem(this.opts.series, index);
  9644. if (seriesData.length !== 0) {
  9645. var _getMixToolTipData = getMixToolTipData(seriesData, this.opts, index, this.opts.categories, option),
  9646. textList = _getMixToolTipData.textList,
  9647. offset = _getMixToolTipData.offset;
  9648. offset.y = _touches$.y;
  9649. opts.tooltip = {
  9650. textList: option.textList ? option.textList : textList,
  9651. offset: option.offset !== undefined ? option.offset : offset,
  9652. option: option,
  9653. index: index };
  9654. }
  9655. }
  9656. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9657. }
  9658. if (this.opts.type === 'candle') {
  9659. var current = this.getCurrentDataIndex(e);
  9660. var index = option.index == undefined ? current.index : option.index;
  9661. if (index > -1) {
  9662. var currentOffset = this.scrollOption.currentOffset;
  9663. var opts = assign({}, this.opts, {
  9664. _scrollDistance_: currentOffset,
  9665. animation: false });
  9666. var seriesData = getSeriesDataItem(this.opts.series, index);
  9667. if (seriesData.length !== 0) {
  9668. var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts, index, this.opts.categories, this.opts.extra.candle, option),
  9669. textList = _getToolTipData.textList,
  9670. offset = _getToolTipData.offset;
  9671. offset.y = _touches$.y;
  9672. opts.tooltip = {
  9673. textList: option.textList ? option.textList : textList,
  9674. offset: option.offset !== undefined ? option.offset : offset,
  9675. option: option,
  9676. index: index };
  9677. }
  9678. }
  9679. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9680. }
  9681. if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose' || this.opts.type === 'funnel') {
  9682. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  9683. if (index > -1) {
  9684. var opts = assign({}, this.opts, { animation: false });
  9685. var seriesData = assign({}, opts._series_[index]);
  9686. var textList = [{
  9687. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  9688. color: seriesData.color }];
  9689. var offset = {
  9690. x: _touches$.x,
  9691. y: _touches$.y };
  9692. opts.tooltip = {
  9693. textList: option.textList ? option.textList : textList,
  9694. offset: option.offset !== undefined ? option.offset : offset,
  9695. option: option,
  9696. index: index };
  9697. }
  9698. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9699. }
  9700. if (this.opts.type === 'map') {
  9701. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  9702. if (index > -1) {
  9703. var opts = assign({}, this.opts, { animation: false });
  9704. var seriesData = assign({}, this.opts.series[index]);
  9705. seriesData.name = seriesData.properties.name;
  9706. var textList = [{
  9707. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  9708. color: seriesData.color }];
  9709. var offset = {
  9710. x: _touches$.x,
  9711. y: _touches$.y };
  9712. opts.tooltip = {
  9713. textList: option.textList ? option.textList : textList,
  9714. offset: option.offset !== undefined ? option.offset : offset,
  9715. option: option,
  9716. index: index };
  9717. }
  9718. opts.updateData = false;
  9719. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9720. }
  9721. if (this.opts.type === 'word') {
  9722. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  9723. if (index > -1) {
  9724. var opts = assign({}, this.opts, { animation: false });
  9725. var seriesData = assign({}, this.opts.series[index]);
  9726. var textList = [{
  9727. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  9728. color: seriesData.color }];
  9729. var offset = {
  9730. x: _touches$.x,
  9731. y: _touches$.y };
  9732. opts.tooltip = {
  9733. textList: option.textList ? option.textList : textList,
  9734. offset: option.offset !== undefined ? option.offset : offset,
  9735. option: option,
  9736. index: index };
  9737. }
  9738. opts.updateData = false;
  9739. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9740. }
  9741. if (this.opts.type === 'radar') {
  9742. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  9743. if (index > -1) {
  9744. var opts = assign({}, this.opts, { animation: false });
  9745. var seriesData = getSeriesDataItem(this.opts.series, index);
  9746. if (seriesData.length !== 0) {
  9747. var textList = seriesData.map(function (item) {
  9748. return {
  9749. text: option.formatter ? option.formatter(item, _this2.opts.categories[index], index, _this2.opts) : item.name + ': ' + item.data,
  9750. color: item.color };
  9751. });
  9752. var offset = {
  9753. x: _touches$.x,
  9754. y: _touches$.y };
  9755. opts.tooltip = {
  9756. textList: option.textList ? option.textList : textList,
  9757. offset: option.offset !== undefined ? option.offset : offset,
  9758. option: option,
  9759. index: index };
  9760. }
  9761. }
  9762. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9763. }
  9764. };
  9765. uCharts.prototype.translate = function (distance) {
  9766. this.scrollOption = {
  9767. currentOffset: distance,
  9768. startTouchX: distance,
  9769. distance: 0,
  9770. lastMoveTime: 0 };
  9771. var opts = assign({}, this.opts, {
  9772. _scrollDistance_: distance,
  9773. animation: false });
  9774. drawCharts.call(this, this.opts.type, opts, this.config, this.context);
  9775. };
  9776. uCharts.prototype.scrollStart = function (e) {
  9777. var touches = null;
  9778. if (e.changedTouches) {
  9779. touches = e.changedTouches[0];
  9780. } else {
  9781. touches = e.mp.changedTouches[0];
  9782. }
  9783. var _touches$ = getTouches(touches, this.opts, e);
  9784. if (touches && this.opts.enableScroll === true) {
  9785. this.scrollOption.startTouchX = _touches$.x;
  9786. }
  9787. };
  9788. uCharts.prototype.scroll = function (e) {
  9789. if (this.scrollOption.lastMoveTime === 0) {
  9790. this.scrollOption.lastMoveTime = Date.now();
  9791. }
  9792. var Limit = this.opts.touchMoveLimit || 60;
  9793. var currMoveTime = Date.now();
  9794. var duration = currMoveTime - this.scrollOption.lastMoveTime;
  9795. if (duration < Math.floor(1000 / Limit)) return;
  9796. if (this.scrollOption.startTouchX == 0) return;
  9797. this.scrollOption.lastMoveTime = currMoveTime;
  9798. var touches = null;
  9799. if (e.changedTouches) {
  9800. touches = e.changedTouches[0];
  9801. } else {
  9802. touches = e.mp.changedTouches[0];
  9803. }
  9804. if (touches && this.opts.enableScroll === true) {
  9805. var _touches$ = getTouches(touches, this.opts, e);
  9806. var _distance;
  9807. _distance = _touches$.x - this.scrollOption.startTouchX;
  9808. var currentOffset = this.scrollOption.currentOffset;
  9809. var validDistance = calValidDistance(this, currentOffset + _distance, this.opts.chartData, this.config, this.opts);
  9810. this.scrollOption.distance = _distance = validDistance - currentOffset;
  9811. var opts = assign({}, this.opts, {
  9812. _scrollDistance_: currentOffset + _distance,
  9813. animation: false });
  9814. this.opts = opts;
  9815. drawCharts.call(this, opts.type, opts, this.config, this.context);
  9816. return currentOffset + _distance;
  9817. }
  9818. };
  9819. uCharts.prototype.scrollEnd = function (e) {
  9820. if (this.opts.enableScroll === true) {
  9821. var _scrollOption = this.scrollOption,
  9822. currentOffset = _scrollOption.currentOffset,
  9823. distance = _scrollOption.distance;
  9824. this.scrollOption.currentOffset = currentOffset + distance;
  9825. this.scrollOption.distance = 0;
  9826. this.scrollOption.moveCount = 0;
  9827. }
  9828. };var _default =
  9829. uCharts;exports.default = _default;
  9830. /***/ }),
  9831. /***/ 112:
  9832. /*!***************************************************************************************************!*\
  9833. !*** D:/hongxing/iot-platform-app/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js ***!
  9834. \***************************************************************************************************/
  9835. /*! no static exports found */
  9836. /***/ (function(module, exports, __webpack_require__) {
  9837. "use strict";
  9838. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /*
  9839. * uCharts®
  9840. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台
  9841. * Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
  9842. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  9843. * 复制使用请保留本段注释,感谢支持开源!
  9844. *
  9845. * uCharts®官方网站
  9846. * https://www.uCharts.cn
  9847. *
  9848. * 开源地址:
  9849. * https://gitee.com/uCharts/uCharts
  9850. *
  9851. * uni-app插件市场地址:
  9852. * http://ext.dcloud.net.cn/plugin?id=271
  9853. *
  9854. */
  9855. // 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
  9856. var color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
  9857. //事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
  9858. var formatDateTime = function formatDateTime(timeStamp, returnType) {
  9859. var date = new Date();
  9860. date.setTime(timeStamp * 1000);
  9861. var y = date.getFullYear();
  9862. var m = date.getMonth() + 1;
  9863. m = m < 10 ? '0' + m : m;
  9864. var d = date.getDate();
  9865. d = d < 10 ? '0' + d : d;
  9866. var h = date.getHours();
  9867. h = h < 10 ? '0' + h : h;
  9868. var minute = date.getMinutes();
  9869. var second = date.getSeconds();
  9870. minute = minute < 10 ? '0' + minute : minute;
  9871. second = second < 10 ? '0' + second : second;
  9872. if (returnType == 'full') {return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;}
  9873. if (returnType == 'y-m-d') {return y + '-' + m + '-' + d;}
  9874. if (returnType == 'h:m') {return h + ':' + minute;}
  9875. if (returnType == 'h:m:s') {return h + ':' + minute + ':' + second;}
  9876. return [y, m, d, h, minute, second];
  9877. };
  9878. var cfu = {
  9879. //demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
  9880. "type": ["pie", "ring", "rose", "word", "funnel", "map", "arcbar", "line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "tline", "tarea", "scatter", "bubble", "demotype"],
  9881. "range": ["饼状图", "圆环图", "玫瑰图", "词云图", "漏斗图", "地图", "圆弧进度条", "折线图", "柱状图", "山峰图", "条状图", "区域图", "雷达图", "仪表盘", "K线图", "混合图", "时间轴折线", "时间轴区域", "散点图", "气泡图", "自定义类型"],
  9882. //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
  9883. //自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
  9884. "categories": ["line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "demotype"],
  9885. //instance为实例变量承载属性,不要删除
  9886. "instance": {},
  9887. //option为opts及eopts承载属性,不要删除
  9888. "option": {},
  9889. //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
  9890. "formatter": {
  9891. "yAxisDemo1": function yAxisDemo1(val, index, opts) {return val + '元';},
  9892. "yAxisDemo2": function yAxisDemo2(val, index, opts) {return val.toFixed(2);},
  9893. "xAxisDemo1": function xAxisDemo1(val, index, opts) {return val + '年';},
  9894. "xAxisDemo2": function xAxisDemo2(val, index, opts) {return formatDateTime(val, 'h:m');},
  9895. "seriesDemo1": function seriesDemo1(val, index, series, opts) {return val + '元';},
  9896. "tooltipDemo1": function tooltipDemo1(item, category, index, opts) {
  9897. if (index == 0) {
  9898. return '随便用' + item.data + '年';
  9899. } else {
  9900. return '其他我没改' + item.data + '天';
  9901. }
  9902. },
  9903. "pieDemo": function pieDemo(val, index, series, opts) {
  9904. if (index !== undefined) {
  9905. return series[index].name + ':' + series[index].data + '元';
  9906. }
  9907. } },
  9908. //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
  9909. "demotype": {
  9910. //我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
  9911. "type": "line",
  9912. "color": color,
  9913. "padding": [15, 10, 0, 15],
  9914. "xAxis": {
  9915. "disableGrid": true },
  9916. "yAxis": {
  9917. "gridType": "dash",
  9918. "dashLength": 2 },
  9919. "legend": {},
  9920. "extra": {
  9921. "line": {
  9922. "type": "curve",
  9923. "width": 2 } } },
  9924. //下面是自定义配置,请添加项目所需的通用配置
  9925. "pie": {
  9926. "type": "pie",
  9927. "color": color,
  9928. "padding": [5, 5, 5, 5],
  9929. "extra": {
  9930. "pie": {
  9931. "activeOpacity": 0.5,
  9932. "activeRadius": 10,
  9933. "offsetAngle": 0,
  9934. "labelWidth": 15,
  9935. "border": true,
  9936. "borderWidth": 3,
  9937. "borderColor": "#FFFFFF" } } },
  9938. "ring": {
  9939. "type": "ring",
  9940. "color": color,
  9941. "padding": [5, 5, 5, 5],
  9942. "rotate": false,
  9943. "dataLabel": true,
  9944. "legend": {
  9945. "show": true,
  9946. "position": "right",
  9947. "lineHeight": 25 },
  9948. "title": {
  9949. "name": "收益率",
  9950. "fontSize": 15,
  9951. "color": "#666666" },
  9952. "subtitle": {
  9953. "name": "70%",
  9954. "fontSize": 25,
  9955. "color": "#7cb5ec" },
  9956. "extra": {
  9957. "ring": {
  9958. "ringWidth": 30,
  9959. "activeOpacity": 0.5,
  9960. "activeRadius": 10,
  9961. "offsetAngle": 0,
  9962. "labelWidth": 15,
  9963. "border": true,
  9964. "borderWidth": 3,
  9965. "borderColor": "#FFFFFF" } } },
  9966. "rose": {
  9967. "type": "rose",
  9968. "color": color,
  9969. "padding": [5, 5, 5, 5],
  9970. "legend": {
  9971. "show": true,
  9972. "position": "left",
  9973. "lineHeight": 25 },
  9974. "extra": {
  9975. "rose": {
  9976. "type": "area",
  9977. "minRadius": 50,
  9978. "activeOpacity": 0.5,
  9979. "activeRadius": 10,
  9980. "offsetAngle": 0,
  9981. "labelWidth": 15,
  9982. "border": false,
  9983. "borderWidth": 2,
  9984. "borderColor": "#FFFFFF" } } },
  9985. "word": {
  9986. "type": "word",
  9987. "color": color,
  9988. "extra": {
  9989. "word": {
  9990. "type": "normal",
  9991. "autoColors": false } } },
  9992. "funnel": {
  9993. "type": "funnel",
  9994. "color": color,
  9995. "padding": [15, 15, 0, 15],
  9996. "extra": {
  9997. "funnel": {
  9998. "activeOpacity": 0.3,
  9999. "activeWidth": 10,
  10000. "border": true,
  10001. "borderWidth": 2,
  10002. "borderColor": "#FFFFFF",
  10003. "fillOpacity": 1,
  10004. "labelAlign": "right" } } },
  10005. "map": {
  10006. "type": "map",
  10007. "color": color,
  10008. "padding": [0, 0, 0, 0],
  10009. "dataLabel": true,
  10010. "extra": {
  10011. "map": {
  10012. "border": true,
  10013. "borderWidth": 1,
  10014. "borderColor": "#666666",
  10015. "fillOpacity": 0.6,
  10016. "activeBorderColor": "#F04864",
  10017. "activeFillColor": "#FACC14",
  10018. "activeFillOpacity": 1 } } },
  10019. "arcbar": {
  10020. "type": "arcbar",
  10021. "color": color,
  10022. "title": {
  10023. "name": "百分比",
  10024. "fontSize": 25,
  10025. "color": "#00FF00" },
  10026. "subtitle": {
  10027. "name": "默认标题",
  10028. "fontSize": 15,
  10029. "color": "#666666" },
  10030. "extra": {
  10031. "arcbar": {
  10032. "type": "default",
  10033. "width": 12,
  10034. "backgroundColor": "#E9E9E9",
  10035. "startAngle": 0.75,
  10036. "endAngle": 0.25,
  10037. "gap": 2 } } },
  10038. "line": {
  10039. "type": "line",
  10040. "color": color,
  10041. "padding": [15, 10, 0, 15],
  10042. "xAxis": {
  10043. "disableGrid": true },
  10044. "yAxis": {
  10045. "gridType": "dash",
  10046. "dashLength": 2 },
  10047. "legend": {},
  10048. "extra": {
  10049. "line": {
  10050. "type": "straight",
  10051. "width": 2 } } },
  10052. "tline": {
  10053. "type": "line",
  10054. "color": color,
  10055. "padding": [15, 10, 0, 15],
  10056. "xAxis": {
  10057. "disableGrid": false,
  10058. "boundaryGap": "justify" },
  10059. "yAxis": {
  10060. "gridType": "dash",
  10061. "dashLength": 2,
  10062. "data": [
  10063. {
  10064. "min": 0,
  10065. "max": 80 }] },
  10066. "legend": {},
  10067. "extra": {
  10068. "line": {
  10069. "type": "curve",
  10070. "width": 2 } } },
  10071. "tarea": {
  10072. "type": "area",
  10073. "color": color,
  10074. "padding": [15, 10, 0, 15],
  10075. "xAxis": {
  10076. "disableGrid": true,
  10077. "boundaryGap": "justify" },
  10078. "yAxis": {
  10079. "gridType": "dash",
  10080. "dashLength": 2,
  10081. "data": [
  10082. {
  10083. "min": 0,
  10084. "max": 80 }] },
  10085. "legend": {},
  10086. "extra": {
  10087. "area": {
  10088. "type": "curve",
  10089. "opacity": 0.2,
  10090. "addLine": true,
  10091. "width": 2,
  10092. "gradient": true } } },
  10093. "column": {
  10094. "type": "column",
  10095. "color": color,
  10096. "padding": [15, 15, 0, 5],
  10097. "xAxis": {
  10098. "disableGrid": true },
  10099. "yAxis": {
  10100. "data": [{ "min": 0 }] },
  10101. "legend": {},
  10102. "extra": {
  10103. "column": {
  10104. "type": "group",
  10105. "width": 30,
  10106. "activeBgColor": "#000000",
  10107. "activeBgOpacity": 0.08 } } },
  10108. "mount": {
  10109. "type": "mount",
  10110. "color": color,
  10111. "padding": [15, 15, 0, 5],
  10112. "xAxis": {
  10113. "disableGrid": true },
  10114. "yAxis": {
  10115. "data": [{ "min": 0 }] },
  10116. "legend": {},
  10117. "extra": {
  10118. "mount": {
  10119. "type": "mount",
  10120. "widthRatio": 1.5 } } },
  10121. "bar": {
  10122. "type": "bar",
  10123. "color": color,
  10124. "padding": [15, 30, 0, 5],
  10125. "xAxis": {
  10126. "boundaryGap": "justify",
  10127. "disableGrid": false,
  10128. "min": 0,
  10129. "axisLine": false },
  10130. "yAxis": {},
  10131. "legend": {},
  10132. "extra": {
  10133. "bar": {
  10134. "type": "group",
  10135. "width": 30,
  10136. "meterBorde": 1,
  10137. "meterFillColor": "#FFFFFF",
  10138. "activeBgColor": "#000000",
  10139. "activeBgOpacity": 0.08 } } },
  10140. "area": {
  10141. "type": "area",
  10142. "color": color,
  10143. "padding": [15, 15, 0, 15],
  10144. "xAxis": {
  10145. "disableGrid": true },
  10146. "yAxis": {
  10147. "gridType": "dash",
  10148. "dashLength": 2 },
  10149. "legend": {},
  10150. "extra": {
  10151. "area": {
  10152. "type": "straight",
  10153. "opacity": 0.2,
  10154. "addLine": true,
  10155. "width": 2,
  10156. "gradient": false } } },
  10157. "radar": {
  10158. "type": "radar",
  10159. "color": color,
  10160. "padding": [5, 5, 5, 5],
  10161. "dataLabel": false,
  10162. "legend": {
  10163. "show": true,
  10164. "position": "right",
  10165. "lineHeight": 25 },
  10166. "extra": {
  10167. "radar": {
  10168. "gridType": "radar",
  10169. "gridColor": "#CCCCCC",
  10170. "gridCount": 3,
  10171. "opacity": 0.2,
  10172. "max": 200 } } },
  10173. "gauge": {
  10174. "type": "gauge",
  10175. "color": color,
  10176. "title": {
  10177. "name": "66Km/H",
  10178. "fontSize": 25,
  10179. "color": "#2fc25b",
  10180. "offsetY": 50 },
  10181. "subtitle": {
  10182. "name": "实时速度",
  10183. "fontSize": 15,
  10184. "color": "#1890ff",
  10185. "offsetY": -50 },
  10186. "extra": {
  10187. "gauge": {
  10188. "type": "default",
  10189. "width": 30,
  10190. "labelColor": "#666666",
  10191. "startAngle": 0.75,
  10192. "endAngle": 0.25,
  10193. "startNumber": 0,
  10194. "endNumber": 100,
  10195. "labelFormat": "",
  10196. "splitLine": {
  10197. "fixRadius": 0,
  10198. "splitNumber": 10,
  10199. "width": 30,
  10200. "color": "#FFFFFF",
  10201. "childNumber": 5,
  10202. "childWidth": 12 },
  10203. "pointer": {
  10204. "width": 24,
  10205. "color": "auto" } } } },
  10206. "candle": {
  10207. "type": "candle",
  10208. "color": color,
  10209. "padding": [15, 15, 0, 15],
  10210. "enableScroll": true,
  10211. "enableMarkLine": true,
  10212. "dataLabel": false,
  10213. "xAxis": {
  10214. "labelCount": 4,
  10215. "itemCount": 40,
  10216. "disableGrid": true,
  10217. "gridColor": "#CCCCCC",
  10218. "gridType": "solid",
  10219. "dashLength": 4,
  10220. "scrollShow": true,
  10221. "scrollAlign": "left",
  10222. "scrollColor": "#A6A6A6",
  10223. "scrollBackgroundColor": "#EFEBEF" },
  10224. "yAxis": {},
  10225. "legend": {},
  10226. "extra": {
  10227. "candle": {
  10228. "color": {
  10229. "upLine": "#f04864",
  10230. "upFill": "#f04864",
  10231. "downLine": "#2fc25b",
  10232. "downFill": "#2fc25b" },
  10233. "average": {
  10234. "show": true,
  10235. "name": ["MA5", "MA10", "MA30"],
  10236. "day": [5, 10, 20],
  10237. "color": ["#1890ff", "#2fc25b", "#facc14"] } },
  10238. "markLine": {
  10239. "type": "dash",
  10240. "dashLength": 5,
  10241. "data": [
  10242. {
  10243. "value": 2150,
  10244. "lineColor": "#f04864",
  10245. "showLabel": true },
  10246. {
  10247. "value": 2350,
  10248. "lineColor": "#f04864",
  10249. "showLabel": true }] } } },
  10250. "mix": {
  10251. "type": "mix",
  10252. "color": color,
  10253. "padding": [15, 15, 0, 15],
  10254. "xAxis": {
  10255. "disableGrid": true },
  10256. "yAxis": {
  10257. "disabled": false,
  10258. "disableGrid": false,
  10259. "splitNumber": 5,
  10260. "gridType": "dash",
  10261. "dashLength": 4,
  10262. "gridColor": "#CCCCCC",
  10263. "padding": 10,
  10264. "showTitle": true,
  10265. "data": [] },
  10266. "legend": {},
  10267. "extra": {
  10268. "mix": {
  10269. "column": {
  10270. "width": 20 } } } },
  10271. "scatter": {
  10272. "type": "scatter",
  10273. "color": color,
  10274. "padding": [15, 15, 0, 15],
  10275. "dataLabel": false,
  10276. "xAxis": {
  10277. "disableGrid": false,
  10278. "gridType": "dash",
  10279. "splitNumber": 5,
  10280. "boundaryGap": "justify",
  10281. "min": 0 },
  10282. "yAxis": {
  10283. "disableGrid": false,
  10284. "gridType": "dash" },
  10285. "legend": {},
  10286. "extra": {
  10287. "scatter": {} } },
  10288. "bubble": {
  10289. "type": "bubble",
  10290. "color": color,
  10291. "padding": [15, 15, 0, 15],
  10292. "xAxis": {
  10293. "disableGrid": false,
  10294. "gridType": "dash",
  10295. "splitNumber": 5,
  10296. "boundaryGap": "justify",
  10297. "min": 0,
  10298. "max": 250 },
  10299. "yAxis": {
  10300. "disableGrid": false,
  10301. "gridType": "dash",
  10302. "data": [{
  10303. "min": 0,
  10304. "max": 150 }] },
  10305. "legend": {},
  10306. "extra": {
  10307. "bubble": {
  10308. "border": 2,
  10309. "opacity": 0.5 } } } };var _default =
  10310. cfu;exports.default = _default;
  10311. /***/ }),
  10312. /***/ 12:
  10313. /*!********************************************************!*\
  10314. !*** D:/hongxing/iot-platform-app/commons/commons.css ***!
  10315. \********************************************************/
  10316. /*! no static exports found */
  10317. /***/ (function(module, exports, __webpack_require__) {
  10318. // extracted by mini-css-extract-plugin
  10319. if(false) { var cssReload; }
  10320. /***/ }),
  10321. /***/ 13:
  10322. /*!*************************************************!*\
  10323. !*** D:/hongxing/iot-platform-app/util/http.js ***!
  10324. \*************************************************/
  10325. /*! no static exports found */
  10326. /***/ (function(module, exports, __webpack_require__) {
  10327. "use strict";
  10328. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.get = get;exports.post = post;exports.default = void 0;var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 4));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  10329. //const BASE_URL = 'https://ymt.prpiano.com/api'
  10330. //const BASE_URL = 'https://ht.test.prpiano.com/api'
  10331. //xw
  10332. //const BASE_URL = 'http://10.0.52.100:82'
  10333. //dh
  10334. var BASE_URL;
  10335. //lb
  10336. //const BASE_URL = 'http://10.0.126.219:82'
  10337. if (true) {
  10338. BASE_URL = 'https://wmswx.adprintingplus.com/api';
  10339. //BASE_URL = 'http://192.168.1.175:8188'
  10340. } else {}
  10341. /**
  10342. * 封装get方法
  10343. * @param url
  10344. * @param data
  10345. * @returns {Promise}
  10346. */
  10347. function get(url) {var req = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10348. return new Promise(function (resolve, reject) {
  10349. if (_vue.default.prototype.$token) {
  10350. var hander = {
  10351. 'Authorization': _vue.default.prototype.$token };
  10352. } else {
  10353. var hander = {};
  10354. }
  10355. uni.request({
  10356. url: BASE_URL + url,
  10357. data: req,
  10358. method: 'GET',
  10359. header: hander,
  10360. success: function success(res) {
  10361. resolve(res.data);
  10362. },
  10363. fail: function fail(err) {
  10364. return Promise.reject(err);
  10365. } });
  10366. });
  10367. }
  10368. /**
  10369. * 封装post请求
  10370. * @param url
  10371. * @param data
  10372. * @returns {Promise}
  10373. */
  10374. var urlList = [];
  10375. function post(url) {var req = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10376. if (urlList.indexOf(url) == -1 || url == '/wx/inventory/selectFabricWTypeDetails' || '/wx/inventory/selectInkEW') {
  10377. urlList.push(url);
  10378. setTimeout(function () {
  10379. urlList.splice(urlList.indexOf(url), 1);
  10380. }, 500);
  10381. } else {
  10382. return Promise.reject('请勿频繁提交');
  10383. }
  10384. return new Promise(function (resolve, reject) {
  10385. if (_vue.default.prototype.$token) {
  10386. var hander = {
  10387. 'Authorization': _vue.default.prototype.$token };
  10388. } else {
  10389. var hander = {};
  10390. }
  10391. uni.request({
  10392. url: BASE_URL + url,
  10393. data: req,
  10394. method: 'POST',
  10395. header: hander,
  10396. success: function success(res) {
  10397. console.log(res);
  10398. if (res.data.code == 401) {
  10399. uni.showToast({
  10400. icon: "error",
  10401. title: '前往登录',
  10402. duration: 2000 });
  10403. _vue.default.prototype.$token = null;
  10404. uni.redirectTo({
  10405. url: "/pages/user/login" });
  10406. } else if (res.data.code == 500) {
  10407. uni.showToast({
  10408. icon: "error",
  10409. title: res.data.msg,
  10410. duration: 2000 });
  10411. } else if (res.data.code == 200) {
  10412. resolve(res.data);
  10413. } else if (!res.data.code) {
  10414. uni.showToast({
  10415. icon: "error",
  10416. title: '服务器错误',
  10417. duration: 2000 });
  10418. } else {
  10419. uni.showToast({
  10420. icon: "error",
  10421. title: res.data.msg,
  10422. duration: 2000 });
  10423. }
  10424. },
  10425. fail: function fail(err) {
  10426. uni.showToast({
  10427. icon: "error",
  10428. title: '服务器错误',
  10429. duration: 2000 });
  10430. return Promise.reject(err);
  10431. } });
  10432. });
  10433. }var _default =
  10434. {
  10435. post: post,
  10436. get: get };exports.default = _default;
  10437. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  10438. /***/ }),
  10439. /***/ 2:
  10440. /*!***********************************!*\
  10441. !*** (webpack)/buildin/global.js ***!
  10442. \***********************************/
  10443. /*! no static exports found */
  10444. /***/ (function(module, exports) {
  10445. var g;
  10446. // This works in non-strict mode
  10447. g = (function() {
  10448. return this;
  10449. })();
  10450. try {
  10451. // This works if eval is allowed (see CSP)
  10452. g = g || new Function("return this")();
  10453. } catch (e) {
  10454. // This works if the window reference is available
  10455. if (typeof window === "object") g = window;
  10456. }
  10457. // g can still be undefined, but nothing to do about it...
  10458. // We return undefined, instead of nothing here, so it's
  10459. // easier to handle this case. if(!global) { ...}
  10460. module.exports = g;
  10461. /***/ }),
  10462. /***/ 20:
  10463. /*!**********************************************************!*\
  10464. !*** D:/hongxing/iot-platform-app/util/cacheConstant.js ***!
  10465. \**********************************************************/
  10466. /*! no static exports found */
  10467. /***/ (function(module, exports, __webpack_require__) {
  10468. "use strict";
  10469. Object.defineProperty(exports, "__esModule", { value: true });exports.OPENID = exports.TOKEN_NAME = void 0; // 记录微信本地缓存key
  10470. var TOKEN_NAME = 'Authorization';exports.TOKEN_NAME = TOKEN_NAME;
  10471. var OPENID = 'openid';exports.OPENID = OPENID;
  10472. /***/ }),
  10473. /***/ 21:
  10474. /*!************************************************!*\
  10475. !*** D:/hongxing/iot-platform-app/util/api.js ***!
  10476. \************************************************/
  10477. /*! no static exports found */
  10478. /***/ (function(module, exports, __webpack_require__) {
  10479. "use strict";
  10480. Object.defineProperty(exports, "__esModule", { value: true });exports.isBind = isBind;exports.getInfo = getInfo;exports.usernameLogin = usernameLogin;exports.getMaterialGroupList = getMaterialGroupList;exports.getPurchaseByMaterialIdList = getPurchaseByMaterialIdList;exports.addBatch = addBatch;
  10481. var _request = __webpack_require__(/*! ./request.js */ 22); // 后端接口集合
  10482. // 查看微信用户是否绑定管理系统
  10483. function isBind(data) {
  10484. return (0, _request.request)("/wx/login/isBind", data);
  10485. }
  10486. // 获取用户基本信息(菜单访问权限,用户id,用户名,角色权限字符)
  10487. function getInfo(data) {
  10488. return (0, _request.request)("/wx/login/getUserInfo", data);
  10489. }
  10490. // 用户名、密码、openid登录
  10491. function usernameLogin(data) {
  10492. return (0, _request.request)("/wx/login/usernameLogin", data);
  10493. }
  10494. // 生成二维码列表
  10495. function getMaterialGroupList(data) {
  10496. return (0, _request.request)("/wx/createQrcode/getMaterialGroupList", data);
  10497. }
  10498. // 选择入库单页面列表
  10499. function getPurchaseByMaterialIdList(data) {
  10500. return (0, _request.request)("/wx/createQrcode/getPurchaseByMaterialIdList", data);
  10501. }
  10502. // 添加二维码
  10503. function addBatch(data) {
  10504. return (0, _request.request)("/wx/createQrcode/addBatch", data);
  10505. }
  10506. /***/ }),
  10507. /***/ 22:
  10508. /*!****************************************************!*\
  10509. !*** D:/hongxing/iot-platform-app/util/request.js ***!
  10510. \****************************************************/
  10511. /*! no static exports found */
  10512. /***/ (function(module, exports, __webpack_require__) {
  10513. "use strict";
  10514. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.request = request;
  10515. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 4));
  10516. var _cacheConstant = __webpack_require__(/*! ./cacheConstant */ 20);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} // 请求后端服务器工具类
  10517. var baseURL = "http://114.115.167.11:8081/api";
  10518. function request(url, data, method) {
  10519. console.log(url, data, method);
  10520. // 赋值token
  10521. var token = _vue.default.prototype.$token;
  10522. console.log();
  10523. console.log(!token);
  10524. if (token) {
  10525. var hander = {
  10526. 'Authorization': _vue.default.prototype.$token };
  10527. } else {
  10528. var hander = {};
  10529. }
  10530. // 默认执行get方法
  10531. method = method === undefined ? 'post' : method;
  10532. wx.showNavigationBarLoading();
  10533. return new Promise(function (resove, reject) {
  10534. uni.request({
  10535. url: baseURL + url,
  10536. method: method,
  10537. data: data,
  10538. header: hander,
  10539. success: function success(res) {
  10540. var data = res.data;
  10541. // 对错误进行拦截提示
  10542. if (data.code != 200) {
  10543. uni.showToast({
  10544. title: data.msg,
  10545. icon: 'none',
  10546. duration: 2000 });
  10547. reject();
  10548. }
  10549. resove(data.data);
  10550. },
  10551. fail: function fail(msg) {
  10552. console.log('请求失败=======', msg);
  10553. uni.showToast({
  10554. title: "网络异常,连接服务器失败",
  10555. icon: 'none',
  10556. duration: 2000 });
  10557. reject();
  10558. },
  10559. complete: function complete() {
  10560. uni.hideNavigationBarLoading();
  10561. } });
  10562. });
  10563. }
  10564. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  10565. /***/ }),
  10566. /***/ 3:
  10567. /*!*************************************************************!*\
  10568. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  10569. \*************************************************************/
  10570. /*! no static exports found */
  10571. /***/ (function(module, exports, __webpack_require__) {
  10572. "use strict";
  10573. /* WEBPACK VAR INJECTION */(function(uni, global) {Object.defineProperty(exports, "__esModule", { value: true });exports.compileI18nJsonStr = compileI18nJsonStr;exports.hasI18nJson = hasI18nJson;exports.initVueI18n = initVueI18n;exports.isI18nStr = isI18nStr;exports.normalizeLocale = normalizeLocale;exports.parseI18nJson = parseI18nJson;exports.resolveLocale = resolveLocale;exports.isString = exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}var isArray = Array.isArray;
  10574. var isObject = function isObject(val) {return val !== null && typeof val === 'object';};
  10575. var defaultDelimiters = ['{', '}'];var
  10576. BaseFormatter = /*#__PURE__*/function () {
  10577. function BaseFormatter() {_classCallCheck(this, BaseFormatter);
  10578. this._caches = Object.create(null);
  10579. }_createClass(BaseFormatter, [{ key: "interpolate", value: function interpolate(
  10580. message, values) {var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  10581. if (!values) {
  10582. return [message];
  10583. }
  10584. var tokens = this._caches[message];
  10585. if (!tokens) {
  10586. tokens = parse(message, delimiters);
  10587. this._caches[message] = tokens;
  10588. }
  10589. return compile(tokens, values);
  10590. } }]);return BaseFormatter;}();exports.Formatter = BaseFormatter;
  10591. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  10592. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  10593. function parse(format, _ref) {var _ref2 = _slicedToArray(_ref, 2),startDelimiter = _ref2[0],endDelimiter = _ref2[1];
  10594. var tokens = [];
  10595. var position = 0;
  10596. var text = '';
  10597. while (position < format.length) {
  10598. var char = format[position++];
  10599. if (char === startDelimiter) {
  10600. if (text) {
  10601. tokens.push({ type: 'text', value: text });
  10602. }
  10603. text = '';
  10604. var sub = '';
  10605. char = format[position++];
  10606. while (char !== undefined && char !== endDelimiter) {
  10607. sub += char;
  10608. char = format[position++];
  10609. }
  10610. var isClosed = char === endDelimiter;
  10611. var type = RE_TOKEN_LIST_VALUE.test(sub) ?
  10612. 'list' :
  10613. isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ?
  10614. 'named' :
  10615. 'unknown';
  10616. tokens.push({ value: sub, type: type });
  10617. }
  10618. // else if (char === '%') {
  10619. // // when found rails i18n syntax, skip text capture
  10620. // if (format[position] !== '{') {
  10621. // text += char
  10622. // }
  10623. // }
  10624. else {
  10625. text += char;
  10626. }
  10627. }
  10628. text && tokens.push({ type: 'text', value: text });
  10629. return tokens;
  10630. }
  10631. function compile(tokens, values) {
  10632. var compiled = [];
  10633. var index = 0;
  10634. var mode = isArray(values) ?
  10635. 'list' :
  10636. isObject(values) ?
  10637. 'named' :
  10638. 'unknown';
  10639. if (mode === 'unknown') {
  10640. return compiled;
  10641. }
  10642. while (index < tokens.length) {
  10643. var token = tokens[index];
  10644. switch (token.type) {
  10645. case 'text':
  10646. compiled.push(token.value);
  10647. break;
  10648. case 'list':
  10649. compiled.push(values[parseInt(token.value, 10)]);
  10650. break;
  10651. case 'named':
  10652. if (mode === 'named') {
  10653. compiled.push(values[token.value]);
  10654. } else
  10655. {
  10656. if (true) {
  10657. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  10658. }
  10659. }
  10660. break;
  10661. case 'unknown':
  10662. if (true) {
  10663. console.warn("Detect 'unknown' type of token!");
  10664. }
  10665. break;}
  10666. index++;
  10667. }
  10668. return compiled;
  10669. }
  10670. var LOCALE_ZH_HANS = 'zh-Hans';exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  10671. var LOCALE_ZH_HANT = 'zh-Hant';exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  10672. var LOCALE_EN = 'en';exports.LOCALE_EN = LOCALE_EN;
  10673. var LOCALE_FR = 'fr';exports.LOCALE_FR = LOCALE_FR;
  10674. var LOCALE_ES = 'es';exports.LOCALE_ES = LOCALE_ES;
  10675. var hasOwnProperty = Object.prototype.hasOwnProperty;
  10676. var hasOwn = function hasOwn(val, key) {return hasOwnProperty.call(val, key);};
  10677. var defaultFormatter = new BaseFormatter();
  10678. function include(str, parts) {
  10679. return !!parts.find(function (part) {return str.indexOf(part) !== -1;});
  10680. }
  10681. function startsWith(str, parts) {
  10682. return parts.find(function (part) {return str.indexOf(part) === 0;});
  10683. }
  10684. function normalizeLocale(locale, messages) {
  10685. if (!locale) {
  10686. return;
  10687. }
  10688. locale = locale.trim().replace(/_/g, '-');
  10689. if (messages && messages[locale]) {
  10690. return locale;
  10691. }
  10692. locale = locale.toLowerCase();
  10693. if (locale.indexOf('zh') === 0) {
  10694. if (locale.indexOf('-hans') > -1) {
  10695. return LOCALE_ZH_HANS;
  10696. }
  10697. if (locale.indexOf('-hant') > -1) {
  10698. return LOCALE_ZH_HANT;
  10699. }
  10700. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  10701. return LOCALE_ZH_HANT;
  10702. }
  10703. return LOCALE_ZH_HANS;
  10704. }
  10705. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  10706. if (lang) {
  10707. return lang;
  10708. }
  10709. }var
  10710. I18n = /*#__PURE__*/function () {
  10711. function I18n(_ref3) {var locale = _ref3.locale,fallbackLocale = _ref3.fallbackLocale,messages = _ref3.messages,watcher = _ref3.watcher,formater = _ref3.formater;_classCallCheck(this, I18n);
  10712. this.locale = LOCALE_EN;
  10713. this.fallbackLocale = LOCALE_EN;
  10714. this.message = {};
  10715. this.messages = {};
  10716. this.watchers = [];
  10717. if (fallbackLocale) {
  10718. this.fallbackLocale = fallbackLocale;
  10719. }
  10720. this.formater = formater || defaultFormatter;
  10721. this.messages = messages || {};
  10722. this.setLocale(locale || LOCALE_EN);
  10723. if (watcher) {
  10724. this.watchLocale(watcher);
  10725. }
  10726. }_createClass(I18n, [{ key: "setLocale", value: function setLocale(
  10727. locale) {var _this = this;
  10728. var oldLocale = this.locale;
  10729. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  10730. if (!this.messages[this.locale]) {
  10731. // 可能初始化时不存在
  10732. this.messages[this.locale] = {};
  10733. }
  10734. this.message = this.messages[this.locale];
  10735. // 仅发生变化时,通知
  10736. if (oldLocale !== this.locale) {
  10737. this.watchers.forEach(function (watcher) {
  10738. watcher(_this.locale, oldLocale);
  10739. });
  10740. }
  10741. } }, { key: "getLocale", value: function getLocale()
  10742. {
  10743. return this.locale;
  10744. } }, { key: "watchLocale", value: function watchLocale(
  10745. fn) {var _this2 = this;
  10746. var index = this.watchers.push(fn) - 1;
  10747. return function () {
  10748. _this2.watchers.splice(index, 1);
  10749. };
  10750. } }, { key: "add", value: function add(
  10751. locale, message) {var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  10752. var curMessages = this.messages[locale];
  10753. if (curMessages) {
  10754. if (override) {
  10755. Object.assign(curMessages, message);
  10756. } else
  10757. {
  10758. Object.keys(message).forEach(function (key) {
  10759. if (!hasOwn(curMessages, key)) {
  10760. curMessages[key] = message[key];
  10761. }
  10762. });
  10763. }
  10764. } else
  10765. {
  10766. this.messages[locale] = message;
  10767. }
  10768. } }, { key: "f", value: function f(
  10769. message, values, delimiters) {
  10770. return this.formater.interpolate(message, values, delimiters).join('');
  10771. } }, { key: "t", value: function t(
  10772. key, locale, values) {
  10773. var message = this.message;
  10774. if (typeof locale === 'string') {
  10775. locale = normalizeLocale(locale, this.messages);
  10776. locale && (message = this.messages[locale]);
  10777. } else
  10778. {
  10779. values = locale;
  10780. }
  10781. if (!hasOwn(message, key)) {
  10782. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  10783. return key;
  10784. }
  10785. return this.formater.interpolate(message[key], values).join('');
  10786. } }]);return I18n;}();exports.I18n = I18n;
  10787. function watchAppLocale(appVm, i18n) {
  10788. // 需要保证 watch 的触发在组件渲染之前
  10789. if (appVm.$watchLocale) {
  10790. // vue2
  10791. appVm.$watchLocale(function (newLocale) {
  10792. i18n.setLocale(newLocale);
  10793. });
  10794. } else
  10795. {
  10796. appVm.$watch(function () {return appVm.$locale;}, function (newLocale) {
  10797. i18n.setLocale(newLocale);
  10798. });
  10799. }
  10800. }
  10801. function getDefaultLocale() {
  10802. if (typeof uni !== 'undefined' && uni.getLocale) {
  10803. return uni.getLocale();
  10804. }
  10805. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  10806. if (typeof global !== 'undefined' && global.getLocale) {
  10807. return global.getLocale();
  10808. }
  10809. return LOCALE_EN;
  10810. }
  10811. function initVueI18n(locale) {var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;var watcher = arguments.length > 3 ? arguments[3] : undefined;
  10812. // 兼容旧版本入参
  10813. if (typeof locale !== 'string') {var _ref4 =
  10814. [
  10815. messages,
  10816. locale];locale = _ref4[0];messages = _ref4[1];
  10817. }
  10818. if (typeof locale !== 'string') {
  10819. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  10820. locale = getDefaultLocale();
  10821. }
  10822. if (typeof fallbackLocale !== 'string') {
  10823. fallbackLocale =
  10824. typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale ||
  10825. LOCALE_EN;
  10826. }
  10827. var i18n = new I18n({
  10828. locale: locale,
  10829. fallbackLocale: fallbackLocale,
  10830. messages: messages,
  10831. watcher: watcher });
  10832. var _t = function t(key, values) {
  10833. if (typeof getApp !== 'function') {
  10834. // app view
  10835. /* eslint-disable no-func-assign */
  10836. _t = function t(key, values) {
  10837. return i18n.t(key, values);
  10838. };
  10839. } else
  10840. {
  10841. var isWatchedAppLocale = false;
  10842. _t = function t(key, values) {
  10843. var appVm = getApp().$vm;
  10844. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  10845. // options: {
  10846. // type: Array,
  10847. // default () {
  10848. // return [{
  10849. // icon: 'shop',
  10850. // text: t("uni-goods-nav.options.shop"),
  10851. // }, {
  10852. // icon: 'cart',
  10853. // text: t("uni-goods-nav.options.cart")
  10854. // }]
  10855. // }
  10856. // },
  10857. if (appVm) {
  10858. // 触发响应式
  10859. appVm.$locale;
  10860. if (!isWatchedAppLocale) {
  10861. isWatchedAppLocale = true;
  10862. watchAppLocale(appVm, i18n);
  10863. }
  10864. }
  10865. return i18n.t(key, values);
  10866. };
  10867. }
  10868. return _t(key, values);
  10869. };
  10870. return {
  10871. i18n: i18n,
  10872. f: function f(message, values, delimiters) {
  10873. return i18n.f(message, values, delimiters);
  10874. },
  10875. t: function t(key, values) {
  10876. return _t(key, values);
  10877. },
  10878. add: function add(locale, message) {var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  10879. return i18n.add(locale, message, override);
  10880. },
  10881. watch: function watch(fn) {
  10882. return i18n.watchLocale(fn);
  10883. },
  10884. getLocale: function getLocale() {
  10885. return i18n.getLocale();
  10886. },
  10887. setLocale: function setLocale(newLocale) {
  10888. return i18n.setLocale(newLocale);
  10889. } };
  10890. }
  10891. var isString = function isString(val) {return typeof val === 'string';};exports.isString = isString;
  10892. var formater;
  10893. function hasI18nJson(jsonObj, delimiters) {
  10894. if (!formater) {
  10895. formater = new BaseFormatter();
  10896. }
  10897. return walkJsonObj(jsonObj, function (jsonObj, key) {
  10898. var value = jsonObj[key];
  10899. if (isString(value)) {
  10900. if (isI18nStr(value, delimiters)) {
  10901. return true;
  10902. }
  10903. } else
  10904. {
  10905. return hasI18nJson(value, delimiters);
  10906. }
  10907. });
  10908. }
  10909. function parseI18nJson(jsonObj, values, delimiters) {
  10910. if (!formater) {
  10911. formater = new BaseFormatter();
  10912. }
  10913. walkJsonObj(jsonObj, function (jsonObj, key) {
  10914. var value = jsonObj[key];
  10915. if (isString(value)) {
  10916. if (isI18nStr(value, delimiters)) {
  10917. jsonObj[key] = compileStr(value, values, delimiters);
  10918. }
  10919. } else
  10920. {
  10921. parseI18nJson(value, values, delimiters);
  10922. }
  10923. });
  10924. return jsonObj;
  10925. }
  10926. function compileI18nJsonStr(jsonStr, _ref5) {var locale = _ref5.locale,locales = _ref5.locales,delimiters = _ref5.delimiters;
  10927. if (!isI18nStr(jsonStr, delimiters)) {
  10928. return jsonStr;
  10929. }
  10930. if (!formater) {
  10931. formater = new BaseFormatter();
  10932. }
  10933. var localeValues = [];
  10934. Object.keys(locales).forEach(function (name) {
  10935. if (name !== locale) {
  10936. localeValues.push({
  10937. locale: name,
  10938. values: locales[name] });
  10939. }
  10940. });
  10941. localeValues.unshift({ locale: locale, values: locales[locale] });
  10942. try {
  10943. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  10944. }
  10945. catch (e) {}
  10946. return jsonStr;
  10947. }
  10948. function isI18nStr(value, delimiters) {
  10949. return value.indexOf(delimiters[0]) > -1;
  10950. }
  10951. function compileStr(value, values, delimiters) {
  10952. return formater.interpolate(value, values, delimiters).join('');
  10953. }
  10954. function compileValue(jsonObj, key, localeValues, delimiters) {
  10955. var value = jsonObj[key];
  10956. if (isString(value)) {
  10957. // 存在国际化
  10958. if (isI18nStr(value, delimiters)) {
  10959. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  10960. if (localeValues.length > 1) {
  10961. // 格式化国际化语言
  10962. var valueLocales = jsonObj[key + 'Locales'] = {};
  10963. localeValues.forEach(function (localValue) {
  10964. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  10965. });
  10966. }
  10967. }
  10968. } else
  10969. {
  10970. compileJsonObj(value, localeValues, delimiters);
  10971. }
  10972. }
  10973. function compileJsonObj(jsonObj, localeValues, delimiters) {
  10974. walkJsonObj(jsonObj, function (jsonObj, key) {
  10975. compileValue(jsonObj, key, localeValues, delimiters);
  10976. });
  10977. return jsonObj;
  10978. }
  10979. function walkJsonObj(jsonObj, walk) {
  10980. if (isArray(jsonObj)) {
  10981. for (var i = 0; i < jsonObj.length; i++) {
  10982. if (walk(jsonObj, i)) {
  10983. return true;
  10984. }
  10985. }
  10986. } else
  10987. if (isObject(jsonObj)) {
  10988. for (var key in jsonObj) {
  10989. if (walk(jsonObj, key)) {
  10990. return true;
  10991. }
  10992. }
  10993. }
  10994. return false;
  10995. }
  10996. function resolveLocale(locales) {
  10997. return function (locale) {
  10998. if (!locale) {
  10999. return locale;
  11000. }
  11001. locale = normalizeLocale(locale) || locale;
  11002. return resolveLocaleChain(locale).find(function (locale) {return locales.indexOf(locale) > -1;});
  11003. };
  11004. }
  11005. function resolveLocaleChain(locale) {
  11006. var chain = [];
  11007. var tokens = locale.split('-');
  11008. while (tokens.length) {
  11009. chain.push(tokens.join('-'));
  11010. tokens.pop();
  11011. }
  11012. return chain;
  11013. }
  11014. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 2)))
  11015. /***/ }),
  11016. /***/ 4:
  11017. /*!******************************************************************************************!*\
  11018. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  11019. \******************************************************************************************/
  11020. /*! exports provided: default */
  11021. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11022. "use strict";
  11023. __webpack_require__.r(__webpack_exports__);
  11024. /* WEBPACK VAR INJECTION */(function(global) {/*!
  11025. * Vue.js v2.6.11
  11026. * (c) 2014-2022 Evan You
  11027. * Released under the MIT License.
  11028. */
  11029. /* */
  11030. var emptyObject = Object.freeze({});
  11031. // These helpers produce better VM code in JS engines due to their
  11032. // explicitness and function inlining.
  11033. function isUndef (v) {
  11034. return v === undefined || v === null
  11035. }
  11036. function isDef (v) {
  11037. return v !== undefined && v !== null
  11038. }
  11039. function isTrue (v) {
  11040. return v === true
  11041. }
  11042. function isFalse (v) {
  11043. return v === false
  11044. }
  11045. /**
  11046. * Check if value is primitive.
  11047. */
  11048. function isPrimitive (value) {
  11049. return (
  11050. typeof value === 'string' ||
  11051. typeof value === 'number' ||
  11052. // $flow-disable-line
  11053. typeof value === 'symbol' ||
  11054. typeof value === 'boolean'
  11055. )
  11056. }
  11057. /**
  11058. * Quick object check - this is primarily used to tell
  11059. * Objects from primitive values when we know the value
  11060. * is a JSON-compliant type.
  11061. */
  11062. function isObject (obj) {
  11063. return obj !== null && typeof obj === 'object'
  11064. }
  11065. /**
  11066. * Get the raw type string of a value, e.g., [object Object].
  11067. */
  11068. var _toString = Object.prototype.toString;
  11069. function toRawType (value) {
  11070. return _toString.call(value).slice(8, -1)
  11071. }
  11072. /**
  11073. * Strict object type check. Only returns true
  11074. * for plain JavaScript objects.
  11075. */
  11076. function isPlainObject (obj) {
  11077. return _toString.call(obj) === '[object Object]'
  11078. }
  11079. function isRegExp (v) {
  11080. return _toString.call(v) === '[object RegExp]'
  11081. }
  11082. /**
  11083. * Check if val is a valid array index.
  11084. */
  11085. function isValidArrayIndex (val) {
  11086. var n = parseFloat(String(val));
  11087. return n >= 0 && Math.floor(n) === n && isFinite(val)
  11088. }
  11089. function isPromise (val) {
  11090. return (
  11091. isDef(val) &&
  11092. typeof val.then === 'function' &&
  11093. typeof val.catch === 'function'
  11094. )
  11095. }
  11096. /**
  11097. * Convert a value to a string that is actually rendered.
  11098. */
  11099. function toString (val) {
  11100. return val == null
  11101. ? ''
  11102. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  11103. ? JSON.stringify(val, null, 2)
  11104. : String(val)
  11105. }
  11106. /**
  11107. * Convert an input value to a number for persistence.
  11108. * If the conversion fails, return original string.
  11109. */
  11110. function toNumber (val) {
  11111. var n = parseFloat(val);
  11112. return isNaN(n) ? val : n
  11113. }
  11114. /**
  11115. * Make a map and return a function for checking if a key
  11116. * is in that map.
  11117. */
  11118. function makeMap (
  11119. str,
  11120. expectsLowerCase
  11121. ) {
  11122. var map = Object.create(null);
  11123. var list = str.split(',');
  11124. for (var i = 0; i < list.length; i++) {
  11125. map[list[i]] = true;
  11126. }
  11127. return expectsLowerCase
  11128. ? function (val) { return map[val.toLowerCase()]; }
  11129. : function (val) { return map[val]; }
  11130. }
  11131. /**
  11132. * Check if a tag is a built-in tag.
  11133. */
  11134. var isBuiltInTag = makeMap('slot,component', true);
  11135. /**
  11136. * Check if an attribute is a reserved attribute.
  11137. */
  11138. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  11139. /**
  11140. * Remove an item from an array.
  11141. */
  11142. function remove (arr, item) {
  11143. if (arr.length) {
  11144. var index = arr.indexOf(item);
  11145. if (index > -1) {
  11146. return arr.splice(index, 1)
  11147. }
  11148. }
  11149. }
  11150. /**
  11151. * Check whether an object has the property.
  11152. */
  11153. var hasOwnProperty = Object.prototype.hasOwnProperty;
  11154. function hasOwn (obj, key) {
  11155. return hasOwnProperty.call(obj, key)
  11156. }
  11157. /**
  11158. * Create a cached version of a pure function.
  11159. */
  11160. function cached (fn) {
  11161. var cache = Object.create(null);
  11162. return (function cachedFn (str) {
  11163. var hit = cache[str];
  11164. return hit || (cache[str] = fn(str))
  11165. })
  11166. }
  11167. /**
  11168. * Camelize a hyphen-delimited string.
  11169. */
  11170. var camelizeRE = /-(\w)/g;
  11171. var camelize = cached(function (str) {
  11172. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  11173. });
  11174. /**
  11175. * Capitalize a string.
  11176. */
  11177. var capitalize = cached(function (str) {
  11178. return str.charAt(0).toUpperCase() + str.slice(1)
  11179. });
  11180. /**
  11181. * Hyphenate a camelCase string.
  11182. */
  11183. var hyphenateRE = /\B([A-Z])/g;
  11184. var hyphenate = cached(function (str) {
  11185. return str.replace(hyphenateRE, '-$1').toLowerCase()
  11186. });
  11187. /**
  11188. * Simple bind polyfill for environments that do not support it,
  11189. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  11190. * since native bind is now performant enough in most browsers.
  11191. * But removing it would mean breaking code that was able to run in
  11192. * PhantomJS 1.x, so this must be kept for backward compatibility.
  11193. */
  11194. /* istanbul ignore next */
  11195. function polyfillBind (fn, ctx) {
  11196. function boundFn (a) {
  11197. var l = arguments.length;
  11198. return l
  11199. ? l > 1
  11200. ? fn.apply(ctx, arguments)
  11201. : fn.call(ctx, a)
  11202. : fn.call(ctx)
  11203. }
  11204. boundFn._length = fn.length;
  11205. return boundFn
  11206. }
  11207. function nativeBind (fn, ctx) {
  11208. return fn.bind(ctx)
  11209. }
  11210. var bind = Function.prototype.bind
  11211. ? nativeBind
  11212. : polyfillBind;
  11213. /**
  11214. * Convert an Array-like object to a real Array.
  11215. */
  11216. function toArray (list, start) {
  11217. start = start || 0;
  11218. var i = list.length - start;
  11219. var ret = new Array(i);
  11220. while (i--) {
  11221. ret[i] = list[i + start];
  11222. }
  11223. return ret
  11224. }
  11225. /**
  11226. * Mix properties into target object.
  11227. */
  11228. function extend (to, _from) {
  11229. for (var key in _from) {
  11230. to[key] = _from[key];
  11231. }
  11232. return to
  11233. }
  11234. /**
  11235. * Merge an Array of Objects into a single Object.
  11236. */
  11237. function toObject (arr) {
  11238. var res = {};
  11239. for (var i = 0; i < arr.length; i++) {
  11240. if (arr[i]) {
  11241. extend(res, arr[i]);
  11242. }
  11243. }
  11244. return res
  11245. }
  11246. /* eslint-disable no-unused-vars */
  11247. /**
  11248. * Perform no operation.
  11249. * Stubbing args to make Flow happy without leaving useless transpiled code
  11250. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  11251. */
  11252. function noop (a, b, c) {}
  11253. /**
  11254. * Always return false.
  11255. */
  11256. var no = function (a, b, c) { return false; };
  11257. /* eslint-enable no-unused-vars */
  11258. /**
  11259. * Return the same value.
  11260. */
  11261. var identity = function (_) { return _; };
  11262. /**
  11263. * Check if two values are loosely equal - that is,
  11264. * if they are plain objects, do they have the same shape?
  11265. */
  11266. function looseEqual (a, b) {
  11267. if (a === b) { return true }
  11268. var isObjectA = isObject(a);
  11269. var isObjectB = isObject(b);
  11270. if (isObjectA && isObjectB) {
  11271. try {
  11272. var isArrayA = Array.isArray(a);
  11273. var isArrayB = Array.isArray(b);
  11274. if (isArrayA && isArrayB) {
  11275. return a.length === b.length && a.every(function (e, i) {
  11276. return looseEqual(e, b[i])
  11277. })
  11278. } else if (a instanceof Date && b instanceof Date) {
  11279. return a.getTime() === b.getTime()
  11280. } else if (!isArrayA && !isArrayB) {
  11281. var keysA = Object.keys(a);
  11282. var keysB = Object.keys(b);
  11283. return keysA.length === keysB.length && keysA.every(function (key) {
  11284. return looseEqual(a[key], b[key])
  11285. })
  11286. } else {
  11287. /* istanbul ignore next */
  11288. return false
  11289. }
  11290. } catch (e) {
  11291. /* istanbul ignore next */
  11292. return false
  11293. }
  11294. } else if (!isObjectA && !isObjectB) {
  11295. return String(a) === String(b)
  11296. } else {
  11297. return false
  11298. }
  11299. }
  11300. /**
  11301. * Return the first index at which a loosely equal value can be
  11302. * found in the array (if value is a plain object, the array must
  11303. * contain an object of the same shape), or -1 if it is not present.
  11304. */
  11305. function looseIndexOf (arr, val) {
  11306. for (var i = 0; i < arr.length; i++) {
  11307. if (looseEqual(arr[i], val)) { return i }
  11308. }
  11309. return -1
  11310. }
  11311. /**
  11312. * Ensure a function is called only once.
  11313. */
  11314. function once (fn) {
  11315. var called = false;
  11316. return function () {
  11317. if (!called) {
  11318. called = true;
  11319. fn.apply(this, arguments);
  11320. }
  11321. }
  11322. }
  11323. var ASSET_TYPES = [
  11324. 'component',
  11325. 'directive',
  11326. 'filter'
  11327. ];
  11328. var LIFECYCLE_HOOKS = [
  11329. 'beforeCreate',
  11330. 'created',
  11331. 'beforeMount',
  11332. 'mounted',
  11333. 'beforeUpdate',
  11334. 'updated',
  11335. 'beforeDestroy',
  11336. 'destroyed',
  11337. 'activated',
  11338. 'deactivated',
  11339. 'errorCaptured',
  11340. 'serverPrefetch'
  11341. ];
  11342. /* */
  11343. var config = ({
  11344. /**
  11345. * Option merge strategies (used in core/util/options)
  11346. */
  11347. // $flow-disable-line
  11348. optionMergeStrategies: Object.create(null),
  11349. /**
  11350. * Whether to suppress warnings.
  11351. */
  11352. silent: false,
  11353. /**
  11354. * Show production mode tip message on boot?
  11355. */
  11356. productionTip: "development" !== 'production',
  11357. /**
  11358. * Whether to enable devtools
  11359. */
  11360. devtools: "development" !== 'production',
  11361. /**
  11362. * Whether to record perf
  11363. */
  11364. performance: false,
  11365. /**
  11366. * Error handler for watcher errors
  11367. */
  11368. errorHandler: null,
  11369. /**
  11370. * Warn handler for watcher warns
  11371. */
  11372. warnHandler: null,
  11373. /**
  11374. * Ignore certain custom elements
  11375. */
  11376. ignoredElements: [],
  11377. /**
  11378. * Custom user key aliases for v-on
  11379. */
  11380. // $flow-disable-line
  11381. keyCodes: Object.create(null),
  11382. /**
  11383. * Check if a tag is reserved so that it cannot be registered as a
  11384. * component. This is platform-dependent and may be overwritten.
  11385. */
  11386. isReservedTag: no,
  11387. /**
  11388. * Check if an attribute is reserved so that it cannot be used as a component
  11389. * prop. This is platform-dependent and may be overwritten.
  11390. */
  11391. isReservedAttr: no,
  11392. /**
  11393. * Check if a tag is an unknown element.
  11394. * Platform-dependent.
  11395. */
  11396. isUnknownElement: no,
  11397. /**
  11398. * Get the namespace of an element
  11399. */
  11400. getTagNamespace: noop,
  11401. /**
  11402. * Parse the real tag name for the specific platform.
  11403. */
  11404. parsePlatformTagName: identity,
  11405. /**
  11406. * Check if an attribute must be bound using property, e.g. value
  11407. * Platform-dependent.
  11408. */
  11409. mustUseProp: no,
  11410. /**
  11411. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  11412. * This will significantly reduce performance if set to false.
  11413. */
  11414. async: true,
  11415. /**
  11416. * Exposed for legacy reasons
  11417. */
  11418. _lifecycleHooks: LIFECYCLE_HOOKS
  11419. });
  11420. /* */
  11421. /**
  11422. * unicode letters used for parsing html tags, component names and property paths.
  11423. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  11424. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  11425. */
  11426. 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/;
  11427. /**
  11428. * Check if a string starts with $ or _
  11429. */
  11430. function isReserved (str) {
  11431. var c = (str + '').charCodeAt(0);
  11432. return c === 0x24 || c === 0x5F
  11433. }
  11434. /**
  11435. * Define a property.
  11436. */
  11437. function def (obj, key, val, enumerable) {
  11438. Object.defineProperty(obj, key, {
  11439. value: val,
  11440. enumerable: !!enumerable,
  11441. writable: true,
  11442. configurable: true
  11443. });
  11444. }
  11445. /**
  11446. * Parse simple path.
  11447. */
  11448. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  11449. function parsePath (path) {
  11450. if (bailRE.test(path)) {
  11451. return
  11452. }
  11453. var segments = path.split('.');
  11454. return function (obj) {
  11455. for (var i = 0; i < segments.length; i++) {
  11456. if (!obj) { return }
  11457. obj = obj[segments[i]];
  11458. }
  11459. return obj
  11460. }
  11461. }
  11462. /* */
  11463. // can we use __proto__?
  11464. var hasProto = '__proto__' in {};
  11465. // Browser environment sniffing
  11466. var inBrowser = typeof window !== 'undefined';
  11467. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  11468. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  11469. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  11470. var isIE = UA && /msie|trident/.test(UA);
  11471. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  11472. var isEdge = UA && UA.indexOf('edge/') > 0;
  11473. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  11474. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  11475. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  11476. var isPhantomJS = UA && /phantomjs/.test(UA);
  11477. var isFF = UA && UA.match(/firefox\/(\d+)/);
  11478. // Firefox has a "watch" function on Object.prototype...
  11479. var nativeWatch = ({}).watch;
  11480. if (inBrowser) {
  11481. try {
  11482. var opts = {};
  11483. Object.defineProperty(opts, 'passive', ({
  11484. get: function get () {
  11485. }
  11486. })); // https://github.com/facebook/flow/issues/285
  11487. window.addEventListener('test-passive', null, opts);
  11488. } catch (e) {}
  11489. }
  11490. // this needs to be lazy-evaled because vue may be required before
  11491. // vue-server-renderer can set VUE_ENV
  11492. var _isServer;
  11493. var isServerRendering = function () {
  11494. if (_isServer === undefined) {
  11495. /* istanbul ignore if */
  11496. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  11497. // detect presence of vue-server-renderer and avoid
  11498. // Webpack shimming the process
  11499. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  11500. } else {
  11501. _isServer = false;
  11502. }
  11503. }
  11504. return _isServer
  11505. };
  11506. // detect devtools
  11507. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  11508. /* istanbul ignore next */
  11509. function isNative (Ctor) {
  11510. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  11511. }
  11512. var hasSymbol =
  11513. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  11514. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  11515. var _Set;
  11516. /* istanbul ignore if */ // $flow-disable-line
  11517. if (typeof Set !== 'undefined' && isNative(Set)) {
  11518. // use native Set when available.
  11519. _Set = Set;
  11520. } else {
  11521. // a non-standard Set polyfill that only works with primitive keys.
  11522. _Set = /*@__PURE__*/(function () {
  11523. function Set () {
  11524. this.set = Object.create(null);
  11525. }
  11526. Set.prototype.has = function has (key) {
  11527. return this.set[key] === true
  11528. };
  11529. Set.prototype.add = function add (key) {
  11530. this.set[key] = true;
  11531. };
  11532. Set.prototype.clear = function clear () {
  11533. this.set = Object.create(null);
  11534. };
  11535. return Set;
  11536. }());
  11537. }
  11538. /* */
  11539. var warn = noop;
  11540. var tip = noop;
  11541. var generateComponentTrace = (noop); // work around flow check
  11542. var formatComponentName = (noop);
  11543. if (true) {
  11544. var hasConsole = typeof console !== 'undefined';
  11545. var classifyRE = /(?:^|[-_])(\w)/g;
  11546. var classify = function (str) { return str
  11547. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  11548. .replace(/[-_]/g, ''); };
  11549. warn = function (msg, vm) {
  11550. var trace = vm ? generateComponentTrace(vm) : '';
  11551. if (config.warnHandler) {
  11552. config.warnHandler.call(null, msg, vm, trace);
  11553. } else if (hasConsole && (!config.silent)) {
  11554. console.error(("[Vue warn]: " + msg + trace));
  11555. }
  11556. };
  11557. tip = function (msg, vm) {
  11558. if (hasConsole && (!config.silent)) {
  11559. console.warn("[Vue tip]: " + msg + (
  11560. vm ? generateComponentTrace(vm) : ''
  11561. ));
  11562. }
  11563. };
  11564. formatComponentName = function (vm, includeFile) {
  11565. if (vm.$root === vm) {
  11566. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  11567. return ('') + vm.$options.__file
  11568. }
  11569. return '<Root>'
  11570. }
  11571. var options = typeof vm === 'function' && vm.cid != null
  11572. ? vm.options
  11573. : vm._isVue
  11574. ? vm.$options || vm.constructor.options
  11575. : vm;
  11576. var name = options.name || options._componentTag;
  11577. var file = options.__file;
  11578. if (!name && file) {
  11579. var match = file.match(/([^/\\]+)\.vue$/);
  11580. name = match && match[1];
  11581. }
  11582. return (
  11583. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  11584. (file && includeFile !== false ? (" at " + file) : '')
  11585. )
  11586. };
  11587. var repeat = function (str, n) {
  11588. var res = '';
  11589. while (n) {
  11590. if (n % 2 === 1) { res += str; }
  11591. if (n > 1) { str += str; }
  11592. n >>= 1;
  11593. }
  11594. return res
  11595. };
  11596. generateComponentTrace = function (vm) {
  11597. if (vm._isVue && vm.$parent) {
  11598. var tree = [];
  11599. var currentRecursiveSequence = 0;
  11600. while (vm && vm.$options.name !== 'PageBody') {
  11601. if (tree.length > 0) {
  11602. var last = tree[tree.length - 1];
  11603. if (last.constructor === vm.constructor) {
  11604. currentRecursiveSequence++;
  11605. vm = vm.$parent;
  11606. continue
  11607. } else if (currentRecursiveSequence > 0) {
  11608. tree[tree.length - 1] = [last, currentRecursiveSequence];
  11609. currentRecursiveSequence = 0;
  11610. }
  11611. }
  11612. !vm.$options.isReserved && tree.push(vm);
  11613. vm = vm.$parent;
  11614. }
  11615. return '\n\nfound in\n\n' + tree
  11616. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  11617. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  11618. : formatComponentName(vm))); })
  11619. .join('\n')
  11620. } else {
  11621. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  11622. }
  11623. };
  11624. }
  11625. /* */
  11626. var uid = 0;
  11627. /**
  11628. * A dep is an observable that can have multiple
  11629. * directives subscribing to it.
  11630. */
  11631. var Dep = function Dep () {
  11632. this.id = uid++;
  11633. this.subs = [];
  11634. };
  11635. Dep.prototype.addSub = function addSub (sub) {
  11636. this.subs.push(sub);
  11637. };
  11638. Dep.prototype.removeSub = function removeSub (sub) {
  11639. remove(this.subs, sub);
  11640. };
  11641. Dep.prototype.depend = function depend () {
  11642. if (Dep.SharedObject.target) {
  11643. Dep.SharedObject.target.addDep(this);
  11644. }
  11645. };
  11646. Dep.prototype.notify = function notify () {
  11647. // stabilize the subscriber list first
  11648. var subs = this.subs.slice();
  11649. if ( true && !config.async) {
  11650. // subs aren't sorted in scheduler if not running async
  11651. // we need to sort them now to make sure they fire in correct
  11652. // order
  11653. subs.sort(function (a, b) { return a.id - b.id; });
  11654. }
  11655. for (var i = 0, l = subs.length; i < l; i++) {
  11656. subs[i].update();
  11657. }
  11658. };
  11659. // The current target watcher being evaluated.
  11660. // This is globally unique because only one watcher
  11661. // can be evaluated at a time.
  11662. // fixed by xxxxxx (nvue shared vuex)
  11663. /* eslint-disable no-undef */
  11664. Dep.SharedObject = {};
  11665. Dep.SharedObject.target = null;
  11666. Dep.SharedObject.targetStack = [];
  11667. function pushTarget (target) {
  11668. Dep.SharedObject.targetStack.push(target);
  11669. Dep.SharedObject.target = target;
  11670. Dep.target = target;
  11671. }
  11672. function popTarget () {
  11673. Dep.SharedObject.targetStack.pop();
  11674. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  11675. Dep.target = Dep.SharedObject.target;
  11676. }
  11677. /* */
  11678. var VNode = function VNode (
  11679. tag,
  11680. data,
  11681. children,
  11682. text,
  11683. elm,
  11684. context,
  11685. componentOptions,
  11686. asyncFactory
  11687. ) {
  11688. this.tag = tag;
  11689. this.data = data;
  11690. this.children = children;
  11691. this.text = text;
  11692. this.elm = elm;
  11693. this.ns = undefined;
  11694. this.context = context;
  11695. this.fnContext = undefined;
  11696. this.fnOptions = undefined;
  11697. this.fnScopeId = undefined;
  11698. this.key = data && data.key;
  11699. this.componentOptions = componentOptions;
  11700. this.componentInstance = undefined;
  11701. this.parent = undefined;
  11702. this.raw = false;
  11703. this.isStatic = false;
  11704. this.isRootInsert = true;
  11705. this.isComment = false;
  11706. this.isCloned = false;
  11707. this.isOnce = false;
  11708. this.asyncFactory = asyncFactory;
  11709. this.asyncMeta = undefined;
  11710. this.isAsyncPlaceholder = false;
  11711. };
  11712. var prototypeAccessors = { child: { configurable: true } };
  11713. // DEPRECATED: alias for componentInstance for backwards compat.
  11714. /* istanbul ignore next */
  11715. prototypeAccessors.child.get = function () {
  11716. return this.componentInstance
  11717. };
  11718. Object.defineProperties( VNode.prototype, prototypeAccessors );
  11719. var createEmptyVNode = function (text) {
  11720. if ( text === void 0 ) text = '';
  11721. var node = new VNode();
  11722. node.text = text;
  11723. node.isComment = true;
  11724. return node
  11725. };
  11726. function createTextVNode (val) {
  11727. return new VNode(undefined, undefined, undefined, String(val))
  11728. }
  11729. // optimized shallow clone
  11730. // used for static nodes and slot nodes because they may be reused across
  11731. // multiple renders, cloning them avoids errors when DOM manipulations rely
  11732. // on their elm reference.
  11733. function cloneVNode (vnode) {
  11734. var cloned = new VNode(
  11735. vnode.tag,
  11736. vnode.data,
  11737. // #7975
  11738. // clone children array to avoid mutating original in case of cloning
  11739. // a child.
  11740. vnode.children && vnode.children.slice(),
  11741. vnode.text,
  11742. vnode.elm,
  11743. vnode.context,
  11744. vnode.componentOptions,
  11745. vnode.asyncFactory
  11746. );
  11747. cloned.ns = vnode.ns;
  11748. cloned.isStatic = vnode.isStatic;
  11749. cloned.key = vnode.key;
  11750. cloned.isComment = vnode.isComment;
  11751. cloned.fnContext = vnode.fnContext;
  11752. cloned.fnOptions = vnode.fnOptions;
  11753. cloned.fnScopeId = vnode.fnScopeId;
  11754. cloned.asyncMeta = vnode.asyncMeta;
  11755. cloned.isCloned = true;
  11756. return cloned
  11757. }
  11758. /*
  11759. * not type checking this file because flow doesn't play well with
  11760. * dynamically accessing methods on Array prototype
  11761. */
  11762. var arrayProto = Array.prototype;
  11763. var arrayMethods = Object.create(arrayProto);
  11764. var methodsToPatch = [
  11765. 'push',
  11766. 'pop',
  11767. 'shift',
  11768. 'unshift',
  11769. 'splice',
  11770. 'sort',
  11771. 'reverse'
  11772. ];
  11773. /**
  11774. * Intercept mutating methods and emit events
  11775. */
  11776. methodsToPatch.forEach(function (method) {
  11777. // cache original method
  11778. var original = arrayProto[method];
  11779. def(arrayMethods, method, function mutator () {
  11780. var args = [], len = arguments.length;
  11781. while ( len-- ) args[ len ] = arguments[ len ];
  11782. var result = original.apply(this, args);
  11783. var ob = this.__ob__;
  11784. var inserted;
  11785. switch (method) {
  11786. case 'push':
  11787. case 'unshift':
  11788. inserted = args;
  11789. break
  11790. case 'splice':
  11791. inserted = args.slice(2);
  11792. break
  11793. }
  11794. if (inserted) { ob.observeArray(inserted); }
  11795. // notify change
  11796. ob.dep.notify();
  11797. return result
  11798. });
  11799. });
  11800. /* */
  11801. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  11802. /**
  11803. * In some cases we may want to disable observation inside a component's
  11804. * update computation.
  11805. */
  11806. var shouldObserve = true;
  11807. function toggleObserving (value) {
  11808. shouldObserve = value;
  11809. }
  11810. /**
  11811. * Observer class that is attached to each observed
  11812. * object. Once attached, the observer converts the target
  11813. * object's property keys into getter/setters that
  11814. * collect dependencies and dispatch updates.
  11815. */
  11816. var Observer = function Observer (value) {
  11817. this.value = value;
  11818. this.dep = new Dep();
  11819. this.vmCount = 0;
  11820. def(value, '__ob__', this);
  11821. if (Array.isArray(value)) {
  11822. if (hasProto) {
  11823. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  11824. if(value.push !== value.__proto__.push){
  11825. copyAugment(value, arrayMethods, arrayKeys);
  11826. } else {
  11827. protoAugment(value, arrayMethods);
  11828. }
  11829. }
  11830. } else {
  11831. copyAugment(value, arrayMethods, arrayKeys);
  11832. }
  11833. this.observeArray(value);
  11834. } else {
  11835. this.walk(value);
  11836. }
  11837. };
  11838. /**
  11839. * Walk through all properties and convert them into
  11840. * getter/setters. This method should only be called when
  11841. * value type is Object.
  11842. */
  11843. Observer.prototype.walk = function walk (obj) {
  11844. var keys = Object.keys(obj);
  11845. for (var i = 0; i < keys.length; i++) {
  11846. defineReactive$$1(obj, keys[i]);
  11847. }
  11848. };
  11849. /**
  11850. * Observe a list of Array items.
  11851. */
  11852. Observer.prototype.observeArray = function observeArray (items) {
  11853. for (var i = 0, l = items.length; i < l; i++) {
  11854. observe(items[i]);
  11855. }
  11856. };
  11857. // helpers
  11858. /**
  11859. * Augment a target Object or Array by intercepting
  11860. * the prototype chain using __proto__
  11861. */
  11862. function protoAugment (target, src) {
  11863. /* eslint-disable no-proto */
  11864. target.__proto__ = src;
  11865. /* eslint-enable no-proto */
  11866. }
  11867. /**
  11868. * Augment a target Object or Array by defining
  11869. * hidden properties.
  11870. */
  11871. /* istanbul ignore next */
  11872. function copyAugment (target, src, keys) {
  11873. for (var i = 0, l = keys.length; i < l; i++) {
  11874. var key = keys[i];
  11875. def(target, key, src[key]);
  11876. }
  11877. }
  11878. /**
  11879. * Attempt to create an observer instance for a value,
  11880. * returns the new observer if successfully observed,
  11881. * or the existing observer if the value already has one.
  11882. */
  11883. function observe (value, asRootData) {
  11884. if (!isObject(value) || value instanceof VNode) {
  11885. return
  11886. }
  11887. var ob;
  11888. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  11889. ob = value.__ob__;
  11890. } else if (
  11891. shouldObserve &&
  11892. !isServerRendering() &&
  11893. (Array.isArray(value) || isPlainObject(value)) &&
  11894. Object.isExtensible(value) &&
  11895. !value._isVue
  11896. ) {
  11897. ob = new Observer(value);
  11898. }
  11899. if (asRootData && ob) {
  11900. ob.vmCount++;
  11901. }
  11902. return ob
  11903. }
  11904. /**
  11905. * Define a reactive property on an Object.
  11906. */
  11907. function defineReactive$$1 (
  11908. obj,
  11909. key,
  11910. val,
  11911. customSetter,
  11912. shallow
  11913. ) {
  11914. var dep = new Dep();
  11915. var property = Object.getOwnPropertyDescriptor(obj, key);
  11916. if (property && property.configurable === false) {
  11917. return
  11918. }
  11919. // cater for pre-defined getter/setters
  11920. var getter = property && property.get;
  11921. var setter = property && property.set;
  11922. if ((!getter || setter) && arguments.length === 2) {
  11923. val = obj[key];
  11924. }
  11925. var childOb = !shallow && observe(val);
  11926. Object.defineProperty(obj, key, {
  11927. enumerable: true,
  11928. configurable: true,
  11929. get: function reactiveGetter () {
  11930. var value = getter ? getter.call(obj) : val;
  11931. if (Dep.SharedObject.target) { // fixed by xxxxxx
  11932. dep.depend();
  11933. if (childOb) {
  11934. childOb.dep.depend();
  11935. if (Array.isArray(value)) {
  11936. dependArray(value);
  11937. }
  11938. }
  11939. }
  11940. return value
  11941. },
  11942. set: function reactiveSetter (newVal) {
  11943. var value = getter ? getter.call(obj) : val;
  11944. /* eslint-disable no-self-compare */
  11945. if (newVal === value || (newVal !== newVal && value !== value)) {
  11946. return
  11947. }
  11948. /* eslint-enable no-self-compare */
  11949. if ( true && customSetter) {
  11950. customSetter();
  11951. }
  11952. // #7981: for accessor properties without setter
  11953. if (getter && !setter) { return }
  11954. if (setter) {
  11955. setter.call(obj, newVal);
  11956. } else {
  11957. val = newVal;
  11958. }
  11959. childOb = !shallow && observe(newVal);
  11960. dep.notify();
  11961. }
  11962. });
  11963. }
  11964. /**
  11965. * Set a property on an object. Adds the new property and
  11966. * triggers change notification if the property doesn't
  11967. * already exist.
  11968. */
  11969. function set (target, key, val) {
  11970. if ( true &&
  11971. (isUndef(target) || isPrimitive(target))
  11972. ) {
  11973. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  11974. }
  11975. if (Array.isArray(target) && isValidArrayIndex(key)) {
  11976. target.length = Math.max(target.length, key);
  11977. target.splice(key, 1, val);
  11978. return val
  11979. }
  11980. if (key in target && !(key in Object.prototype)) {
  11981. target[key] = val;
  11982. return val
  11983. }
  11984. var ob = (target).__ob__;
  11985. if (target._isVue || (ob && ob.vmCount)) {
  11986. true && warn(
  11987. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  11988. 'at runtime - declare it upfront in the data option.'
  11989. );
  11990. return val
  11991. }
  11992. if (!ob) {
  11993. target[key] = val;
  11994. return val
  11995. }
  11996. defineReactive$$1(ob.value, key, val);
  11997. ob.dep.notify();
  11998. return val
  11999. }
  12000. /**
  12001. * Delete a property and trigger change if necessary.
  12002. */
  12003. function del (target, key) {
  12004. if ( true &&
  12005. (isUndef(target) || isPrimitive(target))
  12006. ) {
  12007. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  12008. }
  12009. if (Array.isArray(target) && isValidArrayIndex(key)) {
  12010. target.splice(key, 1);
  12011. return
  12012. }
  12013. var ob = (target).__ob__;
  12014. if (target._isVue || (ob && ob.vmCount)) {
  12015. true && warn(
  12016. 'Avoid deleting properties on a Vue instance or its root $data ' +
  12017. '- just set it to null.'
  12018. );
  12019. return
  12020. }
  12021. if (!hasOwn(target, key)) {
  12022. return
  12023. }
  12024. delete target[key];
  12025. if (!ob) {
  12026. return
  12027. }
  12028. ob.dep.notify();
  12029. }
  12030. /**
  12031. * Collect dependencies on array elements when the array is touched, since
  12032. * we cannot intercept array element access like property getters.
  12033. */
  12034. function dependArray (value) {
  12035. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  12036. e = value[i];
  12037. e && e.__ob__ && e.__ob__.dep.depend();
  12038. if (Array.isArray(e)) {
  12039. dependArray(e);
  12040. }
  12041. }
  12042. }
  12043. /* */
  12044. /**
  12045. * Option overwriting strategies are functions that handle
  12046. * how to merge a parent option value and a child option
  12047. * value into the final value.
  12048. */
  12049. var strats = config.optionMergeStrategies;
  12050. /**
  12051. * Options with restrictions
  12052. */
  12053. if (true) {
  12054. strats.el = strats.propsData = function (parent, child, vm, key) {
  12055. if (!vm) {
  12056. warn(
  12057. "option \"" + key + "\" can only be used during instance " +
  12058. 'creation with the `new` keyword.'
  12059. );
  12060. }
  12061. return defaultStrat(parent, child)
  12062. };
  12063. }
  12064. /**
  12065. * Helper that recursively merges two data objects together.
  12066. */
  12067. function mergeData (to, from) {
  12068. if (!from) { return to }
  12069. var key, toVal, fromVal;
  12070. var keys = hasSymbol
  12071. ? Reflect.ownKeys(from)
  12072. : Object.keys(from);
  12073. for (var i = 0; i < keys.length; i++) {
  12074. key = keys[i];
  12075. // in case the object is already observed...
  12076. if (key === '__ob__') { continue }
  12077. toVal = to[key];
  12078. fromVal = from[key];
  12079. if (!hasOwn(to, key)) {
  12080. set(to, key, fromVal);
  12081. } else if (
  12082. toVal !== fromVal &&
  12083. isPlainObject(toVal) &&
  12084. isPlainObject(fromVal)
  12085. ) {
  12086. mergeData(toVal, fromVal);
  12087. }
  12088. }
  12089. return to
  12090. }
  12091. /**
  12092. * Data
  12093. */
  12094. function mergeDataOrFn (
  12095. parentVal,
  12096. childVal,
  12097. vm
  12098. ) {
  12099. if (!vm) {
  12100. // in a Vue.extend merge, both should be functions
  12101. if (!childVal) {
  12102. return parentVal
  12103. }
  12104. if (!parentVal) {
  12105. return childVal
  12106. }
  12107. // when parentVal & childVal are both present,
  12108. // we need to return a function that returns the
  12109. // merged result of both functions... no need to
  12110. // check if parentVal is a function here because
  12111. // it has to be a function to pass previous merges.
  12112. return function mergedDataFn () {
  12113. return mergeData(
  12114. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  12115. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  12116. )
  12117. }
  12118. } else {
  12119. return function mergedInstanceDataFn () {
  12120. // instance merge
  12121. var instanceData = typeof childVal === 'function'
  12122. ? childVal.call(vm, vm)
  12123. : childVal;
  12124. var defaultData = typeof parentVal === 'function'
  12125. ? parentVal.call(vm, vm)
  12126. : parentVal;
  12127. if (instanceData) {
  12128. return mergeData(instanceData, defaultData)
  12129. } else {
  12130. return defaultData
  12131. }
  12132. }
  12133. }
  12134. }
  12135. strats.data = function (
  12136. parentVal,
  12137. childVal,
  12138. vm
  12139. ) {
  12140. if (!vm) {
  12141. if (childVal && typeof childVal !== 'function') {
  12142. true && warn(
  12143. 'The "data" option should be a function ' +
  12144. 'that returns a per-instance value in component ' +
  12145. 'definitions.',
  12146. vm
  12147. );
  12148. return parentVal
  12149. }
  12150. return mergeDataOrFn(parentVal, childVal)
  12151. }
  12152. return mergeDataOrFn(parentVal, childVal, vm)
  12153. };
  12154. /**
  12155. * Hooks and props are merged as arrays.
  12156. */
  12157. function mergeHook (
  12158. parentVal,
  12159. childVal
  12160. ) {
  12161. var res = childVal
  12162. ? parentVal
  12163. ? parentVal.concat(childVal)
  12164. : Array.isArray(childVal)
  12165. ? childVal
  12166. : [childVal]
  12167. : parentVal;
  12168. return res
  12169. ? dedupeHooks(res)
  12170. : res
  12171. }
  12172. function dedupeHooks (hooks) {
  12173. var res = [];
  12174. for (var i = 0; i < hooks.length; i++) {
  12175. if (res.indexOf(hooks[i]) === -1) {
  12176. res.push(hooks[i]);
  12177. }
  12178. }
  12179. return res
  12180. }
  12181. LIFECYCLE_HOOKS.forEach(function (hook) {
  12182. strats[hook] = mergeHook;
  12183. });
  12184. /**
  12185. * Assets
  12186. *
  12187. * When a vm is present (instance creation), we need to do
  12188. * a three-way merge between constructor options, instance
  12189. * options and parent options.
  12190. */
  12191. function mergeAssets (
  12192. parentVal,
  12193. childVal,
  12194. vm,
  12195. key
  12196. ) {
  12197. var res = Object.create(parentVal || null);
  12198. if (childVal) {
  12199. true && assertObjectType(key, childVal, vm);
  12200. return extend(res, childVal)
  12201. } else {
  12202. return res
  12203. }
  12204. }
  12205. ASSET_TYPES.forEach(function (type) {
  12206. strats[type + 's'] = mergeAssets;
  12207. });
  12208. /**
  12209. * Watchers.
  12210. *
  12211. * Watchers hashes should not overwrite one
  12212. * another, so we merge them as arrays.
  12213. */
  12214. strats.watch = function (
  12215. parentVal,
  12216. childVal,
  12217. vm,
  12218. key
  12219. ) {
  12220. // work around Firefox's Object.prototype.watch...
  12221. if (parentVal === nativeWatch) { parentVal = undefined; }
  12222. if (childVal === nativeWatch) { childVal = undefined; }
  12223. /* istanbul ignore if */
  12224. if (!childVal) { return Object.create(parentVal || null) }
  12225. if (true) {
  12226. assertObjectType(key, childVal, vm);
  12227. }
  12228. if (!parentVal) { return childVal }
  12229. var ret = {};
  12230. extend(ret, parentVal);
  12231. for (var key$1 in childVal) {
  12232. var parent = ret[key$1];
  12233. var child = childVal[key$1];
  12234. if (parent && !Array.isArray(parent)) {
  12235. parent = [parent];
  12236. }
  12237. ret[key$1] = parent
  12238. ? parent.concat(child)
  12239. : Array.isArray(child) ? child : [child];
  12240. }
  12241. return ret
  12242. };
  12243. /**
  12244. * Other object hashes.
  12245. */
  12246. strats.props =
  12247. strats.methods =
  12248. strats.inject =
  12249. strats.computed = function (
  12250. parentVal,
  12251. childVal,
  12252. vm,
  12253. key
  12254. ) {
  12255. if (childVal && "development" !== 'production') {
  12256. assertObjectType(key, childVal, vm);
  12257. }
  12258. if (!parentVal) { return childVal }
  12259. var ret = Object.create(null);
  12260. extend(ret, parentVal);
  12261. if (childVal) { extend(ret, childVal); }
  12262. return ret
  12263. };
  12264. strats.provide = mergeDataOrFn;
  12265. /**
  12266. * Default strategy.
  12267. */
  12268. var defaultStrat = function (parentVal, childVal) {
  12269. return childVal === undefined
  12270. ? parentVal
  12271. : childVal
  12272. };
  12273. /**
  12274. * Validate component names
  12275. */
  12276. function checkComponents (options) {
  12277. for (var key in options.components) {
  12278. validateComponentName(key);
  12279. }
  12280. }
  12281. function validateComponentName (name) {
  12282. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  12283. warn(
  12284. 'Invalid component name: "' + name + '". Component names ' +
  12285. 'should conform to valid custom element name in html5 specification.'
  12286. );
  12287. }
  12288. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  12289. warn(
  12290. 'Do not use built-in or reserved HTML elements as component ' +
  12291. 'id: ' + name
  12292. );
  12293. }
  12294. }
  12295. /**
  12296. * Ensure all props option syntax are normalized into the
  12297. * Object-based format.
  12298. */
  12299. function normalizeProps (options, vm) {
  12300. var props = options.props;
  12301. if (!props) { return }
  12302. var res = {};
  12303. var i, val, name;
  12304. if (Array.isArray(props)) {
  12305. i = props.length;
  12306. while (i--) {
  12307. val = props[i];
  12308. if (typeof val === 'string') {
  12309. name = camelize(val);
  12310. res[name] = { type: null };
  12311. } else if (true) {
  12312. warn('props must be strings when using array syntax.');
  12313. }
  12314. }
  12315. } else if (isPlainObject(props)) {
  12316. for (var key in props) {
  12317. val = props[key];
  12318. name = camelize(key);
  12319. res[name] = isPlainObject(val)
  12320. ? val
  12321. : { type: val };
  12322. }
  12323. } else if (true) {
  12324. warn(
  12325. "Invalid value for option \"props\": expected an Array or an Object, " +
  12326. "but got " + (toRawType(props)) + ".",
  12327. vm
  12328. );
  12329. }
  12330. options.props = res;
  12331. }
  12332. /**
  12333. * Normalize all injections into Object-based format
  12334. */
  12335. function normalizeInject (options, vm) {
  12336. var inject = options.inject;
  12337. if (!inject) { return }
  12338. var normalized = options.inject = {};
  12339. if (Array.isArray(inject)) {
  12340. for (var i = 0; i < inject.length; i++) {
  12341. normalized[inject[i]] = { from: inject[i] };
  12342. }
  12343. } else if (isPlainObject(inject)) {
  12344. for (var key in inject) {
  12345. var val = inject[key];
  12346. normalized[key] = isPlainObject(val)
  12347. ? extend({ from: key }, val)
  12348. : { from: val };
  12349. }
  12350. } else if (true) {
  12351. warn(
  12352. "Invalid value for option \"inject\": expected an Array or an Object, " +
  12353. "but got " + (toRawType(inject)) + ".",
  12354. vm
  12355. );
  12356. }
  12357. }
  12358. /**
  12359. * Normalize raw function directives into object format.
  12360. */
  12361. function normalizeDirectives (options) {
  12362. var dirs = options.directives;
  12363. if (dirs) {
  12364. for (var key in dirs) {
  12365. var def$$1 = dirs[key];
  12366. if (typeof def$$1 === 'function') {
  12367. dirs[key] = { bind: def$$1, update: def$$1 };
  12368. }
  12369. }
  12370. }
  12371. }
  12372. function assertObjectType (name, value, vm) {
  12373. if (!isPlainObject(value)) {
  12374. warn(
  12375. "Invalid value for option \"" + name + "\": expected an Object, " +
  12376. "but got " + (toRawType(value)) + ".",
  12377. vm
  12378. );
  12379. }
  12380. }
  12381. /**
  12382. * Merge two option objects into a new one.
  12383. * Core utility used in both instantiation and inheritance.
  12384. */
  12385. function mergeOptions (
  12386. parent,
  12387. child,
  12388. vm
  12389. ) {
  12390. if (true) {
  12391. checkComponents(child);
  12392. }
  12393. if (typeof child === 'function') {
  12394. child = child.options;
  12395. }
  12396. normalizeProps(child, vm);
  12397. normalizeInject(child, vm);
  12398. normalizeDirectives(child);
  12399. // Apply extends and mixins on the child options,
  12400. // but only if it is a raw options object that isn't
  12401. // the result of another mergeOptions call.
  12402. // Only merged options has the _base property.
  12403. if (!child._base) {
  12404. if (child.extends) {
  12405. parent = mergeOptions(parent, child.extends, vm);
  12406. }
  12407. if (child.mixins) {
  12408. for (var i = 0, l = child.mixins.length; i < l; i++) {
  12409. parent = mergeOptions(parent, child.mixins[i], vm);
  12410. }
  12411. }
  12412. }
  12413. var options = {};
  12414. var key;
  12415. for (key in parent) {
  12416. mergeField(key);
  12417. }
  12418. for (key in child) {
  12419. if (!hasOwn(parent, key)) {
  12420. mergeField(key);
  12421. }
  12422. }
  12423. function mergeField (key) {
  12424. var strat = strats[key] || defaultStrat;
  12425. options[key] = strat(parent[key], child[key], vm, key);
  12426. }
  12427. return options
  12428. }
  12429. /**
  12430. * Resolve an asset.
  12431. * This function is used because child instances need access
  12432. * to assets defined in its ancestor chain.
  12433. */
  12434. function resolveAsset (
  12435. options,
  12436. type,
  12437. id,
  12438. warnMissing
  12439. ) {
  12440. /* istanbul ignore if */
  12441. if (typeof id !== 'string') {
  12442. return
  12443. }
  12444. var assets = options[type];
  12445. // check local registration variations first
  12446. if (hasOwn(assets, id)) { return assets[id] }
  12447. var camelizedId = camelize(id);
  12448. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  12449. var PascalCaseId = capitalize(camelizedId);
  12450. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  12451. // fallback to prototype chain
  12452. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  12453. if ( true && warnMissing && !res) {
  12454. warn(
  12455. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  12456. options
  12457. );
  12458. }
  12459. return res
  12460. }
  12461. /* */
  12462. function validateProp (
  12463. key,
  12464. propOptions,
  12465. propsData,
  12466. vm
  12467. ) {
  12468. var prop = propOptions[key];
  12469. var absent = !hasOwn(propsData, key);
  12470. var value = propsData[key];
  12471. // boolean casting
  12472. var booleanIndex = getTypeIndex(Boolean, prop.type);
  12473. if (booleanIndex > -1) {
  12474. if (absent && !hasOwn(prop, 'default')) {
  12475. value = false;
  12476. } else if (value === '' || value === hyphenate(key)) {
  12477. // only cast empty string / same name to boolean if
  12478. // boolean has higher priority
  12479. var stringIndex = getTypeIndex(String, prop.type);
  12480. if (stringIndex < 0 || booleanIndex < stringIndex) {
  12481. value = true;
  12482. }
  12483. }
  12484. }
  12485. // check default value
  12486. if (value === undefined) {
  12487. value = getPropDefaultValue(vm, prop, key);
  12488. // since the default value is a fresh copy,
  12489. // make sure to observe it.
  12490. var prevShouldObserve = shouldObserve;
  12491. toggleObserving(true);
  12492. observe(value);
  12493. toggleObserving(prevShouldObserve);
  12494. }
  12495. if (
  12496. true
  12497. ) {
  12498. assertProp(prop, key, value, vm, absent);
  12499. }
  12500. return value
  12501. }
  12502. /**
  12503. * Get the default value of a prop.
  12504. */
  12505. function getPropDefaultValue (vm, prop, key) {
  12506. // no default, return undefined
  12507. if (!hasOwn(prop, 'default')) {
  12508. return undefined
  12509. }
  12510. var def = prop.default;
  12511. // warn against non-factory defaults for Object & Array
  12512. if ( true && isObject(def)) {
  12513. warn(
  12514. 'Invalid default value for prop "' + key + '": ' +
  12515. 'Props with type Object/Array must use a factory function ' +
  12516. 'to return the default value.',
  12517. vm
  12518. );
  12519. }
  12520. // the raw prop value was also undefined from previous render,
  12521. // return previous default value to avoid unnecessary watcher trigger
  12522. if (vm && vm.$options.propsData &&
  12523. vm.$options.propsData[key] === undefined &&
  12524. vm._props[key] !== undefined
  12525. ) {
  12526. return vm._props[key]
  12527. }
  12528. // call factory function for non-Function types
  12529. // a value is Function if its prototype is function even across different execution context
  12530. return typeof def === 'function' && getType(prop.type) !== 'Function'
  12531. ? def.call(vm)
  12532. : def
  12533. }
  12534. /**
  12535. * Assert whether a prop is valid.
  12536. */
  12537. function assertProp (
  12538. prop,
  12539. name,
  12540. value,
  12541. vm,
  12542. absent
  12543. ) {
  12544. if (prop.required && absent) {
  12545. warn(
  12546. 'Missing required prop: "' + name + '"',
  12547. vm
  12548. );
  12549. return
  12550. }
  12551. if (value == null && !prop.required) {
  12552. return
  12553. }
  12554. var type = prop.type;
  12555. var valid = !type || type === true;
  12556. var expectedTypes = [];
  12557. if (type) {
  12558. if (!Array.isArray(type)) {
  12559. type = [type];
  12560. }
  12561. for (var i = 0; i < type.length && !valid; i++) {
  12562. var assertedType = assertType(value, type[i]);
  12563. expectedTypes.push(assertedType.expectedType || '');
  12564. valid = assertedType.valid;
  12565. }
  12566. }
  12567. if (!valid) {
  12568. warn(
  12569. getInvalidTypeMessage(name, value, expectedTypes),
  12570. vm
  12571. );
  12572. return
  12573. }
  12574. var validator = prop.validator;
  12575. if (validator) {
  12576. if (!validator(value)) {
  12577. warn(
  12578. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  12579. vm
  12580. );
  12581. }
  12582. }
  12583. }
  12584. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  12585. function assertType (value, type) {
  12586. var valid;
  12587. var expectedType = getType(type);
  12588. if (simpleCheckRE.test(expectedType)) {
  12589. var t = typeof value;
  12590. valid = t === expectedType.toLowerCase();
  12591. // for primitive wrapper objects
  12592. if (!valid && t === 'object') {
  12593. valid = value instanceof type;
  12594. }
  12595. } else if (expectedType === 'Object') {
  12596. valid = isPlainObject(value);
  12597. } else if (expectedType === 'Array') {
  12598. valid = Array.isArray(value);
  12599. } else {
  12600. valid = value instanceof type;
  12601. }
  12602. return {
  12603. valid: valid,
  12604. expectedType: expectedType
  12605. }
  12606. }
  12607. /**
  12608. * Use function string name to check built-in types,
  12609. * because a simple equality check will fail when running
  12610. * across different vms / iframes.
  12611. */
  12612. function getType (fn) {
  12613. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  12614. return match ? match[1] : ''
  12615. }
  12616. function isSameType (a, b) {
  12617. return getType(a) === getType(b)
  12618. }
  12619. function getTypeIndex (type, expectedTypes) {
  12620. if (!Array.isArray(expectedTypes)) {
  12621. return isSameType(expectedTypes, type) ? 0 : -1
  12622. }
  12623. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  12624. if (isSameType(expectedTypes[i], type)) {
  12625. return i
  12626. }
  12627. }
  12628. return -1
  12629. }
  12630. function getInvalidTypeMessage (name, value, expectedTypes) {
  12631. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  12632. " Expected " + (expectedTypes.map(capitalize).join(', '));
  12633. var expectedType = expectedTypes[0];
  12634. var receivedType = toRawType(value);
  12635. var expectedValue = styleValue(value, expectedType);
  12636. var receivedValue = styleValue(value, receivedType);
  12637. // check if we need to specify expected value
  12638. if (expectedTypes.length === 1 &&
  12639. isExplicable(expectedType) &&
  12640. !isBoolean(expectedType, receivedType)) {
  12641. message += " with value " + expectedValue;
  12642. }
  12643. message += ", got " + receivedType + " ";
  12644. // check if we need to specify received value
  12645. if (isExplicable(receivedType)) {
  12646. message += "with value " + receivedValue + ".";
  12647. }
  12648. return message
  12649. }
  12650. function styleValue (value, type) {
  12651. if (type === 'String') {
  12652. return ("\"" + value + "\"")
  12653. } else if (type === 'Number') {
  12654. return ("" + (Number(value)))
  12655. } else {
  12656. return ("" + value)
  12657. }
  12658. }
  12659. function isExplicable (value) {
  12660. var explicitTypes = ['string', 'number', 'boolean'];
  12661. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  12662. }
  12663. function isBoolean () {
  12664. var args = [], len = arguments.length;
  12665. while ( len-- ) args[ len ] = arguments[ len ];
  12666. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  12667. }
  12668. /* */
  12669. function handleError (err, vm, info) {
  12670. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  12671. // See: https://github.com/vuejs/vuex/issues/1505
  12672. pushTarget();
  12673. try {
  12674. if (vm) {
  12675. var cur = vm;
  12676. while ((cur = cur.$parent)) {
  12677. var hooks = cur.$options.errorCaptured;
  12678. if (hooks) {
  12679. for (var i = 0; i < hooks.length; i++) {
  12680. try {
  12681. var capture = hooks[i].call(cur, err, vm, info) === false;
  12682. if (capture) { return }
  12683. } catch (e) {
  12684. globalHandleError(e, cur, 'errorCaptured hook');
  12685. }
  12686. }
  12687. }
  12688. }
  12689. }
  12690. globalHandleError(err, vm, info);
  12691. } finally {
  12692. popTarget();
  12693. }
  12694. }
  12695. function invokeWithErrorHandling (
  12696. handler,
  12697. context,
  12698. args,
  12699. vm,
  12700. info
  12701. ) {
  12702. var res;
  12703. try {
  12704. res = args ? handler.apply(context, args) : handler.call(context);
  12705. if (res && !res._isVue && isPromise(res) && !res._handled) {
  12706. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  12707. // issue #9511
  12708. // avoid catch triggering multiple times when nested calls
  12709. res._handled = true;
  12710. }
  12711. } catch (e) {
  12712. handleError(e, vm, info);
  12713. }
  12714. return res
  12715. }
  12716. function globalHandleError (err, vm, info) {
  12717. if (config.errorHandler) {
  12718. try {
  12719. return config.errorHandler.call(null, err, vm, info)
  12720. } catch (e) {
  12721. // if the user intentionally throws the original error in the handler,
  12722. // do not log it twice
  12723. if (e !== err) {
  12724. logError(e, null, 'config.errorHandler');
  12725. }
  12726. }
  12727. }
  12728. logError(err, vm, info);
  12729. }
  12730. function logError (err, vm, info) {
  12731. if (true) {
  12732. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  12733. }
  12734. /* istanbul ignore else */
  12735. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  12736. console.error(err);
  12737. } else {
  12738. throw err
  12739. }
  12740. }
  12741. /* */
  12742. var callbacks = [];
  12743. var pending = false;
  12744. function flushCallbacks () {
  12745. pending = false;
  12746. var copies = callbacks.slice(0);
  12747. callbacks.length = 0;
  12748. for (var i = 0; i < copies.length; i++) {
  12749. copies[i]();
  12750. }
  12751. }
  12752. // Here we have async deferring wrappers using microtasks.
  12753. // In 2.5 we used (macro) tasks (in combination with microtasks).
  12754. // However, it has subtle problems when state is changed right before repaint
  12755. // (e.g. #6813, out-in transitions).
  12756. // Also, using (macro) tasks in event handler would cause some weird behaviors
  12757. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  12758. // So we now use microtasks everywhere, again.
  12759. // A major drawback of this tradeoff is that there are some scenarios
  12760. // where microtasks have too high a priority and fire in between supposedly
  12761. // sequential events (e.g. #4521, #6690, which have workarounds)
  12762. // or even between bubbling of the same event (#6566).
  12763. var timerFunc;
  12764. // The nextTick behavior leverages the microtask queue, which can be accessed
  12765. // via either native Promise.then or MutationObserver.
  12766. // MutationObserver has wider support, however it is seriously bugged in
  12767. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  12768. // completely stops working after triggering a few times... so, if native
  12769. // Promise is available, we will use it:
  12770. /* istanbul ignore next, $flow-disable-line */
  12771. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  12772. var p = Promise.resolve();
  12773. timerFunc = function () {
  12774. p.then(flushCallbacks);
  12775. // In problematic UIWebViews, Promise.then doesn't completely break, but
  12776. // it can get stuck in a weird state where callbacks are pushed into the
  12777. // microtask queue but the queue isn't being flushed, until the browser
  12778. // needs to do some other work, e.g. handle a timer. Therefore we can
  12779. // "force" the microtask queue to be flushed by adding an empty timer.
  12780. if (isIOS) { setTimeout(noop); }
  12781. };
  12782. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  12783. isNative(MutationObserver) ||
  12784. // PhantomJS and iOS 7.x
  12785. MutationObserver.toString() === '[object MutationObserverConstructor]'
  12786. )) {
  12787. // Use MutationObserver where native Promise is not available,
  12788. // e.g. PhantomJS, iOS7, Android 4.4
  12789. // (#6466 MutationObserver is unreliable in IE11)
  12790. var counter = 1;
  12791. var observer = new MutationObserver(flushCallbacks);
  12792. var textNode = document.createTextNode(String(counter));
  12793. observer.observe(textNode, {
  12794. characterData: true
  12795. });
  12796. timerFunc = function () {
  12797. counter = (counter + 1) % 2;
  12798. textNode.data = String(counter);
  12799. };
  12800. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  12801. // Fallback to setImmediate.
  12802. // Technically it leverages the (macro) task queue,
  12803. // but it is still a better choice than setTimeout.
  12804. timerFunc = function () {
  12805. setImmediate(flushCallbacks);
  12806. };
  12807. } else {
  12808. // Fallback to setTimeout.
  12809. timerFunc = function () {
  12810. setTimeout(flushCallbacks, 0);
  12811. };
  12812. }
  12813. function nextTick (cb, ctx) {
  12814. var _resolve;
  12815. callbacks.push(function () {
  12816. if (cb) {
  12817. try {
  12818. cb.call(ctx);
  12819. } catch (e) {
  12820. handleError(e, ctx, 'nextTick');
  12821. }
  12822. } else if (_resolve) {
  12823. _resolve(ctx);
  12824. }
  12825. });
  12826. if (!pending) {
  12827. pending = true;
  12828. timerFunc();
  12829. }
  12830. // $flow-disable-line
  12831. if (!cb && typeof Promise !== 'undefined') {
  12832. return new Promise(function (resolve) {
  12833. _resolve = resolve;
  12834. })
  12835. }
  12836. }
  12837. /* */
  12838. /* not type checking this file because flow doesn't play well with Proxy */
  12839. var initProxy;
  12840. if (true) {
  12841. var allowedGlobals = makeMap(
  12842. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  12843. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  12844. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  12845. 'require' // for Webpack/Browserify
  12846. );
  12847. var warnNonPresent = function (target, key) {
  12848. warn(
  12849. "Property or method \"" + key + "\" is not defined on the instance but " +
  12850. 'referenced during render. Make sure that this property is reactive, ' +
  12851. 'either in the data option, or for class-based components, by ' +
  12852. 'initializing the property. ' +
  12853. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  12854. target
  12855. );
  12856. };
  12857. var warnReservedPrefix = function (target, key) {
  12858. warn(
  12859. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  12860. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  12861. 'prevent conflicts with Vue internals. ' +
  12862. 'See: https://vuejs.org/v2/api/#data',
  12863. target
  12864. );
  12865. };
  12866. var hasProxy =
  12867. typeof Proxy !== 'undefined' && isNative(Proxy);
  12868. if (hasProxy) {
  12869. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  12870. config.keyCodes = new Proxy(config.keyCodes, {
  12871. set: function set (target, key, value) {
  12872. if (isBuiltInModifier(key)) {
  12873. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  12874. return false
  12875. } else {
  12876. target[key] = value;
  12877. return true
  12878. }
  12879. }
  12880. });
  12881. }
  12882. var hasHandler = {
  12883. has: function has (target, key) {
  12884. var has = key in target;
  12885. var isAllowed = allowedGlobals(key) ||
  12886. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  12887. if (!has && !isAllowed) {
  12888. if (key in target.$data) { warnReservedPrefix(target, key); }
  12889. else { warnNonPresent(target, key); }
  12890. }
  12891. return has || !isAllowed
  12892. }
  12893. };
  12894. var getHandler = {
  12895. get: function get (target, key) {
  12896. if (typeof key === 'string' && !(key in target)) {
  12897. if (key in target.$data) { warnReservedPrefix(target, key); }
  12898. else { warnNonPresent(target, key); }
  12899. }
  12900. return target[key]
  12901. }
  12902. };
  12903. initProxy = function initProxy (vm) {
  12904. if (hasProxy) {
  12905. // determine which proxy handler to use
  12906. var options = vm.$options;
  12907. var handlers = options.render && options.render._withStripped
  12908. ? getHandler
  12909. : hasHandler;
  12910. vm._renderProxy = new Proxy(vm, handlers);
  12911. } else {
  12912. vm._renderProxy = vm;
  12913. }
  12914. };
  12915. }
  12916. /* */
  12917. var seenObjects = new _Set();
  12918. /**
  12919. * Recursively traverse an object to evoke all converted
  12920. * getters, so that every nested property inside the object
  12921. * is collected as a "deep" dependency.
  12922. */
  12923. function traverse (val) {
  12924. _traverse(val, seenObjects);
  12925. seenObjects.clear();
  12926. }
  12927. function _traverse (val, seen) {
  12928. var i, keys;
  12929. var isA = Array.isArray(val);
  12930. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  12931. return
  12932. }
  12933. if (val.__ob__) {
  12934. var depId = val.__ob__.dep.id;
  12935. if (seen.has(depId)) {
  12936. return
  12937. }
  12938. seen.add(depId);
  12939. }
  12940. if (isA) {
  12941. i = val.length;
  12942. while (i--) { _traverse(val[i], seen); }
  12943. } else {
  12944. keys = Object.keys(val);
  12945. i = keys.length;
  12946. while (i--) { _traverse(val[keys[i]], seen); }
  12947. }
  12948. }
  12949. var mark;
  12950. var measure;
  12951. if (true) {
  12952. var perf = inBrowser && window.performance;
  12953. /* istanbul ignore if */
  12954. if (
  12955. perf &&
  12956. perf.mark &&
  12957. perf.measure &&
  12958. perf.clearMarks &&
  12959. perf.clearMeasures
  12960. ) {
  12961. mark = function (tag) { return perf.mark(tag); };
  12962. measure = function (name, startTag, endTag) {
  12963. perf.measure(name, startTag, endTag);
  12964. perf.clearMarks(startTag);
  12965. perf.clearMarks(endTag);
  12966. // perf.clearMeasures(name)
  12967. };
  12968. }
  12969. }
  12970. /* */
  12971. var normalizeEvent = cached(function (name) {
  12972. var passive = name.charAt(0) === '&';
  12973. name = passive ? name.slice(1) : name;
  12974. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  12975. name = once$$1 ? name.slice(1) : name;
  12976. var capture = name.charAt(0) === '!';
  12977. name = capture ? name.slice(1) : name;
  12978. return {
  12979. name: name,
  12980. once: once$$1,
  12981. capture: capture,
  12982. passive: passive
  12983. }
  12984. });
  12985. function createFnInvoker (fns, vm) {
  12986. function invoker () {
  12987. var arguments$1 = arguments;
  12988. var fns = invoker.fns;
  12989. if (Array.isArray(fns)) {
  12990. var cloned = fns.slice();
  12991. for (var i = 0; i < cloned.length; i++) {
  12992. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  12993. }
  12994. } else {
  12995. // return handler return value for single handlers
  12996. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  12997. }
  12998. }
  12999. invoker.fns = fns;
  13000. return invoker
  13001. }
  13002. function updateListeners (
  13003. on,
  13004. oldOn,
  13005. add,
  13006. remove$$1,
  13007. createOnceHandler,
  13008. vm
  13009. ) {
  13010. var name, def$$1, cur, old, event;
  13011. for (name in on) {
  13012. def$$1 = cur = on[name];
  13013. old = oldOn[name];
  13014. event = normalizeEvent(name);
  13015. if (isUndef(cur)) {
  13016. true && warn(
  13017. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  13018. vm
  13019. );
  13020. } else if (isUndef(old)) {
  13021. if (isUndef(cur.fns)) {
  13022. cur = on[name] = createFnInvoker(cur, vm);
  13023. }
  13024. if (isTrue(event.once)) {
  13025. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  13026. }
  13027. add(event.name, cur, event.capture, event.passive, event.params);
  13028. } else if (cur !== old) {
  13029. old.fns = cur;
  13030. on[name] = old;
  13031. }
  13032. }
  13033. for (name in oldOn) {
  13034. if (isUndef(on[name])) {
  13035. event = normalizeEvent(name);
  13036. remove$$1(event.name, oldOn[name], event.capture);
  13037. }
  13038. }
  13039. }
  13040. /* */
  13041. /* */
  13042. // fixed by xxxxxx (mp properties)
  13043. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  13044. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  13045. if (isUndef(propOptions)) {
  13046. return res
  13047. }
  13048. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  13049. var attrs = data.attrs;
  13050. var props = data.props;
  13051. if (isDef(attrs) || isDef(props)) {
  13052. for (var key in propOptions) {
  13053. var altKey = hyphenate(key);
  13054. var result = checkProp(res, props, key, altKey, true) ||
  13055. checkProp(res, attrs, key, altKey, false);
  13056. // externalClass
  13057. if (
  13058. result &&
  13059. res[key] &&
  13060. externalClasses.indexOf(altKey) !== -1 &&
  13061. context[camelize(res[key])]
  13062. ) {
  13063. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  13064. res[key] = context[camelize(res[key])];
  13065. }
  13066. }
  13067. }
  13068. return res
  13069. }
  13070. function extractPropsFromVNodeData (
  13071. data,
  13072. Ctor,
  13073. tag,
  13074. context// fixed by xxxxxx
  13075. ) {
  13076. // we are only extracting raw values here.
  13077. // validation and default values are handled in the child
  13078. // component itself.
  13079. var propOptions = Ctor.options.props;
  13080. if (isUndef(propOptions)) {
  13081. // fixed by xxxxxx
  13082. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  13083. }
  13084. var res = {};
  13085. var attrs = data.attrs;
  13086. var props = data.props;
  13087. if (isDef(attrs) || isDef(props)) {
  13088. for (var key in propOptions) {
  13089. var altKey = hyphenate(key);
  13090. if (true) {
  13091. var keyInLowerCase = key.toLowerCase();
  13092. if (
  13093. key !== keyInLowerCase &&
  13094. attrs && hasOwn(attrs, keyInLowerCase)
  13095. ) {
  13096. tip(
  13097. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  13098. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  13099. " \"" + key + "\". " +
  13100. "Note that HTML attributes are case-insensitive and camelCased " +
  13101. "props need to use their kebab-case equivalents when using in-DOM " +
  13102. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  13103. );
  13104. }
  13105. }
  13106. checkProp(res, props, key, altKey, true) ||
  13107. checkProp(res, attrs, key, altKey, false);
  13108. }
  13109. }
  13110. // fixed by xxxxxx
  13111. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  13112. }
  13113. function checkProp (
  13114. res,
  13115. hash,
  13116. key,
  13117. altKey,
  13118. preserve
  13119. ) {
  13120. if (isDef(hash)) {
  13121. if (hasOwn(hash, key)) {
  13122. res[key] = hash[key];
  13123. if (!preserve) {
  13124. delete hash[key];
  13125. }
  13126. return true
  13127. } else if (hasOwn(hash, altKey)) {
  13128. res[key] = hash[altKey];
  13129. if (!preserve) {
  13130. delete hash[altKey];
  13131. }
  13132. return true
  13133. }
  13134. }
  13135. return false
  13136. }
  13137. /* */
  13138. // The template compiler attempts to minimize the need for normalization by
  13139. // statically analyzing the template at compile time.
  13140. //
  13141. // For plain HTML markup, normalization can be completely skipped because the
  13142. // generated render function is guaranteed to return Array<VNode>. There are
  13143. // two cases where extra normalization is needed:
  13144. // 1. When the children contains components - because a functional component
  13145. // may return an Array instead of a single root. In this case, just a simple
  13146. // normalization is needed - if any child is an Array, we flatten the whole
  13147. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  13148. // because functional components already normalize their own children.
  13149. function simpleNormalizeChildren (children) {
  13150. for (var i = 0; i < children.length; i++) {
  13151. if (Array.isArray(children[i])) {
  13152. return Array.prototype.concat.apply([], children)
  13153. }
  13154. }
  13155. return children
  13156. }
  13157. // 2. When the children contains constructs that always generated nested Arrays,
  13158. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  13159. // with hand-written render functions / JSX. In such cases a full normalization
  13160. // is needed to cater to all possible types of children values.
  13161. function normalizeChildren (children) {
  13162. return isPrimitive(children)
  13163. ? [createTextVNode(children)]
  13164. : Array.isArray(children)
  13165. ? normalizeArrayChildren(children)
  13166. : undefined
  13167. }
  13168. function isTextNode (node) {
  13169. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  13170. }
  13171. function normalizeArrayChildren (children, nestedIndex) {
  13172. var res = [];
  13173. var i, c, lastIndex, last;
  13174. for (i = 0; i < children.length; i++) {
  13175. c = children[i];
  13176. if (isUndef(c) || typeof c === 'boolean') { continue }
  13177. lastIndex = res.length - 1;
  13178. last = res[lastIndex];
  13179. // nested
  13180. if (Array.isArray(c)) {
  13181. if (c.length > 0) {
  13182. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  13183. // merge adjacent text nodes
  13184. if (isTextNode(c[0]) && isTextNode(last)) {
  13185. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  13186. c.shift();
  13187. }
  13188. res.push.apply(res, c);
  13189. }
  13190. } else if (isPrimitive(c)) {
  13191. if (isTextNode(last)) {
  13192. // merge adjacent text nodes
  13193. // this is necessary for SSR hydration because text nodes are
  13194. // essentially merged when rendered to HTML strings
  13195. res[lastIndex] = createTextVNode(last.text + c);
  13196. } else if (c !== '') {
  13197. // convert primitive to vnode
  13198. res.push(createTextVNode(c));
  13199. }
  13200. } else {
  13201. if (isTextNode(c) && isTextNode(last)) {
  13202. // merge adjacent text nodes
  13203. res[lastIndex] = createTextVNode(last.text + c.text);
  13204. } else {
  13205. // default key for nested array children (likely generated by v-for)
  13206. if (isTrue(children._isVList) &&
  13207. isDef(c.tag) &&
  13208. isUndef(c.key) &&
  13209. isDef(nestedIndex)) {
  13210. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  13211. }
  13212. res.push(c);
  13213. }
  13214. }
  13215. }
  13216. return res
  13217. }
  13218. /* */
  13219. function initProvide (vm) {
  13220. var provide = vm.$options.provide;
  13221. if (provide) {
  13222. vm._provided = typeof provide === 'function'
  13223. ? provide.call(vm)
  13224. : provide;
  13225. }
  13226. }
  13227. function initInjections (vm) {
  13228. var result = resolveInject(vm.$options.inject, vm);
  13229. if (result) {
  13230. toggleObserving(false);
  13231. Object.keys(result).forEach(function (key) {
  13232. /* istanbul ignore else */
  13233. if (true) {
  13234. defineReactive$$1(vm, key, result[key], function () {
  13235. warn(
  13236. "Avoid mutating an injected value directly since the changes will be " +
  13237. "overwritten whenever the provided component re-renders. " +
  13238. "injection being mutated: \"" + key + "\"",
  13239. vm
  13240. );
  13241. });
  13242. } else {}
  13243. });
  13244. toggleObserving(true);
  13245. }
  13246. }
  13247. function resolveInject (inject, vm) {
  13248. if (inject) {
  13249. // inject is :any because flow is not smart enough to figure out cached
  13250. var result = Object.create(null);
  13251. var keys = hasSymbol
  13252. ? Reflect.ownKeys(inject)
  13253. : Object.keys(inject);
  13254. for (var i = 0; i < keys.length; i++) {
  13255. var key = keys[i];
  13256. // #6574 in case the inject object is observed...
  13257. if (key === '__ob__') { continue }
  13258. var provideKey = inject[key].from;
  13259. var source = vm;
  13260. while (source) {
  13261. if (source._provided && hasOwn(source._provided, provideKey)) {
  13262. result[key] = source._provided[provideKey];
  13263. break
  13264. }
  13265. source = source.$parent;
  13266. }
  13267. if (!source) {
  13268. if ('default' in inject[key]) {
  13269. var provideDefault = inject[key].default;
  13270. result[key] = typeof provideDefault === 'function'
  13271. ? provideDefault.call(vm)
  13272. : provideDefault;
  13273. } else if (true) {
  13274. warn(("Injection \"" + key + "\" not found"), vm);
  13275. }
  13276. }
  13277. }
  13278. return result
  13279. }
  13280. }
  13281. /* */
  13282. /**
  13283. * Runtime helper for resolving raw children VNodes into a slot object.
  13284. */
  13285. function resolveSlots (
  13286. children,
  13287. context
  13288. ) {
  13289. if (!children || !children.length) {
  13290. return {}
  13291. }
  13292. var slots = {};
  13293. for (var i = 0, l = children.length; i < l; i++) {
  13294. var child = children[i];
  13295. var data = child.data;
  13296. // remove slot attribute if the node is resolved as a Vue slot node
  13297. if (data && data.attrs && data.attrs.slot) {
  13298. delete data.attrs.slot;
  13299. }
  13300. // named slots should only be respected if the vnode was rendered in the
  13301. // same context.
  13302. if ((child.context === context || child.fnContext === context) &&
  13303. data && data.slot != null
  13304. ) {
  13305. var name = data.slot;
  13306. var slot = (slots[name] || (slots[name] = []));
  13307. if (child.tag === 'template') {
  13308. slot.push.apply(slot, child.children || []);
  13309. } else {
  13310. slot.push(child);
  13311. }
  13312. } else {
  13313. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  13314. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  13315. (slots['page'] || (slots['page'] = [])).push(child);
  13316. }else{
  13317. (slots.default || (slots.default = [])).push(child);
  13318. }
  13319. }
  13320. }
  13321. // ignore slots that contains only whitespace
  13322. for (var name$1 in slots) {
  13323. if (slots[name$1].every(isWhitespace)) {
  13324. delete slots[name$1];
  13325. }
  13326. }
  13327. return slots
  13328. }
  13329. function isWhitespace (node) {
  13330. return (node.isComment && !node.asyncFactory) || node.text === ' '
  13331. }
  13332. /* */
  13333. function normalizeScopedSlots (
  13334. slots,
  13335. normalSlots,
  13336. prevSlots
  13337. ) {
  13338. var res;
  13339. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  13340. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  13341. var key = slots && slots.$key;
  13342. if (!slots) {
  13343. res = {};
  13344. } else if (slots._normalized) {
  13345. // fast path 1: child component re-render only, parent did not change
  13346. return slots._normalized
  13347. } else if (
  13348. isStable &&
  13349. prevSlots &&
  13350. prevSlots !== emptyObject &&
  13351. key === prevSlots.$key &&
  13352. !hasNormalSlots &&
  13353. !prevSlots.$hasNormal
  13354. ) {
  13355. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  13356. // only need to normalize once
  13357. return prevSlots
  13358. } else {
  13359. res = {};
  13360. for (var key$1 in slots) {
  13361. if (slots[key$1] && key$1[0] !== '$') {
  13362. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  13363. }
  13364. }
  13365. }
  13366. // expose normal slots on scopedSlots
  13367. for (var key$2 in normalSlots) {
  13368. if (!(key$2 in res)) {
  13369. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  13370. }
  13371. }
  13372. // avoriaz seems to mock a non-extensible $scopedSlots object
  13373. // and when that is passed down this would cause an error
  13374. if (slots && Object.isExtensible(slots)) {
  13375. (slots)._normalized = res;
  13376. }
  13377. def(res, '$stable', isStable);
  13378. def(res, '$key', key);
  13379. def(res, '$hasNormal', hasNormalSlots);
  13380. return res
  13381. }
  13382. function normalizeScopedSlot(normalSlots, key, fn) {
  13383. var normalized = function () {
  13384. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  13385. res = res && typeof res === 'object' && !Array.isArray(res)
  13386. ? [res] // single vnode
  13387. : normalizeChildren(res);
  13388. return res && (
  13389. res.length === 0 ||
  13390. (res.length === 1 && res[0].isComment) // #9658
  13391. ) ? undefined
  13392. : res
  13393. };
  13394. // this is a slot using the new v-slot syntax without scope. although it is
  13395. // compiled as a scoped slot, render fn users would expect it to be present
  13396. // on this.$slots because the usage is semantically a normal slot.
  13397. if (fn.proxy) {
  13398. Object.defineProperty(normalSlots, key, {
  13399. get: normalized,
  13400. enumerable: true,
  13401. configurable: true
  13402. });
  13403. }
  13404. return normalized
  13405. }
  13406. function proxyNormalSlot(slots, key) {
  13407. return function () { return slots[key]; }
  13408. }
  13409. /* */
  13410. /**
  13411. * Runtime helper for rendering v-for lists.
  13412. */
  13413. function renderList (
  13414. val,
  13415. render
  13416. ) {
  13417. var ret, i, l, keys, key;
  13418. if (Array.isArray(val) || typeof val === 'string') {
  13419. ret = new Array(val.length);
  13420. for (i = 0, l = val.length; i < l; i++) {
  13421. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  13422. }
  13423. } else if (typeof val === 'number') {
  13424. ret = new Array(val);
  13425. for (i = 0; i < val; i++) {
  13426. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  13427. }
  13428. } else if (isObject(val)) {
  13429. if (hasSymbol && val[Symbol.iterator]) {
  13430. ret = [];
  13431. var iterator = val[Symbol.iterator]();
  13432. var result = iterator.next();
  13433. while (!result.done) {
  13434. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  13435. result = iterator.next();
  13436. }
  13437. } else {
  13438. keys = Object.keys(val);
  13439. ret = new Array(keys.length);
  13440. for (i = 0, l = keys.length; i < l; i++) {
  13441. key = keys[i];
  13442. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  13443. }
  13444. }
  13445. }
  13446. if (!isDef(ret)) {
  13447. ret = [];
  13448. }
  13449. (ret)._isVList = true;
  13450. return ret
  13451. }
  13452. /* */
  13453. /**
  13454. * Runtime helper for rendering <slot>
  13455. */
  13456. function renderSlot (
  13457. name,
  13458. fallback,
  13459. props,
  13460. bindObject
  13461. ) {
  13462. var scopedSlotFn = this.$scopedSlots[name];
  13463. var nodes;
  13464. if (scopedSlotFn) { // scoped slot
  13465. props = props || {};
  13466. if (bindObject) {
  13467. if ( true && !isObject(bindObject)) {
  13468. warn(
  13469. 'slot v-bind without argument expects an Object',
  13470. this
  13471. );
  13472. }
  13473. props = extend(extend({}, bindObject), props);
  13474. }
  13475. // fixed by xxxxxx app-plus scopedSlot
  13476. nodes = scopedSlotFn(props, this, props._i) || fallback;
  13477. } else {
  13478. nodes = this.$slots[name] || fallback;
  13479. }
  13480. var target = props && props.slot;
  13481. if (target) {
  13482. return this.$createElement('template', { slot: target }, nodes)
  13483. } else {
  13484. return nodes
  13485. }
  13486. }
  13487. /* */
  13488. /**
  13489. * Runtime helper for resolving filters
  13490. */
  13491. function resolveFilter (id) {
  13492. return resolveAsset(this.$options, 'filters', id, true) || identity
  13493. }
  13494. /* */
  13495. function isKeyNotMatch (expect, actual) {
  13496. if (Array.isArray(expect)) {
  13497. return expect.indexOf(actual) === -1
  13498. } else {
  13499. return expect !== actual
  13500. }
  13501. }
  13502. /**
  13503. * Runtime helper for checking keyCodes from config.
  13504. * exposed as Vue.prototype._k
  13505. * passing in eventKeyName as last argument separately for backwards compat
  13506. */
  13507. function checkKeyCodes (
  13508. eventKeyCode,
  13509. key,
  13510. builtInKeyCode,
  13511. eventKeyName,
  13512. builtInKeyName
  13513. ) {
  13514. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  13515. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  13516. return isKeyNotMatch(builtInKeyName, eventKeyName)
  13517. } else if (mappedKeyCode) {
  13518. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  13519. } else if (eventKeyName) {
  13520. return hyphenate(eventKeyName) !== key
  13521. }
  13522. }
  13523. /* */
  13524. /**
  13525. * Runtime helper for merging v-bind="object" into a VNode's data.
  13526. */
  13527. function bindObjectProps (
  13528. data,
  13529. tag,
  13530. value,
  13531. asProp,
  13532. isSync
  13533. ) {
  13534. if (value) {
  13535. if (!isObject(value)) {
  13536. true && warn(
  13537. 'v-bind without argument expects an Object or Array value',
  13538. this
  13539. );
  13540. } else {
  13541. if (Array.isArray(value)) {
  13542. value = toObject(value);
  13543. }
  13544. var hash;
  13545. var loop = function ( key ) {
  13546. if (
  13547. key === 'class' ||
  13548. key === 'style' ||
  13549. isReservedAttribute(key)
  13550. ) {
  13551. hash = data;
  13552. } else {
  13553. var type = data.attrs && data.attrs.type;
  13554. hash = asProp || config.mustUseProp(tag, type, key)
  13555. ? data.domProps || (data.domProps = {})
  13556. : data.attrs || (data.attrs = {});
  13557. }
  13558. var camelizedKey = camelize(key);
  13559. var hyphenatedKey = hyphenate(key);
  13560. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  13561. hash[key] = value[key];
  13562. if (isSync) {
  13563. var on = data.on || (data.on = {});
  13564. on[("update:" + key)] = function ($event) {
  13565. value[key] = $event;
  13566. };
  13567. }
  13568. }
  13569. };
  13570. for (var key in value) loop( key );
  13571. }
  13572. }
  13573. return data
  13574. }
  13575. /* */
  13576. /**
  13577. * Runtime helper for rendering static trees.
  13578. */
  13579. function renderStatic (
  13580. index,
  13581. isInFor
  13582. ) {
  13583. var cached = this._staticTrees || (this._staticTrees = []);
  13584. var tree = cached[index];
  13585. // if has already-rendered static tree and not inside v-for,
  13586. // we can reuse the same tree.
  13587. if (tree && !isInFor) {
  13588. return tree
  13589. }
  13590. // otherwise, render a fresh tree.
  13591. tree = cached[index] = this.$options.staticRenderFns[index].call(
  13592. this._renderProxy,
  13593. null,
  13594. this // for render fns generated for functional component templates
  13595. );
  13596. markStatic(tree, ("__static__" + index), false);
  13597. return tree
  13598. }
  13599. /**
  13600. * Runtime helper for v-once.
  13601. * Effectively it means marking the node as static with a unique key.
  13602. */
  13603. function markOnce (
  13604. tree,
  13605. index,
  13606. key
  13607. ) {
  13608. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  13609. return tree
  13610. }
  13611. function markStatic (
  13612. tree,
  13613. key,
  13614. isOnce
  13615. ) {
  13616. if (Array.isArray(tree)) {
  13617. for (var i = 0; i < tree.length; i++) {
  13618. if (tree[i] && typeof tree[i] !== 'string') {
  13619. markStaticNode(tree[i], (key + "_" + i), isOnce);
  13620. }
  13621. }
  13622. } else {
  13623. markStaticNode(tree, key, isOnce);
  13624. }
  13625. }
  13626. function markStaticNode (node, key, isOnce) {
  13627. node.isStatic = true;
  13628. node.key = key;
  13629. node.isOnce = isOnce;
  13630. }
  13631. /* */
  13632. function bindObjectListeners (data, value) {
  13633. if (value) {
  13634. if (!isPlainObject(value)) {
  13635. true && warn(
  13636. 'v-on without argument expects an Object value',
  13637. this
  13638. );
  13639. } else {
  13640. var on = data.on = data.on ? extend({}, data.on) : {};
  13641. for (var key in value) {
  13642. var existing = on[key];
  13643. var ours = value[key];
  13644. on[key] = existing ? [].concat(existing, ours) : ours;
  13645. }
  13646. }
  13647. }
  13648. return data
  13649. }
  13650. /* */
  13651. function resolveScopedSlots (
  13652. fns, // see flow/vnode
  13653. res,
  13654. // the following are added in 2.6
  13655. hasDynamicKeys,
  13656. contentHashKey
  13657. ) {
  13658. res = res || { $stable: !hasDynamicKeys };
  13659. for (var i = 0; i < fns.length; i++) {
  13660. var slot = fns[i];
  13661. if (Array.isArray(slot)) {
  13662. resolveScopedSlots(slot, res, hasDynamicKeys);
  13663. } else if (slot) {
  13664. // marker for reverse proxying v-slot without scope on this.$slots
  13665. if (slot.proxy) {
  13666. slot.fn.proxy = true;
  13667. }
  13668. res[slot.key] = slot.fn;
  13669. }
  13670. }
  13671. if (contentHashKey) {
  13672. (res).$key = contentHashKey;
  13673. }
  13674. return res
  13675. }
  13676. /* */
  13677. function bindDynamicKeys (baseObj, values) {
  13678. for (var i = 0; i < values.length; i += 2) {
  13679. var key = values[i];
  13680. if (typeof key === 'string' && key) {
  13681. baseObj[values[i]] = values[i + 1];
  13682. } else if ( true && key !== '' && key !== null) {
  13683. // null is a special value for explicitly removing a binding
  13684. warn(
  13685. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  13686. this
  13687. );
  13688. }
  13689. }
  13690. return baseObj
  13691. }
  13692. // helper to dynamically append modifier runtime markers to event names.
  13693. // ensure only append when value is already string, otherwise it will be cast
  13694. // to string and cause the type check to miss.
  13695. function prependModifier (value, symbol) {
  13696. return typeof value === 'string' ? symbol + value : value
  13697. }
  13698. /* */
  13699. function installRenderHelpers (target) {
  13700. target._o = markOnce;
  13701. target._n = toNumber;
  13702. target._s = toString;
  13703. target._l = renderList;
  13704. target._t = renderSlot;
  13705. target._q = looseEqual;
  13706. target._i = looseIndexOf;
  13707. target._m = renderStatic;
  13708. target._f = resolveFilter;
  13709. target._k = checkKeyCodes;
  13710. target._b = bindObjectProps;
  13711. target._v = createTextVNode;
  13712. target._e = createEmptyVNode;
  13713. target._u = resolveScopedSlots;
  13714. target._g = bindObjectListeners;
  13715. target._d = bindDynamicKeys;
  13716. target._p = prependModifier;
  13717. }
  13718. /* */
  13719. function FunctionalRenderContext (
  13720. data,
  13721. props,
  13722. children,
  13723. parent,
  13724. Ctor
  13725. ) {
  13726. var this$1 = this;
  13727. var options = Ctor.options;
  13728. // ensure the createElement function in functional components
  13729. // gets a unique context - this is necessary for correct named slot check
  13730. var contextVm;
  13731. if (hasOwn(parent, '_uid')) {
  13732. contextVm = Object.create(parent);
  13733. // $flow-disable-line
  13734. contextVm._original = parent;
  13735. } else {
  13736. // the context vm passed in is a functional context as well.
  13737. // in this case we want to make sure we are able to get a hold to the
  13738. // real context instance.
  13739. contextVm = parent;
  13740. // $flow-disable-line
  13741. parent = parent._original;
  13742. }
  13743. var isCompiled = isTrue(options._compiled);
  13744. var needNormalization = !isCompiled;
  13745. this.data = data;
  13746. this.props = props;
  13747. this.children = children;
  13748. this.parent = parent;
  13749. this.listeners = data.on || emptyObject;
  13750. this.injections = resolveInject(options.inject, parent);
  13751. this.slots = function () {
  13752. if (!this$1.$slots) {
  13753. normalizeScopedSlots(
  13754. data.scopedSlots,
  13755. this$1.$slots = resolveSlots(children, parent)
  13756. );
  13757. }
  13758. return this$1.$slots
  13759. };
  13760. Object.defineProperty(this, 'scopedSlots', ({
  13761. enumerable: true,
  13762. get: function get () {
  13763. return normalizeScopedSlots(data.scopedSlots, this.slots())
  13764. }
  13765. }));
  13766. // support for compiled functional template
  13767. if (isCompiled) {
  13768. // exposing $options for renderStatic()
  13769. this.$options = options;
  13770. // pre-resolve slots for renderSlot()
  13771. this.$slots = this.slots();
  13772. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  13773. }
  13774. if (options._scopeId) {
  13775. this._c = function (a, b, c, d) {
  13776. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  13777. if (vnode && !Array.isArray(vnode)) {
  13778. vnode.fnScopeId = options._scopeId;
  13779. vnode.fnContext = parent;
  13780. }
  13781. return vnode
  13782. };
  13783. } else {
  13784. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  13785. }
  13786. }
  13787. installRenderHelpers(FunctionalRenderContext.prototype);
  13788. function createFunctionalComponent (
  13789. Ctor,
  13790. propsData,
  13791. data,
  13792. contextVm,
  13793. children
  13794. ) {
  13795. var options = Ctor.options;
  13796. var props = {};
  13797. var propOptions = options.props;
  13798. if (isDef(propOptions)) {
  13799. for (var key in propOptions) {
  13800. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  13801. }
  13802. } else {
  13803. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  13804. if (isDef(data.props)) { mergeProps(props, data.props); }
  13805. }
  13806. var renderContext = new FunctionalRenderContext(
  13807. data,
  13808. props,
  13809. children,
  13810. contextVm,
  13811. Ctor
  13812. );
  13813. var vnode = options.render.call(null, renderContext._c, renderContext);
  13814. if (vnode instanceof VNode) {
  13815. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  13816. } else if (Array.isArray(vnode)) {
  13817. var vnodes = normalizeChildren(vnode) || [];
  13818. var res = new Array(vnodes.length);
  13819. for (var i = 0; i < vnodes.length; i++) {
  13820. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  13821. }
  13822. return res
  13823. }
  13824. }
  13825. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  13826. // #7817 clone node before setting fnContext, otherwise if the node is reused
  13827. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  13828. // that should not be matched to match.
  13829. var clone = cloneVNode(vnode);
  13830. clone.fnContext = contextVm;
  13831. clone.fnOptions = options;
  13832. if (true) {
  13833. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  13834. }
  13835. if (data.slot) {
  13836. (clone.data || (clone.data = {})).slot = data.slot;
  13837. }
  13838. return clone
  13839. }
  13840. function mergeProps (to, from) {
  13841. for (var key in from) {
  13842. to[camelize(key)] = from[key];
  13843. }
  13844. }
  13845. /* */
  13846. /* */
  13847. /* */
  13848. /* */
  13849. // inline hooks to be invoked on component VNodes during patch
  13850. var componentVNodeHooks = {
  13851. init: function init (vnode, hydrating) {
  13852. if (
  13853. vnode.componentInstance &&
  13854. !vnode.componentInstance._isDestroyed &&
  13855. vnode.data.keepAlive
  13856. ) {
  13857. // kept-alive components, treat as a patch
  13858. var mountedNode = vnode; // work around flow
  13859. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  13860. } else {
  13861. var child = vnode.componentInstance = createComponentInstanceForVnode(
  13862. vnode,
  13863. activeInstance
  13864. );
  13865. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  13866. }
  13867. },
  13868. prepatch: function prepatch (oldVnode, vnode) {
  13869. var options = vnode.componentOptions;
  13870. var child = vnode.componentInstance = oldVnode.componentInstance;
  13871. updateChildComponent(
  13872. child,
  13873. options.propsData, // updated props
  13874. options.listeners, // updated listeners
  13875. vnode, // new parent vnode
  13876. options.children // new children
  13877. );
  13878. },
  13879. insert: function insert (vnode) {
  13880. var context = vnode.context;
  13881. var componentInstance = vnode.componentInstance;
  13882. if (!componentInstance._isMounted) {
  13883. callHook(componentInstance, 'onServiceCreated');
  13884. callHook(componentInstance, 'onServiceAttached');
  13885. componentInstance._isMounted = true;
  13886. callHook(componentInstance, 'mounted');
  13887. }
  13888. if (vnode.data.keepAlive) {
  13889. if (context._isMounted) {
  13890. // vue-router#1212
  13891. // During updates, a kept-alive component's child components may
  13892. // change, so directly walking the tree here may call activated hooks
  13893. // on incorrect children. Instead we push them into a queue which will
  13894. // be processed after the whole patch process ended.
  13895. queueActivatedComponent(componentInstance);
  13896. } else {
  13897. activateChildComponent(componentInstance, true /* direct */);
  13898. }
  13899. }
  13900. },
  13901. destroy: function destroy (vnode) {
  13902. var componentInstance = vnode.componentInstance;
  13903. if (!componentInstance._isDestroyed) {
  13904. if (!vnode.data.keepAlive) {
  13905. componentInstance.$destroy();
  13906. } else {
  13907. deactivateChildComponent(componentInstance, true /* direct */);
  13908. }
  13909. }
  13910. }
  13911. };
  13912. var hooksToMerge = Object.keys(componentVNodeHooks);
  13913. function createComponent (
  13914. Ctor,
  13915. data,
  13916. context,
  13917. children,
  13918. tag
  13919. ) {
  13920. if (isUndef(Ctor)) {
  13921. return
  13922. }
  13923. var baseCtor = context.$options._base;
  13924. // plain options object: turn it into a constructor
  13925. if (isObject(Ctor)) {
  13926. Ctor = baseCtor.extend(Ctor);
  13927. }
  13928. // if at this stage it's not a constructor or an async component factory,
  13929. // reject.
  13930. if (typeof Ctor !== 'function') {
  13931. if (true) {
  13932. warn(("Invalid Component definition: " + (String(Ctor))), context);
  13933. }
  13934. return
  13935. }
  13936. // async component
  13937. var asyncFactory;
  13938. if (isUndef(Ctor.cid)) {
  13939. asyncFactory = Ctor;
  13940. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  13941. if (Ctor === undefined) {
  13942. // return a placeholder node for async component, which is rendered
  13943. // as a comment node but preserves all the raw information for the node.
  13944. // the information will be used for async server-rendering and hydration.
  13945. return createAsyncPlaceholder(
  13946. asyncFactory,
  13947. data,
  13948. context,
  13949. children,
  13950. tag
  13951. )
  13952. }
  13953. }
  13954. data = data || {};
  13955. // resolve constructor options in case global mixins are applied after
  13956. // component constructor creation
  13957. resolveConstructorOptions(Ctor);
  13958. // transform component v-model data into props & events
  13959. if (isDef(data.model)) {
  13960. transformModel(Ctor.options, data);
  13961. }
  13962. // extract props
  13963. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  13964. // functional component
  13965. if (isTrue(Ctor.options.functional)) {
  13966. return createFunctionalComponent(Ctor, propsData, data, context, children)
  13967. }
  13968. // extract listeners, since these needs to be treated as
  13969. // child component listeners instead of DOM listeners
  13970. var listeners = data.on;
  13971. // replace with listeners with .native modifier
  13972. // so it gets processed during parent component patch.
  13973. data.on = data.nativeOn;
  13974. if (isTrue(Ctor.options.abstract)) {
  13975. // abstract components do not keep anything
  13976. // other than props & listeners & slot
  13977. // work around flow
  13978. var slot = data.slot;
  13979. data = {};
  13980. if (slot) {
  13981. data.slot = slot;
  13982. }
  13983. }
  13984. // install component management hooks onto the placeholder node
  13985. installComponentHooks(data);
  13986. // return a placeholder vnode
  13987. var name = Ctor.options.name || tag;
  13988. var vnode = new VNode(
  13989. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  13990. data, undefined, undefined, undefined, context,
  13991. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  13992. asyncFactory
  13993. );
  13994. return vnode
  13995. }
  13996. function createComponentInstanceForVnode (
  13997. vnode, // we know it's MountedComponentVNode but flow doesn't
  13998. parent // activeInstance in lifecycle state
  13999. ) {
  14000. var options = {
  14001. _isComponent: true,
  14002. _parentVnode: vnode,
  14003. parent: parent
  14004. };
  14005. // check inline-template render functions
  14006. var inlineTemplate = vnode.data.inlineTemplate;
  14007. if (isDef(inlineTemplate)) {
  14008. options.render = inlineTemplate.render;
  14009. options.staticRenderFns = inlineTemplate.staticRenderFns;
  14010. }
  14011. return new vnode.componentOptions.Ctor(options)
  14012. }
  14013. function installComponentHooks (data) {
  14014. var hooks = data.hook || (data.hook = {});
  14015. for (var i = 0; i < hooksToMerge.length; i++) {
  14016. var key = hooksToMerge[i];
  14017. var existing = hooks[key];
  14018. var toMerge = componentVNodeHooks[key];
  14019. if (existing !== toMerge && !(existing && existing._merged)) {
  14020. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  14021. }
  14022. }
  14023. }
  14024. function mergeHook$1 (f1, f2) {
  14025. var merged = function (a, b) {
  14026. // flow complains about extra args which is why we use any
  14027. f1(a, b);
  14028. f2(a, b);
  14029. };
  14030. merged._merged = true;
  14031. return merged
  14032. }
  14033. // transform component v-model info (value and callback) into
  14034. // prop and event handler respectively.
  14035. function transformModel (options, data) {
  14036. var prop = (options.model && options.model.prop) || 'value';
  14037. var event = (options.model && options.model.event) || 'input'
  14038. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  14039. var on = data.on || (data.on = {});
  14040. var existing = on[event];
  14041. var callback = data.model.callback;
  14042. if (isDef(existing)) {
  14043. if (
  14044. Array.isArray(existing)
  14045. ? existing.indexOf(callback) === -1
  14046. : existing !== callback
  14047. ) {
  14048. on[event] = [callback].concat(existing);
  14049. }
  14050. } else {
  14051. on[event] = callback;
  14052. }
  14053. }
  14054. /* */
  14055. var SIMPLE_NORMALIZE = 1;
  14056. var ALWAYS_NORMALIZE = 2;
  14057. // wrapper function for providing a more flexible interface
  14058. // without getting yelled at by flow
  14059. function createElement (
  14060. context,
  14061. tag,
  14062. data,
  14063. children,
  14064. normalizationType,
  14065. alwaysNormalize
  14066. ) {
  14067. if (Array.isArray(data) || isPrimitive(data)) {
  14068. normalizationType = children;
  14069. children = data;
  14070. data = undefined;
  14071. }
  14072. if (isTrue(alwaysNormalize)) {
  14073. normalizationType = ALWAYS_NORMALIZE;
  14074. }
  14075. return _createElement(context, tag, data, children, normalizationType)
  14076. }
  14077. function _createElement (
  14078. context,
  14079. tag,
  14080. data,
  14081. children,
  14082. normalizationType
  14083. ) {
  14084. if (isDef(data) && isDef((data).__ob__)) {
  14085. true && warn(
  14086. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  14087. 'Always create fresh vnode data objects in each render!',
  14088. context
  14089. );
  14090. return createEmptyVNode()
  14091. }
  14092. // object syntax in v-bind
  14093. if (isDef(data) && isDef(data.is)) {
  14094. tag = data.is;
  14095. }
  14096. if (!tag) {
  14097. // in case of component :is set to falsy value
  14098. return createEmptyVNode()
  14099. }
  14100. // warn against non-primitive key
  14101. if ( true &&
  14102. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  14103. ) {
  14104. {
  14105. warn(
  14106. 'Avoid using non-primitive value as key, ' +
  14107. 'use string/number value instead.',
  14108. context
  14109. );
  14110. }
  14111. }
  14112. // support single function children as default scoped slot
  14113. if (Array.isArray(children) &&
  14114. typeof children[0] === 'function'
  14115. ) {
  14116. data = data || {};
  14117. data.scopedSlots = { default: children[0] };
  14118. children.length = 0;
  14119. }
  14120. if (normalizationType === ALWAYS_NORMALIZE) {
  14121. children = normalizeChildren(children);
  14122. } else if (normalizationType === SIMPLE_NORMALIZE) {
  14123. children = simpleNormalizeChildren(children);
  14124. }
  14125. var vnode, ns;
  14126. if (typeof tag === 'string') {
  14127. var Ctor;
  14128. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  14129. if (config.isReservedTag(tag)) {
  14130. // platform built-in elements
  14131. if ( true && isDef(data) && isDef(data.nativeOn)) {
  14132. warn(
  14133. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  14134. context
  14135. );
  14136. }
  14137. vnode = new VNode(
  14138. config.parsePlatformTagName(tag), data, children,
  14139. undefined, undefined, context
  14140. );
  14141. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  14142. // component
  14143. vnode = createComponent(Ctor, data, context, children, tag);
  14144. } else {
  14145. // unknown or unlisted namespaced elements
  14146. // check at runtime because it may get assigned a namespace when its
  14147. // parent normalizes children
  14148. vnode = new VNode(
  14149. tag, data, children,
  14150. undefined, undefined, context
  14151. );
  14152. }
  14153. } else {
  14154. // direct component options / constructor
  14155. vnode = createComponent(tag, data, context, children);
  14156. }
  14157. if (Array.isArray(vnode)) {
  14158. return vnode
  14159. } else if (isDef(vnode)) {
  14160. if (isDef(ns)) { applyNS(vnode, ns); }
  14161. if (isDef(data)) { registerDeepBindings(data); }
  14162. return vnode
  14163. } else {
  14164. return createEmptyVNode()
  14165. }
  14166. }
  14167. function applyNS (vnode, ns, force) {
  14168. vnode.ns = ns;
  14169. if (vnode.tag === 'foreignObject') {
  14170. // use default namespace inside foreignObject
  14171. ns = undefined;
  14172. force = true;
  14173. }
  14174. if (isDef(vnode.children)) {
  14175. for (var i = 0, l = vnode.children.length; i < l; i++) {
  14176. var child = vnode.children[i];
  14177. if (isDef(child.tag) && (
  14178. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  14179. applyNS(child, ns, force);
  14180. }
  14181. }
  14182. }
  14183. }
  14184. // ref #5318
  14185. // necessary to ensure parent re-render when deep bindings like :style and
  14186. // :class are used on slot nodes
  14187. function registerDeepBindings (data) {
  14188. if (isObject(data.style)) {
  14189. traverse(data.style);
  14190. }
  14191. if (isObject(data.class)) {
  14192. traverse(data.class);
  14193. }
  14194. }
  14195. /* */
  14196. function initRender (vm) {
  14197. vm._vnode = null; // the root of the child tree
  14198. vm._staticTrees = null; // v-once cached trees
  14199. var options = vm.$options;
  14200. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  14201. var renderContext = parentVnode && parentVnode.context;
  14202. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  14203. vm.$scopedSlots = emptyObject;
  14204. // bind the createElement fn to this instance
  14205. // so that we get proper render context inside it.
  14206. // args order: tag, data, children, normalizationType, alwaysNormalize
  14207. // internal version is used by render functions compiled from templates
  14208. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  14209. // normalization is always applied for the public version, used in
  14210. // user-written render functions.
  14211. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  14212. // $attrs & $listeners are exposed for easier HOC creation.
  14213. // they need to be reactive so that HOCs using them are always updated
  14214. var parentData = parentVnode && parentVnode.data;
  14215. /* istanbul ignore else */
  14216. if (true) {
  14217. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  14218. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  14219. }, true);
  14220. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  14221. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  14222. }, true);
  14223. } else {}
  14224. }
  14225. var currentRenderingInstance = null;
  14226. function renderMixin (Vue) {
  14227. // install runtime convenience helpers
  14228. installRenderHelpers(Vue.prototype);
  14229. Vue.prototype.$nextTick = function (fn) {
  14230. return nextTick(fn, this)
  14231. };
  14232. Vue.prototype._render = function () {
  14233. var vm = this;
  14234. var ref = vm.$options;
  14235. var render = ref.render;
  14236. var _parentVnode = ref._parentVnode;
  14237. if (_parentVnode) {
  14238. vm.$scopedSlots = normalizeScopedSlots(
  14239. _parentVnode.data.scopedSlots,
  14240. vm.$slots,
  14241. vm.$scopedSlots
  14242. );
  14243. }
  14244. // set parent vnode. this allows render functions to have access
  14245. // to the data on the placeholder node.
  14246. vm.$vnode = _parentVnode;
  14247. // render self
  14248. var vnode;
  14249. try {
  14250. // There's no need to maintain a stack because all render fns are called
  14251. // separately from one another. Nested component's render fns are called
  14252. // when parent component is patched.
  14253. currentRenderingInstance = vm;
  14254. vnode = render.call(vm._renderProxy, vm.$createElement);
  14255. } catch (e) {
  14256. handleError(e, vm, "render");
  14257. // return error render result,
  14258. // or previous vnode to prevent render error causing blank component
  14259. /* istanbul ignore else */
  14260. if ( true && vm.$options.renderError) {
  14261. try {
  14262. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  14263. } catch (e) {
  14264. handleError(e, vm, "renderError");
  14265. vnode = vm._vnode;
  14266. }
  14267. } else {
  14268. vnode = vm._vnode;
  14269. }
  14270. } finally {
  14271. currentRenderingInstance = null;
  14272. }
  14273. // if the returned array contains only a single node, allow it
  14274. if (Array.isArray(vnode) && vnode.length === 1) {
  14275. vnode = vnode[0];
  14276. }
  14277. // return empty vnode in case the render function errored out
  14278. if (!(vnode instanceof VNode)) {
  14279. if ( true && Array.isArray(vnode)) {
  14280. warn(
  14281. 'Multiple root nodes returned from render function. Render function ' +
  14282. 'should return a single root node.',
  14283. vm
  14284. );
  14285. }
  14286. vnode = createEmptyVNode();
  14287. }
  14288. // set parent
  14289. vnode.parent = _parentVnode;
  14290. return vnode
  14291. };
  14292. }
  14293. /* */
  14294. function ensureCtor (comp, base) {
  14295. if (
  14296. comp.__esModule ||
  14297. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  14298. ) {
  14299. comp = comp.default;
  14300. }
  14301. return isObject(comp)
  14302. ? base.extend(comp)
  14303. : comp
  14304. }
  14305. function createAsyncPlaceholder (
  14306. factory,
  14307. data,
  14308. context,
  14309. children,
  14310. tag
  14311. ) {
  14312. var node = createEmptyVNode();
  14313. node.asyncFactory = factory;
  14314. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  14315. return node
  14316. }
  14317. function resolveAsyncComponent (
  14318. factory,
  14319. baseCtor
  14320. ) {
  14321. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  14322. return factory.errorComp
  14323. }
  14324. if (isDef(factory.resolved)) {
  14325. return factory.resolved
  14326. }
  14327. var owner = currentRenderingInstance;
  14328. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  14329. // already pending
  14330. factory.owners.push(owner);
  14331. }
  14332. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  14333. return factory.loadingComp
  14334. }
  14335. if (owner && !isDef(factory.owners)) {
  14336. var owners = factory.owners = [owner];
  14337. var sync = true;
  14338. var timerLoading = null;
  14339. var timerTimeout = null
  14340. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  14341. var forceRender = function (renderCompleted) {
  14342. for (var i = 0, l = owners.length; i < l; i++) {
  14343. (owners[i]).$forceUpdate();
  14344. }
  14345. if (renderCompleted) {
  14346. owners.length = 0;
  14347. if (timerLoading !== null) {
  14348. clearTimeout(timerLoading);
  14349. timerLoading = null;
  14350. }
  14351. if (timerTimeout !== null) {
  14352. clearTimeout(timerTimeout);
  14353. timerTimeout = null;
  14354. }
  14355. }
  14356. };
  14357. var resolve = once(function (res) {
  14358. // cache resolved
  14359. factory.resolved = ensureCtor(res, baseCtor);
  14360. // invoke callbacks only if this is not a synchronous resolve
  14361. // (async resolves are shimmed as synchronous during SSR)
  14362. if (!sync) {
  14363. forceRender(true);
  14364. } else {
  14365. owners.length = 0;
  14366. }
  14367. });
  14368. var reject = once(function (reason) {
  14369. true && warn(
  14370. "Failed to resolve async component: " + (String(factory)) +
  14371. (reason ? ("\nReason: " + reason) : '')
  14372. );
  14373. if (isDef(factory.errorComp)) {
  14374. factory.error = true;
  14375. forceRender(true);
  14376. }
  14377. });
  14378. var res = factory(resolve, reject);
  14379. if (isObject(res)) {
  14380. if (isPromise(res)) {
  14381. // () => Promise
  14382. if (isUndef(factory.resolved)) {
  14383. res.then(resolve, reject);
  14384. }
  14385. } else if (isPromise(res.component)) {
  14386. res.component.then(resolve, reject);
  14387. if (isDef(res.error)) {
  14388. factory.errorComp = ensureCtor(res.error, baseCtor);
  14389. }
  14390. if (isDef(res.loading)) {
  14391. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  14392. if (res.delay === 0) {
  14393. factory.loading = true;
  14394. } else {
  14395. timerLoading = setTimeout(function () {
  14396. timerLoading = null;
  14397. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  14398. factory.loading = true;
  14399. forceRender(false);
  14400. }
  14401. }, res.delay || 200);
  14402. }
  14403. }
  14404. if (isDef(res.timeout)) {
  14405. timerTimeout = setTimeout(function () {
  14406. timerTimeout = null;
  14407. if (isUndef(factory.resolved)) {
  14408. reject(
  14409. true
  14410. ? ("timeout (" + (res.timeout) + "ms)")
  14411. : undefined
  14412. );
  14413. }
  14414. }, res.timeout);
  14415. }
  14416. }
  14417. }
  14418. sync = false;
  14419. // return in case resolved synchronously
  14420. return factory.loading
  14421. ? factory.loadingComp
  14422. : factory.resolved
  14423. }
  14424. }
  14425. /* */
  14426. function isAsyncPlaceholder (node) {
  14427. return node.isComment && node.asyncFactory
  14428. }
  14429. /* */
  14430. function getFirstComponentChild (children) {
  14431. if (Array.isArray(children)) {
  14432. for (var i = 0; i < children.length; i++) {
  14433. var c = children[i];
  14434. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  14435. return c
  14436. }
  14437. }
  14438. }
  14439. }
  14440. /* */
  14441. /* */
  14442. function initEvents (vm) {
  14443. vm._events = Object.create(null);
  14444. vm._hasHookEvent = false;
  14445. // init parent attached events
  14446. var listeners = vm.$options._parentListeners;
  14447. if (listeners) {
  14448. updateComponentListeners(vm, listeners);
  14449. }
  14450. }
  14451. var target;
  14452. function add (event, fn) {
  14453. target.$on(event, fn);
  14454. }
  14455. function remove$1 (event, fn) {
  14456. target.$off(event, fn);
  14457. }
  14458. function createOnceHandler (event, fn) {
  14459. var _target = target;
  14460. return function onceHandler () {
  14461. var res = fn.apply(null, arguments);
  14462. if (res !== null) {
  14463. _target.$off(event, onceHandler);
  14464. }
  14465. }
  14466. }
  14467. function updateComponentListeners (
  14468. vm,
  14469. listeners,
  14470. oldListeners
  14471. ) {
  14472. target = vm;
  14473. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  14474. target = undefined;
  14475. }
  14476. function eventsMixin (Vue) {
  14477. var hookRE = /^hook:/;
  14478. Vue.prototype.$on = function (event, fn) {
  14479. var vm = this;
  14480. if (Array.isArray(event)) {
  14481. for (var i = 0, l = event.length; i < l; i++) {
  14482. vm.$on(event[i], fn);
  14483. }
  14484. } else {
  14485. (vm._events[event] || (vm._events[event] = [])).push(fn);
  14486. // optimize hook:event cost by using a boolean flag marked at registration
  14487. // instead of a hash lookup
  14488. if (hookRE.test(event)) {
  14489. vm._hasHookEvent = true;
  14490. }
  14491. }
  14492. return vm
  14493. };
  14494. Vue.prototype.$once = function (event, fn) {
  14495. var vm = this;
  14496. function on () {
  14497. vm.$off(event, on);
  14498. fn.apply(vm, arguments);
  14499. }
  14500. on.fn = fn;
  14501. vm.$on(event, on);
  14502. return vm
  14503. };
  14504. Vue.prototype.$off = function (event, fn) {
  14505. var vm = this;
  14506. // all
  14507. if (!arguments.length) {
  14508. vm._events = Object.create(null);
  14509. return vm
  14510. }
  14511. // array of events
  14512. if (Array.isArray(event)) {
  14513. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  14514. vm.$off(event[i$1], fn);
  14515. }
  14516. return vm
  14517. }
  14518. // specific event
  14519. var cbs = vm._events[event];
  14520. if (!cbs) {
  14521. return vm
  14522. }
  14523. if (!fn) {
  14524. vm._events[event] = null;
  14525. return vm
  14526. }
  14527. // specific handler
  14528. var cb;
  14529. var i = cbs.length;
  14530. while (i--) {
  14531. cb = cbs[i];
  14532. if (cb === fn || cb.fn === fn) {
  14533. cbs.splice(i, 1);
  14534. break
  14535. }
  14536. }
  14537. return vm
  14538. };
  14539. Vue.prototype.$emit = function (event) {
  14540. var vm = this;
  14541. if (true) {
  14542. var lowerCaseEvent = event.toLowerCase();
  14543. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  14544. tip(
  14545. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  14546. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  14547. "Note that HTML attributes are case-insensitive and you cannot use " +
  14548. "v-on to listen to camelCase events when using in-DOM templates. " +
  14549. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  14550. );
  14551. }
  14552. }
  14553. var cbs = vm._events[event];
  14554. if (cbs) {
  14555. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  14556. var args = toArray(arguments, 1);
  14557. var info = "event handler for \"" + event + "\"";
  14558. for (var i = 0, l = cbs.length; i < l; i++) {
  14559. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  14560. }
  14561. }
  14562. return vm
  14563. };
  14564. }
  14565. /* */
  14566. var activeInstance = null;
  14567. var isUpdatingChildComponent = false;
  14568. function setActiveInstance(vm) {
  14569. var prevActiveInstance = activeInstance;
  14570. activeInstance = vm;
  14571. return function () {
  14572. activeInstance = prevActiveInstance;
  14573. }
  14574. }
  14575. function initLifecycle (vm) {
  14576. var options = vm.$options;
  14577. // locate first non-abstract parent
  14578. var parent = options.parent;
  14579. if (parent && !options.abstract) {
  14580. while (parent.$options.abstract && parent.$parent) {
  14581. parent = parent.$parent;
  14582. }
  14583. parent.$children.push(vm);
  14584. }
  14585. vm.$parent = parent;
  14586. vm.$root = parent ? parent.$root : vm;
  14587. vm.$children = [];
  14588. vm.$refs = {};
  14589. vm._watcher = null;
  14590. vm._inactive = null;
  14591. vm._directInactive = false;
  14592. vm._isMounted = false;
  14593. vm._isDestroyed = false;
  14594. vm._isBeingDestroyed = false;
  14595. }
  14596. function lifecycleMixin (Vue) {
  14597. Vue.prototype._update = function (vnode, hydrating) {
  14598. var vm = this;
  14599. var prevEl = vm.$el;
  14600. var prevVnode = vm._vnode;
  14601. var restoreActiveInstance = setActiveInstance(vm);
  14602. vm._vnode = vnode;
  14603. // Vue.prototype.__patch__ is injected in entry points
  14604. // based on the rendering backend used.
  14605. if (!prevVnode) {
  14606. // initial render
  14607. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  14608. } else {
  14609. // updates
  14610. vm.$el = vm.__patch__(prevVnode, vnode);
  14611. }
  14612. restoreActiveInstance();
  14613. // update __vue__ reference
  14614. if (prevEl) {
  14615. prevEl.__vue__ = null;
  14616. }
  14617. if (vm.$el) {
  14618. vm.$el.__vue__ = vm;
  14619. }
  14620. // if parent is an HOC, update its $el as well
  14621. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  14622. vm.$parent.$el = vm.$el;
  14623. }
  14624. // updated hook is called by the scheduler to ensure that children are
  14625. // updated in a parent's updated hook.
  14626. };
  14627. Vue.prototype.$forceUpdate = function () {
  14628. var vm = this;
  14629. if (vm._watcher) {
  14630. vm._watcher.update();
  14631. }
  14632. };
  14633. Vue.prototype.$destroy = function () {
  14634. var vm = this;
  14635. if (vm._isBeingDestroyed) {
  14636. return
  14637. }
  14638. callHook(vm, 'beforeDestroy');
  14639. vm._isBeingDestroyed = true;
  14640. // remove self from parent
  14641. var parent = vm.$parent;
  14642. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  14643. remove(parent.$children, vm);
  14644. }
  14645. // teardown watchers
  14646. if (vm._watcher) {
  14647. vm._watcher.teardown();
  14648. }
  14649. var i = vm._watchers.length;
  14650. while (i--) {
  14651. vm._watchers[i].teardown();
  14652. }
  14653. // remove reference from data ob
  14654. // frozen object may not have observer.
  14655. if (vm._data.__ob__) {
  14656. vm._data.__ob__.vmCount--;
  14657. }
  14658. // call the last hook...
  14659. vm._isDestroyed = true;
  14660. // invoke destroy hooks on current rendered tree
  14661. vm.__patch__(vm._vnode, null);
  14662. // fire destroyed hook
  14663. callHook(vm, 'destroyed');
  14664. // turn off all instance listeners.
  14665. vm.$off();
  14666. // remove __vue__ reference
  14667. if (vm.$el) {
  14668. vm.$el.__vue__ = null;
  14669. }
  14670. // release circular reference (#6759)
  14671. if (vm.$vnode) {
  14672. vm.$vnode.parent = null;
  14673. }
  14674. };
  14675. }
  14676. function updateChildComponent (
  14677. vm,
  14678. propsData,
  14679. listeners,
  14680. parentVnode,
  14681. renderChildren
  14682. ) {
  14683. if (true) {
  14684. isUpdatingChildComponent = true;
  14685. }
  14686. // determine whether component has slot children
  14687. // we need to do this before overwriting $options._renderChildren.
  14688. // check if there are dynamic scopedSlots (hand-written or compiled but with
  14689. // dynamic slot names). Static scoped slots compiled from template has the
  14690. // "$stable" marker.
  14691. var newScopedSlots = parentVnode.data.scopedSlots;
  14692. var oldScopedSlots = vm.$scopedSlots;
  14693. var hasDynamicScopedSlot = !!(
  14694. (newScopedSlots && !newScopedSlots.$stable) ||
  14695. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  14696. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  14697. );
  14698. // Any static slot children from the parent may have changed during parent's
  14699. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  14700. // update is necessary to ensure correctness.
  14701. var needsForceUpdate = !!(
  14702. renderChildren || // has new static slots
  14703. vm.$options._renderChildren || // has old static slots
  14704. hasDynamicScopedSlot
  14705. );
  14706. vm.$options._parentVnode = parentVnode;
  14707. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  14708. if (vm._vnode) { // update child tree's parent
  14709. vm._vnode.parent = parentVnode;
  14710. }
  14711. vm.$options._renderChildren = renderChildren;
  14712. // update $attrs and $listeners hash
  14713. // these are also reactive so they may trigger child update if the child
  14714. // used them during render
  14715. vm.$attrs = parentVnode.data.attrs || emptyObject;
  14716. vm.$listeners = listeners || emptyObject;
  14717. // update props
  14718. if (propsData && vm.$options.props) {
  14719. toggleObserving(false);
  14720. var props = vm._props;
  14721. var propKeys = vm.$options._propKeys || [];
  14722. for (var i = 0; i < propKeys.length; i++) {
  14723. var key = propKeys[i];
  14724. var propOptions = vm.$options.props; // wtf flow?
  14725. props[key] = validateProp(key, propOptions, propsData, vm);
  14726. }
  14727. toggleObserving(true);
  14728. // keep a copy of raw propsData
  14729. vm.$options.propsData = propsData;
  14730. }
  14731. // fixed by xxxxxx update properties(mp runtime)
  14732. vm._$updateProperties && vm._$updateProperties(vm);
  14733. // update listeners
  14734. listeners = listeners || emptyObject;
  14735. var oldListeners = vm.$options._parentListeners;
  14736. vm.$options._parentListeners = listeners;
  14737. updateComponentListeners(vm, listeners, oldListeners);
  14738. // resolve slots + force update if has children
  14739. if (needsForceUpdate) {
  14740. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  14741. vm.$forceUpdate();
  14742. }
  14743. if (true) {
  14744. isUpdatingChildComponent = false;
  14745. }
  14746. }
  14747. function isInInactiveTree (vm) {
  14748. while (vm && (vm = vm.$parent)) {
  14749. if (vm._inactive) { return true }
  14750. }
  14751. return false
  14752. }
  14753. function activateChildComponent (vm, direct) {
  14754. if (direct) {
  14755. vm._directInactive = false;
  14756. if (isInInactiveTree(vm)) {
  14757. return
  14758. }
  14759. } else if (vm._directInactive) {
  14760. return
  14761. }
  14762. if (vm._inactive || vm._inactive === null) {
  14763. vm._inactive = false;
  14764. for (var i = 0; i < vm.$children.length; i++) {
  14765. activateChildComponent(vm.$children[i]);
  14766. }
  14767. callHook(vm, 'activated');
  14768. }
  14769. }
  14770. function deactivateChildComponent (vm, direct) {
  14771. if (direct) {
  14772. vm._directInactive = true;
  14773. if (isInInactiveTree(vm)) {
  14774. return
  14775. }
  14776. }
  14777. if (!vm._inactive) {
  14778. vm._inactive = true;
  14779. for (var i = 0; i < vm.$children.length; i++) {
  14780. deactivateChildComponent(vm.$children[i]);
  14781. }
  14782. callHook(vm, 'deactivated');
  14783. }
  14784. }
  14785. function callHook (vm, hook) {
  14786. // #7573 disable dep collection when invoking lifecycle hooks
  14787. pushTarget();
  14788. var handlers = vm.$options[hook];
  14789. var info = hook + " hook";
  14790. if (handlers) {
  14791. for (var i = 0, j = handlers.length; i < j; i++) {
  14792. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  14793. }
  14794. }
  14795. if (vm._hasHookEvent) {
  14796. vm.$emit('hook:' + hook);
  14797. }
  14798. popTarget();
  14799. }
  14800. /* */
  14801. var MAX_UPDATE_COUNT = 100;
  14802. var queue = [];
  14803. var activatedChildren = [];
  14804. var has = {};
  14805. var circular = {};
  14806. var waiting = false;
  14807. var flushing = false;
  14808. var index = 0;
  14809. /**
  14810. * Reset the scheduler's state.
  14811. */
  14812. function resetSchedulerState () {
  14813. index = queue.length = activatedChildren.length = 0;
  14814. has = {};
  14815. if (true) {
  14816. circular = {};
  14817. }
  14818. waiting = flushing = false;
  14819. }
  14820. // Async edge case #6566 requires saving the timestamp when event listeners are
  14821. // attached. However, calling performance.now() has a perf overhead especially
  14822. // if the page has thousands of event listeners. Instead, we take a timestamp
  14823. // every time the scheduler flushes and use that for all event listeners
  14824. // attached during that flush.
  14825. var currentFlushTimestamp = 0;
  14826. // Async edge case fix requires storing an event listener's attach timestamp.
  14827. var getNow = Date.now;
  14828. // Determine what event timestamp the browser is using. Annoyingly, the
  14829. // timestamp can either be hi-res (relative to page load) or low-res
  14830. // (relative to UNIX epoch), so in order to compare time we have to use the
  14831. // same timestamp type when saving the flush timestamp.
  14832. // All IE versions use low-res event timestamps, and have problematic clock
  14833. // implementations (#9632)
  14834. if (inBrowser && !isIE) {
  14835. var performance = window.performance;
  14836. if (
  14837. performance &&
  14838. typeof performance.now === 'function' &&
  14839. getNow() > document.createEvent('Event').timeStamp
  14840. ) {
  14841. // if the event timestamp, although evaluated AFTER the Date.now(), is
  14842. // smaller than it, it means the event is using a hi-res timestamp,
  14843. // and we need to use the hi-res version for event listener timestamps as
  14844. // well.
  14845. getNow = function () { return performance.now(); };
  14846. }
  14847. }
  14848. /**
  14849. * Flush both queues and run the watchers.
  14850. */
  14851. function flushSchedulerQueue () {
  14852. currentFlushTimestamp = getNow();
  14853. flushing = true;
  14854. var watcher, id;
  14855. // Sort queue before flush.
  14856. // This ensures that:
  14857. // 1. Components are updated from parent to child. (because parent is always
  14858. // created before the child)
  14859. // 2. A component's user watchers are run before its render watcher (because
  14860. // user watchers are created before the render watcher)
  14861. // 3. If a component is destroyed during a parent component's watcher run,
  14862. // its watchers can be skipped.
  14863. queue.sort(function (a, b) { return a.id - b.id; });
  14864. // do not cache length because more watchers might be pushed
  14865. // as we run existing watchers
  14866. for (index = 0; index < queue.length; index++) {
  14867. watcher = queue[index];
  14868. if (watcher.before) {
  14869. watcher.before();
  14870. }
  14871. id = watcher.id;
  14872. has[id] = null;
  14873. watcher.run();
  14874. // in dev build, check and stop circular updates.
  14875. if ( true && has[id] != null) {
  14876. circular[id] = (circular[id] || 0) + 1;
  14877. if (circular[id] > MAX_UPDATE_COUNT) {
  14878. warn(
  14879. 'You may have an infinite update loop ' + (
  14880. watcher.user
  14881. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  14882. : "in a component render function."
  14883. ),
  14884. watcher.vm
  14885. );
  14886. break
  14887. }
  14888. }
  14889. }
  14890. // keep copies of post queues before resetting state
  14891. var activatedQueue = activatedChildren.slice();
  14892. var updatedQueue = queue.slice();
  14893. resetSchedulerState();
  14894. // call component updated and activated hooks
  14895. callActivatedHooks(activatedQueue);
  14896. callUpdatedHooks(updatedQueue);
  14897. // devtool hook
  14898. /* istanbul ignore if */
  14899. if (devtools && config.devtools) {
  14900. devtools.emit('flush');
  14901. }
  14902. }
  14903. function callUpdatedHooks (queue) {
  14904. var i = queue.length;
  14905. while (i--) {
  14906. var watcher = queue[i];
  14907. var vm = watcher.vm;
  14908. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  14909. callHook(vm, 'updated');
  14910. }
  14911. }
  14912. }
  14913. /**
  14914. * Queue a kept-alive component that was activated during patch.
  14915. * The queue will be processed after the entire tree has been patched.
  14916. */
  14917. function queueActivatedComponent (vm) {
  14918. // setting _inactive to false here so that a render function can
  14919. // rely on checking whether it's in an inactive tree (e.g. router-view)
  14920. vm._inactive = false;
  14921. activatedChildren.push(vm);
  14922. }
  14923. function callActivatedHooks (queue) {
  14924. for (var i = 0; i < queue.length; i++) {
  14925. queue[i]._inactive = true;
  14926. activateChildComponent(queue[i], true /* true */);
  14927. }
  14928. }
  14929. /**
  14930. * Push a watcher into the watcher queue.
  14931. * Jobs with duplicate IDs will be skipped unless it's
  14932. * pushed when the queue is being flushed.
  14933. */
  14934. function queueWatcher (watcher) {
  14935. var id = watcher.id;
  14936. if (has[id] == null) {
  14937. has[id] = true;
  14938. if (!flushing) {
  14939. queue.push(watcher);
  14940. } else {
  14941. // if already flushing, splice the watcher based on its id
  14942. // if already past its id, it will be run next immediately.
  14943. var i = queue.length - 1;
  14944. while (i > index && queue[i].id > watcher.id) {
  14945. i--;
  14946. }
  14947. queue.splice(i + 1, 0, watcher);
  14948. }
  14949. // queue the flush
  14950. if (!waiting) {
  14951. waiting = true;
  14952. if ( true && !config.async) {
  14953. flushSchedulerQueue();
  14954. return
  14955. }
  14956. nextTick(flushSchedulerQueue);
  14957. }
  14958. }
  14959. }
  14960. /* */
  14961. var uid$2 = 0;
  14962. /**
  14963. * A watcher parses an expression, collects dependencies,
  14964. * and fires callback when the expression value changes.
  14965. * This is used for both the $watch() api and directives.
  14966. */
  14967. var Watcher = function Watcher (
  14968. vm,
  14969. expOrFn,
  14970. cb,
  14971. options,
  14972. isRenderWatcher
  14973. ) {
  14974. this.vm = vm;
  14975. if (isRenderWatcher) {
  14976. vm._watcher = this;
  14977. }
  14978. vm._watchers.push(this);
  14979. // options
  14980. if (options) {
  14981. this.deep = !!options.deep;
  14982. this.user = !!options.user;
  14983. this.lazy = !!options.lazy;
  14984. this.sync = !!options.sync;
  14985. this.before = options.before;
  14986. } else {
  14987. this.deep = this.user = this.lazy = this.sync = false;
  14988. }
  14989. this.cb = cb;
  14990. this.id = ++uid$2; // uid for batching
  14991. this.active = true;
  14992. this.dirty = this.lazy; // for lazy watchers
  14993. this.deps = [];
  14994. this.newDeps = [];
  14995. this.depIds = new _Set();
  14996. this.newDepIds = new _Set();
  14997. this.expression = true
  14998. ? expOrFn.toString()
  14999. : undefined;
  15000. // parse expression for getter
  15001. if (typeof expOrFn === 'function') {
  15002. this.getter = expOrFn;
  15003. } else {
  15004. this.getter = parsePath(expOrFn);
  15005. if (!this.getter) {
  15006. this.getter = noop;
  15007. true && warn(
  15008. "Failed watching path: \"" + expOrFn + "\" " +
  15009. 'Watcher only accepts simple dot-delimited paths. ' +
  15010. 'For full control, use a function instead.',
  15011. vm
  15012. );
  15013. }
  15014. }
  15015. this.value = this.lazy
  15016. ? undefined
  15017. : this.get();
  15018. };
  15019. /**
  15020. * Evaluate the getter, and re-collect dependencies.
  15021. */
  15022. Watcher.prototype.get = function get () {
  15023. pushTarget(this);
  15024. var value;
  15025. var vm = this.vm;
  15026. try {
  15027. value = this.getter.call(vm, vm);
  15028. } catch (e) {
  15029. if (this.user) {
  15030. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  15031. } else {
  15032. throw e
  15033. }
  15034. } finally {
  15035. // "touch" every property so they are all tracked as
  15036. // dependencies for deep watching
  15037. if (this.deep) {
  15038. traverse(value);
  15039. }
  15040. popTarget();
  15041. this.cleanupDeps();
  15042. }
  15043. return value
  15044. };
  15045. /**
  15046. * Add a dependency to this directive.
  15047. */
  15048. Watcher.prototype.addDep = function addDep (dep) {
  15049. var id = dep.id;
  15050. if (!this.newDepIds.has(id)) {
  15051. this.newDepIds.add(id);
  15052. this.newDeps.push(dep);
  15053. if (!this.depIds.has(id)) {
  15054. dep.addSub(this);
  15055. }
  15056. }
  15057. };
  15058. /**
  15059. * Clean up for dependency collection.
  15060. */
  15061. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  15062. var i = this.deps.length;
  15063. while (i--) {
  15064. var dep = this.deps[i];
  15065. if (!this.newDepIds.has(dep.id)) {
  15066. dep.removeSub(this);
  15067. }
  15068. }
  15069. var tmp = this.depIds;
  15070. this.depIds = this.newDepIds;
  15071. this.newDepIds = tmp;
  15072. this.newDepIds.clear();
  15073. tmp = this.deps;
  15074. this.deps = this.newDeps;
  15075. this.newDeps = tmp;
  15076. this.newDeps.length = 0;
  15077. };
  15078. /**
  15079. * Subscriber interface.
  15080. * Will be called when a dependency changes.
  15081. */
  15082. Watcher.prototype.update = function update () {
  15083. /* istanbul ignore else */
  15084. if (this.lazy) {
  15085. this.dirty = true;
  15086. } else if (this.sync) {
  15087. this.run();
  15088. } else {
  15089. queueWatcher(this);
  15090. }
  15091. };
  15092. /**
  15093. * Scheduler job interface.
  15094. * Will be called by the scheduler.
  15095. */
  15096. Watcher.prototype.run = function run () {
  15097. if (this.active) {
  15098. var value = this.get();
  15099. if (
  15100. value !== this.value ||
  15101. // Deep watchers and watchers on Object/Arrays should fire even
  15102. // when the value is the same, because the value may
  15103. // have mutated.
  15104. isObject(value) ||
  15105. this.deep
  15106. ) {
  15107. // set new value
  15108. var oldValue = this.value;
  15109. this.value = value;
  15110. if (this.user) {
  15111. try {
  15112. this.cb.call(this.vm, value, oldValue);
  15113. } catch (e) {
  15114. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  15115. }
  15116. } else {
  15117. this.cb.call(this.vm, value, oldValue);
  15118. }
  15119. }
  15120. }
  15121. };
  15122. /**
  15123. * Evaluate the value of the watcher.
  15124. * This only gets called for lazy watchers.
  15125. */
  15126. Watcher.prototype.evaluate = function evaluate () {
  15127. this.value = this.get();
  15128. this.dirty = false;
  15129. };
  15130. /**
  15131. * Depend on all deps collected by this watcher.
  15132. */
  15133. Watcher.prototype.depend = function depend () {
  15134. var i = this.deps.length;
  15135. while (i--) {
  15136. this.deps[i].depend();
  15137. }
  15138. };
  15139. /**
  15140. * Remove self from all dependencies' subscriber list.
  15141. */
  15142. Watcher.prototype.teardown = function teardown () {
  15143. if (this.active) {
  15144. // remove self from vm's watcher list
  15145. // this is a somewhat expensive operation so we skip it
  15146. // if the vm is being destroyed.
  15147. if (!this.vm._isBeingDestroyed) {
  15148. remove(this.vm._watchers, this);
  15149. }
  15150. var i = this.deps.length;
  15151. while (i--) {
  15152. this.deps[i].removeSub(this);
  15153. }
  15154. this.active = false;
  15155. }
  15156. };
  15157. /* */
  15158. var sharedPropertyDefinition = {
  15159. enumerable: true,
  15160. configurable: true,
  15161. get: noop,
  15162. set: noop
  15163. };
  15164. function proxy (target, sourceKey, key) {
  15165. sharedPropertyDefinition.get = function proxyGetter () {
  15166. return this[sourceKey][key]
  15167. };
  15168. sharedPropertyDefinition.set = function proxySetter (val) {
  15169. this[sourceKey][key] = val;
  15170. };
  15171. Object.defineProperty(target, key, sharedPropertyDefinition);
  15172. }
  15173. function initState (vm) {
  15174. vm._watchers = [];
  15175. var opts = vm.$options;
  15176. if (opts.props) { initProps(vm, opts.props); }
  15177. if (opts.methods) { initMethods(vm, opts.methods); }
  15178. if (opts.data) {
  15179. initData(vm);
  15180. } else {
  15181. observe(vm._data = {}, true /* asRootData */);
  15182. }
  15183. if (opts.computed) { initComputed(vm, opts.computed); }
  15184. if (opts.watch && opts.watch !== nativeWatch) {
  15185. initWatch(vm, opts.watch);
  15186. }
  15187. }
  15188. function initProps (vm, propsOptions) {
  15189. var propsData = vm.$options.propsData || {};
  15190. var props = vm._props = {};
  15191. // cache prop keys so that future props updates can iterate using Array
  15192. // instead of dynamic object key enumeration.
  15193. var keys = vm.$options._propKeys = [];
  15194. var isRoot = !vm.$parent;
  15195. // root instance props should be converted
  15196. if (!isRoot) {
  15197. toggleObserving(false);
  15198. }
  15199. var loop = function ( key ) {
  15200. keys.push(key);
  15201. var value = validateProp(key, propsOptions, propsData, vm);
  15202. /* istanbul ignore else */
  15203. if (true) {
  15204. var hyphenatedKey = hyphenate(key);
  15205. if (isReservedAttribute(hyphenatedKey) ||
  15206. config.isReservedAttr(hyphenatedKey)) {
  15207. warn(
  15208. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  15209. vm
  15210. );
  15211. }
  15212. defineReactive$$1(props, key, value, function () {
  15213. if (!isRoot && !isUpdatingChildComponent) {
  15214. {
  15215. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  15216. return
  15217. }
  15218. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  15219. if(
  15220. key === 'value' &&
  15221. Array.isArray(vm.$options.behaviors) &&
  15222. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  15223. ){
  15224. return
  15225. }
  15226. if(vm._getFormData){
  15227. return
  15228. }
  15229. var $parent = vm.$parent;
  15230. while($parent){
  15231. if($parent.__next_tick_pending){
  15232. return
  15233. }
  15234. $parent = $parent.$parent;
  15235. }
  15236. }
  15237. warn(
  15238. "Avoid mutating a prop directly since the value will be " +
  15239. "overwritten whenever the parent component re-renders. " +
  15240. "Instead, use a data or computed property based on the prop's " +
  15241. "value. Prop being mutated: \"" + key + "\"",
  15242. vm
  15243. );
  15244. }
  15245. });
  15246. } else {}
  15247. // static props are already proxied on the component's prototype
  15248. // during Vue.extend(). We only need to proxy props defined at
  15249. // instantiation here.
  15250. if (!(key in vm)) {
  15251. proxy(vm, "_props", key);
  15252. }
  15253. };
  15254. for (var key in propsOptions) loop( key );
  15255. toggleObserving(true);
  15256. }
  15257. function initData (vm) {
  15258. var data = vm.$options.data;
  15259. data = vm._data = typeof data === 'function'
  15260. ? getData(data, vm)
  15261. : data || {};
  15262. if (!isPlainObject(data)) {
  15263. data = {};
  15264. true && warn(
  15265. 'data functions should return an object:\n' +
  15266. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  15267. vm
  15268. );
  15269. }
  15270. // proxy data on instance
  15271. var keys = Object.keys(data);
  15272. var props = vm.$options.props;
  15273. var methods = vm.$options.methods;
  15274. var i = keys.length;
  15275. while (i--) {
  15276. var key = keys[i];
  15277. if (true) {
  15278. if (methods && hasOwn(methods, key)) {
  15279. warn(
  15280. ("Method \"" + key + "\" has already been defined as a data property."),
  15281. vm
  15282. );
  15283. }
  15284. }
  15285. if (props && hasOwn(props, key)) {
  15286. true && warn(
  15287. "The data property \"" + key + "\" is already declared as a prop. " +
  15288. "Use prop default value instead.",
  15289. vm
  15290. );
  15291. } else if (!isReserved(key)) {
  15292. proxy(vm, "_data", key);
  15293. }
  15294. }
  15295. // observe data
  15296. observe(data, true /* asRootData */);
  15297. }
  15298. function getData (data, vm) {
  15299. // #7573 disable dep collection when invoking data getters
  15300. pushTarget();
  15301. try {
  15302. return data.call(vm, vm)
  15303. } catch (e) {
  15304. handleError(e, vm, "data()");
  15305. return {}
  15306. } finally {
  15307. popTarget();
  15308. }
  15309. }
  15310. var computedWatcherOptions = { lazy: true };
  15311. function initComputed (vm, computed) {
  15312. // $flow-disable-line
  15313. var watchers = vm._computedWatchers = Object.create(null);
  15314. // computed properties are just getters during SSR
  15315. var isSSR = isServerRendering();
  15316. for (var key in computed) {
  15317. var userDef = computed[key];
  15318. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  15319. if ( true && getter == null) {
  15320. warn(
  15321. ("Getter is missing for computed property \"" + key + "\"."),
  15322. vm
  15323. );
  15324. }
  15325. if (!isSSR) {
  15326. // create internal watcher for the computed property.
  15327. watchers[key] = new Watcher(
  15328. vm,
  15329. getter || noop,
  15330. noop,
  15331. computedWatcherOptions
  15332. );
  15333. }
  15334. // component-defined computed properties are already defined on the
  15335. // component prototype. We only need to define computed properties defined
  15336. // at instantiation here.
  15337. if (!(key in vm)) {
  15338. defineComputed(vm, key, userDef);
  15339. } else if (true) {
  15340. if (key in vm.$data) {
  15341. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  15342. } else if (vm.$options.props && key in vm.$options.props) {
  15343. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  15344. }
  15345. }
  15346. }
  15347. }
  15348. function defineComputed (
  15349. target,
  15350. key,
  15351. userDef
  15352. ) {
  15353. var shouldCache = !isServerRendering();
  15354. if (typeof userDef === 'function') {
  15355. sharedPropertyDefinition.get = shouldCache
  15356. ? createComputedGetter(key)
  15357. : createGetterInvoker(userDef);
  15358. sharedPropertyDefinition.set = noop;
  15359. } else {
  15360. sharedPropertyDefinition.get = userDef.get
  15361. ? shouldCache && userDef.cache !== false
  15362. ? createComputedGetter(key)
  15363. : createGetterInvoker(userDef.get)
  15364. : noop;
  15365. sharedPropertyDefinition.set = userDef.set || noop;
  15366. }
  15367. if ( true &&
  15368. sharedPropertyDefinition.set === noop) {
  15369. sharedPropertyDefinition.set = function () {
  15370. warn(
  15371. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  15372. this
  15373. );
  15374. };
  15375. }
  15376. Object.defineProperty(target, key, sharedPropertyDefinition);
  15377. }
  15378. function createComputedGetter (key) {
  15379. return function computedGetter () {
  15380. var watcher = this._computedWatchers && this._computedWatchers[key];
  15381. if (watcher) {
  15382. if (watcher.dirty) {
  15383. watcher.evaluate();
  15384. }
  15385. if (Dep.SharedObject.target) {// fixed by xxxxxx
  15386. watcher.depend();
  15387. }
  15388. return watcher.value
  15389. }
  15390. }
  15391. }
  15392. function createGetterInvoker(fn) {
  15393. return function computedGetter () {
  15394. return fn.call(this, this)
  15395. }
  15396. }
  15397. function initMethods (vm, methods) {
  15398. var props = vm.$options.props;
  15399. for (var key in methods) {
  15400. if (true) {
  15401. if (typeof methods[key] !== 'function') {
  15402. warn(
  15403. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  15404. "Did you reference the function correctly?",
  15405. vm
  15406. );
  15407. }
  15408. if (props && hasOwn(props, key)) {
  15409. warn(
  15410. ("Method \"" + key + "\" has already been defined as a prop."),
  15411. vm
  15412. );
  15413. }
  15414. if ((key in vm) && isReserved(key)) {
  15415. warn(
  15416. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  15417. "Avoid defining component methods that start with _ or $."
  15418. );
  15419. }
  15420. }
  15421. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  15422. }
  15423. }
  15424. function initWatch (vm, watch) {
  15425. for (var key in watch) {
  15426. var handler = watch[key];
  15427. if (Array.isArray(handler)) {
  15428. for (var i = 0; i < handler.length; i++) {
  15429. createWatcher(vm, key, handler[i]);
  15430. }
  15431. } else {
  15432. createWatcher(vm, key, handler);
  15433. }
  15434. }
  15435. }
  15436. function createWatcher (
  15437. vm,
  15438. expOrFn,
  15439. handler,
  15440. options
  15441. ) {
  15442. if (isPlainObject(handler)) {
  15443. options = handler;
  15444. handler = handler.handler;
  15445. }
  15446. if (typeof handler === 'string') {
  15447. handler = vm[handler];
  15448. }
  15449. return vm.$watch(expOrFn, handler, options)
  15450. }
  15451. function stateMixin (Vue) {
  15452. // flow somehow has problems with directly declared definition object
  15453. // when using Object.defineProperty, so we have to procedurally build up
  15454. // the object here.
  15455. var dataDef = {};
  15456. dataDef.get = function () { return this._data };
  15457. var propsDef = {};
  15458. propsDef.get = function () { return this._props };
  15459. if (true) {
  15460. dataDef.set = function () {
  15461. warn(
  15462. 'Avoid replacing instance root $data. ' +
  15463. 'Use nested data properties instead.',
  15464. this
  15465. );
  15466. };
  15467. propsDef.set = function () {
  15468. warn("$props is readonly.", this);
  15469. };
  15470. }
  15471. Object.defineProperty(Vue.prototype, '$data', dataDef);
  15472. Object.defineProperty(Vue.prototype, '$props', propsDef);
  15473. Vue.prototype.$set = set;
  15474. Vue.prototype.$delete = del;
  15475. Vue.prototype.$watch = function (
  15476. expOrFn,
  15477. cb,
  15478. options
  15479. ) {
  15480. var vm = this;
  15481. if (isPlainObject(cb)) {
  15482. return createWatcher(vm, expOrFn, cb, options)
  15483. }
  15484. options = options || {};
  15485. options.user = true;
  15486. var watcher = new Watcher(vm, expOrFn, cb, options);
  15487. if (options.immediate) {
  15488. try {
  15489. cb.call(vm, watcher.value);
  15490. } catch (error) {
  15491. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  15492. }
  15493. }
  15494. return function unwatchFn () {
  15495. watcher.teardown();
  15496. }
  15497. };
  15498. }
  15499. /* */
  15500. var uid$3 = 0;
  15501. function initMixin (Vue) {
  15502. Vue.prototype._init = function (options) {
  15503. var vm = this;
  15504. // a uid
  15505. vm._uid = uid$3++;
  15506. var startTag, endTag;
  15507. /* istanbul ignore if */
  15508. if ( true && config.performance && mark) {
  15509. startTag = "vue-perf-start:" + (vm._uid);
  15510. endTag = "vue-perf-end:" + (vm._uid);
  15511. mark(startTag);
  15512. }
  15513. // a flag to avoid this being observed
  15514. vm._isVue = true;
  15515. // merge options
  15516. if (options && options._isComponent) {
  15517. // optimize internal component instantiation
  15518. // since dynamic options merging is pretty slow, and none of the
  15519. // internal component options needs special treatment.
  15520. initInternalComponent(vm, options);
  15521. } else {
  15522. vm.$options = mergeOptions(
  15523. resolveConstructorOptions(vm.constructor),
  15524. options || {},
  15525. vm
  15526. );
  15527. }
  15528. /* istanbul ignore else */
  15529. if (true) {
  15530. initProxy(vm);
  15531. } else {}
  15532. // expose real self
  15533. vm._self = vm;
  15534. initLifecycle(vm);
  15535. initEvents(vm);
  15536. initRender(vm);
  15537. callHook(vm, 'beforeCreate');
  15538. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  15539. initState(vm);
  15540. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  15541. !vm._$fallback && callHook(vm, 'created');
  15542. /* istanbul ignore if */
  15543. if ( true && config.performance && mark) {
  15544. vm._name = formatComponentName(vm, false);
  15545. mark(endTag);
  15546. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  15547. }
  15548. if (vm.$options.el) {
  15549. vm.$mount(vm.$options.el);
  15550. }
  15551. };
  15552. }
  15553. function initInternalComponent (vm, options) {
  15554. var opts = vm.$options = Object.create(vm.constructor.options);
  15555. // doing this because it's faster than dynamic enumeration.
  15556. var parentVnode = options._parentVnode;
  15557. opts.parent = options.parent;
  15558. opts._parentVnode = parentVnode;
  15559. var vnodeComponentOptions = parentVnode.componentOptions;
  15560. opts.propsData = vnodeComponentOptions.propsData;
  15561. opts._parentListeners = vnodeComponentOptions.listeners;
  15562. opts._renderChildren = vnodeComponentOptions.children;
  15563. opts._componentTag = vnodeComponentOptions.tag;
  15564. if (options.render) {
  15565. opts.render = options.render;
  15566. opts.staticRenderFns = options.staticRenderFns;
  15567. }
  15568. }
  15569. function resolveConstructorOptions (Ctor) {
  15570. var options = Ctor.options;
  15571. if (Ctor.super) {
  15572. var superOptions = resolveConstructorOptions(Ctor.super);
  15573. var cachedSuperOptions = Ctor.superOptions;
  15574. if (superOptions !== cachedSuperOptions) {
  15575. // super option changed,
  15576. // need to resolve new options.
  15577. Ctor.superOptions = superOptions;
  15578. // check if there are any late-modified/attached options (#4976)
  15579. var modifiedOptions = resolveModifiedOptions(Ctor);
  15580. // update base extend options
  15581. if (modifiedOptions) {
  15582. extend(Ctor.extendOptions, modifiedOptions);
  15583. }
  15584. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  15585. if (options.name) {
  15586. options.components[options.name] = Ctor;
  15587. }
  15588. }
  15589. }
  15590. return options
  15591. }
  15592. function resolveModifiedOptions (Ctor) {
  15593. var modified;
  15594. var latest = Ctor.options;
  15595. var sealed = Ctor.sealedOptions;
  15596. for (var key in latest) {
  15597. if (latest[key] !== sealed[key]) {
  15598. if (!modified) { modified = {}; }
  15599. modified[key] = latest[key];
  15600. }
  15601. }
  15602. return modified
  15603. }
  15604. function Vue (options) {
  15605. if ( true &&
  15606. !(this instanceof Vue)
  15607. ) {
  15608. warn('Vue is a constructor and should be called with the `new` keyword');
  15609. }
  15610. this._init(options);
  15611. }
  15612. initMixin(Vue);
  15613. stateMixin(Vue);
  15614. eventsMixin(Vue);
  15615. lifecycleMixin(Vue);
  15616. renderMixin(Vue);
  15617. /* */
  15618. function initUse (Vue) {
  15619. Vue.use = function (plugin) {
  15620. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  15621. if (installedPlugins.indexOf(plugin) > -1) {
  15622. return this
  15623. }
  15624. // additional parameters
  15625. var args = toArray(arguments, 1);
  15626. args.unshift(this);
  15627. if (typeof plugin.install === 'function') {
  15628. plugin.install.apply(plugin, args);
  15629. } else if (typeof plugin === 'function') {
  15630. plugin.apply(null, args);
  15631. }
  15632. installedPlugins.push(plugin);
  15633. return this
  15634. };
  15635. }
  15636. /* */
  15637. function initMixin$1 (Vue) {
  15638. Vue.mixin = function (mixin) {
  15639. this.options = mergeOptions(this.options, mixin);
  15640. return this
  15641. };
  15642. }
  15643. /* */
  15644. function initExtend (Vue) {
  15645. /**
  15646. * Each instance constructor, including Vue, has a unique
  15647. * cid. This enables us to create wrapped "child
  15648. * constructors" for prototypal inheritance and cache them.
  15649. */
  15650. Vue.cid = 0;
  15651. var cid = 1;
  15652. /**
  15653. * Class inheritance
  15654. */
  15655. Vue.extend = function (extendOptions) {
  15656. extendOptions = extendOptions || {};
  15657. var Super = this;
  15658. var SuperId = Super.cid;
  15659. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  15660. if (cachedCtors[SuperId]) {
  15661. return cachedCtors[SuperId]
  15662. }
  15663. var name = extendOptions.name || Super.options.name;
  15664. if ( true && name) {
  15665. validateComponentName(name);
  15666. }
  15667. var Sub = function VueComponent (options) {
  15668. this._init(options);
  15669. };
  15670. Sub.prototype = Object.create(Super.prototype);
  15671. Sub.prototype.constructor = Sub;
  15672. Sub.cid = cid++;
  15673. Sub.options = mergeOptions(
  15674. Super.options,
  15675. extendOptions
  15676. );
  15677. Sub['super'] = Super;
  15678. // For props and computed properties, we define the proxy getters on
  15679. // the Vue instances at extension time, on the extended prototype. This
  15680. // avoids Object.defineProperty calls for each instance created.
  15681. if (Sub.options.props) {
  15682. initProps$1(Sub);
  15683. }
  15684. if (Sub.options.computed) {
  15685. initComputed$1(Sub);
  15686. }
  15687. // allow further extension/mixin/plugin usage
  15688. Sub.extend = Super.extend;
  15689. Sub.mixin = Super.mixin;
  15690. Sub.use = Super.use;
  15691. // create asset registers, so extended classes
  15692. // can have their private assets too.
  15693. ASSET_TYPES.forEach(function (type) {
  15694. Sub[type] = Super[type];
  15695. });
  15696. // enable recursive self-lookup
  15697. if (name) {
  15698. Sub.options.components[name] = Sub;
  15699. }
  15700. // keep a reference to the super options at extension time.
  15701. // later at instantiation we can check if Super's options have
  15702. // been updated.
  15703. Sub.superOptions = Super.options;
  15704. Sub.extendOptions = extendOptions;
  15705. Sub.sealedOptions = extend({}, Sub.options);
  15706. // cache constructor
  15707. cachedCtors[SuperId] = Sub;
  15708. return Sub
  15709. };
  15710. }
  15711. function initProps$1 (Comp) {
  15712. var props = Comp.options.props;
  15713. for (var key in props) {
  15714. proxy(Comp.prototype, "_props", key);
  15715. }
  15716. }
  15717. function initComputed$1 (Comp) {
  15718. var computed = Comp.options.computed;
  15719. for (var key in computed) {
  15720. defineComputed(Comp.prototype, key, computed[key]);
  15721. }
  15722. }
  15723. /* */
  15724. function initAssetRegisters (Vue) {
  15725. /**
  15726. * Create asset registration methods.
  15727. */
  15728. ASSET_TYPES.forEach(function (type) {
  15729. Vue[type] = function (
  15730. id,
  15731. definition
  15732. ) {
  15733. if (!definition) {
  15734. return this.options[type + 's'][id]
  15735. } else {
  15736. /* istanbul ignore if */
  15737. if ( true && type === 'component') {
  15738. validateComponentName(id);
  15739. }
  15740. if (type === 'component' && isPlainObject(definition)) {
  15741. definition.name = definition.name || id;
  15742. definition = this.options._base.extend(definition);
  15743. }
  15744. if (type === 'directive' && typeof definition === 'function') {
  15745. definition = { bind: definition, update: definition };
  15746. }
  15747. this.options[type + 's'][id] = definition;
  15748. return definition
  15749. }
  15750. };
  15751. });
  15752. }
  15753. /* */
  15754. function getComponentName (opts) {
  15755. return opts && (opts.Ctor.options.name || opts.tag)
  15756. }
  15757. function matches (pattern, name) {
  15758. if (Array.isArray(pattern)) {
  15759. return pattern.indexOf(name) > -1
  15760. } else if (typeof pattern === 'string') {
  15761. return pattern.split(',').indexOf(name) > -1
  15762. } else if (isRegExp(pattern)) {
  15763. return pattern.test(name)
  15764. }
  15765. /* istanbul ignore next */
  15766. return false
  15767. }
  15768. function pruneCache (keepAliveInstance, filter) {
  15769. var cache = keepAliveInstance.cache;
  15770. var keys = keepAliveInstance.keys;
  15771. var _vnode = keepAliveInstance._vnode;
  15772. for (var key in cache) {
  15773. var cachedNode = cache[key];
  15774. if (cachedNode) {
  15775. var name = getComponentName(cachedNode.componentOptions);
  15776. if (name && !filter(name)) {
  15777. pruneCacheEntry(cache, key, keys, _vnode);
  15778. }
  15779. }
  15780. }
  15781. }
  15782. function pruneCacheEntry (
  15783. cache,
  15784. key,
  15785. keys,
  15786. current
  15787. ) {
  15788. var cached$$1 = cache[key];
  15789. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  15790. cached$$1.componentInstance.$destroy();
  15791. }
  15792. cache[key] = null;
  15793. remove(keys, key);
  15794. }
  15795. var patternTypes = [String, RegExp, Array];
  15796. var KeepAlive = {
  15797. name: 'keep-alive',
  15798. abstract: true,
  15799. props: {
  15800. include: patternTypes,
  15801. exclude: patternTypes,
  15802. max: [String, Number]
  15803. },
  15804. created: function created () {
  15805. this.cache = Object.create(null);
  15806. this.keys = [];
  15807. },
  15808. destroyed: function destroyed () {
  15809. for (var key in this.cache) {
  15810. pruneCacheEntry(this.cache, key, this.keys);
  15811. }
  15812. },
  15813. mounted: function mounted () {
  15814. var this$1 = this;
  15815. this.$watch('include', function (val) {
  15816. pruneCache(this$1, function (name) { return matches(val, name); });
  15817. });
  15818. this.$watch('exclude', function (val) {
  15819. pruneCache(this$1, function (name) { return !matches(val, name); });
  15820. });
  15821. },
  15822. render: function render () {
  15823. var slot = this.$slots.default;
  15824. var vnode = getFirstComponentChild(slot);
  15825. var componentOptions = vnode && vnode.componentOptions;
  15826. if (componentOptions) {
  15827. // check pattern
  15828. var name = getComponentName(componentOptions);
  15829. var ref = this;
  15830. var include = ref.include;
  15831. var exclude = ref.exclude;
  15832. if (
  15833. // not included
  15834. (include && (!name || !matches(include, name))) ||
  15835. // excluded
  15836. (exclude && name && matches(exclude, name))
  15837. ) {
  15838. return vnode
  15839. }
  15840. var ref$1 = this;
  15841. var cache = ref$1.cache;
  15842. var keys = ref$1.keys;
  15843. var key = vnode.key == null
  15844. // same constructor may get registered as different local components
  15845. // so cid alone is not enough (#3269)
  15846. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  15847. : vnode.key;
  15848. if (cache[key]) {
  15849. vnode.componentInstance = cache[key].componentInstance;
  15850. // make current key freshest
  15851. remove(keys, key);
  15852. keys.push(key);
  15853. } else {
  15854. cache[key] = vnode;
  15855. keys.push(key);
  15856. // prune oldest entry
  15857. if (this.max && keys.length > parseInt(this.max)) {
  15858. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  15859. }
  15860. }
  15861. vnode.data.keepAlive = true;
  15862. }
  15863. return vnode || (slot && slot[0])
  15864. }
  15865. };
  15866. var builtInComponents = {
  15867. KeepAlive: KeepAlive
  15868. };
  15869. /* */
  15870. function initGlobalAPI (Vue) {
  15871. // config
  15872. var configDef = {};
  15873. configDef.get = function () { return config; };
  15874. if (true) {
  15875. configDef.set = function () {
  15876. warn(
  15877. 'Do not replace the Vue.config object, set individual fields instead.'
  15878. );
  15879. };
  15880. }
  15881. Object.defineProperty(Vue, 'config', configDef);
  15882. // exposed util methods.
  15883. // NOTE: these are not considered part of the public API - avoid relying on
  15884. // them unless you are aware of the risk.
  15885. Vue.util = {
  15886. warn: warn,
  15887. extend: extend,
  15888. mergeOptions: mergeOptions,
  15889. defineReactive: defineReactive$$1
  15890. };
  15891. Vue.set = set;
  15892. Vue.delete = del;
  15893. Vue.nextTick = nextTick;
  15894. // 2.6 explicit observable API
  15895. Vue.observable = function (obj) {
  15896. observe(obj);
  15897. return obj
  15898. };
  15899. Vue.options = Object.create(null);
  15900. ASSET_TYPES.forEach(function (type) {
  15901. Vue.options[type + 's'] = Object.create(null);
  15902. });
  15903. // this is used to identify the "base" constructor to extend all plain-object
  15904. // components with in Weex's multi-instance scenarios.
  15905. Vue.options._base = Vue;
  15906. extend(Vue.options.components, builtInComponents);
  15907. initUse(Vue);
  15908. initMixin$1(Vue);
  15909. initExtend(Vue);
  15910. initAssetRegisters(Vue);
  15911. }
  15912. initGlobalAPI(Vue);
  15913. Object.defineProperty(Vue.prototype, '$isServer', {
  15914. get: isServerRendering
  15915. });
  15916. Object.defineProperty(Vue.prototype, '$ssrContext', {
  15917. get: function get () {
  15918. /* istanbul ignore next */
  15919. return this.$vnode && this.$vnode.ssrContext
  15920. }
  15921. });
  15922. // expose FunctionalRenderContext for ssr runtime helper installation
  15923. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  15924. value: FunctionalRenderContext
  15925. });
  15926. Vue.version = '2.6.11';
  15927. /**
  15928. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  15929. */
  15930. var ARRAYTYPE = '[object Array]';
  15931. var OBJECTTYPE = '[object Object]';
  15932. // const FUNCTIONTYPE = '[object Function]'
  15933. function diff(current, pre) {
  15934. var result = {};
  15935. syncKeys(current, pre);
  15936. _diff(current, pre, '', result);
  15937. return result
  15938. }
  15939. function syncKeys(current, pre) {
  15940. if (current === pre) { return }
  15941. var rootCurrentType = type(current);
  15942. var rootPreType = type(pre);
  15943. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  15944. if(Object.keys(current).length >= Object.keys(pre).length){
  15945. for (var key in pre) {
  15946. var currentValue = current[key];
  15947. if (currentValue === undefined) {
  15948. current[key] = null;
  15949. } else {
  15950. syncKeys(currentValue, pre[key]);
  15951. }
  15952. }
  15953. }
  15954. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  15955. if (current.length >= pre.length) {
  15956. pre.forEach(function (item, index) {
  15957. syncKeys(current[index], item);
  15958. });
  15959. }
  15960. }
  15961. }
  15962. function _diff(current, pre, path, result) {
  15963. if (current === pre) { return }
  15964. var rootCurrentType = type(current);
  15965. var rootPreType = type(pre);
  15966. if (rootCurrentType == OBJECTTYPE) {
  15967. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  15968. setResult(result, path, current);
  15969. } else {
  15970. var loop = function ( key ) {
  15971. var currentValue = current[key];
  15972. var preValue = pre[key];
  15973. var currentType = type(currentValue);
  15974. var preType = type(preValue);
  15975. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  15976. if (currentValue !== pre[key]) {
  15977. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  15978. }
  15979. } else if (currentType == ARRAYTYPE) {
  15980. if (preType != ARRAYTYPE) {
  15981. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  15982. } else {
  15983. if (currentValue.length < preValue.length) {
  15984. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  15985. } else {
  15986. currentValue.forEach(function (item, index) {
  15987. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  15988. });
  15989. }
  15990. }
  15991. } else if (currentType == OBJECTTYPE) {
  15992. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  15993. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  15994. } else {
  15995. for (var subKey in currentValue) {
  15996. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  15997. }
  15998. }
  15999. }
  16000. };
  16001. for (var key in current) loop( key );
  16002. }
  16003. } else if (rootCurrentType == ARRAYTYPE) {
  16004. if (rootPreType != ARRAYTYPE) {
  16005. setResult(result, path, current);
  16006. } else {
  16007. if (current.length < pre.length) {
  16008. setResult(result, path, current);
  16009. } else {
  16010. current.forEach(function (item, index) {
  16011. _diff(item, pre[index], path + '[' + index + ']', result);
  16012. });
  16013. }
  16014. }
  16015. } else {
  16016. setResult(result, path, current);
  16017. }
  16018. }
  16019. function setResult(result, k, v) {
  16020. // if (type(v) != FUNCTIONTYPE) {
  16021. result[k] = v;
  16022. // }
  16023. }
  16024. function type(obj) {
  16025. return Object.prototype.toString.call(obj)
  16026. }
  16027. /* */
  16028. function flushCallbacks$1(vm) {
  16029. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  16030. if (Object({"NODE_ENV":"development","VUE_APP_NAME":"wechat","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  16031. var mpInstance = vm.$scope;
  16032. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  16033. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  16034. }
  16035. var copies = vm.__next_tick_callbacks.slice(0);
  16036. vm.__next_tick_callbacks.length = 0;
  16037. for (var i = 0; i < copies.length; i++) {
  16038. copies[i]();
  16039. }
  16040. }
  16041. }
  16042. function hasRenderWatcher(vm) {
  16043. return queue.find(function (watcher) { return vm._watcher === watcher; })
  16044. }
  16045. function nextTick$1(vm, cb) {
  16046. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  16047. //2.nextTick 之前存在 render watcher
  16048. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  16049. if(Object({"NODE_ENV":"development","VUE_APP_NAME":"wechat","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  16050. var mpInstance = vm.$scope;
  16051. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  16052. ']:nextVueTick');
  16053. }
  16054. return nextTick(cb, vm)
  16055. }else{
  16056. if(Object({"NODE_ENV":"development","VUE_APP_NAME":"wechat","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  16057. var mpInstance$1 = vm.$scope;
  16058. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  16059. ']:nextMPTick');
  16060. }
  16061. }
  16062. var _resolve;
  16063. if (!vm.__next_tick_callbacks) {
  16064. vm.__next_tick_callbacks = [];
  16065. }
  16066. vm.__next_tick_callbacks.push(function () {
  16067. if (cb) {
  16068. try {
  16069. cb.call(vm);
  16070. } catch (e) {
  16071. handleError(e, vm, 'nextTick');
  16072. }
  16073. } else if (_resolve) {
  16074. _resolve(vm);
  16075. }
  16076. });
  16077. // $flow-disable-line
  16078. if (!cb && typeof Promise !== 'undefined') {
  16079. return new Promise(function (resolve) {
  16080. _resolve = resolve;
  16081. })
  16082. }
  16083. }
  16084. /* */
  16085. function cloneWithData(vm) {
  16086. // 确保当前 vm 所有数据被同步
  16087. var ret = Object.create(null);
  16088. var dataKeys = [].concat(
  16089. Object.keys(vm._data || {}),
  16090. Object.keys(vm._computedWatchers || {}));
  16091. dataKeys.reduce(function(ret, key) {
  16092. ret[key] = vm[key];
  16093. return ret
  16094. }, ret);
  16095. // vue-composition-api
  16096. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  16097. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  16098. if (rawBindings) {
  16099. Object.keys(rawBindings).forEach(function (key) {
  16100. ret[key] = vm[key];
  16101. });
  16102. }
  16103. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  16104. Object.assign(ret, vm.$mp.data || {});
  16105. if (
  16106. Array.isArray(vm.$options.behaviors) &&
  16107. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  16108. ) { //form-field
  16109. ret['name'] = vm.name;
  16110. ret['value'] = vm.value;
  16111. }
  16112. return JSON.parse(JSON.stringify(ret))
  16113. }
  16114. var patch = function(oldVnode, vnode) {
  16115. var this$1 = this;
  16116. if (vnode === null) { //destroy
  16117. return
  16118. }
  16119. if (this.mpType === 'page' || this.mpType === 'component') {
  16120. var mpInstance = this.$scope;
  16121. var data = Object.create(null);
  16122. try {
  16123. data = cloneWithData(this);
  16124. } catch (err) {
  16125. console.error(err);
  16126. }
  16127. data.__webviewId__ = mpInstance.data.__webviewId__;
  16128. var mpData = Object.create(null);
  16129. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  16130. mpData[key] = mpInstance.data[key];
  16131. });
  16132. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  16133. if (Object.keys(diffData).length) {
  16134. if (Object({"NODE_ENV":"development","VUE_APP_NAME":"wechat","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  16135. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  16136. ']差量更新',
  16137. JSON.stringify(diffData));
  16138. }
  16139. this.__next_tick_pending = true;
  16140. mpInstance.setData(diffData, function () {
  16141. this$1.__next_tick_pending = false;
  16142. flushCallbacks$1(this$1);
  16143. });
  16144. } else {
  16145. flushCallbacks$1(this);
  16146. }
  16147. }
  16148. };
  16149. /* */
  16150. function createEmptyRender() {
  16151. }
  16152. function mountComponent$1(
  16153. vm,
  16154. el,
  16155. hydrating
  16156. ) {
  16157. if (!vm.mpType) {//main.js 中的 new Vue
  16158. return vm
  16159. }
  16160. if (vm.mpType === 'app') {
  16161. vm.$options.render = createEmptyRender;
  16162. }
  16163. if (!vm.$options.render) {
  16164. vm.$options.render = createEmptyRender;
  16165. if (true) {
  16166. /* istanbul ignore if */
  16167. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  16168. vm.$options.el || el) {
  16169. warn(
  16170. 'You are using the runtime-only build of Vue where the template ' +
  16171. 'compiler is not available. Either pre-compile the templates into ' +
  16172. 'render functions, or use the compiler-included build.',
  16173. vm
  16174. );
  16175. } else {
  16176. warn(
  16177. 'Failed to mount component: template or render function not defined.',
  16178. vm
  16179. );
  16180. }
  16181. }
  16182. }
  16183. !vm._$fallback && callHook(vm, 'beforeMount');
  16184. var updateComponent = function () {
  16185. vm._update(vm._render(), hydrating);
  16186. };
  16187. // we set this to vm._watcher inside the watcher's constructor
  16188. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  16189. // component's mounted hook), which relies on vm._watcher being already defined
  16190. new Watcher(vm, updateComponent, noop, {
  16191. before: function before() {
  16192. if (vm._isMounted && !vm._isDestroyed) {
  16193. callHook(vm, 'beforeUpdate');
  16194. }
  16195. }
  16196. }, true /* isRenderWatcher */);
  16197. hydrating = false;
  16198. return vm
  16199. }
  16200. /* */
  16201. function renderClass (
  16202. staticClass,
  16203. dynamicClass
  16204. ) {
  16205. if (isDef(staticClass) || isDef(dynamicClass)) {
  16206. return concat(staticClass, stringifyClass(dynamicClass))
  16207. }
  16208. /* istanbul ignore next */
  16209. return ''
  16210. }
  16211. function concat (a, b) {
  16212. return a ? b ? (a + ' ' + b) : a : (b || '')
  16213. }
  16214. function stringifyClass (value) {
  16215. if (Array.isArray(value)) {
  16216. return stringifyArray(value)
  16217. }
  16218. if (isObject(value)) {
  16219. return stringifyObject(value)
  16220. }
  16221. if (typeof value === 'string') {
  16222. return value
  16223. }
  16224. /* istanbul ignore next */
  16225. return ''
  16226. }
  16227. function stringifyArray (value) {
  16228. var res = '';
  16229. var stringified;
  16230. for (var i = 0, l = value.length; i < l; i++) {
  16231. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  16232. if (res) { res += ' '; }
  16233. res += stringified;
  16234. }
  16235. }
  16236. return res
  16237. }
  16238. function stringifyObject (value) {
  16239. var res = '';
  16240. for (var key in value) {
  16241. if (value[key]) {
  16242. if (res) { res += ' '; }
  16243. res += key;
  16244. }
  16245. }
  16246. return res
  16247. }
  16248. /* */
  16249. var parseStyleText = cached(function (cssText) {
  16250. var res = {};
  16251. var listDelimiter = /;(?![^(]*\))/g;
  16252. var propertyDelimiter = /:(.+)/;
  16253. cssText.split(listDelimiter).forEach(function (item) {
  16254. if (item) {
  16255. var tmp = item.split(propertyDelimiter);
  16256. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  16257. }
  16258. });
  16259. return res
  16260. });
  16261. // normalize possible array / string values into Object
  16262. function normalizeStyleBinding (bindingStyle) {
  16263. if (Array.isArray(bindingStyle)) {
  16264. return toObject(bindingStyle)
  16265. }
  16266. if (typeof bindingStyle === 'string') {
  16267. return parseStyleText(bindingStyle)
  16268. }
  16269. return bindingStyle
  16270. }
  16271. /* */
  16272. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  16273. function getTarget(obj, path) {
  16274. var parts = path.split('.');
  16275. var key = parts[0];
  16276. if (key.indexOf('__$n') === 0) { //number index
  16277. key = parseInt(key.replace('__$n', ''));
  16278. }
  16279. if (parts.length === 1) {
  16280. return obj[key]
  16281. }
  16282. return getTarget(obj[key], parts.slice(1).join('.'))
  16283. }
  16284. function internalMixin(Vue) {
  16285. Vue.config.errorHandler = function(err, vm, info) {
  16286. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  16287. console.error(err);
  16288. /* eslint-disable no-undef */
  16289. var app = typeof getApp === 'function' && getApp();
  16290. if (app && app.onError) {
  16291. app.onError(err);
  16292. }
  16293. };
  16294. var oldEmit = Vue.prototype.$emit;
  16295. Vue.prototype.$emit = function(event) {
  16296. if (this.$scope && event) {
  16297. (this.$scope['_triggerEvent'] || this.$scope['triggerEvent']).call(this.$scope, event, {
  16298. __args__: toArray(arguments, 1)
  16299. });
  16300. }
  16301. return oldEmit.apply(this, arguments)
  16302. };
  16303. Vue.prototype.$nextTick = function(fn) {
  16304. return nextTick$1(this, fn)
  16305. };
  16306. MP_METHODS.forEach(function (method) {
  16307. Vue.prototype[method] = function(args) {
  16308. if (this.$scope && this.$scope[method]) {
  16309. return this.$scope[method](args)
  16310. }
  16311. // mp-alipay
  16312. if (typeof my === 'undefined') {
  16313. return
  16314. }
  16315. if (method === 'createSelectorQuery') {
  16316. /* eslint-disable no-undef */
  16317. return my.createSelectorQuery(args)
  16318. } else if (method === 'createIntersectionObserver') {
  16319. /* eslint-disable no-undef */
  16320. return my.createIntersectionObserver(args)
  16321. }
  16322. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  16323. };
  16324. });
  16325. Vue.prototype.__init_provide = initProvide;
  16326. Vue.prototype.__init_injections = initInjections;
  16327. Vue.prototype.__call_hook = function(hook, args) {
  16328. var vm = this;
  16329. // #7573 disable dep collection when invoking lifecycle hooks
  16330. pushTarget();
  16331. var handlers = vm.$options[hook];
  16332. var info = hook + " hook";
  16333. var ret;
  16334. if (handlers) {
  16335. for (var i = 0, j = handlers.length; i < j; i++) {
  16336. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  16337. }
  16338. }
  16339. if (vm._hasHookEvent) {
  16340. vm.$emit('hook:' + hook, args);
  16341. }
  16342. popTarget();
  16343. return ret
  16344. };
  16345. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  16346. if (Array.isArray(modifiers)) {
  16347. if (modifiers.indexOf('trim') !== -1) {
  16348. value = value.trim();
  16349. }
  16350. if (modifiers.indexOf('number') !== -1) {
  16351. value = this._n(value);
  16352. }
  16353. }
  16354. if (!target) {
  16355. target = this;
  16356. }
  16357. // 解决动态属性添加
  16358. Vue.set(target, key, value);
  16359. };
  16360. Vue.prototype.__set_sync = function(target, key, value) {
  16361. if (!target) {
  16362. target = this;
  16363. }
  16364. // 解决动态属性添加
  16365. Vue.set(target, key, value);
  16366. };
  16367. Vue.prototype.__get_orig = function(item) {
  16368. if (isPlainObject(item)) {
  16369. return item['$orig'] || item
  16370. }
  16371. return item
  16372. };
  16373. Vue.prototype.__get_value = function(dataPath, target) {
  16374. return getTarget(target || this, dataPath)
  16375. };
  16376. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  16377. return renderClass(staticClass, dynamicClass)
  16378. };
  16379. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  16380. if (!dynamicStyle && !staticStyle) {
  16381. return ''
  16382. }
  16383. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  16384. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  16385. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  16386. };
  16387. Vue.prototype.__map = function(val, iteratee) {
  16388. //TODO 暂不考虑 string
  16389. var ret, i, l, keys, key;
  16390. if (Array.isArray(val)) {
  16391. ret = new Array(val.length);
  16392. for (i = 0, l = val.length; i < l; i++) {
  16393. ret[i] = iteratee(val[i], i);
  16394. }
  16395. return ret
  16396. } else if (isObject(val)) {
  16397. keys = Object.keys(val);
  16398. ret = Object.create(null);
  16399. for (i = 0, l = keys.length; i < l; i++) {
  16400. key = keys[i];
  16401. ret[key] = iteratee(val[key], key, i);
  16402. }
  16403. return ret
  16404. } else if (typeof val === 'number') {
  16405. ret = new Array(val);
  16406. for (i = 0, l = val; i < l; i++) {
  16407. // 第一个参数暂时仍和小程序一致
  16408. ret[i] = iteratee(i, i);
  16409. }
  16410. return ret
  16411. }
  16412. return []
  16413. };
  16414. }
  16415. /* */
  16416. var LIFECYCLE_HOOKS$1 = [
  16417. //App
  16418. 'onLaunch',
  16419. 'onShow',
  16420. 'onHide',
  16421. 'onUniNViewMessage',
  16422. 'onPageNotFound',
  16423. 'onThemeChange',
  16424. 'onError',
  16425. 'onUnhandledRejection',
  16426. //Page
  16427. 'onInit',
  16428. 'onLoad',
  16429. // 'onShow',
  16430. 'onReady',
  16431. // 'onHide',
  16432. 'onUnload',
  16433. 'onPullDownRefresh',
  16434. 'onReachBottom',
  16435. 'onTabItemTap',
  16436. 'onAddToFavorites',
  16437. 'onShareTimeline',
  16438. 'onShareAppMessage',
  16439. 'onResize',
  16440. 'onPageScroll',
  16441. 'onNavigationBarButtonTap',
  16442. 'onBackPress',
  16443. 'onNavigationBarSearchInputChanged',
  16444. 'onNavigationBarSearchInputConfirmed',
  16445. 'onNavigationBarSearchInputClicked',
  16446. //Component
  16447. // 'onReady', // 兼容旧版本,应该移除该事件
  16448. 'onPageShow',
  16449. 'onPageHide',
  16450. 'onPageResize'
  16451. ];
  16452. function lifecycleMixin$1(Vue) {
  16453. //fixed vue-class-component
  16454. var oldExtend = Vue.extend;
  16455. Vue.extend = function(extendOptions) {
  16456. extendOptions = extendOptions || {};
  16457. var methods = extendOptions.methods;
  16458. if (methods) {
  16459. Object.keys(methods).forEach(function (methodName) {
  16460. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  16461. extendOptions[methodName] = methods[methodName];
  16462. delete methods[methodName];
  16463. }
  16464. });
  16465. }
  16466. return oldExtend.call(this, extendOptions)
  16467. };
  16468. var strategies = Vue.config.optionMergeStrategies;
  16469. var mergeHook = strategies.created;
  16470. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  16471. strategies[hook] = mergeHook;
  16472. });
  16473. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  16474. }
  16475. /* */
  16476. // install platform patch function
  16477. Vue.prototype.__patch__ = patch;
  16478. // public mount method
  16479. Vue.prototype.$mount = function(
  16480. el ,
  16481. hydrating
  16482. ) {
  16483. return mountComponent$1(this, el, hydrating)
  16484. };
  16485. lifecycleMixin$1(Vue);
  16486. internalMixin(Vue);
  16487. /* */
  16488. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  16489. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 2)))
  16490. /***/ }),
  16491. /***/ 5:
  16492. /*!***********************************************!*\
  16493. !*** D:/hongxing/iot-platform-app/pages.json ***!
  16494. \***********************************************/
  16495. /*! no static exports found */
  16496. /***/ (function(module, exports) {
  16497. /***/ }),
  16498. /***/ 67:
  16499. /*!***********************************************************!*\
  16500. !*** D:/hongxing/iot-platform-app/static/images/zhen.png ***!
  16501. \***********************************************************/
  16502. /*! no static exports found */
  16503. /***/ (function(module, exports) {
  16504. module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjg0MUJDNEFDMENCOTExRURCNEVGQkU3MjhEOEQxNjQ1IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjg0MUJDNEFEMENCOTExRURCNEVGQkU3MjhEOEQxNjQ1Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6ODQxQkM0QUEwQ0I5MTFFREI0RUZCRTcyOEQ4RDE2NDUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6ODQxQkM0QUIwQ0I5MTFFREI0RUZCRTcyOEQ4RDE2NDUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz62RyNmAAACOklEQVR42sxYsU7cQBCdsQKIKi7TcRE/sGmpji4dly/IpUmTAiggddooEkpFeZeCKpHCH0D+gE9w/sDpEuGdYXbX5rzmLhhpDLvSaTSnPc/bN29m1gfMDH0+9y3+MZncu6dHnAy0FpPReIweICBIBhB/fz0GrsbpMFT5lKk86plOuuxIFPk8MUBg0gFELl0MCVWZHbsq47MdkwhDXJd9lifCUGVCyqpEUuYqjKzT0vjJU8Yzk3swoKNrDQ0Zrx8/gDFPRNS24SuBKiOZ8sgNQwmkjKq8hWPr6QGxzRfM4CgNUStNen+kPtdTvxFjffDp9hQy3BftiIYwaCjYQuwc1quv+K4ou1dYdUA8G+XwDy8CMx0dx34JGe/i++JqMEB8ImA2+EKCmhYjHVuDYj8HSrC4ix8CqD6xHjY61qu5iNj4vuN007YOgbe0sJakAu1PfxDtWcanL+QSRntBwASx7YKJ/BGsXU/1h2vFB8JOzQh1rF3h16CA3uqXvX/vwjoAQiyW2jZaavvkrRkCUI89URnUvwmWT/LcV55aypo0cEfQd3yKv+egKTwsS10NARURCGiC8m3QBYgOKGv/6Iua7GWoGlotYOblPtD5IKODv2y6sbC1tAn+7+aR0Us8/FvoN0bm6comuKxZBiY/OTCDDVf+vOaa3KxdTFF1xYx9w6NFU9RnyMU5vp6LeSWn/xUxxBFjv4WZN20wg18/AlsyZC1M/LBFkLcPuJQjXuFHOF/1D5oaoMdaNwIMAFzc0wKLNf6FAAAAAElFTkSuQmCC"
  16505. /***/ }),
  16506. /***/ 98:
  16507. /*!*****************************************************************************************!*\
  16508. !*** D:/hongxing/iot-platform-app/node_modules/@dcloudio/uni-ui/lib/uni-icons/icons.js ***!
  16509. \*****************************************************************************************/
  16510. /*! no static exports found */
  16511. /***/ (function(module, exports, __webpack_require__) {
  16512. "use strict";
  16513. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _default = {
  16514. "id": "2852637",
  16515. "name": "uniui图标库",
  16516. "font_family": "uniicons",
  16517. "css_prefix_text": "uniui-",
  16518. "description": "",
  16519. "glyphs": [
  16520. {
  16521. "icon_id": "25027049",
  16522. "name": "yanse",
  16523. "font_class": "color",
  16524. "unicode": "e6cf",
  16525. "unicode_decimal": 59087 },
  16526. {
  16527. "icon_id": "25027048",
  16528. "name": "wallet",
  16529. "font_class": "wallet",
  16530. "unicode": "e6b1",
  16531. "unicode_decimal": 59057 },
  16532. {
  16533. "icon_id": "25015720",
  16534. "name": "settings-filled",
  16535. "font_class": "settings-filled",
  16536. "unicode": "e6ce",
  16537. "unicode_decimal": 59086 },
  16538. {
  16539. "icon_id": "25015434",
  16540. "name": "shimingrenzheng-filled",
  16541. "font_class": "auth-filled",
  16542. "unicode": "e6cc",
  16543. "unicode_decimal": 59084 },
  16544. {
  16545. "icon_id": "24934246",
  16546. "name": "shop-filled",
  16547. "font_class": "shop-filled",
  16548. "unicode": "e6cd",
  16549. "unicode_decimal": 59085 },
  16550. {
  16551. "icon_id": "24934159",
  16552. "name": "staff-filled-01",
  16553. "font_class": "staff-filled",
  16554. "unicode": "e6cb",
  16555. "unicode_decimal": 59083 },
  16556. {
  16557. "icon_id": "24932461",
  16558. "name": "VIP-filled",
  16559. "font_class": "vip-filled",
  16560. "unicode": "e6c6",
  16561. "unicode_decimal": 59078 },
  16562. {
  16563. "icon_id": "24932462",
  16564. "name": "plus_circle_fill",
  16565. "font_class": "plus-filled",
  16566. "unicode": "e6c7",
  16567. "unicode_decimal": 59079 },
  16568. {
  16569. "icon_id": "24932463",
  16570. "name": "folder_add-filled",
  16571. "font_class": "folder-add-filled",
  16572. "unicode": "e6c8",
  16573. "unicode_decimal": 59080 },
  16574. {
  16575. "icon_id": "24932464",
  16576. "name": "yanse-filled",
  16577. "font_class": "color-filled",
  16578. "unicode": "e6c9",
  16579. "unicode_decimal": 59081 },
  16580. {
  16581. "icon_id": "24932465",
  16582. "name": "tune-filled",
  16583. "font_class": "tune-filled",
  16584. "unicode": "e6ca",
  16585. "unicode_decimal": 59082 },
  16586. {
  16587. "icon_id": "24932455",
  16588. "name": "a-rilidaka-filled",
  16589. "font_class": "calendar-filled",
  16590. "unicode": "e6c0",
  16591. "unicode_decimal": 59072 },
  16592. {
  16593. "icon_id": "24932456",
  16594. "name": "notification-filled",
  16595. "font_class": "notification-filled",
  16596. "unicode": "e6c1",
  16597. "unicode_decimal": 59073 },
  16598. {
  16599. "icon_id": "24932457",
  16600. "name": "wallet-filled",
  16601. "font_class": "wallet-filled",
  16602. "unicode": "e6c2",
  16603. "unicode_decimal": 59074 },
  16604. {
  16605. "icon_id": "24932458",
  16606. "name": "paihangbang-filled",
  16607. "font_class": "medal-filled",
  16608. "unicode": "e6c3",
  16609. "unicode_decimal": 59075 },
  16610. {
  16611. "icon_id": "24932459",
  16612. "name": "gift-filled",
  16613. "font_class": "gift-filled",
  16614. "unicode": "e6c4",
  16615. "unicode_decimal": 59076 },
  16616. {
  16617. "icon_id": "24932460",
  16618. "name": "fire-filled",
  16619. "font_class": "fire-filled",
  16620. "unicode": "e6c5",
  16621. "unicode_decimal": 59077 },
  16622. {
  16623. "icon_id": "24928001",
  16624. "name": "refreshempty",
  16625. "font_class": "refreshempty",
  16626. "unicode": "e6bf",
  16627. "unicode_decimal": 59071 },
  16628. {
  16629. "icon_id": "24926853",
  16630. "name": "location-ellipse",
  16631. "font_class": "location-filled",
  16632. "unicode": "e6af",
  16633. "unicode_decimal": 59055 },
  16634. {
  16635. "icon_id": "24926735",
  16636. "name": "person-filled",
  16637. "font_class": "person-filled",
  16638. "unicode": "e69d",
  16639. "unicode_decimal": 59037 },
  16640. {
  16641. "icon_id": "24926703",
  16642. "name": "personadd-filled",
  16643. "font_class": "personadd-filled",
  16644. "unicode": "e698",
  16645. "unicode_decimal": 59032 },
  16646. {
  16647. "icon_id": "24923351",
  16648. "name": "back",
  16649. "font_class": "back",
  16650. "unicode": "e6b9",
  16651. "unicode_decimal": 59065 },
  16652. {
  16653. "icon_id": "24923352",
  16654. "name": "forward",
  16655. "font_class": "forward",
  16656. "unicode": "e6ba",
  16657. "unicode_decimal": 59066 },
  16658. {
  16659. "icon_id": "24923353",
  16660. "name": "arrowthinright",
  16661. "font_class": "arrow-right",
  16662. "unicode": "e6bb",
  16663. "unicode_decimal": 59067 },
  16664. {
  16665. "icon_id": "24923353",
  16666. "name": "arrowthinright",
  16667. "font_class": "arrowthinright",
  16668. "unicode": "e6bb",
  16669. "unicode_decimal": 59067 },
  16670. {
  16671. "icon_id": "24923354",
  16672. "name": "arrowthinleft",
  16673. "font_class": "arrow-left",
  16674. "unicode": "e6bc",
  16675. "unicode_decimal": 59068 },
  16676. {
  16677. "icon_id": "24923354",
  16678. "name": "arrowthinleft",
  16679. "font_class": "arrowthinleft",
  16680. "unicode": "e6bc",
  16681. "unicode_decimal": 59068 },
  16682. {
  16683. "icon_id": "24923355",
  16684. "name": "arrowthinup",
  16685. "font_class": "arrow-up",
  16686. "unicode": "e6bd",
  16687. "unicode_decimal": 59069 },
  16688. {
  16689. "icon_id": "24923355",
  16690. "name": "arrowthinup",
  16691. "font_class": "arrowthinup",
  16692. "unicode": "e6bd",
  16693. "unicode_decimal": 59069 },
  16694. {
  16695. "icon_id": "24923356",
  16696. "name": "arrowthindown",
  16697. "font_class": "arrow-down",
  16698. "unicode": "e6be",
  16699. "unicode_decimal": 59070 },
  16700. {
  16701. "icon_id": "24923356",
  16702. "name": "arrowthindown",
  16703. "font_class": "arrowthindown",
  16704. "unicode": "e6be",
  16705. "unicode_decimal": 59070 },
  16706. {
  16707. "icon_id": "24923349",
  16708. "name": "arrowdown",
  16709. "font_class": "bottom",
  16710. "unicode": "e6b8",
  16711. "unicode_decimal": 59064 },
  16712. {
  16713. "icon_id": "24923349",
  16714. "name": "arrowdown",
  16715. "font_class": "arrowdown",
  16716. "unicode": "e6b8",
  16717. "unicode_decimal": 59064 },
  16718. {
  16719. "icon_id": "24923346",
  16720. "name": "arrowright",
  16721. "font_class": "right",
  16722. "unicode": "e6b5",
  16723. "unicode_decimal": 59061 },
  16724. {
  16725. "icon_id": "24923346",
  16726. "name": "arrowright",
  16727. "font_class": "arrowright",
  16728. "unicode": "e6b5",
  16729. "unicode_decimal": 59061 },
  16730. {
  16731. "icon_id": "24923347",
  16732. "name": "arrowup",
  16733. "font_class": "top",
  16734. "unicode": "e6b6",
  16735. "unicode_decimal": 59062 },
  16736. {
  16737. "icon_id": "24923347",
  16738. "name": "arrowup",
  16739. "font_class": "arrowup",
  16740. "unicode": "e6b6",
  16741. "unicode_decimal": 59062 },
  16742. {
  16743. "icon_id": "24923348",
  16744. "name": "arrowleft",
  16745. "font_class": "left",
  16746. "unicode": "e6b7",
  16747. "unicode_decimal": 59063 },
  16748. {
  16749. "icon_id": "24923348",
  16750. "name": "arrowleft",
  16751. "font_class": "arrowleft",
  16752. "unicode": "e6b7",
  16753. "unicode_decimal": 59063 },
  16754. {
  16755. "icon_id": "24923334",
  16756. "name": "eye",
  16757. "font_class": "eye",
  16758. "unicode": "e651",
  16759. "unicode_decimal": 58961 },
  16760. {
  16761. "icon_id": "24923335",
  16762. "name": "eye-filled",
  16763. "font_class": "eye-filled",
  16764. "unicode": "e66a",
  16765. "unicode_decimal": 58986 },
  16766. {
  16767. "icon_id": "24923336",
  16768. "name": "eye-slash",
  16769. "font_class": "eye-slash",
  16770. "unicode": "e6b3",
  16771. "unicode_decimal": 59059 },
  16772. {
  16773. "icon_id": "24923337",
  16774. "name": "eye-slash-filled",
  16775. "font_class": "eye-slash-filled",
  16776. "unicode": "e6b4",
  16777. "unicode_decimal": 59060 },
  16778. {
  16779. "icon_id": "24923305",
  16780. "name": "info-filled",
  16781. "font_class": "info-filled",
  16782. "unicode": "e649",
  16783. "unicode_decimal": 58953 },
  16784. {
  16785. "icon_id": "24923299",
  16786. "name": "reload-01",
  16787. "font_class": "reload",
  16788. "unicode": "e6b2",
  16789. "unicode_decimal": 59058 },
  16790. {
  16791. "icon_id": "24923195",
  16792. "name": "mic_slash_fill",
  16793. "font_class": "micoff-filled",
  16794. "unicode": "e6b0",
  16795. "unicode_decimal": 59056 },
  16796. {
  16797. "icon_id": "24923165",
  16798. "name": "map-pin-ellipse",
  16799. "font_class": "map-pin-ellipse",
  16800. "unicode": "e6ac",
  16801. "unicode_decimal": 59052 },
  16802. {
  16803. "icon_id": "24923166",
  16804. "name": "map-pin",
  16805. "font_class": "map-pin",
  16806. "unicode": "e6ad",
  16807. "unicode_decimal": 59053 },
  16808. {
  16809. "icon_id": "24923167",
  16810. "name": "location",
  16811. "font_class": "location",
  16812. "unicode": "e6ae",
  16813. "unicode_decimal": 59054 },
  16814. {
  16815. "icon_id": "24923064",
  16816. "name": "starhalf",
  16817. "font_class": "starhalf",
  16818. "unicode": "e683",
  16819. "unicode_decimal": 59011 },
  16820. {
  16821. "icon_id": "24923065",
  16822. "name": "star",
  16823. "font_class": "star",
  16824. "unicode": "e688",
  16825. "unicode_decimal": 59016 },
  16826. {
  16827. "icon_id": "24923066",
  16828. "name": "star-filled",
  16829. "font_class": "star-filled",
  16830. "unicode": "e68f",
  16831. "unicode_decimal": 59023 },
  16832. {
  16833. "icon_id": "24899646",
  16834. "name": "a-rilidaka",
  16835. "font_class": "calendar",
  16836. "unicode": "e6a0",
  16837. "unicode_decimal": 59040 },
  16838. {
  16839. "icon_id": "24899647",
  16840. "name": "fire",
  16841. "font_class": "fire",
  16842. "unicode": "e6a1",
  16843. "unicode_decimal": 59041 },
  16844. {
  16845. "icon_id": "24899648",
  16846. "name": "paihangbang",
  16847. "font_class": "medal",
  16848. "unicode": "e6a2",
  16849. "unicode_decimal": 59042 },
  16850. {
  16851. "icon_id": "24899649",
  16852. "name": "font",
  16853. "font_class": "font",
  16854. "unicode": "e6a3",
  16855. "unicode_decimal": 59043 },
  16856. {
  16857. "icon_id": "24899650",
  16858. "name": "gift",
  16859. "font_class": "gift",
  16860. "unicode": "e6a4",
  16861. "unicode_decimal": 59044 },
  16862. {
  16863. "icon_id": "24899651",
  16864. "name": "link",
  16865. "font_class": "link",
  16866. "unicode": "e6a5",
  16867. "unicode_decimal": 59045 },
  16868. {
  16869. "icon_id": "24899652",
  16870. "name": "notification",
  16871. "font_class": "notification",
  16872. "unicode": "e6a6",
  16873. "unicode_decimal": 59046 },
  16874. {
  16875. "icon_id": "24899653",
  16876. "name": "staff",
  16877. "font_class": "staff",
  16878. "unicode": "e6a7",
  16879. "unicode_decimal": 59047 },
  16880. {
  16881. "icon_id": "24899654",
  16882. "name": "VIP",
  16883. "font_class": "vip",
  16884. "unicode": "e6a8",
  16885. "unicode_decimal": 59048 },
  16886. {
  16887. "icon_id": "24899655",
  16888. "name": "folder_add",
  16889. "font_class": "folder-add",
  16890. "unicode": "e6a9",
  16891. "unicode_decimal": 59049 },
  16892. {
  16893. "icon_id": "24899656",
  16894. "name": "tune",
  16895. "font_class": "tune",
  16896. "unicode": "e6aa",
  16897. "unicode_decimal": 59050 },
  16898. {
  16899. "icon_id": "24899657",
  16900. "name": "shimingrenzheng",
  16901. "font_class": "auth",
  16902. "unicode": "e6ab",
  16903. "unicode_decimal": 59051 },
  16904. {
  16905. "icon_id": "24899565",
  16906. "name": "person",
  16907. "font_class": "person",
  16908. "unicode": "e699",
  16909. "unicode_decimal": 59033 },
  16910. {
  16911. "icon_id": "24899566",
  16912. "name": "email-filled",
  16913. "font_class": "email-filled",
  16914. "unicode": "e69a",
  16915. "unicode_decimal": 59034 },
  16916. {
  16917. "icon_id": "24899567",
  16918. "name": "phone-filled",
  16919. "font_class": "phone-filled",
  16920. "unicode": "e69b",
  16921. "unicode_decimal": 59035 },
  16922. {
  16923. "icon_id": "24899568",
  16924. "name": "phone",
  16925. "font_class": "phone",
  16926. "unicode": "e69c",
  16927. "unicode_decimal": 59036 },
  16928. {
  16929. "icon_id": "24899570",
  16930. "name": "email",
  16931. "font_class": "email",
  16932. "unicode": "e69e",
  16933. "unicode_decimal": 59038 },
  16934. {
  16935. "icon_id": "24899571",
  16936. "name": "personadd",
  16937. "font_class": "personadd",
  16938. "unicode": "e69f",
  16939. "unicode_decimal": 59039 },
  16940. {
  16941. "icon_id": "24899558",
  16942. "name": "chatboxes-filled",
  16943. "font_class": "chatboxes-filled",
  16944. "unicode": "e692",
  16945. "unicode_decimal": 59026 },
  16946. {
  16947. "icon_id": "24899559",
  16948. "name": "contact",
  16949. "font_class": "contact",
  16950. "unicode": "e693",
  16951. "unicode_decimal": 59027 },
  16952. {
  16953. "icon_id": "24899560",
  16954. "name": "chatbubble-filled",
  16955. "font_class": "chatbubble-filled",
  16956. "unicode": "e694",
  16957. "unicode_decimal": 59028 },
  16958. {
  16959. "icon_id": "24899561",
  16960. "name": "contact-filled",
  16961. "font_class": "contact-filled",
  16962. "unicode": "e695",
  16963. "unicode_decimal": 59029 },
  16964. {
  16965. "icon_id": "24899562",
  16966. "name": "chatboxes",
  16967. "font_class": "chatboxes",
  16968. "unicode": "e696",
  16969. "unicode_decimal": 59030 },
  16970. {
  16971. "icon_id": "24899563",
  16972. "name": "chatbubble",
  16973. "font_class": "chatbubble",
  16974. "unicode": "e697",
  16975. "unicode_decimal": 59031 },
  16976. {
  16977. "icon_id": "24881290",
  16978. "name": "upload-filled",
  16979. "font_class": "upload-filled",
  16980. "unicode": "e68e",
  16981. "unicode_decimal": 59022 },
  16982. {
  16983. "icon_id": "24881292",
  16984. "name": "upload",
  16985. "font_class": "upload",
  16986. "unicode": "e690",
  16987. "unicode_decimal": 59024 },
  16988. {
  16989. "icon_id": "24881293",
  16990. "name": "weixin",
  16991. "font_class": "weixin",
  16992. "unicode": "e691",
  16993. "unicode_decimal": 59025 },
  16994. {
  16995. "icon_id": "24881274",
  16996. "name": "compose",
  16997. "font_class": "compose",
  16998. "unicode": "e67f",
  16999. "unicode_decimal": 59007 },
  17000. {
  17001. "icon_id": "24881275",
  17002. "name": "qq",
  17003. "font_class": "qq",
  17004. "unicode": "e680",
  17005. "unicode_decimal": 59008 },
  17006. {
  17007. "icon_id": "24881276",
  17008. "name": "download-filled",
  17009. "font_class": "download-filled",
  17010. "unicode": "e681",
  17011. "unicode_decimal": 59009 },
  17012. {
  17013. "icon_id": "24881277",
  17014. "name": "pengyouquan",
  17015. "font_class": "pyq",
  17016. "unicode": "e682",
  17017. "unicode_decimal": 59010 },
  17018. {
  17019. "icon_id": "24881279",
  17020. "name": "sound",
  17021. "font_class": "sound",
  17022. "unicode": "e684",
  17023. "unicode_decimal": 59012 },
  17024. {
  17025. "icon_id": "24881280",
  17026. "name": "trash-filled",
  17027. "font_class": "trash-filled",
  17028. "unicode": "e685",
  17029. "unicode_decimal": 59013 },
  17030. {
  17031. "icon_id": "24881281",
  17032. "name": "sound-filled",
  17033. "font_class": "sound-filled",
  17034. "unicode": "e686",
  17035. "unicode_decimal": 59014 },
  17036. {
  17037. "icon_id": "24881282",
  17038. "name": "trash",
  17039. "font_class": "trash",
  17040. "unicode": "e687",
  17041. "unicode_decimal": 59015 },
  17042. {
  17043. "icon_id": "24881284",
  17044. "name": "videocam-filled",
  17045. "font_class": "videocam-filled",
  17046. "unicode": "e689",
  17047. "unicode_decimal": 59017 },
  17048. {
  17049. "icon_id": "24881285",
  17050. "name": "spinner-cycle",
  17051. "font_class": "spinner-cycle",
  17052. "unicode": "e68a",
  17053. "unicode_decimal": 59018 },
  17054. {
  17055. "icon_id": "24881286",
  17056. "name": "weibo",
  17057. "font_class": "weibo",
  17058. "unicode": "e68b",
  17059. "unicode_decimal": 59019 },
  17060. {
  17061. "icon_id": "24881288",
  17062. "name": "videocam",
  17063. "font_class": "videocam",
  17064. "unicode": "e68c",
  17065. "unicode_decimal": 59020 },
  17066. {
  17067. "icon_id": "24881289",
  17068. "name": "download",
  17069. "font_class": "download",
  17070. "unicode": "e68d",
  17071. "unicode_decimal": 59021 },
  17072. {
  17073. "icon_id": "24879601",
  17074. "name": "help",
  17075. "font_class": "help",
  17076. "unicode": "e679",
  17077. "unicode_decimal": 59001 },
  17078. {
  17079. "icon_id": "24879602",
  17080. "name": "navigate-filled",
  17081. "font_class": "navigate-filled",
  17082. "unicode": "e67a",
  17083. "unicode_decimal": 59002 },
  17084. {
  17085. "icon_id": "24879603",
  17086. "name": "plusempty",
  17087. "font_class": "plusempty",
  17088. "unicode": "e67b",
  17089. "unicode_decimal": 59003 },
  17090. {
  17091. "icon_id": "24879604",
  17092. "name": "smallcircle",
  17093. "font_class": "smallcircle",
  17094. "unicode": "e67c",
  17095. "unicode_decimal": 59004 },
  17096. {
  17097. "icon_id": "24879605",
  17098. "name": "minus-filled",
  17099. "font_class": "minus-filled",
  17100. "unicode": "e67d",
  17101. "unicode_decimal": 59005 },
  17102. {
  17103. "icon_id": "24879606",
  17104. "name": "micoff",
  17105. "font_class": "micoff",
  17106. "unicode": "e67e",
  17107. "unicode_decimal": 59006 },
  17108. {
  17109. "icon_id": "24879588",
  17110. "name": "closeempty",
  17111. "font_class": "closeempty",
  17112. "unicode": "e66c",
  17113. "unicode_decimal": 58988 },
  17114. {
  17115. "icon_id": "24879589",
  17116. "name": "clear",
  17117. "font_class": "clear",
  17118. "unicode": "e66d",
  17119. "unicode_decimal": 58989 },
  17120. {
  17121. "icon_id": "24879590",
  17122. "name": "navigate",
  17123. "font_class": "navigate",
  17124. "unicode": "e66e",
  17125. "unicode_decimal": 58990 },
  17126. {
  17127. "icon_id": "24879591",
  17128. "name": "minus",
  17129. "font_class": "minus",
  17130. "unicode": "e66f",
  17131. "unicode_decimal": 58991 },
  17132. {
  17133. "icon_id": "24879592",
  17134. "name": "image",
  17135. "font_class": "image",
  17136. "unicode": "e670",
  17137. "unicode_decimal": 58992 },
  17138. {
  17139. "icon_id": "24879593",
  17140. "name": "mic",
  17141. "font_class": "mic",
  17142. "unicode": "e671",
  17143. "unicode_decimal": 58993 },
  17144. {
  17145. "icon_id": "24879594",
  17146. "name": "paperplane",
  17147. "font_class": "paperplane",
  17148. "unicode": "e672",
  17149. "unicode_decimal": 58994 },
  17150. {
  17151. "icon_id": "24879595",
  17152. "name": "close",
  17153. "font_class": "close",
  17154. "unicode": "e673",
  17155. "unicode_decimal": 58995 },
  17156. {
  17157. "icon_id": "24879596",
  17158. "name": "help-filled",
  17159. "font_class": "help-filled",
  17160. "unicode": "e674",
  17161. "unicode_decimal": 58996 },
  17162. {
  17163. "icon_id": "24879597",
  17164. "name": "plus-filled",
  17165. "font_class": "paperplane-filled",
  17166. "unicode": "e675",
  17167. "unicode_decimal": 58997 },
  17168. {
  17169. "icon_id": "24879598",
  17170. "name": "plus",
  17171. "font_class": "plus",
  17172. "unicode": "e676",
  17173. "unicode_decimal": 58998 },
  17174. {
  17175. "icon_id": "24879599",
  17176. "name": "mic-filled",
  17177. "font_class": "mic-filled",
  17178. "unicode": "e677",
  17179. "unicode_decimal": 58999 },
  17180. {
  17181. "icon_id": "24879600",
  17182. "name": "image-filled",
  17183. "font_class": "image-filled",
  17184. "unicode": "e678",
  17185. "unicode_decimal": 59000 },
  17186. {
  17187. "icon_id": "24855900",
  17188. "name": "locked-filled",
  17189. "font_class": "locked-filled",
  17190. "unicode": "e668",
  17191. "unicode_decimal": 58984 },
  17192. {
  17193. "icon_id": "24855901",
  17194. "name": "info",
  17195. "font_class": "info",
  17196. "unicode": "e669",
  17197. "unicode_decimal": 58985 },
  17198. {
  17199. "icon_id": "24855903",
  17200. "name": "locked",
  17201. "font_class": "locked",
  17202. "unicode": "e66b",
  17203. "unicode_decimal": 58987 },
  17204. {
  17205. "icon_id": "24855884",
  17206. "name": "camera-filled",
  17207. "font_class": "camera-filled",
  17208. "unicode": "e658",
  17209. "unicode_decimal": 58968 },
  17210. {
  17211. "icon_id": "24855885",
  17212. "name": "chat-filled",
  17213. "font_class": "chat-filled",
  17214. "unicode": "e659",
  17215. "unicode_decimal": 58969 },
  17216. {
  17217. "icon_id": "24855886",
  17218. "name": "camera",
  17219. "font_class": "camera",
  17220. "unicode": "e65a",
  17221. "unicode_decimal": 58970 },
  17222. {
  17223. "icon_id": "24855887",
  17224. "name": "circle",
  17225. "font_class": "circle",
  17226. "unicode": "e65b",
  17227. "unicode_decimal": 58971 },
  17228. {
  17229. "icon_id": "24855888",
  17230. "name": "checkmarkempty",
  17231. "font_class": "checkmarkempty",
  17232. "unicode": "e65c",
  17233. "unicode_decimal": 58972 },
  17234. {
  17235. "icon_id": "24855889",
  17236. "name": "chat",
  17237. "font_class": "chat",
  17238. "unicode": "e65d",
  17239. "unicode_decimal": 58973 },
  17240. {
  17241. "icon_id": "24855890",
  17242. "name": "circle-filled",
  17243. "font_class": "circle-filled",
  17244. "unicode": "e65e",
  17245. "unicode_decimal": 58974 },
  17246. {
  17247. "icon_id": "24855891",
  17248. "name": "flag",
  17249. "font_class": "flag",
  17250. "unicode": "e65f",
  17251. "unicode_decimal": 58975 },
  17252. {
  17253. "icon_id": "24855892",
  17254. "name": "flag-filled",
  17255. "font_class": "flag-filled",
  17256. "unicode": "e660",
  17257. "unicode_decimal": 58976 },
  17258. {
  17259. "icon_id": "24855893",
  17260. "name": "gear-filled",
  17261. "font_class": "gear-filled",
  17262. "unicode": "e661",
  17263. "unicode_decimal": 58977 },
  17264. {
  17265. "icon_id": "24855894",
  17266. "name": "home",
  17267. "font_class": "home",
  17268. "unicode": "e662",
  17269. "unicode_decimal": 58978 },
  17270. {
  17271. "icon_id": "24855895",
  17272. "name": "home-filled",
  17273. "font_class": "home-filled",
  17274. "unicode": "e663",
  17275. "unicode_decimal": 58979 },
  17276. {
  17277. "icon_id": "24855896",
  17278. "name": "gear",
  17279. "font_class": "gear",
  17280. "unicode": "e664",
  17281. "unicode_decimal": 58980 },
  17282. {
  17283. "icon_id": "24855897",
  17284. "name": "smallcircle-filled",
  17285. "font_class": "smallcircle-filled",
  17286. "unicode": "e665",
  17287. "unicode_decimal": 58981 },
  17288. {
  17289. "icon_id": "24855898",
  17290. "name": "map-filled",
  17291. "font_class": "map-filled",
  17292. "unicode": "e666",
  17293. "unicode_decimal": 58982 },
  17294. {
  17295. "icon_id": "24855899",
  17296. "name": "map",
  17297. "font_class": "map",
  17298. "unicode": "e667",
  17299. "unicode_decimal": 58983 },
  17300. {
  17301. "icon_id": "24855825",
  17302. "name": "refresh-filled",
  17303. "font_class": "refresh-filled",
  17304. "unicode": "e656",
  17305. "unicode_decimal": 58966 },
  17306. {
  17307. "icon_id": "24855826",
  17308. "name": "refresh",
  17309. "font_class": "refresh",
  17310. "unicode": "e657",
  17311. "unicode_decimal": 58967 },
  17312. {
  17313. "icon_id": "24855808",
  17314. "name": "cloud-upload",
  17315. "font_class": "cloud-upload",
  17316. "unicode": "e645",
  17317. "unicode_decimal": 58949 },
  17318. {
  17319. "icon_id": "24855809",
  17320. "name": "cloud-download-filled",
  17321. "font_class": "cloud-download-filled",
  17322. "unicode": "e646",
  17323. "unicode_decimal": 58950 },
  17324. {
  17325. "icon_id": "24855810",
  17326. "name": "cloud-download",
  17327. "font_class": "cloud-download",
  17328. "unicode": "e647",
  17329. "unicode_decimal": 58951 },
  17330. {
  17331. "icon_id": "24855811",
  17332. "name": "cloud-upload-filled",
  17333. "font_class": "cloud-upload-filled",
  17334. "unicode": "e648",
  17335. "unicode_decimal": 58952 },
  17336. {
  17337. "icon_id": "24855813",
  17338. "name": "redo",
  17339. "font_class": "redo",
  17340. "unicode": "e64a",
  17341. "unicode_decimal": 58954 },
  17342. {
  17343. "icon_id": "24855814",
  17344. "name": "images-filled",
  17345. "font_class": "images-filled",
  17346. "unicode": "e64b",
  17347. "unicode_decimal": 58955 },
  17348. {
  17349. "icon_id": "24855815",
  17350. "name": "undo-filled",
  17351. "font_class": "undo-filled",
  17352. "unicode": "e64c",
  17353. "unicode_decimal": 58956 },
  17354. {
  17355. "icon_id": "24855816",
  17356. "name": "more",
  17357. "font_class": "more",
  17358. "unicode": "e64d",
  17359. "unicode_decimal": 58957 },
  17360. {
  17361. "icon_id": "24855817",
  17362. "name": "more-filled",
  17363. "font_class": "more-filled",
  17364. "unicode": "e64e",
  17365. "unicode_decimal": 58958 },
  17366. {
  17367. "icon_id": "24855818",
  17368. "name": "undo",
  17369. "font_class": "undo",
  17370. "unicode": "e64f",
  17371. "unicode_decimal": 58959 },
  17372. {
  17373. "icon_id": "24855819",
  17374. "name": "images",
  17375. "font_class": "images",
  17376. "unicode": "e650",
  17377. "unicode_decimal": 58960 },
  17378. {
  17379. "icon_id": "24855821",
  17380. "name": "paperclip",
  17381. "font_class": "paperclip",
  17382. "unicode": "e652",
  17383. "unicode_decimal": 58962 },
  17384. {
  17385. "icon_id": "24855822",
  17386. "name": "settings",
  17387. "font_class": "settings",
  17388. "unicode": "e653",
  17389. "unicode_decimal": 58963 },
  17390. {
  17391. "icon_id": "24855823",
  17392. "name": "search",
  17393. "font_class": "search",
  17394. "unicode": "e654",
  17395. "unicode_decimal": 58964 },
  17396. {
  17397. "icon_id": "24855824",
  17398. "name": "redo-filled",
  17399. "font_class": "redo-filled",
  17400. "unicode": "e655",
  17401. "unicode_decimal": 58965 },
  17402. {
  17403. "icon_id": "24841702",
  17404. "name": "list",
  17405. "font_class": "list",
  17406. "unicode": "e644",
  17407. "unicode_decimal": 58948 },
  17408. {
  17409. "icon_id": "24841489",
  17410. "name": "mail-open-filled",
  17411. "font_class": "mail-open-filled",
  17412. "unicode": "e63a",
  17413. "unicode_decimal": 58938 },
  17414. {
  17415. "icon_id": "24841491",
  17416. "name": "hand-thumbsdown-filled",
  17417. "font_class": "hand-down-filled",
  17418. "unicode": "e63c",
  17419. "unicode_decimal": 58940 },
  17420. {
  17421. "icon_id": "24841492",
  17422. "name": "hand-thumbsdown",
  17423. "font_class": "hand-down",
  17424. "unicode": "e63d",
  17425. "unicode_decimal": 58941 },
  17426. {
  17427. "icon_id": "24841493",
  17428. "name": "hand-thumbsup-filled",
  17429. "font_class": "hand-up-filled",
  17430. "unicode": "e63e",
  17431. "unicode_decimal": 58942 },
  17432. {
  17433. "icon_id": "24841494",
  17434. "name": "hand-thumbsup",
  17435. "font_class": "hand-up",
  17436. "unicode": "e63f",
  17437. "unicode_decimal": 58943 },
  17438. {
  17439. "icon_id": "24841496",
  17440. "name": "heart-filled",
  17441. "font_class": "heart-filled",
  17442. "unicode": "e641",
  17443. "unicode_decimal": 58945 },
  17444. {
  17445. "icon_id": "24841498",
  17446. "name": "mail-open",
  17447. "font_class": "mail-open",
  17448. "unicode": "e643",
  17449. "unicode_decimal": 58947 },
  17450. {
  17451. "icon_id": "24841488",
  17452. "name": "heart",
  17453. "font_class": "heart",
  17454. "unicode": "e639",
  17455. "unicode_decimal": 58937 },
  17456. {
  17457. "icon_id": "24839963",
  17458. "name": "loop",
  17459. "font_class": "loop",
  17460. "unicode": "e633",
  17461. "unicode_decimal": 58931 },
  17462. {
  17463. "icon_id": "24839866",
  17464. "name": "pulldown",
  17465. "font_class": "pulldown",
  17466. "unicode": "e632",
  17467. "unicode_decimal": 58930 },
  17468. {
  17469. "icon_id": "24813798",
  17470. "name": "scan",
  17471. "font_class": "scan",
  17472. "unicode": "e62a",
  17473. "unicode_decimal": 58922 },
  17474. {
  17475. "icon_id": "24813786",
  17476. "name": "bars",
  17477. "font_class": "bars",
  17478. "unicode": "e627",
  17479. "unicode_decimal": 58919 },
  17480. {
  17481. "icon_id": "24813788",
  17482. "name": "cart-filled",
  17483. "font_class": "cart-filled",
  17484. "unicode": "e629",
  17485. "unicode_decimal": 58921 },
  17486. {
  17487. "icon_id": "24813790",
  17488. "name": "checkbox",
  17489. "font_class": "checkbox",
  17490. "unicode": "e62b",
  17491. "unicode_decimal": 58923 },
  17492. {
  17493. "icon_id": "24813791",
  17494. "name": "checkbox-filled",
  17495. "font_class": "checkbox-filled",
  17496. "unicode": "e62c",
  17497. "unicode_decimal": 58924 },
  17498. {
  17499. "icon_id": "24813794",
  17500. "name": "shop",
  17501. "font_class": "shop",
  17502. "unicode": "e62f",
  17503. "unicode_decimal": 58927 },
  17504. {
  17505. "icon_id": "24813795",
  17506. "name": "headphones",
  17507. "font_class": "headphones",
  17508. "unicode": "e630",
  17509. "unicode_decimal": 58928 },
  17510. {
  17511. "icon_id": "24813796",
  17512. "name": "cart",
  17513. "font_class": "cart",
  17514. "unicode": "e631",
  17515. "unicode_decimal": 58929 }] };exports.default = _default;
  17516. /***/ })
  17517. }]);
  17518. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map