vendor.js 448 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217
  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|getSystemSetting|getAppAuthorizeSetting/;
  290. var CONTEXT_API_RE = /^create|Manager$/;
  291. // Context例外情况
  292. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  293. // 同步例外情况
  294. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  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__CA02DBC",
  643. appName: "vrv-platform",
  644. appVersion: "1.0.0",
  645. appVersionCode: "100",
  646. appLanguage: getAppLanguage(hostLanguage),
  647. uniCompileVersion: "3.5.3",
  648. uniRuntimeVersion: "3.5.3",
  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__CA02DBC",
  736. appName: "vrv-platform",
  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. var getAppAuthorizeSetting = {
  765. returnValue: function returnValue(result) {var
  766. locationReducedAccuracy = result.locationReducedAccuracy;
  767. result.locationAccuracy = 'unsupported';
  768. if (locationReducedAccuracy === true) {
  769. result.locationAccuracy = 'reduced';
  770. } else if (locationReducedAccuracy === false) {
  771. result.locationAccuracy = 'full';
  772. }
  773. } };
  774. // import navigateTo from 'uni-helpers/navigate-to'
  775. var protocols = {
  776. redirectTo: redirectTo,
  777. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  778. previewImage: previewImage,
  779. getSystemInfo: getSystemInfo,
  780. getSystemInfoSync: getSystemInfo,
  781. showActionSheet: showActionSheet,
  782. getAppBaseInfo: getAppBaseInfo,
  783. getDeviceInfo: getDeviceInfo,
  784. getWindowInfo: getWindowInfo,
  785. getAppAuthorizeSetting: getAppAuthorizeSetting };
  786. var todos = [
  787. 'vibrate',
  788. 'preloadPage',
  789. 'unPreloadPage',
  790. 'loadSubPackage'];
  791. var canIUses = [];
  792. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  793. function processCallback(methodName, method, returnValue) {
  794. return function (res) {
  795. return method(processReturnValue(methodName, res, returnValue));
  796. };
  797. }
  798. 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;
  799. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  800. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  801. if (isFn(argsOption)) {
  802. argsOption = argsOption(fromArgs, toArgs) || {};
  803. }
  804. for (var key in fromArgs) {
  805. if (hasOwn(argsOption, key)) {
  806. var keyOption = argsOption[key];
  807. if (isFn(keyOption)) {
  808. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  809. }
  810. if (!keyOption) {// 不支持的参数
  811. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  812. } else if (isStr(keyOption)) {// 重写参数 key
  813. toArgs[keyOption] = fromArgs[key];
  814. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  815. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  816. }
  817. } else if (CALLBACKS.indexOf(key) !== -1) {
  818. if (isFn(fromArgs[key])) {
  819. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  820. }
  821. } else {
  822. if (!keepFromArgs) {
  823. toArgs[key] = fromArgs[key];
  824. }
  825. }
  826. }
  827. return toArgs;
  828. } else if (isFn(fromArgs)) {
  829. fromArgs = processCallback(methodName, fromArgs, returnValue);
  830. }
  831. return fromArgs;
  832. }
  833. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  834. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  835. res = protocols.returnValue(methodName, res);
  836. }
  837. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  838. }
  839. function wrapper(methodName, method) {
  840. if (hasOwn(protocols, methodName)) {
  841. var protocol = protocols[methodName];
  842. if (!protocol) {// 暂不支持的 api
  843. return function () {
  844. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  845. };
  846. }
  847. return function (arg1, arg2) {// 目前 api 最多两个参数
  848. var options = protocol;
  849. if (isFn(protocol)) {
  850. options = protocol(arg1);
  851. }
  852. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  853. var args = [arg1];
  854. if (typeof arg2 !== 'undefined') {
  855. args.push(arg2);
  856. }
  857. if (isFn(options.name)) {
  858. methodName = options.name(arg1);
  859. } else if (isStr(options.name)) {
  860. methodName = options.name;
  861. }
  862. var returnValue = wx[methodName].apply(wx, args);
  863. if (isSyncApi(methodName)) {// 同步 api
  864. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  865. }
  866. return returnValue;
  867. };
  868. }
  869. return method;
  870. }
  871. var todoApis = Object.create(null);
  872. var TODOS = [
  873. 'onTabBarMidButtonTap',
  874. 'subscribePush',
  875. 'unsubscribePush',
  876. 'onPush',
  877. 'offPush',
  878. 'share'];
  879. function createTodoApi(name) {
  880. return function todoApi(_ref)
  881. {var fail = _ref.fail,complete = _ref.complete;
  882. var res = {
  883. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported") };
  884. isFn(fail) && fail(res);
  885. isFn(complete) && complete(res);
  886. };
  887. }
  888. TODOS.forEach(function (name) {
  889. todoApis[name] = createTodoApi(name);
  890. });
  891. var providers = {
  892. oauth: ['weixin'],
  893. share: ['weixin'],
  894. payment: ['wxpay'],
  895. push: ['weixin'] };
  896. function getProvider(_ref2)
  897. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  898. var res = false;
  899. if (providers[service]) {
  900. res = {
  901. errMsg: 'getProvider:ok',
  902. service: service,
  903. provider: providers[service] };
  904. isFn(success) && success(res);
  905. } else {
  906. res = {
  907. errMsg: 'getProvider:fail service not found' };
  908. isFn(fail) && fail(res);
  909. }
  910. isFn(complete) && complete(res);
  911. }
  912. var extraApi = /*#__PURE__*/Object.freeze({
  913. __proto__: null,
  914. getProvider: getProvider });
  915. var getEmitter = function () {
  916. var Emitter;
  917. return function getUniEmitter() {
  918. if (!Emitter) {
  919. Emitter = new _vue.default();
  920. }
  921. return Emitter;
  922. };
  923. }();
  924. function apply(ctx, method, args) {
  925. return ctx[method].apply(ctx, args);
  926. }
  927. function $on() {
  928. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  929. }
  930. function $off() {
  931. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  932. }
  933. function $once() {
  934. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  935. }
  936. function $emit() {
  937. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  938. }
  939. var eventApi = /*#__PURE__*/Object.freeze({
  940. __proto__: null,
  941. $on: $on,
  942. $off: $off,
  943. $once: $once,
  944. $emit: $emit });
  945. /**
  946. * 框架内 try-catch
  947. */
  948. /**
  949. * 开发者 try-catch
  950. */
  951. function tryCatch(fn) {
  952. return function () {
  953. try {
  954. return fn.apply(fn, arguments);
  955. } catch (e) {
  956. // TODO
  957. console.error(e);
  958. }
  959. };
  960. }
  961. function getApiCallbacks(params) {
  962. var apiCallbacks = {};
  963. for (var name in params) {
  964. var param = params[name];
  965. if (isFn(param)) {
  966. apiCallbacks[name] = tryCatch(param);
  967. delete params[name];
  968. }
  969. }
  970. return apiCallbacks;
  971. }
  972. var cid;
  973. var cidErrMsg;
  974. var enabled;
  975. function normalizePushMessage(message) {
  976. try {
  977. return JSON.parse(message);
  978. } catch (e) {}
  979. return message;
  980. }
  981. function invokePushCallback(
  982. args)
  983. {
  984. if (args.type === 'enabled') {
  985. enabled = true;
  986. } else if (args.type === 'clientId') {
  987. cid = args.cid;
  988. cidErrMsg = args.errMsg;
  989. invokeGetPushCidCallbacks(cid, args.errMsg);
  990. } else if (args.type === 'pushMsg') {
  991. var message = {
  992. type: 'receive',
  993. data: normalizePushMessage(args.message) };
  994. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  995. var callback = onPushMessageCallbacks[i];
  996. callback(message);
  997. // 该消息已被阻止
  998. if (message.stopped) {
  999. break;
  1000. }
  1001. }
  1002. } else if (args.type === 'click') {
  1003. onPushMessageCallbacks.forEach(function (callback) {
  1004. callback({
  1005. type: 'click',
  1006. data: normalizePushMessage(args.message) });
  1007. });
  1008. }
  1009. }
  1010. var getPushCidCallbacks = [];
  1011. function invokeGetPushCidCallbacks(cid, errMsg) {
  1012. getPushCidCallbacks.forEach(function (callback) {
  1013. callback(cid, errMsg);
  1014. });
  1015. getPushCidCallbacks.length = 0;
  1016. }
  1017. function getPushClientId(args) {
  1018. if (!isPlainObject(args)) {
  1019. args = {};
  1020. }var _getApiCallbacks =
  1021. getApiCallbacks(args),success = _getApiCallbacks.success,fail = _getApiCallbacks.fail,complete = _getApiCallbacks.complete;
  1022. var hasSuccess = isFn(success);
  1023. var hasFail = isFn(fail);
  1024. var hasComplete = isFn(complete);
  1025. Promise.resolve().then(function () {
  1026. if (typeof enabled === 'undefined') {
  1027. enabled = false;
  1028. cid = '';
  1029. cidErrMsg = 'unipush is not enabled';
  1030. }
  1031. getPushCidCallbacks.push(function (cid, errMsg) {
  1032. var res;
  1033. if (cid) {
  1034. res = {
  1035. errMsg: 'getPushClientId:ok',
  1036. cid: cid };
  1037. hasSuccess && success(res);
  1038. } else {
  1039. res = {
  1040. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
  1041. hasFail && fail(res);
  1042. }
  1043. hasComplete && complete(res);
  1044. });
  1045. if (typeof cid !== 'undefined') {
  1046. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1047. }
  1048. });
  1049. }
  1050. var onPushMessageCallbacks = [];
  1051. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1052. var onPushMessage = function onPushMessage(fn) {
  1053. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1054. onPushMessageCallbacks.push(fn);
  1055. }
  1056. };
  1057. var offPushMessage = function offPushMessage(fn) {
  1058. if (!fn) {
  1059. onPushMessageCallbacks.length = 0;
  1060. } else {
  1061. var index = onPushMessageCallbacks.indexOf(fn);
  1062. if (index > -1) {
  1063. onPushMessageCallbacks.splice(index, 1);
  1064. }
  1065. }
  1066. };
  1067. var api = /*#__PURE__*/Object.freeze({
  1068. __proto__: null,
  1069. getPushClientId: getPushClientId,
  1070. onPushMessage: onPushMessage,
  1071. offPushMessage: offPushMessage,
  1072. invokePushCallback: invokePushCallback });
  1073. var MPPage = Page;
  1074. var MPComponent = Component;
  1075. var customizeRE = /:/g;
  1076. var customize = cached(function (str) {
  1077. return camelize(str.replace(customizeRE, '-'));
  1078. });
  1079. function initTriggerEvent(mpInstance) {
  1080. var oldTriggerEvent = mpInstance.triggerEvent;
  1081. 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];}
  1082. return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args));
  1083. };
  1084. try {
  1085. // 京东小程序 triggerEvent 为只读
  1086. mpInstance.triggerEvent = newTriggerEvent;
  1087. } catch (error) {
  1088. mpInstance._triggerEvent = newTriggerEvent;
  1089. }
  1090. }
  1091. function initHook(name, options, isComponent) {
  1092. var oldHook = options[name];
  1093. if (!oldHook) {
  1094. options[name] = function () {
  1095. initTriggerEvent(this);
  1096. };
  1097. } else {
  1098. options[name] = function () {
  1099. initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}
  1100. return oldHook.apply(this, args);
  1101. };
  1102. }
  1103. }
  1104. if (!MPPage.__$wrappered) {
  1105. MPPage.__$wrappered = true;
  1106. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1107. initHook('onLoad', options);
  1108. return MPPage(options);
  1109. };
  1110. Page.after = MPPage.after;
  1111. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1112. initHook('created', options);
  1113. return MPComponent(options);
  1114. };
  1115. }
  1116. var PAGE_EVENT_HOOKS = [
  1117. 'onPullDownRefresh',
  1118. 'onReachBottom',
  1119. 'onAddToFavorites',
  1120. 'onShareTimeline',
  1121. 'onShareAppMessage',
  1122. 'onPageScroll',
  1123. 'onResize',
  1124. 'onTabItemTap'];
  1125. function initMocks(vm, mocks) {
  1126. var mpInstance = vm.$mp[vm.mpType];
  1127. mocks.forEach(function (mock) {
  1128. if (hasOwn(mpInstance, mock)) {
  1129. vm[mock] = mpInstance[mock];
  1130. }
  1131. });
  1132. }
  1133. function hasHook(hook, vueOptions) {
  1134. if (!vueOptions) {
  1135. return true;
  1136. }
  1137. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1138. return true;
  1139. }
  1140. vueOptions = vueOptions.default || vueOptions;
  1141. if (isFn(vueOptions)) {
  1142. if (isFn(vueOptions.extendOptions[hook])) {
  1143. return true;
  1144. }
  1145. if (vueOptions.super &&
  1146. vueOptions.super.options &&
  1147. Array.isArray(vueOptions.super.options[hook])) {
  1148. return true;
  1149. }
  1150. return false;
  1151. }
  1152. if (isFn(vueOptions[hook])) {
  1153. return true;
  1154. }
  1155. var mixins = vueOptions.mixins;
  1156. if (Array.isArray(mixins)) {
  1157. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  1158. }
  1159. }
  1160. function initHooks(mpOptions, hooks, vueOptions) {
  1161. hooks.forEach(function (hook) {
  1162. if (hasHook(hook, vueOptions)) {
  1163. mpOptions[hook] = function (args) {
  1164. return this.$vm && this.$vm.__call_hook(hook, args);
  1165. };
  1166. }
  1167. });
  1168. }
  1169. function initVueComponent(Vue, vueOptions) {
  1170. vueOptions = vueOptions.default || vueOptions;
  1171. var VueComponent;
  1172. if (isFn(vueOptions)) {
  1173. VueComponent = vueOptions;
  1174. } else {
  1175. VueComponent = Vue.extend(vueOptions);
  1176. }
  1177. vueOptions = VueComponent.options;
  1178. return [VueComponent, vueOptions];
  1179. }
  1180. function initSlots(vm, vueSlots) {
  1181. if (Array.isArray(vueSlots) && vueSlots.length) {
  1182. var $slots = Object.create(null);
  1183. vueSlots.forEach(function (slotName) {
  1184. $slots[slotName] = true;
  1185. });
  1186. vm.$scopedSlots = vm.$slots = $slots;
  1187. }
  1188. }
  1189. function initVueIds(vueIds, mpInstance) {
  1190. vueIds = (vueIds || '').split(',');
  1191. var len = vueIds.length;
  1192. if (len === 1) {
  1193. mpInstance._$vueId = vueIds[0];
  1194. } else if (len === 2) {
  1195. mpInstance._$vueId = vueIds[0];
  1196. mpInstance._$vuePid = vueIds[1];
  1197. }
  1198. }
  1199. function initData(vueOptions, context) {
  1200. var data = vueOptions.data || {};
  1201. var methods = vueOptions.methods || {};
  1202. if (typeof data === 'function') {
  1203. try {
  1204. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1205. } catch (e) {
  1206. if (Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1207. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1208. }
  1209. }
  1210. } else {
  1211. try {
  1212. // 对 data 格式化
  1213. data = JSON.parse(JSON.stringify(data));
  1214. } catch (e) {}
  1215. }
  1216. if (!isPlainObject(data)) {
  1217. data = {};
  1218. }
  1219. Object.keys(methods).forEach(function (methodName) {
  1220. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1221. data[methodName] = methods[methodName];
  1222. }
  1223. });
  1224. return data;
  1225. }
  1226. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1227. function createObserver(name) {
  1228. return function observer(newVal, oldVal) {
  1229. if (this.$vm) {
  1230. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1231. }
  1232. };
  1233. }
  1234. function initBehaviors(vueOptions, initBehavior) {
  1235. var vueBehaviors = vueOptions.behaviors;
  1236. var vueExtends = vueOptions.extends;
  1237. var vueMixins = vueOptions.mixins;
  1238. var vueProps = vueOptions.props;
  1239. if (!vueProps) {
  1240. vueOptions.props = vueProps = [];
  1241. }
  1242. var behaviors = [];
  1243. if (Array.isArray(vueBehaviors)) {
  1244. vueBehaviors.forEach(function (behavior) {
  1245. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1246. if (behavior === 'uni://form-field') {
  1247. if (Array.isArray(vueProps)) {
  1248. vueProps.push('name');
  1249. vueProps.push('value');
  1250. } else {
  1251. vueProps.name = {
  1252. type: String,
  1253. default: '' };
  1254. vueProps.value = {
  1255. type: [String, Number, Boolean, Array, Object, Date],
  1256. default: '' };
  1257. }
  1258. }
  1259. });
  1260. }
  1261. if (isPlainObject(vueExtends) && vueExtends.props) {
  1262. behaviors.push(
  1263. initBehavior({
  1264. properties: initProperties(vueExtends.props, true) }));
  1265. }
  1266. if (Array.isArray(vueMixins)) {
  1267. vueMixins.forEach(function (vueMixin) {
  1268. if (isPlainObject(vueMixin) && vueMixin.props) {
  1269. behaviors.push(
  1270. initBehavior({
  1271. properties: initProperties(vueMixin.props, true) }));
  1272. }
  1273. });
  1274. }
  1275. return behaviors;
  1276. }
  1277. function parsePropType(key, type, defaultValue, file) {
  1278. // [String]=>String
  1279. if (Array.isArray(type) && type.length === 1) {
  1280. return type[0];
  1281. }
  1282. return type;
  1283. }
  1284. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';var options = arguments.length > 3 ? arguments[3] : undefined;
  1285. var properties = {};
  1286. if (!isBehavior) {
  1287. properties.vueId = {
  1288. type: String,
  1289. value: '' };
  1290. {
  1291. if (options.virtualHost) {
  1292. properties.virtualHostStyle = {
  1293. type: null,
  1294. value: '' };
  1295. properties.virtualHostClass = {
  1296. type: null,
  1297. value: '' };
  1298. }
  1299. }
  1300. // scopedSlotsCompiler auto
  1301. properties.scopedSlotsCompiler = {
  1302. type: String,
  1303. value: '' };
  1304. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1305. type: null,
  1306. value: [],
  1307. observer: function observer(newVal, oldVal) {
  1308. var $slots = Object.create(null);
  1309. newVal.forEach(function (slotName) {
  1310. $slots[slotName] = true;
  1311. });
  1312. this.setData({
  1313. $slots: $slots });
  1314. } };
  1315. }
  1316. if (Array.isArray(props)) {// ['title']
  1317. props.forEach(function (key) {
  1318. properties[key] = {
  1319. type: null,
  1320. observer: createObserver(key) };
  1321. });
  1322. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  1323. Object.keys(props).forEach(function (key) {
  1324. var opts = props[key];
  1325. if (isPlainObject(opts)) {// title:{type:String,default:''}
  1326. var value = opts.default;
  1327. if (isFn(value)) {
  1328. value = value();
  1329. }
  1330. opts.type = parsePropType(key, opts.type);
  1331. properties[key] = {
  1332. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1333. value: value,
  1334. observer: createObserver(key) };
  1335. } else {// content:String
  1336. var type = parsePropType(key, opts);
  1337. properties[key] = {
  1338. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1339. observer: createObserver(key) };
  1340. }
  1341. });
  1342. }
  1343. return properties;
  1344. }
  1345. function wrapper$1(event) {
  1346. // TODO 又得兼容 mpvue 的 mp 对象
  1347. try {
  1348. event.mp = JSON.parse(JSON.stringify(event));
  1349. } catch (e) {}
  1350. event.stopPropagation = noop;
  1351. event.preventDefault = noop;
  1352. event.target = event.target || {};
  1353. if (!hasOwn(event, 'detail')) {
  1354. event.detail = {};
  1355. }
  1356. if (hasOwn(event, 'markerId')) {
  1357. event.detail = typeof event.detail === 'object' ? event.detail : {};
  1358. event.detail.markerId = event.markerId;
  1359. }
  1360. if (isPlainObject(event.detail)) {
  1361. event.target = Object.assign({}, event.target, event.detail);
  1362. }
  1363. return event;
  1364. }
  1365. function getExtraValue(vm, dataPathsArray) {
  1366. var context = vm;
  1367. dataPathsArray.forEach(function (dataPathArray) {
  1368. var dataPath = dataPathArray[0];
  1369. var value = dataPathArray[2];
  1370. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  1371. var propPath = dataPathArray[1];
  1372. var valuePath = dataPathArray[3];
  1373. var vFor;
  1374. if (Number.isInteger(dataPath)) {
  1375. vFor = dataPath;
  1376. } else if (!dataPath) {
  1377. vFor = context;
  1378. } else if (typeof dataPath === 'string' && dataPath) {
  1379. if (dataPath.indexOf('#s#') === 0) {
  1380. vFor = dataPath.substr(3);
  1381. } else {
  1382. vFor = vm.__get_value(dataPath, context);
  1383. }
  1384. }
  1385. if (Number.isInteger(vFor)) {
  1386. context = value;
  1387. } else if (!propPath) {
  1388. context = vFor[value];
  1389. } else {
  1390. if (Array.isArray(vFor)) {
  1391. context = vFor.find(function (vForItem) {
  1392. return vm.__get_value(propPath, vForItem) === value;
  1393. });
  1394. } else if (isPlainObject(vFor)) {
  1395. context = Object.keys(vFor).find(function (vForKey) {
  1396. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1397. });
  1398. } else {
  1399. console.error('v-for 暂不支持循环数据:', vFor);
  1400. }
  1401. }
  1402. if (valuePath) {
  1403. context = vm.__get_value(valuePath, context);
  1404. }
  1405. }
  1406. });
  1407. return context;
  1408. }
  1409. function processEventExtra(vm, extra, event) {
  1410. var extraObj = {};
  1411. if (Array.isArray(extra) && extra.length) {
  1412. /**
  1413. *[
  1414. * ['data.items', 'data.id', item.data.id],
  1415. * ['metas', 'id', meta.id]
  1416. *],
  1417. *[
  1418. * ['data.items', 'data.id', item.data.id],
  1419. * ['metas', 'id', meta.id]
  1420. *],
  1421. *'test'
  1422. */
  1423. extra.forEach(function (dataPath, index) {
  1424. if (typeof dataPath === 'string') {
  1425. if (!dataPath) {// model,prop.sync
  1426. extraObj['$' + index] = vm;
  1427. } else {
  1428. if (dataPath === '$event') {// $event
  1429. extraObj['$' + index] = event;
  1430. } else if (dataPath === 'arguments') {
  1431. if (event.detail && event.detail.__args__) {
  1432. extraObj['$' + index] = event.detail.__args__;
  1433. } else {
  1434. extraObj['$' + index] = [event];
  1435. }
  1436. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  1437. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1438. } else {
  1439. extraObj['$' + index] = vm.__get_value(dataPath);
  1440. }
  1441. }
  1442. } else {
  1443. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1444. }
  1445. });
  1446. }
  1447. return extraObj;
  1448. }
  1449. function getObjByArray(arr) {
  1450. var obj = {};
  1451. for (var i = 1; i < arr.length; i++) {
  1452. var element = arr[i];
  1453. obj[element[0]] = element[1];
  1454. }
  1455. return obj;
  1456. }
  1457. 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;
  1458. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1459. if (isCustom) {// 自定义事件
  1460. isCustomMPEvent = event.currentTarget &&
  1461. event.currentTarget.dataset &&
  1462. event.currentTarget.dataset.comType === 'wx';
  1463. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  1464. if (isCustomMPEvent) {
  1465. return [event];
  1466. }
  1467. return event.detail.__args__ || event.detail;
  1468. }
  1469. }
  1470. var extraObj = processEventExtra(vm, extra, event);
  1471. var ret = [];
  1472. args.forEach(function (arg) {
  1473. if (arg === '$event') {
  1474. if (methodName === '__set_model' && !isCustom) {// input v-model value
  1475. ret.push(event.target.value);
  1476. } else {
  1477. if (isCustom && !isCustomMPEvent) {
  1478. ret.push(event.detail.__args__[0]);
  1479. } else {// wxcomponent 组件或内置组件
  1480. ret.push(event);
  1481. }
  1482. }
  1483. } else {
  1484. if (Array.isArray(arg) && arg[0] === 'o') {
  1485. ret.push(getObjByArray(arg));
  1486. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1487. ret.push(extraObj[arg]);
  1488. } else {
  1489. ret.push(arg);
  1490. }
  1491. }
  1492. });
  1493. return ret;
  1494. }
  1495. var ONCE = '~';
  1496. var CUSTOM = '^';
  1497. function isMatchEventType(eventType, optType) {
  1498. return eventType === optType ||
  1499. optType === 'regionchange' && (
  1500. eventType === 'begin' ||
  1501. eventType === 'end');
  1502. }
  1503. function getContextVm(vm) {
  1504. var $parent = vm.$parent;
  1505. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1506. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1507. $parent = $parent.$parent;
  1508. }
  1509. return $parent && $parent.$parent;
  1510. }
  1511. function handleEvent(event) {var _this2 = this;
  1512. event = wrapper$1(event);
  1513. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1514. var dataset = (event.currentTarget || event.target).dataset;
  1515. if (!dataset) {
  1516. return console.warn('事件信息不存在');
  1517. }
  1518. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1519. if (!eventOpts) {
  1520. return console.warn('事件信息不存在');
  1521. }
  1522. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1523. var eventType = event.type;
  1524. var ret = [];
  1525. eventOpts.forEach(function (eventOpt) {
  1526. var type = eventOpt[0];
  1527. var eventsArray = eventOpt[1];
  1528. var isCustom = type.charAt(0) === CUSTOM;
  1529. type = isCustom ? type.slice(1) : type;
  1530. var isOnce = type.charAt(0) === ONCE;
  1531. type = isOnce ? type.slice(1) : type;
  1532. if (eventsArray && isMatchEventType(eventType, type)) {
  1533. eventsArray.forEach(function (eventArray) {
  1534. var methodName = eventArray[0];
  1535. if (methodName) {
  1536. var handlerCtx = _this2.$vm;
  1537. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1538. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1539. }
  1540. if (methodName === '$emit') {
  1541. handlerCtx.$emit.apply(handlerCtx,
  1542. processEventArgs(
  1543. _this2.$vm,
  1544. event,
  1545. eventArray[1],
  1546. eventArray[2],
  1547. isCustom,
  1548. methodName));
  1549. return;
  1550. }
  1551. var handler = handlerCtx[methodName];
  1552. if (!isFn(handler)) {
  1553. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  1554. var path = _this2.route || _this2.is;
  1555. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  1556. }
  1557. if (isOnce) {
  1558. if (handler.once) {
  1559. return;
  1560. }
  1561. handler.once = true;
  1562. }
  1563. var params = processEventArgs(
  1564. _this2.$vm,
  1565. event,
  1566. eventArray[1],
  1567. eventArray[2],
  1568. isCustom,
  1569. methodName);
  1570. params = Array.isArray(params) ? params : [];
  1571. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1572. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1573. // eslint-disable-next-line no-sparse-arrays
  1574. params = params.concat([,,,,,,,,,, event]);
  1575. }
  1576. ret.push(handler.apply(handlerCtx, params));
  1577. }
  1578. });
  1579. }
  1580. });
  1581. if (
  1582. eventType === 'input' &&
  1583. ret.length === 1 &&
  1584. typeof ret[0] !== 'undefined')
  1585. {
  1586. return ret[0];
  1587. }
  1588. }
  1589. var eventChannels = {};
  1590. var eventChannelStack = [];
  1591. function getEventChannel(id) {
  1592. if (id) {
  1593. var eventChannel = eventChannels[id];
  1594. delete eventChannels[id];
  1595. return eventChannel;
  1596. }
  1597. return eventChannelStack.shift();
  1598. }
  1599. var hooks = [
  1600. 'onShow',
  1601. 'onHide',
  1602. 'onError',
  1603. 'onPageNotFound',
  1604. 'onThemeChange',
  1605. 'onUnhandledRejection'];
  1606. function initEventChannel() {
  1607. _vue.default.prototype.getOpenerEventChannel = function () {
  1608. // 微信小程序使用自身getOpenerEventChannel
  1609. {
  1610. return this.$scope.getOpenerEventChannel();
  1611. }
  1612. };
  1613. var callHook = _vue.default.prototype.__call_hook;
  1614. _vue.default.prototype.__call_hook = function (hook, args) {
  1615. if (hook === 'onLoad' && args && args.__id__) {
  1616. this.__eventChannel__ = getEventChannel(args.__id__);
  1617. delete args.__id__;
  1618. }
  1619. return callHook.call(this, hook, args);
  1620. };
  1621. }
  1622. function initScopedSlotsParams() {
  1623. var center = {};
  1624. var parents = {};
  1625. _vue.default.prototype.$hasScopedSlotsParams = function (vueId) {
  1626. var has = center[vueId];
  1627. if (!has) {
  1628. parents[vueId] = this;
  1629. this.$on('hook:destroyed', function () {
  1630. delete parents[vueId];
  1631. });
  1632. }
  1633. return has;
  1634. };
  1635. _vue.default.prototype.$getScopedSlotsParams = function (vueId, name, key) {
  1636. var data = center[vueId];
  1637. if (data) {
  1638. var object = data[name] || {};
  1639. return key ? object[key] : object;
  1640. } else {
  1641. parents[vueId] = this;
  1642. this.$on('hook:destroyed', function () {
  1643. delete parents[vueId];
  1644. });
  1645. }
  1646. };
  1647. _vue.default.prototype.$setScopedSlotsParams = function (name, value) {
  1648. var vueIds = this.$options.propsData.vueId;
  1649. if (vueIds) {
  1650. var vueId = vueIds.split(',')[0];
  1651. var object = center[vueId] = center[vueId] || {};
  1652. object[name] = value;
  1653. if (parents[vueId]) {
  1654. parents[vueId].$forceUpdate();
  1655. }
  1656. }
  1657. };
  1658. _vue.default.mixin({
  1659. destroyed: function destroyed() {
  1660. var propsData = this.$options.propsData;
  1661. var vueId = propsData && propsData.vueId;
  1662. if (vueId) {
  1663. delete center[vueId];
  1664. delete parents[vueId];
  1665. }
  1666. } });
  1667. }
  1668. function parseBaseApp(vm, _ref3)
  1669. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1670. initEventChannel();
  1671. {
  1672. initScopedSlotsParams();
  1673. }
  1674. if (vm.$options.store) {
  1675. _vue.default.prototype.$store = vm.$options.store;
  1676. }
  1677. uniIdMixin(_vue.default);
  1678. _vue.default.prototype.mpHost = "mp-weixin";
  1679. _vue.default.mixin({
  1680. beforeCreate: function beforeCreate() {
  1681. if (!this.$options.mpType) {
  1682. return;
  1683. }
  1684. this.mpType = this.$options.mpType;
  1685. this.$mp = _defineProperty({
  1686. data: {} },
  1687. this.mpType, this.$options.mpInstance);
  1688. this.$scope = this.$options.mpInstance;
  1689. delete this.$options.mpType;
  1690. delete this.$options.mpInstance;
  1691. if (this.mpType === 'page' && typeof getApp === 'function') {// hack vue-i18n
  1692. var app = getApp();
  1693. if (app.$vm && app.$vm.$i18n) {
  1694. this._i18n = app.$vm.$i18n;
  1695. }
  1696. }
  1697. if (this.mpType !== 'app') {
  1698. initRefs(this);
  1699. initMocks(this, mocks);
  1700. }
  1701. } });
  1702. var appOptions = {
  1703. onLaunch: function onLaunch(args) {
  1704. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1705. return;
  1706. }
  1707. {
  1708. if (wx.canIUse && !wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1709. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1710. }
  1711. }
  1712. this.$vm = vm;
  1713. this.$vm.$mp = {
  1714. app: this };
  1715. this.$vm.$scope = this;
  1716. // vm 上也挂载 globalData
  1717. this.$vm.globalData = this.globalData;
  1718. this.$vm._isMounted = true;
  1719. this.$vm.__call_hook('mounted', args);
  1720. this.$vm.__call_hook('onLaunch', args);
  1721. } };
  1722. // 兼容旧版本 globalData
  1723. appOptions.globalData = vm.$options.globalData || {};
  1724. // 将 methods 中的方法挂在 getApp() 中
  1725. var methods = vm.$options.methods;
  1726. if (methods) {
  1727. Object.keys(methods).forEach(function (name) {
  1728. appOptions[name] = methods[name];
  1729. });
  1730. }
  1731. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  1732. initHooks(appOptions, hooks);
  1733. return appOptions;
  1734. }
  1735. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1736. function findVmByVueId(vm, vuePid) {
  1737. var $children = vm.$children;
  1738. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1739. for (var i = $children.length - 1; i >= 0; i--) {
  1740. var childVm = $children[i];
  1741. if (childVm.$scope._$vueId === vuePid) {
  1742. return childVm;
  1743. }
  1744. }
  1745. // 反向递归查找
  1746. var parentVm;
  1747. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1748. parentVm = findVmByVueId($children[_i], vuePid);
  1749. if (parentVm) {
  1750. return parentVm;
  1751. }
  1752. }
  1753. }
  1754. function initBehavior(options) {
  1755. return Behavior(options);
  1756. }
  1757. function isPage() {
  1758. return !!this.route;
  1759. }
  1760. function initRelation(detail) {
  1761. this.triggerEvent('__l', detail);
  1762. }
  1763. function selectAllComponents(mpInstance, selector, $refs) {
  1764. var components = mpInstance.selectAllComponents(selector);
  1765. components.forEach(function (component) {
  1766. var ref = component.dataset.ref;
  1767. $refs[ref] = component.$vm || component;
  1768. {
  1769. if (component.dataset.vueGeneric === 'scoped') {
  1770. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1771. selectAllComponents(scopedComponent, selector, $refs);
  1772. });
  1773. }
  1774. }
  1775. });
  1776. }
  1777. function initRefs(vm) {
  1778. var mpInstance = vm.$scope;
  1779. Object.defineProperty(vm, '$refs', {
  1780. get: function get() {
  1781. var $refs = {};
  1782. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1783. // TODO 暂不考虑 for 中的 scoped
  1784. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1785. forComponents.forEach(function (component) {
  1786. var ref = component.dataset.ref;
  1787. if (!$refs[ref]) {
  1788. $refs[ref] = [];
  1789. }
  1790. $refs[ref].push(component.$vm || component);
  1791. });
  1792. return $refs;
  1793. } });
  1794. }
  1795. function handleLink(event) {var _ref4 =
  1796. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1797. var parentVm;
  1798. if (vuePid) {
  1799. parentVm = findVmByVueId(this.$vm, vuePid);
  1800. }
  1801. if (!parentVm) {
  1802. parentVm = this.$vm;
  1803. }
  1804. vueOptions.parent = parentVm;
  1805. }
  1806. function parseApp(vm) {
  1807. return parseBaseApp(vm, {
  1808. mocks: mocks,
  1809. initRefs: initRefs });
  1810. }
  1811. function createApp(vm) {
  1812. App(parseApp(vm));
  1813. return vm;
  1814. }
  1815. var encodeReserveRE = /[!'()*]/g;
  1816. var encodeReserveReplacer = function encodeReserveReplacer(c) {return '%' + c.charCodeAt(0).toString(16);};
  1817. var commaRE = /%2C/g;
  1818. // fixed encodeURIComponent which is more conformant to RFC3986:
  1819. // - escapes [!'()*]
  1820. // - preserve commas
  1821. var encode = function encode(str) {return encodeURIComponent(str).
  1822. replace(encodeReserveRE, encodeReserveReplacer).
  1823. replace(commaRE, ',');};
  1824. function stringifyQuery(obj) {var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  1825. var res = obj ? Object.keys(obj).map(function (key) {
  1826. var val = obj[key];
  1827. if (val === undefined) {
  1828. return '';
  1829. }
  1830. if (val === null) {
  1831. return encodeStr(key);
  1832. }
  1833. if (Array.isArray(val)) {
  1834. var result = [];
  1835. val.forEach(function (val2) {
  1836. if (val2 === undefined) {
  1837. return;
  1838. }
  1839. if (val2 === null) {
  1840. result.push(encodeStr(key));
  1841. } else {
  1842. result.push(encodeStr(key) + '=' + encodeStr(val2));
  1843. }
  1844. });
  1845. return result.join('&');
  1846. }
  1847. return encodeStr(key) + '=' + encodeStr(val);
  1848. }).filter(function (x) {return x.length > 0;}).join('&') : null;
  1849. return res ? "?".concat(res) : '';
  1850. }
  1851. function parseBaseComponent(vueComponentOptions)
  1852. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1853. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1854. var options = _objectSpread({
  1855. multipleSlots: true,
  1856. addGlobalClass: true },
  1857. vueOptions.options || {});
  1858. {
  1859. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1860. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1861. Object.assign(options, vueOptions['mp-weixin'].options);
  1862. }
  1863. }
  1864. var componentOptions = {
  1865. options: options,
  1866. data: initData(vueOptions, _vue.default.prototype),
  1867. behaviors: initBehaviors(vueOptions, initBehavior),
  1868. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  1869. lifetimes: {
  1870. attached: function attached() {
  1871. var properties = this.properties;
  1872. var options = {
  1873. mpType: isPage.call(this) ? 'page' : 'component',
  1874. mpInstance: this,
  1875. propsData: properties };
  1876. initVueIds(properties.vueId, this);
  1877. // 处理父子关系
  1878. initRelation.call(this, {
  1879. vuePid: this._$vuePid,
  1880. vueOptions: options });
  1881. // 初始化 vue 实例
  1882. this.$vm = new VueComponent(options);
  1883. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1884. initSlots(this.$vm, properties.vueSlots);
  1885. // 触发首次 setData
  1886. this.$vm.$mount();
  1887. },
  1888. ready: function ready() {
  1889. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1890. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1891. if (this.$vm) {
  1892. this.$vm._isMounted = true;
  1893. this.$vm.__call_hook('mounted');
  1894. this.$vm.__call_hook('onReady');
  1895. }
  1896. },
  1897. detached: function detached() {
  1898. this.$vm && this.$vm.$destroy();
  1899. } },
  1900. pageLifetimes: {
  1901. show: function show(args) {
  1902. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1903. },
  1904. hide: function hide() {
  1905. this.$vm && this.$vm.__call_hook('onPageHide');
  1906. },
  1907. resize: function resize(size) {
  1908. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1909. } },
  1910. methods: {
  1911. __l: handleLink,
  1912. __e: handleEvent } };
  1913. // externalClasses
  1914. if (vueOptions.externalClasses) {
  1915. componentOptions.externalClasses = vueOptions.externalClasses;
  1916. }
  1917. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1918. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1919. componentOptions.methods[callMethod] = function (args) {
  1920. return this.$vm[callMethod](args);
  1921. };
  1922. });
  1923. }
  1924. if (isPage) {
  1925. return componentOptions;
  1926. }
  1927. return [componentOptions, VueComponent];
  1928. }
  1929. function parseComponent(vueComponentOptions) {
  1930. return parseBaseComponent(vueComponentOptions, {
  1931. isPage: isPage,
  1932. initRelation: initRelation });
  1933. }
  1934. var hooks$1 = [
  1935. 'onShow',
  1936. 'onHide',
  1937. 'onUnload'];
  1938. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1939. function parseBasePage(vuePageOptions, _ref6)
  1940. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1941. var pageOptions = parseComponent(vuePageOptions);
  1942. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1943. pageOptions.methods.onLoad = function (query) {
  1944. this.options = query;
  1945. var copyQuery = Object.assign({}, query);
  1946. delete copyQuery.__id__;
  1947. this.$page = {
  1948. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery) };
  1949. this.$vm.$mp.query = query; // 兼容 mpvue
  1950. this.$vm.__call_hook('onLoad', query);
  1951. };
  1952. return pageOptions;
  1953. }
  1954. function parsePage(vuePageOptions) {
  1955. return parseBasePage(vuePageOptions, {
  1956. isPage: isPage,
  1957. initRelation: initRelation });
  1958. }
  1959. function createPage(vuePageOptions) {
  1960. {
  1961. return Component(parsePage(vuePageOptions));
  1962. }
  1963. }
  1964. function createComponent(vueOptions) {
  1965. {
  1966. return Component(parseComponent(vueOptions));
  1967. }
  1968. }
  1969. function createSubpackageApp(vm) {
  1970. var appOptions = parseApp(vm);
  1971. var app = getApp({
  1972. allowDefault: true });
  1973. vm.$scope = app;
  1974. var globalData = app.globalData;
  1975. if (globalData) {
  1976. Object.keys(appOptions.globalData).forEach(function (name) {
  1977. if (!hasOwn(globalData, name)) {
  1978. globalData[name] = appOptions.globalData[name];
  1979. }
  1980. });
  1981. }
  1982. Object.keys(appOptions).forEach(function (name) {
  1983. if (!hasOwn(app, name)) {
  1984. app[name] = appOptions[name];
  1985. }
  1986. });
  1987. if (isFn(appOptions.onShow) && wx.onAppShow) {
  1988. wx.onAppShow(function () {for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}
  1989. vm.__call_hook('onShow', args);
  1990. });
  1991. }
  1992. if (isFn(appOptions.onHide) && wx.onAppHide) {
  1993. wx.onAppHide(function () {for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}
  1994. vm.__call_hook('onHide', args);
  1995. });
  1996. }
  1997. if (isFn(appOptions.onLaunch)) {
  1998. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  1999. vm.__call_hook('onLaunch', args);
  2000. }
  2001. return vm;
  2002. }
  2003. function createPlugin(vm) {
  2004. var appOptions = parseApp(vm);
  2005. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2006. wx.onAppShow(function () {for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {args[_key7] = arguments[_key7];}
  2007. vm.__call_hook('onShow', args);
  2008. });
  2009. }
  2010. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2011. wx.onAppHide(function () {for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {args[_key8] = arguments[_key8];}
  2012. vm.__call_hook('onHide', args);
  2013. });
  2014. }
  2015. if (isFn(appOptions.onLaunch)) {
  2016. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2017. vm.__call_hook('onLaunch', args);
  2018. }
  2019. return vm;
  2020. }
  2021. todos.forEach(function (todoApi) {
  2022. protocols[todoApi] = false;
  2023. });
  2024. canIUses.forEach(function (canIUseApi) {
  2025. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  2026. canIUseApi;
  2027. if (!wx.canIUse(apiName)) {
  2028. protocols[canIUseApi] = false;
  2029. }
  2030. });
  2031. var uni = {};
  2032. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2033. uni = new Proxy({}, {
  2034. get: function get(target, name) {
  2035. if (hasOwn(target, name)) {
  2036. return target[name];
  2037. }
  2038. if (baseApi[name]) {
  2039. return baseApi[name];
  2040. }
  2041. if (api[name]) {
  2042. return promisify(name, api[name]);
  2043. }
  2044. {
  2045. if (extraApi[name]) {
  2046. return promisify(name, extraApi[name]);
  2047. }
  2048. if (todoApis[name]) {
  2049. return promisify(name, todoApis[name]);
  2050. }
  2051. }
  2052. if (eventApi[name]) {
  2053. return eventApi[name];
  2054. }
  2055. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  2056. return;
  2057. }
  2058. return promisify(name, wrapper(name, wx[name]));
  2059. },
  2060. set: function set(target, name, value) {
  2061. target[name] = value;
  2062. return true;
  2063. } });
  2064. } else {
  2065. Object.keys(baseApi).forEach(function (name) {
  2066. uni[name] = baseApi[name];
  2067. });
  2068. {
  2069. Object.keys(todoApis).forEach(function (name) {
  2070. uni[name] = promisify(name, todoApis[name]);
  2071. });
  2072. Object.keys(extraApi).forEach(function (name) {
  2073. uni[name] = promisify(name, todoApis[name]);
  2074. });
  2075. }
  2076. Object.keys(eventApi).forEach(function (name) {
  2077. uni[name] = eventApi[name];
  2078. });
  2079. Object.keys(api).forEach(function (name) {
  2080. uni[name] = promisify(name, api[name]);
  2081. });
  2082. Object.keys(wx).forEach(function (name) {
  2083. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2084. uni[name] = promisify(name, wrapper(name, wx[name]));
  2085. }
  2086. });
  2087. }
  2088. wx.createApp = createApp;
  2089. wx.createPage = createPage;
  2090. wx.createComponent = createComponent;
  2091. wx.createSubpackageApp = createSubpackageApp;
  2092. wx.createPlugin = createPlugin;
  2093. var uni$1 = uni;var _default =
  2094. uni$1;exports.default = _default;
  2095. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 2)))
  2096. /***/ }),
  2097. /***/ 11:
  2098. /*!**********************************************************************************************************!*\
  2099. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  2100. \**********************************************************************************************************/
  2101. /*! exports provided: default */
  2102. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2103. "use strict";
  2104. __webpack_require__.r(__webpack_exports__);
  2105. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  2106. /* globals __VUE_SSR_CONTEXT__ */
  2107. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  2108. // This module is a runtime utility for cleaner component module output and will
  2109. // be included in the final webpack user bundle.
  2110. function normalizeComponent (
  2111. scriptExports,
  2112. render,
  2113. staticRenderFns,
  2114. functionalTemplate,
  2115. injectStyles,
  2116. scopeId,
  2117. moduleIdentifier, /* server only */
  2118. shadowMode, /* vue-cli only */
  2119. components, // fixed by xxxxxx auto components
  2120. renderjs // fixed by xxxxxx renderjs
  2121. ) {
  2122. // Vue.extend constructor export interop
  2123. var options = typeof scriptExports === 'function'
  2124. ? scriptExports.options
  2125. : scriptExports
  2126. // fixed by xxxxxx auto components
  2127. if (components) {
  2128. if (!options.components) {
  2129. options.components = {}
  2130. }
  2131. var hasOwn = Object.prototype.hasOwnProperty
  2132. for (var name in components) {
  2133. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  2134. options.components[name] = components[name]
  2135. }
  2136. }
  2137. }
  2138. // fixed by xxxxxx renderjs
  2139. if (renderjs) {
  2140. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  2141. this[renderjs.__module] = this
  2142. });
  2143. (options.mixins || (options.mixins = [])).push(renderjs)
  2144. }
  2145. // render functions
  2146. if (render) {
  2147. options.render = render
  2148. options.staticRenderFns = staticRenderFns
  2149. options._compiled = true
  2150. }
  2151. // functional template
  2152. if (functionalTemplate) {
  2153. options.functional = true
  2154. }
  2155. // scopedId
  2156. if (scopeId) {
  2157. options._scopeId = 'data-v-' + scopeId
  2158. }
  2159. var hook
  2160. if (moduleIdentifier) { // server build
  2161. hook = function (context) {
  2162. // 2.3 injection
  2163. context =
  2164. context || // cached call
  2165. (this.$vnode && this.$vnode.ssrContext) || // stateful
  2166. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  2167. // 2.2 with runInNewContext: true
  2168. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  2169. context = __VUE_SSR_CONTEXT__
  2170. }
  2171. // inject component styles
  2172. if (injectStyles) {
  2173. injectStyles.call(this, context)
  2174. }
  2175. // register component module identifier for async chunk inferrence
  2176. if (context && context._registeredComponents) {
  2177. context._registeredComponents.add(moduleIdentifier)
  2178. }
  2179. }
  2180. // used by ssr in case component is cached and beforeCreate
  2181. // never gets called
  2182. options._ssrRegister = hook
  2183. } else if (injectStyles) {
  2184. hook = shadowMode
  2185. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  2186. : injectStyles
  2187. }
  2188. if (hook) {
  2189. if (options.functional) {
  2190. // for template-only hot-reload because in that case the render fn doesn't
  2191. // go through the normalizer
  2192. options._injectStyles = hook
  2193. // register for functioal component in vue file
  2194. var originalRender = options.render
  2195. options.render = function renderWithStyleInjection (h, context) {
  2196. hook.call(context)
  2197. return originalRender(h, context)
  2198. }
  2199. } else {
  2200. // inject component registration as beforeCreate hook
  2201. var existing = options.beforeCreate
  2202. options.beforeCreate = existing
  2203. ? [].concat(existing, hook)
  2204. : [hook]
  2205. }
  2206. }
  2207. return {
  2208. exports: scriptExports,
  2209. options: options
  2210. }
  2211. }
  2212. /***/ }),
  2213. /***/ 12:
  2214. /*!******************************************************************************************!*\
  2215. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/utils/http.js ***!
  2216. \******************************************************************************************/
  2217. /*! no static exports found */
  2218. /***/ (function(module, exports, __webpack_require__) {
  2219. "use strict";
  2220. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var http = {
  2221. get: function get(url, data)
  2222. {var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},header = _ref.header,_ref$timeout = _ref.timeout,timeout = _ref$timeout === void 0 ? 20000 : _ref$timeout;
  2223. var promise = new Promise(function (resolve, reject) {
  2224. uni.request({
  2225. url: url,
  2226. method: 'GET',
  2227. data: data,
  2228. timeout: timeout }).
  2229. then(
  2230. function (res) {
  2231. resolve(res[1]);
  2232. }).
  2233. catch();
  2234. });
  2235. return promise;
  2236. } };var _default =
  2237. http;exports.default = _default;
  2238. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  2239. /***/ }),
  2240. /***/ 13:
  2241. /*!******************************************************************************************!*\
  2242. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/config/api.js ***!
  2243. \******************************************************************************************/
  2244. /*! no static exports found */
  2245. /***/ (function(module, exports, __webpack_require__) {
  2246. "use strict";
  2247. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; //路径
  2248. var root = "http://127.0.0.1:9999";
  2249. //接口auth
  2250. var api = {
  2251. user: {
  2252. list: "".concat(root, "/user/list"),
  2253. add: "".concat(root, "/user/add"),
  2254. update: "".concat(root, "/user/update"),
  2255. detail: "".concat(root, "/user/detail"),
  2256. delete: "".concat(root, "/user/delete"),
  2257. batchDelete: "".concat(root, "/user/batchDelete"),
  2258. bindRole: "".concat(root, "/user/bindRole"),
  2259. bindOperator: "".concat(root, "/user/bindOperator") },
  2260. operator: {
  2261. list: "".concat(root, "/operator/list"),
  2262. add: "".concat(root, "/operator/add"),
  2263. update: "".concat(root, "/operator/update"),
  2264. detail: "".concat(root, "/operator/detail"),
  2265. delete: "".concat(root, "/operator/delete"),
  2266. batchDelete: "".concat(root, "/operator/batchDelete") },
  2267. project: {
  2268. list: "".concat(root, "/project/list"),
  2269. operatorList: "".concat(root, "/project/operatorList"),
  2270. add: "".concat(root, "/project/add"),
  2271. update: "".concat(root, "/project/update"),
  2272. detail: "".concat(root, "/project/detail"),
  2273. delete: "".concat(root, "/project/delete"),
  2274. batchDelete: "".concat(root, "/project/batchDelete") },
  2275. gateway: {
  2276. list: "".concat(root, "/gateway/list"),
  2277. add: "".concat(root, "/gateway/add"),
  2278. update: "".concat(root, "/gateway/update"),
  2279. detail: "".concat(root, "/gateway/detail"),
  2280. delete: "".concat(root, "/gateway/delete"),
  2281. batchDelete: "".concat(root, "/gateway/batchDelete") },
  2282. device: {
  2283. list: "".concat(root, "/device/list"),
  2284. add: "".concat(root, "/device/add"),
  2285. update: "".concat(root, "/device/update"),
  2286. detail: "".concat(root, "/device/detail"),
  2287. delete: "".concat(root, "/device/delete"),
  2288. batchDelete: "".concat(root, "/device/batchDelete") },
  2289. deviceParam: {
  2290. list: "".concat(root, "/deviceParam/list"),
  2291. add: "".concat(root, "/deviceParam/add"),
  2292. update: "".concat(root, "/deviceParam/update"),
  2293. updateParam: "".concat(root, "/deviceParam/updateParam"),
  2294. detail: "".concat(root, "/deviceParam/detail"),
  2295. delete: "".concat(root, "/deviceParam/delete"),
  2296. batchDelete: "".concat(root, "/deviceParam/batchDelete") },
  2297. deviceAlarmRecord: {
  2298. list: "".concat(root, "/deviceAlarmRecord/list"),
  2299. add: "".concat(root, "/deviceAlarmRecord/add"),
  2300. update: "".concat(root, "/deviceAlarmRecord/update"),
  2301. detail: "".concat(root, "/deviceAlarmRecord/detail"),
  2302. delete: "".concat(root, "/deviceAlarmRecord/delete"),
  2303. batchDelete: "".concat(root, "/deviceAlarmRecord/batchDelete") },
  2304. deviceAlarmConfig: {
  2305. list: "".concat(root, "/deviceAlarmConfig/list"),
  2306. add: "".concat(root, "/deviceAlarmConfig/add"),
  2307. update: "".concat(root, "/deviceAlarmConfig/update"),
  2308. detail: "".concat(root, "/deviceAlarmConfig/detail"),
  2309. delete: "".concat(root, "/deviceAlarmConfig/delete"),
  2310. batchDelete: "".concat(root, "/deviceAlarmConfig/batchDelete") },
  2311. deviceAlarmRepairRecord: {
  2312. list: "".concat(root, "/deviceAlarmRepairRecord/list"),
  2313. add: "".concat(root, "/deviceAlarmRepairRecord/add"),
  2314. update: "".concat(root, "/deviceAlarmRepairRecord/update"),
  2315. detail: "".concat(root, "/deviceAlarmRepairRecord/detail"),
  2316. delete: "".concat(root, "/deviceAlarmRepairRecord/delete"),
  2317. batchDelete: "".concat(root, "/deviceAlarmRepairRecord/batchDelete") },
  2318. operatorLog: {
  2319. list: "".concat(root, "/operatorLog/list"),
  2320. add: "".concat(root, "/operatorLog/add"),
  2321. update: "".concat(root, "/operatorLog/update"),
  2322. detail: "".concat(root, "/operatorLog/detail"),
  2323. delete: "".concat(root, "/operatorLog/delete"),
  2324. batchDelete: "".concat(root, "/operatorLog/batchDelete") },
  2325. auth: {
  2326. verifyCode: "".concat(root, "/auth/verifyCode"),
  2327. login: "".concat(root, "/auth/login"),
  2328. updateUserPassword: "".concat(root, "/auth/updateUserPassword"),
  2329. userInfo: "".concat(root, "/auth/userInfo"),
  2330. logout: "".concat(root, "/auth/logout") },
  2331. role: {
  2332. list: "".concat(root, "/role/list"),
  2333. add: "".concat(root, "/role/add"),
  2334. update: "".concat(root, "/role/update"),
  2335. detail: "".concat(root, "/role/detail"),
  2336. delete: "".concat(root, "/role/delete") },
  2337. power: {
  2338. list: "".concat(root, "/power/list"),
  2339. add: "".concat(root, "/power/add"),
  2340. update: "".concat(root, "/power/update"),
  2341. detail: "".concat(root, "/power/detail"),
  2342. delete: "".concat(root, "/power/delete") },
  2343. rolePower: {
  2344. list: "".concat(root, "/rolePower/list"),
  2345. add: "".concat(root, "/rolePower/add"),
  2346. update: "".concat(root, "/rolePower/update"),
  2347. detail: "".concat(root, "/rolePower/detail"),
  2348. delete: "".concat(root, "/rolePower/delete") },
  2349. menu: {} };var _default =
  2350. Object.assign({
  2351. $base: {
  2352. root: root } },
  2353. api);exports.default = _default;
  2354. /***/ }),
  2355. /***/ 181:
  2356. /*!************************************************************************************************************!*\
  2357. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/components/u-charts/u-charts.js ***!
  2358. \************************************************************************************************************/
  2359. /*! no static exports found */
  2360. /***/ (function(module, exports, __webpack_require__) {
  2361. "use strict";
  2362. /* WEBPACK VAR INJECTION */(function(uni) {/*
  2363. * uCharts v1.8.5.20190815
  2364. * uni-app平台高性能跨全端图表,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)
  2365. * Copyright (c) 2019 QIUN秋云 https://www.ucharts.cn All rights reserved.
  2366. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  2367. *
  2368. * uCharts官方网站
  2369. * https://www.uCharts.cn
  2370. *
  2371. * 开源地址:
  2372. * https://gitee.com/uCharts/uCharts
  2373. *
  2374. * uni-app插件市场地址:
  2375. * http://ext.dcloud.net.cn/plugin?id=271
  2376. *
  2377. */
  2378. var config = {
  2379. yAxisWidth: 15,
  2380. yAxisSplit: 5,
  2381. xAxisHeight: 15,
  2382. xAxisLineHeight: 15,
  2383. legendHeight: 15,
  2384. yAxisTitleWidth: 15,
  2385. padding: [10, 10, 10, 10],
  2386. pixelRatio: 1,
  2387. rotate: false,
  2388. columePadding: 3,
  2389. fontSize: 13,
  2390. //dataPointShape: ['diamond', 'circle', 'triangle', 'rect'],
  2391. dataPointShape: ['circle', 'circle', 'circle', 'circle'],
  2392. colors: ['#1890ff', '#2fc25b', '#facc14', '#f04864', '#8543e0', '#90ed7d'],
  2393. pieChartLinePadding: 15,
  2394. pieChartTextPadding: 5,
  2395. xAxisTextPadding: 3,
  2396. titleColor: '#333333',
  2397. titleFontSize: 20,
  2398. subtitleColor: '#999999',
  2399. subtitleFontSize: 15,
  2400. toolTipPadding: 3,
  2401. toolTipBackground: '#000000',
  2402. toolTipOpacity: 0.7,
  2403. toolTipLineHeight: 20,
  2404. radarGridCount: 3,
  2405. radarLabelTextMargin: 15,
  2406. gaugeLabelTextMargin: 15 };
  2407. var assign;
  2408. if (Object.assign) {
  2409. assign = Object.assign;
  2410. } else {
  2411. // 使用polyfill
  2412. assign = function assign(target, varArgs) {
  2413. if (target == null) {
  2414. throw new TypeError('Cannot convert undefined or null to object');
  2415. }
  2416. var to = Object(target);
  2417. for (var index = 1; index < arguments.length; index++) {
  2418. var nextSource = arguments[index];
  2419. if (nextSource != null) {
  2420. for (var nextKey in nextSource) {
  2421. if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
  2422. to[nextKey] = nextSource[nextKey];
  2423. }
  2424. }
  2425. }
  2426. }
  2427. return to;
  2428. };
  2429. }
  2430. var util = {
  2431. toFixed: function toFixed(num, limit) {
  2432. limit = limit || 2;
  2433. if (this.isFloat(num)) {
  2434. num = num.toFixed(limit);
  2435. }
  2436. return num;
  2437. },
  2438. isFloat: function isFloat(num) {
  2439. return num % 1 !== 0;
  2440. },
  2441. approximatelyEqual: function approximatelyEqual(num1, num2) {
  2442. return Math.abs(num1 - num2) < 1e-10;
  2443. },
  2444. isSameSign: function isSameSign(num1, num2) {
  2445. return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
  2446. },
  2447. isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
  2448. return this.isSameSign(p1.x, p2.x);
  2449. },
  2450. isCollision: function isCollision(obj1, obj2) {
  2451. obj1.end = {};
  2452. obj1.end.x = obj1.start.x + obj1.width;
  2453. obj1.end.y = obj1.start.y - obj1.height;
  2454. obj2.end = {};
  2455. obj2.end.x = obj2.start.x + obj2.width;
  2456. obj2.end.y = obj2.start.y - obj2.height;
  2457. 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;
  2458. return !flag;
  2459. } };
  2460. //兼容H5点击事件
  2461. function getH5Offset(e) {
  2462. e.mp = {
  2463. changedTouches: [] };
  2464. e.mp.changedTouches.push({
  2465. x: e.offsetX,
  2466. y: e.offsetY });
  2467. return e;
  2468. }
  2469. // hex 转 rgba
  2470. function hexToRgb(hexValue, opc) {
  2471. var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  2472. var hex = hexValue.replace(rgx, function (m, r, g, b) {
  2473. return r + r + g + g + b + b;
  2474. });
  2475. var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  2476. var r = parseInt(rgb[1], 16);
  2477. var g = parseInt(rgb[2], 16);
  2478. var b = parseInt(rgb[3], 16);
  2479. return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')';
  2480. }
  2481. function findRange(num, type, limit) {
  2482. if (isNaN(num)) {
  2483. throw new Error('[uCharts] unvalid series data!');
  2484. }
  2485. limit = limit || 10;
  2486. type = type ? type : 'upper';
  2487. var multiple = 1;
  2488. while (limit < 1) {
  2489. limit *= 10;
  2490. multiple *= 10;
  2491. }
  2492. if (type === 'upper') {
  2493. num = Math.ceil(num * multiple);
  2494. } else {
  2495. num = Math.floor(num * multiple);
  2496. }
  2497. while (num % limit !== 0) {
  2498. if (type === 'upper') {
  2499. num++;
  2500. } else {
  2501. num--;
  2502. }
  2503. }
  2504. return num / multiple;
  2505. }
  2506. function calCandleMA(dayArr, nameArr, colorArr, kdata) {
  2507. var seriesTemp = [];
  2508. for (var k = 0; k < dayArr.length; k++) {
  2509. var seriesItem = {
  2510. data: [],
  2511. name: nameArr[k],
  2512. color: colorArr[k] };
  2513. for (var i = 0, len = kdata.length; i < len; i++) {
  2514. if (i < dayArr[k]) {
  2515. seriesItem.data.push(null);
  2516. continue;
  2517. }
  2518. var sum = 0;
  2519. for (var j = 0; j < dayArr[k]; j++) {
  2520. sum += kdata[i - j][1];
  2521. }
  2522. seriesItem.data.push(+(sum / dayArr[k]).toFixed(3));
  2523. }
  2524. seriesTemp.push(seriesItem);
  2525. }
  2526. return seriesTemp;
  2527. }
  2528. function calValidDistance(distance, chartData, config, opts) {
  2529. var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
  2530. var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length - 1);
  2531. var validDistance = distance;
  2532. if (distance >= 0) {
  2533. validDistance = 0;
  2534. } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) {
  2535. validDistance = dataChartAreaWidth - dataChartWidth;
  2536. }
  2537. return validDistance;
  2538. }
  2539. function isInAngleRange(angle, startAngle, endAngle) {
  2540. function adjust(angle) {
  2541. while (angle < 0) {
  2542. angle += 2 * Math.PI;
  2543. }
  2544. while (angle > 2 * Math.PI) {
  2545. angle -= 2 * Math.PI;
  2546. }
  2547. return angle;
  2548. }
  2549. angle = adjust(angle);
  2550. startAngle = adjust(startAngle);
  2551. endAngle = adjust(endAngle);
  2552. if (startAngle > endAngle) {
  2553. endAngle += 2 * Math.PI;
  2554. if (angle < startAngle) {
  2555. angle += 2 * Math.PI;
  2556. }
  2557. }
  2558. return angle >= startAngle && angle <= endAngle;
  2559. }
  2560. function calRotateTranslate(x, y, h) {
  2561. var xv = x;
  2562. var yv = h - y;
  2563. var transX = xv + (h - yv - xv) / Math.sqrt(2);
  2564. transX *= -1;
  2565. var transY = (h - yv) * (Math.sqrt(2) - 1) - (h - yv - xv) / Math.sqrt(2);
  2566. return {
  2567. transX: transX,
  2568. transY: transY };
  2569. }
  2570. function createCurveControlPoints(points, i) {
  2571. function isNotMiddlePoint(points, i) {
  2572. if (points[i - 1] && points[i + 1]) {
  2573. return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y,
  2574. points[
  2575. i + 1].y);
  2576. } else {
  2577. return false;
  2578. }
  2579. }
  2580. var a = 0.2;
  2581. var b = 0.2;
  2582. var pAx = null;
  2583. var pAy = null;
  2584. var pBx = null;
  2585. var pBy = null;
  2586. if (i < 1) {
  2587. pAx = points[0].x + (points[1].x - points[0].x) * a;
  2588. pAy = points[0].y + (points[1].y - points[0].y) * a;
  2589. } else {
  2590. pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
  2591. pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
  2592. }
  2593. if (i > points.length - 3) {
  2594. var last = points.length - 1;
  2595. pBx = points[last].x - (points[last].x - points[last - 1].x) * b;
  2596. pBy = points[last].y - (points[last].y - points[last - 1].y) * b;
  2597. } else {
  2598. pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
  2599. pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
  2600. }
  2601. if (isNotMiddlePoint(points, i + 1)) {
  2602. pBy = points[i + 1].y;
  2603. }
  2604. if (isNotMiddlePoint(points, i)) {
  2605. pAy = points[i].y;
  2606. }
  2607. return {
  2608. ctrA: {
  2609. x: pAx,
  2610. y: pAy },
  2611. ctrB: {
  2612. x: pBx,
  2613. y: pBy } };
  2614. }
  2615. function convertCoordinateOrigin(x, y, center) {
  2616. return {
  2617. x: center.x + x,
  2618. y: center.y - y };
  2619. }
  2620. function avoidCollision(obj, target) {
  2621. if (target) {
  2622. // is collision test
  2623. while (util.isCollision(obj, target)) {
  2624. if (obj.start.x > 0) {
  2625. obj.start.y--;
  2626. } else if (obj.start.x < 0) {
  2627. obj.start.y++;
  2628. } else {
  2629. if (obj.start.y > 0) {
  2630. obj.start.y++;
  2631. } else {
  2632. obj.start.y--;
  2633. }
  2634. }
  2635. }
  2636. }
  2637. return obj;
  2638. }
  2639. function fillSeries(series, opts, config) {
  2640. var index = 0;
  2641. return series.map(function (item) {
  2642. if (!item.color) {
  2643. item.color = config.colors[index];
  2644. index = (index + 1) % config.colors.length;
  2645. }
  2646. if (!item.type) {
  2647. item.type = opts.type;
  2648. }
  2649. if (typeof item.show == "undefined") {
  2650. item.show = true;
  2651. }
  2652. if (!item.type) {
  2653. item.type = opts.type;
  2654. }
  2655. if (!item.pointShape) {
  2656. item.pointShape = "circle";
  2657. }
  2658. if (!item.legendShape) {
  2659. switch (item.type) {
  2660. case 'line':
  2661. item.legendShape = "line";
  2662. break;
  2663. case 'column':
  2664. item.legendShape = "rect";
  2665. break;
  2666. case 'area':
  2667. item.legendShape = "triangle";
  2668. break;
  2669. default:
  2670. item.legendShape = "circle";}
  2671. }
  2672. return item;
  2673. });
  2674. }
  2675. function getDataRange(minData, maxData) {
  2676. var limit = 0;
  2677. var range = maxData - minData;
  2678. if (range >= 10000) {
  2679. limit = 1000;
  2680. } else if (range >= 1000) {
  2681. limit = 100;
  2682. } else if (range >= 100) {
  2683. limit = 10;
  2684. } else if (range >= 10) {
  2685. limit = 5;
  2686. } else if (range >= 1) {
  2687. limit = 1;
  2688. } else if (range >= 0.1) {
  2689. limit = 0.1;
  2690. } else if (range >= 0.01) {
  2691. limit = 0.01;
  2692. } else if (range >= 0.001) {
  2693. limit = 0.001;
  2694. } else if (range >= 0.0001) {
  2695. limit = 0.0001;
  2696. } else if (range >= 0.00001) {
  2697. limit = 0.00001;
  2698. } else {
  2699. limit = 0.000001;
  2700. }
  2701. return {
  2702. minRange: findRange(minData, 'lower', limit),
  2703. maxRange: findRange(maxData, 'upper', limit) };
  2704. }
  2705. function measureText(text) {
  2706. var fontSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : config.fontSize;
  2707. text = String(text);
  2708. var text = text.split('');
  2709. var width = 0;
  2710. for (var i = 0; i < text.length; i++) {
  2711. var item = text[i];
  2712. if (/[a-zA-Z]/.test(item)) {
  2713. width += 7;
  2714. } else if (/[0-9]/.test(item)) {
  2715. width += 5.5;
  2716. } else if (/\./.test(item)) {
  2717. width += 2.7;
  2718. } else if (/-/.test(item)) {
  2719. width += 3.25;
  2720. } else if (/[\u4e00-\u9fa5]/.test(item)) {
  2721. width += 10;
  2722. } else if (/\(|\)/.test(item)) {
  2723. width += 3.73;
  2724. } else if (/\s/.test(item)) {
  2725. width += 2.5;
  2726. } else if (/%/.test(item)) {
  2727. width += 8;
  2728. } else {
  2729. width += 10;
  2730. }
  2731. }
  2732. return width * fontSize / 10;
  2733. }
  2734. function dataCombine(series) {
  2735. return series.reduce(function (a, b) {
  2736. return (a.data ? a.data : a).concat(b.data);
  2737. }, []);
  2738. }
  2739. function dataCombineStack(series, len) {
  2740. var sum = new Array(len);
  2741. for (var j = 0; j < sum.length; j++) {
  2742. sum[j] = 0;
  2743. }
  2744. for (var i = 0; i < series.length; i++) {
  2745. for (var j = 0; j < sum.length; j++) {
  2746. sum[j] += series[i].data[j];
  2747. }
  2748. }
  2749. return series.reduce(function (a, b) {
  2750. return (a.data ? a.data : a).concat(b.data).concat(sum);
  2751. }, []);
  2752. }
  2753. function getTouches(touches, opts, e) {
  2754. var x, y;
  2755. if (touches.clientX) {
  2756. if (opts.rotate) {
  2757. y = opts.height - touches.clientX * opts.pixelRatio;
  2758. x = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pixelRatio / 2 * (opts.pixelRatio - 1)) *
  2759. opts.pixelRatio;
  2760. } else {
  2761. x = touches.clientX * opts.pixelRatio;
  2762. y = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pixelRatio / 2 * (opts.pixelRatio - 1)) *
  2763. opts.pixelRatio;
  2764. }
  2765. } else {
  2766. if (opts.rotate) {
  2767. y = opts.height - touches.x * opts.pixelRatio;
  2768. x = touches.y * opts.pixelRatio;
  2769. } else {
  2770. x = touches.x * opts.pixelRatio;
  2771. y = touches.y * opts.pixelRatio;
  2772. }
  2773. }
  2774. return {
  2775. x: x,
  2776. y: y };
  2777. }
  2778. function getSeriesDataItem(series, index) {
  2779. var data = [];
  2780. for (var i = 0; i < series.length; i++) {
  2781. var item = series[i];
  2782. if (item.data[index] !== null && typeof item.data[index] !== 'undefined' && item.show) {
  2783. var seriesItem = {};
  2784. seriesItem.color = item.color;
  2785. seriesItem.type = item.type;
  2786. seriesItem.style = item.style;
  2787. seriesItem.pointShape = item.pointShape;
  2788. seriesItem.disableLegend = item.disableLegend;
  2789. seriesItem.name = item.name;
  2790. seriesItem.show = item.show;
  2791. seriesItem.data = item.format ? item.format(item.data[index]) : item.data[index];
  2792. data.push(seriesItem);
  2793. }
  2794. }
  2795. return data;
  2796. }
  2797. function getMaxTextListLength(list) {
  2798. var lengthList = list.map(function (item) {
  2799. return measureText(item);
  2800. });
  2801. return Math.max.apply(null, lengthList);
  2802. }
  2803. function getRadarCoordinateSeries(length) {
  2804. var eachAngle = 2 * Math.PI / length;
  2805. var CoordinateSeries = [];
  2806. for (var i = 0; i < length; i++) {
  2807. CoordinateSeries.push(eachAngle * i);
  2808. }
  2809. return CoordinateSeries.map(function (item) {
  2810. return -1 * item + Math.PI / 2;
  2811. });
  2812. }
  2813. function getToolTipData(seriesData, calPoints, index, categories) {
  2814. var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  2815. var textList = seriesData.map(function (item) {
  2816. return {
  2817. text: option.format ? option.format(item, categories[index]) : item.name + ': ' + item.data,
  2818. color: item.color };
  2819. });
  2820. var validCalPoints = [];
  2821. var offset = {
  2822. x: 0,
  2823. y: 0 };
  2824. for (var i = 0; i < calPoints.length; i++) {
  2825. var points = calPoints[i];
  2826. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  2827. validCalPoints.push(points[index]);
  2828. }
  2829. }
  2830. for (var _i = 0; _i < validCalPoints.length; _i++) {
  2831. var item = validCalPoints[_i];
  2832. offset.x = Math.round(item.x);
  2833. offset.y += item.y;
  2834. }
  2835. offset.y /= validCalPoints.length;
  2836. return {
  2837. textList: textList,
  2838. offset: offset };
  2839. }
  2840. function getMixToolTipData(seriesData, calPoints, index, categories) {
  2841. var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  2842. var textList = seriesData.map(function (item) {
  2843. return {
  2844. text: option.format ? option.format(item, categories[index]) : item.name + ': ' + item.data,
  2845. color: item.color,
  2846. disableLegend: item.disableLegend ? true : false };
  2847. });
  2848. textList = textList.filter(function (item) {
  2849. if (item.disableLegend !== true) {
  2850. return item;
  2851. }
  2852. });
  2853. var validCalPoints = [];
  2854. var offset = {
  2855. x: 0,
  2856. y: 0 };
  2857. for (var i = 0; i < calPoints.length; i++) {
  2858. var points = calPoints[i];
  2859. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  2860. validCalPoints.push(points[index]);
  2861. }
  2862. }
  2863. for (var _i2 = 0; _i2 < validCalPoints.length; _i2++) {
  2864. var item = validCalPoints[_i2];
  2865. offset.x = Math.round(item.x);
  2866. offset.y += item.y;
  2867. }
  2868. offset.y /= validCalPoints.length;
  2869. return {
  2870. textList: textList,
  2871. offset: offset };
  2872. }
  2873. function getCandleToolTipData(series, seriesData, calPoints, index, categories, extra) {
  2874. var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
  2875. var upColor = extra.color.upFill;
  2876. var downColor = extra.color.downFill;
  2877. //颜色顺序为开盘,收盘,最低,最高
  2878. var color = [upColor, upColor, downColor, upColor];
  2879. var textList = [];
  2880. var text0 = {
  2881. text: categories[index],
  2882. color: null };
  2883. textList.push(text0);
  2884. seriesData.map(function (item) {
  2885. if (index == 0 && item.data[1] - item.data[0] < 0) {
  2886. color[1] = downColor;
  2887. } else {
  2888. if (item.data[0] < series[index - 1][1]) {
  2889. color[0] = downColor;
  2890. }
  2891. if (item.data[1] < item.data[0]) {
  2892. color[1] = downColor;
  2893. }
  2894. if (item.data[2] > series[index - 1][1]) {
  2895. color[2] = upColor;
  2896. }
  2897. if (item.data[3] < series[index - 1][1]) {
  2898. color[3] = downColor;
  2899. }
  2900. }
  2901. var text1 = {
  2902. text: '开盘:' + item.data[0],
  2903. color: color[0] };
  2904. var text2 = {
  2905. text: '收盘:' + item.data[1],
  2906. color: color[1] };
  2907. var text3 = {
  2908. text: '最低:' + item.data[2],
  2909. color: color[2] };
  2910. var text4 = {
  2911. text: '最高:' + item.data[3],
  2912. color: color[3] };
  2913. textList.push(text1, text2, text3, text4);
  2914. });
  2915. var validCalPoints = [];
  2916. var offset = {
  2917. x: 0,
  2918. y: 0 };
  2919. for (var i = 0; i < calPoints.length; i++) {
  2920. var points = calPoints[i];
  2921. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  2922. validCalPoints.push(points[index]);
  2923. }
  2924. }
  2925. offset.x = Math.round(validCalPoints[0][0].x);
  2926. return {
  2927. textList: textList,
  2928. offset: offset };
  2929. }
  2930. function filterSeries(series) {
  2931. var tempSeries = [];
  2932. for (var i = 0; i < series.length; i++) {
  2933. if (series[i].show == true) {
  2934. tempSeries.push(series[i]);
  2935. }
  2936. }
  2937. return tempSeries;
  2938. }
  2939. function findCurrentIndex(currentPoints, xAxisPoints, opts, config) {
  2940. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  2941. var currentIndex = -1;
  2942. var spacing = 0;
  2943. if ((opts.type == 'line' || opts.type == 'area') && opts.xAxis.boundaryGap == 'justify') {
  2944. spacing = opts.chartData.eachSpacing / 2;
  2945. }
  2946. if (isInExactChartArea(currentPoints, opts, config)) {
  2947. xAxisPoints.forEach(function (item, index) {
  2948. if (currentPoints.x + offset + spacing > item) {
  2949. currentIndex = index;
  2950. }
  2951. });
  2952. }
  2953. return currentIndex;
  2954. }
  2955. function findLegendIndex(currentPoints, legendData, opts) {
  2956. var currentIndex = -1;
  2957. if (isInExactLegendArea(currentPoints, legendData.area)) {
  2958. var points = legendData.points;
  2959. var index = -1;
  2960. for (var i = 0, len = points.length; i < len; i++) {
  2961. var item = points[i];
  2962. for (var j = 0; j < item.length; j++) {
  2963. index += 1;
  2964. var area = item[j]['area'];
  2965. if (currentPoints.x > area[0] && currentPoints.x < area[2] && currentPoints.y > area[1] && currentPoints.y < area[3]) {
  2966. currentIndex = index;
  2967. break;
  2968. }
  2969. }
  2970. }
  2971. return currentIndex;
  2972. }
  2973. return currentIndex;
  2974. }
  2975. function isInExactLegendArea(currentPoints, area) {
  2976. return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y &&
  2977. currentPoints.y < area.end.y;
  2978. }
  2979. function isInExactChartArea(currentPoints, opts, config) {
  2980. 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];
  2981. }
  2982. function findRadarChartCurrentIndex(currentPoints, radarData, count) {
  2983. var eachAngleArea = 2 * Math.PI / count;
  2984. var currentIndex = -1;
  2985. if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
  2986. var fixAngle = function fixAngle(angle) {
  2987. if (angle < 0) {
  2988. angle += 2 * Math.PI;
  2989. }
  2990. if (angle > 2 * Math.PI) {
  2991. angle -= 2 * Math.PI;
  2992. }
  2993. return angle;
  2994. };
  2995. var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x);
  2996. angle = -1 * angle;
  2997. if (angle < 0) {
  2998. angle += 2 * Math.PI;
  2999. }
  3000. var angleList = radarData.angleList.map(function (item) {
  3001. item = fixAngle(-1 * item);
  3002. return item;
  3003. });
  3004. angleList.forEach(function (item, index) {
  3005. var rangeStart = fixAngle(item - eachAngleArea / 2);
  3006. var rangeEnd = fixAngle(item + eachAngleArea / 2);
  3007. if (rangeEnd < rangeStart) {
  3008. rangeEnd += 2 * Math.PI;
  3009. }
  3010. if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <=
  3011. rangeEnd) {
  3012. currentIndex = index;
  3013. }
  3014. });
  3015. }
  3016. return currentIndex;
  3017. }
  3018. function findFunnelChartCurrentIndex(currentPoints, funnelData) {
  3019. var currentIndex = -1;
  3020. for (var i = 0, len = funnelData.series.length; i < len; i++) {
  3021. var item = funnelData.series[i];
  3022. if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
  3023. currentIndex = i;
  3024. break;
  3025. }
  3026. }
  3027. return currentIndex;
  3028. }
  3029. function findWordChartCurrentIndex(currentPoints, wordData) {
  3030. var currentIndex = -1;
  3031. for (var i = 0, len = wordData.length; i < len; i++) {
  3032. var item = wordData[i];
  3033. if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
  3034. currentIndex = i;
  3035. break;
  3036. }
  3037. }
  3038. return currentIndex;
  3039. }
  3040. function findMapChartCurrentIndex(currentPoints, opts) {
  3041. var currentIndex = -1;
  3042. var cData = opts.chartData.mapData;
  3043. var data = opts.series;
  3044. var tmp = pointToCoordinate(currentPoints.y, currentPoints.x, cData.bounds, cData.scale, cData.xoffset, cData.yoffset);
  3045. var poi = [tmp.x, tmp.y];
  3046. for (var i = 0, len = data.length; i < len; i++) {
  3047. var item = data[i].geometry.coordinates;
  3048. if (isPoiWithinPoly(poi, item)) {
  3049. currentIndex = i;
  3050. break;
  3051. }
  3052. }
  3053. return currentIndex;
  3054. }
  3055. function findPieChartCurrentIndex(currentPoints, pieData) {
  3056. var currentIndex = -1;
  3057. if (isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  3058. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  3059. angle = -angle;
  3060. for (var i = 0, len = pieData.series.length; i < len; i++) {
  3061. var item = pieData.series[i];
  3062. if (isInAngleRange(angle, item._start_, item._start_ + item._proportion_ * 2 * Math.PI)) {
  3063. currentIndex = i;
  3064. break;
  3065. }
  3066. }
  3067. }
  3068. return currentIndex;
  3069. }
  3070. function isInExactPieChartArea(currentPoints, center, radius) {
  3071. return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2);
  3072. }
  3073. function splitPoints(points) {
  3074. var newPoints = [];
  3075. var items = [];
  3076. points.forEach(function (item, index) {
  3077. if (item !== null) {
  3078. items.push(item);
  3079. } else {
  3080. if (items.length) {
  3081. newPoints.push(items);
  3082. }
  3083. items = [];
  3084. }
  3085. });
  3086. if (items.length) {
  3087. newPoints.push(items);
  3088. }
  3089. return newPoints;
  3090. }
  3091. function calLegendData(series, opts, config, chartData) {
  3092. var legendData = {
  3093. area: {
  3094. start: {
  3095. x: 0,
  3096. y: 0 },
  3097. end: {
  3098. x: 0,
  3099. y: 0 },
  3100. width: 0,
  3101. height: 0,
  3102. wholeWidth: 0,
  3103. wholeHeight: 0 },
  3104. points: [],
  3105. widthArr: [],
  3106. heightArr: [] };
  3107. if (opts.legend.show === false) {
  3108. chartData.legendData = legendData;
  3109. return legendData;
  3110. }
  3111. var padding = opts.legend.padding;
  3112. var margin = opts.legend.margin;
  3113. var fontSize = opts.legend.fontSize;
  3114. var shapeWidth = 15 * opts.pixelRatio;
  3115. var shapeRight = 5 * opts.pixelRatio;
  3116. var lineHeight = Math.max(opts.legend.lineHeight * opts.pixelRatio, fontSize);
  3117. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  3118. var legendList = [];
  3119. var widthCount = 0;
  3120. var widthCountArr = [];
  3121. var currentRow = [];
  3122. for (var i = 0; i < series.length; i++) {
  3123. var item = series[i];
  3124. var itemWidth = shapeWidth + shapeRight + measureText(item.name || 'undefined', fontSize) + opts.legend.itemGap;
  3125. if (widthCount + itemWidth > opts.width - opts.padding[1] - opts.padding[3]) {
  3126. legendList.push(currentRow);
  3127. widthCountArr.push(widthCount - opts.legend.itemGap);
  3128. widthCount = itemWidth;
  3129. currentRow = [item];
  3130. } else {
  3131. widthCount += itemWidth;
  3132. currentRow.push(item);
  3133. }
  3134. }
  3135. if (currentRow.length) {
  3136. legendList.push(currentRow);
  3137. widthCountArr.push(widthCount - opts.legend.itemGap);
  3138. legendData.widthArr = widthCountArr;
  3139. var legendWidth = Math.max.apply(null, widthCountArr);
  3140. switch (opts.legend.float) {
  3141. case 'left':
  3142. legendData.area.start.x = opts.padding[3];
  3143. legendData.area.end.x = opts.padding[3] + 2 * padding;
  3144. break;
  3145. case 'right':
  3146. legendData.area.start.x = opts.width - opts.padding[1] - legendWidth - 2 * padding;
  3147. legendData.area.end.x = opts.width - opts.padding[1];
  3148. break;
  3149. default:
  3150. legendData.area.start.x = (opts.width - legendWidth) / 2 - padding;
  3151. legendData.area.end.x = (opts.width + legendWidth) / 2 + padding;}
  3152. legendData.area.width = legendWidth + 2 * padding;
  3153. legendData.area.wholeWidth = legendWidth + 2 * padding;
  3154. legendData.area.height = legendList.length * lineHeight + 2 * padding;
  3155. legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin;
  3156. legendData.points = legendList;
  3157. }
  3158. } else {
  3159. var len = series.length;
  3160. var maxHeight = opts.height - opts.padding[0] - opts.padding[2] - 2 * margin - 2 * padding;
  3161. var maxLength = Math.min(Math.floor(maxHeight / lineHeight), len);
  3162. legendData.area.height = maxLength * lineHeight + padding * 2;
  3163. legendData.area.wholeHeight = maxLength * lineHeight + padding * 2;
  3164. switch (opts.legend.float) {
  3165. case 'top':
  3166. legendData.area.start.y = opts.padding[0] + margin;
  3167. legendData.area.end.y = opts.padding[0] + margin + legendData.area.height;
  3168. break;
  3169. case 'bottom':
  3170. legendData.area.start.y = opts.height - opts.padding[2] - margin - legendData.area.height;
  3171. legendData.area.end.y = opts.height - opts.padding[2] - margin;
  3172. break;
  3173. default:
  3174. legendData.area.start.y = (opts.height - legendData.area.height) / 2;
  3175. legendData.area.end.y = (opts.height + legendData.area.height) / 2;}
  3176. var lineNum = len % maxLength === 0 ? len / maxLength : Math.floor(len / maxLength + 1);
  3177. var _currentRow = [];
  3178. for (var _i3 = 0; _i3 < lineNum; _i3++) {
  3179. var temp = series.slice(_i3 * maxLength, _i3 * maxLength + maxLength);
  3180. _currentRow.push(temp);
  3181. }
  3182. legendData.points = _currentRow;
  3183. if (_currentRow.length) {
  3184. for (var _i4 = 0; _i4 < _currentRow.length; _i4++) {
  3185. var _item = _currentRow[_i4];
  3186. var maxWidth = 0;
  3187. for (var j = 0; j < _item.length; j++) {
  3188. var _itemWidth = shapeWidth + shapeRight + measureText(_item[j].name || 'undefined', fontSize) + opts.legend.itemGap;
  3189. if (_itemWidth > maxWidth) {
  3190. maxWidth = _itemWidth;
  3191. }
  3192. }
  3193. legendData.widthArr.push(maxWidth);
  3194. legendData.heightArr.push(_item.length * lineHeight + padding * 2);
  3195. }
  3196. var _legendWidth = 0;
  3197. for (var _i5 = 0; _i5 < legendData.widthArr.length; _i5++) {
  3198. _legendWidth += legendData.widthArr[_i5];
  3199. }
  3200. legendData.area.width = _legendWidth - opts.legend.itemGap + 2 * padding;
  3201. legendData.area.wholeWidth = legendData.area.width + padding;
  3202. }
  3203. }
  3204. switch (opts.legend.position) {
  3205. case 'top':
  3206. legendData.area.start.y = opts.padding[0] + margin;
  3207. legendData.area.end.y = opts.padding[0] + margin + legendData.area.height;
  3208. break;
  3209. case 'bottom':
  3210. legendData.area.start.y = opts.height - opts.padding[2] - legendData.area.height - margin;
  3211. legendData.area.end.y = opts.height - opts.padding[2] - margin;
  3212. break;
  3213. case 'left':
  3214. legendData.area.start.x = opts.padding[3];
  3215. legendData.area.end.x = opts.padding[3] + legendData.area.width;
  3216. break;
  3217. case 'right':
  3218. legendData.area.start.x = opts.width - opts.padding[1] - legendData.area.width;
  3219. legendData.area.end.x = opts.width - opts.padding[1];
  3220. break;}
  3221. chartData.legendData = legendData;
  3222. return legendData;
  3223. }
  3224. function calCategoriesData(categories, opts, config, eachSpacing) {
  3225. var result = {
  3226. angle: 0,
  3227. xAxisHeight: config.xAxisHeight };
  3228. var categoriesTextLenth = categories.map(function (item) {
  3229. return measureText(item);
  3230. });
  3231. var maxTextLength = Math.max.apply(this, categoriesTextLenth);
  3232. if (opts.xAxis.rotateLabel == true && maxTextLength + 2 * config.xAxisTextPadding > eachSpacing) {
  3233. result.angle = 45 * Math.PI / 180;
  3234. result.xAxisHeight = 2 * config.xAxisTextPadding + maxTextLength * Math.sin(result.angle);
  3235. }
  3236. return result;
  3237. }
  3238. function getRadarDataPoints(angleList, center, radius, series, opts) {
  3239. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  3240. var radarOption = opts.extra.radar || {};
  3241. radarOption.max = radarOption.max || 0;
  3242. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  3243. var data = [];var _loop2 = function _loop2(
  3244. i) {
  3245. var each = series[i];
  3246. var listItem = {};
  3247. listItem.color = each.color;
  3248. listItem.data = [];
  3249. each.data.forEach(function (item, index) {
  3250. var tmp = {};
  3251. tmp.angle = angleList[index];
  3252. tmp.proportion = item / maxData;
  3253. tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion *
  3254. process * Math.sin(tmp.angle), center);
  3255. listItem.data.push(tmp);
  3256. });
  3257. data.push(listItem);};for (var i = 0; i < series.length; i++) {_loop2(i);
  3258. }
  3259. return data;
  3260. }
  3261. function getPieDataPoints(series, radius) {
  3262. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  3263. var count = 0;
  3264. var _start_ = 0;
  3265. for (var i = 0; i < series.length; i++) {
  3266. var item = series[i];
  3267. item.data = item.data === null ? 0 : item.data;
  3268. count += item.data;
  3269. }
  3270. for (var _i6 = 0; _i6 < series.length; _i6++) {
  3271. var _item2 = series[_i6];
  3272. _item2.data = _item2.data === null ? 0 : _item2.data;
  3273. if (count === 0) {
  3274. _item2._proportion_ = 1 / series.length * process;
  3275. } else {
  3276. _item2._proportion_ = _item2.data / count * process;
  3277. }
  3278. _item2._radius_ = radius;
  3279. }
  3280. for (var _i7 = 0; _i7 < series.length; _i7++) {
  3281. var _item3 = series[_i7];
  3282. _item3._start_ = _start_;
  3283. _start_ += 2 * _item3._proportion_ * Math.PI;
  3284. }
  3285. return series;
  3286. }
  3287. function getFunnelDataPoints(series, radius) {
  3288. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  3289. series = series.sort(function (a, b) {return parseInt(b.data) - parseInt(a.data);});
  3290. for (var i = 0; i < series.length; i++) {
  3291. series[i].radius = series[i].data / series[0].data * radius * process;
  3292. series[i]._proportion_ = series[i].data / series[0].data;
  3293. }
  3294. return series.reverse();
  3295. }
  3296. function getRoseDataPoints(series, type, minRadius, radius) {
  3297. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  3298. var count = 0;
  3299. var _start_ = 0;
  3300. var dataArr = [];
  3301. for (var i = 0; i < series.length; i++) {
  3302. var item = series[i];
  3303. item.data = item.data === null ? 0 : item.data;
  3304. count += item.data;
  3305. dataArr.push(item.data);
  3306. }
  3307. var minData = Math.min.apply(null, dataArr);
  3308. var maxData = Math.max.apply(null, dataArr);
  3309. var radiusLength = radius - minRadius;
  3310. for (var _i8 = 0; _i8 < series.length; _i8++) {
  3311. var _item4 = series[_i8];
  3312. _item4.data = _item4.data === null ? 0 : _item4.data;
  3313. if (count === 0 || type == 'area') {
  3314. _item4._proportion_ = _item4.data / count * process;
  3315. _item4._rose_proportion_ = 1 / series.length * process;
  3316. } else {
  3317. _item4._proportion_ = _item4.data / count * process;
  3318. _item4._rose_proportion_ = _item4.data / count * process;
  3319. }
  3320. _item4._radius_ = minRadius + radiusLength * ((_item4.data - minData) / (maxData - minData));
  3321. }
  3322. for (var _i9 = 0; _i9 < series.length; _i9++) {
  3323. var _item5 = series[_i9];
  3324. _item5._start_ = _start_;
  3325. _start_ += 2 * _item5._rose_proportion_ * Math.PI;
  3326. }
  3327. return series;
  3328. }
  3329. function getArcbarDataPoints(series, arcbarOption) {
  3330. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  3331. if (process == 1) {
  3332. process = 0.999999;
  3333. }
  3334. for (var i = 0; i < series.length; i++) {
  3335. var item = series[i];
  3336. item.data = item.data === null ? 0 : item.data;
  3337. var totalAngle = void 0;
  3338. if (arcbarOption.type == 'default') {
  3339. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  3340. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  3341. } else {
  3342. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  3343. }
  3344. } else {
  3345. totalAngle = 2;
  3346. }
  3347. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  3348. if (item._proportion_ >= 2) {
  3349. item._proportion_ = item._proportion_ % 2;
  3350. }
  3351. }
  3352. return series;
  3353. }
  3354. function getGaugeAxisPoints(categories, startAngle, endAngle) {
  3355. var totalAngle = startAngle - endAngle + 1;
  3356. var tempStartAngle = startAngle;
  3357. for (var i = 0; i < categories.length; i++) {
  3358. categories[i].value = categories[i].value === null ? 0 : categories[i].value;
  3359. categories[i]._startAngle_ = tempStartAngle;
  3360. categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle;
  3361. if (categories[i]._endAngle_ >= 2) {
  3362. categories[i]._endAngle_ = categories[i]._endAngle_ % 2;
  3363. }
  3364. tempStartAngle = categories[i]._endAngle_;
  3365. }
  3366. return categories;
  3367. }
  3368. function getGaugeDataPoints(series, categories, gaugeOption) {
  3369. var process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
  3370. for (var i = 0; i < series.length; i++) {
  3371. var item = series[i];
  3372. item.data = item.data === null ? 0 : item.data;
  3373. if (gaugeOption.pointer.color == 'auto') {
  3374. for (var _i10 = 0; _i10 < categories.length; _i10++) {
  3375. if (item.data <= categories[_i10].value) {
  3376. item.color = categories[_i10].color;
  3377. break;
  3378. }
  3379. }
  3380. } else {
  3381. item.color = gaugeOption.pointer.color;
  3382. }
  3383. var totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  3384. item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle;
  3385. item._oldAngle_ = gaugeOption.oldAngle;
  3386. if (gaugeOption.oldAngle < gaugeOption.endAngle) {
  3387. item._oldAngle_ += 2;
  3388. }
  3389. if (item.data >= gaugeOption.oldData) {
  3390. item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle;
  3391. } else {
  3392. item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process;
  3393. }
  3394. if (item._proportion_ >= 2) {
  3395. item._proportion_ = item._proportion_ % 2;
  3396. }
  3397. }
  3398. return series;
  3399. }
  3400. function getPieTextMaxLength(series) {
  3401. series = getPieDataPoints(series);
  3402. var maxLength = 0;
  3403. for (var i = 0; i < series.length; i++) {
  3404. var item = series[i];
  3405. var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
  3406. maxLength = Math.max(maxLength, measureText(text));
  3407. }
  3408. return maxLength;
  3409. }
  3410. function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
  3411. return points.map(function (item) {
  3412. if (item === null) {
  3413. return null;
  3414. }
  3415. item.width = Math.ceil((eachSpacing - 2 * config.columePadding) / columnLen);
  3416. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  3417. item.width = Math.min(item.width, +opts.extra.column.width);
  3418. }
  3419. if (item.width <= 0) {
  3420. item.width = 1;
  3421. }
  3422. item.x += (index + 0.5 - columnLen / 2) * item.width;
  3423. return item;
  3424. });
  3425. }
  3426. function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
  3427. return points.map(function (item) {
  3428. if (item === null) {
  3429. return null;
  3430. }
  3431. item.width = Math.ceil((eachSpacing - 2 * config.columePadding) / 2);
  3432. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  3433. item.width = Math.min(item.width, +opts.extra.column.width);
  3434. }
  3435. if (index > 0) {
  3436. item.width -= 2 * border;
  3437. }
  3438. return item;
  3439. });
  3440. }
  3441. function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  3442. return points.map(function (item, indexn) {
  3443. if (item === null) {
  3444. return null;
  3445. }
  3446. item.width = Math.ceil((eachSpacing - 2 * config.columePadding) / 2);
  3447. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  3448. item.width = Math.min(item.width, +opts.extra.column.width);
  3449. }
  3450. return item;
  3451. });
  3452. }
  3453. function getXAxisPoints(categories, opts, config) {
  3454. var yAxisTotalWidth = config.yAxisWidth + config.yAxisTitleWidth;
  3455. var spacingValid = opts.width - opts.area[1] - opts.area[3];
  3456. var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
  3457. if ((opts.type == 'line' || opts.type == 'area') && dataCount > 1 && opts.xAxis.boundaryGap == 'justify') {
  3458. dataCount -= 1;
  3459. }
  3460. var eachSpacing = spacingValid / dataCount;
  3461. var xAxisPoints = [];
  3462. var startX = opts.area[3];
  3463. var endX = opts.width - opts.area[1];
  3464. categories.forEach(function (item, index) {
  3465. xAxisPoints.push(startX + index * eachSpacing);
  3466. });
  3467. if (opts.xAxis.boundaryGap !== 'justify') {
  3468. if (opts.enableScroll === true) {
  3469. xAxisPoints.push(startX + categories.length * eachSpacing);
  3470. } else {
  3471. xAxisPoints.push(endX);
  3472. }
  3473. }
  3474. return {
  3475. xAxisPoints: xAxisPoints,
  3476. startX: startX,
  3477. endX: endX,
  3478. eachSpacing: eachSpacing };
  3479. }
  3480. function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  3481. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  3482. var points = [];
  3483. var validHeight = opts.height - opts.area[0] - opts.area[2];
  3484. data.forEach(function (item, index) {
  3485. if (item === null) {
  3486. points.push(null);
  3487. } else {
  3488. var cPoints = [];
  3489. item.forEach(function (items, indexs) {
  3490. var point = {};
  3491. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  3492. var value = items.value || items;
  3493. var height = validHeight * (value - minRange) / (maxRange - minRange);
  3494. height *= process;
  3495. point.y = opts.height - Math.round(height) - opts.area[2];
  3496. cPoints.push(point);
  3497. });
  3498. points.push(cPoints);
  3499. }
  3500. });
  3501. return points;
  3502. }
  3503. function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  3504. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  3505. var boundaryGap = 'center';
  3506. if (opts.type == 'line' || opts.type == 'area') {
  3507. boundaryGap = opts.xAxis.boundaryGap;
  3508. }
  3509. var points = [];
  3510. var validHeight = opts.height - opts.area[0] - opts.area[2];
  3511. data.forEach(function (item, index) {
  3512. if (item === null) {
  3513. points.push(null);
  3514. } else {
  3515. var point = {};
  3516. point.color = item.color;
  3517. point.x = xAxisPoints[index];
  3518. if (boundaryGap == 'center') {
  3519. point.x += Math.round(eachSpacing / 2);
  3520. }
  3521. var value = item;
  3522. if (typeof item === 'object' && item !== null) {
  3523. value = item.value;
  3524. }
  3525. var height = validHeight * (value - minRange) / (maxRange - minRange);
  3526. height *= process;
  3527. point.y = opts.height - Math.round(height) - opts.area[2];
  3528. points.push(point);
  3529. }
  3530. });
  3531. return points;
  3532. }
  3533. function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  3534. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  3535. var points = [];
  3536. var validHeight = opts.height - opts.area[0] - opts.area[2];
  3537. data.forEach(function (item, index) {
  3538. if (item === null) {
  3539. points.push(null);
  3540. } else {
  3541. var point = {};
  3542. point.color = item.color;
  3543. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  3544. if (seriesIndex > 0) {
  3545. var value = 0;
  3546. for (var i = 0; i <= seriesIndex; i++) {
  3547. value += stackSeries[i].data[index];
  3548. }
  3549. var value0 = value - item;
  3550. var height = validHeight * (value - minRange) / (maxRange - minRange);
  3551. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  3552. } else {
  3553. var value = item;
  3554. var height = validHeight * (value - minRange) / (maxRange - minRange);
  3555. var height0 = 0;
  3556. }
  3557. var heightc = height0;
  3558. height *= process;
  3559. heightc *= process;
  3560. point.y = opts.height - Math.round(height) - opts.area[2];
  3561. point.y0 = opts.height - Math.round(heightc) - opts.area[2];
  3562. points.push(point);
  3563. }
  3564. });
  3565. return points;
  3566. }
  3567. function getYAxisTextList(series, opts, config, stack) {
  3568. var data;
  3569. if (stack == 'stack') {
  3570. data = dataCombineStack(series, opts.categories.length);
  3571. } else {
  3572. data = dataCombine(series);
  3573. }
  3574. var sorted = [];
  3575. // remove null from data
  3576. data = data.filter(function (item) {
  3577. //return item !== null;
  3578. if (typeof item === 'object' && item !== null) {
  3579. if (Array.isArray(item)) {
  3580. return item !== null;
  3581. } else {
  3582. return item.value !== null;
  3583. }
  3584. } else {
  3585. return item !== null;
  3586. }
  3587. });
  3588. data.map(function (item) {
  3589. if (typeof item === 'object') {
  3590. if (Array.isArray(item)) {
  3591. item.map(function (subitem) {
  3592. sorted.push(subitem);
  3593. });
  3594. } else {
  3595. sorted.push(item.value);
  3596. }
  3597. } else {
  3598. sorted.push(item);
  3599. }
  3600. });
  3601. var minData = 0;
  3602. var maxData = 0;
  3603. if (sorted.length > 0) {
  3604. minData = Math.min.apply(this, sorted);
  3605. maxData = Math.max.apply(this, sorted);
  3606. }
  3607. if (typeof opts.yAxis.min === 'number') {
  3608. minData = Math.min(opts.yAxis.min, minData);
  3609. }
  3610. if (typeof opts.yAxis.max === 'number') {
  3611. maxData = Math.max(opts.yAxis.max, maxData);
  3612. }
  3613. if (minData === maxData) {
  3614. var rangeSpan = maxData || 10;
  3615. maxData += rangeSpan;
  3616. }
  3617. var dataRange = getDataRange(minData, maxData);
  3618. var minRange = dataRange.minRange;
  3619. var maxRange = dataRange.maxRange;
  3620. var range = [];
  3621. var eachRange = (maxRange - minRange) / config.yAxisSplit;
  3622. for (var i = 0; i <= config.yAxisSplit; i++) {
  3623. range.push(minRange + eachRange * i);
  3624. }
  3625. return range.reverse();
  3626. }
  3627. function calYAxisData(series, opts, config) {
  3628. //堆叠图重算Y轴
  3629. var columnstyle = assign({}, {
  3630. type: "" },
  3631. opts.extra.column);
  3632. var ranges = getYAxisTextList(series, opts, config, columnstyle.type);
  3633. var yAxisWidth = config.yAxisWidth;
  3634. var yAxisFontSize = opts.yAxis.fontSize || config.fontSize;
  3635. var rangesFormat = ranges.map(function (item) {
  3636. item = util.toFixed(item, 6);
  3637. item = opts.yAxis.format ? opts.yAxis.format(Number(item)) : item;
  3638. yAxisWidth = Math.max(yAxisWidth, measureText(item, yAxisFontSize) + 5);
  3639. return item;
  3640. });
  3641. if (opts.yAxis.disabled === true) {
  3642. yAxisWidth = 0;
  3643. }
  3644. return {
  3645. rangesFormat: rangesFormat,
  3646. ranges: ranges,
  3647. yAxisWidth: yAxisWidth };
  3648. }
  3649. function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
  3650. var ranges = getYAxisTextList(series, opts, config);
  3651. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  3652. var maxVal = ranges[0];
  3653. var minVal = ranges[ranges.length - 1];
  3654. var minAxis = opts.padding[3];
  3655. var maxAxis = opts.padding[1] + spacingValid;
  3656. var item = maxVal - (maxVal - minVal) * (point - minAxis) / (maxAxis - minAxis);
  3657. item = opts.yAxis.format ? opts.yAxis.format(Number(item)) : item;
  3658. return item;
  3659. }
  3660. function calMarkLineData(minRange, maxRange, points, opts) {
  3661. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  3662. for (var i = 0; i < points.length; i++) {
  3663. var height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
  3664. points[i].y = opts.height - Math.round(height) - opts.area[2];
  3665. }
  3666. return points;
  3667. }
  3668. function contextRotate(context, opts) {
  3669. if (opts.rotateLock !== true) {
  3670. context.translate(opts.height, 0);
  3671. context.rotate(90 * Math.PI / 180);
  3672. } else if (opts._rotate_ !== true) {
  3673. context.translate(opts.height, 0);
  3674. context.rotate(90 * Math.PI / 180);
  3675. opts._rotate_ = true;
  3676. }
  3677. }
  3678. function drawPointShape(points, color, shape, context, opts) {
  3679. context.beginPath();
  3680. context.setStrokeStyle("#ffffff");
  3681. context.setLineWidth(1 * opts.pixelRatio);
  3682. context.setFillStyle(color);
  3683. if (shape === 'diamond') {
  3684. points.forEach(function (item, index) {
  3685. if (item !== null) {
  3686. context.moveTo(item.x, item.y - 4.5);
  3687. context.lineTo(item.x - 4.5, item.y);
  3688. context.lineTo(item.x, item.y + 4.5);
  3689. context.lineTo(item.x + 4.5, item.y);
  3690. context.lineTo(item.x, item.y - 4.5);
  3691. }
  3692. });
  3693. } else if (shape === 'circle') {
  3694. points.forEach(function (item, index) {
  3695. if (item !== null) {
  3696. context.moveTo(item.x + 3.5 * opts.pixelRatio, item.y);
  3697. context.arc(item.x, item.y, 4 * opts.pixelRatio, 0, 2 * Math.PI, false);
  3698. }
  3699. });
  3700. } else if (shape === 'rect') {
  3701. points.forEach(function (item, index) {
  3702. if (item !== null) {
  3703. context.moveTo(item.x - 3.5, item.y - 3.5);
  3704. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  3705. }
  3706. });
  3707. } else if (shape === 'triangle') {
  3708. points.forEach(function (item, index) {
  3709. if (item !== null) {
  3710. context.moveTo(item.x, item.y - 4.5);
  3711. context.lineTo(item.x - 4.5, item.y + 4.5);
  3712. context.lineTo(item.x + 4.5, item.y + 4.5);
  3713. context.lineTo(item.x, item.y - 4.5);
  3714. }
  3715. });
  3716. }
  3717. context.closePath();
  3718. context.fill();
  3719. context.stroke();
  3720. }
  3721. function drawRingTitle(opts, config, context, center) {
  3722. var titlefontSize = opts.title.fontSize || config.titleFontSize;
  3723. var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize;
  3724. var title = opts.title.name || '';
  3725. var subtitle = opts.subtitle.name || '';
  3726. var titleFontColor = opts.title.color || config.titleColor;
  3727. var subtitleFontColor = opts.subtitle.color || config.subtitleColor;
  3728. var titleHeight = title ? titlefontSize : 0;
  3729. var subtitleHeight = subtitle ? subtitlefontSize : 0;
  3730. var margin = 5;
  3731. if (subtitle) {
  3732. var textWidth = measureText(subtitle, subtitlefontSize);
  3733. var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0);
  3734. var startY = center.y + subtitlefontSize / 2 + (opts.subtitle.offsetY || 0);
  3735. if (title) {
  3736. startY += (titleHeight + margin) / 2;
  3737. }
  3738. context.beginPath();
  3739. context.setFontSize(subtitlefontSize);
  3740. context.setFillStyle(subtitleFontColor);
  3741. context.fillText(subtitle, startX, startY);
  3742. context.closePath();
  3743. context.stroke();
  3744. }
  3745. if (title) {
  3746. var _textWidth = measureText(title, titlefontSize);
  3747. var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0);
  3748. var _startY = center.y + titlefontSize / 2 + (opts.title.offsetY || 0);
  3749. if (subtitle) {
  3750. _startY -= (subtitleHeight + margin) / 2;
  3751. }
  3752. context.beginPath();
  3753. context.setFontSize(titlefontSize);
  3754. context.setFillStyle(titleFontColor);
  3755. context.fillText(title, _startX, _startY);
  3756. context.closePath();
  3757. context.stroke();
  3758. }
  3759. }
  3760. function drawPointText(points, series, config, context) {
  3761. // 绘制数据文案
  3762. var data = series.data;
  3763. points.forEach(function (item, index) {
  3764. if (item !== null) {
  3765. //var formatVal = series.format ? series.format(data[index]) : data[index];
  3766. context.beginPath();
  3767. context.setFontSize(series.textSize || config.fontSize);
  3768. context.setFillStyle(series.textColor || '#666666');
  3769. var value = data[index];
  3770. if (typeof data[index] === 'object' && data[index] !== null) {
  3771. value = data[index].value;
  3772. }
  3773. var formatVal = series.format ? series.format(value) : value;
  3774. context.fillText(String(formatVal), item.x - measureText(formatVal, series.textSize || config.fontSize) / 2, item.y -
  3775. 2);
  3776. context.closePath();
  3777. context.stroke();
  3778. }
  3779. });
  3780. }
  3781. function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
  3782. radius -= gaugeOption.width / 2 + config.gaugeLabelTextMargin;
  3783. var totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  3784. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  3785. var totalNumber = gaugeOption.endNumber - gaugeOption.startNumber;
  3786. var splitNumber = totalNumber / gaugeOption.splitLine.splitNumber;
  3787. var nowAngle = gaugeOption.startAngle;
  3788. var nowNumber = gaugeOption.startNumber;
  3789. for (var i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
  3790. var pos = {
  3791. x: radius * Math.cos(nowAngle * Math.PI),
  3792. y: radius * Math.sin(nowAngle * Math.PI) };
  3793. var labelText = gaugeOption.labelFormat ? gaugeOption.labelFormat(nowNumber) : nowNumber;
  3794. pos.x += centerPosition.x - measureText(labelText) / 2;
  3795. pos.y += centerPosition.y;
  3796. var startX = pos.x;
  3797. var startY = pos.y;
  3798. context.beginPath();
  3799. context.setFontSize(config.fontSize);
  3800. context.setFillStyle(gaugeOption.labelColor || '#666666');
  3801. context.fillText(labelText, startX, startY + config.fontSize / 2);
  3802. context.closePath();
  3803. context.stroke();
  3804. nowAngle += splitAngle;
  3805. if (nowAngle >= 2) {
  3806. nowAngle = nowAngle % 2;
  3807. }
  3808. nowNumber += splitNumber;
  3809. }
  3810. }
  3811. function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
  3812. var radarOption = opts.extra.radar || {};
  3813. radius += config.radarLabelTextMargin;
  3814. angleList.forEach(function (angle, index) {
  3815. var pos = {
  3816. x: radius * Math.cos(angle),
  3817. y: radius * Math.sin(angle) };
  3818. var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition);
  3819. var startX = posRelativeCanvas.x;
  3820. var startY = posRelativeCanvas.y;
  3821. if (util.approximatelyEqual(pos.x, 0)) {
  3822. startX -= measureText(opts.categories[index] || '') / 2;
  3823. } else if (pos.x < 0) {
  3824. startX -= measureText(opts.categories[index] || '');
  3825. }
  3826. context.beginPath();
  3827. context.setFontSize(config.fontSize);
  3828. context.setFillStyle(radarOption.labelColor || '#666666');
  3829. context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2);
  3830. context.closePath();
  3831. context.stroke();
  3832. });
  3833. }
  3834. function drawPieText(series, opts, config, context, radius, center) {
  3835. var lineRadius = config.pieChartLinePadding;
  3836. var textObjectCollection = [];
  3837. var lastTextObject = null;
  3838. var seriesConvert = series.map(function (item) {
  3839. var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_.toFixed(4) * 100) + '%';
  3840. if (item._rose_proportion_) item._proportion_ = item._rose_proportion_;
  3841. var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
  3842. var color = item.color;
  3843. var radius = item._radius_;
  3844. return {
  3845. arc: arc,
  3846. text: text,
  3847. color: color,
  3848. radius: radius,
  3849. textColor: item.textColor,
  3850. textSize: item.textSize };
  3851. });
  3852. for (var i = 0; i < seriesConvert.length; i++) {
  3853. var item = seriesConvert[i];
  3854. // line end
  3855. var orginX1 = Math.cos(item.arc) * (item.radius + lineRadius);
  3856. var orginY1 = Math.sin(item.arc) * (item.radius + lineRadius);
  3857. // line start
  3858. var orginX2 = Math.cos(item.arc) * item.radius;
  3859. var orginY2 = Math.sin(item.arc) * item.radius;
  3860. // text start
  3861. var orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding;
  3862. var orginY3 = orginY1;
  3863. var textWidth = measureText(item.text);
  3864. var startY = orginY3;
  3865. if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
  3866. x: orginX3 }))
  3867. {
  3868. if (orginX3 > 0) {
  3869. startY = Math.min(orginY3, lastTextObject.start.y);
  3870. } else if (orginX1 < 0) {
  3871. startY = Math.max(orginY3, lastTextObject.start.y);
  3872. } else {
  3873. if (orginY3 > 0) {
  3874. startY = Math.max(orginY3, lastTextObject.start.y);
  3875. } else {
  3876. startY = Math.min(orginY3, lastTextObject.start.y);
  3877. }
  3878. }
  3879. }
  3880. if (orginX3 < 0) {
  3881. orginX3 -= textWidth;
  3882. }
  3883. var textObject = {
  3884. lineStart: {
  3885. x: orginX2,
  3886. y: orginY2 },
  3887. lineEnd: {
  3888. x: orginX1,
  3889. y: orginY1 },
  3890. start: {
  3891. x: orginX3,
  3892. y: startY },
  3893. width: textWidth,
  3894. height: config.fontSize,
  3895. text: item.text,
  3896. color: item.color,
  3897. textColor: item.textColor,
  3898. textSize: item.textSize };
  3899. lastTextObject = avoidCollision(textObject, lastTextObject);
  3900. textObjectCollection.push(lastTextObject);
  3901. }
  3902. for (var _i11 = 0; _i11 < textObjectCollection.length; _i11++) {
  3903. var _item6 = textObjectCollection[_i11];
  3904. var lineStartPoistion = convertCoordinateOrigin(_item6.lineStart.x, _item6.lineStart.y, center);
  3905. var lineEndPoistion = convertCoordinateOrigin(_item6.lineEnd.x, _item6.lineEnd.y, center);
  3906. var textPosition = convertCoordinateOrigin(_item6.start.x, _item6.start.y, center);
  3907. context.setLineWidth(1 * opts.pixelRatio);
  3908. context.setFontSize(config.fontSize);
  3909. context.beginPath();
  3910. context.setStrokeStyle(_item6.color);
  3911. context.setFillStyle(_item6.color);
  3912. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  3913. var curveStartX = _item6.start.x < 0 ? textPosition.x + _item6.width : textPosition.x;
  3914. var textStartX = _item6.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5;
  3915. context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y);
  3916. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  3917. context.stroke();
  3918. context.closePath();
  3919. context.beginPath();
  3920. context.moveTo(textPosition.x + _item6.width, textPosition.y);
  3921. context.arc(curveStartX, textPosition.y, 2, 0, 2 * Math.PI);
  3922. context.closePath();
  3923. context.fill();
  3924. context.beginPath();
  3925. context.setFontSize(_item6.textSize || config.fontSize);
  3926. context.setFillStyle(_item6.textColor || '#666666');
  3927. context.fillText(_item6.text, textStartX, textPosition.y + 3);
  3928. context.closePath();
  3929. context.stroke();
  3930. context.closePath();
  3931. }
  3932. }
  3933. function drawToolTipSplitLine(offsetX, opts, config, context) {
  3934. var toolTipOption = opts.extra.tooltip || {};
  3935. toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType;
  3936. toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength;
  3937. var startY = opts.area[0];
  3938. var endY = opts.height - opts.area[2];
  3939. if (toolTipOption.gridType == 'dash') {
  3940. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  3941. }
  3942. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  3943. context.setLineWidth(1 * opts.pixelRatio);
  3944. context.beginPath();
  3945. context.moveTo(offsetX, startY);
  3946. context.lineTo(offsetX, endY);
  3947. context.stroke();
  3948. context.setLineDash([]);
  3949. if (toolTipOption.xAxisLabel) {
  3950. var labelText = opts.categories[opts.tooltip.index];
  3951. context.setFontSize(config.fontSize);
  3952. var textWidth = measureText(labelText, config.fontSize);
  3953. var textX = offsetX - 0.5 * textWidth;
  3954. var textY = endY;
  3955. context.beginPath();
  3956. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  3957. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  3958. context.setLineWidth(1 * opts.pixelRatio);
  3959. context.rect(textX - config.toolTipPadding, textY, textWidth + 2 * config.toolTipPadding, config.fontSize + 2 * config.toolTipPadding);
  3960. context.closePath();
  3961. context.stroke();
  3962. context.fill();
  3963. context.beginPath();
  3964. context.setFontSize(config.fontSize);
  3965. context.setFillStyle(toolTipOption.labelFontColor || config.fontColor);
  3966. context.fillText(String(labelText), textX, textY + config.toolTipPadding + config.fontSize);
  3967. context.closePath();
  3968. context.stroke();
  3969. }
  3970. }
  3971. function drawMarkLine(minRange, maxRange, opts, config, context) {
  3972. var markLineOption = assign({}, {
  3973. type: 'solid',
  3974. dashLength: 4,
  3975. data: [] },
  3976. opts.extra.markLine);
  3977. var startX = opts.area[3];
  3978. var endX = opts.width - opts.padding[1];
  3979. var points = calMarkLineData(minRange, maxRange, markLineOption.data, opts);
  3980. for (var i = 0; i < points.length; i++) {
  3981. var item = assign({}, {
  3982. lineColor: '#DE4A42',
  3983. showLabel: false,
  3984. labelFontColor: '#666666',
  3985. labelBgColor: '#DFE8FF',
  3986. labelBgOpacity: 0.8,
  3987. yAxisIndex: 0 },
  3988. points[i]);
  3989. if (markLineOption.type == 'dash') {
  3990. context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
  3991. }
  3992. context.setStrokeStyle(item.lineColor);
  3993. context.setLineWidth(1 * opts.pixelRatio);
  3994. context.beginPath();
  3995. context.moveTo(startX, item.y);
  3996. context.lineTo(endX, item.y);
  3997. context.stroke();
  3998. context.setLineDash([]);
  3999. if (item.showLabel) {
  4000. var labelText = opts.yAxis.format ? opts.yAxis.format(Number(item.value)) : item.value;
  4001. context.setFontSize(config.fontSize);
  4002. var textWidth = measureText(labelText, config.fontSize);
  4003. var bgStartX = opts.padding[3] + config.yAxisTitleWidth - config.toolTipPadding;
  4004. var bgEndX = Math.max(opts.area[3], textWidth + config.toolTipPadding * 2);
  4005. var bgWidth = bgEndX - bgStartX;
  4006. var textX = bgStartX + (bgWidth - textWidth) / 2;
  4007. var textY = item.y;
  4008. context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity));
  4009. context.setStrokeStyle(item.labelBgColor);
  4010. context.setLineWidth(1 * opts.pixelRatio);
  4011. context.beginPath();
  4012. context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 * config.toolTipPadding);
  4013. context.closePath();
  4014. context.stroke();
  4015. context.fill();
  4016. context.beginPath();
  4017. context.setFontSize(config.fontSize);
  4018. context.setFillStyle(item.labelFontColor);
  4019. context.fillText(String(labelText), textX, textY + 0.5 * config.fontSize);
  4020. context.stroke();
  4021. }
  4022. }
  4023. }
  4024. function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
  4025. var toolTipOption = assign({}, {
  4026. gridType: 'solid',
  4027. dashLength: 4 },
  4028. opts.extra.tooltip);
  4029. var startX = opts.area[3];
  4030. var endX = opts.width - opts.padding[1];
  4031. if (toolTipOption.gridType == 'dash') {
  4032. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  4033. }
  4034. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  4035. context.setLineWidth(1 * opts.pixelRatio);
  4036. context.beginPath();
  4037. context.moveTo(startX, opts.tooltip.offset.y);
  4038. context.lineTo(endX, opts.tooltip.offset.y);
  4039. context.stroke();
  4040. context.setLineDash([]);
  4041. if (toolTipOption.yAxisLabel) {
  4042. var labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing);
  4043. context.setFontSize(config.fontSize);
  4044. var textWidth = measureText(labelText, config.fontSize);
  4045. var bgStartX = opts.padding[3] + config.yAxisTitleWidth - config.toolTipPadding;
  4046. var bgEndX = Math.max(opts.area[3], textWidth + config.toolTipPadding * 2);
  4047. var bgWidth = bgEndX - bgStartX;
  4048. var textX = bgStartX + (bgWidth - textWidth) / 2;
  4049. var textY = opts.tooltip.offset.y;
  4050. context.beginPath();
  4051. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  4052. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  4053. context.setLineWidth(1 * opts.pixelRatio);
  4054. context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 * config.toolTipPadding);
  4055. context.closePath();
  4056. context.stroke();
  4057. context.fill();
  4058. context.beginPath();
  4059. context.setFontSize(config.fontSize);
  4060. context.setFillStyle(toolTipOption.labelFontColor || config.fontColor);
  4061. context.fillText(labelText, textX, textY + 0.5 * config.fontSize);
  4062. context.closePath();
  4063. context.stroke();
  4064. }
  4065. }
  4066. function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  4067. var toolTipOption = assign({}, {
  4068. activeBgColor: '#000000',
  4069. activeBgOpacity: 0.08 },
  4070. opts.extra.tooltip);
  4071. var startY = opts.area[0];
  4072. var endY = opts.height - opts.area[2];
  4073. context.beginPath();
  4074. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  4075. context.rect(offsetX - eachSpacing / 2, startY, eachSpacing, endY - startY);
  4076. context.closePath();
  4077. context.fill();
  4078. }
  4079. function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
  4080. var toolTipOption = assign({}, {
  4081. bgColor: '#000000',
  4082. bgOpacity: 0.7,
  4083. fontColor: '#FFFFFF' },
  4084. opts.extra.tooltip);
  4085. var legendWidth = 4 * opts.pixelRatio;
  4086. var legendMarginRight = 5 * opts.pixelRatio;
  4087. var arrowWidth = 8 * opts.pixelRatio;
  4088. var isOverRightBorder = false;
  4089. if (opts.type == 'line' || opts.type == 'area' || opts.type == 'candle' || opts.type == 'mix') {
  4090. drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
  4091. }
  4092. offset = assign({
  4093. x: 0,
  4094. y: 0 },
  4095. offset);
  4096. offset.y -= 8 * opts.pixelRatio;
  4097. var textWidth = textList.map(function (item) {
  4098. return measureText(item.text, config.fontSize);
  4099. });
  4100. var toolTipWidth = legendWidth + legendMarginRight + 4 * config.toolTipPadding + Math.max.apply(null, textWidth);
  4101. var toolTipHeight = 2 * config.toolTipPadding + textList.length * config.toolTipLineHeight;
  4102. // if beyond the right border
  4103. if (offset.x - Math.abs(opts._scrollDistance_) + arrowWidth + toolTipWidth > opts.width) {
  4104. isOverRightBorder = true;
  4105. }
  4106. if (toolTipHeight + offset.y > opts.height) {
  4107. offset.y = opts.height - toolTipHeight;
  4108. }
  4109. // draw background rect
  4110. context.beginPath();
  4111. context.setFillStyle(hexToRgb(toolTipOption.bgColor || config.toolTipBackground, toolTipOption.bgOpacity || config.toolTipOpacity));
  4112. if (isOverRightBorder) {
  4113. context.moveTo(offset.x, offset.y + 10 * opts.pixelRatio);
  4114. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pixelRatio - 5 * opts.pixelRatio);
  4115. context.lineTo(offset.x - arrowWidth, offset.y);
  4116. context.lineTo(offset.x - arrowWidth - Math.round(toolTipWidth), offset.y);
  4117. context.lineTo(offset.x - arrowWidth - Math.round(toolTipWidth), offset.y + toolTipHeight);
  4118. context.lineTo(offset.x - arrowWidth, offset.y + toolTipHeight);
  4119. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pixelRatio + 5 * opts.pixelRatio);
  4120. context.lineTo(offset.x, offset.y + 10 * opts.pixelRatio);
  4121. } else {
  4122. context.moveTo(offset.x, offset.y + 10 * opts.pixelRatio);
  4123. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pixelRatio - 5 * opts.pixelRatio);
  4124. context.lineTo(offset.x + arrowWidth, offset.y);
  4125. context.lineTo(offset.x + arrowWidth + Math.round(toolTipWidth), offset.y);
  4126. context.lineTo(offset.x + arrowWidth + Math.round(toolTipWidth), offset.y + toolTipHeight);
  4127. context.lineTo(offset.x + arrowWidth, offset.y + toolTipHeight);
  4128. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pixelRatio + 5 * opts.pixelRatio);
  4129. context.lineTo(offset.x, offset.y + 10 * opts.pixelRatio);
  4130. }
  4131. context.closePath();
  4132. context.fill();
  4133. // draw legend
  4134. textList.forEach(function (item, index) {
  4135. if (item.color !== null) {
  4136. context.beginPath();
  4137. context.setFillStyle(item.color);
  4138. var startX = offset.x + arrowWidth + 2 * config.toolTipPadding;
  4139. var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index +
  4140. config.toolTipPadding + 1;
  4141. if (isOverRightBorder) {
  4142. startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding;
  4143. }
  4144. context.fillRect(startX, startY, legendWidth, config.fontSize);
  4145. context.closePath();
  4146. }
  4147. });
  4148. // draw text list
  4149. textList.forEach(function (item, index) {
  4150. var startX = offset.x + arrowWidth + 2 * config.toolTipPadding + legendWidth + legendMarginRight;
  4151. if (isOverRightBorder) {
  4152. startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding + +legendWidth + legendMarginRight;
  4153. }
  4154. var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index +
  4155. config.toolTipPadding;
  4156. context.beginPath();
  4157. context.setFontSize(config.fontSize);
  4158. context.setFillStyle(toolTipOption.fontColor);
  4159. context.fillText(item.text, startX, startY + config.fontSize);
  4160. context.closePath();
  4161. context.stroke();
  4162. });
  4163. }
  4164. function drawYAxisTitle(title, opts, config, context) {
  4165. var startX = config.xAxisHeight + (opts.height - config.xAxisHeight - measureText(title)) / 2;
  4166. context.save();
  4167. context.beginPath();
  4168. context.setFontSize(config.fontSize);
  4169. context.setFillStyle(opts.yAxis.titleFontColor || '#333333');
  4170. context.translate(0, opts.height);
  4171. context.rotate(-90 * Math.PI / 180);
  4172. context.fillText(title, startX, opts.padding[3] + 0.5 * config.fontSize);
  4173. context.closePath();
  4174. context.stroke();
  4175. context.restore();
  4176. }
  4177. function drawColumnDataPoints(series, opts, config, context) {
  4178. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4179. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4180. var xAxisData = opts.chartData.xAxisData,
  4181. xAxisPoints = xAxisData.xAxisPoints,
  4182. eachSpacing = xAxisData.eachSpacing;
  4183. var columnOption = assign({}, {
  4184. type: 'group',
  4185. width: eachSpacing / 2,
  4186. meter: {
  4187. border: 4,
  4188. fillColor: '#FFFFFF' } },
  4189. opts.extra.column);
  4190. var minRange = ranges.pop();
  4191. var maxRange = ranges.shift();
  4192. var calPoints = [];
  4193. context.save();
  4194. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4195. context.translate(opts._scrollDistance_, 0);
  4196. }
  4197. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  4198. drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
  4199. }
  4200. series.forEach(function (eachSeries, seriesIndex) {
  4201. var data = eachSeries.data;
  4202. switch (columnOption.type) {
  4203. case 'group':
  4204. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4205. var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  4206. calPoints.push(tooltipPoints);
  4207. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  4208. points.forEach(function (item, index) {
  4209. if (item !== null) {
  4210. context.beginPath();
  4211. context.setStrokeStyle(item.color || eachSeries.color);
  4212. context.setLineWidth(1);
  4213. context.setFillStyle(item.color || eachSeries.color);
  4214. var startX = item.x - item.width / 2;
  4215. var height = opts.height - item.y - opts.area[2];
  4216. context.moveTo(startX - 1, item.y);
  4217. context.lineTo(startX + item.width - 2, item.y);
  4218. context.lineTo(startX + item.width - 2, opts.height - opts.area[2]);
  4219. context.lineTo(startX, opts.height - opts.area[2]);
  4220. context.lineTo(startX, item.y);
  4221. //context.rect(startX, item.y, item.width, height);
  4222. context.closePath();
  4223. context.stroke();
  4224. context.fill();
  4225. }
  4226. });
  4227. break;
  4228. case 'stack':
  4229. // 绘制堆叠数据图
  4230. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config,
  4231. seriesIndex,
  4232. series, process);
  4233. calPoints.push(points);
  4234. points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  4235. points.forEach(function (item, index) {
  4236. if (item !== null) {
  4237. context.beginPath();
  4238. context.setFillStyle(item.color || eachSeries.color);
  4239. var startX = item.x - item.width / 2 + 1;
  4240. var height = opts.height - item.y - opts.area[2];
  4241. var height0 = opts.height - item.y0 - opts.area[2];
  4242. if (seriesIndex > 0) {
  4243. height -= height0;
  4244. }
  4245. context.moveTo(startX, item.y);
  4246. context.fillRect(startX, item.y, item.width - 2, height);
  4247. context.closePath();
  4248. context.fill();
  4249. }
  4250. });
  4251. break;
  4252. case 'meter':
  4253. // 绘制温度计数据图
  4254. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4255. calPoints.push(points);
  4256. points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meter.
  4257. border);
  4258. if (seriesIndex == 0) {
  4259. points.forEach(function (item, index) {
  4260. if (item !== null) {
  4261. //画背景颜色
  4262. context.beginPath();
  4263. context.setFillStyle(columnOption.meter.fillColor);
  4264. var startX = item.x - item.width / 2;
  4265. var height = opts.height - item.y - opts.area[2];
  4266. context.moveTo(startX, item.y);
  4267. context.fillRect(startX, item.y, item.width, height);
  4268. context.closePath();
  4269. context.fill();
  4270. //画边框线
  4271. if (columnOption.meter.border > 0) {
  4272. context.beginPath();
  4273. context.setStrokeStyle(eachSeries.color);
  4274. context.setLineWidth(columnOption.meter.border * opts.pixelRatio);
  4275. context.moveTo(startX + columnOption.meter.border * 0.5, item.y + height);
  4276. context.lineTo(startX + columnOption.meter.border * 0.5, item.y + columnOption.meter.border * 0.5);
  4277. context.lineTo(startX + item.width - columnOption.meter.border * 0.5, item.y + columnOption.meter.border * 0.5);
  4278. context.lineTo(startX + item.width - columnOption.meter.border * 0.5, item.y + height);
  4279. context.stroke();
  4280. }
  4281. }
  4282. });
  4283. } else {
  4284. points.forEach(function (item, index) {
  4285. if (item !== null) {
  4286. context.beginPath();
  4287. context.setFillStyle(item.color || eachSeries.color);
  4288. var startX = item.x - item.width / 2;
  4289. var height = opts.height - item.y - opts.area[2];
  4290. context.moveTo(startX, item.y);
  4291. context.fillRect(startX, item.y, item.width, height);
  4292. context.closePath();
  4293. context.fill();
  4294. }
  4295. });
  4296. }
  4297. break;}
  4298. });
  4299. if (opts.dataLabel !== false && process === 1) {
  4300. series.forEach(function (eachSeries, seriesIndex) {
  4301. var data = eachSeries.data;
  4302. switch (columnOption.type) {
  4303. case 'group':
  4304. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4305. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  4306. drawPointText(points, eachSeries, config, context);
  4307. break;
  4308. case 'stack':
  4309. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config,
  4310. seriesIndex,
  4311. series, process);
  4312. drawPointText(points, eachSeries, config, context);
  4313. break;
  4314. case 'meter':
  4315. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4316. drawPointText(points, eachSeries, config, context);
  4317. break;}
  4318. });
  4319. }
  4320. context.restore();
  4321. return {
  4322. xAxisPoints: xAxisPoints,
  4323. calPoints: calPoints,
  4324. eachSpacing: eachSpacing,
  4325. minRange: minRange,
  4326. maxRange: maxRange };
  4327. }
  4328. function drawCandleDataPoints(series, seriesMA, opts, config, context) {
  4329. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  4330. var candleOption = assign({}, {
  4331. color: {},
  4332. average: {} },
  4333. opts.extra.candle);
  4334. candleOption.color = assign({}, {
  4335. upLine: '#f04864',
  4336. upFill: '#f04864',
  4337. downLine: '#2fc25b',
  4338. downFill: '#2fc25b' },
  4339. candleOption.color);
  4340. candleOption.average = assign({}, {
  4341. show: false,
  4342. name: [],
  4343. day: [],
  4344. color: config.colors },
  4345. candleOption.average);
  4346. opts.extra.candle = candleOption;
  4347. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4348. var xAxisData = opts.chartData.xAxisData,
  4349. xAxisPoints = xAxisData.xAxisPoints,
  4350. eachSpacing = xAxisData.eachSpacing;
  4351. var minRange = ranges.pop();
  4352. var maxRange = ranges.shift();
  4353. var calPoints = [];
  4354. context.save();
  4355. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4356. context.translate(opts._scrollDistance_, 0);
  4357. }
  4358. //画均线
  4359. if (candleOption.average.show) {
  4360. seriesMA.forEach(function (eachSeries, seriesIndex) {
  4361. var data = eachSeries.data;
  4362. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4363. //calPoints.push(points);
  4364. var splitPointList = splitPoints(points);
  4365. splitPointList.forEach(function (points, index) {
  4366. context.beginPath();
  4367. context.setStrokeStyle(eachSeries.color);
  4368. context.setLineWidth(1);
  4369. if (points.length === 1) {
  4370. context.moveTo(points[0].x, points[0].y);
  4371. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  4372. } else {
  4373. context.moveTo(points[0].x, points[0].y);
  4374. points.forEach(function (item, index) {
  4375. if (index > 0) {
  4376. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4377. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
  4378. item.x, item.
  4379. y);
  4380. }
  4381. });
  4382. context.moveTo(points[0].x, points[0].y);
  4383. }
  4384. context.closePath();
  4385. context.stroke();
  4386. });
  4387. });
  4388. }
  4389. //画K线
  4390. series.forEach(function (eachSeries, seriesIndex) {
  4391. var data = eachSeries.data;
  4392. var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4393. calPoints.push(points);
  4394. var splitPointList = splitPoints(points);
  4395. splitPointList = splitPointList[0];
  4396. splitPointList.forEach(function (points, index) {
  4397. context.beginPath();
  4398. //如果上涨
  4399. if (data[index][1] - data[index][0] > 0) {
  4400. context.setStrokeStyle(candleOption.color.upLine);
  4401. context.setFillStyle(candleOption.color.upFill);
  4402. context.setLineWidth(1 * opts.pixelRatio);
  4403. context.moveTo(points[3].x, points[3].y); //顶点
  4404. context.lineTo(points[1].x, points[1].y); //收盘中间点
  4405. context.lineTo(points[1].x - eachSpacing / 4, points[1].y); //收盘左侧点
  4406. context.lineTo(points[0].x - eachSpacing / 4, points[0].y); //开盘左侧点
  4407. context.lineTo(points[0].x, points[0].y); //开盘中间点
  4408. context.lineTo(points[2].x, points[2].y); //底点
  4409. context.lineTo(points[0].x, points[0].y); //开盘中间点
  4410. context.lineTo(points[0].x + eachSpacing / 4, points[0].y); //开盘右侧点
  4411. context.lineTo(points[1].x + eachSpacing / 4, points[1].y); //收盘右侧点
  4412. context.lineTo(points[1].x, points[1].y); //收盘中间点
  4413. context.moveTo(points[3].x, points[3].y); //顶点
  4414. } else {
  4415. context.setStrokeStyle(candleOption.color.downLine);
  4416. context.setFillStyle(candleOption.color.downFill);
  4417. context.setLineWidth(1 * opts.pixelRatio);
  4418. context.moveTo(points[3].x, points[3].y); //顶点
  4419. context.lineTo(points[0].x, points[0].y); //开盘中间点
  4420. context.lineTo(points[0].x - eachSpacing / 4, points[0].y); //开盘左侧点
  4421. context.lineTo(points[1].x - eachSpacing / 4, points[1].y); //收盘左侧点
  4422. context.lineTo(points[1].x, points[1].y); //收盘中间点
  4423. context.lineTo(points[2].x, points[2].y); //底点
  4424. context.lineTo(points[1].x, points[1].y); //收盘中间点
  4425. context.lineTo(points[1].x + eachSpacing / 4, points[1].y); //收盘右侧点
  4426. context.lineTo(points[0].x + eachSpacing / 4, points[0].y); //开盘右侧点
  4427. context.lineTo(points[0].x, points[0].y); //开盘中间点
  4428. context.moveTo(points[3].x, points[3].y); //顶点
  4429. }
  4430. context.closePath();
  4431. context.fill();
  4432. context.stroke();
  4433. });
  4434. });
  4435. context.restore();
  4436. return {
  4437. xAxisPoints: xAxisPoints,
  4438. calPoints: calPoints,
  4439. eachSpacing: eachSpacing,
  4440. minRange: minRange,
  4441. maxRange: maxRange };
  4442. }
  4443. function drawAreaDataPoints(series, opts, config, context) {
  4444. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4445. var areaOption = assign({}, {
  4446. type: 'straight',
  4447. opacity: 0.2,
  4448. addLine: false,
  4449. width: 2 },
  4450. opts.extra.area);
  4451. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4452. var xAxisData = opts.chartData.xAxisData,
  4453. xAxisPoints = xAxisData.xAxisPoints,
  4454. eachSpacing = xAxisData.eachSpacing;
  4455. var minRange = ranges.pop();
  4456. var maxRange = ranges.shift();
  4457. var endY = opts.height - opts.area[2];
  4458. var calPoints = [];
  4459. context.save();
  4460. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4461. context.translate(opts._scrollDistance_, 0);
  4462. }
  4463. series.forEach(function (eachSeries, seriesIndex) {
  4464. var data = eachSeries.data;
  4465. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4466. calPoints.push(points);
  4467. var splitPointList = splitPoints(points);var _loop3 = function _loop3(
  4468. i) {
  4469. var points = splitPointList[i];
  4470. // 绘制区域数
  4471. context.beginPath();
  4472. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  4473. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  4474. context.setLineWidth(areaOption.width * opts.pixelRatio);
  4475. if (points.length > 1) {
  4476. var firstPoint = points[0];
  4477. var lastPoint = points[points.length - 1];
  4478. context.moveTo(firstPoint.x, firstPoint.y);
  4479. if (areaOption.type === 'curve') {
  4480. points.forEach(function (item, index) {
  4481. if (index > 0) {
  4482. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4483. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  4484. }
  4485. });
  4486. } else {
  4487. points.forEach(function (item, index) {
  4488. if (index > 0) {
  4489. context.lineTo(item.x, item.y);
  4490. }
  4491. });
  4492. }
  4493. context.lineTo(lastPoint.x, endY);
  4494. context.lineTo(firstPoint.x, endY);
  4495. context.lineTo(firstPoint.x, firstPoint.y);
  4496. } else {
  4497. var item = points[0];
  4498. context.moveTo(item.x - eachSpacing / 2, item.y);
  4499. context.lineTo(item.x + eachSpacing / 2, item.y);
  4500. context.lineTo(item.x + eachSpacing / 2, endY);
  4501. context.lineTo(item.x - eachSpacing / 2, endY);
  4502. context.moveTo(item.x - eachSpacing / 2, item.y);
  4503. }
  4504. context.closePath();
  4505. context.fill();
  4506. //画连线
  4507. if (areaOption.addLine) {
  4508. context.beginPath();
  4509. context.setStrokeStyle(eachSeries.color);
  4510. context.setLineWidth(areaOption.width * opts.pixelRatio);
  4511. if (points.length === 1) {
  4512. context.moveTo(points[0].x, points[0].y);
  4513. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  4514. } else {
  4515. context.moveTo(points[0].x, points[0].y);
  4516. if (areaOption.type === 'curve') {
  4517. points.forEach(function (item, index) {
  4518. if (index > 0) {
  4519. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4520. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  4521. }
  4522. });
  4523. } else {
  4524. points.forEach(function (item, index) {
  4525. if (index > 0) {
  4526. context.lineTo(item.x, item.y);
  4527. }
  4528. });
  4529. }
  4530. context.moveTo(points[0].x, points[0].y);
  4531. }
  4532. context.closePath();
  4533. context.stroke();
  4534. }};for (var i = 0; i < splitPointList.length; i++) {_loop3(i);
  4535. }
  4536. //画点
  4537. if (opts.dataPointShape !== false) {
  4538. var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
  4539. drawPointShape(points, eachSeries.color, shape, context, opts);
  4540. }
  4541. });
  4542. if (opts.dataLabel !== false && process === 1) {
  4543. series.forEach(function (eachSeries, seriesIndex) {
  4544. var data = eachSeries.data;
  4545. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4546. drawPointText(points, eachSeries, config, context);
  4547. });
  4548. }
  4549. context.restore();
  4550. return {
  4551. xAxisPoints: xAxisPoints,
  4552. calPoints: calPoints,
  4553. eachSpacing: eachSpacing,
  4554. minRange: minRange,
  4555. maxRange: maxRange };
  4556. }
  4557. function drawLineDataPoints(series, opts, config, context) {
  4558. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4559. var lineOption = opts.extra.line || {
  4560. type: 'straight',
  4561. width: 2 };
  4562. lineOption.type = lineOption.type ? lineOption.type : 'straight';
  4563. lineOption.width = lineOption.width ? lineOption.width : 2;
  4564. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4565. var xAxisData = opts.chartData.xAxisData,
  4566. xAxisPoints = xAxisData.xAxisPoints,
  4567. eachSpacing = xAxisData.eachSpacing;
  4568. var minRange = ranges.pop();
  4569. var maxRange = ranges.shift();
  4570. var calPoints = [];
  4571. context.save();
  4572. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4573. context.translate(opts._scrollDistance_, 0);
  4574. }
  4575. series.forEach(function (eachSeries, seriesIndex) {
  4576. var data = eachSeries.data;
  4577. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4578. calPoints.push(points);
  4579. var splitPointList = splitPoints(points);
  4580. splitPointList.forEach(function (points, index) {
  4581. context.beginPath();
  4582. context.setStrokeStyle(eachSeries.color);
  4583. context.setLineWidth(lineOption.width * opts.pixelRatio);
  4584. if (points.length === 1) {
  4585. context.moveTo(points[0].x, points[0].y);
  4586. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  4587. } else {
  4588. context.moveTo(points[0].x, points[0].y);
  4589. if (lineOption.type === 'curve') {
  4590. points.forEach(function (item, index) {
  4591. if (index > 0) {
  4592. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4593. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
  4594. item.x, item.
  4595. y);
  4596. }
  4597. });
  4598. } else {
  4599. points.forEach(function (item, index) {
  4600. if (index > 0) {
  4601. context.lineTo(item.x, item.y);
  4602. }
  4603. });
  4604. }
  4605. context.moveTo(points[0].x, points[0].y);
  4606. }
  4607. context.closePath();
  4608. context.stroke();
  4609. });
  4610. if (opts.dataPointShape !== false) {
  4611. var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
  4612. drawPointShape(points, eachSeries.color, shape, context, opts);
  4613. }
  4614. });
  4615. if (opts.dataLabel !== false && process === 1) {
  4616. series.forEach(function (eachSeries, seriesIndex) {
  4617. var data = eachSeries.data;
  4618. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4619. drawPointText(points, eachSeries, config, context);
  4620. });
  4621. }
  4622. context.restore();
  4623. return {
  4624. xAxisPoints: xAxisPoints,
  4625. calPoints: calPoints,
  4626. eachSpacing: eachSpacing,
  4627. minRange: minRange,
  4628. maxRange: maxRange };
  4629. }
  4630. function drawMixDataPoints(series, opts, config, context) {
  4631. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4632. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4633. var xAxisData = opts.chartData.xAxisData,
  4634. xAxisPoints = xAxisData.xAxisPoints,
  4635. eachSpacing = xAxisData.eachSpacing;
  4636. var minRange = ranges.pop();
  4637. var maxRange = ranges.shift();
  4638. var endY = opts.height - opts.area[2];
  4639. var calPoints = [];
  4640. var columnIndex = 0;
  4641. var columnLength = 0;
  4642. series.forEach(function (eachSeries, seriesIndex) {
  4643. if (eachSeries.type == 'column') {
  4644. columnLength += 1;
  4645. }
  4646. });
  4647. context.save();
  4648. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4649. context.translate(opts._scrollDistance_, 0);
  4650. }
  4651. series.forEach(function (eachSeries, seriesIndex) {
  4652. var data = eachSeries.data;
  4653. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4654. calPoints.push(points);
  4655. // 绘制柱状数据图
  4656. if (eachSeries.type == 'column') {
  4657. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  4658. points.forEach(function (item, index) {
  4659. if (item !== null) {
  4660. context.beginPath();
  4661. context.setStrokeStyle(item.color || eachSeries.color);
  4662. context.setLineWidth(1);
  4663. context.setFillStyle(item.color || eachSeries.color);
  4664. var startX = item.x - item.width / 2;
  4665. var height = opts.height - item.y - opts.area[2];
  4666. context.moveTo(startX, item.y);
  4667. context.moveTo(startX - 1, item.y);
  4668. context.lineTo(startX + item.width - 2, item.y);
  4669. context.lineTo(startX + item.width - 2, opts.height - opts.area[2]);
  4670. context.lineTo(startX, opts.height - opts.area[2]);
  4671. context.lineTo(startX, item.y);
  4672. //context.rect(startX, item.y, item.width, height);
  4673. context.closePath();
  4674. context.stroke();
  4675. context.fill();
  4676. context.closePath();
  4677. context.fill();
  4678. }
  4679. });
  4680. columnIndex += 1;
  4681. }
  4682. //绘制区域图数据
  4683. if (eachSeries.type == 'area') {
  4684. var _splitPointList = splitPoints(points);var _loop4 = function _loop4(
  4685. i) {
  4686. var points = _splitPointList[i];
  4687. // 绘制区域数据
  4688. context.beginPath();
  4689. context.setStrokeStyle(eachSeries.color);
  4690. context.setFillStyle(hexToRgb(eachSeries.color, 0.2));
  4691. context.setLineWidth(2 * opts.pixelRatio);
  4692. if (points.length > 1) {
  4693. firstPoint = points[0];
  4694. var lastPoint = points[points.length - 1];
  4695. context.moveTo(firstPoint.x, firstPoint.y);
  4696. if (eachSeries.style === 'curve') {
  4697. points.forEach(function (item, index) {
  4698. if (index > 0) {
  4699. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4700. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  4701. }
  4702. });
  4703. } else {
  4704. points.forEach(function (item, index) {
  4705. if (index > 0) {
  4706. context.lineTo(item.x, item.y);
  4707. }
  4708. });
  4709. }
  4710. context.lineTo(lastPoint.x, endY);
  4711. context.lineTo(firstPoint.x, endY);
  4712. context.lineTo(firstPoint.x, firstPoint.y);
  4713. } else {
  4714. var item = points[0];
  4715. context.moveTo(item.x - eachSpacing / 2, item.y);
  4716. context.lineTo(item.x + eachSpacing / 2, item.y);
  4717. context.lineTo(item.x + eachSpacing / 2, endY);
  4718. context.lineTo(item.x - eachSpacing / 2, endY);
  4719. context.moveTo(item.x - eachSpacing / 2, item.y);
  4720. }
  4721. context.closePath();
  4722. context.fill();};for (var i = 0; i < _splitPointList.length; i++) {var firstPoint;_loop4(i);
  4723. }
  4724. }
  4725. // 绘制折线数据图
  4726. if (eachSeries.type == 'line') {
  4727. var splitPointList = splitPoints(points);
  4728. splitPointList.forEach(function (points, index) {
  4729. context.beginPath();
  4730. context.setStrokeStyle(eachSeries.color);
  4731. context.setLineWidth(2 * opts.pixelRatio);
  4732. if (points.length === 1) {
  4733. context.moveTo(points[0].x, points[0].y);
  4734. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  4735. } else {
  4736. context.moveTo(points[0].x, points[0].y);
  4737. if (eachSeries.style == 'curve') {
  4738. points.forEach(function (item, index) {
  4739. if (index > 0) {
  4740. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4741. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
  4742. item.x,
  4743. item.y);
  4744. }
  4745. });
  4746. } else {
  4747. points.forEach(function (item, index) {
  4748. if (index > 0) {
  4749. context.lineTo(item.x, item.y);
  4750. }
  4751. });
  4752. }
  4753. context.moveTo(points[0].x, points[0].y);
  4754. }
  4755. context.closePath();
  4756. context.stroke();
  4757. });
  4758. }
  4759. // 绘制点数据图
  4760. if (eachSeries.type == 'point') {
  4761. points.forEach(function (pointsa, index) {
  4762. if (pointsa) {
  4763. context.beginPath();
  4764. context.setFillStyle(eachSeries.color);
  4765. context.setStrokeStyle('#FFFFFF');
  4766. context.setLineWidth(1 * opts.pixelRatio);
  4767. context.moveTo(pointsa.x + 3.5 * opts.pixelRatio, pointsa.y);
  4768. context.arc(pointsa.x, pointsa.y, 4 * opts.pixelRatio, 0, 2 * Math.PI);
  4769. context.closePath();
  4770. context.fill();
  4771. context.stroke();
  4772. }
  4773. });
  4774. }
  4775. if (eachSeries.addPoint == true && eachSeries.type !== 'column') {
  4776. var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
  4777. drawPointShape(points, eachSeries.color, shape, context, opts);
  4778. }
  4779. });
  4780. if (opts.dataLabel !== false && process === 1) {
  4781. var columnIndex = 0;
  4782. series.forEach(function (eachSeries, seriesIndex) {
  4783. var data = eachSeries.data;
  4784. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4785. if (eachSeries.type !== 'column') {
  4786. drawPointText(points, eachSeries, config, context);
  4787. } else {
  4788. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  4789. drawPointText(points, eachSeries, config, context);
  4790. columnIndex += 1;
  4791. }
  4792. });
  4793. }
  4794. context.restore();
  4795. return {
  4796. xAxisPoints: xAxisPoints,
  4797. calPoints: calPoints,
  4798. eachSpacing: eachSpacing,
  4799. minRange: minRange,
  4800. maxRange: maxRange };
  4801. }
  4802. function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
  4803. var toolTipOption = opts.extra.tooltip || {};
  4804. if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'candle' || opts.type == 'mix')) {
  4805. drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints);
  4806. }
  4807. context.save();
  4808. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4809. context.translate(opts._scrollDistance_, 0);
  4810. }
  4811. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  4812. drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
  4813. }
  4814. context.restore();
  4815. }
  4816. function drawXAxis(categories, opts, config, context) {
  4817. var xAxisData = opts.chartData.xAxisData,
  4818. xAxisPoints = xAxisData.xAxisPoints,
  4819. startX = xAxisData.startX,
  4820. endX = xAxisData.endX,
  4821. eachSpacing = xAxisData.eachSpacing;
  4822. var boundaryGap = 'center';
  4823. if (opts.type == 'line' || opts.type == 'area') {
  4824. boundaryGap = opts.xAxis.boundaryGap;
  4825. }
  4826. var startY = opts.height - opts.area[2];
  4827. var endY = opts.area[0];
  4828. //绘制滚动条
  4829. if (opts.enableScroll && opts.xAxis.scrollShow) {
  4830. var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
  4831. var scrollScreenWidth = endX - startX;
  4832. var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
  4833. var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
  4834. var scrollLeft = 0;
  4835. if (opts._scrollDistance_) {
  4836. scrollLeft = -opts._scrollDistance_ * scrollScreenWidth / scrollTotalWidth;
  4837. }
  4838. context.beginPath();
  4839. context.setLineCap('round');
  4840. context.setLineWidth(6 * opts.pixelRatio);
  4841. context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
  4842. context.moveTo(startX, scrollY);
  4843. context.lineTo(endX, scrollY);
  4844. context.stroke();
  4845. context.closePath();
  4846. context.beginPath();
  4847. context.setLineCap('round');
  4848. context.setLineWidth(6 * opts.pixelRatio);
  4849. context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
  4850. context.moveTo(startX + scrollLeft, scrollY);
  4851. context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
  4852. context.stroke();
  4853. context.closePath();
  4854. context.setLineCap('butt');
  4855. }
  4856. context.save();
  4857. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  4858. context.translate(opts._scrollDistance_, 0);
  4859. }
  4860. if (opts.xAxis.disableGrid !== true) {
  4861. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  4862. context.setLineCap('butt');
  4863. context.setLineWidth(1 * opts.pixelRatio);
  4864. if (opts.xAxis.gridType == 'dash') {
  4865. context.setLineDash([opts.xAxis.dashLength, opts.xAxis.dashLength]);
  4866. }
  4867. if (opts.xAxis.type === 'calibration') {
  4868. xAxisPoints.forEach(function (item, index) {
  4869. if (index > 0) {
  4870. context.beginPath();
  4871. context.moveTo(item - eachSpacing / 2, startY);
  4872. context.lineTo(item - eachSpacing / 2, startY + 4 * opts.pixelRatio);
  4873. context.closePath();
  4874. context.stroke();
  4875. }
  4876. });
  4877. } else {
  4878. opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
  4879. xAxisPoints.forEach(function (item, index) {
  4880. if (index % opts.xAxis.gridEval == 0) {
  4881. context.beginPath();
  4882. context.moveTo(item, startY);
  4883. context.lineTo(item, endY);
  4884. context.stroke();
  4885. }
  4886. });
  4887. }
  4888. context.setLineDash([]);
  4889. }
  4890. //不绘制X轴
  4891. if (opts.xAxis.disabled !== true) {
  4892. // 对X轴列表做抽稀处理
  4893. var validWidth = opts.width - opts.padding[1] - opts.padding[3] - config.yAxisWidth - config.yAxisTitleWidth;
  4894. //默认全部显示X轴标签
  4895. var maxXAxisListLength = categories.length;
  4896. //如果设置了X轴单屏数量
  4897. if (opts.xAxis.labelCount) {
  4898. //如果设置X轴密度
  4899. if (opts.xAxis.itemCount) {
  4900. maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
  4901. } else {
  4902. maxXAxisListLength = opts.xAxis.labelCount;
  4903. }
  4904. maxXAxisListLength -= 1;
  4905. }
  4906. var ratio = Math.ceil(categories.length / maxXAxisListLength);
  4907. var newCategories = [];
  4908. var cgLength = categories.length;
  4909. for (var i = 0; i < cgLength; i++) {
  4910. if (i % ratio !== 0) {
  4911. newCategories.push("");
  4912. } else {
  4913. newCategories.push(categories[i]);
  4914. }
  4915. }
  4916. newCategories[cgLength - 1] = categories[cgLength - 1];
  4917. var xAxisFontSize = opts.xAxis.fontSize || config.fontSize;
  4918. if (config._xAxisTextAngle_ === 0) {
  4919. newCategories.forEach(function (item, index) {
  4920. var offset = -measureText(item, xAxisFontSize) / 2;
  4921. if (boundaryGap == 'center') {
  4922. offset += eachSpacing / 2;
  4923. }
  4924. context.beginPath();
  4925. context.setFontSize(xAxisFontSize);
  4926. context.setFillStyle(opts.xAxis.fontColor || '#666666');
  4927. context.fillText(item, xAxisPoints[index] + offset, startY + xAxisFontSize + (config.xAxisHeight - xAxisFontSize) / 2);
  4928. context.closePath();
  4929. context.stroke();
  4930. });
  4931. } else {
  4932. newCategories.forEach(function (item, index) {
  4933. context.save();
  4934. context.beginPath();
  4935. context.setFontSize(xAxisFontSize);
  4936. context.setFillStyle(opts.xAxis.fontColor || '#666666');
  4937. var textWidth = measureText(item);
  4938. var offset = -textWidth;
  4939. if (boundaryGap == 'center') {
  4940. offset += eachSpacing / 2;
  4941. }
  4942. var _calRotateTranslate = calRotateTranslate(xAxisPoints[index] + eachSpacing / 2, startY + xAxisFontSize / 2 + 5, opts.height),
  4943. transX = _calRotateTranslate.transX,
  4944. transY = _calRotateTranslate.transY;
  4945. context.rotate(-1 * config._xAxisTextAngle_);
  4946. context.translate(transX, transY);
  4947. context.fillText(item, xAxisPoints[index] + offset, startY + xAxisFontSize + 5);
  4948. context.closePath();
  4949. context.stroke();
  4950. context.restore();
  4951. });
  4952. }
  4953. }
  4954. context.restore();
  4955. }
  4956. function drawYAxisGrid(categories, opts, config, context) {
  4957. if (opts.yAxis.disableGrid === true) {
  4958. return;
  4959. }
  4960. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  4961. var eachSpacing = spacingValid / config.yAxisSplit;
  4962. var startX = opts.area[3];
  4963. var xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  4964. xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing;
  4965. var TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1);
  4966. var endX = startX + TotalWidth;
  4967. var points = [];
  4968. for (var i = 0; i < config.yAxisSplit + 1; i++) {
  4969. points.push(opts.height - opts.area[2] - eachSpacing * i);
  4970. }
  4971. context.save();
  4972. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  4973. context.translate(opts._scrollDistance_, 0);
  4974. }
  4975. if (opts.yAxis.gridType == 'dash') {
  4976. context.setLineDash([opts.yAxis.dashLength, opts.yAxis.dashLength]);
  4977. }
  4978. context.setStrokeStyle(opts.yAxis.gridColor || "#cccccc");
  4979. context.setLineWidth(1 * opts.pixelRatio);
  4980. points.forEach(function (item, index) {
  4981. context.beginPath();
  4982. context.moveTo(startX, item);
  4983. context.lineTo(endX, item);
  4984. context.stroke();
  4985. });
  4986. context.setLineDash([]);
  4987. context.restore();
  4988. }
  4989. function drawYAxis(series, opts, config, context) {
  4990. if (opts.yAxis.disabled === true) {
  4991. return;
  4992. }
  4993. var rangesFormat = opts.chartData.yAxisData.rangesFormat;
  4994. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  4995. var eachSpacing = Math.floor(spacingValid / config.yAxisSplit);
  4996. var startX = opts.area[3];
  4997. var endX = opts.width - opts.area[1];
  4998. var endY = opts.height - opts.area[2];
  4999. var fillEndY = endY + config.xAxisHeight;
  5000. if (opts.xAxis.scrollShow) {
  5001. fillEndY -= 3 * opts.pixelRatio;
  5002. }
  5003. // set YAxis background
  5004. context.beginPath();
  5005. context.setFillStyle(opts.background || '#ffffff');
  5006. if (opts._scrollDistance_ < 0) {
  5007. context.fillRect(0, 0, startX, fillEndY);
  5008. }
  5009. if (opts.enableScroll == true) {
  5010. context.fillRect(endX, 0, opts.width, fillEndY);
  5011. }
  5012. context.closePath();
  5013. context.stroke();
  5014. var points = [];
  5015. for (var i = 0; i <= config.yAxisSplit; i++) {
  5016. points.push(opts.area[0] + eachSpacing * i);
  5017. }
  5018. var yAxisFontSize = opts.yAxis.fontSize || config.fontSize;
  5019. rangesFormat.forEach(function (item, index) {
  5020. var pos = points[index] ? points[index] : endY;
  5021. context.beginPath();
  5022. context.setFontSize(yAxisFontSize);
  5023. context.setFillStyle(opts.yAxis.fontColor || '#666666');
  5024. context.fillText(String(item), opts.area[3] - config.yAxisWidth, pos + yAxisFontSize / 2);
  5025. context.closePath();
  5026. context.stroke();
  5027. });
  5028. if (opts.yAxis.title) {
  5029. drawYAxisTitle(opts.yAxis.title, opts, config, context);
  5030. }
  5031. }
  5032. function drawLegend(series, opts, config, context, chartData) {
  5033. if (opts.legend.show === false) {
  5034. return;
  5035. }
  5036. var legendData = chartData.legendData;
  5037. var legendList = legendData.points;
  5038. var legendArea = legendData.area;
  5039. var padding = opts.legend.padding;
  5040. var fontSize = opts.legend.fontSize;
  5041. var shapeWidth = 15 * opts.pixelRatio;
  5042. var shapeRight = 5 * opts.pixelRatio;
  5043. var itemGap = opts.legend.itemGap;
  5044. var lineHeight = Math.max(opts.legend.lineHeight * opts.pixelRatio, fontSize);
  5045. //画背景及边框
  5046. context.beginPath();
  5047. context.setLineWidth(opts.legend.borderWidth);
  5048. context.setStrokeStyle(opts.legend.borderColor);
  5049. context.setFillStyle(opts.legend.backgroundColor);
  5050. context.moveTo(legendArea.start.x, legendArea.start.y);
  5051. context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height);
  5052. context.closePath();
  5053. context.fill();
  5054. context.stroke();
  5055. legendList.forEach(function (itemList, listIndex) {
  5056. var width = 0;
  5057. var height = 0;
  5058. width = legendData.widthArr[listIndex];
  5059. height = legendData.heightArr[listIndex];
  5060. var startX = 0;
  5061. var startY = 0;
  5062. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  5063. startX = legendArea.start.x + (legendArea.width - width) / 2;
  5064. startY = legendArea.start.y + padding + listIndex * lineHeight;
  5065. } else {
  5066. if (listIndex == 0) {
  5067. width = 0;
  5068. } else {
  5069. width = legendData.widthArr[listIndex - 1];
  5070. }
  5071. startX = legendArea.start.x + padding + width;
  5072. startY = legendArea.start.y + padding + (legendArea.height - height) / 2;
  5073. }
  5074. context.setFontSize(config.fontSize);
  5075. for (var i = 0; i < itemList.length; i++) {
  5076. var item = itemList[i];
  5077. item.area = [0, 0, 0, 0];
  5078. item.area[0] = startX;
  5079. item.area[1] = startY;
  5080. item.area[3] = startY + lineHeight;
  5081. context.beginPath();
  5082. context.setLineWidth(1 * opts.pixelRatio);
  5083. context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor);
  5084. context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor);
  5085. switch (item.legendShape) {
  5086. case 'line':
  5087. context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pixelRatio);
  5088. context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pixelRatio, 15 * opts.pixelRatio, 4 * opts.pixelRatio);
  5089. break;
  5090. case 'triangle':
  5091. context.moveTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5092. context.lineTo(startX + 2.5 * opts.pixelRatio, startY + 0.5 * lineHeight + 5 * opts.pixelRatio);
  5093. context.lineTo(startX + 12.5 * opts.pixelRatio, startY + 0.5 * lineHeight + 5 * opts.pixelRatio);
  5094. context.lineTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5095. break;
  5096. case 'diamond':
  5097. context.moveTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5098. context.lineTo(startX + 2.5 * opts.pixelRatio, startY + 0.5 * lineHeight);
  5099. context.lineTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight + 5 * opts.pixelRatio);
  5100. context.lineTo(startX + 12.5 * opts.pixelRatio, startY + 0.5 * lineHeight);
  5101. context.lineTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5102. break;
  5103. case 'circle':
  5104. context.moveTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight);
  5105. context.arc(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight, 5 * opts.pixelRatio, 0, 2 * Math.PI);
  5106. break;
  5107. case 'rect':
  5108. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5109. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio, 15 * opts.pixelRatio, 10 * opts.pixelRatio);
  5110. break;
  5111. default:
  5112. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5113. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio, 15 * opts.pixelRatio, 10 * opts.pixelRatio);}
  5114. context.closePath();
  5115. context.fill();
  5116. context.stroke();
  5117. startX += shapeWidth + shapeRight;
  5118. var fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2;
  5119. context.beginPath();
  5120. context.setFontSize(fontSize);
  5121. context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor);
  5122. context.fillText(item.name, startX, startY + fontTrans);
  5123. context.closePath();
  5124. context.stroke();
  5125. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  5126. startX += measureText(item.name, fontSize) + itemGap;
  5127. item.area[2] = startX;
  5128. } else {
  5129. item.area[2] = startX + measureText(item.name, fontSize) + itemGap;;
  5130. startX -= shapeWidth + shapeRight;
  5131. startY += lineHeight;
  5132. }
  5133. }
  5134. });
  5135. }
  5136. function drawPieDataPoints(series, opts, config, context) {
  5137. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5138. var pieOption = assign({}, {
  5139. activeOpacity: 0.5,
  5140. activeRadius: 10 * opts.pixelRatio,
  5141. offsetAngle: 0,
  5142. labelWidth: 15 * opts.pixelRatio,
  5143. ringWidth: 0,
  5144. border: false,
  5145. borderWidth: 2,
  5146. borderColor: '#FFFFFF' },
  5147. opts.extra.pie);
  5148. var centerPosition = {
  5149. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  5150. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 };
  5151. if (config.pieChartLinePadding == 0) {
  5152. config.pieChartLinePadding = pieOption.activeRadius;
  5153. }
  5154. 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);
  5155. series = getPieDataPoints(series, radius, process);
  5156. var activeRadius = pieOption.activeRadius;
  5157. series = series.map(function (eachSeries) {
  5158. eachSeries._start_ += pieOption.offsetAngle * Math.PI / 180;
  5159. return eachSeries;
  5160. });
  5161. series.forEach(function (eachSeries, seriesIndex) {
  5162. if (opts.tooltip) {
  5163. if (opts.tooltip.index == seriesIndex) {
  5164. context.beginPath();
  5165. context.setFillStyle(hexToRgb(eachSeries.color, opts.extra.pie.activeOpacity || 0.5));
  5166. context.moveTo(centerPosition.x, centerPosition.y);
  5167. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_,
  5168. eachSeries._start_ + 2 *
  5169. eachSeries._proportion_ * Math.PI);
  5170. context.closePath();
  5171. context.fill();
  5172. }
  5173. }
  5174. context.beginPath();
  5175. context.setLineWidth(pieOption.borderWidth * opts.pixelRatio);
  5176. context.lineJoin = "round";
  5177. context.setStrokeStyle(pieOption.borderColor);
  5178. context.setFillStyle(eachSeries.color);
  5179. context.moveTo(centerPosition.x, centerPosition.y);
  5180. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  5181. context.closePath();
  5182. context.fill();
  5183. if (pieOption.border == true) {
  5184. context.stroke();
  5185. }
  5186. });
  5187. if (opts.type === 'ring') {
  5188. var innerPieWidth = radius * 0.6;
  5189. if (typeof opts.extra.pie.ringWidth === 'number' && opts.extra.pie.ringWidth > 0) {
  5190. innerPieWidth = Math.max(0, radius - opts.extra.pie.ringWidth);
  5191. }
  5192. context.beginPath();
  5193. context.setFillStyle(opts.background || '#ffffff');
  5194. context.moveTo(centerPosition.x, centerPosition.y);
  5195. context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI);
  5196. context.closePath();
  5197. context.fill();
  5198. }
  5199. if (opts.dataLabel !== false && process === 1) {
  5200. var valid = false;
  5201. for (var i = 0, len = series.length; i < len; i++) {
  5202. if (series[i].data > 0) {
  5203. valid = true;
  5204. break;
  5205. }
  5206. }
  5207. if (valid) {
  5208. drawPieText(series, opts, config, context, radius, centerPosition);
  5209. }
  5210. }
  5211. if (process === 1 && opts.type === 'ring') {
  5212. drawRingTitle(opts, config, context, centerPosition);
  5213. }
  5214. return {
  5215. center: centerPosition,
  5216. radius: radius,
  5217. series: series };
  5218. }
  5219. function drawRoseDataPoints(series, opts, config, context) {
  5220. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5221. var roseOption = assign({}, {
  5222. type: 'area',
  5223. activeOpacity: 0.5,
  5224. activeRadius: 10 * opts.pixelRatio,
  5225. offsetAngle: 0,
  5226. labelWidth: 15 * opts.pixelRatio,
  5227. border: false,
  5228. borderWidth: 2,
  5229. borderColor: '#FFFFFF' },
  5230. opts.extra.rose);
  5231. if (config.pieChartLinePadding == 0) {
  5232. config.pieChartLinePadding = roseOption.activeRadius;
  5233. }
  5234. var centerPosition = {
  5235. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  5236. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 };
  5237. 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);
  5238. var minRadius = roseOption.minRadius || radius * 0.5;
  5239. series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
  5240. var activeRadius = roseOption.activeRadius;
  5241. series = series.map(function (eachSeries) {
  5242. eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
  5243. return eachSeries;
  5244. });
  5245. series.forEach(function (eachSeries, seriesIndex) {
  5246. if (opts.tooltip) {
  5247. if (opts.tooltip.index == seriesIndex) {
  5248. context.beginPath();
  5249. context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
  5250. context.moveTo(centerPosition.x, centerPosition.y);
  5251. context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_,
  5252. eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  5253. context.closePath();
  5254. context.fill();
  5255. }
  5256. }
  5257. context.beginPath();
  5258. context.setLineWidth(roseOption.borderWidth * opts.pixelRatio);
  5259. context.lineJoin = "round";
  5260. context.setStrokeStyle(roseOption.borderColor);
  5261. context.setFillStyle(eachSeries.color);
  5262. context.moveTo(centerPosition.x, centerPosition.y);
  5263. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 *
  5264. eachSeries._rose_proportion_ * Math.PI);
  5265. context.closePath();
  5266. context.fill();
  5267. if (roseOption.border == true) {
  5268. context.stroke();
  5269. }
  5270. });
  5271. if (opts.dataLabel !== false && process === 1) {
  5272. var valid = false;
  5273. for (var i = 0, len = series.length; i < len; i++) {
  5274. if (series[i].data > 0) {
  5275. valid = true;
  5276. break;
  5277. }
  5278. }
  5279. if (valid) {
  5280. drawPieText(series, opts, config, context, radius, centerPosition);
  5281. }
  5282. }
  5283. return {
  5284. center: centerPosition,
  5285. radius: radius,
  5286. series: series };
  5287. }
  5288. function drawArcbarDataPoints(series, opts, config, context) {
  5289. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5290. var arcbarOption = assign({}, {
  5291. startAngle: 0.75,
  5292. endAngle: 0.25,
  5293. type: 'default',
  5294. width: 12 * opts.pixelRatio },
  5295. opts.extra.arcbar);
  5296. series = getArcbarDataPoints(series, arcbarOption, process);
  5297. var centerPosition = {
  5298. x: opts.width / 2,
  5299. y: opts.height / 2 };
  5300. var radius = Math.min(centerPosition.x, centerPosition.y);
  5301. radius -= 5 * opts.pixelRatio;
  5302. radius -= arcbarOption.width / 2;
  5303. //背景颜色
  5304. context.setLineWidth(arcbarOption.width);
  5305. context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9');
  5306. context.setLineCap('round');
  5307. context.beginPath();
  5308. if (arcbarOption.type == 'default') {
  5309. context.arc(centerPosition.x, centerPosition.y, radius, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle *
  5310. Math.PI, false);
  5311. } else {
  5312. context.arc(centerPosition.x, centerPosition.y, radius, 0, 2 * Math.PI, false);
  5313. }
  5314. context.stroke();
  5315. for (var i = 0; i < series.length; i++) {
  5316. var eachSeries = series[i];
  5317. context.setLineWidth(arcbarOption.width);
  5318. context.setStrokeStyle(eachSeries.color);
  5319. context.setLineCap('round');
  5320. context.beginPath();
  5321. context.arc(centerPosition.x, centerPosition.y, radius, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ *
  5322. Math.PI, false);
  5323. context.stroke();
  5324. }
  5325. drawRingTitle(opts, config, context, centerPosition);
  5326. return {
  5327. center: centerPosition,
  5328. radius: radius,
  5329. series: series };
  5330. }
  5331. function drawGaugeDataPoints(categories, series, opts, config, context) {
  5332. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  5333. var gaugeOption = assign({}, {
  5334. startAngle: 0.75,
  5335. endAngle: 0.25,
  5336. width: 15,
  5337. splitLine: {
  5338. fixRadius: 0,
  5339. splitNumber: 10,
  5340. width: 15,
  5341. color: '#FFFFFF',
  5342. childNumber: 5,
  5343. childWidth: 5 },
  5344. pointer: {
  5345. width: 15,
  5346. color: 'auto' } },
  5347. opts.extra.gauge);
  5348. if (gaugeOption.oldAngle == undefined) {
  5349. gaugeOption.oldAngle = gaugeOption.startAngle;
  5350. }
  5351. if (gaugeOption.oldData == undefined) {
  5352. gaugeOption.oldData = 0;
  5353. }
  5354. categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle);
  5355. var centerPosition = {
  5356. x: opts.width / 2,
  5357. y: opts.height / 2 };
  5358. var radius = Math.min(centerPosition.x, centerPosition.y);
  5359. radius -= 5 * opts.pixelRatio;
  5360. radius -= gaugeOption.width / 2;
  5361. var innerRadius = radius - gaugeOption.width;
  5362. //画背景
  5363. context.setLineWidth(gaugeOption.width);
  5364. context.setLineCap('butt');
  5365. for (var i = 0; i < categories.length; i++) {
  5366. var eachCategories = categories[i];
  5367. context.beginPath();
  5368. context.setStrokeStyle(eachCategories.color);
  5369. context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ *
  5370. Math.PI, false);
  5371. context.stroke();
  5372. }
  5373. context.save();
  5374. //画刻度线
  5375. var totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  5376. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  5377. var childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  5378. var startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  5379. var endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  5380. var childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.childWidth;
  5381. context.translate(centerPosition.x, centerPosition.y);
  5382. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  5383. for (var _i12 = 0; _i12 < gaugeOption.splitLine.splitNumber + 1; _i12++) {
  5384. context.beginPath();
  5385. context.setStrokeStyle(gaugeOption.splitLine.color);
  5386. context.setLineWidth(2 * opts.pixelRatio);
  5387. context.moveTo(startX, 0);
  5388. context.lineTo(endX, 0);
  5389. context.stroke();
  5390. context.rotate(splitAngle * Math.PI);
  5391. }
  5392. context.restore();
  5393. context.save();
  5394. context.translate(centerPosition.x, centerPosition.y);
  5395. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  5396. for (var _i13 = 0; _i13 < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; _i13++) {
  5397. context.beginPath();
  5398. context.setStrokeStyle(gaugeOption.splitLine.color);
  5399. context.setLineWidth(1 * opts.pixelRatio);
  5400. context.moveTo(startX, 0);
  5401. context.lineTo(childendX, 0);
  5402. context.stroke();
  5403. context.rotate(childAngle * Math.PI);
  5404. }
  5405. context.restore();
  5406. //画指针
  5407. series = getGaugeDataPoints(series, categories, gaugeOption, process);
  5408. for (var _i14 = 0; _i14 < series.length; _i14++) {
  5409. var eachSeries = series[_i14];
  5410. context.save();
  5411. context.translate(centerPosition.x, centerPosition.y);
  5412. context.rotate((eachSeries._proportion_ - 1) * Math.PI);
  5413. context.beginPath();
  5414. context.setFillStyle(eachSeries.color);
  5415. context.moveTo(gaugeOption.pointer.width, 0);
  5416. context.lineTo(0, -gaugeOption.pointer.width / 2);
  5417. context.lineTo(-innerRadius, 0);
  5418. context.lineTo(0, gaugeOption.pointer.width / 2);
  5419. context.lineTo(gaugeOption.pointer.width, 0);
  5420. context.closePath();
  5421. context.fill();
  5422. context.beginPath();
  5423. context.setFillStyle('#FFFFFF');
  5424. context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false);
  5425. context.fill();
  5426. context.restore();
  5427. }
  5428. if (opts.dataLabel !== false) {
  5429. drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context);
  5430. }
  5431. drawRingTitle(opts, config, context, centerPosition);
  5432. if (process === 1 && opts.type === 'gauge') {
  5433. opts.extra.gauge.oldAngle = series[0]._proportion_;
  5434. opts.extra.gauge.oldData = series[0].data;
  5435. }
  5436. return {
  5437. center: centerPosition,
  5438. radius: radius,
  5439. innerRadius: innerRadius,
  5440. categories: categories,
  5441. totalAngle: totalAngle };
  5442. }
  5443. function drawRadarDataPoints(series, opts, config, context) {
  5444. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5445. var radarOption = assign({}, {
  5446. gridColor: '#cccccc',
  5447. labelColor: '#666666',
  5448. opacity: 0.2 },
  5449. opts.extra.radar);
  5450. var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
  5451. var centerPosition = {
  5452. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  5453. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 };
  5454. var radius = Math.min(centerPosition.x - (getMaxTextListLength(opts.categories) + config.radarLabelTextMargin),
  5455. centerPosition.y - config.radarLabelTextMargin);
  5456. //TODO逻辑不对
  5457. radius -= opts.padding[1];
  5458. // draw grid
  5459. context.beginPath();
  5460. context.setLineWidth(1 * opts.pixelRatio);
  5461. context.setStrokeStyle(radarOption.gridColor);
  5462. coordinateAngle.forEach(function (angle) {
  5463. var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
  5464. context.moveTo(centerPosition.x, centerPosition.y);
  5465. context.lineTo(pos.x, pos.y);
  5466. });
  5467. context.stroke();
  5468. context.closePath();
  5469. // draw split line grid
  5470. var _loop = function _loop(i) {
  5471. var startPos = {};
  5472. context.beginPath();
  5473. context.setLineWidth(1 * opts.pixelRatio);
  5474. context.setStrokeStyle(radarOption.gridColor);
  5475. coordinateAngle.forEach(function (angle, index) {
  5476. var pos = convertCoordinateOrigin(radius / config.radarGridCount * i * Math.cos(angle), radius / config.radarGridCount *
  5477. i * Math.sin(angle), centerPosition);
  5478. if (index === 0) {
  5479. startPos = pos;
  5480. context.moveTo(pos.x, pos.y);
  5481. } else {
  5482. context.lineTo(pos.x, pos.y);
  5483. }
  5484. });
  5485. context.lineTo(startPos.x, startPos.y);
  5486. context.stroke();
  5487. context.closePath();
  5488. };
  5489. for (var i = 1; i <= config.radarGridCount; i++) {
  5490. _loop(i);
  5491. }
  5492. var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
  5493. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  5494. // 绘制区域数据
  5495. context.beginPath();
  5496. context.setFillStyle(hexToRgb(eachSeries.color, radarOption.opacity));
  5497. eachSeries.data.forEach(function (item, index) {
  5498. if (index === 0) {
  5499. context.moveTo(item.position.x, item.position.y);
  5500. } else {
  5501. context.lineTo(item.position.x, item.position.y);
  5502. }
  5503. });
  5504. context.closePath();
  5505. context.fill();
  5506. if (opts.dataPointShape !== false) {
  5507. var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
  5508. var points = eachSeries.data.map(function (item) {
  5509. return item.position;
  5510. });
  5511. drawPointShape(points, eachSeries.color, shape, context, opts);
  5512. }
  5513. });
  5514. // draw label text
  5515. drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context);
  5516. return {
  5517. center: centerPosition,
  5518. radius: radius,
  5519. angleList: coordinateAngle };
  5520. }
  5521. function normalInt(min, max, iter) {
  5522. iter = iter == 0 ? 1 : iter;
  5523. var arr = [];
  5524. for (var i = 0; i < iter; i++) {
  5525. arr[i] = Math.random();
  5526. };
  5527. return Math.floor(arr.reduce(function (i, j) {return i + j;}) / iter * (max - min)) + min;
  5528. };
  5529. function collisionNew(area, points, width, height) {
  5530. var isIn = false;
  5531. for (var i = 0; i < points.length; i++) {
  5532. if (points[i].area) {
  5533. 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]) {
  5534. if (area[0] < 0 || area[1] < 0 || area[2] > width || area[3] > height) {
  5535. isIn = true;
  5536. break;
  5537. } else {
  5538. isIn = false;
  5539. }
  5540. } else {
  5541. isIn = true;
  5542. break;
  5543. }
  5544. }
  5545. }
  5546. return isIn;
  5547. };
  5548. function getBoundingBox(data) {
  5549. var bounds = {},coords;
  5550. bounds.xMin = 180;
  5551. bounds.xMax = 0;
  5552. bounds.yMin = 90;
  5553. bounds.yMax = 0;
  5554. for (var i = 0; i < data.length; i++) {
  5555. var coorda = data[i].geometry.coordinates;
  5556. for (var k = 0; k < coorda.length; k++) {
  5557. coords = coorda[k];
  5558. if (coords.length == 1) {
  5559. coords = coords[0];
  5560. }
  5561. for (var j = 0; j < coords.length; j++) {
  5562. var longitude = coords[j][0];
  5563. var latitude = coords[j][1];
  5564. var point = {
  5565. x: longitude,
  5566. y: latitude };
  5567. bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
  5568. bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
  5569. bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
  5570. bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
  5571. }
  5572. }
  5573. }
  5574. return bounds;
  5575. }
  5576. function coordinateToPoint(latitude, longitude, bounds, scale, xoffset, yoffset) {
  5577. return {
  5578. x: (longitude - bounds.xMin) * scale + xoffset,
  5579. y: (bounds.yMax - latitude) * scale + yoffset };
  5580. }
  5581. function pointToCoordinate(pointY, pointX, bounds, scale, xoffset, yoffset) {
  5582. return {
  5583. x: (pointX - xoffset) / scale + bounds.xMin,
  5584. y: bounds.yMax - (pointY - yoffset) / scale };
  5585. }
  5586. function isRayIntersectsSegment(poi, s_poi, e_poi) {
  5587. if (s_poi[1] == e_poi[1]) {return false;}
  5588. if (s_poi[1] > poi[1] && e_poi[1] > poi[1]) {return false;}
  5589. if (s_poi[1] < poi[1] && e_poi[1] < poi[1]) {return false;}
  5590. if (s_poi[1] == poi[1] && e_poi[1] > poi[1]) {return false;}
  5591. if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) {return false;}
  5592. if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) {return false;}
  5593. var xseg = e_poi[0] - (e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1]) / (e_poi[1] - s_poi[1]);
  5594. if (xseg < poi[0]) {
  5595. return false;
  5596. } else {
  5597. return true;
  5598. }
  5599. }
  5600. function isPoiWithinPoly(poi, poly) {
  5601. var sinsc = 0;
  5602. for (var i = 0; i < poly.length; i++) {
  5603. var epoly = poly[i][0];
  5604. if (poly.length == 1) {
  5605. epoly = poly[i][0];
  5606. }
  5607. for (var j = 0; j < epoly.length - 1; j++) {
  5608. var s_poi = epoly[j];
  5609. var e_poi = epoly[j + 1];
  5610. if (isRayIntersectsSegment(poi, s_poi, e_poi)) {
  5611. sinsc += 1;
  5612. }
  5613. }
  5614. }
  5615. if (sinsc % 2 == 1) {
  5616. return true;
  5617. } else {
  5618. return false;
  5619. }
  5620. }
  5621. function drawMapDataPoints(series, opts, config, context) {
  5622. var mapOption = assign({}, {
  5623. border: true,
  5624. borderWidth: 1,
  5625. borderColor: '#666666',
  5626. fillOpacity: 0.6,
  5627. activeBorderColor: '#f04864',
  5628. activeFillColor: '#facc14',
  5629. activeFillOpacity: 1 },
  5630. opts.extra.map);
  5631. var coords, point;
  5632. var data = series;
  5633. var bounds = getBoundingBox(data);
  5634. var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
  5635. var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
  5636. var scale = xScale < yScale ? xScale : yScale;
  5637. var xoffset = opts.width / 2 - Math.abs(bounds.xMax - bounds.xMin) / 2 * scale;
  5638. var yoffset = opts.height / 2 - Math.abs(bounds.yMax - bounds.yMin) / 2 * scale;
  5639. context.beginPath();
  5640. context.clearRect(0, 0, opts.width, opts.height);
  5641. context.setFillStyle(opts.background || '#FFFFFF');
  5642. context.rect(0, 0, opts.width, opts.height);
  5643. context.fill();
  5644. for (var i = 0; i < data.length; i++) {
  5645. context.beginPath();
  5646. context.setLineWidth(mapOption.borderWidth * opts.pixelRatio);
  5647. context.setStrokeStyle(mapOption.borderColor);
  5648. context.setFillStyle(hexToRgb(series[i].color, mapOption.fillOpacity));
  5649. if (opts.tooltip) {
  5650. if (opts.tooltip.index == i) {
  5651. context.setStrokeStyle(mapOption.activeBorderColor);
  5652. context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
  5653. }
  5654. }
  5655. var coorda = data[i].geometry.coordinates;
  5656. for (var k = 0; k < coorda.length; k++) {
  5657. coords = coorda[k];
  5658. if (coords.length == 1) {
  5659. coords = coords[0];
  5660. }
  5661. for (var j = 0; j < coords.length; j++) {
  5662. point = coordinateToPoint(coords[j][1], coords[j][0], bounds, scale, xoffset, yoffset);
  5663. if (j === 0) {
  5664. context.beginPath();
  5665. context.moveTo(point.x, point.y);
  5666. } else {
  5667. context.lineTo(point.x, point.y);
  5668. }
  5669. }
  5670. context.fill();
  5671. if (mapOption.border == true) {
  5672. context.stroke();
  5673. }
  5674. }
  5675. if (opts.dataLabel == true) {
  5676. var centerPoint = data[i].properties.centroid;
  5677. if (centerPoint) {
  5678. point = coordinateToPoint(centerPoint[1], centerPoint[0], bounds, scale, xoffset, yoffset);
  5679. var fontSize = data[i].textSize || config.fontSize;
  5680. var text = data[i].properties.name;
  5681. context.beginPath();
  5682. context.setFontSize(fontSize);
  5683. context.setFillStyle(data[i].textColor || '#666666');
  5684. context.fillText(text, point.x - measureText(text, fontSize) / 2, point.y + fontSize / 2);
  5685. context.closePath();
  5686. context.stroke();
  5687. }
  5688. }
  5689. }
  5690. opts.chartData.mapData = {
  5691. bounds: bounds,
  5692. scale: scale,
  5693. xoffset: xoffset,
  5694. yoffset: yoffset };
  5695. drawToolTipBridge(opts, config, context, 1);
  5696. context.draw();
  5697. }
  5698. function getWordCloudPoint(opts, type) {
  5699. var points = opts.series.sort(function (a, b) {return parseInt(b.textSize) - parseInt(a.textSize);});
  5700. switch (type) {
  5701. case 'normal':
  5702. for (var i = 0; i < points.length; i++) {
  5703. var text = points[i].name;
  5704. var tHeight = points[i].textSize;
  5705. var tWidth = measureText(text, tHeight);
  5706. var x = void 0,y = void 0;
  5707. var area = void 0;
  5708. var breaknum = 0;
  5709. while (true) {
  5710. breaknum++;
  5711. x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2;
  5712. y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2;
  5713. area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / 2, y + 5 + opts.height / 2];
  5714. var isCollision = collisionNew(area, points, opts.width, opts.height);
  5715. if (!isCollision) break;
  5716. if (breaknum == 1000) {
  5717. area = [-100, -100, -100, -100];
  5718. break;
  5719. }
  5720. };
  5721. points[i].area = area;
  5722. }
  5723. break;
  5724. case 'vertical':var
  5725. Spin = function Spin() {
  5726. //获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
  5727. if (Math.random() > 0.7) {
  5728. return true;
  5729. } else {return false;};
  5730. };;
  5731. for (var _i15 = 0; _i15 < points.length; _i15++) {
  5732. var _text = points[_i15].name;
  5733. var _tHeight = points[_i15].textSize;
  5734. var _tWidth = measureText(_text, _tHeight);
  5735. var isSpin = Spin();
  5736. var _x = void 0,_y = void 0,_area = void 0,areav = void 0;
  5737. var _breaknum = 0;
  5738. while (true) {
  5739. _breaknum++;
  5740. var _isCollision = void 0;
  5741. if (isSpin) {
  5742. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  5743. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  5744. _area = [_y - 5 - _tWidth + opts.width / 2, -_x - 5 + opts.height / 2, _y + 5 + opts.width / 2, -_x + _tHeight + 5 + opts.height / 2];
  5745. 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];
  5746. _isCollision = collisionNew(areav, points, opts.height, opts.width);
  5747. } else {
  5748. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  5749. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  5750. _area = [_x - 5 + opts.width / 2, _y - 5 - _tHeight + opts.height / 2, _x + _tWidth + 5 + opts.width / 2, _y + 5 + opts.height / 2];
  5751. _isCollision = collisionNew(_area, points, opts.width, opts.height);
  5752. }
  5753. if (!_isCollision) break;
  5754. if (_breaknum == 1000) {
  5755. _area = [-1000, -1000, -1000, -1000];
  5756. break;
  5757. }
  5758. };
  5759. if (isSpin) {
  5760. points[_i15].area = areav;
  5761. points[_i15].areav = _area;
  5762. } else {
  5763. points[_i15].area = _area;
  5764. }
  5765. points[_i15].rotate = isSpin;
  5766. };
  5767. break;}
  5768. return points;
  5769. }
  5770. function drawWordCloudDataPoints(series, opts, config, context) {
  5771. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5772. var wordOption = assign({}, {
  5773. type: 'normal',
  5774. autoColors: true },
  5775. opts.extra.word);
  5776. context.beginPath();
  5777. context.setFillStyle(opts.background || '#FFFFFF');
  5778. context.rect(0, 0, opts.width, opts.height);
  5779. context.fill();
  5780. context.save();
  5781. var points = opts.chartData.wordCloudData;
  5782. context.translate(opts.width / 2, opts.height / 2);
  5783. for (var i = 0; i < points.length; i++) {
  5784. context.save();
  5785. if (points[i].rotate) {
  5786. context.rotate(90 * Math.PI / 180);
  5787. }
  5788. var text = points[i].name;
  5789. var tHeight = points[i].textSize;
  5790. var tWidth = measureText(text, tHeight);
  5791. context.beginPath();
  5792. context.setStrokeStyle(points[i].color);
  5793. context.setFillStyle(points[i].color);
  5794. context.setFontSize(tHeight);
  5795. if (points[i].rotate) {
  5796. if (points[i].areav[0] > 0) {
  5797. if (opts.tooltip) {
  5798. if (opts.tooltip.index == i) {
  5799. 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);
  5800. } else {
  5801. 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);
  5802. }
  5803. } else {
  5804. 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);
  5805. }
  5806. }
  5807. } else {
  5808. if (points[i].area[0] > 0) {
  5809. if (opts.tooltip) {
  5810. if (opts.tooltip.index == i) {
  5811. 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);
  5812. } else {
  5813. 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);
  5814. }
  5815. } else {
  5816. 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);
  5817. }
  5818. }
  5819. }
  5820. context.stroke();
  5821. context.restore();
  5822. }
  5823. context.restore();
  5824. }
  5825. function drawFunnelDataPoints(series, opts, config, context) {
  5826. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5827. var funnelOption = assign({}, {
  5828. activeWidth: 10,
  5829. activeOpacity: 0.3,
  5830. border: false,
  5831. borderWidth: 2,
  5832. borderColor: '#FFFFFF',
  5833. fillOpacity: 1,
  5834. labelAlign: 'right' },
  5835. opts.extra.funnel);
  5836. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length;
  5837. var centerPosition = {
  5838. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  5839. y: opts.height - opts.area[2] };
  5840. var activeWidth = funnelOption.activeWidth;
  5841. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
  5842. series = getFunnelDataPoints(series, radius, process);
  5843. context.save();
  5844. context.translate(centerPosition.x, centerPosition.y);
  5845. for (var i = 0; i < series.length; i++) {
  5846. if (i == 0) {
  5847. if (opts.tooltip) {
  5848. if (opts.tooltip.index == i) {
  5849. context.beginPath();
  5850. context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
  5851. context.moveTo(-activeWidth, 0);
  5852. context.lineTo(-series[i].radius - activeWidth, -eachSpacing);
  5853. context.lineTo(series[i].radius + activeWidth, -eachSpacing);
  5854. context.lineTo(activeWidth, 0);
  5855. context.lineTo(-activeWidth, 0);
  5856. context.closePath();
  5857. context.fill();
  5858. }
  5859. }
  5860. series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing, centerPosition.x + series[i].radius, centerPosition.y];
  5861. context.beginPath();
  5862. context.setLineWidth(funnelOption.borderWidth * opts.pixelRatio);
  5863. context.setStrokeStyle(funnelOption.borderColor);
  5864. context.setFillStyle(hexToRgb(series[i].color, funnelOption.fillOpacity));
  5865. context.moveTo(0, 0);
  5866. context.lineTo(-series[i].radius, -eachSpacing);
  5867. context.lineTo(series[i].radius, -eachSpacing);
  5868. context.lineTo(0, 0);
  5869. context.closePath();
  5870. context.fill();
  5871. if (funnelOption.border == true) {
  5872. context.stroke();
  5873. }
  5874. } else {
  5875. if (opts.tooltip) {
  5876. if (opts.tooltip.index == i) {
  5877. context.beginPath();
  5878. context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
  5879. context.moveTo(0, 0);
  5880. context.lineTo(-series[i - 1].radius - activeWidth, 0);
  5881. context.lineTo(-series[i].radius - activeWidth, -eachSpacing);
  5882. context.lineTo(series[i].radius + activeWidth, -eachSpacing);
  5883. context.lineTo(series[i - 1].radius + activeWidth, 0);
  5884. context.lineTo(0, 0);
  5885. context.closePath();
  5886. context.fill();
  5887. context.closePath();
  5888. context.fill();
  5889. }
  5890. }
  5891. series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + series[i].radius, centerPosition.y - eachSpacing * i];
  5892. context.beginPath();
  5893. context.setLineWidth(funnelOption.borderWidth * opts.pixelRatio);
  5894. context.setStrokeStyle(funnelOption.borderColor);
  5895. context.setFillStyle(hexToRgb(series[i].color, funnelOption.fillOpacity));
  5896. context.moveTo(0, 0);
  5897. context.lineTo(-series[i - 1].radius, 0);
  5898. context.lineTo(-series[i].radius, -eachSpacing);
  5899. context.lineTo(series[i].radius, -eachSpacing);
  5900. context.lineTo(series[i - 1].radius, 0);
  5901. context.lineTo(0, 0);
  5902. context.closePath();
  5903. context.fill();
  5904. if (funnelOption.border == true) {
  5905. context.stroke();
  5906. }
  5907. }
  5908. context.translate(0, -eachSpacing);
  5909. }
  5910. context.restore();
  5911. if (opts.dataLabel !== false && process === 1) {
  5912. drawFunnelText(series, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  5913. }
  5914. return {
  5915. center: centerPosition,
  5916. radius: radius,
  5917. series: series };
  5918. }
  5919. function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  5920. for (var i = 0; i < series.length; i++) {
  5921. var item = series[i];
  5922. var startX = void 0,endX = void 0,startY = void 0,fontSize = void 0;
  5923. var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
  5924. if (labelAlign == 'right') {
  5925. if (i == 0) {
  5926. startX = (item.funnelArea[2] + centerPosition.x) / 2;
  5927. } else {
  5928. startX = (item.funnelArea[2] + series[i - 1].funnelArea[2]) / 2;
  5929. }
  5930. endX = startX + activeWidth * 2;
  5931. startY = item.funnelArea[1] + eachSpacing / 2;
  5932. fontSize = item.textSize || opts.fontSize;
  5933. context.setLineWidth(1 * opts.pixelRatio);
  5934. context.setStrokeStyle(item.color);
  5935. context.setFillStyle(item.color);
  5936. context.beginPath();
  5937. context.moveTo(startX, startY);
  5938. context.lineTo(endX, startY);
  5939. context.stroke();
  5940. context.closePath();
  5941. context.beginPath();
  5942. context.moveTo(endX, startY);
  5943. context.arc(endX, startY, 2, 0, 2 * Math.PI);
  5944. context.closePath();
  5945. context.fill();
  5946. context.beginPath();
  5947. context.setFontSize(fontSize);
  5948. context.setFillStyle(item.textColor || '#666666');
  5949. context.fillText(text, endX + 5, startY + fontSize / 2 - 2);
  5950. context.closePath();
  5951. context.stroke();
  5952. context.closePath();
  5953. } else {
  5954. if (i == 0) {
  5955. startX = (item.funnelArea[0] + centerPosition.x) / 2;
  5956. } else {
  5957. startX = (item.funnelArea[0] + series[i - 1].funnelArea[0]) / 2;
  5958. }
  5959. endX = startX - activeWidth * 2;
  5960. startY = item.funnelArea[1] + eachSpacing / 2;
  5961. fontSize = item.textSize || opts.fontSize;
  5962. context.setLineWidth(1 * opts.pixelRatio);
  5963. context.setStrokeStyle(item.color);
  5964. context.setFillStyle(item.color);
  5965. context.beginPath();
  5966. context.moveTo(startX, startY);
  5967. context.lineTo(endX, startY);
  5968. context.stroke();
  5969. context.closePath();
  5970. context.beginPath();
  5971. context.moveTo(endX, startY);
  5972. context.arc(endX, startY, 2, 0, 2 * Math.PI);
  5973. context.closePath();
  5974. context.fill();
  5975. context.beginPath();
  5976. context.setFontSize(fontSize);
  5977. context.setFillStyle(item.textColor || '#666666');
  5978. context.fillText(text, endX - 5 - measureText(text), startY + fontSize / 2 - 2);
  5979. context.closePath();
  5980. context.stroke();
  5981. context.closePath();
  5982. }
  5983. }
  5984. }
  5985. function drawCanvas(opts, context) {
  5986. context.draw();
  5987. }
  5988. var Timing = {
  5989. easeIn: function easeIn(pos) {
  5990. return Math.pow(pos, 3);
  5991. },
  5992. easeOut: function easeOut(pos) {
  5993. return Math.pow(pos - 1, 3) + 1;
  5994. },
  5995. easeInOut: function easeInOut(pos) {
  5996. if ((pos /= 0.5) < 1) {
  5997. return 0.5 * Math.pow(pos, 3);
  5998. } else {
  5999. return 0.5 * (Math.pow(pos - 2, 3) + 2);
  6000. }
  6001. },
  6002. linear: function linear(pos) {
  6003. return pos;
  6004. } };
  6005. function Animation(opts) {
  6006. this.isStop = false;
  6007. opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
  6008. opts.timing = opts.timing || 'linear';
  6009. var delay = 17;
  6010. function createAnimationFrame() {
  6011. if (typeof setTimeout !== 'undefined') {
  6012. return function (step, delay) {
  6013. setTimeout(function () {
  6014. var timeStamp = +new Date();
  6015. step(timeStamp);
  6016. }, delay);
  6017. };
  6018. } else if (typeof requestAnimationFrame !== 'undefined') {
  6019. return requestAnimationFrame;
  6020. } else {
  6021. return function (step) {
  6022. step(null);
  6023. };
  6024. }
  6025. };
  6026. var animationFrame = createAnimationFrame();
  6027. var startTimeStamp = null;
  6028. var _step = function step(timestamp) {
  6029. if (timestamp === null || this.isStop === true) {
  6030. opts.onProcess && opts.onProcess(1);
  6031. opts.onAnimationFinish && opts.onAnimationFinish();
  6032. return;
  6033. }
  6034. if (startTimeStamp === null) {
  6035. startTimeStamp = timestamp;
  6036. }
  6037. if (timestamp - startTimeStamp < opts.duration) {
  6038. var process = (timestamp - startTimeStamp) / opts.duration;
  6039. var timingFunction = Timing[opts.timing];
  6040. process = timingFunction(process);
  6041. opts.onProcess && opts.onProcess(process);
  6042. animationFrame(_step, delay);
  6043. } else {
  6044. opts.onProcess && opts.onProcess(1);
  6045. opts.onAnimationFinish && opts.onAnimationFinish();
  6046. }
  6047. };
  6048. _step = _step.bind(this);
  6049. animationFrame(_step, delay);
  6050. }
  6051. // stop animation immediately
  6052. // and tigger onAnimationFinish
  6053. Animation.prototype.stop = function () {
  6054. this.isStop = true;
  6055. };
  6056. function drawCharts(type, opts, config, context) {
  6057. var _this = this;
  6058. var series = opts.series;
  6059. var categories = opts.categories;
  6060. series = fillSeries(series, opts, config);
  6061. var duration = opts.animation ? opts.duration : 0;
  6062. this.animationInstance && this.animationInstance.stop();
  6063. var seriesMA = null;
  6064. if (type == 'candle') {
  6065. var average = assign({}, opts.extra.candle.average);
  6066. if (average.show) {
  6067. seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data);
  6068. seriesMA = fillSeries(seriesMA, opts, config);
  6069. opts.seriesMA = seriesMA;
  6070. } else if (opts.seriesMA) {
  6071. seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config);
  6072. } else {
  6073. seriesMA = series;
  6074. }
  6075. } else {
  6076. seriesMA = series;
  6077. }
  6078. /* 过滤掉show=false的series */
  6079. opts._series_ = series = filterSeries(series);
  6080. //重新计算图表区域
  6081. opts.area = new Array(4);
  6082. //复位绘图区域
  6083. for (var j = 0; j < 4; j++) {
  6084. opts.area[j] = opts.padding[j];
  6085. }
  6086. //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域
  6087. var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData),
  6088. legendHeight = _calLegendData.area.wholeHeight,
  6089. legendWidth = _calLegendData.area.wholeWidth;
  6090. //TODO废弃config.legendHeight参数
  6091. config.legendHeight = legendHeight;
  6092. switch (opts.legend.position) {
  6093. case 'top':
  6094. opts.area[0] += legendHeight;
  6095. break;
  6096. case 'bottom':
  6097. opts.area[2] += legendHeight;
  6098. break;
  6099. case 'left':
  6100. opts.area[3] += legendWidth;
  6101. break;
  6102. case 'right':
  6103. opts.area[1] += legendWidth;
  6104. break;}
  6105. var _calYAxisData = {},yAxisWidth = 0;
  6106. if (opts.type === 'line' || opts.type === 'column' || opts.type === 'area' || opts.type === 'mix' || opts.type === 'candle') {
  6107. _calYAxisData = calYAxisData(series, opts, config);
  6108. yAxisWidth = _calYAxisData.yAxisWidth;
  6109. config.yAxisWidth = yAxisWidth;
  6110. opts.area[3] += yAxisWidth;
  6111. } else {
  6112. config.yAxisWidth = yAxisWidth;
  6113. }
  6114. opts.chartData.yAxisData = _calYAxisData;
  6115. if (opts.categories && opts.categories.length) {
  6116. opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config);
  6117. var _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing),
  6118. xAxisHeight = _calCategoriesData.xAxisHeight,
  6119. angle = _calCategoriesData.angle;
  6120. config.xAxisHeight = xAxisHeight;
  6121. config._xAxisTextAngle_ = angle;
  6122. opts.area[2] += xAxisHeight;
  6123. opts.chartData.categoriesData = _calCategoriesData;
  6124. }
  6125. //计算右对齐偏移距离
  6126. if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) {
  6127. var offsetLeft = 0,
  6128. xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  6129. startX = opts.chartData.xAxisData.startX,
  6130. endX = opts.chartData.xAxisData.endX,
  6131. eachSpacing = opts.chartData.xAxisData.eachSpacing;
  6132. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  6133. var screenWidth = endX - startX;
  6134. offsetLeft = screenWidth - totalWidth;
  6135. _this.scrollOption = {
  6136. currentOffset: offsetLeft,
  6137. startTouchX: offsetLeft,
  6138. distance: 0,
  6139. lastMoveTime: 0 };
  6140. opts._scrollDistance_ = offsetLeft;
  6141. }
  6142. if (type === 'pie' || type === 'ring' || type === 'rose') {
  6143. config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA);
  6144. }
  6145. switch (type) {
  6146. case 'word':
  6147. var wordOption = assign({}, {
  6148. type: 'normal',
  6149. autoColors: true },
  6150. opts.extra.word);
  6151. if (opts.updateData == true || opts.updateData == undefined) {
  6152. opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type);
  6153. }
  6154. this.animationInstance = new Animation({
  6155. timing: 'easeInOut',
  6156. duration: duration,
  6157. onProcess: function onProcess(process) {
  6158. context.clearRect(0, 0, opts.width, opts.height);
  6159. if (opts.rotate) {
  6160. contextRotate(context, opts);
  6161. }
  6162. drawWordCloudDataPoints(series, opts, config, context, process);
  6163. drawCanvas(opts, context);
  6164. },
  6165. onAnimationFinish: function onAnimationFinish() {
  6166. _this.event.trigger('renderComplete');
  6167. } });
  6168. break;
  6169. case 'map':
  6170. context.clearRect(0, 0, opts.width, opts.height);
  6171. drawMapDataPoints(series, opts, config, context);
  6172. break;
  6173. case 'funnel':
  6174. this.animationInstance = new Animation({
  6175. timing: 'easeInOut',
  6176. duration: duration,
  6177. onProcess: function onProcess(process) {
  6178. context.clearRect(0, 0, opts.width, opts.height);
  6179. if (opts.rotate) {
  6180. contextRotate(context, opts);
  6181. }
  6182. opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, process);
  6183. drawLegend(opts.series, opts, config, context, opts.chartData);
  6184. drawToolTipBridge(opts, config, context, process);
  6185. drawCanvas(opts, context);
  6186. },
  6187. onAnimationFinish: function onAnimationFinish() {
  6188. _this.event.trigger('renderComplete');
  6189. } });
  6190. break;
  6191. case 'line':
  6192. this.animationInstance = new Animation({
  6193. timing: 'easeIn',
  6194. duration: duration,
  6195. onProcess: function onProcess(process) {
  6196. context.clearRect(0, 0, opts.width, opts.height);
  6197. if (opts.rotate) {
  6198. contextRotate(context, opts);
  6199. }
  6200. drawYAxisGrid(categories, opts, config, context);
  6201. drawXAxis(categories, opts, config, context);
  6202. var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process),
  6203. xAxisPoints = _drawLineDataPoints.xAxisPoints,
  6204. calPoints = _drawLineDataPoints.calPoints,
  6205. eachSpacing = _drawLineDataPoints.eachSpacing,
  6206. minRange = _drawLineDataPoints.minRange,
  6207. maxRange = _drawLineDataPoints.maxRange;
  6208. opts.chartData.xAxisPoints = xAxisPoints;
  6209. opts.chartData.calPoints = calPoints;
  6210. opts.chartData.eachSpacing = eachSpacing;
  6211. drawYAxis(series, opts, config, context);
  6212. if (opts.enableMarkLine !== false && process === 1) {
  6213. drawMarkLine(minRange, maxRange, opts, config, context);
  6214. }
  6215. drawLegend(opts.series, opts, config, context, opts.chartData);
  6216. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6217. drawCanvas(opts, context);
  6218. },
  6219. onAnimationFinish: function onAnimationFinish() {
  6220. _this.event.trigger('renderComplete');
  6221. } });
  6222. break;
  6223. case 'mix':
  6224. this.animationInstance = new Animation({
  6225. timing: 'easeIn',
  6226. duration: duration,
  6227. onProcess: function onProcess(process) {
  6228. context.clearRect(0, 0, opts.width, opts.height);
  6229. if (opts.rotate) {
  6230. contextRotate(context, opts);
  6231. }
  6232. drawYAxisGrid(categories, opts, config, context);
  6233. drawXAxis(categories, opts, config, context);
  6234. var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process),
  6235. xAxisPoints = _drawMixDataPoints.xAxisPoints,
  6236. calPoints = _drawMixDataPoints.calPoints,
  6237. eachSpacing = _drawMixDataPoints.eachSpacing,
  6238. minRange = _drawMixDataPoints.minRange,
  6239. maxRange = _drawMixDataPoints.maxRange;
  6240. opts.chartData.xAxisPoints = xAxisPoints;
  6241. opts.chartData.calPoints = calPoints;
  6242. opts.chartData.eachSpacing = eachSpacing;
  6243. drawYAxis(series, opts, config, context);
  6244. if (opts.enableMarkLine !== false && process === 1) {
  6245. drawMarkLine(minRange, maxRange, opts, config, context);
  6246. }
  6247. drawLegend(opts.series, opts, config, context, opts.chartData);
  6248. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6249. drawCanvas(opts, context);
  6250. },
  6251. onAnimationFinish: function onAnimationFinish() {
  6252. _this.event.trigger('renderComplete');
  6253. } });
  6254. break;
  6255. case 'column':
  6256. this.animationInstance = new Animation({
  6257. timing: 'easeIn',
  6258. duration: duration,
  6259. onProcess: function onProcess(process) {
  6260. context.clearRect(0, 0, opts.width, opts.height);
  6261. if (opts.rotate) {
  6262. contextRotate(context, opts);
  6263. }
  6264. drawYAxisGrid(categories, opts, config, context);
  6265. drawXAxis(categories, opts, config, context);
  6266. var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process),
  6267. xAxisPoints = _drawColumnDataPoints.xAxisPoints,
  6268. calPoints = _drawColumnDataPoints.calPoints,
  6269. eachSpacing = _drawColumnDataPoints.eachSpacing,
  6270. minRange = _drawColumnDataPoints.minRange,
  6271. maxRange = _drawColumnDataPoints.maxRange;
  6272. opts.chartData.xAxisPoints = xAxisPoints;
  6273. opts.chartData.calPoints = calPoints;
  6274. opts.chartData.eachSpacing = eachSpacing;
  6275. drawYAxis(series, opts, config, context);
  6276. if (opts.enableMarkLine !== false && process === 1) {
  6277. drawMarkLine(minRange, maxRange, opts, config, context);
  6278. }
  6279. drawLegend(opts.series, opts, config, context, opts.chartData);
  6280. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6281. drawCanvas(opts, context);
  6282. },
  6283. onAnimationFinish: function onAnimationFinish() {
  6284. _this.event.trigger('renderComplete');
  6285. } });
  6286. break;
  6287. case 'area':
  6288. this.animationInstance = new Animation({
  6289. timing: 'easeIn',
  6290. duration: duration,
  6291. onProcess: function onProcess(process) {
  6292. context.clearRect(0, 0, opts.width, opts.height);
  6293. if (opts.rotate) {
  6294. contextRotate(context, opts);
  6295. }
  6296. drawYAxisGrid(categories, opts, config, context);
  6297. drawXAxis(categories, opts, config, context);
  6298. var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process),
  6299. xAxisPoints = _drawAreaDataPoints.xAxisPoints,
  6300. calPoints = _drawAreaDataPoints.calPoints,
  6301. eachSpacing = _drawAreaDataPoints.eachSpacing,
  6302. minRange = _drawAreaDataPoints.minRange,
  6303. maxRange = _drawAreaDataPoints.maxRange;
  6304. opts.chartData.xAxisPoints = xAxisPoints;
  6305. opts.chartData.calPoints = calPoints;
  6306. opts.chartData.eachSpacing = eachSpacing;
  6307. drawYAxis(series, opts, config, context);
  6308. if (opts.enableMarkLine !== false && process === 1) {
  6309. drawMarkLine(minRange, maxRange, opts, config, context);
  6310. }
  6311. drawLegend(opts.series, opts, config, context, opts.chartData);
  6312. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6313. drawCanvas(opts, context);
  6314. },
  6315. onAnimationFinish: function onAnimationFinish() {
  6316. _this.event.trigger('renderComplete');
  6317. } });
  6318. break;
  6319. case 'ring':
  6320. case 'pie':
  6321. this.animationInstance = new Animation({
  6322. timing: 'easeInOut',
  6323. duration: duration,
  6324. onProcess: function onProcess(process) {
  6325. context.clearRect(0, 0, opts.width, opts.height);
  6326. if (opts.rotate) {
  6327. contextRotate(context, opts);
  6328. }
  6329. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  6330. drawLegend(opts.series, opts, config, context, opts.chartData);
  6331. drawToolTipBridge(opts, config, context, process);
  6332. drawCanvas(opts, context);
  6333. },
  6334. onAnimationFinish: function onAnimationFinish() {
  6335. _this.event.trigger('renderComplete');
  6336. } });
  6337. break;
  6338. case 'rose':
  6339. this.animationInstance = new Animation({
  6340. timing: 'easeInOut',
  6341. duration: duration,
  6342. onProcess: function onProcess(process) {
  6343. context.clearRect(0, 0, opts.width, opts.height);
  6344. if (opts.rotate) {
  6345. contextRotate(context, opts);
  6346. }
  6347. opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process);
  6348. drawLegend(opts.series, opts, config, context, opts.chartData);
  6349. drawToolTipBridge(opts, config, context, process);
  6350. drawCanvas(opts, context);
  6351. },
  6352. onAnimationFinish: function onAnimationFinish() {
  6353. _this.event.trigger('renderComplete');
  6354. } });
  6355. break;
  6356. case 'radar':
  6357. this.animationInstance = new Animation({
  6358. timing: 'easeInOut',
  6359. duration: duration,
  6360. onProcess: function onProcess(process) {
  6361. context.clearRect(0, 0, opts.width, opts.height);
  6362. if (opts.rotate) {
  6363. contextRotate(context, opts);
  6364. }
  6365. opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process);
  6366. drawLegend(opts.series, opts, config, context, opts.chartData);
  6367. drawToolTipBridge(opts, config, context, process);
  6368. drawCanvas(opts, context);
  6369. },
  6370. onAnimationFinish: function onAnimationFinish() {
  6371. _this.event.trigger('renderComplete');
  6372. } });
  6373. break;
  6374. case 'arcbar':
  6375. this.animationInstance = new Animation({
  6376. timing: 'easeInOut',
  6377. duration: duration,
  6378. onProcess: function onProcess(process) {
  6379. context.clearRect(0, 0, opts.width, opts.height);
  6380. if (opts.rotate) {
  6381. contextRotate(context, opts);
  6382. }
  6383. opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, process);
  6384. drawCanvas(opts, context);
  6385. },
  6386. onAnimationFinish: function onAnimationFinish() {
  6387. _this.event.trigger('renderComplete');
  6388. } });
  6389. break;
  6390. case 'gauge':
  6391. this.animationInstance = new Animation({
  6392. timing: 'easeInOut',
  6393. duration: duration,
  6394. onProcess: function onProcess(process) {
  6395. context.clearRect(0, 0, opts.width, opts.height);
  6396. if (opts.rotate) {
  6397. contextRotate(context, opts);
  6398. }
  6399. opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, context, process);
  6400. drawCanvas(opts, context);
  6401. },
  6402. onAnimationFinish: function onAnimationFinish() {
  6403. _this.event.trigger('renderComplete');
  6404. } });
  6405. break;
  6406. case 'candle':
  6407. this.animationInstance = new Animation({
  6408. timing: 'easeIn',
  6409. duration: duration,
  6410. onProcess: function onProcess(process) {
  6411. context.clearRect(0, 0, opts.width, opts.height);
  6412. if (opts.rotate) {
  6413. contextRotate(context, opts);
  6414. }
  6415. drawYAxisGrid(categories, opts, config, context);
  6416. drawXAxis(categories, opts, config, context);
  6417. var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, context, process),
  6418. xAxisPoints = _drawCandleDataPoints.xAxisPoints,
  6419. calPoints = _drawCandleDataPoints.calPoints,
  6420. eachSpacing = _drawCandleDataPoints.eachSpacing,
  6421. minRange = _drawCandleDataPoints.minRange,
  6422. maxRange = _drawCandleDataPoints.maxRange;
  6423. opts.chartData.xAxisPoints = xAxisPoints;
  6424. opts.chartData.calPoints = calPoints;
  6425. opts.chartData.eachSpacing = eachSpacing;
  6426. drawYAxis(series, opts, config, context);
  6427. if (opts.enableMarkLine !== false && process === 1) {
  6428. drawMarkLine(minRange, maxRange, opts, config, context);
  6429. }
  6430. if (seriesMA) {
  6431. drawLegend(seriesMA, opts, config, context, opts.chartData);
  6432. } else {
  6433. drawLegend(opts.series, opts, config, context, opts.chartData);
  6434. }
  6435. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6436. drawCanvas(opts, context);
  6437. },
  6438. onAnimationFinish: function onAnimationFinish() {
  6439. _this.event.trigger('renderComplete');
  6440. } });
  6441. break;}
  6442. }
  6443. // simple event implement
  6444. function Event() {
  6445. this.events = {};
  6446. }
  6447. Event.prototype.addEventListener = function (type, listener) {
  6448. this.events[type] = this.events[type] || [];
  6449. this.events[type].push(listener);
  6450. };
  6451. Event.prototype.trigger = function () {
  6452. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  6453. args[_key] = arguments[_key];
  6454. }
  6455. var type = args[0];
  6456. var params = args.slice(1);
  6457. if (!!this.events[type]) {
  6458. this.events[type].forEach(function (listener) {
  6459. try {
  6460. listener.apply(null, params);
  6461. } catch (e) {
  6462. console.error(e);
  6463. }
  6464. });
  6465. }
  6466. };
  6467. var Charts = function Charts(opts) {
  6468. opts.pixelRatio = opts.pixelRatio ? opts.pixelRatio : 1;
  6469. opts.fontSize = opts.fontSize ? opts.fontSize * opts.pixelRatio : 13 * opts.pixelRatio;
  6470. opts.title = assign({}, opts.title);
  6471. opts.subtitle = assign({}, opts.subtitle);
  6472. opts.duration = opts.duration ? opts.duration : 1000;
  6473. opts.yAxis = assign({}, {
  6474. gridType: 'solid',
  6475. dashLength: 4 * opts.pixelRatio },
  6476. opts.yAxis);
  6477. opts.xAxis = assign({}, {
  6478. rotateLabel: false,
  6479. type: 'calibration',
  6480. gridType: 'solid',
  6481. dashLength: 4 * opts.pixelRatio,
  6482. scrollAlign: 'left',
  6483. boundaryGap: 'center' },
  6484. opts.xAxis);
  6485. opts.legend = assign({}, {
  6486. show: true,
  6487. position: 'bottom',
  6488. float: 'center',
  6489. backgroundColor: 'rgba(0,0,0,0)',
  6490. borderColor: 'rgba(0,0,0,0)',
  6491. borderWidth: 0,
  6492. padding: 5,
  6493. margin: 5,
  6494. itemGap: 10,
  6495. fontSize: opts.fontSize,
  6496. lineHeight: opts.fontSize,
  6497. fontColor: '#333333',
  6498. format: {},
  6499. hiddenColor: '#CECECE' },
  6500. opts.legend);
  6501. opts.legend.borderWidth = opts.legend.borderWidth * opts.pixelRatio;
  6502. opts.legend.itemGap = opts.legend.itemGap * opts.pixelRatio;
  6503. opts.legend.padding = opts.legend.padding * opts.pixelRatio;
  6504. opts.legend.margin = opts.legend.margin * opts.pixelRatio;
  6505. opts.extra = assign({}, opts.extra);
  6506. opts.rotate = opts.rotate ? true : false;
  6507. opts.animation = opts.animation ? true : false;
  6508. var config$$1 = JSON.parse(JSON.stringify(config));
  6509. config$$1.colors = opts.colors ? opts.colors : config$$1.colors;
  6510. config$$1.yAxisTitleWidth = opts.yAxis.disabled !== true && opts.yAxis.title ? config$$1.yAxisTitleWidth : 0;
  6511. if (opts.type == 'pie' || opts.type == 'ring') {
  6512. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
  6513. }
  6514. if (opts.type == 'rose') {
  6515. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
  6516. }
  6517. config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pixelRatio;
  6518. config$$1.yAxisSplit = opts.yAxis.splitNumber ? opts.yAxis.splitNumber : config.yAxisSplit;
  6519. //屏幕旋转
  6520. config$$1.rotate = opts.rotate;
  6521. if (opts.rotate) {
  6522. var tempWidth = opts.width;
  6523. var tempHeight = opts.height;
  6524. opts.width = tempHeight;
  6525. opts.height = tempWidth;
  6526. }
  6527. //适配高分屏
  6528. opts.padding = opts.padding ? opts.padding : config$$1.padding;
  6529. for (var i = 0; i < 4; i++) {
  6530. opts.padding[i] *= opts.pixelRatio;
  6531. }
  6532. config$$1.yAxisWidth = config.yAxisWidth * opts.pixelRatio;
  6533. config$$1.xAxisHeight = config.xAxisHeight * opts.pixelRatio;
  6534. if (opts.enableScroll && opts.xAxis.scrollShow) {
  6535. config$$1.xAxisHeight += 6 * opts.pixelRatio;
  6536. }
  6537. config$$1.xAxisLineHeight = config.xAxisLineHeight * opts.pixelRatio;
  6538. config$$1.legendHeight = config.legendHeight * opts.pixelRatio;
  6539. config$$1.fontSize = opts.fontSize;
  6540. config$$1.titleFontSize = config.titleFontSize * opts.pixelRatio;
  6541. config$$1.subtitleFontSize = config.subtitleFontSize * opts.pixelRatio;
  6542. config$$1.toolTipPadding = config.toolTipPadding * opts.pixelRatio;
  6543. config$$1.toolTipLineHeight = config.toolTipLineHeight * opts.pixelRatio;
  6544. config$$1.columePadding = config.columePadding * opts.pixelRatio;
  6545. opts.$this = opts.$this ? opts.$this : this;
  6546. this.context = uni.createCanvasContext(opts.canvasId, opts.$this);
  6547. /* 兼容原生H5
  6548. this.context = document.getElementById(opts.canvasId).getContext("2d");
  6549. this.context.setStrokeStyle = function(e){ return this.strokeStyle=e; }
  6550. this.context.setLineWidth = function(e){ return this.lineWidth=e; }
  6551. this.context.setLineCap = function(e){ return this.lineCap=e; }
  6552. this.context.setFontSize = function(e){ return this.font=e+"px sans-serif"; }
  6553. this.context.setFillStyle = function(e){ return this.fillStyle=e; }
  6554. this.context.draw = function(){ }
  6555. */
  6556. opts.chartData = {};
  6557. this.event = new Event();
  6558. this.scrollOption = {
  6559. currentOffset: 0,
  6560. startTouchX: 0,
  6561. distance: 0,
  6562. lastMoveTime: 0 };
  6563. this.opts = opts;
  6564. this.config = config$$1;
  6565. drawCharts.call(this, opts.type, opts, config$$1, this.context);
  6566. };
  6567. Charts.prototype.updateData = function () {
  6568. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  6569. this.opts = assign({}, this.opts, data);
  6570. this.opts.updateData = true;
  6571. var scrollPosition = data.scrollPosition || 'current';
  6572. switch (scrollPosition) {
  6573. case 'current':
  6574. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  6575. break;
  6576. case 'left':
  6577. this.opts._scrollDistance_ = 0;
  6578. this.scrollOption = {
  6579. currentOffset: 0,
  6580. startTouchX: 0,
  6581. distance: 0,
  6582. lastMoveTime: 0 };
  6583. break;
  6584. case 'right':
  6585. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config),
  6586. yAxisWidth = _calYAxisData.yAxisWidth;
  6587. this.config.yAxisWidth = yAxisWidth;
  6588. var offsetLeft = 0;
  6589. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  6590. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  6591. startX = _getXAxisPoints0.startX,
  6592. endX = _getXAxisPoints0.endX,
  6593. eachSpacing = _getXAxisPoints0.eachSpacing;
  6594. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  6595. var screenWidth = endX - startX;
  6596. offsetLeft = screenWidth - totalWidth;
  6597. this.scrollOption = {
  6598. currentOffset: offsetLeft,
  6599. startTouchX: offsetLeft,
  6600. distance: 0,
  6601. lastMoveTime: 0 };
  6602. this.opts._scrollDistance_ = offsetLeft;
  6603. break;}
  6604. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  6605. };
  6606. Charts.prototype.zoom = function () {
  6607. var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
  6608. if (this.opts.enableScroll !== true) {
  6609. console.log('请启用滚动条后使用!');
  6610. return;
  6611. }
  6612. //当前屏幕中间点
  6613. var centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(
  6614. this.opts.xAxis.itemCount / 2);
  6615. this.opts.animation = false;
  6616. this.opts.xAxis.itemCount = val.itemCount;
  6617. //重新计算x轴偏移距离
  6618. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config),
  6619. yAxisWidth = _calYAxisData.yAxisWidth;
  6620. this.config.yAxisWidth = yAxisWidth;
  6621. var offsetLeft = 0;
  6622. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  6623. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  6624. startX = _getXAxisPoints0.startX,
  6625. endX = _getXAxisPoints0.endX,
  6626. eachSpacing = _getXAxisPoints0.eachSpacing;
  6627. var centerLeft = eachSpacing * centerPoint;
  6628. var screenWidth = endX - startX;
  6629. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  6630. offsetLeft = screenWidth / 2 - centerLeft;
  6631. if (offsetLeft > 0) {
  6632. offsetLeft = 0;
  6633. }
  6634. if (offsetLeft < MaxLeft) {
  6635. offsetLeft = MaxLeft;
  6636. }
  6637. this.scrollOption = {
  6638. currentOffset: offsetLeft,
  6639. startTouchX: offsetLeft,
  6640. distance: 0,
  6641. lastMoveTime: 0 };
  6642. this.opts._scrollDistance_ = offsetLeft;
  6643. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  6644. };
  6645. Charts.prototype.stopAnimation = function () {
  6646. this.animationInstance && this.animationInstance.stop();
  6647. };
  6648. Charts.prototype.addEventListener = function (type, listener) {
  6649. this.event.addEventListener(type, listener);
  6650. };
  6651. Charts.prototype.getCurrentDataIndex = function (e) {
  6652. var touches = null;
  6653. if (e.changedTouches) {
  6654. touches = e.changedTouches[0];
  6655. } else {
  6656. touches = e.mp.changedTouches[0];
  6657. }
  6658. if (touches) {
  6659. var _touches$ = getTouches(touches, this.opts, e);
  6660. if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose') {
  6661. return findPieChartCurrentIndex({
  6662. x: _touches$.x,
  6663. y: _touches$.y },
  6664. this.opts.chartData.pieData);
  6665. } else if (this.opts.type === 'radar') {
  6666. return findRadarChartCurrentIndex({
  6667. x: _touches$.x,
  6668. y: _touches$.y },
  6669. this.opts.chartData.radarData, this.opts.categories.length);
  6670. } else if (this.opts.type === 'funnel') {
  6671. return findFunnelChartCurrentIndex({
  6672. x: _touches$.x,
  6673. y: _touches$.y },
  6674. this.opts.chartData.funnelData);
  6675. } else if (this.opts.type === 'map') {
  6676. return findMapChartCurrentIndex({
  6677. x: _touches$.x,
  6678. y: _touches$.y },
  6679. this.opts);
  6680. } else if (this.opts.type === 'word') {
  6681. return findWordChartCurrentIndex({
  6682. x: _touches$.x,
  6683. y: _touches$.y },
  6684. this.opts.chartData.wordCloudData);
  6685. } else {
  6686. return findCurrentIndex({
  6687. x: _touches$.x,
  6688. y: _touches$.y },
  6689. this.opts.chartData.xAxisPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  6690. }
  6691. }
  6692. return -1;
  6693. };
  6694. Charts.prototype.getLegendDataIndex = function (e) {
  6695. var touches = null;
  6696. if (e.changedTouches) {
  6697. touches = e.changedTouches[0];
  6698. } else {
  6699. touches = e.mp.changedTouches[0];
  6700. }
  6701. if (touches) {
  6702. var _touches$ = getTouches(touches, this.opts, e);
  6703. return findLegendIndex({
  6704. x: _touches$.x,
  6705. y: _touches$.y },
  6706. this.opts.chartData.legendData);
  6707. }
  6708. return -1;
  6709. };
  6710. Charts.prototype.touchLegend = function (e) {
  6711. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6712. var touches = null;
  6713. if (e.changedTouches) {
  6714. touches = e.changedTouches[0];
  6715. } else {
  6716. touches = e.mp.changedTouches[0];
  6717. }
  6718. if (touches) {
  6719. var _touches$ = getTouches(touches, this.opts, e);
  6720. var index = this.getLegendDataIndex(e);
  6721. if (index >= 0) {
  6722. this.opts.series[index].show = !this.opts.series[index].show;
  6723. this.opts.animation = option.animation ? true : false;
  6724. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  6725. }
  6726. }
  6727. };
  6728. Charts.prototype.showToolTip = function (e) {
  6729. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6730. var touches = null;
  6731. if (e.changedTouches) {
  6732. touches = e.changedTouches[0];
  6733. } else {
  6734. touches = e.mp.changedTouches[0];
  6735. }
  6736. if (!touches) {
  6737. console.log("touchError");
  6738. }
  6739. var _touches$ = getTouches(touches, this.opts, e);
  6740. var currentOffset = this.scrollOption.currentOffset;
  6741. var opts = assign({}, this.opts, {
  6742. _scrollDistance_: currentOffset,
  6743. animation: false });
  6744. if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column') {
  6745. var index = this.getCurrentDataIndex(e);
  6746. if (index > -1) {
  6747. var seriesData = getSeriesDataItem(this.opts.series, index);
  6748. if (seriesData.length !== 0) {
  6749. var _getToolTipData = getToolTipData(seriesData, this.opts.chartData.calPoints, index, this.opts.categories, option),
  6750. textList = _getToolTipData.textList,
  6751. offset = _getToolTipData.offset;
  6752. offset.y = _touches$.y;
  6753. opts.tooltip = {
  6754. textList: textList,
  6755. offset: offset,
  6756. option: option,
  6757. index: index };
  6758. }
  6759. }
  6760. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6761. }
  6762. if (this.opts.type === 'mix') {
  6763. var index = this.getCurrentDataIndex(e);
  6764. if (index > -1) {
  6765. var currentOffset = this.scrollOption.currentOffset;
  6766. var opts = assign({}, this.opts, {
  6767. _scrollDistance_: currentOffset,
  6768. animation: false });
  6769. var seriesData = getSeriesDataItem(this.opts.series, index);
  6770. if (seriesData.length !== 0) {
  6771. var _getMixToolTipData = getMixToolTipData(seriesData, this.opts.chartData.calPoints, index, this.opts.categories, option),
  6772. textList = _getMixToolTipData.textList,
  6773. offset = _getMixToolTipData.offset;
  6774. offset.y = _touches$.y;
  6775. opts.tooltip = {
  6776. textList: textList,
  6777. offset: offset,
  6778. option: option,
  6779. index: index };
  6780. }
  6781. }
  6782. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6783. }
  6784. if (this.opts.type === 'candle') {
  6785. var index = this.getCurrentDataIndex(e);
  6786. if (index > -1) {
  6787. var currentOffset = this.scrollOption.currentOffset;
  6788. var opts = assign({}, this.opts, {
  6789. _scrollDistance_: currentOffset,
  6790. animation: false });
  6791. var seriesData = getSeriesDataItem(this.opts.series, index);
  6792. if (seriesData.length !== 0) {
  6793. var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts.chartData.calPoints,
  6794. index, this.opts.categories, this.opts.extra.candle, option),
  6795. textList = _getToolTipData.textList,
  6796. offset = _getToolTipData.offset;
  6797. offset.y = _touches$.y;
  6798. opts.tooltip = {
  6799. textList: textList,
  6800. offset: offset,
  6801. option: option,
  6802. index: index };
  6803. }
  6804. }
  6805. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6806. }
  6807. if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose' || this.opts.type === 'funnel') {
  6808. var index = this.getCurrentDataIndex(e);
  6809. if (index > -1) {
  6810. var currentOffset = this.scrollOption.currentOffset;
  6811. var opts = assign({}, this.opts, {
  6812. _scrollDistance_: currentOffset,
  6813. animation: false });
  6814. var seriesData = this.opts._series_[index];
  6815. var textList = [{
  6816. text: option.format ? option.format(seriesData) : seriesData.name + ': ' + seriesData.data,
  6817. color: seriesData.color }];
  6818. var offset = {
  6819. x: _touches$.x,
  6820. y: _touches$.y };
  6821. opts.tooltip = {
  6822. textList: textList,
  6823. offset: offset,
  6824. option: option,
  6825. index: index };
  6826. }
  6827. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6828. }
  6829. if (this.opts.type === 'map' || this.opts.type === 'word') {
  6830. var index = this.getCurrentDataIndex(e);
  6831. if (index > -1) {
  6832. var currentOffset = this.scrollOption.currentOffset;
  6833. var opts = assign({}, this.opts, {
  6834. _scrollDistance_: currentOffset,
  6835. animation: false });
  6836. var seriesData = this.opts._series_[index];
  6837. var textList = [{
  6838. text: option.format ? option.format(seriesData) : seriesData.properties.name,
  6839. color: seriesData.color }];
  6840. var offset = {
  6841. x: _touches$.x,
  6842. y: _touches$.y };
  6843. opts.tooltip = {
  6844. textList: textList,
  6845. offset: offset,
  6846. option: option,
  6847. index: index };
  6848. }
  6849. opts.updateData = false;
  6850. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6851. }
  6852. if (this.opts.type === 'radar') {
  6853. var index = this.getCurrentDataIndex(e);
  6854. if (index > -1) {
  6855. var currentOffset = this.scrollOption.currentOffset;
  6856. var opts = assign({}, this.opts, {
  6857. _scrollDistance_: currentOffset,
  6858. animation: false });
  6859. var seriesData = getSeriesDataItem(this.opts.series, index);
  6860. if (seriesData.length !== 0) {
  6861. var textList = seriesData.map(function (item) {
  6862. return {
  6863. text: option.format ? option.format(item) : item.name + ': ' + item.data,
  6864. color: item.color };
  6865. });
  6866. var offset = {
  6867. x: _touches$.x,
  6868. y: _touches$.y };
  6869. opts.tooltip = {
  6870. textList: textList,
  6871. offset: offset,
  6872. option: option,
  6873. index: index };
  6874. }
  6875. }
  6876. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6877. }
  6878. };
  6879. Charts.prototype.translate = function (distance) {
  6880. this.scrollOption = {
  6881. currentOffset: distance,
  6882. startTouchX: distance,
  6883. distance: 0,
  6884. lastMoveTime: 0 };
  6885. var opts = assign({}, this.opts, {
  6886. _scrollDistance_: distance,
  6887. animation: false });
  6888. drawCharts.call(this, this.opts.type, opts, this.config, this.context);
  6889. };
  6890. Charts.prototype.scrollStart = function (e) {
  6891. var touches = null;
  6892. if (e.changedTouches) {
  6893. touches = e.changedTouches[0];
  6894. } else {
  6895. touches = e.mp.changedTouches[0];
  6896. }
  6897. var _touches$ = getTouches(touches, this.opts, e);
  6898. if (touches && this.opts.enableScroll === true) {
  6899. this.scrollOption.startTouchX = _touches$.x;
  6900. }
  6901. };
  6902. Charts.prototype.scroll = function (e) {
  6903. if (this.scrollOption.lastMoveTime === 0) {
  6904. this.scrollOption.lastMoveTime = Date.now();
  6905. }
  6906. var Limit = this.opts.extra.touchMoveLimit || 20;
  6907. var currMoveTime = Date.now();
  6908. var duration = currMoveTime - this.scrollOption.lastMoveTime;
  6909. if (duration < Math.floor(1000 / Limit)) return;
  6910. this.scrollOption.lastMoveTime = currMoveTime;
  6911. var touches = null;
  6912. if (e.changedTouches) {
  6913. touches = e.changedTouches[0];
  6914. } else {
  6915. touches = e.mp.changedTouches[0];
  6916. }
  6917. if (touches && this.opts.enableScroll === true) {
  6918. var _touches$ = getTouches(touches, this.opts, e);
  6919. var _distance;
  6920. _distance = _touches$.x - this.scrollOption.startTouchX;
  6921. var currentOffset = this.scrollOption.currentOffset;
  6922. var validDistance = calValidDistance(currentOffset + _distance, this.opts.chartData, this.config, this.opts);
  6923. this.scrollOption.distance = _distance = validDistance - currentOffset;
  6924. var opts = assign({}, this.opts, {
  6925. _scrollDistance_: currentOffset + _distance,
  6926. animation: false });
  6927. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6928. return currentOffset + _distance;
  6929. }
  6930. };
  6931. Charts.prototype.scrollEnd = function (e) {
  6932. if (this.opts.enableScroll === true) {
  6933. var _scrollOption = this.scrollOption,
  6934. currentOffset = _scrollOption.currentOffset,
  6935. distance = _scrollOption.distance;
  6936. this.scrollOption.currentOffset = currentOffset + distance;
  6937. this.scrollOption.distance = 0;
  6938. }
  6939. };
  6940. if ( true && typeof module.exports === "object") {
  6941. module.exports = Charts;
  6942. //export default Charts;//建议使用nodejs的module导出方式,如报错请使用export方式导出
  6943. }
  6944. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  6945. /***/ }),
  6946. /***/ 2:
  6947. /*!***********************************!*\
  6948. !*** (webpack)/buildin/global.js ***!
  6949. \***********************************/
  6950. /*! no static exports found */
  6951. /***/ (function(module, exports) {
  6952. var g;
  6953. // This works in non-strict mode
  6954. g = (function() {
  6955. return this;
  6956. })();
  6957. try {
  6958. // This works if eval is allowed (see CSP)
  6959. g = g || new Function("return this")();
  6960. } catch (e) {
  6961. // This works if the window reference is available
  6962. if (typeof window === "object") g = window;
  6963. }
  6964. // g can still be undefined, but nothing to do about it...
  6965. // We return undefined, instead of nothing here, so it's
  6966. // easier to handle this case. if(!global) { ...}
  6967. module.exports = g;
  6968. /***/ }),
  6969. /***/ 20:
  6970. /*!**********************************************************!*\
  6971. !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
  6972. \**********************************************************/
  6973. /*! no static exports found */
  6974. /***/ (function(module, exports, __webpack_require__) {
  6975. module.exports = __webpack_require__(/*! regenerator-runtime */ 21);
  6976. /***/ }),
  6977. /***/ 21:
  6978. /*!************************************************************!*\
  6979. !*** ./node_modules/regenerator-runtime/runtime-module.js ***!
  6980. \************************************************************/
  6981. /*! no static exports found */
  6982. /***/ (function(module, exports, __webpack_require__) {
  6983. /**
  6984. * Copyright (c) 2014-present, Facebook, Inc.
  6985. *
  6986. * This source code is licensed under the MIT license found in the
  6987. * LICENSE file in the root directory of this source tree.
  6988. */
  6989. // This method of obtaining a reference to the global object needs to be
  6990. // kept identical to the way it is obtained in runtime.js
  6991. var g = (function() {
  6992. return this || (typeof self === "object" && self);
  6993. })() || Function("return this")();
  6994. // Use `getOwnPropertyNames` because not all browsers support calling
  6995. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  6996. var hadRuntime = g.regeneratorRuntime &&
  6997. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  6998. // Save the old regeneratorRuntime in case it needs to be restored later.
  6999. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  7000. // Force reevalutation of runtime.js.
  7001. g.regeneratorRuntime = undefined;
  7002. module.exports = __webpack_require__(/*! ./runtime */ 22);
  7003. if (hadRuntime) {
  7004. // Restore the original runtime.
  7005. g.regeneratorRuntime = oldRuntime;
  7006. } else {
  7007. // Remove the global property added by runtime.js.
  7008. try {
  7009. delete g.regeneratorRuntime;
  7010. } catch(e) {
  7011. g.regeneratorRuntime = undefined;
  7012. }
  7013. }
  7014. /***/ }),
  7015. /***/ 22:
  7016. /*!*****************************************************!*\
  7017. !*** ./node_modules/regenerator-runtime/runtime.js ***!
  7018. \*****************************************************/
  7019. /*! no static exports found */
  7020. /***/ (function(module, exports) {
  7021. /**
  7022. * Copyright (c) 2014-present, Facebook, Inc.
  7023. *
  7024. * This source code is licensed under the MIT license found in the
  7025. * LICENSE file in the root directory of this source tree.
  7026. */
  7027. !(function(global) {
  7028. "use strict";
  7029. var Op = Object.prototype;
  7030. var hasOwn = Op.hasOwnProperty;
  7031. var undefined; // More compressible than void 0.
  7032. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  7033. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  7034. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  7035. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  7036. var inModule = typeof module === "object";
  7037. var runtime = global.regeneratorRuntime;
  7038. if (runtime) {
  7039. if (inModule) {
  7040. // If regeneratorRuntime is defined globally and we're in a module,
  7041. // make the exports object identical to regeneratorRuntime.
  7042. module.exports = runtime;
  7043. }
  7044. // Don't bother evaluating the rest of this file if the runtime was
  7045. // already defined globally.
  7046. return;
  7047. }
  7048. // Define the runtime globally (as expected by generated code) as either
  7049. // module.exports (if we're in a module) or a new, empty object.
  7050. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  7051. function wrap(innerFn, outerFn, self, tryLocsList) {
  7052. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  7053. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  7054. var generator = Object.create(protoGenerator.prototype);
  7055. var context = new Context(tryLocsList || []);
  7056. // The ._invoke method unifies the implementations of the .next,
  7057. // .throw, and .return methods.
  7058. generator._invoke = makeInvokeMethod(innerFn, self, context);
  7059. return generator;
  7060. }
  7061. runtime.wrap = wrap;
  7062. // Try/catch helper to minimize deoptimizations. Returns a completion
  7063. // record like context.tryEntries[i].completion. This interface could
  7064. // have been (and was previously) designed to take a closure to be
  7065. // invoked without arguments, but in all the cases we care about we
  7066. // already have an existing method we want to call, so there's no need
  7067. // to create a new function object. We can even get away with assuming
  7068. // the method takes exactly one argument, since that happens to be true
  7069. // in every case, so we don't have to touch the arguments object. The
  7070. // only additional allocation required is the completion record, which
  7071. // has a stable shape and so hopefully should be cheap to allocate.
  7072. function tryCatch(fn, obj, arg) {
  7073. try {
  7074. return { type: "normal", arg: fn.call(obj, arg) };
  7075. } catch (err) {
  7076. return { type: "throw", arg: err };
  7077. }
  7078. }
  7079. var GenStateSuspendedStart = "suspendedStart";
  7080. var GenStateSuspendedYield = "suspendedYield";
  7081. var GenStateExecuting = "executing";
  7082. var GenStateCompleted = "completed";
  7083. // Returning this object from the innerFn has the same effect as
  7084. // breaking out of the dispatch switch statement.
  7085. var ContinueSentinel = {};
  7086. // Dummy constructor functions that we use as the .constructor and
  7087. // .constructor.prototype properties for functions that return Generator
  7088. // objects. For full spec compliance, you may wish to configure your
  7089. // minifier not to mangle the names of these two functions.
  7090. function Generator() {}
  7091. function GeneratorFunction() {}
  7092. function GeneratorFunctionPrototype() {}
  7093. // This is a polyfill for %IteratorPrototype% for environments that
  7094. // don't natively support it.
  7095. var IteratorPrototype = {};
  7096. IteratorPrototype[iteratorSymbol] = function () {
  7097. return this;
  7098. };
  7099. var getProto = Object.getPrototypeOf;
  7100. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  7101. if (NativeIteratorPrototype &&
  7102. NativeIteratorPrototype !== Op &&
  7103. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  7104. // This environment has a native %IteratorPrototype%; use it instead
  7105. // of the polyfill.
  7106. IteratorPrototype = NativeIteratorPrototype;
  7107. }
  7108. var Gp = GeneratorFunctionPrototype.prototype =
  7109. Generator.prototype = Object.create(IteratorPrototype);
  7110. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  7111. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  7112. GeneratorFunctionPrototype[toStringTagSymbol] =
  7113. GeneratorFunction.displayName = "GeneratorFunction";
  7114. // Helper for defining the .next, .throw, and .return methods of the
  7115. // Iterator interface in terms of a single ._invoke method.
  7116. function defineIteratorMethods(prototype) {
  7117. ["next", "throw", "return"].forEach(function(method) {
  7118. prototype[method] = function(arg) {
  7119. return this._invoke(method, arg);
  7120. };
  7121. });
  7122. }
  7123. runtime.isGeneratorFunction = function(genFun) {
  7124. var ctor = typeof genFun === "function" && genFun.constructor;
  7125. return ctor
  7126. ? ctor === GeneratorFunction ||
  7127. // For the native GeneratorFunction constructor, the best we can
  7128. // do is to check its .name property.
  7129. (ctor.displayName || ctor.name) === "GeneratorFunction"
  7130. : false;
  7131. };
  7132. runtime.mark = function(genFun) {
  7133. if (Object.setPrototypeOf) {
  7134. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  7135. } else {
  7136. genFun.__proto__ = GeneratorFunctionPrototype;
  7137. if (!(toStringTagSymbol in genFun)) {
  7138. genFun[toStringTagSymbol] = "GeneratorFunction";
  7139. }
  7140. }
  7141. genFun.prototype = Object.create(Gp);
  7142. return genFun;
  7143. };
  7144. // Within the body of any async function, `await x` is transformed to
  7145. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  7146. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  7147. // meant to be awaited.
  7148. runtime.awrap = function(arg) {
  7149. return { __await: arg };
  7150. };
  7151. function AsyncIterator(generator) {
  7152. function invoke(method, arg, resolve, reject) {
  7153. var record = tryCatch(generator[method], generator, arg);
  7154. if (record.type === "throw") {
  7155. reject(record.arg);
  7156. } else {
  7157. var result = record.arg;
  7158. var value = result.value;
  7159. if (value &&
  7160. typeof value === "object" &&
  7161. hasOwn.call(value, "__await")) {
  7162. return Promise.resolve(value.__await).then(function(value) {
  7163. invoke("next", value, resolve, reject);
  7164. }, function(err) {
  7165. invoke("throw", err, resolve, reject);
  7166. });
  7167. }
  7168. return Promise.resolve(value).then(function(unwrapped) {
  7169. // When a yielded Promise is resolved, its final value becomes
  7170. // the .value of the Promise<{value,done}> result for the
  7171. // current iteration.
  7172. result.value = unwrapped;
  7173. resolve(result);
  7174. }, function(error) {
  7175. // If a rejected Promise was yielded, throw the rejection back
  7176. // into the async generator function so it can be handled there.
  7177. return invoke("throw", error, resolve, reject);
  7178. });
  7179. }
  7180. }
  7181. var previousPromise;
  7182. function enqueue(method, arg) {
  7183. function callInvokeWithMethodAndArg() {
  7184. return new Promise(function(resolve, reject) {
  7185. invoke(method, arg, resolve, reject);
  7186. });
  7187. }
  7188. return previousPromise =
  7189. // If enqueue has been called before, then we want to wait until
  7190. // all previous Promises have been resolved before calling invoke,
  7191. // so that results are always delivered in the correct order. If
  7192. // enqueue has not been called before, then it is important to
  7193. // call invoke immediately, without waiting on a callback to fire,
  7194. // so that the async generator function has the opportunity to do
  7195. // any necessary setup in a predictable way. This predictability
  7196. // is why the Promise constructor synchronously invokes its
  7197. // executor callback, and why async functions synchronously
  7198. // execute code before the first await. Since we implement simple
  7199. // async functions in terms of async generators, it is especially
  7200. // important to get this right, even though it requires care.
  7201. previousPromise ? previousPromise.then(
  7202. callInvokeWithMethodAndArg,
  7203. // Avoid propagating failures to Promises returned by later
  7204. // invocations of the iterator.
  7205. callInvokeWithMethodAndArg
  7206. ) : callInvokeWithMethodAndArg();
  7207. }
  7208. // Define the unified helper method that is used to implement .next,
  7209. // .throw, and .return (see defineIteratorMethods).
  7210. this._invoke = enqueue;
  7211. }
  7212. defineIteratorMethods(AsyncIterator.prototype);
  7213. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  7214. return this;
  7215. };
  7216. runtime.AsyncIterator = AsyncIterator;
  7217. // Note that simple async functions are implemented on top of
  7218. // AsyncIterator objects; they just return a Promise for the value of
  7219. // the final result produced by the iterator.
  7220. runtime.async = function(innerFn, outerFn, self, tryLocsList) {
  7221. var iter = new AsyncIterator(
  7222. wrap(innerFn, outerFn, self, tryLocsList)
  7223. );
  7224. return runtime.isGeneratorFunction(outerFn)
  7225. ? iter // If outerFn is a generator, return the full iterator.
  7226. : iter.next().then(function(result) {
  7227. return result.done ? result.value : iter.next();
  7228. });
  7229. };
  7230. function makeInvokeMethod(innerFn, self, context) {
  7231. var state = GenStateSuspendedStart;
  7232. return function invoke(method, arg) {
  7233. if (state === GenStateExecuting) {
  7234. throw new Error("Generator is already running");
  7235. }
  7236. if (state === GenStateCompleted) {
  7237. if (method === "throw") {
  7238. throw arg;
  7239. }
  7240. // Be forgiving, per 25.3.3.3.3 of the spec:
  7241. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  7242. return doneResult();
  7243. }
  7244. context.method = method;
  7245. context.arg = arg;
  7246. while (true) {
  7247. var delegate = context.delegate;
  7248. if (delegate) {
  7249. var delegateResult = maybeInvokeDelegate(delegate, context);
  7250. if (delegateResult) {
  7251. if (delegateResult === ContinueSentinel) continue;
  7252. return delegateResult;
  7253. }
  7254. }
  7255. if (context.method === "next") {
  7256. // Setting context._sent for legacy support of Babel's
  7257. // function.sent implementation.
  7258. context.sent = context._sent = context.arg;
  7259. } else if (context.method === "throw") {
  7260. if (state === GenStateSuspendedStart) {
  7261. state = GenStateCompleted;
  7262. throw context.arg;
  7263. }
  7264. context.dispatchException(context.arg);
  7265. } else if (context.method === "return") {
  7266. context.abrupt("return", context.arg);
  7267. }
  7268. state = GenStateExecuting;
  7269. var record = tryCatch(innerFn, self, context);
  7270. if (record.type === "normal") {
  7271. // If an exception is thrown from innerFn, we leave state ===
  7272. // GenStateExecuting and loop back for another invocation.
  7273. state = context.done
  7274. ? GenStateCompleted
  7275. : GenStateSuspendedYield;
  7276. if (record.arg === ContinueSentinel) {
  7277. continue;
  7278. }
  7279. return {
  7280. value: record.arg,
  7281. done: context.done
  7282. };
  7283. } else if (record.type === "throw") {
  7284. state = GenStateCompleted;
  7285. // Dispatch the exception by looping back around to the
  7286. // context.dispatchException(context.arg) call above.
  7287. context.method = "throw";
  7288. context.arg = record.arg;
  7289. }
  7290. }
  7291. };
  7292. }
  7293. // Call delegate.iterator[context.method](context.arg) and handle the
  7294. // result, either by returning a { value, done } result from the
  7295. // delegate iterator, or by modifying context.method and context.arg,
  7296. // setting context.delegate to null, and returning the ContinueSentinel.
  7297. function maybeInvokeDelegate(delegate, context) {
  7298. var method = delegate.iterator[context.method];
  7299. if (method === undefined) {
  7300. // A .throw or .return when the delegate iterator has no .throw
  7301. // method always terminates the yield* loop.
  7302. context.delegate = null;
  7303. if (context.method === "throw") {
  7304. if (delegate.iterator.return) {
  7305. // If the delegate iterator has a return method, give it a
  7306. // chance to clean up.
  7307. context.method = "return";
  7308. context.arg = undefined;
  7309. maybeInvokeDelegate(delegate, context);
  7310. if (context.method === "throw") {
  7311. // If maybeInvokeDelegate(context) changed context.method from
  7312. // "return" to "throw", let that override the TypeError below.
  7313. return ContinueSentinel;
  7314. }
  7315. }
  7316. context.method = "throw";
  7317. context.arg = new TypeError(
  7318. "The iterator does not provide a 'throw' method");
  7319. }
  7320. return ContinueSentinel;
  7321. }
  7322. var record = tryCatch(method, delegate.iterator, context.arg);
  7323. if (record.type === "throw") {
  7324. context.method = "throw";
  7325. context.arg = record.arg;
  7326. context.delegate = null;
  7327. return ContinueSentinel;
  7328. }
  7329. var info = record.arg;
  7330. if (! info) {
  7331. context.method = "throw";
  7332. context.arg = new TypeError("iterator result is not an object");
  7333. context.delegate = null;
  7334. return ContinueSentinel;
  7335. }
  7336. if (info.done) {
  7337. // Assign the result of the finished delegate to the temporary
  7338. // variable specified by delegate.resultName (see delegateYield).
  7339. context[delegate.resultName] = info.value;
  7340. // Resume execution at the desired location (see delegateYield).
  7341. context.next = delegate.nextLoc;
  7342. // If context.method was "throw" but the delegate handled the
  7343. // exception, let the outer generator proceed normally. If
  7344. // context.method was "next", forget context.arg since it has been
  7345. // "consumed" by the delegate iterator. If context.method was
  7346. // "return", allow the original .return call to continue in the
  7347. // outer generator.
  7348. if (context.method !== "return") {
  7349. context.method = "next";
  7350. context.arg = undefined;
  7351. }
  7352. } else {
  7353. // Re-yield the result returned by the delegate method.
  7354. return info;
  7355. }
  7356. // The delegate iterator is finished, so forget it and continue with
  7357. // the outer generator.
  7358. context.delegate = null;
  7359. return ContinueSentinel;
  7360. }
  7361. // Define Generator.prototype.{next,throw,return} in terms of the
  7362. // unified ._invoke helper method.
  7363. defineIteratorMethods(Gp);
  7364. Gp[toStringTagSymbol] = "Generator";
  7365. // A Generator should always return itself as the iterator object when the
  7366. // @@iterator function is called on it. Some browsers' implementations of the
  7367. // iterator prototype chain incorrectly implement this, causing the Generator
  7368. // object to not be returned from this call. This ensures that doesn't happen.
  7369. // See https://github.com/facebook/regenerator/issues/274 for more details.
  7370. Gp[iteratorSymbol] = function() {
  7371. return this;
  7372. };
  7373. Gp.toString = function() {
  7374. return "[object Generator]";
  7375. };
  7376. function pushTryEntry(locs) {
  7377. var entry = { tryLoc: locs[0] };
  7378. if (1 in locs) {
  7379. entry.catchLoc = locs[1];
  7380. }
  7381. if (2 in locs) {
  7382. entry.finallyLoc = locs[2];
  7383. entry.afterLoc = locs[3];
  7384. }
  7385. this.tryEntries.push(entry);
  7386. }
  7387. function resetTryEntry(entry) {
  7388. var record = entry.completion || {};
  7389. record.type = "normal";
  7390. delete record.arg;
  7391. entry.completion = record;
  7392. }
  7393. function Context(tryLocsList) {
  7394. // The root entry object (effectively a try statement without a catch
  7395. // or a finally block) gives us a place to store values thrown from
  7396. // locations where there is no enclosing try statement.
  7397. this.tryEntries = [{ tryLoc: "root" }];
  7398. tryLocsList.forEach(pushTryEntry, this);
  7399. this.reset(true);
  7400. }
  7401. runtime.keys = function(object) {
  7402. var keys = [];
  7403. for (var key in object) {
  7404. keys.push(key);
  7405. }
  7406. keys.reverse();
  7407. // Rather than returning an object with a next method, we keep
  7408. // things simple and return the next function itself.
  7409. return function next() {
  7410. while (keys.length) {
  7411. var key = keys.pop();
  7412. if (key in object) {
  7413. next.value = key;
  7414. next.done = false;
  7415. return next;
  7416. }
  7417. }
  7418. // To avoid creating an additional object, we just hang the .value
  7419. // and .done properties off the next function object itself. This
  7420. // also ensures that the minifier will not anonymize the function.
  7421. next.done = true;
  7422. return next;
  7423. };
  7424. };
  7425. function values(iterable) {
  7426. if (iterable) {
  7427. var iteratorMethod = iterable[iteratorSymbol];
  7428. if (iteratorMethod) {
  7429. return iteratorMethod.call(iterable);
  7430. }
  7431. if (typeof iterable.next === "function") {
  7432. return iterable;
  7433. }
  7434. if (!isNaN(iterable.length)) {
  7435. var i = -1, next = function next() {
  7436. while (++i < iterable.length) {
  7437. if (hasOwn.call(iterable, i)) {
  7438. next.value = iterable[i];
  7439. next.done = false;
  7440. return next;
  7441. }
  7442. }
  7443. next.value = undefined;
  7444. next.done = true;
  7445. return next;
  7446. };
  7447. return next.next = next;
  7448. }
  7449. }
  7450. // Return an iterator with no values.
  7451. return { next: doneResult };
  7452. }
  7453. runtime.values = values;
  7454. function doneResult() {
  7455. return { value: undefined, done: true };
  7456. }
  7457. Context.prototype = {
  7458. constructor: Context,
  7459. reset: function(skipTempReset) {
  7460. this.prev = 0;
  7461. this.next = 0;
  7462. // Resetting context._sent for legacy support of Babel's
  7463. // function.sent implementation.
  7464. this.sent = this._sent = undefined;
  7465. this.done = false;
  7466. this.delegate = null;
  7467. this.method = "next";
  7468. this.arg = undefined;
  7469. this.tryEntries.forEach(resetTryEntry);
  7470. if (!skipTempReset) {
  7471. for (var name in this) {
  7472. // Not sure about the optimal order of these conditions:
  7473. if (name.charAt(0) === "t" &&
  7474. hasOwn.call(this, name) &&
  7475. !isNaN(+name.slice(1))) {
  7476. this[name] = undefined;
  7477. }
  7478. }
  7479. }
  7480. },
  7481. stop: function() {
  7482. this.done = true;
  7483. var rootEntry = this.tryEntries[0];
  7484. var rootRecord = rootEntry.completion;
  7485. if (rootRecord.type === "throw") {
  7486. throw rootRecord.arg;
  7487. }
  7488. return this.rval;
  7489. },
  7490. dispatchException: function(exception) {
  7491. if (this.done) {
  7492. throw exception;
  7493. }
  7494. var context = this;
  7495. function handle(loc, caught) {
  7496. record.type = "throw";
  7497. record.arg = exception;
  7498. context.next = loc;
  7499. if (caught) {
  7500. // If the dispatched exception was caught by a catch block,
  7501. // then let that catch block handle the exception normally.
  7502. context.method = "next";
  7503. context.arg = undefined;
  7504. }
  7505. return !! caught;
  7506. }
  7507. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7508. var entry = this.tryEntries[i];
  7509. var record = entry.completion;
  7510. if (entry.tryLoc === "root") {
  7511. // Exception thrown outside of any try block that could handle
  7512. // it, so set the completion value of the entire function to
  7513. // throw the exception.
  7514. return handle("end");
  7515. }
  7516. if (entry.tryLoc <= this.prev) {
  7517. var hasCatch = hasOwn.call(entry, "catchLoc");
  7518. var hasFinally = hasOwn.call(entry, "finallyLoc");
  7519. if (hasCatch && hasFinally) {
  7520. if (this.prev < entry.catchLoc) {
  7521. return handle(entry.catchLoc, true);
  7522. } else if (this.prev < entry.finallyLoc) {
  7523. return handle(entry.finallyLoc);
  7524. }
  7525. } else if (hasCatch) {
  7526. if (this.prev < entry.catchLoc) {
  7527. return handle(entry.catchLoc, true);
  7528. }
  7529. } else if (hasFinally) {
  7530. if (this.prev < entry.finallyLoc) {
  7531. return handle(entry.finallyLoc);
  7532. }
  7533. } else {
  7534. throw new Error("try statement without catch or finally");
  7535. }
  7536. }
  7537. }
  7538. },
  7539. abrupt: function(type, arg) {
  7540. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7541. var entry = this.tryEntries[i];
  7542. if (entry.tryLoc <= this.prev &&
  7543. hasOwn.call(entry, "finallyLoc") &&
  7544. this.prev < entry.finallyLoc) {
  7545. var finallyEntry = entry;
  7546. break;
  7547. }
  7548. }
  7549. if (finallyEntry &&
  7550. (type === "break" ||
  7551. type === "continue") &&
  7552. finallyEntry.tryLoc <= arg &&
  7553. arg <= finallyEntry.finallyLoc) {
  7554. // Ignore the finally entry if control is not jumping to a
  7555. // location outside the try/catch block.
  7556. finallyEntry = null;
  7557. }
  7558. var record = finallyEntry ? finallyEntry.completion : {};
  7559. record.type = type;
  7560. record.arg = arg;
  7561. if (finallyEntry) {
  7562. this.method = "next";
  7563. this.next = finallyEntry.finallyLoc;
  7564. return ContinueSentinel;
  7565. }
  7566. return this.complete(record);
  7567. },
  7568. complete: function(record, afterLoc) {
  7569. if (record.type === "throw") {
  7570. throw record.arg;
  7571. }
  7572. if (record.type === "break" ||
  7573. record.type === "continue") {
  7574. this.next = record.arg;
  7575. } else if (record.type === "return") {
  7576. this.rval = this.arg = record.arg;
  7577. this.method = "return";
  7578. this.next = "end";
  7579. } else if (record.type === "normal" && afterLoc) {
  7580. this.next = afterLoc;
  7581. }
  7582. return ContinueSentinel;
  7583. },
  7584. finish: function(finallyLoc) {
  7585. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7586. var entry = this.tryEntries[i];
  7587. if (entry.finallyLoc === finallyLoc) {
  7588. this.complete(entry.completion, entry.afterLoc);
  7589. resetTryEntry(entry);
  7590. return ContinueSentinel;
  7591. }
  7592. }
  7593. },
  7594. "catch": function(tryLoc) {
  7595. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7596. var entry = this.tryEntries[i];
  7597. if (entry.tryLoc === tryLoc) {
  7598. var record = entry.completion;
  7599. if (record.type === "throw") {
  7600. var thrown = record.arg;
  7601. resetTryEntry(entry);
  7602. }
  7603. return thrown;
  7604. }
  7605. }
  7606. // The context.catch method must only be called with a location
  7607. // argument that corresponds to a known catch block.
  7608. throw new Error("illegal catch attempt");
  7609. },
  7610. delegateYield: function(iterable, resultName, nextLoc) {
  7611. this.delegate = {
  7612. iterator: values(iterable),
  7613. resultName: resultName,
  7614. nextLoc: nextLoc
  7615. };
  7616. if (this.method === "next") {
  7617. // Deliberately forget the last sent value so that we don't
  7618. // accidentally pass it on to the delegate.
  7619. this.arg = undefined;
  7620. }
  7621. return ContinueSentinel;
  7622. }
  7623. };
  7624. })(
  7625. // In sloppy mode, unbound `this` refers to the global object, fallback to
  7626. // Function constructor if we're in global strict mode. That is sadly a form
  7627. // of indirect eval which violates Content Security Policy.
  7628. (function() {
  7629. return this || (typeof self === "object" && self);
  7630. })() || Function("return this")()
  7631. );
  7632. /***/ }),
  7633. /***/ 3:
  7634. /*!*************************************************************!*\
  7635. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  7636. \*************************************************************/
  7637. /*! no static exports found */
  7638. /***/ (function(module, exports, __webpack_require__) {
  7639. "use strict";
  7640. /* 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;
  7641. var isObject = function isObject(val) {return val !== null && typeof val === 'object';};
  7642. var defaultDelimiters = ['{', '}'];var
  7643. BaseFormatter = /*#__PURE__*/function () {
  7644. function BaseFormatter() {_classCallCheck(this, BaseFormatter);
  7645. this._caches = Object.create(null);
  7646. }_createClass(BaseFormatter, [{ key: "interpolate", value: function interpolate(
  7647. message, values) {var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  7648. if (!values) {
  7649. return [message];
  7650. }
  7651. var tokens = this._caches[message];
  7652. if (!tokens) {
  7653. tokens = parse(message, delimiters);
  7654. this._caches[message] = tokens;
  7655. }
  7656. return compile(tokens, values);
  7657. } }]);return BaseFormatter;}();exports.Formatter = BaseFormatter;
  7658. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  7659. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  7660. function parse(format, _ref) {var _ref2 = _slicedToArray(_ref, 2),startDelimiter = _ref2[0],endDelimiter = _ref2[1];
  7661. var tokens = [];
  7662. var position = 0;
  7663. var text = '';
  7664. while (position < format.length) {
  7665. var char = format[position++];
  7666. if (char === startDelimiter) {
  7667. if (text) {
  7668. tokens.push({ type: 'text', value: text });
  7669. }
  7670. text = '';
  7671. var sub = '';
  7672. char = format[position++];
  7673. while (char !== undefined && char !== endDelimiter) {
  7674. sub += char;
  7675. char = format[position++];
  7676. }
  7677. var isClosed = char === endDelimiter;
  7678. var type = RE_TOKEN_LIST_VALUE.test(sub) ?
  7679. 'list' :
  7680. isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ?
  7681. 'named' :
  7682. 'unknown';
  7683. tokens.push({ value: sub, type: type });
  7684. }
  7685. // else if (char === '%') {
  7686. // // when found rails i18n syntax, skip text capture
  7687. // if (format[position] !== '{') {
  7688. // text += char
  7689. // }
  7690. // }
  7691. else {
  7692. text += char;
  7693. }
  7694. }
  7695. text && tokens.push({ type: 'text', value: text });
  7696. return tokens;
  7697. }
  7698. function compile(tokens, values) {
  7699. var compiled = [];
  7700. var index = 0;
  7701. var mode = isArray(values) ?
  7702. 'list' :
  7703. isObject(values) ?
  7704. 'named' :
  7705. 'unknown';
  7706. if (mode === 'unknown') {
  7707. return compiled;
  7708. }
  7709. while (index < tokens.length) {
  7710. var token = tokens[index];
  7711. switch (token.type) {
  7712. case 'text':
  7713. compiled.push(token.value);
  7714. break;
  7715. case 'list':
  7716. compiled.push(values[parseInt(token.value, 10)]);
  7717. break;
  7718. case 'named':
  7719. if (mode === 'named') {
  7720. compiled.push(values[token.value]);
  7721. } else
  7722. {
  7723. if (true) {
  7724. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  7725. }
  7726. }
  7727. break;
  7728. case 'unknown':
  7729. if (true) {
  7730. console.warn("Detect 'unknown' type of token!");
  7731. }
  7732. break;}
  7733. index++;
  7734. }
  7735. return compiled;
  7736. }
  7737. var LOCALE_ZH_HANS = 'zh-Hans';exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  7738. var LOCALE_ZH_HANT = 'zh-Hant';exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  7739. var LOCALE_EN = 'en';exports.LOCALE_EN = LOCALE_EN;
  7740. var LOCALE_FR = 'fr';exports.LOCALE_FR = LOCALE_FR;
  7741. var LOCALE_ES = 'es';exports.LOCALE_ES = LOCALE_ES;
  7742. var hasOwnProperty = Object.prototype.hasOwnProperty;
  7743. var hasOwn = function hasOwn(val, key) {return hasOwnProperty.call(val, key);};
  7744. var defaultFormatter = new BaseFormatter();
  7745. function include(str, parts) {
  7746. return !!parts.find(function (part) {return str.indexOf(part) !== -1;});
  7747. }
  7748. function startsWith(str, parts) {
  7749. return parts.find(function (part) {return str.indexOf(part) === 0;});
  7750. }
  7751. function normalizeLocale(locale, messages) {
  7752. if (!locale) {
  7753. return;
  7754. }
  7755. locale = locale.trim().replace(/_/g, '-');
  7756. if (messages && messages[locale]) {
  7757. return locale;
  7758. }
  7759. locale = locale.toLowerCase();
  7760. if (locale.indexOf('zh') === 0) {
  7761. if (locale.indexOf('-hans') > -1) {
  7762. return LOCALE_ZH_HANS;
  7763. }
  7764. if (locale.indexOf('-hant') > -1) {
  7765. return LOCALE_ZH_HANT;
  7766. }
  7767. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  7768. return LOCALE_ZH_HANT;
  7769. }
  7770. return LOCALE_ZH_HANS;
  7771. }
  7772. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  7773. if (lang) {
  7774. return lang;
  7775. }
  7776. }var
  7777. I18n = /*#__PURE__*/function () {
  7778. function I18n(_ref3) {var locale = _ref3.locale,fallbackLocale = _ref3.fallbackLocale,messages = _ref3.messages,watcher = _ref3.watcher,formater = _ref3.formater;_classCallCheck(this, I18n);
  7779. this.locale = LOCALE_EN;
  7780. this.fallbackLocale = LOCALE_EN;
  7781. this.message = {};
  7782. this.messages = {};
  7783. this.watchers = [];
  7784. if (fallbackLocale) {
  7785. this.fallbackLocale = fallbackLocale;
  7786. }
  7787. this.formater = formater || defaultFormatter;
  7788. this.messages = messages || {};
  7789. this.setLocale(locale || LOCALE_EN);
  7790. if (watcher) {
  7791. this.watchLocale(watcher);
  7792. }
  7793. }_createClass(I18n, [{ key: "setLocale", value: function setLocale(
  7794. locale) {var _this = this;
  7795. var oldLocale = this.locale;
  7796. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  7797. if (!this.messages[this.locale]) {
  7798. // 可能初始化时不存在
  7799. this.messages[this.locale] = {};
  7800. }
  7801. this.message = this.messages[this.locale];
  7802. // 仅发生变化时,通知
  7803. if (oldLocale !== this.locale) {
  7804. this.watchers.forEach(function (watcher) {
  7805. watcher(_this.locale, oldLocale);
  7806. });
  7807. }
  7808. } }, { key: "getLocale", value: function getLocale()
  7809. {
  7810. return this.locale;
  7811. } }, { key: "watchLocale", value: function watchLocale(
  7812. fn) {var _this2 = this;
  7813. var index = this.watchers.push(fn) - 1;
  7814. return function () {
  7815. _this2.watchers.splice(index, 1);
  7816. };
  7817. } }, { key: "add", value: function add(
  7818. locale, message) {var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  7819. var curMessages = this.messages[locale];
  7820. if (curMessages) {
  7821. if (override) {
  7822. Object.assign(curMessages, message);
  7823. } else
  7824. {
  7825. Object.keys(message).forEach(function (key) {
  7826. if (!hasOwn(curMessages, key)) {
  7827. curMessages[key] = message[key];
  7828. }
  7829. });
  7830. }
  7831. } else
  7832. {
  7833. this.messages[locale] = message;
  7834. }
  7835. } }, { key: "f", value: function f(
  7836. message, values, delimiters) {
  7837. return this.formater.interpolate(message, values, delimiters).join('');
  7838. } }, { key: "t", value: function t(
  7839. key, locale, values) {
  7840. var message = this.message;
  7841. if (typeof locale === 'string') {
  7842. locale = normalizeLocale(locale, this.messages);
  7843. locale && (message = this.messages[locale]);
  7844. } else
  7845. {
  7846. values = locale;
  7847. }
  7848. if (!hasOwn(message, key)) {
  7849. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  7850. return key;
  7851. }
  7852. return this.formater.interpolate(message[key], values).join('');
  7853. } }]);return I18n;}();exports.I18n = I18n;
  7854. function watchAppLocale(appVm, i18n) {
  7855. // 需要保证 watch 的触发在组件渲染之前
  7856. if (appVm.$watchLocale) {
  7857. // vue2
  7858. appVm.$watchLocale(function (newLocale) {
  7859. i18n.setLocale(newLocale);
  7860. });
  7861. } else
  7862. {
  7863. appVm.$watch(function () {return appVm.$locale;}, function (newLocale) {
  7864. i18n.setLocale(newLocale);
  7865. });
  7866. }
  7867. }
  7868. function getDefaultLocale() {
  7869. if (typeof uni !== 'undefined' && uni.getLocale) {
  7870. return uni.getLocale();
  7871. }
  7872. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  7873. if (typeof global !== 'undefined' && global.getLocale) {
  7874. return global.getLocale();
  7875. }
  7876. return LOCALE_EN;
  7877. }
  7878. 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;
  7879. // 兼容旧版本入参
  7880. if (typeof locale !== 'string') {var _ref4 =
  7881. [
  7882. messages,
  7883. locale];locale = _ref4[0];messages = _ref4[1];
  7884. }
  7885. if (typeof locale !== 'string') {
  7886. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  7887. locale = getDefaultLocale();
  7888. }
  7889. if (typeof fallbackLocale !== 'string') {
  7890. fallbackLocale =
  7891. typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale ||
  7892. LOCALE_EN;
  7893. }
  7894. var i18n = new I18n({
  7895. locale: locale,
  7896. fallbackLocale: fallbackLocale,
  7897. messages: messages,
  7898. watcher: watcher });
  7899. var _t = function t(key, values) {
  7900. if (typeof getApp !== 'function') {
  7901. // app view
  7902. /* eslint-disable no-func-assign */
  7903. _t = function t(key, values) {
  7904. return i18n.t(key, values);
  7905. };
  7906. } else
  7907. {
  7908. var isWatchedAppLocale = false;
  7909. _t = function t(key, values) {
  7910. var appVm = getApp().$vm;
  7911. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  7912. // options: {
  7913. // type: Array,
  7914. // default () {
  7915. // return [{
  7916. // icon: 'shop',
  7917. // text: t("uni-goods-nav.options.shop"),
  7918. // }, {
  7919. // icon: 'cart',
  7920. // text: t("uni-goods-nav.options.cart")
  7921. // }]
  7922. // }
  7923. // },
  7924. if (appVm) {
  7925. // 触发响应式
  7926. appVm.$locale;
  7927. if (!isWatchedAppLocale) {
  7928. isWatchedAppLocale = true;
  7929. watchAppLocale(appVm, i18n);
  7930. }
  7931. }
  7932. return i18n.t(key, values);
  7933. };
  7934. }
  7935. return _t(key, values);
  7936. };
  7937. return {
  7938. i18n: i18n,
  7939. f: function f(message, values, delimiters) {
  7940. return i18n.f(message, values, delimiters);
  7941. },
  7942. t: function t(key, values) {
  7943. return _t(key, values);
  7944. },
  7945. add: function add(locale, message) {var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  7946. return i18n.add(locale, message, override);
  7947. },
  7948. watch: function watch(fn) {
  7949. return i18n.watchLocale(fn);
  7950. },
  7951. getLocale: function getLocale() {
  7952. return i18n.getLocale();
  7953. },
  7954. setLocale: function setLocale(newLocale) {
  7955. return i18n.setLocale(newLocale);
  7956. } };
  7957. }
  7958. var isString = function isString(val) {return typeof val === 'string';};exports.isString = isString;
  7959. var formater;
  7960. function hasI18nJson(jsonObj, delimiters) {
  7961. if (!formater) {
  7962. formater = new BaseFormatter();
  7963. }
  7964. return walkJsonObj(jsonObj, function (jsonObj, key) {
  7965. var value = jsonObj[key];
  7966. if (isString(value)) {
  7967. if (isI18nStr(value, delimiters)) {
  7968. return true;
  7969. }
  7970. } else
  7971. {
  7972. return hasI18nJson(value, delimiters);
  7973. }
  7974. });
  7975. }
  7976. function parseI18nJson(jsonObj, values, delimiters) {
  7977. if (!formater) {
  7978. formater = new BaseFormatter();
  7979. }
  7980. walkJsonObj(jsonObj, function (jsonObj, key) {
  7981. var value = jsonObj[key];
  7982. if (isString(value)) {
  7983. if (isI18nStr(value, delimiters)) {
  7984. jsonObj[key] = compileStr(value, values, delimiters);
  7985. }
  7986. } else
  7987. {
  7988. parseI18nJson(value, values, delimiters);
  7989. }
  7990. });
  7991. return jsonObj;
  7992. }
  7993. function compileI18nJsonStr(jsonStr, _ref5) {var locale = _ref5.locale,locales = _ref5.locales,delimiters = _ref5.delimiters;
  7994. if (!isI18nStr(jsonStr, delimiters)) {
  7995. return jsonStr;
  7996. }
  7997. if (!formater) {
  7998. formater = new BaseFormatter();
  7999. }
  8000. var localeValues = [];
  8001. Object.keys(locales).forEach(function (name) {
  8002. if (name !== locale) {
  8003. localeValues.push({
  8004. locale: name,
  8005. values: locales[name] });
  8006. }
  8007. });
  8008. localeValues.unshift({ locale: locale, values: locales[locale] });
  8009. try {
  8010. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  8011. }
  8012. catch (e) {}
  8013. return jsonStr;
  8014. }
  8015. function isI18nStr(value, delimiters) {
  8016. return value.indexOf(delimiters[0]) > -1;
  8017. }
  8018. function compileStr(value, values, delimiters) {
  8019. return formater.interpolate(value, values, delimiters).join('');
  8020. }
  8021. function compileValue(jsonObj, key, localeValues, delimiters) {
  8022. var value = jsonObj[key];
  8023. if (isString(value)) {
  8024. // 存在国际化
  8025. if (isI18nStr(value, delimiters)) {
  8026. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  8027. if (localeValues.length > 1) {
  8028. // 格式化国际化语言
  8029. var valueLocales = jsonObj[key + 'Locales'] = {};
  8030. localeValues.forEach(function (localValue) {
  8031. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  8032. });
  8033. }
  8034. }
  8035. } else
  8036. {
  8037. compileJsonObj(value, localeValues, delimiters);
  8038. }
  8039. }
  8040. function compileJsonObj(jsonObj, localeValues, delimiters) {
  8041. walkJsonObj(jsonObj, function (jsonObj, key) {
  8042. compileValue(jsonObj, key, localeValues, delimiters);
  8043. });
  8044. return jsonObj;
  8045. }
  8046. function walkJsonObj(jsonObj, walk) {
  8047. if (isArray(jsonObj)) {
  8048. for (var i = 0; i < jsonObj.length; i++) {
  8049. if (walk(jsonObj, i)) {
  8050. return true;
  8051. }
  8052. }
  8053. } else
  8054. if (isObject(jsonObj)) {
  8055. for (var key in jsonObj) {
  8056. if (walk(jsonObj, key)) {
  8057. return true;
  8058. }
  8059. }
  8060. }
  8061. return false;
  8062. }
  8063. function resolveLocale(locales) {
  8064. return function (locale) {
  8065. if (!locale) {
  8066. return locale;
  8067. }
  8068. locale = normalizeLocale(locale) || locale;
  8069. return resolveLocaleChain(locale).find(function (locale) {return locales.indexOf(locale) > -1;});
  8070. };
  8071. }
  8072. function resolveLocaleChain(locale) {
  8073. var chain = [];
  8074. var tokens = locale.split('-');
  8075. while (tokens.length) {
  8076. chain.push(tokens.join('-'));
  8077. tokens.pop();
  8078. }
  8079. return chain;
  8080. }
  8081. /* 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)))
  8082. /***/ }),
  8083. /***/ 4:
  8084. /*!******************************************************************************************!*\
  8085. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  8086. \******************************************************************************************/
  8087. /*! exports provided: default */
  8088. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8089. "use strict";
  8090. __webpack_require__.r(__webpack_exports__);
  8091. /* WEBPACK VAR INJECTION */(function(global) {/*!
  8092. * Vue.js v2.6.11
  8093. * (c) 2014-2022 Evan You
  8094. * Released under the MIT License.
  8095. */
  8096. /* */
  8097. var emptyObject = Object.freeze({});
  8098. // These helpers produce better VM code in JS engines due to their
  8099. // explicitness and function inlining.
  8100. function isUndef (v) {
  8101. return v === undefined || v === null
  8102. }
  8103. function isDef (v) {
  8104. return v !== undefined && v !== null
  8105. }
  8106. function isTrue (v) {
  8107. return v === true
  8108. }
  8109. function isFalse (v) {
  8110. return v === false
  8111. }
  8112. /**
  8113. * Check if value is primitive.
  8114. */
  8115. function isPrimitive (value) {
  8116. return (
  8117. typeof value === 'string' ||
  8118. typeof value === 'number' ||
  8119. // $flow-disable-line
  8120. typeof value === 'symbol' ||
  8121. typeof value === 'boolean'
  8122. )
  8123. }
  8124. /**
  8125. * Quick object check - this is primarily used to tell
  8126. * Objects from primitive values when we know the value
  8127. * is a JSON-compliant type.
  8128. */
  8129. function isObject (obj) {
  8130. return obj !== null && typeof obj === 'object'
  8131. }
  8132. /**
  8133. * Get the raw type string of a value, e.g., [object Object].
  8134. */
  8135. var _toString = Object.prototype.toString;
  8136. function toRawType (value) {
  8137. return _toString.call(value).slice(8, -1)
  8138. }
  8139. /**
  8140. * Strict object type check. Only returns true
  8141. * for plain JavaScript objects.
  8142. */
  8143. function isPlainObject (obj) {
  8144. return _toString.call(obj) === '[object Object]'
  8145. }
  8146. function isRegExp (v) {
  8147. return _toString.call(v) === '[object RegExp]'
  8148. }
  8149. /**
  8150. * Check if val is a valid array index.
  8151. */
  8152. function isValidArrayIndex (val) {
  8153. var n = parseFloat(String(val));
  8154. return n >= 0 && Math.floor(n) === n && isFinite(val)
  8155. }
  8156. function isPromise (val) {
  8157. return (
  8158. isDef(val) &&
  8159. typeof val.then === 'function' &&
  8160. typeof val.catch === 'function'
  8161. )
  8162. }
  8163. /**
  8164. * Convert a value to a string that is actually rendered.
  8165. */
  8166. function toString (val) {
  8167. return val == null
  8168. ? ''
  8169. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  8170. ? JSON.stringify(val, null, 2)
  8171. : String(val)
  8172. }
  8173. /**
  8174. * Convert an input value to a number for persistence.
  8175. * If the conversion fails, return original string.
  8176. */
  8177. function toNumber (val) {
  8178. var n = parseFloat(val);
  8179. return isNaN(n) ? val : n
  8180. }
  8181. /**
  8182. * Make a map and return a function for checking if a key
  8183. * is in that map.
  8184. */
  8185. function makeMap (
  8186. str,
  8187. expectsLowerCase
  8188. ) {
  8189. var map = Object.create(null);
  8190. var list = str.split(',');
  8191. for (var i = 0; i < list.length; i++) {
  8192. map[list[i]] = true;
  8193. }
  8194. return expectsLowerCase
  8195. ? function (val) { return map[val.toLowerCase()]; }
  8196. : function (val) { return map[val]; }
  8197. }
  8198. /**
  8199. * Check if a tag is a built-in tag.
  8200. */
  8201. var isBuiltInTag = makeMap('slot,component', true);
  8202. /**
  8203. * Check if an attribute is a reserved attribute.
  8204. */
  8205. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  8206. /**
  8207. * Remove an item from an array.
  8208. */
  8209. function remove (arr, item) {
  8210. if (arr.length) {
  8211. var index = arr.indexOf(item);
  8212. if (index > -1) {
  8213. return arr.splice(index, 1)
  8214. }
  8215. }
  8216. }
  8217. /**
  8218. * Check whether an object has the property.
  8219. */
  8220. var hasOwnProperty = Object.prototype.hasOwnProperty;
  8221. function hasOwn (obj, key) {
  8222. return hasOwnProperty.call(obj, key)
  8223. }
  8224. /**
  8225. * Create a cached version of a pure function.
  8226. */
  8227. function cached (fn) {
  8228. var cache = Object.create(null);
  8229. return (function cachedFn (str) {
  8230. var hit = cache[str];
  8231. return hit || (cache[str] = fn(str))
  8232. })
  8233. }
  8234. /**
  8235. * Camelize a hyphen-delimited string.
  8236. */
  8237. var camelizeRE = /-(\w)/g;
  8238. var camelize = cached(function (str) {
  8239. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  8240. });
  8241. /**
  8242. * Capitalize a string.
  8243. */
  8244. var capitalize = cached(function (str) {
  8245. return str.charAt(0).toUpperCase() + str.slice(1)
  8246. });
  8247. /**
  8248. * Hyphenate a camelCase string.
  8249. */
  8250. var hyphenateRE = /\B([A-Z])/g;
  8251. var hyphenate = cached(function (str) {
  8252. return str.replace(hyphenateRE, '-$1').toLowerCase()
  8253. });
  8254. /**
  8255. * Simple bind polyfill for environments that do not support it,
  8256. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  8257. * since native bind is now performant enough in most browsers.
  8258. * But removing it would mean breaking code that was able to run in
  8259. * PhantomJS 1.x, so this must be kept for backward compatibility.
  8260. */
  8261. /* istanbul ignore next */
  8262. function polyfillBind (fn, ctx) {
  8263. function boundFn (a) {
  8264. var l = arguments.length;
  8265. return l
  8266. ? l > 1
  8267. ? fn.apply(ctx, arguments)
  8268. : fn.call(ctx, a)
  8269. : fn.call(ctx)
  8270. }
  8271. boundFn._length = fn.length;
  8272. return boundFn
  8273. }
  8274. function nativeBind (fn, ctx) {
  8275. return fn.bind(ctx)
  8276. }
  8277. var bind = Function.prototype.bind
  8278. ? nativeBind
  8279. : polyfillBind;
  8280. /**
  8281. * Convert an Array-like object to a real Array.
  8282. */
  8283. function toArray (list, start) {
  8284. start = start || 0;
  8285. var i = list.length - start;
  8286. var ret = new Array(i);
  8287. while (i--) {
  8288. ret[i] = list[i + start];
  8289. }
  8290. return ret
  8291. }
  8292. /**
  8293. * Mix properties into target object.
  8294. */
  8295. function extend (to, _from) {
  8296. for (var key in _from) {
  8297. to[key] = _from[key];
  8298. }
  8299. return to
  8300. }
  8301. /**
  8302. * Merge an Array of Objects into a single Object.
  8303. */
  8304. function toObject (arr) {
  8305. var res = {};
  8306. for (var i = 0; i < arr.length; i++) {
  8307. if (arr[i]) {
  8308. extend(res, arr[i]);
  8309. }
  8310. }
  8311. return res
  8312. }
  8313. /* eslint-disable no-unused-vars */
  8314. /**
  8315. * Perform no operation.
  8316. * Stubbing args to make Flow happy without leaving useless transpiled code
  8317. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  8318. */
  8319. function noop (a, b, c) {}
  8320. /**
  8321. * Always return false.
  8322. */
  8323. var no = function (a, b, c) { return false; };
  8324. /* eslint-enable no-unused-vars */
  8325. /**
  8326. * Return the same value.
  8327. */
  8328. var identity = function (_) { return _; };
  8329. /**
  8330. * Check if two values are loosely equal - that is,
  8331. * if they are plain objects, do they have the same shape?
  8332. */
  8333. function looseEqual (a, b) {
  8334. if (a === b) { return true }
  8335. var isObjectA = isObject(a);
  8336. var isObjectB = isObject(b);
  8337. if (isObjectA && isObjectB) {
  8338. try {
  8339. var isArrayA = Array.isArray(a);
  8340. var isArrayB = Array.isArray(b);
  8341. if (isArrayA && isArrayB) {
  8342. return a.length === b.length && a.every(function (e, i) {
  8343. return looseEqual(e, b[i])
  8344. })
  8345. } else if (a instanceof Date && b instanceof Date) {
  8346. return a.getTime() === b.getTime()
  8347. } else if (!isArrayA && !isArrayB) {
  8348. var keysA = Object.keys(a);
  8349. var keysB = Object.keys(b);
  8350. return keysA.length === keysB.length && keysA.every(function (key) {
  8351. return looseEqual(a[key], b[key])
  8352. })
  8353. } else {
  8354. /* istanbul ignore next */
  8355. return false
  8356. }
  8357. } catch (e) {
  8358. /* istanbul ignore next */
  8359. return false
  8360. }
  8361. } else if (!isObjectA && !isObjectB) {
  8362. return String(a) === String(b)
  8363. } else {
  8364. return false
  8365. }
  8366. }
  8367. /**
  8368. * Return the first index at which a loosely equal value can be
  8369. * found in the array (if value is a plain object, the array must
  8370. * contain an object of the same shape), or -1 if it is not present.
  8371. */
  8372. function looseIndexOf (arr, val) {
  8373. for (var i = 0; i < arr.length; i++) {
  8374. if (looseEqual(arr[i], val)) { return i }
  8375. }
  8376. return -1
  8377. }
  8378. /**
  8379. * Ensure a function is called only once.
  8380. */
  8381. function once (fn) {
  8382. var called = false;
  8383. return function () {
  8384. if (!called) {
  8385. called = true;
  8386. fn.apply(this, arguments);
  8387. }
  8388. }
  8389. }
  8390. var ASSET_TYPES = [
  8391. 'component',
  8392. 'directive',
  8393. 'filter'
  8394. ];
  8395. var LIFECYCLE_HOOKS = [
  8396. 'beforeCreate',
  8397. 'created',
  8398. 'beforeMount',
  8399. 'mounted',
  8400. 'beforeUpdate',
  8401. 'updated',
  8402. 'beforeDestroy',
  8403. 'destroyed',
  8404. 'activated',
  8405. 'deactivated',
  8406. 'errorCaptured',
  8407. 'serverPrefetch'
  8408. ];
  8409. /* */
  8410. var config = ({
  8411. /**
  8412. * Option merge strategies (used in core/util/options)
  8413. */
  8414. // $flow-disable-line
  8415. optionMergeStrategies: Object.create(null),
  8416. /**
  8417. * Whether to suppress warnings.
  8418. */
  8419. silent: false,
  8420. /**
  8421. * Show production mode tip message on boot?
  8422. */
  8423. productionTip: "development" !== 'production',
  8424. /**
  8425. * Whether to enable devtools
  8426. */
  8427. devtools: "development" !== 'production',
  8428. /**
  8429. * Whether to record perf
  8430. */
  8431. performance: false,
  8432. /**
  8433. * Error handler for watcher errors
  8434. */
  8435. errorHandler: null,
  8436. /**
  8437. * Warn handler for watcher warns
  8438. */
  8439. warnHandler: null,
  8440. /**
  8441. * Ignore certain custom elements
  8442. */
  8443. ignoredElements: [],
  8444. /**
  8445. * Custom user key aliases for v-on
  8446. */
  8447. // $flow-disable-line
  8448. keyCodes: Object.create(null),
  8449. /**
  8450. * Check if a tag is reserved so that it cannot be registered as a
  8451. * component. This is platform-dependent and may be overwritten.
  8452. */
  8453. isReservedTag: no,
  8454. /**
  8455. * Check if an attribute is reserved so that it cannot be used as a component
  8456. * prop. This is platform-dependent and may be overwritten.
  8457. */
  8458. isReservedAttr: no,
  8459. /**
  8460. * Check if a tag is an unknown element.
  8461. * Platform-dependent.
  8462. */
  8463. isUnknownElement: no,
  8464. /**
  8465. * Get the namespace of an element
  8466. */
  8467. getTagNamespace: noop,
  8468. /**
  8469. * Parse the real tag name for the specific platform.
  8470. */
  8471. parsePlatformTagName: identity,
  8472. /**
  8473. * Check if an attribute must be bound using property, e.g. value
  8474. * Platform-dependent.
  8475. */
  8476. mustUseProp: no,
  8477. /**
  8478. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  8479. * This will significantly reduce performance if set to false.
  8480. */
  8481. async: true,
  8482. /**
  8483. * Exposed for legacy reasons
  8484. */
  8485. _lifecycleHooks: LIFECYCLE_HOOKS
  8486. });
  8487. /* */
  8488. /**
  8489. * unicode letters used for parsing html tags, component names and property paths.
  8490. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  8491. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  8492. */
  8493. 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/;
  8494. /**
  8495. * Check if a string starts with $ or _
  8496. */
  8497. function isReserved (str) {
  8498. var c = (str + '').charCodeAt(0);
  8499. return c === 0x24 || c === 0x5F
  8500. }
  8501. /**
  8502. * Define a property.
  8503. */
  8504. function def (obj, key, val, enumerable) {
  8505. Object.defineProperty(obj, key, {
  8506. value: val,
  8507. enumerable: !!enumerable,
  8508. writable: true,
  8509. configurable: true
  8510. });
  8511. }
  8512. /**
  8513. * Parse simple path.
  8514. */
  8515. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  8516. function parsePath (path) {
  8517. if (bailRE.test(path)) {
  8518. return
  8519. }
  8520. var segments = path.split('.');
  8521. return function (obj) {
  8522. for (var i = 0; i < segments.length; i++) {
  8523. if (!obj) { return }
  8524. obj = obj[segments[i]];
  8525. }
  8526. return obj
  8527. }
  8528. }
  8529. /* */
  8530. // can we use __proto__?
  8531. var hasProto = '__proto__' in {};
  8532. // Browser environment sniffing
  8533. var inBrowser = typeof window !== 'undefined';
  8534. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  8535. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  8536. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  8537. var isIE = UA && /msie|trident/.test(UA);
  8538. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  8539. var isEdge = UA && UA.indexOf('edge/') > 0;
  8540. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  8541. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  8542. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  8543. var isPhantomJS = UA && /phantomjs/.test(UA);
  8544. var isFF = UA && UA.match(/firefox\/(\d+)/);
  8545. // Firefox has a "watch" function on Object.prototype...
  8546. var nativeWatch = ({}).watch;
  8547. if (inBrowser) {
  8548. try {
  8549. var opts = {};
  8550. Object.defineProperty(opts, 'passive', ({
  8551. get: function get () {
  8552. }
  8553. })); // https://github.com/facebook/flow/issues/285
  8554. window.addEventListener('test-passive', null, opts);
  8555. } catch (e) {}
  8556. }
  8557. // this needs to be lazy-evaled because vue may be required before
  8558. // vue-server-renderer can set VUE_ENV
  8559. var _isServer;
  8560. var isServerRendering = function () {
  8561. if (_isServer === undefined) {
  8562. /* istanbul ignore if */
  8563. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  8564. // detect presence of vue-server-renderer and avoid
  8565. // Webpack shimming the process
  8566. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  8567. } else {
  8568. _isServer = false;
  8569. }
  8570. }
  8571. return _isServer
  8572. };
  8573. // detect devtools
  8574. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  8575. /* istanbul ignore next */
  8576. function isNative (Ctor) {
  8577. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  8578. }
  8579. var hasSymbol =
  8580. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  8581. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  8582. var _Set;
  8583. /* istanbul ignore if */ // $flow-disable-line
  8584. if (typeof Set !== 'undefined' && isNative(Set)) {
  8585. // use native Set when available.
  8586. _Set = Set;
  8587. } else {
  8588. // a non-standard Set polyfill that only works with primitive keys.
  8589. _Set = /*@__PURE__*/(function () {
  8590. function Set () {
  8591. this.set = Object.create(null);
  8592. }
  8593. Set.prototype.has = function has (key) {
  8594. return this.set[key] === true
  8595. };
  8596. Set.prototype.add = function add (key) {
  8597. this.set[key] = true;
  8598. };
  8599. Set.prototype.clear = function clear () {
  8600. this.set = Object.create(null);
  8601. };
  8602. return Set;
  8603. }());
  8604. }
  8605. /* */
  8606. var warn = noop;
  8607. var tip = noop;
  8608. var generateComponentTrace = (noop); // work around flow check
  8609. var formatComponentName = (noop);
  8610. if (true) {
  8611. var hasConsole = typeof console !== 'undefined';
  8612. var classifyRE = /(?:^|[-_])(\w)/g;
  8613. var classify = function (str) { return str
  8614. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  8615. .replace(/[-_]/g, ''); };
  8616. warn = function (msg, vm) {
  8617. var trace = vm ? generateComponentTrace(vm) : '';
  8618. if (config.warnHandler) {
  8619. config.warnHandler.call(null, msg, vm, trace);
  8620. } else if (hasConsole && (!config.silent)) {
  8621. console.error(("[Vue warn]: " + msg + trace));
  8622. }
  8623. };
  8624. tip = function (msg, vm) {
  8625. if (hasConsole && (!config.silent)) {
  8626. console.warn("[Vue tip]: " + msg + (
  8627. vm ? generateComponentTrace(vm) : ''
  8628. ));
  8629. }
  8630. };
  8631. formatComponentName = function (vm, includeFile) {
  8632. if (vm.$root === vm) {
  8633. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  8634. return ('') + vm.$options.__file
  8635. }
  8636. return '<Root>'
  8637. }
  8638. var options = typeof vm === 'function' && vm.cid != null
  8639. ? vm.options
  8640. : vm._isVue
  8641. ? vm.$options || vm.constructor.options
  8642. : vm;
  8643. var name = options.name || options._componentTag;
  8644. var file = options.__file;
  8645. if (!name && file) {
  8646. var match = file.match(/([^/\\]+)\.vue$/);
  8647. name = match && match[1];
  8648. }
  8649. return (
  8650. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  8651. (file && includeFile !== false ? (" at " + file) : '')
  8652. )
  8653. };
  8654. var repeat = function (str, n) {
  8655. var res = '';
  8656. while (n) {
  8657. if (n % 2 === 1) { res += str; }
  8658. if (n > 1) { str += str; }
  8659. n >>= 1;
  8660. }
  8661. return res
  8662. };
  8663. generateComponentTrace = function (vm) {
  8664. if (vm._isVue && vm.$parent) {
  8665. var tree = [];
  8666. var currentRecursiveSequence = 0;
  8667. while (vm && vm.$options.name !== 'PageBody') {
  8668. if (tree.length > 0) {
  8669. var last = tree[tree.length - 1];
  8670. if (last.constructor === vm.constructor) {
  8671. currentRecursiveSequence++;
  8672. vm = vm.$parent;
  8673. continue
  8674. } else if (currentRecursiveSequence > 0) {
  8675. tree[tree.length - 1] = [last, currentRecursiveSequence];
  8676. currentRecursiveSequence = 0;
  8677. }
  8678. }
  8679. !vm.$options.isReserved && tree.push(vm);
  8680. vm = vm.$parent;
  8681. }
  8682. return '\n\nfound in\n\n' + tree
  8683. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  8684. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  8685. : formatComponentName(vm))); })
  8686. .join('\n')
  8687. } else {
  8688. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  8689. }
  8690. };
  8691. }
  8692. /* */
  8693. var uid = 0;
  8694. /**
  8695. * A dep is an observable that can have multiple
  8696. * directives subscribing to it.
  8697. */
  8698. var Dep = function Dep () {
  8699. this.id = uid++;
  8700. this.subs = [];
  8701. };
  8702. Dep.prototype.addSub = function addSub (sub) {
  8703. this.subs.push(sub);
  8704. };
  8705. Dep.prototype.removeSub = function removeSub (sub) {
  8706. remove(this.subs, sub);
  8707. };
  8708. Dep.prototype.depend = function depend () {
  8709. if (Dep.SharedObject.target) {
  8710. Dep.SharedObject.target.addDep(this);
  8711. }
  8712. };
  8713. Dep.prototype.notify = function notify () {
  8714. // stabilize the subscriber list first
  8715. var subs = this.subs.slice();
  8716. if ( true && !config.async) {
  8717. // subs aren't sorted in scheduler if not running async
  8718. // we need to sort them now to make sure they fire in correct
  8719. // order
  8720. subs.sort(function (a, b) { return a.id - b.id; });
  8721. }
  8722. for (var i = 0, l = subs.length; i < l; i++) {
  8723. subs[i].update();
  8724. }
  8725. };
  8726. // The current target watcher being evaluated.
  8727. // This is globally unique because only one watcher
  8728. // can be evaluated at a time.
  8729. // fixed by xxxxxx (nvue shared vuex)
  8730. /* eslint-disable no-undef */
  8731. Dep.SharedObject = {};
  8732. Dep.SharedObject.target = null;
  8733. Dep.SharedObject.targetStack = [];
  8734. function pushTarget (target) {
  8735. Dep.SharedObject.targetStack.push(target);
  8736. Dep.SharedObject.target = target;
  8737. Dep.target = target;
  8738. }
  8739. function popTarget () {
  8740. Dep.SharedObject.targetStack.pop();
  8741. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  8742. Dep.target = Dep.SharedObject.target;
  8743. }
  8744. /* */
  8745. var VNode = function VNode (
  8746. tag,
  8747. data,
  8748. children,
  8749. text,
  8750. elm,
  8751. context,
  8752. componentOptions,
  8753. asyncFactory
  8754. ) {
  8755. this.tag = tag;
  8756. this.data = data;
  8757. this.children = children;
  8758. this.text = text;
  8759. this.elm = elm;
  8760. this.ns = undefined;
  8761. this.context = context;
  8762. this.fnContext = undefined;
  8763. this.fnOptions = undefined;
  8764. this.fnScopeId = undefined;
  8765. this.key = data && data.key;
  8766. this.componentOptions = componentOptions;
  8767. this.componentInstance = undefined;
  8768. this.parent = undefined;
  8769. this.raw = false;
  8770. this.isStatic = false;
  8771. this.isRootInsert = true;
  8772. this.isComment = false;
  8773. this.isCloned = false;
  8774. this.isOnce = false;
  8775. this.asyncFactory = asyncFactory;
  8776. this.asyncMeta = undefined;
  8777. this.isAsyncPlaceholder = false;
  8778. };
  8779. var prototypeAccessors = { child: { configurable: true } };
  8780. // DEPRECATED: alias for componentInstance for backwards compat.
  8781. /* istanbul ignore next */
  8782. prototypeAccessors.child.get = function () {
  8783. return this.componentInstance
  8784. };
  8785. Object.defineProperties( VNode.prototype, prototypeAccessors );
  8786. var createEmptyVNode = function (text) {
  8787. if ( text === void 0 ) text = '';
  8788. var node = new VNode();
  8789. node.text = text;
  8790. node.isComment = true;
  8791. return node
  8792. };
  8793. function createTextVNode (val) {
  8794. return new VNode(undefined, undefined, undefined, String(val))
  8795. }
  8796. // optimized shallow clone
  8797. // used for static nodes and slot nodes because they may be reused across
  8798. // multiple renders, cloning them avoids errors when DOM manipulations rely
  8799. // on their elm reference.
  8800. function cloneVNode (vnode) {
  8801. var cloned = new VNode(
  8802. vnode.tag,
  8803. vnode.data,
  8804. // #7975
  8805. // clone children array to avoid mutating original in case of cloning
  8806. // a child.
  8807. vnode.children && vnode.children.slice(),
  8808. vnode.text,
  8809. vnode.elm,
  8810. vnode.context,
  8811. vnode.componentOptions,
  8812. vnode.asyncFactory
  8813. );
  8814. cloned.ns = vnode.ns;
  8815. cloned.isStatic = vnode.isStatic;
  8816. cloned.key = vnode.key;
  8817. cloned.isComment = vnode.isComment;
  8818. cloned.fnContext = vnode.fnContext;
  8819. cloned.fnOptions = vnode.fnOptions;
  8820. cloned.fnScopeId = vnode.fnScopeId;
  8821. cloned.asyncMeta = vnode.asyncMeta;
  8822. cloned.isCloned = true;
  8823. return cloned
  8824. }
  8825. /*
  8826. * not type checking this file because flow doesn't play well with
  8827. * dynamically accessing methods on Array prototype
  8828. */
  8829. var arrayProto = Array.prototype;
  8830. var arrayMethods = Object.create(arrayProto);
  8831. var methodsToPatch = [
  8832. 'push',
  8833. 'pop',
  8834. 'shift',
  8835. 'unshift',
  8836. 'splice',
  8837. 'sort',
  8838. 'reverse'
  8839. ];
  8840. /**
  8841. * Intercept mutating methods and emit events
  8842. */
  8843. methodsToPatch.forEach(function (method) {
  8844. // cache original method
  8845. var original = arrayProto[method];
  8846. def(arrayMethods, method, function mutator () {
  8847. var args = [], len = arguments.length;
  8848. while ( len-- ) args[ len ] = arguments[ len ];
  8849. var result = original.apply(this, args);
  8850. var ob = this.__ob__;
  8851. var inserted;
  8852. switch (method) {
  8853. case 'push':
  8854. case 'unshift':
  8855. inserted = args;
  8856. break
  8857. case 'splice':
  8858. inserted = args.slice(2);
  8859. break
  8860. }
  8861. if (inserted) { ob.observeArray(inserted); }
  8862. // notify change
  8863. ob.dep.notify();
  8864. return result
  8865. });
  8866. });
  8867. /* */
  8868. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  8869. /**
  8870. * In some cases we may want to disable observation inside a component's
  8871. * update computation.
  8872. */
  8873. var shouldObserve = true;
  8874. function toggleObserving (value) {
  8875. shouldObserve = value;
  8876. }
  8877. /**
  8878. * Observer class that is attached to each observed
  8879. * object. Once attached, the observer converts the target
  8880. * object's property keys into getter/setters that
  8881. * collect dependencies and dispatch updates.
  8882. */
  8883. var Observer = function Observer (value) {
  8884. this.value = value;
  8885. this.dep = new Dep();
  8886. this.vmCount = 0;
  8887. def(value, '__ob__', this);
  8888. if (Array.isArray(value)) {
  8889. if (hasProto) {
  8890. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  8891. if(value.push !== value.__proto__.push){
  8892. copyAugment(value, arrayMethods, arrayKeys);
  8893. } else {
  8894. protoAugment(value, arrayMethods);
  8895. }
  8896. }
  8897. } else {
  8898. copyAugment(value, arrayMethods, arrayKeys);
  8899. }
  8900. this.observeArray(value);
  8901. } else {
  8902. this.walk(value);
  8903. }
  8904. };
  8905. /**
  8906. * Walk through all properties and convert them into
  8907. * getter/setters. This method should only be called when
  8908. * value type is Object.
  8909. */
  8910. Observer.prototype.walk = function walk (obj) {
  8911. var keys = Object.keys(obj);
  8912. for (var i = 0; i < keys.length; i++) {
  8913. defineReactive$$1(obj, keys[i]);
  8914. }
  8915. };
  8916. /**
  8917. * Observe a list of Array items.
  8918. */
  8919. Observer.prototype.observeArray = function observeArray (items) {
  8920. for (var i = 0, l = items.length; i < l; i++) {
  8921. observe(items[i]);
  8922. }
  8923. };
  8924. // helpers
  8925. /**
  8926. * Augment a target Object or Array by intercepting
  8927. * the prototype chain using __proto__
  8928. */
  8929. function protoAugment (target, src) {
  8930. /* eslint-disable no-proto */
  8931. target.__proto__ = src;
  8932. /* eslint-enable no-proto */
  8933. }
  8934. /**
  8935. * Augment a target Object or Array by defining
  8936. * hidden properties.
  8937. */
  8938. /* istanbul ignore next */
  8939. function copyAugment (target, src, keys) {
  8940. for (var i = 0, l = keys.length; i < l; i++) {
  8941. var key = keys[i];
  8942. def(target, key, src[key]);
  8943. }
  8944. }
  8945. /**
  8946. * Attempt to create an observer instance for a value,
  8947. * returns the new observer if successfully observed,
  8948. * or the existing observer if the value already has one.
  8949. */
  8950. function observe (value, asRootData) {
  8951. if (!isObject(value) || value instanceof VNode) {
  8952. return
  8953. }
  8954. var ob;
  8955. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  8956. ob = value.__ob__;
  8957. } else if (
  8958. shouldObserve &&
  8959. !isServerRendering() &&
  8960. (Array.isArray(value) || isPlainObject(value)) &&
  8961. Object.isExtensible(value) &&
  8962. !value._isVue
  8963. ) {
  8964. ob = new Observer(value);
  8965. }
  8966. if (asRootData && ob) {
  8967. ob.vmCount++;
  8968. }
  8969. return ob
  8970. }
  8971. /**
  8972. * Define a reactive property on an Object.
  8973. */
  8974. function defineReactive$$1 (
  8975. obj,
  8976. key,
  8977. val,
  8978. customSetter,
  8979. shallow
  8980. ) {
  8981. var dep = new Dep();
  8982. var property = Object.getOwnPropertyDescriptor(obj, key);
  8983. if (property && property.configurable === false) {
  8984. return
  8985. }
  8986. // cater for pre-defined getter/setters
  8987. var getter = property && property.get;
  8988. var setter = property && property.set;
  8989. if ((!getter || setter) && arguments.length === 2) {
  8990. val = obj[key];
  8991. }
  8992. var childOb = !shallow && observe(val);
  8993. Object.defineProperty(obj, key, {
  8994. enumerable: true,
  8995. configurable: true,
  8996. get: function reactiveGetter () {
  8997. var value = getter ? getter.call(obj) : val;
  8998. if (Dep.SharedObject.target) { // fixed by xxxxxx
  8999. dep.depend();
  9000. if (childOb) {
  9001. childOb.dep.depend();
  9002. if (Array.isArray(value)) {
  9003. dependArray(value);
  9004. }
  9005. }
  9006. }
  9007. return value
  9008. },
  9009. set: function reactiveSetter (newVal) {
  9010. var value = getter ? getter.call(obj) : val;
  9011. /* eslint-disable no-self-compare */
  9012. if (newVal === value || (newVal !== newVal && value !== value)) {
  9013. return
  9014. }
  9015. /* eslint-enable no-self-compare */
  9016. if ( true && customSetter) {
  9017. customSetter();
  9018. }
  9019. // #7981: for accessor properties without setter
  9020. if (getter && !setter) { return }
  9021. if (setter) {
  9022. setter.call(obj, newVal);
  9023. } else {
  9024. val = newVal;
  9025. }
  9026. childOb = !shallow && observe(newVal);
  9027. dep.notify();
  9028. }
  9029. });
  9030. }
  9031. /**
  9032. * Set a property on an object. Adds the new property and
  9033. * triggers change notification if the property doesn't
  9034. * already exist.
  9035. */
  9036. function set (target, key, val) {
  9037. if ( true &&
  9038. (isUndef(target) || isPrimitive(target))
  9039. ) {
  9040. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  9041. }
  9042. if (Array.isArray(target) && isValidArrayIndex(key)) {
  9043. target.length = Math.max(target.length, key);
  9044. target.splice(key, 1, val);
  9045. return val
  9046. }
  9047. if (key in target && !(key in Object.prototype)) {
  9048. target[key] = val;
  9049. return val
  9050. }
  9051. var ob = (target).__ob__;
  9052. if (target._isVue || (ob && ob.vmCount)) {
  9053. true && warn(
  9054. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  9055. 'at runtime - declare it upfront in the data option.'
  9056. );
  9057. return val
  9058. }
  9059. if (!ob) {
  9060. target[key] = val;
  9061. return val
  9062. }
  9063. defineReactive$$1(ob.value, key, val);
  9064. ob.dep.notify();
  9065. return val
  9066. }
  9067. /**
  9068. * Delete a property and trigger change if necessary.
  9069. */
  9070. function del (target, key) {
  9071. if ( true &&
  9072. (isUndef(target) || isPrimitive(target))
  9073. ) {
  9074. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  9075. }
  9076. if (Array.isArray(target) && isValidArrayIndex(key)) {
  9077. target.splice(key, 1);
  9078. return
  9079. }
  9080. var ob = (target).__ob__;
  9081. if (target._isVue || (ob && ob.vmCount)) {
  9082. true && warn(
  9083. 'Avoid deleting properties on a Vue instance or its root $data ' +
  9084. '- just set it to null.'
  9085. );
  9086. return
  9087. }
  9088. if (!hasOwn(target, key)) {
  9089. return
  9090. }
  9091. delete target[key];
  9092. if (!ob) {
  9093. return
  9094. }
  9095. ob.dep.notify();
  9096. }
  9097. /**
  9098. * Collect dependencies on array elements when the array is touched, since
  9099. * we cannot intercept array element access like property getters.
  9100. */
  9101. function dependArray (value) {
  9102. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  9103. e = value[i];
  9104. e && e.__ob__ && e.__ob__.dep.depend();
  9105. if (Array.isArray(e)) {
  9106. dependArray(e);
  9107. }
  9108. }
  9109. }
  9110. /* */
  9111. /**
  9112. * Option overwriting strategies are functions that handle
  9113. * how to merge a parent option value and a child option
  9114. * value into the final value.
  9115. */
  9116. var strats = config.optionMergeStrategies;
  9117. /**
  9118. * Options with restrictions
  9119. */
  9120. if (true) {
  9121. strats.el = strats.propsData = function (parent, child, vm, key) {
  9122. if (!vm) {
  9123. warn(
  9124. "option \"" + key + "\" can only be used during instance " +
  9125. 'creation with the `new` keyword.'
  9126. );
  9127. }
  9128. return defaultStrat(parent, child)
  9129. };
  9130. }
  9131. /**
  9132. * Helper that recursively merges two data objects together.
  9133. */
  9134. function mergeData (to, from) {
  9135. if (!from) { return to }
  9136. var key, toVal, fromVal;
  9137. var keys = hasSymbol
  9138. ? Reflect.ownKeys(from)
  9139. : Object.keys(from);
  9140. for (var i = 0; i < keys.length; i++) {
  9141. key = keys[i];
  9142. // in case the object is already observed...
  9143. if (key === '__ob__') { continue }
  9144. toVal = to[key];
  9145. fromVal = from[key];
  9146. if (!hasOwn(to, key)) {
  9147. set(to, key, fromVal);
  9148. } else if (
  9149. toVal !== fromVal &&
  9150. isPlainObject(toVal) &&
  9151. isPlainObject(fromVal)
  9152. ) {
  9153. mergeData(toVal, fromVal);
  9154. }
  9155. }
  9156. return to
  9157. }
  9158. /**
  9159. * Data
  9160. */
  9161. function mergeDataOrFn (
  9162. parentVal,
  9163. childVal,
  9164. vm
  9165. ) {
  9166. if (!vm) {
  9167. // in a Vue.extend merge, both should be functions
  9168. if (!childVal) {
  9169. return parentVal
  9170. }
  9171. if (!parentVal) {
  9172. return childVal
  9173. }
  9174. // when parentVal & childVal are both present,
  9175. // we need to return a function that returns the
  9176. // merged result of both functions... no need to
  9177. // check if parentVal is a function here because
  9178. // it has to be a function to pass previous merges.
  9179. return function mergedDataFn () {
  9180. return mergeData(
  9181. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  9182. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  9183. )
  9184. }
  9185. } else {
  9186. return function mergedInstanceDataFn () {
  9187. // instance merge
  9188. var instanceData = typeof childVal === 'function'
  9189. ? childVal.call(vm, vm)
  9190. : childVal;
  9191. var defaultData = typeof parentVal === 'function'
  9192. ? parentVal.call(vm, vm)
  9193. : parentVal;
  9194. if (instanceData) {
  9195. return mergeData(instanceData, defaultData)
  9196. } else {
  9197. return defaultData
  9198. }
  9199. }
  9200. }
  9201. }
  9202. strats.data = function (
  9203. parentVal,
  9204. childVal,
  9205. vm
  9206. ) {
  9207. if (!vm) {
  9208. if (childVal && typeof childVal !== 'function') {
  9209. true && warn(
  9210. 'The "data" option should be a function ' +
  9211. 'that returns a per-instance value in component ' +
  9212. 'definitions.',
  9213. vm
  9214. );
  9215. return parentVal
  9216. }
  9217. return mergeDataOrFn(parentVal, childVal)
  9218. }
  9219. return mergeDataOrFn(parentVal, childVal, vm)
  9220. };
  9221. /**
  9222. * Hooks and props are merged as arrays.
  9223. */
  9224. function mergeHook (
  9225. parentVal,
  9226. childVal
  9227. ) {
  9228. var res = childVal
  9229. ? parentVal
  9230. ? parentVal.concat(childVal)
  9231. : Array.isArray(childVal)
  9232. ? childVal
  9233. : [childVal]
  9234. : parentVal;
  9235. return res
  9236. ? dedupeHooks(res)
  9237. : res
  9238. }
  9239. function dedupeHooks (hooks) {
  9240. var res = [];
  9241. for (var i = 0; i < hooks.length; i++) {
  9242. if (res.indexOf(hooks[i]) === -1) {
  9243. res.push(hooks[i]);
  9244. }
  9245. }
  9246. return res
  9247. }
  9248. LIFECYCLE_HOOKS.forEach(function (hook) {
  9249. strats[hook] = mergeHook;
  9250. });
  9251. /**
  9252. * Assets
  9253. *
  9254. * When a vm is present (instance creation), we need to do
  9255. * a three-way merge between constructor options, instance
  9256. * options and parent options.
  9257. */
  9258. function mergeAssets (
  9259. parentVal,
  9260. childVal,
  9261. vm,
  9262. key
  9263. ) {
  9264. var res = Object.create(parentVal || null);
  9265. if (childVal) {
  9266. true && assertObjectType(key, childVal, vm);
  9267. return extend(res, childVal)
  9268. } else {
  9269. return res
  9270. }
  9271. }
  9272. ASSET_TYPES.forEach(function (type) {
  9273. strats[type + 's'] = mergeAssets;
  9274. });
  9275. /**
  9276. * Watchers.
  9277. *
  9278. * Watchers hashes should not overwrite one
  9279. * another, so we merge them as arrays.
  9280. */
  9281. strats.watch = function (
  9282. parentVal,
  9283. childVal,
  9284. vm,
  9285. key
  9286. ) {
  9287. // work around Firefox's Object.prototype.watch...
  9288. if (parentVal === nativeWatch) { parentVal = undefined; }
  9289. if (childVal === nativeWatch) { childVal = undefined; }
  9290. /* istanbul ignore if */
  9291. if (!childVal) { return Object.create(parentVal || null) }
  9292. if (true) {
  9293. assertObjectType(key, childVal, vm);
  9294. }
  9295. if (!parentVal) { return childVal }
  9296. var ret = {};
  9297. extend(ret, parentVal);
  9298. for (var key$1 in childVal) {
  9299. var parent = ret[key$1];
  9300. var child = childVal[key$1];
  9301. if (parent && !Array.isArray(parent)) {
  9302. parent = [parent];
  9303. }
  9304. ret[key$1] = parent
  9305. ? parent.concat(child)
  9306. : Array.isArray(child) ? child : [child];
  9307. }
  9308. return ret
  9309. };
  9310. /**
  9311. * Other object hashes.
  9312. */
  9313. strats.props =
  9314. strats.methods =
  9315. strats.inject =
  9316. strats.computed = function (
  9317. parentVal,
  9318. childVal,
  9319. vm,
  9320. key
  9321. ) {
  9322. if (childVal && "development" !== 'production') {
  9323. assertObjectType(key, childVal, vm);
  9324. }
  9325. if (!parentVal) { return childVal }
  9326. var ret = Object.create(null);
  9327. extend(ret, parentVal);
  9328. if (childVal) { extend(ret, childVal); }
  9329. return ret
  9330. };
  9331. strats.provide = mergeDataOrFn;
  9332. /**
  9333. * Default strategy.
  9334. */
  9335. var defaultStrat = function (parentVal, childVal) {
  9336. return childVal === undefined
  9337. ? parentVal
  9338. : childVal
  9339. };
  9340. /**
  9341. * Validate component names
  9342. */
  9343. function checkComponents (options) {
  9344. for (var key in options.components) {
  9345. validateComponentName(key);
  9346. }
  9347. }
  9348. function validateComponentName (name) {
  9349. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  9350. warn(
  9351. 'Invalid component name: "' + name + '". Component names ' +
  9352. 'should conform to valid custom element name in html5 specification.'
  9353. );
  9354. }
  9355. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  9356. warn(
  9357. 'Do not use built-in or reserved HTML elements as component ' +
  9358. 'id: ' + name
  9359. );
  9360. }
  9361. }
  9362. /**
  9363. * Ensure all props option syntax are normalized into the
  9364. * Object-based format.
  9365. */
  9366. function normalizeProps (options, vm) {
  9367. var props = options.props;
  9368. if (!props) { return }
  9369. var res = {};
  9370. var i, val, name;
  9371. if (Array.isArray(props)) {
  9372. i = props.length;
  9373. while (i--) {
  9374. val = props[i];
  9375. if (typeof val === 'string') {
  9376. name = camelize(val);
  9377. res[name] = { type: null };
  9378. } else if (true) {
  9379. warn('props must be strings when using array syntax.');
  9380. }
  9381. }
  9382. } else if (isPlainObject(props)) {
  9383. for (var key in props) {
  9384. val = props[key];
  9385. name = camelize(key);
  9386. res[name] = isPlainObject(val)
  9387. ? val
  9388. : { type: val };
  9389. }
  9390. } else if (true) {
  9391. warn(
  9392. "Invalid value for option \"props\": expected an Array or an Object, " +
  9393. "but got " + (toRawType(props)) + ".",
  9394. vm
  9395. );
  9396. }
  9397. options.props = res;
  9398. }
  9399. /**
  9400. * Normalize all injections into Object-based format
  9401. */
  9402. function normalizeInject (options, vm) {
  9403. var inject = options.inject;
  9404. if (!inject) { return }
  9405. var normalized = options.inject = {};
  9406. if (Array.isArray(inject)) {
  9407. for (var i = 0; i < inject.length; i++) {
  9408. normalized[inject[i]] = { from: inject[i] };
  9409. }
  9410. } else if (isPlainObject(inject)) {
  9411. for (var key in inject) {
  9412. var val = inject[key];
  9413. normalized[key] = isPlainObject(val)
  9414. ? extend({ from: key }, val)
  9415. : { from: val };
  9416. }
  9417. } else if (true) {
  9418. warn(
  9419. "Invalid value for option \"inject\": expected an Array or an Object, " +
  9420. "but got " + (toRawType(inject)) + ".",
  9421. vm
  9422. );
  9423. }
  9424. }
  9425. /**
  9426. * Normalize raw function directives into object format.
  9427. */
  9428. function normalizeDirectives (options) {
  9429. var dirs = options.directives;
  9430. if (dirs) {
  9431. for (var key in dirs) {
  9432. var def$$1 = dirs[key];
  9433. if (typeof def$$1 === 'function') {
  9434. dirs[key] = { bind: def$$1, update: def$$1 };
  9435. }
  9436. }
  9437. }
  9438. }
  9439. function assertObjectType (name, value, vm) {
  9440. if (!isPlainObject(value)) {
  9441. warn(
  9442. "Invalid value for option \"" + name + "\": expected an Object, " +
  9443. "but got " + (toRawType(value)) + ".",
  9444. vm
  9445. );
  9446. }
  9447. }
  9448. /**
  9449. * Merge two option objects into a new one.
  9450. * Core utility used in both instantiation and inheritance.
  9451. */
  9452. function mergeOptions (
  9453. parent,
  9454. child,
  9455. vm
  9456. ) {
  9457. if (true) {
  9458. checkComponents(child);
  9459. }
  9460. if (typeof child === 'function') {
  9461. child = child.options;
  9462. }
  9463. normalizeProps(child, vm);
  9464. normalizeInject(child, vm);
  9465. normalizeDirectives(child);
  9466. // Apply extends and mixins on the child options,
  9467. // but only if it is a raw options object that isn't
  9468. // the result of another mergeOptions call.
  9469. // Only merged options has the _base property.
  9470. if (!child._base) {
  9471. if (child.extends) {
  9472. parent = mergeOptions(parent, child.extends, vm);
  9473. }
  9474. if (child.mixins) {
  9475. for (var i = 0, l = child.mixins.length; i < l; i++) {
  9476. parent = mergeOptions(parent, child.mixins[i], vm);
  9477. }
  9478. }
  9479. }
  9480. var options = {};
  9481. var key;
  9482. for (key in parent) {
  9483. mergeField(key);
  9484. }
  9485. for (key in child) {
  9486. if (!hasOwn(parent, key)) {
  9487. mergeField(key);
  9488. }
  9489. }
  9490. function mergeField (key) {
  9491. var strat = strats[key] || defaultStrat;
  9492. options[key] = strat(parent[key], child[key], vm, key);
  9493. }
  9494. return options
  9495. }
  9496. /**
  9497. * Resolve an asset.
  9498. * This function is used because child instances need access
  9499. * to assets defined in its ancestor chain.
  9500. */
  9501. function resolveAsset (
  9502. options,
  9503. type,
  9504. id,
  9505. warnMissing
  9506. ) {
  9507. /* istanbul ignore if */
  9508. if (typeof id !== 'string') {
  9509. return
  9510. }
  9511. var assets = options[type];
  9512. // check local registration variations first
  9513. if (hasOwn(assets, id)) { return assets[id] }
  9514. var camelizedId = camelize(id);
  9515. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  9516. var PascalCaseId = capitalize(camelizedId);
  9517. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  9518. // fallback to prototype chain
  9519. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  9520. if ( true && warnMissing && !res) {
  9521. warn(
  9522. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  9523. options
  9524. );
  9525. }
  9526. return res
  9527. }
  9528. /* */
  9529. function validateProp (
  9530. key,
  9531. propOptions,
  9532. propsData,
  9533. vm
  9534. ) {
  9535. var prop = propOptions[key];
  9536. var absent = !hasOwn(propsData, key);
  9537. var value = propsData[key];
  9538. // boolean casting
  9539. var booleanIndex = getTypeIndex(Boolean, prop.type);
  9540. if (booleanIndex > -1) {
  9541. if (absent && !hasOwn(prop, 'default')) {
  9542. value = false;
  9543. } else if (value === '' || value === hyphenate(key)) {
  9544. // only cast empty string / same name to boolean if
  9545. // boolean has higher priority
  9546. var stringIndex = getTypeIndex(String, prop.type);
  9547. if (stringIndex < 0 || booleanIndex < stringIndex) {
  9548. value = true;
  9549. }
  9550. }
  9551. }
  9552. // check default value
  9553. if (value === undefined) {
  9554. value = getPropDefaultValue(vm, prop, key);
  9555. // since the default value is a fresh copy,
  9556. // make sure to observe it.
  9557. var prevShouldObserve = shouldObserve;
  9558. toggleObserving(true);
  9559. observe(value);
  9560. toggleObserving(prevShouldObserve);
  9561. }
  9562. if (
  9563. true
  9564. ) {
  9565. assertProp(prop, key, value, vm, absent);
  9566. }
  9567. return value
  9568. }
  9569. /**
  9570. * Get the default value of a prop.
  9571. */
  9572. function getPropDefaultValue (vm, prop, key) {
  9573. // no default, return undefined
  9574. if (!hasOwn(prop, 'default')) {
  9575. return undefined
  9576. }
  9577. var def = prop.default;
  9578. // warn against non-factory defaults for Object & Array
  9579. if ( true && isObject(def)) {
  9580. warn(
  9581. 'Invalid default value for prop "' + key + '": ' +
  9582. 'Props with type Object/Array must use a factory function ' +
  9583. 'to return the default value.',
  9584. vm
  9585. );
  9586. }
  9587. // the raw prop value was also undefined from previous render,
  9588. // return previous default value to avoid unnecessary watcher trigger
  9589. if (vm && vm.$options.propsData &&
  9590. vm.$options.propsData[key] === undefined &&
  9591. vm._props[key] !== undefined
  9592. ) {
  9593. return vm._props[key]
  9594. }
  9595. // call factory function for non-Function types
  9596. // a value is Function if its prototype is function even across different execution context
  9597. return typeof def === 'function' && getType(prop.type) !== 'Function'
  9598. ? def.call(vm)
  9599. : def
  9600. }
  9601. /**
  9602. * Assert whether a prop is valid.
  9603. */
  9604. function assertProp (
  9605. prop,
  9606. name,
  9607. value,
  9608. vm,
  9609. absent
  9610. ) {
  9611. if (prop.required && absent) {
  9612. warn(
  9613. 'Missing required prop: "' + name + '"',
  9614. vm
  9615. );
  9616. return
  9617. }
  9618. if (value == null && !prop.required) {
  9619. return
  9620. }
  9621. var type = prop.type;
  9622. var valid = !type || type === true;
  9623. var expectedTypes = [];
  9624. if (type) {
  9625. if (!Array.isArray(type)) {
  9626. type = [type];
  9627. }
  9628. for (var i = 0; i < type.length && !valid; i++) {
  9629. var assertedType = assertType(value, type[i]);
  9630. expectedTypes.push(assertedType.expectedType || '');
  9631. valid = assertedType.valid;
  9632. }
  9633. }
  9634. if (!valid) {
  9635. warn(
  9636. getInvalidTypeMessage(name, value, expectedTypes),
  9637. vm
  9638. );
  9639. return
  9640. }
  9641. var validator = prop.validator;
  9642. if (validator) {
  9643. if (!validator(value)) {
  9644. warn(
  9645. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  9646. vm
  9647. );
  9648. }
  9649. }
  9650. }
  9651. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  9652. function assertType (value, type) {
  9653. var valid;
  9654. var expectedType = getType(type);
  9655. if (simpleCheckRE.test(expectedType)) {
  9656. var t = typeof value;
  9657. valid = t === expectedType.toLowerCase();
  9658. // for primitive wrapper objects
  9659. if (!valid && t === 'object') {
  9660. valid = value instanceof type;
  9661. }
  9662. } else if (expectedType === 'Object') {
  9663. valid = isPlainObject(value);
  9664. } else if (expectedType === 'Array') {
  9665. valid = Array.isArray(value);
  9666. } else {
  9667. valid = value instanceof type;
  9668. }
  9669. return {
  9670. valid: valid,
  9671. expectedType: expectedType
  9672. }
  9673. }
  9674. /**
  9675. * Use function string name to check built-in types,
  9676. * because a simple equality check will fail when running
  9677. * across different vms / iframes.
  9678. */
  9679. function getType (fn) {
  9680. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  9681. return match ? match[1] : ''
  9682. }
  9683. function isSameType (a, b) {
  9684. return getType(a) === getType(b)
  9685. }
  9686. function getTypeIndex (type, expectedTypes) {
  9687. if (!Array.isArray(expectedTypes)) {
  9688. return isSameType(expectedTypes, type) ? 0 : -1
  9689. }
  9690. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  9691. if (isSameType(expectedTypes[i], type)) {
  9692. return i
  9693. }
  9694. }
  9695. return -1
  9696. }
  9697. function getInvalidTypeMessage (name, value, expectedTypes) {
  9698. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  9699. " Expected " + (expectedTypes.map(capitalize).join(', '));
  9700. var expectedType = expectedTypes[0];
  9701. var receivedType = toRawType(value);
  9702. var expectedValue = styleValue(value, expectedType);
  9703. var receivedValue = styleValue(value, receivedType);
  9704. // check if we need to specify expected value
  9705. if (expectedTypes.length === 1 &&
  9706. isExplicable(expectedType) &&
  9707. !isBoolean(expectedType, receivedType)) {
  9708. message += " with value " + expectedValue;
  9709. }
  9710. message += ", got " + receivedType + " ";
  9711. // check if we need to specify received value
  9712. if (isExplicable(receivedType)) {
  9713. message += "with value " + receivedValue + ".";
  9714. }
  9715. return message
  9716. }
  9717. function styleValue (value, type) {
  9718. if (type === 'String') {
  9719. return ("\"" + value + "\"")
  9720. } else if (type === 'Number') {
  9721. return ("" + (Number(value)))
  9722. } else {
  9723. return ("" + value)
  9724. }
  9725. }
  9726. function isExplicable (value) {
  9727. var explicitTypes = ['string', 'number', 'boolean'];
  9728. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  9729. }
  9730. function isBoolean () {
  9731. var args = [], len = arguments.length;
  9732. while ( len-- ) args[ len ] = arguments[ len ];
  9733. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  9734. }
  9735. /* */
  9736. function handleError (err, vm, info) {
  9737. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  9738. // See: https://github.com/vuejs/vuex/issues/1505
  9739. pushTarget();
  9740. try {
  9741. if (vm) {
  9742. var cur = vm;
  9743. while ((cur = cur.$parent)) {
  9744. var hooks = cur.$options.errorCaptured;
  9745. if (hooks) {
  9746. for (var i = 0; i < hooks.length; i++) {
  9747. try {
  9748. var capture = hooks[i].call(cur, err, vm, info) === false;
  9749. if (capture) { return }
  9750. } catch (e) {
  9751. globalHandleError(e, cur, 'errorCaptured hook');
  9752. }
  9753. }
  9754. }
  9755. }
  9756. }
  9757. globalHandleError(err, vm, info);
  9758. } finally {
  9759. popTarget();
  9760. }
  9761. }
  9762. function invokeWithErrorHandling (
  9763. handler,
  9764. context,
  9765. args,
  9766. vm,
  9767. info
  9768. ) {
  9769. var res;
  9770. try {
  9771. res = args ? handler.apply(context, args) : handler.call(context);
  9772. if (res && !res._isVue && isPromise(res) && !res._handled) {
  9773. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  9774. // issue #9511
  9775. // avoid catch triggering multiple times when nested calls
  9776. res._handled = true;
  9777. }
  9778. } catch (e) {
  9779. handleError(e, vm, info);
  9780. }
  9781. return res
  9782. }
  9783. function globalHandleError (err, vm, info) {
  9784. if (config.errorHandler) {
  9785. try {
  9786. return config.errorHandler.call(null, err, vm, info)
  9787. } catch (e) {
  9788. // if the user intentionally throws the original error in the handler,
  9789. // do not log it twice
  9790. if (e !== err) {
  9791. logError(e, null, 'config.errorHandler');
  9792. }
  9793. }
  9794. }
  9795. logError(err, vm, info);
  9796. }
  9797. function logError (err, vm, info) {
  9798. if (true) {
  9799. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  9800. }
  9801. /* istanbul ignore else */
  9802. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  9803. console.error(err);
  9804. } else {
  9805. throw err
  9806. }
  9807. }
  9808. /* */
  9809. var callbacks = [];
  9810. var pending = false;
  9811. function flushCallbacks () {
  9812. pending = false;
  9813. var copies = callbacks.slice(0);
  9814. callbacks.length = 0;
  9815. for (var i = 0; i < copies.length; i++) {
  9816. copies[i]();
  9817. }
  9818. }
  9819. // Here we have async deferring wrappers using microtasks.
  9820. // In 2.5 we used (macro) tasks (in combination with microtasks).
  9821. // However, it has subtle problems when state is changed right before repaint
  9822. // (e.g. #6813, out-in transitions).
  9823. // Also, using (macro) tasks in event handler would cause some weird behaviors
  9824. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  9825. // So we now use microtasks everywhere, again.
  9826. // A major drawback of this tradeoff is that there are some scenarios
  9827. // where microtasks have too high a priority and fire in between supposedly
  9828. // sequential events (e.g. #4521, #6690, which have workarounds)
  9829. // or even between bubbling of the same event (#6566).
  9830. var timerFunc;
  9831. // The nextTick behavior leverages the microtask queue, which can be accessed
  9832. // via either native Promise.then or MutationObserver.
  9833. // MutationObserver has wider support, however it is seriously bugged in
  9834. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  9835. // completely stops working after triggering a few times... so, if native
  9836. // Promise is available, we will use it:
  9837. /* istanbul ignore next, $flow-disable-line */
  9838. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  9839. var p = Promise.resolve();
  9840. timerFunc = function () {
  9841. p.then(flushCallbacks);
  9842. // In problematic UIWebViews, Promise.then doesn't completely break, but
  9843. // it can get stuck in a weird state where callbacks are pushed into the
  9844. // microtask queue but the queue isn't being flushed, until the browser
  9845. // needs to do some other work, e.g. handle a timer. Therefore we can
  9846. // "force" the microtask queue to be flushed by adding an empty timer.
  9847. if (isIOS) { setTimeout(noop); }
  9848. };
  9849. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  9850. isNative(MutationObserver) ||
  9851. // PhantomJS and iOS 7.x
  9852. MutationObserver.toString() === '[object MutationObserverConstructor]'
  9853. )) {
  9854. // Use MutationObserver where native Promise is not available,
  9855. // e.g. PhantomJS, iOS7, Android 4.4
  9856. // (#6466 MutationObserver is unreliable in IE11)
  9857. var counter = 1;
  9858. var observer = new MutationObserver(flushCallbacks);
  9859. var textNode = document.createTextNode(String(counter));
  9860. observer.observe(textNode, {
  9861. characterData: true
  9862. });
  9863. timerFunc = function () {
  9864. counter = (counter + 1) % 2;
  9865. textNode.data = String(counter);
  9866. };
  9867. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  9868. // Fallback to setImmediate.
  9869. // Technically it leverages the (macro) task queue,
  9870. // but it is still a better choice than setTimeout.
  9871. timerFunc = function () {
  9872. setImmediate(flushCallbacks);
  9873. };
  9874. } else {
  9875. // Fallback to setTimeout.
  9876. timerFunc = function () {
  9877. setTimeout(flushCallbacks, 0);
  9878. };
  9879. }
  9880. function nextTick (cb, ctx) {
  9881. var _resolve;
  9882. callbacks.push(function () {
  9883. if (cb) {
  9884. try {
  9885. cb.call(ctx);
  9886. } catch (e) {
  9887. handleError(e, ctx, 'nextTick');
  9888. }
  9889. } else if (_resolve) {
  9890. _resolve(ctx);
  9891. }
  9892. });
  9893. if (!pending) {
  9894. pending = true;
  9895. timerFunc();
  9896. }
  9897. // $flow-disable-line
  9898. if (!cb && typeof Promise !== 'undefined') {
  9899. return new Promise(function (resolve) {
  9900. _resolve = resolve;
  9901. })
  9902. }
  9903. }
  9904. /* */
  9905. /* not type checking this file because flow doesn't play well with Proxy */
  9906. var initProxy;
  9907. if (true) {
  9908. var allowedGlobals = makeMap(
  9909. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  9910. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  9911. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  9912. 'require' // for Webpack/Browserify
  9913. );
  9914. var warnNonPresent = function (target, key) {
  9915. warn(
  9916. "Property or method \"" + key + "\" is not defined on the instance but " +
  9917. 'referenced during render. Make sure that this property is reactive, ' +
  9918. 'either in the data option, or for class-based components, by ' +
  9919. 'initializing the property. ' +
  9920. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  9921. target
  9922. );
  9923. };
  9924. var warnReservedPrefix = function (target, key) {
  9925. warn(
  9926. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  9927. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  9928. 'prevent conflicts with Vue internals. ' +
  9929. 'See: https://vuejs.org/v2/api/#data',
  9930. target
  9931. );
  9932. };
  9933. var hasProxy =
  9934. typeof Proxy !== 'undefined' && isNative(Proxy);
  9935. if (hasProxy) {
  9936. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  9937. config.keyCodes = new Proxy(config.keyCodes, {
  9938. set: function set (target, key, value) {
  9939. if (isBuiltInModifier(key)) {
  9940. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  9941. return false
  9942. } else {
  9943. target[key] = value;
  9944. return true
  9945. }
  9946. }
  9947. });
  9948. }
  9949. var hasHandler = {
  9950. has: function has (target, key) {
  9951. var has = key in target;
  9952. var isAllowed = allowedGlobals(key) ||
  9953. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  9954. if (!has && !isAllowed) {
  9955. if (key in target.$data) { warnReservedPrefix(target, key); }
  9956. else { warnNonPresent(target, key); }
  9957. }
  9958. return has || !isAllowed
  9959. }
  9960. };
  9961. var getHandler = {
  9962. get: function get (target, key) {
  9963. if (typeof key === 'string' && !(key in target)) {
  9964. if (key in target.$data) { warnReservedPrefix(target, key); }
  9965. else { warnNonPresent(target, key); }
  9966. }
  9967. return target[key]
  9968. }
  9969. };
  9970. initProxy = function initProxy (vm) {
  9971. if (hasProxy) {
  9972. // determine which proxy handler to use
  9973. var options = vm.$options;
  9974. var handlers = options.render && options.render._withStripped
  9975. ? getHandler
  9976. : hasHandler;
  9977. vm._renderProxy = new Proxy(vm, handlers);
  9978. } else {
  9979. vm._renderProxy = vm;
  9980. }
  9981. };
  9982. }
  9983. /* */
  9984. var seenObjects = new _Set();
  9985. /**
  9986. * Recursively traverse an object to evoke all converted
  9987. * getters, so that every nested property inside the object
  9988. * is collected as a "deep" dependency.
  9989. */
  9990. function traverse (val) {
  9991. _traverse(val, seenObjects);
  9992. seenObjects.clear();
  9993. }
  9994. function _traverse (val, seen) {
  9995. var i, keys;
  9996. var isA = Array.isArray(val);
  9997. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  9998. return
  9999. }
  10000. if (val.__ob__) {
  10001. var depId = val.__ob__.dep.id;
  10002. if (seen.has(depId)) {
  10003. return
  10004. }
  10005. seen.add(depId);
  10006. }
  10007. if (isA) {
  10008. i = val.length;
  10009. while (i--) { _traverse(val[i], seen); }
  10010. } else {
  10011. keys = Object.keys(val);
  10012. i = keys.length;
  10013. while (i--) { _traverse(val[keys[i]], seen); }
  10014. }
  10015. }
  10016. var mark;
  10017. var measure;
  10018. if (true) {
  10019. var perf = inBrowser && window.performance;
  10020. /* istanbul ignore if */
  10021. if (
  10022. perf &&
  10023. perf.mark &&
  10024. perf.measure &&
  10025. perf.clearMarks &&
  10026. perf.clearMeasures
  10027. ) {
  10028. mark = function (tag) { return perf.mark(tag); };
  10029. measure = function (name, startTag, endTag) {
  10030. perf.measure(name, startTag, endTag);
  10031. perf.clearMarks(startTag);
  10032. perf.clearMarks(endTag);
  10033. // perf.clearMeasures(name)
  10034. };
  10035. }
  10036. }
  10037. /* */
  10038. var normalizeEvent = cached(function (name) {
  10039. var passive = name.charAt(0) === '&';
  10040. name = passive ? name.slice(1) : name;
  10041. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  10042. name = once$$1 ? name.slice(1) : name;
  10043. var capture = name.charAt(0) === '!';
  10044. name = capture ? name.slice(1) : name;
  10045. return {
  10046. name: name,
  10047. once: once$$1,
  10048. capture: capture,
  10049. passive: passive
  10050. }
  10051. });
  10052. function createFnInvoker (fns, vm) {
  10053. function invoker () {
  10054. var arguments$1 = arguments;
  10055. var fns = invoker.fns;
  10056. if (Array.isArray(fns)) {
  10057. var cloned = fns.slice();
  10058. for (var i = 0; i < cloned.length; i++) {
  10059. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  10060. }
  10061. } else {
  10062. // return handler return value for single handlers
  10063. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  10064. }
  10065. }
  10066. invoker.fns = fns;
  10067. return invoker
  10068. }
  10069. function updateListeners (
  10070. on,
  10071. oldOn,
  10072. add,
  10073. remove$$1,
  10074. createOnceHandler,
  10075. vm
  10076. ) {
  10077. var name, def$$1, cur, old, event;
  10078. for (name in on) {
  10079. def$$1 = cur = on[name];
  10080. old = oldOn[name];
  10081. event = normalizeEvent(name);
  10082. if (isUndef(cur)) {
  10083. true && warn(
  10084. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  10085. vm
  10086. );
  10087. } else if (isUndef(old)) {
  10088. if (isUndef(cur.fns)) {
  10089. cur = on[name] = createFnInvoker(cur, vm);
  10090. }
  10091. if (isTrue(event.once)) {
  10092. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  10093. }
  10094. add(event.name, cur, event.capture, event.passive, event.params);
  10095. } else if (cur !== old) {
  10096. old.fns = cur;
  10097. on[name] = old;
  10098. }
  10099. }
  10100. for (name in oldOn) {
  10101. if (isUndef(on[name])) {
  10102. event = normalizeEvent(name);
  10103. remove$$1(event.name, oldOn[name], event.capture);
  10104. }
  10105. }
  10106. }
  10107. /* */
  10108. /* */
  10109. // fixed by xxxxxx (mp properties)
  10110. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  10111. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  10112. if (isUndef(propOptions)) {
  10113. return res
  10114. }
  10115. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  10116. var attrs = data.attrs;
  10117. var props = data.props;
  10118. if (isDef(attrs) || isDef(props)) {
  10119. for (var key in propOptions) {
  10120. var altKey = hyphenate(key);
  10121. var result = checkProp(res, props, key, altKey, true) ||
  10122. checkProp(res, attrs, key, altKey, false);
  10123. // externalClass
  10124. if (
  10125. result &&
  10126. res[key] &&
  10127. externalClasses.indexOf(altKey) !== -1 &&
  10128. context[camelize(res[key])]
  10129. ) {
  10130. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  10131. res[key] = context[camelize(res[key])];
  10132. }
  10133. }
  10134. }
  10135. return res
  10136. }
  10137. function extractPropsFromVNodeData (
  10138. data,
  10139. Ctor,
  10140. tag,
  10141. context// fixed by xxxxxx
  10142. ) {
  10143. // we are only extracting raw values here.
  10144. // validation and default values are handled in the child
  10145. // component itself.
  10146. var propOptions = Ctor.options.props;
  10147. if (isUndef(propOptions)) {
  10148. // fixed by xxxxxx
  10149. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  10150. }
  10151. var res = {};
  10152. var attrs = data.attrs;
  10153. var props = data.props;
  10154. if (isDef(attrs) || isDef(props)) {
  10155. for (var key in propOptions) {
  10156. var altKey = hyphenate(key);
  10157. if (true) {
  10158. var keyInLowerCase = key.toLowerCase();
  10159. if (
  10160. key !== keyInLowerCase &&
  10161. attrs && hasOwn(attrs, keyInLowerCase)
  10162. ) {
  10163. tip(
  10164. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  10165. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  10166. " \"" + key + "\". " +
  10167. "Note that HTML attributes are case-insensitive and camelCased " +
  10168. "props need to use their kebab-case equivalents when using in-DOM " +
  10169. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  10170. );
  10171. }
  10172. }
  10173. checkProp(res, props, key, altKey, true) ||
  10174. checkProp(res, attrs, key, altKey, false);
  10175. }
  10176. }
  10177. // fixed by xxxxxx
  10178. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  10179. }
  10180. function checkProp (
  10181. res,
  10182. hash,
  10183. key,
  10184. altKey,
  10185. preserve
  10186. ) {
  10187. if (isDef(hash)) {
  10188. if (hasOwn(hash, key)) {
  10189. res[key] = hash[key];
  10190. if (!preserve) {
  10191. delete hash[key];
  10192. }
  10193. return true
  10194. } else if (hasOwn(hash, altKey)) {
  10195. res[key] = hash[altKey];
  10196. if (!preserve) {
  10197. delete hash[altKey];
  10198. }
  10199. return true
  10200. }
  10201. }
  10202. return false
  10203. }
  10204. /* */
  10205. // The template compiler attempts to minimize the need for normalization by
  10206. // statically analyzing the template at compile time.
  10207. //
  10208. // For plain HTML markup, normalization can be completely skipped because the
  10209. // generated render function is guaranteed to return Array<VNode>. There are
  10210. // two cases where extra normalization is needed:
  10211. // 1. When the children contains components - because a functional component
  10212. // may return an Array instead of a single root. In this case, just a simple
  10213. // normalization is needed - if any child is an Array, we flatten the whole
  10214. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  10215. // because functional components already normalize their own children.
  10216. function simpleNormalizeChildren (children) {
  10217. for (var i = 0; i < children.length; i++) {
  10218. if (Array.isArray(children[i])) {
  10219. return Array.prototype.concat.apply([], children)
  10220. }
  10221. }
  10222. return children
  10223. }
  10224. // 2. When the children contains constructs that always generated nested Arrays,
  10225. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  10226. // with hand-written render functions / JSX. In such cases a full normalization
  10227. // is needed to cater to all possible types of children values.
  10228. function normalizeChildren (children) {
  10229. return isPrimitive(children)
  10230. ? [createTextVNode(children)]
  10231. : Array.isArray(children)
  10232. ? normalizeArrayChildren(children)
  10233. : undefined
  10234. }
  10235. function isTextNode (node) {
  10236. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  10237. }
  10238. function normalizeArrayChildren (children, nestedIndex) {
  10239. var res = [];
  10240. var i, c, lastIndex, last;
  10241. for (i = 0; i < children.length; i++) {
  10242. c = children[i];
  10243. if (isUndef(c) || typeof c === 'boolean') { continue }
  10244. lastIndex = res.length - 1;
  10245. last = res[lastIndex];
  10246. // nested
  10247. if (Array.isArray(c)) {
  10248. if (c.length > 0) {
  10249. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  10250. // merge adjacent text nodes
  10251. if (isTextNode(c[0]) && isTextNode(last)) {
  10252. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  10253. c.shift();
  10254. }
  10255. res.push.apply(res, c);
  10256. }
  10257. } else if (isPrimitive(c)) {
  10258. if (isTextNode(last)) {
  10259. // merge adjacent text nodes
  10260. // this is necessary for SSR hydration because text nodes are
  10261. // essentially merged when rendered to HTML strings
  10262. res[lastIndex] = createTextVNode(last.text + c);
  10263. } else if (c !== '') {
  10264. // convert primitive to vnode
  10265. res.push(createTextVNode(c));
  10266. }
  10267. } else {
  10268. if (isTextNode(c) && isTextNode(last)) {
  10269. // merge adjacent text nodes
  10270. res[lastIndex] = createTextVNode(last.text + c.text);
  10271. } else {
  10272. // default key for nested array children (likely generated by v-for)
  10273. if (isTrue(children._isVList) &&
  10274. isDef(c.tag) &&
  10275. isUndef(c.key) &&
  10276. isDef(nestedIndex)) {
  10277. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  10278. }
  10279. res.push(c);
  10280. }
  10281. }
  10282. }
  10283. return res
  10284. }
  10285. /* */
  10286. function initProvide (vm) {
  10287. var provide = vm.$options.provide;
  10288. if (provide) {
  10289. vm._provided = typeof provide === 'function'
  10290. ? provide.call(vm)
  10291. : provide;
  10292. }
  10293. }
  10294. function initInjections (vm) {
  10295. var result = resolveInject(vm.$options.inject, vm);
  10296. if (result) {
  10297. toggleObserving(false);
  10298. Object.keys(result).forEach(function (key) {
  10299. /* istanbul ignore else */
  10300. if (true) {
  10301. defineReactive$$1(vm, key, result[key], function () {
  10302. warn(
  10303. "Avoid mutating an injected value directly since the changes will be " +
  10304. "overwritten whenever the provided component re-renders. " +
  10305. "injection being mutated: \"" + key + "\"",
  10306. vm
  10307. );
  10308. });
  10309. } else {}
  10310. });
  10311. toggleObserving(true);
  10312. }
  10313. }
  10314. function resolveInject (inject, vm) {
  10315. if (inject) {
  10316. // inject is :any because flow is not smart enough to figure out cached
  10317. var result = Object.create(null);
  10318. var keys = hasSymbol
  10319. ? Reflect.ownKeys(inject)
  10320. : Object.keys(inject);
  10321. for (var i = 0; i < keys.length; i++) {
  10322. var key = keys[i];
  10323. // #6574 in case the inject object is observed...
  10324. if (key === '__ob__') { continue }
  10325. var provideKey = inject[key].from;
  10326. var source = vm;
  10327. while (source) {
  10328. if (source._provided && hasOwn(source._provided, provideKey)) {
  10329. result[key] = source._provided[provideKey];
  10330. break
  10331. }
  10332. source = source.$parent;
  10333. }
  10334. if (!source) {
  10335. if ('default' in inject[key]) {
  10336. var provideDefault = inject[key].default;
  10337. result[key] = typeof provideDefault === 'function'
  10338. ? provideDefault.call(vm)
  10339. : provideDefault;
  10340. } else if (true) {
  10341. warn(("Injection \"" + key + "\" not found"), vm);
  10342. }
  10343. }
  10344. }
  10345. return result
  10346. }
  10347. }
  10348. /* */
  10349. /**
  10350. * Runtime helper for resolving raw children VNodes into a slot object.
  10351. */
  10352. function resolveSlots (
  10353. children,
  10354. context
  10355. ) {
  10356. if (!children || !children.length) {
  10357. return {}
  10358. }
  10359. var slots = {};
  10360. for (var i = 0, l = children.length; i < l; i++) {
  10361. var child = children[i];
  10362. var data = child.data;
  10363. // remove slot attribute if the node is resolved as a Vue slot node
  10364. if (data && data.attrs && data.attrs.slot) {
  10365. delete data.attrs.slot;
  10366. }
  10367. // named slots should only be respected if the vnode was rendered in the
  10368. // same context.
  10369. if ((child.context === context || child.fnContext === context) &&
  10370. data && data.slot != null
  10371. ) {
  10372. var name = data.slot;
  10373. var slot = (slots[name] || (slots[name] = []));
  10374. if (child.tag === 'template') {
  10375. slot.push.apply(slot, child.children || []);
  10376. } else {
  10377. slot.push(child);
  10378. }
  10379. } else {
  10380. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  10381. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  10382. (slots['page'] || (slots['page'] = [])).push(child);
  10383. }else{
  10384. (slots.default || (slots.default = [])).push(child);
  10385. }
  10386. }
  10387. }
  10388. // ignore slots that contains only whitespace
  10389. for (var name$1 in slots) {
  10390. if (slots[name$1].every(isWhitespace)) {
  10391. delete slots[name$1];
  10392. }
  10393. }
  10394. return slots
  10395. }
  10396. function isWhitespace (node) {
  10397. return (node.isComment && !node.asyncFactory) || node.text === ' '
  10398. }
  10399. /* */
  10400. function normalizeScopedSlots (
  10401. slots,
  10402. normalSlots,
  10403. prevSlots
  10404. ) {
  10405. var res;
  10406. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  10407. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  10408. var key = slots && slots.$key;
  10409. if (!slots) {
  10410. res = {};
  10411. } else if (slots._normalized) {
  10412. // fast path 1: child component re-render only, parent did not change
  10413. return slots._normalized
  10414. } else if (
  10415. isStable &&
  10416. prevSlots &&
  10417. prevSlots !== emptyObject &&
  10418. key === prevSlots.$key &&
  10419. !hasNormalSlots &&
  10420. !prevSlots.$hasNormal
  10421. ) {
  10422. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  10423. // only need to normalize once
  10424. return prevSlots
  10425. } else {
  10426. res = {};
  10427. for (var key$1 in slots) {
  10428. if (slots[key$1] && key$1[0] !== '$') {
  10429. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  10430. }
  10431. }
  10432. }
  10433. // expose normal slots on scopedSlots
  10434. for (var key$2 in normalSlots) {
  10435. if (!(key$2 in res)) {
  10436. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  10437. }
  10438. }
  10439. // avoriaz seems to mock a non-extensible $scopedSlots object
  10440. // and when that is passed down this would cause an error
  10441. if (slots && Object.isExtensible(slots)) {
  10442. (slots)._normalized = res;
  10443. }
  10444. def(res, '$stable', isStable);
  10445. def(res, '$key', key);
  10446. def(res, '$hasNormal', hasNormalSlots);
  10447. return res
  10448. }
  10449. function normalizeScopedSlot(normalSlots, key, fn) {
  10450. var normalized = function () {
  10451. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  10452. res = res && typeof res === 'object' && !Array.isArray(res)
  10453. ? [res] // single vnode
  10454. : normalizeChildren(res);
  10455. return res && (
  10456. res.length === 0 ||
  10457. (res.length === 1 && res[0].isComment) // #9658
  10458. ) ? undefined
  10459. : res
  10460. };
  10461. // this is a slot using the new v-slot syntax without scope. although it is
  10462. // compiled as a scoped slot, render fn users would expect it to be present
  10463. // on this.$slots because the usage is semantically a normal slot.
  10464. if (fn.proxy) {
  10465. Object.defineProperty(normalSlots, key, {
  10466. get: normalized,
  10467. enumerable: true,
  10468. configurable: true
  10469. });
  10470. }
  10471. return normalized
  10472. }
  10473. function proxyNormalSlot(slots, key) {
  10474. return function () { return slots[key]; }
  10475. }
  10476. /* */
  10477. /**
  10478. * Runtime helper for rendering v-for lists.
  10479. */
  10480. function renderList (
  10481. val,
  10482. render
  10483. ) {
  10484. var ret, i, l, keys, key;
  10485. if (Array.isArray(val) || typeof val === 'string') {
  10486. ret = new Array(val.length);
  10487. for (i = 0, l = val.length; i < l; i++) {
  10488. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  10489. }
  10490. } else if (typeof val === 'number') {
  10491. ret = new Array(val);
  10492. for (i = 0; i < val; i++) {
  10493. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  10494. }
  10495. } else if (isObject(val)) {
  10496. if (hasSymbol && val[Symbol.iterator]) {
  10497. ret = [];
  10498. var iterator = val[Symbol.iterator]();
  10499. var result = iterator.next();
  10500. while (!result.done) {
  10501. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  10502. result = iterator.next();
  10503. }
  10504. } else {
  10505. keys = Object.keys(val);
  10506. ret = new Array(keys.length);
  10507. for (i = 0, l = keys.length; i < l; i++) {
  10508. key = keys[i];
  10509. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  10510. }
  10511. }
  10512. }
  10513. if (!isDef(ret)) {
  10514. ret = [];
  10515. }
  10516. (ret)._isVList = true;
  10517. return ret
  10518. }
  10519. /* */
  10520. /**
  10521. * Runtime helper for rendering <slot>
  10522. */
  10523. function renderSlot (
  10524. name,
  10525. fallback,
  10526. props,
  10527. bindObject
  10528. ) {
  10529. var scopedSlotFn = this.$scopedSlots[name];
  10530. var nodes;
  10531. if (scopedSlotFn) { // scoped slot
  10532. props = props || {};
  10533. if (bindObject) {
  10534. if ( true && !isObject(bindObject)) {
  10535. warn(
  10536. 'slot v-bind without argument expects an Object',
  10537. this
  10538. );
  10539. }
  10540. props = extend(extend({}, bindObject), props);
  10541. }
  10542. // fixed by xxxxxx app-plus scopedSlot
  10543. nodes = scopedSlotFn(props, this, props._i) || fallback;
  10544. } else {
  10545. nodes = this.$slots[name] || fallback;
  10546. }
  10547. var target = props && props.slot;
  10548. if (target) {
  10549. return this.$createElement('template', { slot: target }, nodes)
  10550. } else {
  10551. return nodes
  10552. }
  10553. }
  10554. /* */
  10555. /**
  10556. * Runtime helper for resolving filters
  10557. */
  10558. function resolveFilter (id) {
  10559. return resolveAsset(this.$options, 'filters', id, true) || identity
  10560. }
  10561. /* */
  10562. function isKeyNotMatch (expect, actual) {
  10563. if (Array.isArray(expect)) {
  10564. return expect.indexOf(actual) === -1
  10565. } else {
  10566. return expect !== actual
  10567. }
  10568. }
  10569. /**
  10570. * Runtime helper for checking keyCodes from config.
  10571. * exposed as Vue.prototype._k
  10572. * passing in eventKeyName as last argument separately for backwards compat
  10573. */
  10574. function checkKeyCodes (
  10575. eventKeyCode,
  10576. key,
  10577. builtInKeyCode,
  10578. eventKeyName,
  10579. builtInKeyName
  10580. ) {
  10581. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  10582. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  10583. return isKeyNotMatch(builtInKeyName, eventKeyName)
  10584. } else if (mappedKeyCode) {
  10585. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  10586. } else if (eventKeyName) {
  10587. return hyphenate(eventKeyName) !== key
  10588. }
  10589. }
  10590. /* */
  10591. /**
  10592. * Runtime helper for merging v-bind="object" into a VNode's data.
  10593. */
  10594. function bindObjectProps (
  10595. data,
  10596. tag,
  10597. value,
  10598. asProp,
  10599. isSync
  10600. ) {
  10601. if (value) {
  10602. if (!isObject(value)) {
  10603. true && warn(
  10604. 'v-bind without argument expects an Object or Array value',
  10605. this
  10606. );
  10607. } else {
  10608. if (Array.isArray(value)) {
  10609. value = toObject(value);
  10610. }
  10611. var hash;
  10612. var loop = function ( key ) {
  10613. if (
  10614. key === 'class' ||
  10615. key === 'style' ||
  10616. isReservedAttribute(key)
  10617. ) {
  10618. hash = data;
  10619. } else {
  10620. var type = data.attrs && data.attrs.type;
  10621. hash = asProp || config.mustUseProp(tag, type, key)
  10622. ? data.domProps || (data.domProps = {})
  10623. : data.attrs || (data.attrs = {});
  10624. }
  10625. var camelizedKey = camelize(key);
  10626. var hyphenatedKey = hyphenate(key);
  10627. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  10628. hash[key] = value[key];
  10629. if (isSync) {
  10630. var on = data.on || (data.on = {});
  10631. on[("update:" + key)] = function ($event) {
  10632. value[key] = $event;
  10633. };
  10634. }
  10635. }
  10636. };
  10637. for (var key in value) loop( key );
  10638. }
  10639. }
  10640. return data
  10641. }
  10642. /* */
  10643. /**
  10644. * Runtime helper for rendering static trees.
  10645. */
  10646. function renderStatic (
  10647. index,
  10648. isInFor
  10649. ) {
  10650. var cached = this._staticTrees || (this._staticTrees = []);
  10651. var tree = cached[index];
  10652. // if has already-rendered static tree and not inside v-for,
  10653. // we can reuse the same tree.
  10654. if (tree && !isInFor) {
  10655. return tree
  10656. }
  10657. // otherwise, render a fresh tree.
  10658. tree = cached[index] = this.$options.staticRenderFns[index].call(
  10659. this._renderProxy,
  10660. null,
  10661. this // for render fns generated for functional component templates
  10662. );
  10663. markStatic(tree, ("__static__" + index), false);
  10664. return tree
  10665. }
  10666. /**
  10667. * Runtime helper for v-once.
  10668. * Effectively it means marking the node as static with a unique key.
  10669. */
  10670. function markOnce (
  10671. tree,
  10672. index,
  10673. key
  10674. ) {
  10675. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  10676. return tree
  10677. }
  10678. function markStatic (
  10679. tree,
  10680. key,
  10681. isOnce
  10682. ) {
  10683. if (Array.isArray(tree)) {
  10684. for (var i = 0; i < tree.length; i++) {
  10685. if (tree[i] && typeof tree[i] !== 'string') {
  10686. markStaticNode(tree[i], (key + "_" + i), isOnce);
  10687. }
  10688. }
  10689. } else {
  10690. markStaticNode(tree, key, isOnce);
  10691. }
  10692. }
  10693. function markStaticNode (node, key, isOnce) {
  10694. node.isStatic = true;
  10695. node.key = key;
  10696. node.isOnce = isOnce;
  10697. }
  10698. /* */
  10699. function bindObjectListeners (data, value) {
  10700. if (value) {
  10701. if (!isPlainObject(value)) {
  10702. true && warn(
  10703. 'v-on without argument expects an Object value',
  10704. this
  10705. );
  10706. } else {
  10707. var on = data.on = data.on ? extend({}, data.on) : {};
  10708. for (var key in value) {
  10709. var existing = on[key];
  10710. var ours = value[key];
  10711. on[key] = existing ? [].concat(existing, ours) : ours;
  10712. }
  10713. }
  10714. }
  10715. return data
  10716. }
  10717. /* */
  10718. function resolveScopedSlots (
  10719. fns, // see flow/vnode
  10720. res,
  10721. // the following are added in 2.6
  10722. hasDynamicKeys,
  10723. contentHashKey
  10724. ) {
  10725. res = res || { $stable: !hasDynamicKeys };
  10726. for (var i = 0; i < fns.length; i++) {
  10727. var slot = fns[i];
  10728. if (Array.isArray(slot)) {
  10729. resolveScopedSlots(slot, res, hasDynamicKeys);
  10730. } else if (slot) {
  10731. // marker for reverse proxying v-slot without scope on this.$slots
  10732. if (slot.proxy) {
  10733. slot.fn.proxy = true;
  10734. }
  10735. res[slot.key] = slot.fn;
  10736. }
  10737. }
  10738. if (contentHashKey) {
  10739. (res).$key = contentHashKey;
  10740. }
  10741. return res
  10742. }
  10743. /* */
  10744. function bindDynamicKeys (baseObj, values) {
  10745. for (var i = 0; i < values.length; i += 2) {
  10746. var key = values[i];
  10747. if (typeof key === 'string' && key) {
  10748. baseObj[values[i]] = values[i + 1];
  10749. } else if ( true && key !== '' && key !== null) {
  10750. // null is a special value for explicitly removing a binding
  10751. warn(
  10752. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  10753. this
  10754. );
  10755. }
  10756. }
  10757. return baseObj
  10758. }
  10759. // helper to dynamically append modifier runtime markers to event names.
  10760. // ensure only append when value is already string, otherwise it will be cast
  10761. // to string and cause the type check to miss.
  10762. function prependModifier (value, symbol) {
  10763. return typeof value === 'string' ? symbol + value : value
  10764. }
  10765. /* */
  10766. function installRenderHelpers (target) {
  10767. target._o = markOnce;
  10768. target._n = toNumber;
  10769. target._s = toString;
  10770. target._l = renderList;
  10771. target._t = renderSlot;
  10772. target._q = looseEqual;
  10773. target._i = looseIndexOf;
  10774. target._m = renderStatic;
  10775. target._f = resolveFilter;
  10776. target._k = checkKeyCodes;
  10777. target._b = bindObjectProps;
  10778. target._v = createTextVNode;
  10779. target._e = createEmptyVNode;
  10780. target._u = resolveScopedSlots;
  10781. target._g = bindObjectListeners;
  10782. target._d = bindDynamicKeys;
  10783. target._p = prependModifier;
  10784. }
  10785. /* */
  10786. function FunctionalRenderContext (
  10787. data,
  10788. props,
  10789. children,
  10790. parent,
  10791. Ctor
  10792. ) {
  10793. var this$1 = this;
  10794. var options = Ctor.options;
  10795. // ensure the createElement function in functional components
  10796. // gets a unique context - this is necessary for correct named slot check
  10797. var contextVm;
  10798. if (hasOwn(parent, '_uid')) {
  10799. contextVm = Object.create(parent);
  10800. // $flow-disable-line
  10801. contextVm._original = parent;
  10802. } else {
  10803. // the context vm passed in is a functional context as well.
  10804. // in this case we want to make sure we are able to get a hold to the
  10805. // real context instance.
  10806. contextVm = parent;
  10807. // $flow-disable-line
  10808. parent = parent._original;
  10809. }
  10810. var isCompiled = isTrue(options._compiled);
  10811. var needNormalization = !isCompiled;
  10812. this.data = data;
  10813. this.props = props;
  10814. this.children = children;
  10815. this.parent = parent;
  10816. this.listeners = data.on || emptyObject;
  10817. this.injections = resolveInject(options.inject, parent);
  10818. this.slots = function () {
  10819. if (!this$1.$slots) {
  10820. normalizeScopedSlots(
  10821. data.scopedSlots,
  10822. this$1.$slots = resolveSlots(children, parent)
  10823. );
  10824. }
  10825. return this$1.$slots
  10826. };
  10827. Object.defineProperty(this, 'scopedSlots', ({
  10828. enumerable: true,
  10829. get: function get () {
  10830. return normalizeScopedSlots(data.scopedSlots, this.slots())
  10831. }
  10832. }));
  10833. // support for compiled functional template
  10834. if (isCompiled) {
  10835. // exposing $options for renderStatic()
  10836. this.$options = options;
  10837. // pre-resolve slots for renderSlot()
  10838. this.$slots = this.slots();
  10839. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  10840. }
  10841. if (options._scopeId) {
  10842. this._c = function (a, b, c, d) {
  10843. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  10844. if (vnode && !Array.isArray(vnode)) {
  10845. vnode.fnScopeId = options._scopeId;
  10846. vnode.fnContext = parent;
  10847. }
  10848. return vnode
  10849. };
  10850. } else {
  10851. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  10852. }
  10853. }
  10854. installRenderHelpers(FunctionalRenderContext.prototype);
  10855. function createFunctionalComponent (
  10856. Ctor,
  10857. propsData,
  10858. data,
  10859. contextVm,
  10860. children
  10861. ) {
  10862. var options = Ctor.options;
  10863. var props = {};
  10864. var propOptions = options.props;
  10865. if (isDef(propOptions)) {
  10866. for (var key in propOptions) {
  10867. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  10868. }
  10869. } else {
  10870. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  10871. if (isDef(data.props)) { mergeProps(props, data.props); }
  10872. }
  10873. var renderContext = new FunctionalRenderContext(
  10874. data,
  10875. props,
  10876. children,
  10877. contextVm,
  10878. Ctor
  10879. );
  10880. var vnode = options.render.call(null, renderContext._c, renderContext);
  10881. if (vnode instanceof VNode) {
  10882. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  10883. } else if (Array.isArray(vnode)) {
  10884. var vnodes = normalizeChildren(vnode) || [];
  10885. var res = new Array(vnodes.length);
  10886. for (var i = 0; i < vnodes.length; i++) {
  10887. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  10888. }
  10889. return res
  10890. }
  10891. }
  10892. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  10893. // #7817 clone node before setting fnContext, otherwise if the node is reused
  10894. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  10895. // that should not be matched to match.
  10896. var clone = cloneVNode(vnode);
  10897. clone.fnContext = contextVm;
  10898. clone.fnOptions = options;
  10899. if (true) {
  10900. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  10901. }
  10902. if (data.slot) {
  10903. (clone.data || (clone.data = {})).slot = data.slot;
  10904. }
  10905. return clone
  10906. }
  10907. function mergeProps (to, from) {
  10908. for (var key in from) {
  10909. to[camelize(key)] = from[key];
  10910. }
  10911. }
  10912. /* */
  10913. /* */
  10914. /* */
  10915. /* */
  10916. // inline hooks to be invoked on component VNodes during patch
  10917. var componentVNodeHooks = {
  10918. init: function init (vnode, hydrating) {
  10919. if (
  10920. vnode.componentInstance &&
  10921. !vnode.componentInstance._isDestroyed &&
  10922. vnode.data.keepAlive
  10923. ) {
  10924. // kept-alive components, treat as a patch
  10925. var mountedNode = vnode; // work around flow
  10926. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  10927. } else {
  10928. var child = vnode.componentInstance = createComponentInstanceForVnode(
  10929. vnode,
  10930. activeInstance
  10931. );
  10932. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  10933. }
  10934. },
  10935. prepatch: function prepatch (oldVnode, vnode) {
  10936. var options = vnode.componentOptions;
  10937. var child = vnode.componentInstance = oldVnode.componentInstance;
  10938. updateChildComponent(
  10939. child,
  10940. options.propsData, // updated props
  10941. options.listeners, // updated listeners
  10942. vnode, // new parent vnode
  10943. options.children // new children
  10944. );
  10945. },
  10946. insert: function insert (vnode) {
  10947. var context = vnode.context;
  10948. var componentInstance = vnode.componentInstance;
  10949. if (!componentInstance._isMounted) {
  10950. callHook(componentInstance, 'onServiceCreated');
  10951. callHook(componentInstance, 'onServiceAttached');
  10952. componentInstance._isMounted = true;
  10953. callHook(componentInstance, 'mounted');
  10954. }
  10955. if (vnode.data.keepAlive) {
  10956. if (context._isMounted) {
  10957. // vue-router#1212
  10958. // During updates, a kept-alive component's child components may
  10959. // change, so directly walking the tree here may call activated hooks
  10960. // on incorrect children. Instead we push them into a queue which will
  10961. // be processed after the whole patch process ended.
  10962. queueActivatedComponent(componentInstance);
  10963. } else {
  10964. activateChildComponent(componentInstance, true /* direct */);
  10965. }
  10966. }
  10967. },
  10968. destroy: function destroy (vnode) {
  10969. var componentInstance = vnode.componentInstance;
  10970. if (!componentInstance._isDestroyed) {
  10971. if (!vnode.data.keepAlive) {
  10972. componentInstance.$destroy();
  10973. } else {
  10974. deactivateChildComponent(componentInstance, true /* direct */);
  10975. }
  10976. }
  10977. }
  10978. };
  10979. var hooksToMerge = Object.keys(componentVNodeHooks);
  10980. function createComponent (
  10981. Ctor,
  10982. data,
  10983. context,
  10984. children,
  10985. tag
  10986. ) {
  10987. if (isUndef(Ctor)) {
  10988. return
  10989. }
  10990. var baseCtor = context.$options._base;
  10991. // plain options object: turn it into a constructor
  10992. if (isObject(Ctor)) {
  10993. Ctor = baseCtor.extend(Ctor);
  10994. }
  10995. // if at this stage it's not a constructor or an async component factory,
  10996. // reject.
  10997. if (typeof Ctor !== 'function') {
  10998. if (true) {
  10999. warn(("Invalid Component definition: " + (String(Ctor))), context);
  11000. }
  11001. return
  11002. }
  11003. // async component
  11004. var asyncFactory;
  11005. if (isUndef(Ctor.cid)) {
  11006. asyncFactory = Ctor;
  11007. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  11008. if (Ctor === undefined) {
  11009. // return a placeholder node for async component, which is rendered
  11010. // as a comment node but preserves all the raw information for the node.
  11011. // the information will be used for async server-rendering and hydration.
  11012. return createAsyncPlaceholder(
  11013. asyncFactory,
  11014. data,
  11015. context,
  11016. children,
  11017. tag
  11018. )
  11019. }
  11020. }
  11021. data = data || {};
  11022. // resolve constructor options in case global mixins are applied after
  11023. // component constructor creation
  11024. resolveConstructorOptions(Ctor);
  11025. // transform component v-model data into props & events
  11026. if (isDef(data.model)) {
  11027. transformModel(Ctor.options, data);
  11028. }
  11029. // extract props
  11030. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  11031. // functional component
  11032. if (isTrue(Ctor.options.functional)) {
  11033. return createFunctionalComponent(Ctor, propsData, data, context, children)
  11034. }
  11035. // extract listeners, since these needs to be treated as
  11036. // child component listeners instead of DOM listeners
  11037. var listeners = data.on;
  11038. // replace with listeners with .native modifier
  11039. // so it gets processed during parent component patch.
  11040. data.on = data.nativeOn;
  11041. if (isTrue(Ctor.options.abstract)) {
  11042. // abstract components do not keep anything
  11043. // other than props & listeners & slot
  11044. // work around flow
  11045. var slot = data.slot;
  11046. data = {};
  11047. if (slot) {
  11048. data.slot = slot;
  11049. }
  11050. }
  11051. // install component management hooks onto the placeholder node
  11052. installComponentHooks(data);
  11053. // return a placeholder vnode
  11054. var name = Ctor.options.name || tag;
  11055. var vnode = new VNode(
  11056. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  11057. data, undefined, undefined, undefined, context,
  11058. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  11059. asyncFactory
  11060. );
  11061. return vnode
  11062. }
  11063. function createComponentInstanceForVnode (
  11064. vnode, // we know it's MountedComponentVNode but flow doesn't
  11065. parent // activeInstance in lifecycle state
  11066. ) {
  11067. var options = {
  11068. _isComponent: true,
  11069. _parentVnode: vnode,
  11070. parent: parent
  11071. };
  11072. // check inline-template render functions
  11073. var inlineTemplate = vnode.data.inlineTemplate;
  11074. if (isDef(inlineTemplate)) {
  11075. options.render = inlineTemplate.render;
  11076. options.staticRenderFns = inlineTemplate.staticRenderFns;
  11077. }
  11078. return new vnode.componentOptions.Ctor(options)
  11079. }
  11080. function installComponentHooks (data) {
  11081. var hooks = data.hook || (data.hook = {});
  11082. for (var i = 0; i < hooksToMerge.length; i++) {
  11083. var key = hooksToMerge[i];
  11084. var existing = hooks[key];
  11085. var toMerge = componentVNodeHooks[key];
  11086. if (existing !== toMerge && !(existing && existing._merged)) {
  11087. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  11088. }
  11089. }
  11090. }
  11091. function mergeHook$1 (f1, f2) {
  11092. var merged = function (a, b) {
  11093. // flow complains about extra args which is why we use any
  11094. f1(a, b);
  11095. f2(a, b);
  11096. };
  11097. merged._merged = true;
  11098. return merged
  11099. }
  11100. // transform component v-model info (value and callback) into
  11101. // prop and event handler respectively.
  11102. function transformModel (options, data) {
  11103. var prop = (options.model && options.model.prop) || 'value';
  11104. var event = (options.model && options.model.event) || 'input'
  11105. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  11106. var on = data.on || (data.on = {});
  11107. var existing = on[event];
  11108. var callback = data.model.callback;
  11109. if (isDef(existing)) {
  11110. if (
  11111. Array.isArray(existing)
  11112. ? existing.indexOf(callback) === -1
  11113. : existing !== callback
  11114. ) {
  11115. on[event] = [callback].concat(existing);
  11116. }
  11117. } else {
  11118. on[event] = callback;
  11119. }
  11120. }
  11121. /* */
  11122. var SIMPLE_NORMALIZE = 1;
  11123. var ALWAYS_NORMALIZE = 2;
  11124. // wrapper function for providing a more flexible interface
  11125. // without getting yelled at by flow
  11126. function createElement (
  11127. context,
  11128. tag,
  11129. data,
  11130. children,
  11131. normalizationType,
  11132. alwaysNormalize
  11133. ) {
  11134. if (Array.isArray(data) || isPrimitive(data)) {
  11135. normalizationType = children;
  11136. children = data;
  11137. data = undefined;
  11138. }
  11139. if (isTrue(alwaysNormalize)) {
  11140. normalizationType = ALWAYS_NORMALIZE;
  11141. }
  11142. return _createElement(context, tag, data, children, normalizationType)
  11143. }
  11144. function _createElement (
  11145. context,
  11146. tag,
  11147. data,
  11148. children,
  11149. normalizationType
  11150. ) {
  11151. if (isDef(data) && isDef((data).__ob__)) {
  11152. true && warn(
  11153. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  11154. 'Always create fresh vnode data objects in each render!',
  11155. context
  11156. );
  11157. return createEmptyVNode()
  11158. }
  11159. // object syntax in v-bind
  11160. if (isDef(data) && isDef(data.is)) {
  11161. tag = data.is;
  11162. }
  11163. if (!tag) {
  11164. // in case of component :is set to falsy value
  11165. return createEmptyVNode()
  11166. }
  11167. // warn against non-primitive key
  11168. if ( true &&
  11169. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  11170. ) {
  11171. {
  11172. warn(
  11173. 'Avoid using non-primitive value as key, ' +
  11174. 'use string/number value instead.',
  11175. context
  11176. );
  11177. }
  11178. }
  11179. // support single function children as default scoped slot
  11180. if (Array.isArray(children) &&
  11181. typeof children[0] === 'function'
  11182. ) {
  11183. data = data || {};
  11184. data.scopedSlots = { default: children[0] };
  11185. children.length = 0;
  11186. }
  11187. if (normalizationType === ALWAYS_NORMALIZE) {
  11188. children = normalizeChildren(children);
  11189. } else if (normalizationType === SIMPLE_NORMALIZE) {
  11190. children = simpleNormalizeChildren(children);
  11191. }
  11192. var vnode, ns;
  11193. if (typeof tag === 'string') {
  11194. var Ctor;
  11195. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  11196. if (config.isReservedTag(tag)) {
  11197. // platform built-in elements
  11198. if ( true && isDef(data) && isDef(data.nativeOn)) {
  11199. warn(
  11200. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  11201. context
  11202. );
  11203. }
  11204. vnode = new VNode(
  11205. config.parsePlatformTagName(tag), data, children,
  11206. undefined, undefined, context
  11207. );
  11208. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  11209. // component
  11210. vnode = createComponent(Ctor, data, context, children, tag);
  11211. } else {
  11212. // unknown or unlisted namespaced elements
  11213. // check at runtime because it may get assigned a namespace when its
  11214. // parent normalizes children
  11215. vnode = new VNode(
  11216. tag, data, children,
  11217. undefined, undefined, context
  11218. );
  11219. }
  11220. } else {
  11221. // direct component options / constructor
  11222. vnode = createComponent(tag, data, context, children);
  11223. }
  11224. if (Array.isArray(vnode)) {
  11225. return vnode
  11226. } else if (isDef(vnode)) {
  11227. if (isDef(ns)) { applyNS(vnode, ns); }
  11228. if (isDef(data)) { registerDeepBindings(data); }
  11229. return vnode
  11230. } else {
  11231. return createEmptyVNode()
  11232. }
  11233. }
  11234. function applyNS (vnode, ns, force) {
  11235. vnode.ns = ns;
  11236. if (vnode.tag === 'foreignObject') {
  11237. // use default namespace inside foreignObject
  11238. ns = undefined;
  11239. force = true;
  11240. }
  11241. if (isDef(vnode.children)) {
  11242. for (var i = 0, l = vnode.children.length; i < l; i++) {
  11243. var child = vnode.children[i];
  11244. if (isDef(child.tag) && (
  11245. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  11246. applyNS(child, ns, force);
  11247. }
  11248. }
  11249. }
  11250. }
  11251. // ref #5318
  11252. // necessary to ensure parent re-render when deep bindings like :style and
  11253. // :class are used on slot nodes
  11254. function registerDeepBindings (data) {
  11255. if (isObject(data.style)) {
  11256. traverse(data.style);
  11257. }
  11258. if (isObject(data.class)) {
  11259. traverse(data.class);
  11260. }
  11261. }
  11262. /* */
  11263. function initRender (vm) {
  11264. vm._vnode = null; // the root of the child tree
  11265. vm._staticTrees = null; // v-once cached trees
  11266. var options = vm.$options;
  11267. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  11268. var renderContext = parentVnode && parentVnode.context;
  11269. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  11270. vm.$scopedSlots = emptyObject;
  11271. // bind the createElement fn to this instance
  11272. // so that we get proper render context inside it.
  11273. // args order: tag, data, children, normalizationType, alwaysNormalize
  11274. // internal version is used by render functions compiled from templates
  11275. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  11276. // normalization is always applied for the public version, used in
  11277. // user-written render functions.
  11278. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  11279. // $attrs & $listeners are exposed for easier HOC creation.
  11280. // they need to be reactive so that HOCs using them are always updated
  11281. var parentData = parentVnode && parentVnode.data;
  11282. /* istanbul ignore else */
  11283. if (true) {
  11284. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  11285. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  11286. }, true);
  11287. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  11288. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  11289. }, true);
  11290. } else {}
  11291. }
  11292. var currentRenderingInstance = null;
  11293. function renderMixin (Vue) {
  11294. // install runtime convenience helpers
  11295. installRenderHelpers(Vue.prototype);
  11296. Vue.prototype.$nextTick = function (fn) {
  11297. return nextTick(fn, this)
  11298. };
  11299. Vue.prototype._render = function () {
  11300. var vm = this;
  11301. var ref = vm.$options;
  11302. var render = ref.render;
  11303. var _parentVnode = ref._parentVnode;
  11304. if (_parentVnode) {
  11305. vm.$scopedSlots = normalizeScopedSlots(
  11306. _parentVnode.data.scopedSlots,
  11307. vm.$slots,
  11308. vm.$scopedSlots
  11309. );
  11310. }
  11311. // set parent vnode. this allows render functions to have access
  11312. // to the data on the placeholder node.
  11313. vm.$vnode = _parentVnode;
  11314. // render self
  11315. var vnode;
  11316. try {
  11317. // There's no need to maintain a stack because all render fns are called
  11318. // separately from one another. Nested component's render fns are called
  11319. // when parent component is patched.
  11320. currentRenderingInstance = vm;
  11321. vnode = render.call(vm._renderProxy, vm.$createElement);
  11322. } catch (e) {
  11323. handleError(e, vm, "render");
  11324. // return error render result,
  11325. // or previous vnode to prevent render error causing blank component
  11326. /* istanbul ignore else */
  11327. if ( true && vm.$options.renderError) {
  11328. try {
  11329. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  11330. } catch (e) {
  11331. handleError(e, vm, "renderError");
  11332. vnode = vm._vnode;
  11333. }
  11334. } else {
  11335. vnode = vm._vnode;
  11336. }
  11337. } finally {
  11338. currentRenderingInstance = null;
  11339. }
  11340. // if the returned array contains only a single node, allow it
  11341. if (Array.isArray(vnode) && vnode.length === 1) {
  11342. vnode = vnode[0];
  11343. }
  11344. // return empty vnode in case the render function errored out
  11345. if (!(vnode instanceof VNode)) {
  11346. if ( true && Array.isArray(vnode)) {
  11347. warn(
  11348. 'Multiple root nodes returned from render function. Render function ' +
  11349. 'should return a single root node.',
  11350. vm
  11351. );
  11352. }
  11353. vnode = createEmptyVNode();
  11354. }
  11355. // set parent
  11356. vnode.parent = _parentVnode;
  11357. return vnode
  11358. };
  11359. }
  11360. /* */
  11361. function ensureCtor (comp, base) {
  11362. if (
  11363. comp.__esModule ||
  11364. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  11365. ) {
  11366. comp = comp.default;
  11367. }
  11368. return isObject(comp)
  11369. ? base.extend(comp)
  11370. : comp
  11371. }
  11372. function createAsyncPlaceholder (
  11373. factory,
  11374. data,
  11375. context,
  11376. children,
  11377. tag
  11378. ) {
  11379. var node = createEmptyVNode();
  11380. node.asyncFactory = factory;
  11381. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  11382. return node
  11383. }
  11384. function resolveAsyncComponent (
  11385. factory,
  11386. baseCtor
  11387. ) {
  11388. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  11389. return factory.errorComp
  11390. }
  11391. if (isDef(factory.resolved)) {
  11392. return factory.resolved
  11393. }
  11394. var owner = currentRenderingInstance;
  11395. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  11396. // already pending
  11397. factory.owners.push(owner);
  11398. }
  11399. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  11400. return factory.loadingComp
  11401. }
  11402. if (owner && !isDef(factory.owners)) {
  11403. var owners = factory.owners = [owner];
  11404. var sync = true;
  11405. var timerLoading = null;
  11406. var timerTimeout = null
  11407. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  11408. var forceRender = function (renderCompleted) {
  11409. for (var i = 0, l = owners.length; i < l; i++) {
  11410. (owners[i]).$forceUpdate();
  11411. }
  11412. if (renderCompleted) {
  11413. owners.length = 0;
  11414. if (timerLoading !== null) {
  11415. clearTimeout(timerLoading);
  11416. timerLoading = null;
  11417. }
  11418. if (timerTimeout !== null) {
  11419. clearTimeout(timerTimeout);
  11420. timerTimeout = null;
  11421. }
  11422. }
  11423. };
  11424. var resolve = once(function (res) {
  11425. // cache resolved
  11426. factory.resolved = ensureCtor(res, baseCtor);
  11427. // invoke callbacks only if this is not a synchronous resolve
  11428. // (async resolves are shimmed as synchronous during SSR)
  11429. if (!sync) {
  11430. forceRender(true);
  11431. } else {
  11432. owners.length = 0;
  11433. }
  11434. });
  11435. var reject = once(function (reason) {
  11436. true && warn(
  11437. "Failed to resolve async component: " + (String(factory)) +
  11438. (reason ? ("\nReason: " + reason) : '')
  11439. );
  11440. if (isDef(factory.errorComp)) {
  11441. factory.error = true;
  11442. forceRender(true);
  11443. }
  11444. });
  11445. var res = factory(resolve, reject);
  11446. if (isObject(res)) {
  11447. if (isPromise(res)) {
  11448. // () => Promise
  11449. if (isUndef(factory.resolved)) {
  11450. res.then(resolve, reject);
  11451. }
  11452. } else if (isPromise(res.component)) {
  11453. res.component.then(resolve, reject);
  11454. if (isDef(res.error)) {
  11455. factory.errorComp = ensureCtor(res.error, baseCtor);
  11456. }
  11457. if (isDef(res.loading)) {
  11458. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  11459. if (res.delay === 0) {
  11460. factory.loading = true;
  11461. } else {
  11462. timerLoading = setTimeout(function () {
  11463. timerLoading = null;
  11464. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  11465. factory.loading = true;
  11466. forceRender(false);
  11467. }
  11468. }, res.delay || 200);
  11469. }
  11470. }
  11471. if (isDef(res.timeout)) {
  11472. timerTimeout = setTimeout(function () {
  11473. timerTimeout = null;
  11474. if (isUndef(factory.resolved)) {
  11475. reject(
  11476. true
  11477. ? ("timeout (" + (res.timeout) + "ms)")
  11478. : undefined
  11479. );
  11480. }
  11481. }, res.timeout);
  11482. }
  11483. }
  11484. }
  11485. sync = false;
  11486. // return in case resolved synchronously
  11487. return factory.loading
  11488. ? factory.loadingComp
  11489. : factory.resolved
  11490. }
  11491. }
  11492. /* */
  11493. function isAsyncPlaceholder (node) {
  11494. return node.isComment && node.asyncFactory
  11495. }
  11496. /* */
  11497. function getFirstComponentChild (children) {
  11498. if (Array.isArray(children)) {
  11499. for (var i = 0; i < children.length; i++) {
  11500. var c = children[i];
  11501. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  11502. return c
  11503. }
  11504. }
  11505. }
  11506. }
  11507. /* */
  11508. /* */
  11509. function initEvents (vm) {
  11510. vm._events = Object.create(null);
  11511. vm._hasHookEvent = false;
  11512. // init parent attached events
  11513. var listeners = vm.$options._parentListeners;
  11514. if (listeners) {
  11515. updateComponentListeners(vm, listeners);
  11516. }
  11517. }
  11518. var target;
  11519. function add (event, fn) {
  11520. target.$on(event, fn);
  11521. }
  11522. function remove$1 (event, fn) {
  11523. target.$off(event, fn);
  11524. }
  11525. function createOnceHandler (event, fn) {
  11526. var _target = target;
  11527. return function onceHandler () {
  11528. var res = fn.apply(null, arguments);
  11529. if (res !== null) {
  11530. _target.$off(event, onceHandler);
  11531. }
  11532. }
  11533. }
  11534. function updateComponentListeners (
  11535. vm,
  11536. listeners,
  11537. oldListeners
  11538. ) {
  11539. target = vm;
  11540. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  11541. target = undefined;
  11542. }
  11543. function eventsMixin (Vue) {
  11544. var hookRE = /^hook:/;
  11545. Vue.prototype.$on = function (event, fn) {
  11546. var vm = this;
  11547. if (Array.isArray(event)) {
  11548. for (var i = 0, l = event.length; i < l; i++) {
  11549. vm.$on(event[i], fn);
  11550. }
  11551. } else {
  11552. (vm._events[event] || (vm._events[event] = [])).push(fn);
  11553. // optimize hook:event cost by using a boolean flag marked at registration
  11554. // instead of a hash lookup
  11555. if (hookRE.test(event)) {
  11556. vm._hasHookEvent = true;
  11557. }
  11558. }
  11559. return vm
  11560. };
  11561. Vue.prototype.$once = function (event, fn) {
  11562. var vm = this;
  11563. function on () {
  11564. vm.$off(event, on);
  11565. fn.apply(vm, arguments);
  11566. }
  11567. on.fn = fn;
  11568. vm.$on(event, on);
  11569. return vm
  11570. };
  11571. Vue.prototype.$off = function (event, fn) {
  11572. var vm = this;
  11573. // all
  11574. if (!arguments.length) {
  11575. vm._events = Object.create(null);
  11576. return vm
  11577. }
  11578. // array of events
  11579. if (Array.isArray(event)) {
  11580. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  11581. vm.$off(event[i$1], fn);
  11582. }
  11583. return vm
  11584. }
  11585. // specific event
  11586. var cbs = vm._events[event];
  11587. if (!cbs) {
  11588. return vm
  11589. }
  11590. if (!fn) {
  11591. vm._events[event] = null;
  11592. return vm
  11593. }
  11594. // specific handler
  11595. var cb;
  11596. var i = cbs.length;
  11597. while (i--) {
  11598. cb = cbs[i];
  11599. if (cb === fn || cb.fn === fn) {
  11600. cbs.splice(i, 1);
  11601. break
  11602. }
  11603. }
  11604. return vm
  11605. };
  11606. Vue.prototype.$emit = function (event) {
  11607. var vm = this;
  11608. if (true) {
  11609. var lowerCaseEvent = event.toLowerCase();
  11610. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  11611. tip(
  11612. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  11613. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  11614. "Note that HTML attributes are case-insensitive and you cannot use " +
  11615. "v-on to listen to camelCase events when using in-DOM templates. " +
  11616. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  11617. );
  11618. }
  11619. }
  11620. var cbs = vm._events[event];
  11621. if (cbs) {
  11622. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  11623. var args = toArray(arguments, 1);
  11624. var info = "event handler for \"" + event + "\"";
  11625. for (var i = 0, l = cbs.length; i < l; i++) {
  11626. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  11627. }
  11628. }
  11629. return vm
  11630. };
  11631. }
  11632. /* */
  11633. var activeInstance = null;
  11634. var isUpdatingChildComponent = false;
  11635. function setActiveInstance(vm) {
  11636. var prevActiveInstance = activeInstance;
  11637. activeInstance = vm;
  11638. return function () {
  11639. activeInstance = prevActiveInstance;
  11640. }
  11641. }
  11642. function initLifecycle (vm) {
  11643. var options = vm.$options;
  11644. // locate first non-abstract parent
  11645. var parent = options.parent;
  11646. if (parent && !options.abstract) {
  11647. while (parent.$options.abstract && parent.$parent) {
  11648. parent = parent.$parent;
  11649. }
  11650. parent.$children.push(vm);
  11651. }
  11652. vm.$parent = parent;
  11653. vm.$root = parent ? parent.$root : vm;
  11654. vm.$children = [];
  11655. vm.$refs = {};
  11656. vm._watcher = null;
  11657. vm._inactive = null;
  11658. vm._directInactive = false;
  11659. vm._isMounted = false;
  11660. vm._isDestroyed = false;
  11661. vm._isBeingDestroyed = false;
  11662. }
  11663. function lifecycleMixin (Vue) {
  11664. Vue.prototype._update = function (vnode, hydrating) {
  11665. var vm = this;
  11666. var prevEl = vm.$el;
  11667. var prevVnode = vm._vnode;
  11668. var restoreActiveInstance = setActiveInstance(vm);
  11669. vm._vnode = vnode;
  11670. // Vue.prototype.__patch__ is injected in entry points
  11671. // based on the rendering backend used.
  11672. if (!prevVnode) {
  11673. // initial render
  11674. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  11675. } else {
  11676. // updates
  11677. vm.$el = vm.__patch__(prevVnode, vnode);
  11678. }
  11679. restoreActiveInstance();
  11680. // update __vue__ reference
  11681. if (prevEl) {
  11682. prevEl.__vue__ = null;
  11683. }
  11684. if (vm.$el) {
  11685. vm.$el.__vue__ = vm;
  11686. }
  11687. // if parent is an HOC, update its $el as well
  11688. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  11689. vm.$parent.$el = vm.$el;
  11690. }
  11691. // updated hook is called by the scheduler to ensure that children are
  11692. // updated in a parent's updated hook.
  11693. };
  11694. Vue.prototype.$forceUpdate = function () {
  11695. var vm = this;
  11696. if (vm._watcher) {
  11697. vm._watcher.update();
  11698. }
  11699. };
  11700. Vue.prototype.$destroy = function () {
  11701. var vm = this;
  11702. if (vm._isBeingDestroyed) {
  11703. return
  11704. }
  11705. callHook(vm, 'beforeDestroy');
  11706. vm._isBeingDestroyed = true;
  11707. // remove self from parent
  11708. var parent = vm.$parent;
  11709. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  11710. remove(parent.$children, vm);
  11711. }
  11712. // teardown watchers
  11713. if (vm._watcher) {
  11714. vm._watcher.teardown();
  11715. }
  11716. var i = vm._watchers.length;
  11717. while (i--) {
  11718. vm._watchers[i].teardown();
  11719. }
  11720. // remove reference from data ob
  11721. // frozen object may not have observer.
  11722. if (vm._data.__ob__) {
  11723. vm._data.__ob__.vmCount--;
  11724. }
  11725. // call the last hook...
  11726. vm._isDestroyed = true;
  11727. // invoke destroy hooks on current rendered tree
  11728. vm.__patch__(vm._vnode, null);
  11729. // fire destroyed hook
  11730. callHook(vm, 'destroyed');
  11731. // turn off all instance listeners.
  11732. vm.$off();
  11733. // remove __vue__ reference
  11734. if (vm.$el) {
  11735. vm.$el.__vue__ = null;
  11736. }
  11737. // release circular reference (#6759)
  11738. if (vm.$vnode) {
  11739. vm.$vnode.parent = null;
  11740. }
  11741. };
  11742. }
  11743. function updateChildComponent (
  11744. vm,
  11745. propsData,
  11746. listeners,
  11747. parentVnode,
  11748. renderChildren
  11749. ) {
  11750. if (true) {
  11751. isUpdatingChildComponent = true;
  11752. }
  11753. // determine whether component has slot children
  11754. // we need to do this before overwriting $options._renderChildren.
  11755. // check if there are dynamic scopedSlots (hand-written or compiled but with
  11756. // dynamic slot names). Static scoped slots compiled from template has the
  11757. // "$stable" marker.
  11758. var newScopedSlots = parentVnode.data.scopedSlots;
  11759. var oldScopedSlots = vm.$scopedSlots;
  11760. var hasDynamicScopedSlot = !!(
  11761. (newScopedSlots && !newScopedSlots.$stable) ||
  11762. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  11763. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  11764. );
  11765. // Any static slot children from the parent may have changed during parent's
  11766. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  11767. // update is necessary to ensure correctness.
  11768. var needsForceUpdate = !!(
  11769. renderChildren || // has new static slots
  11770. vm.$options._renderChildren || // has old static slots
  11771. hasDynamicScopedSlot
  11772. );
  11773. vm.$options._parentVnode = parentVnode;
  11774. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  11775. if (vm._vnode) { // update child tree's parent
  11776. vm._vnode.parent = parentVnode;
  11777. }
  11778. vm.$options._renderChildren = renderChildren;
  11779. // update $attrs and $listeners hash
  11780. // these are also reactive so they may trigger child update if the child
  11781. // used them during render
  11782. vm.$attrs = parentVnode.data.attrs || emptyObject;
  11783. vm.$listeners = listeners || emptyObject;
  11784. // update props
  11785. if (propsData && vm.$options.props) {
  11786. toggleObserving(false);
  11787. var props = vm._props;
  11788. var propKeys = vm.$options._propKeys || [];
  11789. for (var i = 0; i < propKeys.length; i++) {
  11790. var key = propKeys[i];
  11791. var propOptions = vm.$options.props; // wtf flow?
  11792. props[key] = validateProp(key, propOptions, propsData, vm);
  11793. }
  11794. toggleObserving(true);
  11795. // keep a copy of raw propsData
  11796. vm.$options.propsData = propsData;
  11797. }
  11798. // fixed by xxxxxx update properties(mp runtime)
  11799. vm._$updateProperties && vm._$updateProperties(vm);
  11800. // update listeners
  11801. listeners = listeners || emptyObject;
  11802. var oldListeners = vm.$options._parentListeners;
  11803. vm.$options._parentListeners = listeners;
  11804. updateComponentListeners(vm, listeners, oldListeners);
  11805. // resolve slots + force update if has children
  11806. if (needsForceUpdate) {
  11807. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  11808. vm.$forceUpdate();
  11809. }
  11810. if (true) {
  11811. isUpdatingChildComponent = false;
  11812. }
  11813. }
  11814. function isInInactiveTree (vm) {
  11815. while (vm && (vm = vm.$parent)) {
  11816. if (vm._inactive) { return true }
  11817. }
  11818. return false
  11819. }
  11820. function activateChildComponent (vm, direct) {
  11821. if (direct) {
  11822. vm._directInactive = false;
  11823. if (isInInactiveTree(vm)) {
  11824. return
  11825. }
  11826. } else if (vm._directInactive) {
  11827. return
  11828. }
  11829. if (vm._inactive || vm._inactive === null) {
  11830. vm._inactive = false;
  11831. for (var i = 0; i < vm.$children.length; i++) {
  11832. activateChildComponent(vm.$children[i]);
  11833. }
  11834. callHook(vm, 'activated');
  11835. }
  11836. }
  11837. function deactivateChildComponent (vm, direct) {
  11838. if (direct) {
  11839. vm._directInactive = true;
  11840. if (isInInactiveTree(vm)) {
  11841. return
  11842. }
  11843. }
  11844. if (!vm._inactive) {
  11845. vm._inactive = true;
  11846. for (var i = 0; i < vm.$children.length; i++) {
  11847. deactivateChildComponent(vm.$children[i]);
  11848. }
  11849. callHook(vm, 'deactivated');
  11850. }
  11851. }
  11852. function callHook (vm, hook) {
  11853. // #7573 disable dep collection when invoking lifecycle hooks
  11854. pushTarget();
  11855. var handlers = vm.$options[hook];
  11856. var info = hook + " hook";
  11857. if (handlers) {
  11858. for (var i = 0, j = handlers.length; i < j; i++) {
  11859. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  11860. }
  11861. }
  11862. if (vm._hasHookEvent) {
  11863. vm.$emit('hook:' + hook);
  11864. }
  11865. popTarget();
  11866. }
  11867. /* */
  11868. var MAX_UPDATE_COUNT = 100;
  11869. var queue = [];
  11870. var activatedChildren = [];
  11871. var has = {};
  11872. var circular = {};
  11873. var waiting = false;
  11874. var flushing = false;
  11875. var index = 0;
  11876. /**
  11877. * Reset the scheduler's state.
  11878. */
  11879. function resetSchedulerState () {
  11880. index = queue.length = activatedChildren.length = 0;
  11881. has = {};
  11882. if (true) {
  11883. circular = {};
  11884. }
  11885. waiting = flushing = false;
  11886. }
  11887. // Async edge case #6566 requires saving the timestamp when event listeners are
  11888. // attached. However, calling performance.now() has a perf overhead especially
  11889. // if the page has thousands of event listeners. Instead, we take a timestamp
  11890. // every time the scheduler flushes and use that for all event listeners
  11891. // attached during that flush.
  11892. var currentFlushTimestamp = 0;
  11893. // Async edge case fix requires storing an event listener's attach timestamp.
  11894. var getNow = Date.now;
  11895. // Determine what event timestamp the browser is using. Annoyingly, the
  11896. // timestamp can either be hi-res (relative to page load) or low-res
  11897. // (relative to UNIX epoch), so in order to compare time we have to use the
  11898. // same timestamp type when saving the flush timestamp.
  11899. // All IE versions use low-res event timestamps, and have problematic clock
  11900. // implementations (#9632)
  11901. if (inBrowser && !isIE) {
  11902. var performance = window.performance;
  11903. if (
  11904. performance &&
  11905. typeof performance.now === 'function' &&
  11906. getNow() > document.createEvent('Event').timeStamp
  11907. ) {
  11908. // if the event timestamp, although evaluated AFTER the Date.now(), is
  11909. // smaller than it, it means the event is using a hi-res timestamp,
  11910. // and we need to use the hi-res version for event listener timestamps as
  11911. // well.
  11912. getNow = function () { return performance.now(); };
  11913. }
  11914. }
  11915. /**
  11916. * Flush both queues and run the watchers.
  11917. */
  11918. function flushSchedulerQueue () {
  11919. currentFlushTimestamp = getNow();
  11920. flushing = true;
  11921. var watcher, id;
  11922. // Sort queue before flush.
  11923. // This ensures that:
  11924. // 1. Components are updated from parent to child. (because parent is always
  11925. // created before the child)
  11926. // 2. A component's user watchers are run before its render watcher (because
  11927. // user watchers are created before the render watcher)
  11928. // 3. If a component is destroyed during a parent component's watcher run,
  11929. // its watchers can be skipped.
  11930. queue.sort(function (a, b) { return a.id - b.id; });
  11931. // do not cache length because more watchers might be pushed
  11932. // as we run existing watchers
  11933. for (index = 0; index < queue.length; index++) {
  11934. watcher = queue[index];
  11935. if (watcher.before) {
  11936. watcher.before();
  11937. }
  11938. id = watcher.id;
  11939. has[id] = null;
  11940. watcher.run();
  11941. // in dev build, check and stop circular updates.
  11942. if ( true && has[id] != null) {
  11943. circular[id] = (circular[id] || 0) + 1;
  11944. if (circular[id] > MAX_UPDATE_COUNT) {
  11945. warn(
  11946. 'You may have an infinite update loop ' + (
  11947. watcher.user
  11948. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  11949. : "in a component render function."
  11950. ),
  11951. watcher.vm
  11952. );
  11953. break
  11954. }
  11955. }
  11956. }
  11957. // keep copies of post queues before resetting state
  11958. var activatedQueue = activatedChildren.slice();
  11959. var updatedQueue = queue.slice();
  11960. resetSchedulerState();
  11961. // call component updated and activated hooks
  11962. callActivatedHooks(activatedQueue);
  11963. callUpdatedHooks(updatedQueue);
  11964. // devtool hook
  11965. /* istanbul ignore if */
  11966. if (devtools && config.devtools) {
  11967. devtools.emit('flush');
  11968. }
  11969. }
  11970. function callUpdatedHooks (queue) {
  11971. var i = queue.length;
  11972. while (i--) {
  11973. var watcher = queue[i];
  11974. var vm = watcher.vm;
  11975. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  11976. callHook(vm, 'updated');
  11977. }
  11978. }
  11979. }
  11980. /**
  11981. * Queue a kept-alive component that was activated during patch.
  11982. * The queue will be processed after the entire tree has been patched.
  11983. */
  11984. function queueActivatedComponent (vm) {
  11985. // setting _inactive to false here so that a render function can
  11986. // rely on checking whether it's in an inactive tree (e.g. router-view)
  11987. vm._inactive = false;
  11988. activatedChildren.push(vm);
  11989. }
  11990. function callActivatedHooks (queue) {
  11991. for (var i = 0; i < queue.length; i++) {
  11992. queue[i]._inactive = true;
  11993. activateChildComponent(queue[i], true /* true */);
  11994. }
  11995. }
  11996. /**
  11997. * Push a watcher into the watcher queue.
  11998. * Jobs with duplicate IDs will be skipped unless it's
  11999. * pushed when the queue is being flushed.
  12000. */
  12001. function queueWatcher (watcher) {
  12002. var id = watcher.id;
  12003. if (has[id] == null) {
  12004. has[id] = true;
  12005. if (!flushing) {
  12006. queue.push(watcher);
  12007. } else {
  12008. // if already flushing, splice the watcher based on its id
  12009. // if already past its id, it will be run next immediately.
  12010. var i = queue.length - 1;
  12011. while (i > index && queue[i].id > watcher.id) {
  12012. i--;
  12013. }
  12014. queue.splice(i + 1, 0, watcher);
  12015. }
  12016. // queue the flush
  12017. if (!waiting) {
  12018. waiting = true;
  12019. if ( true && !config.async) {
  12020. flushSchedulerQueue();
  12021. return
  12022. }
  12023. nextTick(flushSchedulerQueue);
  12024. }
  12025. }
  12026. }
  12027. /* */
  12028. var uid$2 = 0;
  12029. /**
  12030. * A watcher parses an expression, collects dependencies,
  12031. * and fires callback when the expression value changes.
  12032. * This is used for both the $watch() api and directives.
  12033. */
  12034. var Watcher = function Watcher (
  12035. vm,
  12036. expOrFn,
  12037. cb,
  12038. options,
  12039. isRenderWatcher
  12040. ) {
  12041. this.vm = vm;
  12042. if (isRenderWatcher) {
  12043. vm._watcher = this;
  12044. }
  12045. vm._watchers.push(this);
  12046. // options
  12047. if (options) {
  12048. this.deep = !!options.deep;
  12049. this.user = !!options.user;
  12050. this.lazy = !!options.lazy;
  12051. this.sync = !!options.sync;
  12052. this.before = options.before;
  12053. } else {
  12054. this.deep = this.user = this.lazy = this.sync = false;
  12055. }
  12056. this.cb = cb;
  12057. this.id = ++uid$2; // uid for batching
  12058. this.active = true;
  12059. this.dirty = this.lazy; // for lazy watchers
  12060. this.deps = [];
  12061. this.newDeps = [];
  12062. this.depIds = new _Set();
  12063. this.newDepIds = new _Set();
  12064. this.expression = true
  12065. ? expOrFn.toString()
  12066. : undefined;
  12067. // parse expression for getter
  12068. if (typeof expOrFn === 'function') {
  12069. this.getter = expOrFn;
  12070. } else {
  12071. this.getter = parsePath(expOrFn);
  12072. if (!this.getter) {
  12073. this.getter = noop;
  12074. true && warn(
  12075. "Failed watching path: \"" + expOrFn + "\" " +
  12076. 'Watcher only accepts simple dot-delimited paths. ' +
  12077. 'For full control, use a function instead.',
  12078. vm
  12079. );
  12080. }
  12081. }
  12082. this.value = this.lazy
  12083. ? undefined
  12084. : this.get();
  12085. };
  12086. /**
  12087. * Evaluate the getter, and re-collect dependencies.
  12088. */
  12089. Watcher.prototype.get = function get () {
  12090. pushTarget(this);
  12091. var value;
  12092. var vm = this.vm;
  12093. try {
  12094. value = this.getter.call(vm, vm);
  12095. } catch (e) {
  12096. if (this.user) {
  12097. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  12098. } else {
  12099. throw e
  12100. }
  12101. } finally {
  12102. // "touch" every property so they are all tracked as
  12103. // dependencies for deep watching
  12104. if (this.deep) {
  12105. traverse(value);
  12106. }
  12107. popTarget();
  12108. this.cleanupDeps();
  12109. }
  12110. return value
  12111. };
  12112. /**
  12113. * Add a dependency to this directive.
  12114. */
  12115. Watcher.prototype.addDep = function addDep (dep) {
  12116. var id = dep.id;
  12117. if (!this.newDepIds.has(id)) {
  12118. this.newDepIds.add(id);
  12119. this.newDeps.push(dep);
  12120. if (!this.depIds.has(id)) {
  12121. dep.addSub(this);
  12122. }
  12123. }
  12124. };
  12125. /**
  12126. * Clean up for dependency collection.
  12127. */
  12128. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  12129. var i = this.deps.length;
  12130. while (i--) {
  12131. var dep = this.deps[i];
  12132. if (!this.newDepIds.has(dep.id)) {
  12133. dep.removeSub(this);
  12134. }
  12135. }
  12136. var tmp = this.depIds;
  12137. this.depIds = this.newDepIds;
  12138. this.newDepIds = tmp;
  12139. this.newDepIds.clear();
  12140. tmp = this.deps;
  12141. this.deps = this.newDeps;
  12142. this.newDeps = tmp;
  12143. this.newDeps.length = 0;
  12144. };
  12145. /**
  12146. * Subscriber interface.
  12147. * Will be called when a dependency changes.
  12148. */
  12149. Watcher.prototype.update = function update () {
  12150. /* istanbul ignore else */
  12151. if (this.lazy) {
  12152. this.dirty = true;
  12153. } else if (this.sync) {
  12154. this.run();
  12155. } else {
  12156. queueWatcher(this);
  12157. }
  12158. };
  12159. /**
  12160. * Scheduler job interface.
  12161. * Will be called by the scheduler.
  12162. */
  12163. Watcher.prototype.run = function run () {
  12164. if (this.active) {
  12165. var value = this.get();
  12166. if (
  12167. value !== this.value ||
  12168. // Deep watchers and watchers on Object/Arrays should fire even
  12169. // when the value is the same, because the value may
  12170. // have mutated.
  12171. isObject(value) ||
  12172. this.deep
  12173. ) {
  12174. // set new value
  12175. var oldValue = this.value;
  12176. this.value = value;
  12177. if (this.user) {
  12178. try {
  12179. this.cb.call(this.vm, value, oldValue);
  12180. } catch (e) {
  12181. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  12182. }
  12183. } else {
  12184. this.cb.call(this.vm, value, oldValue);
  12185. }
  12186. }
  12187. }
  12188. };
  12189. /**
  12190. * Evaluate the value of the watcher.
  12191. * This only gets called for lazy watchers.
  12192. */
  12193. Watcher.prototype.evaluate = function evaluate () {
  12194. this.value = this.get();
  12195. this.dirty = false;
  12196. };
  12197. /**
  12198. * Depend on all deps collected by this watcher.
  12199. */
  12200. Watcher.prototype.depend = function depend () {
  12201. var i = this.deps.length;
  12202. while (i--) {
  12203. this.deps[i].depend();
  12204. }
  12205. };
  12206. /**
  12207. * Remove self from all dependencies' subscriber list.
  12208. */
  12209. Watcher.prototype.teardown = function teardown () {
  12210. if (this.active) {
  12211. // remove self from vm's watcher list
  12212. // this is a somewhat expensive operation so we skip it
  12213. // if the vm is being destroyed.
  12214. if (!this.vm._isBeingDestroyed) {
  12215. remove(this.vm._watchers, this);
  12216. }
  12217. var i = this.deps.length;
  12218. while (i--) {
  12219. this.deps[i].removeSub(this);
  12220. }
  12221. this.active = false;
  12222. }
  12223. };
  12224. /* */
  12225. var sharedPropertyDefinition = {
  12226. enumerable: true,
  12227. configurable: true,
  12228. get: noop,
  12229. set: noop
  12230. };
  12231. function proxy (target, sourceKey, key) {
  12232. sharedPropertyDefinition.get = function proxyGetter () {
  12233. return this[sourceKey][key]
  12234. };
  12235. sharedPropertyDefinition.set = function proxySetter (val) {
  12236. this[sourceKey][key] = val;
  12237. };
  12238. Object.defineProperty(target, key, sharedPropertyDefinition);
  12239. }
  12240. function initState (vm) {
  12241. vm._watchers = [];
  12242. var opts = vm.$options;
  12243. if (opts.props) { initProps(vm, opts.props); }
  12244. if (opts.methods) { initMethods(vm, opts.methods); }
  12245. if (opts.data) {
  12246. initData(vm);
  12247. } else {
  12248. observe(vm._data = {}, true /* asRootData */);
  12249. }
  12250. if (opts.computed) { initComputed(vm, opts.computed); }
  12251. if (opts.watch && opts.watch !== nativeWatch) {
  12252. initWatch(vm, opts.watch);
  12253. }
  12254. }
  12255. function initProps (vm, propsOptions) {
  12256. var propsData = vm.$options.propsData || {};
  12257. var props = vm._props = {};
  12258. // cache prop keys so that future props updates can iterate using Array
  12259. // instead of dynamic object key enumeration.
  12260. var keys = vm.$options._propKeys = [];
  12261. var isRoot = !vm.$parent;
  12262. // root instance props should be converted
  12263. if (!isRoot) {
  12264. toggleObserving(false);
  12265. }
  12266. var loop = function ( key ) {
  12267. keys.push(key);
  12268. var value = validateProp(key, propsOptions, propsData, vm);
  12269. /* istanbul ignore else */
  12270. if (true) {
  12271. var hyphenatedKey = hyphenate(key);
  12272. if (isReservedAttribute(hyphenatedKey) ||
  12273. config.isReservedAttr(hyphenatedKey)) {
  12274. warn(
  12275. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  12276. vm
  12277. );
  12278. }
  12279. defineReactive$$1(props, key, value, function () {
  12280. if (!isRoot && !isUpdatingChildComponent) {
  12281. {
  12282. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  12283. return
  12284. }
  12285. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  12286. if(
  12287. key === 'value' &&
  12288. Array.isArray(vm.$options.behaviors) &&
  12289. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  12290. ){
  12291. return
  12292. }
  12293. if(vm._getFormData){
  12294. return
  12295. }
  12296. var $parent = vm.$parent;
  12297. while($parent){
  12298. if($parent.__next_tick_pending){
  12299. return
  12300. }
  12301. $parent = $parent.$parent;
  12302. }
  12303. }
  12304. warn(
  12305. "Avoid mutating a prop directly since the value will be " +
  12306. "overwritten whenever the parent component re-renders. " +
  12307. "Instead, use a data or computed property based on the prop's " +
  12308. "value. Prop being mutated: \"" + key + "\"",
  12309. vm
  12310. );
  12311. }
  12312. });
  12313. } else {}
  12314. // static props are already proxied on the component's prototype
  12315. // during Vue.extend(). We only need to proxy props defined at
  12316. // instantiation here.
  12317. if (!(key in vm)) {
  12318. proxy(vm, "_props", key);
  12319. }
  12320. };
  12321. for (var key in propsOptions) loop( key );
  12322. toggleObserving(true);
  12323. }
  12324. function initData (vm) {
  12325. var data = vm.$options.data;
  12326. data = vm._data = typeof data === 'function'
  12327. ? getData(data, vm)
  12328. : data || {};
  12329. if (!isPlainObject(data)) {
  12330. data = {};
  12331. true && warn(
  12332. 'data functions should return an object:\n' +
  12333. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  12334. vm
  12335. );
  12336. }
  12337. // proxy data on instance
  12338. var keys = Object.keys(data);
  12339. var props = vm.$options.props;
  12340. var methods = vm.$options.methods;
  12341. var i = keys.length;
  12342. while (i--) {
  12343. var key = keys[i];
  12344. if (true) {
  12345. if (methods && hasOwn(methods, key)) {
  12346. warn(
  12347. ("Method \"" + key + "\" has already been defined as a data property."),
  12348. vm
  12349. );
  12350. }
  12351. }
  12352. if (props && hasOwn(props, key)) {
  12353. true && warn(
  12354. "The data property \"" + key + "\" is already declared as a prop. " +
  12355. "Use prop default value instead.",
  12356. vm
  12357. );
  12358. } else if (!isReserved(key)) {
  12359. proxy(vm, "_data", key);
  12360. }
  12361. }
  12362. // observe data
  12363. observe(data, true /* asRootData */);
  12364. }
  12365. function getData (data, vm) {
  12366. // #7573 disable dep collection when invoking data getters
  12367. pushTarget();
  12368. try {
  12369. return data.call(vm, vm)
  12370. } catch (e) {
  12371. handleError(e, vm, "data()");
  12372. return {}
  12373. } finally {
  12374. popTarget();
  12375. }
  12376. }
  12377. var computedWatcherOptions = { lazy: true };
  12378. function initComputed (vm, computed) {
  12379. // $flow-disable-line
  12380. var watchers = vm._computedWatchers = Object.create(null);
  12381. // computed properties are just getters during SSR
  12382. var isSSR = isServerRendering();
  12383. for (var key in computed) {
  12384. var userDef = computed[key];
  12385. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  12386. if ( true && getter == null) {
  12387. warn(
  12388. ("Getter is missing for computed property \"" + key + "\"."),
  12389. vm
  12390. );
  12391. }
  12392. if (!isSSR) {
  12393. // create internal watcher for the computed property.
  12394. watchers[key] = new Watcher(
  12395. vm,
  12396. getter || noop,
  12397. noop,
  12398. computedWatcherOptions
  12399. );
  12400. }
  12401. // component-defined computed properties are already defined on the
  12402. // component prototype. We only need to define computed properties defined
  12403. // at instantiation here.
  12404. if (!(key in vm)) {
  12405. defineComputed(vm, key, userDef);
  12406. } else if (true) {
  12407. if (key in vm.$data) {
  12408. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  12409. } else if (vm.$options.props && key in vm.$options.props) {
  12410. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  12411. }
  12412. }
  12413. }
  12414. }
  12415. function defineComputed (
  12416. target,
  12417. key,
  12418. userDef
  12419. ) {
  12420. var shouldCache = !isServerRendering();
  12421. if (typeof userDef === 'function') {
  12422. sharedPropertyDefinition.get = shouldCache
  12423. ? createComputedGetter(key)
  12424. : createGetterInvoker(userDef);
  12425. sharedPropertyDefinition.set = noop;
  12426. } else {
  12427. sharedPropertyDefinition.get = userDef.get
  12428. ? shouldCache && userDef.cache !== false
  12429. ? createComputedGetter(key)
  12430. : createGetterInvoker(userDef.get)
  12431. : noop;
  12432. sharedPropertyDefinition.set = userDef.set || noop;
  12433. }
  12434. if ( true &&
  12435. sharedPropertyDefinition.set === noop) {
  12436. sharedPropertyDefinition.set = function () {
  12437. warn(
  12438. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  12439. this
  12440. );
  12441. };
  12442. }
  12443. Object.defineProperty(target, key, sharedPropertyDefinition);
  12444. }
  12445. function createComputedGetter (key) {
  12446. return function computedGetter () {
  12447. var watcher = this._computedWatchers && this._computedWatchers[key];
  12448. if (watcher) {
  12449. if (watcher.dirty) {
  12450. watcher.evaluate();
  12451. }
  12452. if (Dep.SharedObject.target) {// fixed by xxxxxx
  12453. watcher.depend();
  12454. }
  12455. return watcher.value
  12456. }
  12457. }
  12458. }
  12459. function createGetterInvoker(fn) {
  12460. return function computedGetter () {
  12461. return fn.call(this, this)
  12462. }
  12463. }
  12464. function initMethods (vm, methods) {
  12465. var props = vm.$options.props;
  12466. for (var key in methods) {
  12467. if (true) {
  12468. if (typeof methods[key] !== 'function') {
  12469. warn(
  12470. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  12471. "Did you reference the function correctly?",
  12472. vm
  12473. );
  12474. }
  12475. if (props && hasOwn(props, key)) {
  12476. warn(
  12477. ("Method \"" + key + "\" has already been defined as a prop."),
  12478. vm
  12479. );
  12480. }
  12481. if ((key in vm) && isReserved(key)) {
  12482. warn(
  12483. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  12484. "Avoid defining component methods that start with _ or $."
  12485. );
  12486. }
  12487. }
  12488. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  12489. }
  12490. }
  12491. function initWatch (vm, watch) {
  12492. for (var key in watch) {
  12493. var handler = watch[key];
  12494. if (Array.isArray(handler)) {
  12495. for (var i = 0; i < handler.length; i++) {
  12496. createWatcher(vm, key, handler[i]);
  12497. }
  12498. } else {
  12499. createWatcher(vm, key, handler);
  12500. }
  12501. }
  12502. }
  12503. function createWatcher (
  12504. vm,
  12505. expOrFn,
  12506. handler,
  12507. options
  12508. ) {
  12509. if (isPlainObject(handler)) {
  12510. options = handler;
  12511. handler = handler.handler;
  12512. }
  12513. if (typeof handler === 'string') {
  12514. handler = vm[handler];
  12515. }
  12516. return vm.$watch(expOrFn, handler, options)
  12517. }
  12518. function stateMixin (Vue) {
  12519. // flow somehow has problems with directly declared definition object
  12520. // when using Object.defineProperty, so we have to procedurally build up
  12521. // the object here.
  12522. var dataDef = {};
  12523. dataDef.get = function () { return this._data };
  12524. var propsDef = {};
  12525. propsDef.get = function () { return this._props };
  12526. if (true) {
  12527. dataDef.set = function () {
  12528. warn(
  12529. 'Avoid replacing instance root $data. ' +
  12530. 'Use nested data properties instead.',
  12531. this
  12532. );
  12533. };
  12534. propsDef.set = function () {
  12535. warn("$props is readonly.", this);
  12536. };
  12537. }
  12538. Object.defineProperty(Vue.prototype, '$data', dataDef);
  12539. Object.defineProperty(Vue.prototype, '$props', propsDef);
  12540. Vue.prototype.$set = set;
  12541. Vue.prototype.$delete = del;
  12542. Vue.prototype.$watch = function (
  12543. expOrFn,
  12544. cb,
  12545. options
  12546. ) {
  12547. var vm = this;
  12548. if (isPlainObject(cb)) {
  12549. return createWatcher(vm, expOrFn, cb, options)
  12550. }
  12551. options = options || {};
  12552. options.user = true;
  12553. var watcher = new Watcher(vm, expOrFn, cb, options);
  12554. if (options.immediate) {
  12555. try {
  12556. cb.call(vm, watcher.value);
  12557. } catch (error) {
  12558. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  12559. }
  12560. }
  12561. return function unwatchFn () {
  12562. watcher.teardown();
  12563. }
  12564. };
  12565. }
  12566. /* */
  12567. var uid$3 = 0;
  12568. function initMixin (Vue) {
  12569. Vue.prototype._init = function (options) {
  12570. var vm = this;
  12571. // a uid
  12572. vm._uid = uid$3++;
  12573. var startTag, endTag;
  12574. /* istanbul ignore if */
  12575. if ( true && config.performance && mark) {
  12576. startTag = "vue-perf-start:" + (vm._uid);
  12577. endTag = "vue-perf-end:" + (vm._uid);
  12578. mark(startTag);
  12579. }
  12580. // a flag to avoid this being observed
  12581. vm._isVue = true;
  12582. // merge options
  12583. if (options && options._isComponent) {
  12584. // optimize internal component instantiation
  12585. // since dynamic options merging is pretty slow, and none of the
  12586. // internal component options needs special treatment.
  12587. initInternalComponent(vm, options);
  12588. } else {
  12589. vm.$options = mergeOptions(
  12590. resolveConstructorOptions(vm.constructor),
  12591. options || {},
  12592. vm
  12593. );
  12594. }
  12595. /* istanbul ignore else */
  12596. if (true) {
  12597. initProxy(vm);
  12598. } else {}
  12599. // expose real self
  12600. vm._self = vm;
  12601. initLifecycle(vm);
  12602. initEvents(vm);
  12603. initRender(vm);
  12604. callHook(vm, 'beforeCreate');
  12605. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  12606. initState(vm);
  12607. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  12608. !vm._$fallback && callHook(vm, 'created');
  12609. /* istanbul ignore if */
  12610. if ( true && config.performance && mark) {
  12611. vm._name = formatComponentName(vm, false);
  12612. mark(endTag);
  12613. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  12614. }
  12615. if (vm.$options.el) {
  12616. vm.$mount(vm.$options.el);
  12617. }
  12618. };
  12619. }
  12620. function initInternalComponent (vm, options) {
  12621. var opts = vm.$options = Object.create(vm.constructor.options);
  12622. // doing this because it's faster than dynamic enumeration.
  12623. var parentVnode = options._parentVnode;
  12624. opts.parent = options.parent;
  12625. opts._parentVnode = parentVnode;
  12626. var vnodeComponentOptions = parentVnode.componentOptions;
  12627. opts.propsData = vnodeComponentOptions.propsData;
  12628. opts._parentListeners = vnodeComponentOptions.listeners;
  12629. opts._renderChildren = vnodeComponentOptions.children;
  12630. opts._componentTag = vnodeComponentOptions.tag;
  12631. if (options.render) {
  12632. opts.render = options.render;
  12633. opts.staticRenderFns = options.staticRenderFns;
  12634. }
  12635. }
  12636. function resolveConstructorOptions (Ctor) {
  12637. var options = Ctor.options;
  12638. if (Ctor.super) {
  12639. var superOptions = resolveConstructorOptions(Ctor.super);
  12640. var cachedSuperOptions = Ctor.superOptions;
  12641. if (superOptions !== cachedSuperOptions) {
  12642. // super option changed,
  12643. // need to resolve new options.
  12644. Ctor.superOptions = superOptions;
  12645. // check if there are any late-modified/attached options (#4976)
  12646. var modifiedOptions = resolveModifiedOptions(Ctor);
  12647. // update base extend options
  12648. if (modifiedOptions) {
  12649. extend(Ctor.extendOptions, modifiedOptions);
  12650. }
  12651. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  12652. if (options.name) {
  12653. options.components[options.name] = Ctor;
  12654. }
  12655. }
  12656. }
  12657. return options
  12658. }
  12659. function resolveModifiedOptions (Ctor) {
  12660. var modified;
  12661. var latest = Ctor.options;
  12662. var sealed = Ctor.sealedOptions;
  12663. for (var key in latest) {
  12664. if (latest[key] !== sealed[key]) {
  12665. if (!modified) { modified = {}; }
  12666. modified[key] = latest[key];
  12667. }
  12668. }
  12669. return modified
  12670. }
  12671. function Vue (options) {
  12672. if ( true &&
  12673. !(this instanceof Vue)
  12674. ) {
  12675. warn('Vue is a constructor and should be called with the `new` keyword');
  12676. }
  12677. this._init(options);
  12678. }
  12679. initMixin(Vue);
  12680. stateMixin(Vue);
  12681. eventsMixin(Vue);
  12682. lifecycleMixin(Vue);
  12683. renderMixin(Vue);
  12684. /* */
  12685. function initUse (Vue) {
  12686. Vue.use = function (plugin) {
  12687. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  12688. if (installedPlugins.indexOf(plugin) > -1) {
  12689. return this
  12690. }
  12691. // additional parameters
  12692. var args = toArray(arguments, 1);
  12693. args.unshift(this);
  12694. if (typeof plugin.install === 'function') {
  12695. plugin.install.apply(plugin, args);
  12696. } else if (typeof plugin === 'function') {
  12697. plugin.apply(null, args);
  12698. }
  12699. installedPlugins.push(plugin);
  12700. return this
  12701. };
  12702. }
  12703. /* */
  12704. function initMixin$1 (Vue) {
  12705. Vue.mixin = function (mixin) {
  12706. this.options = mergeOptions(this.options, mixin);
  12707. return this
  12708. };
  12709. }
  12710. /* */
  12711. function initExtend (Vue) {
  12712. /**
  12713. * Each instance constructor, including Vue, has a unique
  12714. * cid. This enables us to create wrapped "child
  12715. * constructors" for prototypal inheritance and cache them.
  12716. */
  12717. Vue.cid = 0;
  12718. var cid = 1;
  12719. /**
  12720. * Class inheritance
  12721. */
  12722. Vue.extend = function (extendOptions) {
  12723. extendOptions = extendOptions || {};
  12724. var Super = this;
  12725. var SuperId = Super.cid;
  12726. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  12727. if (cachedCtors[SuperId]) {
  12728. return cachedCtors[SuperId]
  12729. }
  12730. var name = extendOptions.name || Super.options.name;
  12731. if ( true && name) {
  12732. validateComponentName(name);
  12733. }
  12734. var Sub = function VueComponent (options) {
  12735. this._init(options);
  12736. };
  12737. Sub.prototype = Object.create(Super.prototype);
  12738. Sub.prototype.constructor = Sub;
  12739. Sub.cid = cid++;
  12740. Sub.options = mergeOptions(
  12741. Super.options,
  12742. extendOptions
  12743. );
  12744. Sub['super'] = Super;
  12745. // For props and computed properties, we define the proxy getters on
  12746. // the Vue instances at extension time, on the extended prototype. This
  12747. // avoids Object.defineProperty calls for each instance created.
  12748. if (Sub.options.props) {
  12749. initProps$1(Sub);
  12750. }
  12751. if (Sub.options.computed) {
  12752. initComputed$1(Sub);
  12753. }
  12754. // allow further extension/mixin/plugin usage
  12755. Sub.extend = Super.extend;
  12756. Sub.mixin = Super.mixin;
  12757. Sub.use = Super.use;
  12758. // create asset registers, so extended classes
  12759. // can have their private assets too.
  12760. ASSET_TYPES.forEach(function (type) {
  12761. Sub[type] = Super[type];
  12762. });
  12763. // enable recursive self-lookup
  12764. if (name) {
  12765. Sub.options.components[name] = Sub;
  12766. }
  12767. // keep a reference to the super options at extension time.
  12768. // later at instantiation we can check if Super's options have
  12769. // been updated.
  12770. Sub.superOptions = Super.options;
  12771. Sub.extendOptions = extendOptions;
  12772. Sub.sealedOptions = extend({}, Sub.options);
  12773. // cache constructor
  12774. cachedCtors[SuperId] = Sub;
  12775. return Sub
  12776. };
  12777. }
  12778. function initProps$1 (Comp) {
  12779. var props = Comp.options.props;
  12780. for (var key in props) {
  12781. proxy(Comp.prototype, "_props", key);
  12782. }
  12783. }
  12784. function initComputed$1 (Comp) {
  12785. var computed = Comp.options.computed;
  12786. for (var key in computed) {
  12787. defineComputed(Comp.prototype, key, computed[key]);
  12788. }
  12789. }
  12790. /* */
  12791. function initAssetRegisters (Vue) {
  12792. /**
  12793. * Create asset registration methods.
  12794. */
  12795. ASSET_TYPES.forEach(function (type) {
  12796. Vue[type] = function (
  12797. id,
  12798. definition
  12799. ) {
  12800. if (!definition) {
  12801. return this.options[type + 's'][id]
  12802. } else {
  12803. /* istanbul ignore if */
  12804. if ( true && type === 'component') {
  12805. validateComponentName(id);
  12806. }
  12807. if (type === 'component' && isPlainObject(definition)) {
  12808. definition.name = definition.name || id;
  12809. definition = this.options._base.extend(definition);
  12810. }
  12811. if (type === 'directive' && typeof definition === 'function') {
  12812. definition = { bind: definition, update: definition };
  12813. }
  12814. this.options[type + 's'][id] = definition;
  12815. return definition
  12816. }
  12817. };
  12818. });
  12819. }
  12820. /* */
  12821. function getComponentName (opts) {
  12822. return opts && (opts.Ctor.options.name || opts.tag)
  12823. }
  12824. function matches (pattern, name) {
  12825. if (Array.isArray(pattern)) {
  12826. return pattern.indexOf(name) > -1
  12827. } else if (typeof pattern === 'string') {
  12828. return pattern.split(',').indexOf(name) > -1
  12829. } else if (isRegExp(pattern)) {
  12830. return pattern.test(name)
  12831. }
  12832. /* istanbul ignore next */
  12833. return false
  12834. }
  12835. function pruneCache (keepAliveInstance, filter) {
  12836. var cache = keepAliveInstance.cache;
  12837. var keys = keepAliveInstance.keys;
  12838. var _vnode = keepAliveInstance._vnode;
  12839. for (var key in cache) {
  12840. var cachedNode = cache[key];
  12841. if (cachedNode) {
  12842. var name = getComponentName(cachedNode.componentOptions);
  12843. if (name && !filter(name)) {
  12844. pruneCacheEntry(cache, key, keys, _vnode);
  12845. }
  12846. }
  12847. }
  12848. }
  12849. function pruneCacheEntry (
  12850. cache,
  12851. key,
  12852. keys,
  12853. current
  12854. ) {
  12855. var cached$$1 = cache[key];
  12856. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  12857. cached$$1.componentInstance.$destroy();
  12858. }
  12859. cache[key] = null;
  12860. remove(keys, key);
  12861. }
  12862. var patternTypes = [String, RegExp, Array];
  12863. var KeepAlive = {
  12864. name: 'keep-alive',
  12865. abstract: true,
  12866. props: {
  12867. include: patternTypes,
  12868. exclude: patternTypes,
  12869. max: [String, Number]
  12870. },
  12871. created: function created () {
  12872. this.cache = Object.create(null);
  12873. this.keys = [];
  12874. },
  12875. destroyed: function destroyed () {
  12876. for (var key in this.cache) {
  12877. pruneCacheEntry(this.cache, key, this.keys);
  12878. }
  12879. },
  12880. mounted: function mounted () {
  12881. var this$1 = this;
  12882. this.$watch('include', function (val) {
  12883. pruneCache(this$1, function (name) { return matches(val, name); });
  12884. });
  12885. this.$watch('exclude', function (val) {
  12886. pruneCache(this$1, function (name) { return !matches(val, name); });
  12887. });
  12888. },
  12889. render: function render () {
  12890. var slot = this.$slots.default;
  12891. var vnode = getFirstComponentChild(slot);
  12892. var componentOptions = vnode && vnode.componentOptions;
  12893. if (componentOptions) {
  12894. // check pattern
  12895. var name = getComponentName(componentOptions);
  12896. var ref = this;
  12897. var include = ref.include;
  12898. var exclude = ref.exclude;
  12899. if (
  12900. // not included
  12901. (include && (!name || !matches(include, name))) ||
  12902. // excluded
  12903. (exclude && name && matches(exclude, name))
  12904. ) {
  12905. return vnode
  12906. }
  12907. var ref$1 = this;
  12908. var cache = ref$1.cache;
  12909. var keys = ref$1.keys;
  12910. var key = vnode.key == null
  12911. // same constructor may get registered as different local components
  12912. // so cid alone is not enough (#3269)
  12913. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  12914. : vnode.key;
  12915. if (cache[key]) {
  12916. vnode.componentInstance = cache[key].componentInstance;
  12917. // make current key freshest
  12918. remove(keys, key);
  12919. keys.push(key);
  12920. } else {
  12921. cache[key] = vnode;
  12922. keys.push(key);
  12923. // prune oldest entry
  12924. if (this.max && keys.length > parseInt(this.max)) {
  12925. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  12926. }
  12927. }
  12928. vnode.data.keepAlive = true;
  12929. }
  12930. return vnode || (slot && slot[0])
  12931. }
  12932. };
  12933. var builtInComponents = {
  12934. KeepAlive: KeepAlive
  12935. };
  12936. /* */
  12937. function initGlobalAPI (Vue) {
  12938. // config
  12939. var configDef = {};
  12940. configDef.get = function () { return config; };
  12941. if (true) {
  12942. configDef.set = function () {
  12943. warn(
  12944. 'Do not replace the Vue.config object, set individual fields instead.'
  12945. );
  12946. };
  12947. }
  12948. Object.defineProperty(Vue, 'config', configDef);
  12949. // exposed util methods.
  12950. // NOTE: these are not considered part of the public API - avoid relying on
  12951. // them unless you are aware of the risk.
  12952. Vue.util = {
  12953. warn: warn,
  12954. extend: extend,
  12955. mergeOptions: mergeOptions,
  12956. defineReactive: defineReactive$$1
  12957. };
  12958. Vue.set = set;
  12959. Vue.delete = del;
  12960. Vue.nextTick = nextTick;
  12961. // 2.6 explicit observable API
  12962. Vue.observable = function (obj) {
  12963. observe(obj);
  12964. return obj
  12965. };
  12966. Vue.options = Object.create(null);
  12967. ASSET_TYPES.forEach(function (type) {
  12968. Vue.options[type + 's'] = Object.create(null);
  12969. });
  12970. // this is used to identify the "base" constructor to extend all plain-object
  12971. // components with in Weex's multi-instance scenarios.
  12972. Vue.options._base = Vue;
  12973. extend(Vue.options.components, builtInComponents);
  12974. initUse(Vue);
  12975. initMixin$1(Vue);
  12976. initExtend(Vue);
  12977. initAssetRegisters(Vue);
  12978. }
  12979. initGlobalAPI(Vue);
  12980. Object.defineProperty(Vue.prototype, '$isServer', {
  12981. get: isServerRendering
  12982. });
  12983. Object.defineProperty(Vue.prototype, '$ssrContext', {
  12984. get: function get () {
  12985. /* istanbul ignore next */
  12986. return this.$vnode && this.$vnode.ssrContext
  12987. }
  12988. });
  12989. // expose FunctionalRenderContext for ssr runtime helper installation
  12990. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  12991. value: FunctionalRenderContext
  12992. });
  12993. Vue.version = '2.6.11';
  12994. /**
  12995. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  12996. */
  12997. var ARRAYTYPE = '[object Array]';
  12998. var OBJECTTYPE = '[object Object]';
  12999. // const FUNCTIONTYPE = '[object Function]'
  13000. function diff(current, pre) {
  13001. var result = {};
  13002. syncKeys(current, pre);
  13003. _diff(current, pre, '', result);
  13004. return result
  13005. }
  13006. function syncKeys(current, pre) {
  13007. if (current === pre) { return }
  13008. var rootCurrentType = type(current);
  13009. var rootPreType = type(pre);
  13010. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  13011. if(Object.keys(current).length >= Object.keys(pre).length){
  13012. for (var key in pre) {
  13013. var currentValue = current[key];
  13014. if (currentValue === undefined) {
  13015. current[key] = null;
  13016. } else {
  13017. syncKeys(currentValue, pre[key]);
  13018. }
  13019. }
  13020. }
  13021. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  13022. if (current.length >= pre.length) {
  13023. pre.forEach(function (item, index) {
  13024. syncKeys(current[index], item);
  13025. });
  13026. }
  13027. }
  13028. }
  13029. function _diff(current, pre, path, result) {
  13030. if (current === pre) { return }
  13031. var rootCurrentType = type(current);
  13032. var rootPreType = type(pre);
  13033. if (rootCurrentType == OBJECTTYPE) {
  13034. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  13035. setResult(result, path, current);
  13036. } else {
  13037. var loop = function ( key ) {
  13038. var currentValue = current[key];
  13039. var preValue = pre[key];
  13040. var currentType = type(currentValue);
  13041. var preType = type(preValue);
  13042. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  13043. if (currentValue !== pre[key]) {
  13044. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  13045. }
  13046. } else if (currentType == ARRAYTYPE) {
  13047. if (preType != ARRAYTYPE) {
  13048. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  13049. } else {
  13050. if (currentValue.length < preValue.length) {
  13051. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  13052. } else {
  13053. currentValue.forEach(function (item, index) {
  13054. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  13055. });
  13056. }
  13057. }
  13058. } else if (currentType == OBJECTTYPE) {
  13059. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  13060. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  13061. } else {
  13062. for (var subKey in currentValue) {
  13063. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  13064. }
  13065. }
  13066. }
  13067. };
  13068. for (var key in current) loop( key );
  13069. }
  13070. } else if (rootCurrentType == ARRAYTYPE) {
  13071. if (rootPreType != ARRAYTYPE) {
  13072. setResult(result, path, current);
  13073. } else {
  13074. if (current.length < pre.length) {
  13075. setResult(result, path, current);
  13076. } else {
  13077. current.forEach(function (item, index) {
  13078. _diff(item, pre[index], path + '[' + index + ']', result);
  13079. });
  13080. }
  13081. }
  13082. } else {
  13083. setResult(result, path, current);
  13084. }
  13085. }
  13086. function setResult(result, k, v) {
  13087. // if (type(v) != FUNCTIONTYPE) {
  13088. result[k] = v;
  13089. // }
  13090. }
  13091. function type(obj) {
  13092. return Object.prototype.toString.call(obj)
  13093. }
  13094. /* */
  13095. function flushCallbacks$1(vm) {
  13096. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  13097. if (Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  13098. var mpInstance = vm.$scope;
  13099. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  13100. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  13101. }
  13102. var copies = vm.__next_tick_callbacks.slice(0);
  13103. vm.__next_tick_callbacks.length = 0;
  13104. for (var i = 0; i < copies.length; i++) {
  13105. copies[i]();
  13106. }
  13107. }
  13108. }
  13109. function hasRenderWatcher(vm) {
  13110. return queue.find(function (watcher) { return vm._watcher === watcher; })
  13111. }
  13112. function nextTick$1(vm, cb) {
  13113. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  13114. //2.nextTick 之前存在 render watcher
  13115. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  13116. if(Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  13117. var mpInstance = vm.$scope;
  13118. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  13119. ']:nextVueTick');
  13120. }
  13121. return nextTick(cb, vm)
  13122. }else{
  13123. if(Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  13124. var mpInstance$1 = vm.$scope;
  13125. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  13126. ']:nextMPTick');
  13127. }
  13128. }
  13129. var _resolve;
  13130. if (!vm.__next_tick_callbacks) {
  13131. vm.__next_tick_callbacks = [];
  13132. }
  13133. vm.__next_tick_callbacks.push(function () {
  13134. if (cb) {
  13135. try {
  13136. cb.call(vm);
  13137. } catch (e) {
  13138. handleError(e, vm, 'nextTick');
  13139. }
  13140. } else if (_resolve) {
  13141. _resolve(vm);
  13142. }
  13143. });
  13144. // $flow-disable-line
  13145. if (!cb && typeof Promise !== 'undefined') {
  13146. return new Promise(function (resolve) {
  13147. _resolve = resolve;
  13148. })
  13149. }
  13150. }
  13151. /* */
  13152. function cloneWithData(vm) {
  13153. // 确保当前 vm 所有数据被同步
  13154. var ret = Object.create(null);
  13155. var dataKeys = [].concat(
  13156. Object.keys(vm._data || {}),
  13157. Object.keys(vm._computedWatchers || {}));
  13158. dataKeys.reduce(function(ret, key) {
  13159. ret[key] = vm[key];
  13160. return ret
  13161. }, ret);
  13162. // vue-composition-api
  13163. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  13164. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  13165. if (rawBindings) {
  13166. Object.keys(rawBindings).forEach(function (key) {
  13167. ret[key] = vm[key];
  13168. });
  13169. }
  13170. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  13171. Object.assign(ret, vm.$mp.data || {});
  13172. if (
  13173. Array.isArray(vm.$options.behaviors) &&
  13174. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  13175. ) { //form-field
  13176. ret['name'] = vm.name;
  13177. ret['value'] = vm.value;
  13178. }
  13179. return JSON.parse(JSON.stringify(ret))
  13180. }
  13181. var patch = function(oldVnode, vnode) {
  13182. var this$1 = this;
  13183. if (vnode === null) { //destroy
  13184. return
  13185. }
  13186. if (this.mpType === 'page' || this.mpType === 'component') {
  13187. var mpInstance = this.$scope;
  13188. var data = Object.create(null);
  13189. try {
  13190. data = cloneWithData(this);
  13191. } catch (err) {
  13192. console.error(err);
  13193. }
  13194. data.__webviewId__ = mpInstance.data.__webviewId__;
  13195. var mpData = Object.create(null);
  13196. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  13197. mpData[key] = mpInstance.data[key];
  13198. });
  13199. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  13200. if (Object.keys(diffData).length) {
  13201. if (Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  13202. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  13203. ']差量更新',
  13204. JSON.stringify(diffData));
  13205. }
  13206. this.__next_tick_pending = true;
  13207. mpInstance.setData(diffData, function () {
  13208. this$1.__next_tick_pending = false;
  13209. flushCallbacks$1(this$1);
  13210. });
  13211. } else {
  13212. flushCallbacks$1(this);
  13213. }
  13214. }
  13215. };
  13216. /* */
  13217. function createEmptyRender() {
  13218. }
  13219. function mountComponent$1(
  13220. vm,
  13221. el,
  13222. hydrating
  13223. ) {
  13224. if (!vm.mpType) {//main.js 中的 new Vue
  13225. return vm
  13226. }
  13227. if (vm.mpType === 'app') {
  13228. vm.$options.render = createEmptyRender;
  13229. }
  13230. if (!vm.$options.render) {
  13231. vm.$options.render = createEmptyRender;
  13232. if (true) {
  13233. /* istanbul ignore if */
  13234. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  13235. vm.$options.el || el) {
  13236. warn(
  13237. 'You are using the runtime-only build of Vue where the template ' +
  13238. 'compiler is not available. Either pre-compile the templates into ' +
  13239. 'render functions, or use the compiler-included build.',
  13240. vm
  13241. );
  13242. } else {
  13243. warn(
  13244. 'Failed to mount component: template or render function not defined.',
  13245. vm
  13246. );
  13247. }
  13248. }
  13249. }
  13250. !vm._$fallback && callHook(vm, 'beforeMount');
  13251. var updateComponent = function () {
  13252. vm._update(vm._render(), hydrating);
  13253. };
  13254. // we set this to vm._watcher inside the watcher's constructor
  13255. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  13256. // component's mounted hook), which relies on vm._watcher being already defined
  13257. new Watcher(vm, updateComponent, noop, {
  13258. before: function before() {
  13259. if (vm._isMounted && !vm._isDestroyed) {
  13260. callHook(vm, 'beforeUpdate');
  13261. }
  13262. }
  13263. }, true /* isRenderWatcher */);
  13264. hydrating = false;
  13265. return vm
  13266. }
  13267. /* */
  13268. function renderClass (
  13269. staticClass,
  13270. dynamicClass
  13271. ) {
  13272. if (isDef(staticClass) || isDef(dynamicClass)) {
  13273. return concat(staticClass, stringifyClass(dynamicClass))
  13274. }
  13275. /* istanbul ignore next */
  13276. return ''
  13277. }
  13278. function concat (a, b) {
  13279. return a ? b ? (a + ' ' + b) : a : (b || '')
  13280. }
  13281. function stringifyClass (value) {
  13282. if (Array.isArray(value)) {
  13283. return stringifyArray(value)
  13284. }
  13285. if (isObject(value)) {
  13286. return stringifyObject(value)
  13287. }
  13288. if (typeof value === 'string') {
  13289. return value
  13290. }
  13291. /* istanbul ignore next */
  13292. return ''
  13293. }
  13294. function stringifyArray (value) {
  13295. var res = '';
  13296. var stringified;
  13297. for (var i = 0, l = value.length; i < l; i++) {
  13298. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  13299. if (res) { res += ' '; }
  13300. res += stringified;
  13301. }
  13302. }
  13303. return res
  13304. }
  13305. function stringifyObject (value) {
  13306. var res = '';
  13307. for (var key in value) {
  13308. if (value[key]) {
  13309. if (res) { res += ' '; }
  13310. res += key;
  13311. }
  13312. }
  13313. return res
  13314. }
  13315. /* */
  13316. var parseStyleText = cached(function (cssText) {
  13317. var res = {};
  13318. var listDelimiter = /;(?![^(]*\))/g;
  13319. var propertyDelimiter = /:(.+)/;
  13320. cssText.split(listDelimiter).forEach(function (item) {
  13321. if (item) {
  13322. var tmp = item.split(propertyDelimiter);
  13323. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  13324. }
  13325. });
  13326. return res
  13327. });
  13328. // normalize possible array / string values into Object
  13329. function normalizeStyleBinding (bindingStyle) {
  13330. if (Array.isArray(bindingStyle)) {
  13331. return toObject(bindingStyle)
  13332. }
  13333. if (typeof bindingStyle === 'string') {
  13334. return parseStyleText(bindingStyle)
  13335. }
  13336. return bindingStyle
  13337. }
  13338. /* */
  13339. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  13340. function getTarget(obj, path) {
  13341. var parts = path.split('.');
  13342. var key = parts[0];
  13343. if (key.indexOf('__$n') === 0) { //number index
  13344. key = parseInt(key.replace('__$n', ''));
  13345. }
  13346. if (parts.length === 1) {
  13347. return obj[key]
  13348. }
  13349. return getTarget(obj[key], parts.slice(1).join('.'))
  13350. }
  13351. function internalMixin(Vue) {
  13352. Vue.config.errorHandler = function(err, vm, info) {
  13353. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  13354. console.error(err);
  13355. /* eslint-disable no-undef */
  13356. var app = typeof getApp === 'function' && getApp();
  13357. if (app && app.onError) {
  13358. app.onError(err);
  13359. }
  13360. };
  13361. var oldEmit = Vue.prototype.$emit;
  13362. Vue.prototype.$emit = function(event) {
  13363. if (this.$scope && event) {
  13364. (this.$scope['_triggerEvent'] || this.$scope['triggerEvent']).call(this.$scope, event, {
  13365. __args__: toArray(arguments, 1)
  13366. });
  13367. }
  13368. return oldEmit.apply(this, arguments)
  13369. };
  13370. Vue.prototype.$nextTick = function(fn) {
  13371. return nextTick$1(this, fn)
  13372. };
  13373. MP_METHODS.forEach(function (method) {
  13374. Vue.prototype[method] = function(args) {
  13375. if (this.$scope && this.$scope[method]) {
  13376. return this.$scope[method](args)
  13377. }
  13378. // mp-alipay
  13379. if (typeof my === 'undefined') {
  13380. return
  13381. }
  13382. if (method === 'createSelectorQuery') {
  13383. /* eslint-disable no-undef */
  13384. return my.createSelectorQuery(args)
  13385. } else if (method === 'createIntersectionObserver') {
  13386. /* eslint-disable no-undef */
  13387. return my.createIntersectionObserver(args)
  13388. }
  13389. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  13390. };
  13391. });
  13392. Vue.prototype.__init_provide = initProvide;
  13393. Vue.prototype.__init_injections = initInjections;
  13394. Vue.prototype.__call_hook = function(hook, args) {
  13395. var vm = this;
  13396. // #7573 disable dep collection when invoking lifecycle hooks
  13397. pushTarget();
  13398. var handlers = vm.$options[hook];
  13399. var info = hook + " hook";
  13400. var ret;
  13401. if (handlers) {
  13402. for (var i = 0, j = handlers.length; i < j; i++) {
  13403. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  13404. }
  13405. }
  13406. if (vm._hasHookEvent) {
  13407. vm.$emit('hook:' + hook, args);
  13408. }
  13409. popTarget();
  13410. return ret
  13411. };
  13412. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  13413. if (Array.isArray(modifiers)) {
  13414. if (modifiers.indexOf('trim') !== -1) {
  13415. value = value.trim();
  13416. }
  13417. if (modifiers.indexOf('number') !== -1) {
  13418. value = this._n(value);
  13419. }
  13420. }
  13421. if (!target) {
  13422. target = this;
  13423. }
  13424. // 解决动态属性添加
  13425. Vue.set(target, key, value);
  13426. };
  13427. Vue.prototype.__set_sync = function(target, key, value) {
  13428. if (!target) {
  13429. target = this;
  13430. }
  13431. // 解决动态属性添加
  13432. Vue.set(target, key, value);
  13433. };
  13434. Vue.prototype.__get_orig = function(item) {
  13435. if (isPlainObject(item)) {
  13436. return item['$orig'] || item
  13437. }
  13438. return item
  13439. };
  13440. Vue.prototype.__get_value = function(dataPath, target) {
  13441. return getTarget(target || this, dataPath)
  13442. };
  13443. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  13444. return renderClass(staticClass, dynamicClass)
  13445. };
  13446. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  13447. if (!dynamicStyle && !staticStyle) {
  13448. return ''
  13449. }
  13450. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  13451. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  13452. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  13453. };
  13454. Vue.prototype.__map = function(val, iteratee) {
  13455. //TODO 暂不考虑 string
  13456. var ret, i, l, keys, key;
  13457. if (Array.isArray(val)) {
  13458. ret = new Array(val.length);
  13459. for (i = 0, l = val.length; i < l; i++) {
  13460. ret[i] = iteratee(val[i], i);
  13461. }
  13462. return ret
  13463. } else if (isObject(val)) {
  13464. keys = Object.keys(val);
  13465. ret = Object.create(null);
  13466. for (i = 0, l = keys.length; i < l; i++) {
  13467. key = keys[i];
  13468. ret[key] = iteratee(val[key], key, i);
  13469. }
  13470. return ret
  13471. } else if (typeof val === 'number') {
  13472. ret = new Array(val);
  13473. for (i = 0, l = val; i < l; i++) {
  13474. // 第一个参数暂时仍和小程序一致
  13475. ret[i] = iteratee(i, i);
  13476. }
  13477. return ret
  13478. }
  13479. return []
  13480. };
  13481. }
  13482. /* */
  13483. var LIFECYCLE_HOOKS$1 = [
  13484. //App
  13485. 'onLaunch',
  13486. 'onShow',
  13487. 'onHide',
  13488. 'onUniNViewMessage',
  13489. 'onPageNotFound',
  13490. 'onThemeChange',
  13491. 'onError',
  13492. 'onUnhandledRejection',
  13493. //Page
  13494. 'onInit',
  13495. 'onLoad',
  13496. // 'onShow',
  13497. 'onReady',
  13498. // 'onHide',
  13499. 'onUnload',
  13500. 'onPullDownRefresh',
  13501. 'onReachBottom',
  13502. 'onTabItemTap',
  13503. 'onAddToFavorites',
  13504. 'onShareTimeline',
  13505. 'onShareAppMessage',
  13506. 'onResize',
  13507. 'onPageScroll',
  13508. 'onNavigationBarButtonTap',
  13509. 'onBackPress',
  13510. 'onNavigationBarSearchInputChanged',
  13511. 'onNavigationBarSearchInputConfirmed',
  13512. 'onNavigationBarSearchInputClicked',
  13513. //Component
  13514. // 'onReady', // 兼容旧版本,应该移除该事件
  13515. 'onPageShow',
  13516. 'onPageHide',
  13517. 'onPageResize'
  13518. ];
  13519. function lifecycleMixin$1(Vue) {
  13520. //fixed vue-class-component
  13521. var oldExtend = Vue.extend;
  13522. Vue.extend = function(extendOptions) {
  13523. extendOptions = extendOptions || {};
  13524. var methods = extendOptions.methods;
  13525. if (methods) {
  13526. Object.keys(methods).forEach(function (methodName) {
  13527. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  13528. extendOptions[methodName] = methods[methodName];
  13529. delete methods[methodName];
  13530. }
  13531. });
  13532. }
  13533. return oldExtend.call(this, extendOptions)
  13534. };
  13535. var strategies = Vue.config.optionMergeStrategies;
  13536. var mergeHook = strategies.created;
  13537. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  13538. strategies[hook] = mergeHook;
  13539. });
  13540. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  13541. }
  13542. /* */
  13543. // install platform patch function
  13544. Vue.prototype.__patch__ = patch;
  13545. // public mount method
  13546. Vue.prototype.$mount = function(
  13547. el ,
  13548. hydrating
  13549. ) {
  13550. return mountComponent$1(this, el, hydrating)
  13551. };
  13552. lifecycleMixin$1(Vue);
  13553. internalMixin(Vue);
  13554. /* */
  13555. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  13556. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 2)))
  13557. /***/ }),
  13558. /***/ 5:
  13559. /*!***************************************************************************************!*\
  13560. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/pages.json ***!
  13561. \***************************************************************************************/
  13562. /*! no static exports found */
  13563. /***/ (function(module, exports) {
  13564. /***/ })
  13565. }]);
  13566. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map