vendor.js 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],{
  2. /***/ 1:
  3. /*!*********************************************************!*\
  4. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js ***!
  5. \*********************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports, __webpack_require__) {
  8. "use strict";
  9. Object.defineProperty(exports, "__esModule", {
  10. value: true
  11. });
  12. exports.default = void 0;
  13. var objectKeys = ['qy', 'env', 'error', 'version', 'lanDebug', 'cloud', 'serviceMarket', 'router', 'worklet', '__webpack_require_UNI_MP_PLUGIN__'];
  14. var singlePageDisableKey = ['lanDebug', 'router', 'worklet'];
  15. var target = typeof globalThis !== 'undefined' ? globalThis : function () {
  16. return this;
  17. }();
  18. var key = ['w', 'x'].join('');
  19. var oldWx = target[key];
  20. var launchOption = oldWx.getLaunchOptionsSync ? oldWx.getLaunchOptionsSync() : null;
  21. function isWxKey(key) {
  22. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  23. return false;
  24. }
  25. return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function';
  26. }
  27. function initWx() {
  28. var newWx = {};
  29. for (var _key in oldWx) {
  30. if (isWxKey(_key)) {
  31. // TODO wrapper function
  32. newWx[_key] = oldWx[_key];
  33. }
  34. }
  35. return newWx;
  36. }
  37. target[key] = initWx();
  38. var _default = target[key];
  39. exports.default = _default;
  40. /***/ }),
  41. /***/ 10:
  42. /*!****************************************************************!*\
  43. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  44. \****************************************************************/
  45. /*! no static exports found */
  46. /***/ (function(module, exports) {
  47. function _nonIterableRest() {
  48. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  49. }
  50. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  51. /***/ }),
  52. /***/ 11:
  53. /*!***************************************************************!*\
  54. !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
  55. \***************************************************************/
  56. /*! no static exports found */
  57. /***/ (function(module, exports, __webpack_require__) {
  58. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  59. function _defineProperty(obj, key, value) {
  60. key = toPropertyKey(key);
  61. if (key in obj) {
  62. Object.defineProperty(obj, key, {
  63. value: value,
  64. enumerable: true,
  65. configurable: true,
  66. writable: true
  67. });
  68. } else {
  69. obj[key] = value;
  70. }
  71. return obj;
  72. }
  73. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  74. /***/ }),
  75. /***/ 116:
  76. /*!************************************************!*\
  77. !*** E:/work/mdapp/js_sdk/xb-copy/uni-copy.js ***!
  78. \************************************************/
  79. /*! no static exports found */
  80. /***/ (function(module, exports, __webpack_require__) {
  81. "use strict";
  82. /* WEBPACK VAR INJECTION */(function(uni) {
  83. Object.defineProperty(exports, "__esModule", {
  84. value: true
  85. });
  86. exports.default = uniCopy;
  87. function uniCopy(_ref) {
  88. var content = _ref.content,
  89. _success = _ref.success,
  90. error = _ref.error;
  91. if (!content) return error('复制的内容不能为空 !');
  92. content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  93. /**
  94. * 小程序端 和 app端的复制逻辑
  95. */
  96. uni.setClipboardData({
  97. data: content,
  98. success: function success() {
  99. _success("复制成功~");
  100. console.log('success');
  101. },
  102. fail: function fail() {
  103. _success("复制失败~");
  104. }
  105. });
  106. /**
  107. * H5端的复制逻辑
  108. */
  109. }
  110. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  111. /***/ }),
  112. /***/ 12:
  113. /*!**************************************************************!*\
  114. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  115. \**************************************************************/
  116. /*! no static exports found */
  117. /***/ (function(module, exports, __webpack_require__) {
  118. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  119. var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 14);
  120. function _toPropertyKey(arg) {
  121. var key = toPrimitive(arg, "string");
  122. return _typeof(key) === "symbol" ? key : String(key);
  123. }
  124. module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  125. /***/ }),
  126. /***/ 13:
  127. /*!*******************************************************!*\
  128. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  129. \*******************************************************/
  130. /*! no static exports found */
  131. /***/ (function(module, exports) {
  132. function _typeof(obj) {
  133. "@babel/helpers - typeof";
  134. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
  135. return typeof obj;
  136. } : function (obj) {
  137. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  138. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
  139. }
  140. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  141. /***/ }),
  142. /***/ 14:
  143. /*!************************************************************!*\
  144. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  145. \************************************************************/
  146. /*! no static exports found */
  147. /***/ (function(module, exports, __webpack_require__) {
  148. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  149. function _toPrimitive(input, hint) {
  150. if (_typeof(input) !== "object" || input === null) return input;
  151. var prim = input[Symbol.toPrimitive];
  152. if (prim !== undefined) {
  153. var res = prim.call(input, hint || "default");
  154. if (_typeof(res) !== "object") return res;
  155. throw new TypeError("@@toPrimitive must return a primitive value.");
  156. }
  157. return (hint === "string" ? String : Number)(input);
  158. }
  159. module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  160. /***/ }),
  161. /***/ 15:
  162. /*!**********************************************************!*\
  163. !*** ./node_modules/@babel/runtime/helpers/construct.js ***!
  164. \**********************************************************/
  165. /*! no static exports found */
  166. /***/ (function(module, exports, __webpack_require__) {
  167. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  168. var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 17);
  169. function _construct(Parent, args, Class) {
  170. if (isNativeReflectConstruct()) {
  171. module.exports = _construct = Reflect.construct.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports;
  172. } else {
  173. module.exports = _construct = function _construct(Parent, args, Class) {
  174. var a = [null];
  175. a.push.apply(a, args);
  176. var Constructor = Function.bind.apply(Parent, a);
  177. var instance = new Constructor();
  178. if (Class) setPrototypeOf(instance, Class.prototype);
  179. return instance;
  180. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  181. }
  182. return _construct.apply(null, arguments);
  183. }
  184. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  185. /***/ }),
  186. /***/ 16:
  187. /*!***************************************************************!*\
  188. !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
  189. \***************************************************************/
  190. /*! no static exports found */
  191. /***/ (function(module, exports) {
  192. function _setPrototypeOf(o, p) {
  193. module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  194. o.__proto__ = p;
  195. return o;
  196. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  197. return _setPrototypeOf(o, p);
  198. }
  199. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  200. /***/ }),
  201. /***/ 17:
  202. /*!*************************************************************************!*\
  203. !*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
  204. \*************************************************************************/
  205. /*! no static exports found */
  206. /***/ (function(module, exports) {
  207. function _isNativeReflectConstruct() {
  208. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  209. if (Reflect.construct.sham) return false;
  210. if (typeof Proxy === "function") return true;
  211. try {
  212. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  213. return true;
  214. } catch (e) {
  215. return false;
  216. }
  217. }
  218. module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  219. /***/ }),
  220. /***/ 173:
  221. /*!*************************************!*\
  222. !*** E:/work/mdapp/utils/qrcode.js ***!
  223. \*************************************/
  224. /*! no static exports found */
  225. /***/ (function(module, exports, __webpack_require__) {
  226. "use strict";
  227. /* WEBPACK VAR INJECTION */(function(uni) {
  228. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  229. Object.defineProperty(exports, "__esModule", {
  230. value: true
  231. });
  232. exports.default = void 0;
  233. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  234. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  235. /**
  236. * qrcode-wx-miniprogram
  237. */
  238. var QRMode = {
  239. MODE_NUMBER: 1 << 0,
  240. MODE_ALPHA_NUM: 1 << 1,
  241. MODE_8BIT_BYTE: 1 << 2,
  242. MODE_KANJI: 1 << 3
  243. },
  244. QRErrorCorrectLevel = {
  245. L: 1,
  246. M: 0,
  247. Q: 3,
  248. H: 2
  249. },
  250. QRMaskPattern = {
  251. PATTERN000: 0,
  252. PATTERN001: 1,
  253. PATTERN010: 2,
  254. PATTERN011: 3,
  255. PATTERN100: 4,
  256. PATTERN101: 5,
  257. PATTERN110: 6,
  258. PATTERN111: 7
  259. },
  260. QRUtil = {
  261. PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]],
  262. G15: 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0,
  263. G18: 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0,
  264. G15_MASK: 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1,
  265. getBCHTypeInfo: function getBCHTypeInfo(data) {
  266. var d = data << 10;
  267. while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
  268. d ^= QRUtil.G15 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15);
  269. }
  270. return (data << 10 | d) ^ QRUtil.G15_MASK;
  271. },
  272. getBCHTypeNumber: function getBCHTypeNumber(data) {
  273. var d = data << 12;
  274. while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
  275. d ^= QRUtil.G18 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18);
  276. }
  277. return data << 12 | d;
  278. },
  279. getBCHDigit: function getBCHDigit(data) {
  280. var digit = 0;
  281. while (data != 0) {
  282. digit++;
  283. data >>>= 1;
  284. }
  285. return digit;
  286. },
  287. getPatternPosition: function getPatternPosition(typeNumber) {
  288. return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
  289. },
  290. getMask: function getMask(maskPattern, i, j) {
  291. switch (maskPattern) {
  292. case QRMaskPattern.PATTERN000:
  293. return (i + j) % 2 == 0;
  294. case QRMaskPattern.PATTERN001:
  295. return i % 2 == 0;
  296. case QRMaskPattern.PATTERN010:
  297. return j % 3 == 0;
  298. case QRMaskPattern.PATTERN011:
  299. return (i + j) % 3 == 0;
  300. case QRMaskPattern.PATTERN100:
  301. return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
  302. case QRMaskPattern.PATTERN101:
  303. return i * j % 2 + i * j % 3 == 0;
  304. case QRMaskPattern.PATTERN110:
  305. return (i * j % 2 + i * j % 3) % 2 == 0;
  306. case QRMaskPattern.PATTERN111:
  307. return (i * j % 3 + (i + j) % 2) % 2 == 0;
  308. default:
  309. //throw new Error("bad maskPattern:" + maskPattern);
  310. throwError("bad maskPattern:" + maskPattern);
  311. }
  312. },
  313. getErrorCorrectPolynomial: function getErrorCorrectPolynomial(errorCorrectLength) {
  314. var a = new QRPolynomial([1], 0);
  315. for (var i = 0; i < errorCorrectLength; i++) {
  316. a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
  317. }
  318. return a;
  319. },
  320. getLengthInBits: function getLengthInBits(mode, type) {
  321. if (1 <= type && type < 10) {
  322. switch (mode) {
  323. case QRMode.MODE_NUMBER:
  324. return 10;
  325. case QRMode.MODE_ALPHA_NUM:
  326. return 9;
  327. case QRMode.MODE_8BIT_BYTE:
  328. return 8;
  329. case QRMode.MODE_KANJI:
  330. return 8;
  331. default:
  332. //throw new Error("mode:" + mode);
  333. throwError("mode:" + mode);
  334. }
  335. } else if (type < 27) {
  336. switch (mode) {
  337. case QRMode.MODE_NUMBER:
  338. return 12;
  339. case QRMode.MODE_ALPHA_NUM:
  340. return 11;
  341. case QRMode.MODE_8BIT_BYTE:
  342. return 16;
  343. case QRMode.MODE_KANJI:
  344. return 10;
  345. default:
  346. //throw new Error("mode:" + mode);
  347. throwError("mode:" + mode);
  348. }
  349. } else if (type < 41) {
  350. switch (mode) {
  351. case QRMode.MODE_NUMBER:
  352. return 14;
  353. case QRMode.MODE_ALPHA_NUM:
  354. return 13;
  355. case QRMode.MODE_8BIT_BYTE:
  356. return 16;
  357. case QRMode.MODE_KANJI:
  358. return 12;
  359. default:
  360. //throw new Error("mode:" + mode);
  361. throwError("mode:" + mode);
  362. }
  363. } else {
  364. //throw new Error("type:" + type);
  365. throwError("type:" + type);
  366. }
  367. },
  368. getLostPoint: function getLostPoint(qrCode) {
  369. var moduleCount = qrCode.getModuleCount();
  370. var lostPoint = 0;
  371. for (var row = 0; row < moduleCount; row++) {
  372. for (var col = 0; col < moduleCount; col++) {
  373. var sameCount = 0;
  374. var dark = qrCode.isDark(row, col);
  375. for (var r = -1; r <= 1; r++) {
  376. if (row + r < 0 || moduleCount <= row + r) {
  377. continue;
  378. }
  379. for (var c = -1; c <= 1; c++) {
  380. if (col + c < 0 || moduleCount <= col + c) {
  381. continue;
  382. }
  383. if (r == 0 && c == 0) {
  384. continue;
  385. }
  386. if (dark == qrCode.isDark(row + r, col + c)) {
  387. sameCount++;
  388. }
  389. }
  390. }
  391. if (sameCount > 5) {
  392. lostPoint += 3 + sameCount - 5;
  393. }
  394. }
  395. }
  396. for (var row = 0; row < moduleCount - 1; row++) {
  397. for (var col = 0; col < moduleCount - 1; col++) {
  398. var count = 0;
  399. if (qrCode.isDark(row, col)) count++;
  400. if (qrCode.isDark(row + 1, col)) count++;
  401. if (qrCode.isDark(row, col + 1)) count++;
  402. if (qrCode.isDark(row + 1, col + 1)) count++;
  403. if (count == 0 || count == 4) {
  404. lostPoint += 3;
  405. }
  406. }
  407. }
  408. for (var row = 0; row < moduleCount; row++) {
  409. for (var col = 0; col < moduleCount - 6; col++) {
  410. if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) {
  411. lostPoint += 40;
  412. }
  413. }
  414. }
  415. for (var col = 0; col < moduleCount; col++) {
  416. for (var row = 0; row < moduleCount - 6; row++) {
  417. if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) {
  418. lostPoint += 40;
  419. }
  420. }
  421. }
  422. var darkCount = 0;
  423. for (var col = 0; col < moduleCount; col++) {
  424. for (var row = 0; row < moduleCount; row++) {
  425. if (qrCode.isDark(row, col)) {
  426. darkCount++;
  427. }
  428. }
  429. }
  430. var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
  431. lostPoint += ratio * 10;
  432. return lostPoint;
  433. }
  434. },
  435. QRMath = {
  436. glog: function glog(n) {
  437. if (n < 1) {
  438. //throw new Error("glog(" + n + ")");
  439. throwError("glog(" + n + ")");
  440. }
  441. return QRMath.LOG_TABLE[n];
  442. },
  443. gexp: function gexp(n) {
  444. while (n < 0) {
  445. n += 255;
  446. }
  447. while (n >= 256) {
  448. n -= 255;
  449. }
  450. return QRMath.EXP_TABLE[n];
  451. },
  452. EXP_TABLE: new Array(256),
  453. LOG_TABLE: new Array(256)
  454. };
  455. for (var i = 0; i < 8; i++) {
  456. QRMath.EXP_TABLE[i] = 1 << i;
  457. }
  458. for (var _i = 8; _i < 256; _i++) {
  459. QRMath.EXP_TABLE[_i] = QRMath.EXP_TABLE[_i - 4] ^ QRMath.EXP_TABLE[_i - 5] ^ QRMath.EXP_TABLE[_i - 6] ^ QRMath.EXP_TABLE[_i - 8];
  460. }
  461. for (var _i2 = 0; _i2 < 255; _i2++) {
  462. QRMath.LOG_TABLE[QRMath.EXP_TABLE[_i2]] = _i2;
  463. }
  464. /*
  465. * class QR8bitByte
  466. * */
  467. var QR8bitByte = /*#__PURE__*/function () {
  468. function QR8bitByte(data) {
  469. (0, _classCallCheck2.default)(this, QR8bitByte);
  470. this.mode = QRMode.MODE_8BIT_BYTE;
  471. this.data = data;
  472. this.parsedData = [];
  473. // Added to support UTF-8 Characters
  474. for (var _i3 = 0, l = this.data.length; _i3 < l; _i3++) {
  475. var byteArray = [],
  476. code = this.data.charCodeAt(_i3);
  477. if (code > 0x10000) {
  478. byteArray[0] = 0xF0 | (code & 0x1C0000) >>> 18;
  479. byteArray[1] = 0x80 | (code & 0x3F000) >>> 12;
  480. byteArray[2] = 0x80 | (code & 0xFC0) >>> 6;
  481. byteArray[3] = 0x80 | code & 0x3F;
  482. } else if (code > 0x800) {
  483. byteArray[0] = 0xE0 | (code & 0xF000) >>> 12;
  484. byteArray[1] = 0x80 | (code & 0xFC0) >>> 6;
  485. byteArray[2] = 0x80 | code & 0x3F;
  486. } else if (code > 0x80) {
  487. byteArray[0] = 0xC0 | (code & 0x7C0) >>> 6;
  488. byteArray[1] = 0x80 | code & 0x3F;
  489. } else {
  490. byteArray[0] = code;
  491. }
  492. this.parsedData.push(byteArray);
  493. }
  494. this.parsedData = Array.prototype.concat.apply([], this.parsedData);
  495. if (this.parsedData.length !== this.data.length) {
  496. this.parsedData.unshift(191);
  497. this.parsedData.unshift(187);
  498. this.parsedData.unshift(239);
  499. }
  500. }
  501. (0, _createClass2.default)(QR8bitByte, [{
  502. key: "getLength",
  503. value: function getLength(buffer) {
  504. return this.parsedData.length;
  505. }
  506. }, {
  507. key: "write",
  508. value: function write(buffer) {
  509. for (var _i4 = 0, l = this.parsedData.length; _i4 < l; _i4++) {
  510. buffer.put(this.parsedData[_i4], 8);
  511. }
  512. }
  513. }]);
  514. return QR8bitByte;
  515. }();
  516. /*
  517. * class QRCodeModel
  518. * */
  519. var QRCodeModel = /*#__PURE__*/function () {
  520. function QRCodeModel(typeNumber, errorCorrectLevel) {
  521. (0, _classCallCheck2.default)(this, QRCodeModel);
  522. this.typeNumber = typeNumber;
  523. this.errorCorrectLevel = errorCorrectLevel;
  524. this.modules = null;
  525. this.moduleCount = 0;
  526. this.dataCache = null;
  527. this.dataList = [];
  528. }
  529. (0, _createClass2.default)(QRCodeModel, [{
  530. key: "addData",
  531. value: function addData(data) {
  532. var newData = new QR8bitByte(data);
  533. this.dataList.push(newData);
  534. this.dataCache = null;
  535. }
  536. }, {
  537. key: "isDark",
  538. value: function isDark(row, col) {
  539. if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
  540. //throw new Error(row + ',' + col);
  541. throwError(row + ',' + col);
  542. }
  543. return this.modules[row][col];
  544. }
  545. }, {
  546. key: "getModuleCount",
  547. value: function getModuleCount() {
  548. return this.moduleCount;
  549. }
  550. }, {
  551. key: "make",
  552. value: function make() {
  553. this.makeImpl(false, this.getBestMaskPattern());
  554. }
  555. }, {
  556. key: "makeImpl",
  557. value: function makeImpl(test, maskPattern) {
  558. this.moduleCount = this.typeNumber * 4 + 17;
  559. this.modules = new Array(this.moduleCount);
  560. for (var row = 0; row < this.moduleCount; row++) {
  561. this.modules[row] = new Array(this.moduleCount);
  562. for (var col = 0; col < this.moduleCount; col++) {
  563. this.modules[row][col] = null;
  564. }
  565. }
  566. this.setupPositionProbePattern(0, 0);
  567. this.setupPositionProbePattern(this.moduleCount - 7, 0);
  568. this.setupPositionProbePattern(0, this.moduleCount - 7);
  569. this.setupPositionAdjustPattern();
  570. this.setupTimingPattern();
  571. this.setupTypeInfo(test, maskPattern);
  572. if (this.typeNumber >= 7) {
  573. this.setupTypeNumber(test);
  574. }
  575. if (this.dataCache == null) {
  576. this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
  577. }
  578. this.mapData(this.dataCache, maskPattern);
  579. }
  580. }, {
  581. key: "setupPositionProbePattern",
  582. value: function setupPositionProbePattern(row, col) {
  583. for (var r = -1; r <= 7; r++) {
  584. if (row + r <= -1 || this.moduleCount <= row + r) {
  585. continue;
  586. }
  587. for (var c = -1; c <= 7; c++) {
  588. if (col + c <= -1 || this.moduleCount <= col + c) {
  589. continue;
  590. }
  591. this.modules[row + r][col + c] = 0 <= r && r <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (r == 0 || r == 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4;
  592. }
  593. }
  594. }
  595. }, {
  596. key: "getBestMaskPattern",
  597. value: function getBestMaskPattern() {
  598. var minLostPoint = 0,
  599. pattern = 0;
  600. for (var _i5 = 0; _i5 < 8; _i5++) {
  601. this.makeImpl(true, _i5);
  602. var lostPoint = QRUtil.getLostPoint(this);
  603. if (_i5 == 0 || minLostPoint > lostPoint) {
  604. minLostPoint = lostPoint;
  605. pattern = _i5;
  606. }
  607. }
  608. return pattern;
  609. }
  610. }, {
  611. key: "setupTimingPattern",
  612. value: function setupTimingPattern() {
  613. for (var r = 8; r < this.moduleCount - 8; r++) {
  614. if (this.modules[r][6] != null) {
  615. continue;
  616. }
  617. this.modules[r][6] = r % 2 == 0;
  618. }
  619. for (var c = 8; c < this.moduleCount - 8; c++) {
  620. if (this.modules[6][c] != null) {
  621. continue;
  622. }
  623. this.modules[6][c] = c % 2 == 0;
  624. }
  625. }
  626. }, {
  627. key: "setupPositionAdjustPattern",
  628. value: function setupPositionAdjustPattern() {
  629. var pos = QRUtil.getPatternPosition(this.typeNumber);
  630. for (var _i6 = 0; _i6 < pos.length; _i6++) {
  631. for (var j = 0; j < pos.length; j++) {
  632. var row = pos[_i6],
  633. col = pos[j];
  634. if (this.modules[row][col] != null) {
  635. continue;
  636. }
  637. for (var r = -2; r <= 2; r++) {
  638. for (var c = -2; c <= 2; c++) {
  639. this.modules[row + r][col + c] = r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0;
  640. }
  641. }
  642. }
  643. }
  644. }
  645. }, {
  646. key: "setupTypeNumber",
  647. value: function setupTypeNumber(test) {
  648. var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
  649. for (var _i7 = 0; _i7 < 18; _i7++) {
  650. this.modules[Math.floor(_i7 / 3)][_i7 % 3 + this.moduleCount - 8 - 3] = !test && (bits >> _i7 & 1) == 1;
  651. }
  652. for (var _i8 = 0; _i8 < 18; _i8++) {
  653. this.modules[_i8 % 3 + this.moduleCount - 8 - 3][Math.floor(_i8 / 3)] = !test && (bits >> _i8 & 1) == 1;
  654. }
  655. }
  656. }, {
  657. key: "setupTypeInfo",
  658. value: function setupTypeInfo(test, maskPattern) {
  659. var data = this.errorCorrectLevel << 3 | maskPattern,
  660. bits = QRUtil.getBCHTypeInfo(data);
  661. for (var _i9 = 0; _i9 < 15; _i9++) {
  662. var mod = !test && (bits >> _i9 & 1) == 1;
  663. if (_i9 < 6) {
  664. this.modules[_i9][8] = mod;
  665. } else if (_i9 < 8) {
  666. this.modules[_i9 + 1][8] = mod;
  667. } else {
  668. this.modules[this.moduleCount - 15 + _i9][8] = mod;
  669. }
  670. }
  671. for (var _i10 = 0; _i10 < 15; _i10++) {
  672. var _mod = !test && (bits >> _i10 & 1) == 1;
  673. if (_i10 < 8) {
  674. this.modules[8][this.moduleCount - _i10 - 1] = _mod;
  675. } else if (_i10 < 9) {
  676. this.modules[8][15 - _i10 - 1 + 1] = _mod;
  677. } else {
  678. this.modules[8][15 - _i10 - 1] = _mod;
  679. }
  680. }
  681. this.modules[this.moduleCount - 8][8] = !test;
  682. }
  683. }, {
  684. key: "mapData",
  685. value: function mapData(data, maskPattern) {
  686. var inc = -1,
  687. row = this.moduleCount - 1,
  688. bitIndex = 7,
  689. byteIndex = 0;
  690. for (var col = this.moduleCount - 1; col > 0; col -= 2) {
  691. if (col == 6) col--;
  692. while (true) {
  693. for (var c = 0; c < 2; c++) {
  694. if (this.modules[row][col - c] == null) {
  695. var dark = false;
  696. if (byteIndex < data.length) {
  697. dark = (data[byteIndex] >>> bitIndex & 1) == 1;
  698. }
  699. var mask = QRUtil.getMask(maskPattern, row, col - c);
  700. if (mask) {
  701. dark = !dark;
  702. }
  703. this.modules[row][col - c] = dark;
  704. bitIndex--;
  705. if (bitIndex == -1) {
  706. byteIndex++;
  707. bitIndex = 7;
  708. }
  709. }
  710. }
  711. row += inc;
  712. if (row < 0 || this.moduleCount <= row) {
  713. row -= inc;
  714. inc = -inc;
  715. break;
  716. }
  717. }
  718. }
  719. }
  720. }]);
  721. return QRCodeModel;
  722. }();
  723. QRCodeModel.PAD0 = 0xEC;
  724. QRCodeModel.PAD1 = 0x11;
  725. QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) {
  726. var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel),
  727. buffer = new QRBitBuffer();
  728. for (var _i11 = 0; _i11 < dataList.length; _i11++) {
  729. var data = dataList[_i11];
  730. buffer.put(data.mode, 4);
  731. buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
  732. data.write(buffer);
  733. }
  734. var totalDataCount = 0;
  735. for (var _i12 = 0; _i12 < rsBlocks.length; _i12++) {
  736. totalDataCount += rsBlocks[_i12].dataCount;
  737. }
  738. if (buffer.getLengthInBits() > totalDataCount * 8) {
  739. /*
  740. throw new Error("code length overflow. (" +
  741. buffer.getLengthInBits() +
  742. ">" +
  743. totalDataCount * 8 +
  744. ")");
  745. */
  746. throwError("code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")");
  747. }
  748. if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
  749. buffer.put(0, 4);
  750. }
  751. while (buffer.getLengthInBits() % 8 != 0) {
  752. buffer.putBit(false);
  753. }
  754. while (true) {
  755. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  756. break;
  757. }
  758. buffer.put(QRCodeModel.PAD0, 8);
  759. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  760. break;
  761. }
  762. buffer.put(QRCodeModel.PAD1, 8);
  763. }
  764. return QRCodeModel.createBytes(buffer, rsBlocks);
  765. };
  766. QRCodeModel.createBytes = function (buffer, rsBlocks) {
  767. var offset = 0,
  768. maxDcCount = 0,
  769. maxEcCount = 0,
  770. dcData = new Array(rsBlocks.length),
  771. ecData = new Array(rsBlocks.length);
  772. for (var r = 0; r < rsBlocks.length; r++) {
  773. var dcCount = rsBlocks[r].dataCount,
  774. ecCount = rsBlocks[r].totalCount - dcCount;
  775. maxDcCount = Math.max(maxDcCount, dcCount);
  776. maxEcCount = Math.max(maxEcCount, ecCount);
  777. dcData[r] = new Array(dcCount);
  778. for (var _i13 = 0; _i13 < dcData[r].length; _i13++) {
  779. dcData[r][_i13] = 0xff & buffer.buffer[_i13 + offset];
  780. }
  781. offset += dcCount;
  782. var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount),
  783. rawPoly = new QRPolynomial(dcData[r], rsPoly.getLength() - 1),
  784. modPoly = rawPoly.mod(rsPoly);
  785. ecData[r] = new Array(rsPoly.getLength() - 1);
  786. for (var _i14 = 0; _i14 < ecData[r].length; _i14++) {
  787. var modIndex = _i14 + modPoly.getLength() - ecData[r].length;
  788. ecData[r][_i14] = modIndex >= 0 ? modPoly.get(modIndex) : 0;
  789. }
  790. }
  791. var totalCodeCount = 0;
  792. for (var _i15 = 0; _i15 < rsBlocks.length; _i15++) {
  793. totalCodeCount += rsBlocks[_i15].totalCount;
  794. }
  795. var data = new Array(totalCodeCount),
  796. index = 0;
  797. for (var _i16 = 0; _i16 < maxDcCount; _i16++) {
  798. for (var _r = 0; _r < rsBlocks.length; _r++) {
  799. if (_i16 < dcData[_r].length) {
  800. data[index++] = dcData[_r][_i16];
  801. }
  802. }
  803. }
  804. for (var _i17 = 0; _i17 < maxEcCount; _i17++) {
  805. for (var _r2 = 0; _r2 < rsBlocks.length; _r2++) {
  806. if (_i17 < ecData[_r2].length) {
  807. data[index++] = ecData[_r2][_i17];
  808. }
  809. }
  810. }
  811. return data;
  812. };
  813. /*
  814. * class QRPolynomial
  815. * */
  816. var QRPolynomial = /*#__PURE__*/function () {
  817. function QRPolynomial(num, shift) {
  818. (0, _classCallCheck2.default)(this, QRPolynomial);
  819. if (num.length == undefined) {
  820. //throw new Error(num.length + '/' + shift);
  821. throwError(num.length + '/' + shift);
  822. }
  823. var offset = 0;
  824. while (offset < num.length && num[offset] == 0) {
  825. offset++;
  826. }
  827. this.num = new Array(num.length - offset + shift);
  828. for (var _i18 = 0; _i18 < num.length - offset; _i18++) {
  829. this.num[_i18] = num[_i18 + offset];
  830. }
  831. }
  832. (0, _createClass2.default)(QRPolynomial, [{
  833. key: "get",
  834. value: function get(index) {
  835. return this.num[index];
  836. }
  837. }, {
  838. key: "getLength",
  839. value: function getLength() {
  840. return this.num.length;
  841. }
  842. }, {
  843. key: "multiply",
  844. value: function multiply(e) {
  845. var num = new Array(this.getLength() + e.getLength() - 1);
  846. for (var _i19 = 0; _i19 < this.getLength(); _i19++) {
  847. for (var j = 0; j < e.getLength(); j++) {
  848. num[_i19 + j] ^= QRMath.gexp(QRMath.glog(this.get(_i19)) + QRMath.glog(e.get(j)));
  849. }
  850. }
  851. return new QRPolynomial(num, 0);
  852. }
  853. }, {
  854. key: "mod",
  855. value: function mod(e) {
  856. if (this.getLength() - e.getLength() < 0) {
  857. return this;
  858. }
  859. var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)),
  860. num = new Array(this.getLength());
  861. for (var _i20 = 0; _i20 < this.getLength(); _i20++) {
  862. num[_i20] = this.get(_i20);
  863. }
  864. for (var _i21 = 0; _i21 < e.getLength(); _i21++) {
  865. num[_i21] ^= QRMath.gexp(QRMath.glog(e.get(_i21)) + ratio);
  866. }
  867. return new QRPolynomial(num, 0).mod(e);
  868. }
  869. }]);
  870. return QRPolynomial;
  871. }();
  872. /*
  873. * class QRRSBlock
  874. * */
  875. var QRRSBlock = /*#__PURE__*/(0, _createClass2.default)(function QRRSBlock(totalCount, dataCount) {
  876. (0, _classCallCheck2.default)(this, QRRSBlock);
  877. this.totalCount = totalCount;
  878. this.dataCount = dataCount;
  879. });
  880. QRRSBlock.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]];
  881. QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) {
  882. var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
  883. if (!rsBlock) {
  884. //throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
  885. throwError("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
  886. }
  887. var length = rsBlock.length / 3,
  888. list = [];
  889. for (var _i22 = 0; _i22 < length; _i22++) {
  890. var count = rsBlock[_i22 * 3],
  891. totalCount = rsBlock[_i22 * 3 + 1],
  892. dataCount = rsBlock[_i22 * 3 + 2];
  893. for (var j = 0; j < count; j++) {
  894. list.push(new QRRSBlock(totalCount, dataCount));
  895. }
  896. }
  897. return list;
  898. };
  899. QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) {
  900. switch (errorCorrectLevel) {
  901. case QRErrorCorrectLevel.L:
  902. return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4];
  903. case QRErrorCorrectLevel.M:
  904. return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
  905. case QRErrorCorrectLevel.Q:
  906. return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
  907. case QRErrorCorrectLevel.H:
  908. return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
  909. default:
  910. return undefined;
  911. }
  912. };
  913. /*
  914. * class QRBitBuffer
  915. * */
  916. var QRBitBuffer = /*#__PURE__*/function () {
  917. function QRBitBuffer() {
  918. (0, _classCallCheck2.default)(this, QRBitBuffer);
  919. this.buffer = [];
  920. this.length = 0;
  921. }
  922. (0, _createClass2.default)(QRBitBuffer, [{
  923. key: "get",
  924. value: function get(index) {
  925. var bufIndex = Math.floor(index / 8);
  926. return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
  927. }
  928. }, {
  929. key: "put",
  930. value: function put(num, length) {
  931. for (var _i23 = 0; _i23 < length; _i23++) {
  932. this.putBit((num >>> length - _i23 - 1 & 1) == 1);
  933. }
  934. }
  935. }, {
  936. key: "getLengthInBits",
  937. value: function getLengthInBits() {
  938. return this.length;
  939. }
  940. }, {
  941. key: "putBit",
  942. value: function putBit(bit) {
  943. var bufIndex = Math.floor(this.length / 8);
  944. if (this.buffer.length <= bufIndex) {
  945. this.buffer.push(0);
  946. }
  947. if (bit) {
  948. this.buffer[bufIndex] |= 0x80 >>> this.length % 8;
  949. }
  950. this.length++;
  951. }
  952. }]);
  953. return QRBitBuffer;
  954. }();
  955. /*
  956. * Class Drawing
  957. * */
  958. var Drawing = /*#__PURE__*/function () {
  959. function Drawing(el, opts) {
  960. (0, _classCallCheck2.default)(this, Drawing);
  961. this._opts = opts;
  962. this._el = el;
  963. this._ctx = uni.createCanvasContext(el);
  964. }
  965. (0, _createClass2.default)(Drawing, [{
  966. key: "draw",
  967. value: function draw(QRCode) {
  968. var ctx = this._ctx,
  969. opts = this._opts;
  970. var ctxPosFix = opts.width / 20;
  971. //console.log(opts.width)
  972. var count = QRCode.getModuleCount(),
  973. width = (opts.width - 2 * ctxPosFix) / count,
  974. height = (opts.height - 2 * ctxPosFix) / count,
  975. roundedWidth = Math.round(width),
  976. roundedHeight = Math.round(height);
  977. this.clear();
  978. ctx.setFillStyle('#fff');
  979. ctx.fillRect(0, 0, this._opts.width + 4 * ctxPosFix, this._opts.width + 4 * ctxPosFix);
  980. for (var row = 0; row < count; row++) {
  981. for (var col = 0; col < count; col++) {
  982. var isDark = QRCode.isDark(row, col),
  983. left = col * width + ctxPosFix,
  984. top = row * height + ctxPosFix;
  985. ctx.setStrokeStyle(isDark ? opts.colorDark : opts.colorLight);
  986. ctx.setLineWidth(1);
  987. ctx.setFillStyle(isDark ? opts.colorDark : opts.colorLight);
  988. ctx.fillRect(left, top, width, height);
  989. ctx.strokeRect(Math.floor(left) + 0.5, Math.floor(top) + 0.5, roundedWidth, roundedHeight);
  990. ctx.strokeRect(Math.ceil(left) - 0.5, Math.ceil(top) - 0.5, roundedWidth, roundedHeight);
  991. }
  992. }
  993. this._opts.logo && this.drawImg(this._opts.logo, this._opts.width, ctx);
  994. ctx.draw();
  995. this._bIsPainted = true;
  996. if (this._opts.successTips && drawingOptsSuccessTips) {
  997. uni.hideLoading();
  998. uni.showToast({
  999. title: '生成成功',
  1000. icon: 'success',
  1001. duration: 1000
  1002. });
  1003. }
  1004. drawingOptsSuccessTips = true;
  1005. }
  1006. }, {
  1007. key: "clear",
  1008. value: function clear() {
  1009. this._ctx.clearRect(0, 0, this._opts.width, this._opts.height);
  1010. }
  1011. /** anlib **/
  1012. /**
  1013. * 二维码上添加图片
  1014. */
  1015. }, {
  1016. key: "drawImg",
  1017. value: function drawImg(src, width, ctx) {
  1018. // logo相对二维码的比例
  1019. var scale = 5;
  1020. // logo相对二维码的大小
  1021. var imgSize = width / scale;
  1022. // 偏移位置起始点
  1023. var imgPos = width / scale * 2;
  1024. // 二维码边框尺寸,这里设置为原宽度的80分之一
  1025. var imgPosFix = width / 80;
  1026. //console.log('width', width);
  1027. //console.log('imgSize', imgSize);
  1028. //console.log('imgPos', imgPos);
  1029. //console.log('imgPosFix', imgPosFix);
  1030. //console.log('src', src);
  1031. ctx.setFillStyle('#fff');
  1032. ctx.fillRect(imgPos - imgPosFix, imgPos - imgPosFix, imgSize + imgPosFix * 2, imgSize + imgPosFix * 2);
  1033. ctx.beginPath();
  1034. ctx.moveTo(imgPos - imgPosFix, imgPos - imgPosFix);
  1035. ctx.stroke();
  1036. ctx.closePath();
  1037. ctx.drawImage(src, imgPos, imgPos, imgSize, imgSize);
  1038. ctx.beginPath();
  1039. }
  1040. }]);
  1041. return Drawing;
  1042. }();
  1043. /*
  1044. * Class QRCode
  1045. * */
  1046. var QRCode = function () {
  1047. /**
  1048. * Get the type by string length
  1049. * @author anlib
  1050. * @private
  1051. * @param {String} text
  1052. * @param {Number} correctLevel
  1053. * @return {Number} type
  1054. */
  1055. function getTypeNumber(text, correctLevel) {
  1056. var type = 1,
  1057. length = getUTF8Length(text),
  1058. QRCodeLimitLength = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]];
  1059. for (var _i24 = 0, len = QRCodeLimitLength.length; _i24 <= len; _i24++) {
  1060. var limit = 0;
  1061. switch (correctLevel) {
  1062. case QRErrorCorrectLevel.L:
  1063. limit = QRCodeLimitLength[_i24][0];
  1064. break;
  1065. case QRErrorCorrectLevel.M:
  1066. limit = QRCodeLimitLength[_i24][1];
  1067. break;
  1068. case QRErrorCorrectLevel.Q:
  1069. limit = QRCodeLimitLength[_i24][2];
  1070. break;
  1071. case QRErrorCorrectLevel.H:
  1072. limit = QRCodeLimitLength[_i24][3];
  1073. break;
  1074. }
  1075. if (length <= limit) {
  1076. break;
  1077. } else {
  1078. type++;
  1079. }
  1080. }
  1081. if (type > QRCodeLimitLength.length) {
  1082. // throw new Error('Too long data'); //supfire
  1083. throwError('Too long data');
  1084. }
  1085. return type;
  1086. }
  1087. function getUTF8Length(text) {
  1088. var replacedText = encodeURI(text).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
  1089. return replacedText.length + (replacedText.length != text ? 3 : 0);
  1090. }
  1091. var Fn = /*#__PURE__*/function () {
  1092. function Fn(el, opts) {
  1093. (0, _classCallCheck2.default)(this, Fn);
  1094. this._opts = {
  1095. width: 300,
  1096. height: 300,
  1097. typeNumber: 4,
  1098. colorDark: '#000000',
  1099. colorLight: '#ffffff',
  1100. correctLevel: Fn.correctLevel.H,
  1101. logo: false,
  1102. successTips: false
  1103. };
  1104. if (typeof opts === 'string') {
  1105. opts = {
  1106. text: opts
  1107. };
  1108. }
  1109. // Overwrites options 简单拷贝
  1110. if (opts) {
  1111. for (var _i25 in opts) {
  1112. if (opts.hasOwnProperty(_i25)) {
  1113. this._opts[_i25] = opts[_i25];
  1114. }
  1115. }
  1116. }
  1117. this._el = el;
  1118. this._QRCode = null;
  1119. this._drawing = new Drawing(this._el, this._opts);
  1120. if (this._opts.text) {
  1121. this.makeCode(this._opts.text);
  1122. }
  1123. }
  1124. (0, _createClass2.default)(Fn, [{
  1125. key: "makeCode",
  1126. value: function makeCode(text) {
  1127. this._QRCode = new QRCodeModel(getTypeNumber(text, this._opts.correctLevel), this._opts.correctLevel);
  1128. this._QRCode.addData(text);
  1129. this._QRCode.make();
  1130. this._drawing.draw(this._QRCode);
  1131. }
  1132. }, {
  1133. key: "clear",
  1134. value: function clear() {
  1135. this._drawing.clear();
  1136. }
  1137. }]);
  1138. return Fn;
  1139. }();
  1140. Fn.correctLevel = QRErrorCorrectLevel;
  1141. return Fn;
  1142. }();
  1143. /** anlib **/
  1144. var drawingOptsSuccessTips = true;
  1145. /**
  1146. * 抛出错误
  1147. */
  1148. function throwError(str) {
  1149. uni.hideLoading();
  1150. uni.showToast({
  1151. title: '有字符暂不支持',
  1152. icon: 'none',
  1153. duration: 2000
  1154. });
  1155. drawingOptsSuccessTips = false;
  1156. //throw new Error(str);
  1157. }
  1158. var _default = QRCode;
  1159. exports.default = _default;
  1160. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  1161. /***/ }),
  1162. /***/ 18:
  1163. /*!******************************************************************!*\
  1164. !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
  1165. \******************************************************************/
  1166. /*! no static exports found */
  1167. /***/ (function(module, exports, __webpack_require__) {
  1168. var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 19);
  1169. var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 20);
  1170. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  1171. var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 21);
  1172. function _toConsumableArray(arr) {
  1173. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  1174. }
  1175. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  1176. /***/ }),
  1177. /***/ 19:
  1178. /*!******************************************************************!*\
  1179. !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
  1180. \******************************************************************/
  1181. /*! no static exports found */
  1182. /***/ (function(module, exports, __webpack_require__) {
  1183. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  1184. function _arrayWithoutHoles(arr) {
  1185. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  1186. }
  1187. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  1188. /***/ }),
  1189. /***/ 2:
  1190. /*!************************************************************!*\
  1191. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  1192. \************************************************************/
  1193. /*! no static exports found */
  1194. /***/ (function(module, exports, __webpack_require__) {
  1195. "use strict";
  1196. /* WEBPACK VAR INJECTION */(function(wx, global) {
  1197. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  1198. Object.defineProperty(exports, "__esModule", {
  1199. value: true
  1200. });
  1201. exports.createApp = createApp;
  1202. exports.createComponent = createComponent;
  1203. exports.createPage = createPage;
  1204. exports.createPlugin = createPlugin;
  1205. exports.createSubpackageApp = createSubpackageApp;
  1206. exports.default = void 0;
  1207. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  1208. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  1209. var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ 15));
  1210. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  1211. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  1212. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
  1213. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 25));
  1214. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  1215. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  1216. var realAtob;
  1217. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1218. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  1219. if (typeof atob !== 'function') {
  1220. realAtob = function realAtob(str) {
  1221. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  1222. if (!b64re.test(str)) {
  1223. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  1224. }
  1225. // Adding the padding if missing, for semplicity
  1226. str += '=='.slice(2 - (str.length & 3));
  1227. var bitmap;
  1228. var result = '';
  1229. var r1;
  1230. var r2;
  1231. var i = 0;
  1232. for (; i < str.length;) {
  1233. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  1234. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  1235. }
  1236. return result;
  1237. };
  1238. } else {
  1239. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  1240. realAtob = atob;
  1241. }
  1242. function b64DecodeUnicode(str) {
  1243. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  1244. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  1245. }).join(''));
  1246. }
  1247. function getCurrentUserInfo() {
  1248. var token = wx.getStorageSync('uni_id_token') || '';
  1249. var tokenArr = token.split('.');
  1250. if (!token || tokenArr.length !== 3) {
  1251. return {
  1252. uid: null,
  1253. role: [],
  1254. permission: [],
  1255. tokenExpired: 0
  1256. };
  1257. }
  1258. var userInfo;
  1259. try {
  1260. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  1261. } catch (error) {
  1262. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  1263. }
  1264. userInfo.tokenExpired = userInfo.exp * 1000;
  1265. delete userInfo.exp;
  1266. delete userInfo.iat;
  1267. return userInfo;
  1268. }
  1269. function uniIdMixin(Vue) {
  1270. Vue.prototype.uniIDHasRole = function (roleId) {
  1271. var _getCurrentUserInfo = getCurrentUserInfo(),
  1272. role = _getCurrentUserInfo.role;
  1273. return role.indexOf(roleId) > -1;
  1274. };
  1275. Vue.prototype.uniIDHasPermission = function (permissionId) {
  1276. var _getCurrentUserInfo2 = getCurrentUserInfo(),
  1277. permission = _getCurrentUserInfo2.permission;
  1278. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  1279. };
  1280. Vue.prototype.uniIDTokenValid = function () {
  1281. var _getCurrentUserInfo3 = getCurrentUserInfo(),
  1282. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  1283. return tokenExpired > Date.now();
  1284. };
  1285. }
  1286. var _toString = Object.prototype.toString;
  1287. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1288. function isFn(fn) {
  1289. return typeof fn === 'function';
  1290. }
  1291. function isStr(str) {
  1292. return typeof str === 'string';
  1293. }
  1294. function isObject(obj) {
  1295. return obj !== null && (0, _typeof2.default)(obj) === 'object';
  1296. }
  1297. function isPlainObject(obj) {
  1298. return _toString.call(obj) === '[object Object]';
  1299. }
  1300. function hasOwn(obj, key) {
  1301. return hasOwnProperty.call(obj, key);
  1302. }
  1303. function noop() {}
  1304. /**
  1305. * Create a cached version of a pure function.
  1306. */
  1307. function cached(fn) {
  1308. var cache = Object.create(null);
  1309. return function cachedFn(str) {
  1310. var hit = cache[str];
  1311. return hit || (cache[str] = fn(str));
  1312. };
  1313. }
  1314. /**
  1315. * Camelize a hyphen-delimited string.
  1316. */
  1317. var camelizeRE = /-(\w)/g;
  1318. var camelize = cached(function (str) {
  1319. return str.replace(camelizeRE, function (_, c) {
  1320. return c ? c.toUpperCase() : '';
  1321. });
  1322. });
  1323. function sortObject(obj) {
  1324. var sortObj = {};
  1325. if (isPlainObject(obj)) {
  1326. Object.keys(obj).sort().forEach(function (key) {
  1327. sortObj[key] = obj[key];
  1328. });
  1329. }
  1330. return !Object.keys(sortObj) ? obj : sortObj;
  1331. }
  1332. var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
  1333. var globalInterceptors = {};
  1334. var scopedInterceptors = {};
  1335. function mergeHook(parentVal, childVal) {
  1336. var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
  1337. return res ? dedupeHooks(res) : res;
  1338. }
  1339. function dedupeHooks(hooks) {
  1340. var res = [];
  1341. for (var i = 0; i < hooks.length; i++) {
  1342. if (res.indexOf(hooks[i]) === -1) {
  1343. res.push(hooks[i]);
  1344. }
  1345. }
  1346. return res;
  1347. }
  1348. function removeHook(hooks, hook) {
  1349. var index = hooks.indexOf(hook);
  1350. if (index !== -1) {
  1351. hooks.splice(index, 1);
  1352. }
  1353. }
  1354. function mergeInterceptorHook(interceptor, option) {
  1355. Object.keys(option).forEach(function (hook) {
  1356. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  1357. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  1358. }
  1359. });
  1360. }
  1361. function removeInterceptorHook(interceptor, option) {
  1362. if (!interceptor || !option) {
  1363. return;
  1364. }
  1365. Object.keys(option).forEach(function (hook) {
  1366. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  1367. removeHook(interceptor[hook], option[hook]);
  1368. }
  1369. });
  1370. }
  1371. function addInterceptor(method, option) {
  1372. if (typeof method === 'string' && isPlainObject(option)) {
  1373. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  1374. } else if (isPlainObject(method)) {
  1375. mergeInterceptorHook(globalInterceptors, method);
  1376. }
  1377. }
  1378. function removeInterceptor(method, option) {
  1379. if (typeof method === 'string') {
  1380. if (isPlainObject(option)) {
  1381. removeInterceptorHook(scopedInterceptors[method], option);
  1382. } else {
  1383. delete scopedInterceptors[method];
  1384. }
  1385. } else if (isPlainObject(method)) {
  1386. removeInterceptorHook(globalInterceptors, method);
  1387. }
  1388. }
  1389. function wrapperHook(hook, params) {
  1390. return function (data) {
  1391. return hook(data, params) || data;
  1392. };
  1393. }
  1394. function isPromise(obj) {
  1395. return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  1396. }
  1397. function queue(hooks, data, params) {
  1398. var promise = false;
  1399. for (var i = 0; i < hooks.length; i++) {
  1400. var hook = hooks[i];
  1401. if (promise) {
  1402. promise = Promise.resolve(wrapperHook(hook, params));
  1403. } else {
  1404. var res = hook(data, params);
  1405. if (isPromise(res)) {
  1406. promise = Promise.resolve(res);
  1407. }
  1408. if (res === false) {
  1409. return {
  1410. then: function then() {}
  1411. };
  1412. }
  1413. }
  1414. }
  1415. return promise || {
  1416. then: function then(callback) {
  1417. return callback(data);
  1418. }
  1419. };
  1420. }
  1421. function wrapperOptions(interceptor) {
  1422. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1423. ['success', 'fail', 'complete'].forEach(function (name) {
  1424. if (Array.isArray(interceptor[name])) {
  1425. var oldCallback = options[name];
  1426. options[name] = function callbackInterceptor(res) {
  1427. queue(interceptor[name], res, options).then(function (res) {
  1428. /* eslint-disable no-mixed-operators */
  1429. return isFn(oldCallback) && oldCallback(res) || res;
  1430. });
  1431. };
  1432. }
  1433. });
  1434. return options;
  1435. }
  1436. function wrapperReturnValue(method, returnValue) {
  1437. var returnValueHooks = [];
  1438. if (Array.isArray(globalInterceptors.returnValue)) {
  1439. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
  1440. }
  1441. var interceptor = scopedInterceptors[method];
  1442. if (interceptor && Array.isArray(interceptor.returnValue)) {
  1443. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
  1444. }
  1445. returnValueHooks.forEach(function (hook) {
  1446. returnValue = hook(returnValue) || returnValue;
  1447. });
  1448. return returnValue;
  1449. }
  1450. function getApiInterceptorHooks(method) {
  1451. var interceptor = Object.create(null);
  1452. Object.keys(globalInterceptors).forEach(function (hook) {
  1453. if (hook !== 'returnValue') {
  1454. interceptor[hook] = globalInterceptors[hook].slice();
  1455. }
  1456. });
  1457. var scopedInterceptor = scopedInterceptors[method];
  1458. if (scopedInterceptor) {
  1459. Object.keys(scopedInterceptor).forEach(function (hook) {
  1460. if (hook !== 'returnValue') {
  1461. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  1462. }
  1463. });
  1464. }
  1465. return interceptor;
  1466. }
  1467. function invokeApi(method, api, options) {
  1468. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  1469. params[_key - 3] = arguments[_key];
  1470. }
  1471. var interceptor = getApiInterceptorHooks(method);
  1472. if (interceptor && Object.keys(interceptor).length) {
  1473. if (Array.isArray(interceptor.invoke)) {
  1474. var res = queue(interceptor.invoke, options);
  1475. return res.then(function (options) {
  1476. // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
  1477. return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
  1478. });
  1479. } else {
  1480. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  1481. }
  1482. }
  1483. return api.apply(void 0, [options].concat(params));
  1484. }
  1485. var promiseInterceptor = {
  1486. returnValue: function returnValue(res) {
  1487. if (!isPromise(res)) {
  1488. return res;
  1489. }
  1490. return new Promise(function (resolve, reject) {
  1491. res.then(function (res) {
  1492. if (res[0]) {
  1493. reject(res[0]);
  1494. } else {
  1495. resolve(res[1]);
  1496. }
  1497. });
  1498. });
  1499. }
  1500. };
  1501. var SYNC_API_RE = /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting|initUTS|requireUTS|registerUTS/;
  1502. var CONTEXT_API_RE = /^create|Manager$/;
  1503. // Context例外情况
  1504. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  1505. // 同步例外情况
  1506. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  1507. var CALLBACK_API_RE = /^on|^off/;
  1508. function isContextApi(name) {
  1509. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  1510. }
  1511. function isSyncApi(name) {
  1512. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  1513. }
  1514. function isCallbackApi(name) {
  1515. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  1516. }
  1517. function handlePromise(promise) {
  1518. return promise.then(function (data) {
  1519. return [null, data];
  1520. }).catch(function (err) {
  1521. return [err];
  1522. });
  1523. }
  1524. function shouldPromise(name) {
  1525. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  1526. return false;
  1527. }
  1528. return true;
  1529. }
  1530. /* eslint-disable no-extend-native */
  1531. if (!Promise.prototype.finally) {
  1532. Promise.prototype.finally = function (callback) {
  1533. var promise = this.constructor;
  1534. return this.then(function (value) {
  1535. return promise.resolve(callback()).then(function () {
  1536. return value;
  1537. });
  1538. }, function (reason) {
  1539. return promise.resolve(callback()).then(function () {
  1540. throw reason;
  1541. });
  1542. });
  1543. };
  1544. }
  1545. function promisify(name, api) {
  1546. if (!shouldPromise(name) || !isFn(api)) {
  1547. return api;
  1548. }
  1549. return function promiseApi() {
  1550. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1551. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  1552. params[_key2 - 1] = arguments[_key2];
  1553. }
  1554. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  1555. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  1556. }
  1557. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  1558. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  1559. success: resolve,
  1560. fail: reject
  1561. })].concat(params));
  1562. })));
  1563. };
  1564. }
  1565. var EPS = 1e-4;
  1566. var BASE_DEVICE_WIDTH = 750;
  1567. var isIOS = false;
  1568. var deviceWidth = 0;
  1569. var deviceDPR = 0;
  1570. function checkDeviceWidth() {
  1571. var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
  1572. platform = _wx$getSystemInfoSync.platform,
  1573. pixelRatio = _wx$getSystemInfoSync.pixelRatio,
  1574. windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  1575. deviceWidth = windowWidth;
  1576. deviceDPR = pixelRatio;
  1577. isIOS = platform === 'ios';
  1578. }
  1579. function upx2px(number, newDeviceWidth) {
  1580. if (deviceWidth === 0) {
  1581. checkDeviceWidth();
  1582. }
  1583. number = Number(number);
  1584. if (number === 0) {
  1585. return 0;
  1586. }
  1587. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  1588. if (result < 0) {
  1589. result = -result;
  1590. }
  1591. result = Math.floor(result + EPS);
  1592. if (result === 0) {
  1593. if (deviceDPR === 1 || !isIOS) {
  1594. result = 1;
  1595. } else {
  1596. result = 0.5;
  1597. }
  1598. }
  1599. return number < 0 ? -result : result;
  1600. }
  1601. var LOCALE_ZH_HANS = 'zh-Hans';
  1602. var LOCALE_ZH_HANT = 'zh-Hant';
  1603. var LOCALE_EN = 'en';
  1604. var LOCALE_FR = 'fr';
  1605. var LOCALE_ES = 'es';
  1606. var messages = {};
  1607. var locale;
  1608. {
  1609. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  1610. }
  1611. function initI18nMessages() {
  1612. if (!isEnableLocale()) {
  1613. return;
  1614. }
  1615. var localeKeys = Object.keys(__uniConfig.locales);
  1616. if (localeKeys.length) {
  1617. localeKeys.forEach(function (locale) {
  1618. var curMessages = messages[locale];
  1619. var userMessages = __uniConfig.locales[locale];
  1620. if (curMessages) {
  1621. Object.assign(curMessages, userMessages);
  1622. } else {
  1623. messages[locale] = userMessages;
  1624. }
  1625. });
  1626. }
  1627. }
  1628. initI18nMessages();
  1629. var i18n = (0, _uniI18n.initVueI18n)(locale, {});
  1630. var t = i18n.t;
  1631. var i18nMixin = i18n.mixin = {
  1632. beforeCreate: function beforeCreate() {
  1633. var _this = this;
  1634. var unwatch = i18n.i18n.watchLocale(function () {
  1635. _this.$forceUpdate();
  1636. });
  1637. this.$once('hook:beforeDestroy', function () {
  1638. unwatch();
  1639. });
  1640. },
  1641. methods: {
  1642. $$t: function $$t(key, values) {
  1643. return t(key, values);
  1644. }
  1645. }
  1646. };
  1647. var setLocale = i18n.setLocale;
  1648. var getLocale = i18n.getLocale;
  1649. function initAppLocale(Vue, appVm, locale) {
  1650. var state = Vue.observable({
  1651. locale: locale || i18n.getLocale()
  1652. });
  1653. var localeWatchers = [];
  1654. appVm.$watchLocale = function (fn) {
  1655. localeWatchers.push(fn);
  1656. };
  1657. Object.defineProperty(appVm, '$locale', {
  1658. get: function get() {
  1659. return state.locale;
  1660. },
  1661. set: function set(v) {
  1662. state.locale = v;
  1663. localeWatchers.forEach(function (watch) {
  1664. return watch(v);
  1665. });
  1666. }
  1667. });
  1668. }
  1669. function isEnableLocale() {
  1670. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  1671. }
  1672. function include(str, parts) {
  1673. return !!parts.find(function (part) {
  1674. return str.indexOf(part) !== -1;
  1675. });
  1676. }
  1677. function startsWith(str, parts) {
  1678. return parts.find(function (part) {
  1679. return str.indexOf(part) === 0;
  1680. });
  1681. }
  1682. function normalizeLocale(locale, messages) {
  1683. if (!locale) {
  1684. return;
  1685. }
  1686. locale = locale.trim().replace(/_/g, '-');
  1687. if (messages && messages[locale]) {
  1688. return locale;
  1689. }
  1690. locale = locale.toLowerCase();
  1691. if (locale === 'chinese') {
  1692. // 支付宝
  1693. return LOCALE_ZH_HANS;
  1694. }
  1695. if (locale.indexOf('zh') === 0) {
  1696. if (locale.indexOf('-hans') > -1) {
  1697. return LOCALE_ZH_HANS;
  1698. }
  1699. if (locale.indexOf('-hant') > -1) {
  1700. return LOCALE_ZH_HANT;
  1701. }
  1702. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  1703. return LOCALE_ZH_HANT;
  1704. }
  1705. return LOCALE_ZH_HANS;
  1706. }
  1707. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  1708. if (lang) {
  1709. return lang;
  1710. }
  1711. }
  1712. // export function initI18n() {
  1713. // const localeKeys = Object.keys(__uniConfig.locales || {})
  1714. // if (localeKeys.length) {
  1715. // localeKeys.forEach((locale) =>
  1716. // i18n.add(locale, __uniConfig.locales[locale])
  1717. // )
  1718. // }
  1719. // }
  1720. function getLocale$1() {
  1721. // 优先使用 $locale
  1722. if (isFn(getApp)) {
  1723. var app = getApp({
  1724. allowDefault: true
  1725. });
  1726. if (app && app.$vm) {
  1727. return app.$vm.$locale;
  1728. }
  1729. }
  1730. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  1731. }
  1732. function setLocale$1(locale) {
  1733. var app = isFn(getApp) ? getApp() : false;
  1734. if (!app) {
  1735. return false;
  1736. }
  1737. var oldLocale = app.$vm.$locale;
  1738. if (oldLocale !== locale) {
  1739. app.$vm.$locale = locale;
  1740. onLocaleChangeCallbacks.forEach(function (fn) {
  1741. return fn({
  1742. locale: locale
  1743. });
  1744. });
  1745. return true;
  1746. }
  1747. return false;
  1748. }
  1749. var onLocaleChangeCallbacks = [];
  1750. function onLocaleChange(fn) {
  1751. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  1752. onLocaleChangeCallbacks.push(fn);
  1753. }
  1754. }
  1755. if (typeof global !== 'undefined') {
  1756. global.getLocale = getLocale$1;
  1757. }
  1758. var interceptors = {
  1759. promiseInterceptor: promiseInterceptor
  1760. };
  1761. var baseApi = /*#__PURE__*/Object.freeze({
  1762. __proto__: null,
  1763. upx2px: upx2px,
  1764. getLocale: getLocale$1,
  1765. setLocale: setLocale$1,
  1766. onLocaleChange: onLocaleChange,
  1767. addInterceptor: addInterceptor,
  1768. removeInterceptor: removeInterceptor,
  1769. interceptors: interceptors
  1770. });
  1771. function findExistsPageIndex(url) {
  1772. var pages = getCurrentPages();
  1773. var len = pages.length;
  1774. while (len--) {
  1775. var page = pages[len];
  1776. if (page.$page && page.$page.fullPath === url) {
  1777. return len;
  1778. }
  1779. }
  1780. return -1;
  1781. }
  1782. var redirectTo = {
  1783. name: function name(fromArgs) {
  1784. if (fromArgs.exists === 'back' && fromArgs.delta) {
  1785. return 'navigateBack';
  1786. }
  1787. return 'redirectTo';
  1788. },
  1789. args: function args(fromArgs) {
  1790. if (fromArgs.exists === 'back' && fromArgs.url) {
  1791. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  1792. if (existsPageIndex !== -1) {
  1793. var delta = getCurrentPages().length - 1 - existsPageIndex;
  1794. if (delta > 0) {
  1795. fromArgs.delta = delta;
  1796. }
  1797. }
  1798. }
  1799. }
  1800. };
  1801. var previewImage = {
  1802. args: function args(fromArgs) {
  1803. var currentIndex = parseInt(fromArgs.current);
  1804. if (isNaN(currentIndex)) {
  1805. return;
  1806. }
  1807. var urls = fromArgs.urls;
  1808. if (!Array.isArray(urls)) {
  1809. return;
  1810. }
  1811. var len = urls.length;
  1812. if (!len) {
  1813. return;
  1814. }
  1815. if (currentIndex < 0) {
  1816. currentIndex = 0;
  1817. } else if (currentIndex >= len) {
  1818. currentIndex = len - 1;
  1819. }
  1820. if (currentIndex > 0) {
  1821. fromArgs.current = urls[currentIndex];
  1822. fromArgs.urls = urls.filter(function (item, index) {
  1823. return index < currentIndex ? item !== urls[currentIndex] : true;
  1824. });
  1825. } else {
  1826. fromArgs.current = urls[0];
  1827. }
  1828. return {
  1829. indicator: false,
  1830. loop: false
  1831. };
  1832. }
  1833. };
  1834. var UUID_KEY = '__DC_STAT_UUID';
  1835. var deviceId;
  1836. function useDeviceId(result) {
  1837. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  1838. if (!deviceId) {
  1839. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  1840. wx.setStorage({
  1841. key: UUID_KEY,
  1842. data: deviceId
  1843. });
  1844. }
  1845. result.deviceId = deviceId;
  1846. }
  1847. function addSafeAreaInsets(result) {
  1848. if (result.safeArea) {
  1849. var safeArea = result.safeArea;
  1850. result.safeAreaInsets = {
  1851. top: safeArea.top,
  1852. left: safeArea.left,
  1853. right: result.windowWidth - safeArea.right,
  1854. bottom: result.screenHeight - safeArea.bottom
  1855. };
  1856. }
  1857. }
  1858. function populateParameters(result) {
  1859. var _result$brand = result.brand,
  1860. brand = _result$brand === void 0 ? '' : _result$brand,
  1861. _result$model = result.model,
  1862. model = _result$model === void 0 ? '' : _result$model,
  1863. _result$system = result.system,
  1864. system = _result$system === void 0 ? '' : _result$system,
  1865. _result$language = result.language,
  1866. language = _result$language === void 0 ? '' : _result$language,
  1867. theme = result.theme,
  1868. version = result.version,
  1869. platform = result.platform,
  1870. fontSizeSetting = result.fontSizeSetting,
  1871. SDKVersion = result.SDKVersion,
  1872. pixelRatio = result.pixelRatio,
  1873. deviceOrientation = result.deviceOrientation;
  1874. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  1875. var extraParam = {};
  1876. // osName osVersion
  1877. var osName = '';
  1878. var osVersion = '';
  1879. {
  1880. osName = system.split(' ')[0] || '';
  1881. osVersion = system.split(' ')[1] || '';
  1882. }
  1883. var hostVersion = version;
  1884. // deviceType
  1885. var deviceType = getGetDeviceType(result, model);
  1886. // deviceModel
  1887. var deviceBrand = getDeviceBrand(brand);
  1888. // hostName
  1889. var _hostName = getHostName(result);
  1890. // deviceOrientation
  1891. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  1892. // devicePixelRatio
  1893. var _devicePixelRatio = pixelRatio;
  1894. // SDKVersion
  1895. var _SDKVersion = SDKVersion;
  1896. // hostLanguage
  1897. var hostLanguage = language.replace(/_/g, '-');
  1898. // wx.getAccountInfoSync
  1899. var parameters = {
  1900. appId: "__UNI__1C40FB4",
  1901. appName: "房票科技",
  1902. appVersion: "1.0.0",
  1903. appVersionCode: "100",
  1904. appLanguage: getAppLanguage(hostLanguage),
  1905. uniCompileVersion: "3.8.12",
  1906. uniRuntimeVersion: "3.8.12",
  1907. uniPlatform: undefined || "mp-weixin",
  1908. deviceBrand: deviceBrand,
  1909. deviceModel: model,
  1910. deviceType: deviceType,
  1911. devicePixelRatio: _devicePixelRatio,
  1912. deviceOrientation: _deviceOrientation,
  1913. osName: osName.toLocaleLowerCase(),
  1914. osVersion: osVersion,
  1915. hostTheme: theme,
  1916. hostVersion: hostVersion,
  1917. hostLanguage: hostLanguage,
  1918. hostName: _hostName,
  1919. hostSDKVersion: _SDKVersion,
  1920. hostFontSizeSetting: fontSizeSetting,
  1921. windowTop: 0,
  1922. windowBottom: 0,
  1923. // TODO
  1924. osLanguage: undefined,
  1925. osTheme: undefined,
  1926. ua: undefined,
  1927. hostPackageName: undefined,
  1928. browserName: undefined,
  1929. browserVersion: undefined
  1930. };
  1931. Object.assign(result, parameters, extraParam);
  1932. }
  1933. function getGetDeviceType(result, model) {
  1934. var deviceType = result.deviceType || 'phone';
  1935. {
  1936. var deviceTypeMaps = {
  1937. ipad: 'pad',
  1938. windows: 'pc',
  1939. mac: 'pc'
  1940. };
  1941. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  1942. var _model = model.toLocaleLowerCase();
  1943. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  1944. var _m = deviceTypeMapsKeys[index];
  1945. if (_model.indexOf(_m) !== -1) {
  1946. deviceType = deviceTypeMaps[_m];
  1947. break;
  1948. }
  1949. }
  1950. }
  1951. return deviceType;
  1952. }
  1953. function getDeviceBrand(brand) {
  1954. var deviceBrand = brand;
  1955. if (deviceBrand) {
  1956. deviceBrand = brand.toLocaleLowerCase();
  1957. }
  1958. return deviceBrand;
  1959. }
  1960. function getAppLanguage(defaultLanguage) {
  1961. return getLocale$1 ? getLocale$1() : defaultLanguage;
  1962. }
  1963. function getHostName(result) {
  1964. var _platform = 'WeChat';
  1965. var _hostName = result.hostName || _platform; // mp-jd
  1966. {
  1967. if (result.environment) {
  1968. _hostName = result.environment;
  1969. } else if (result.host && result.host.env) {
  1970. _hostName = result.host.env;
  1971. }
  1972. }
  1973. return _hostName;
  1974. }
  1975. var getSystemInfo = {
  1976. returnValue: function returnValue(result) {
  1977. useDeviceId(result);
  1978. addSafeAreaInsets(result);
  1979. populateParameters(result);
  1980. }
  1981. };
  1982. var showActionSheet = {
  1983. args: function args(fromArgs) {
  1984. if ((0, _typeof2.default)(fromArgs) === 'object') {
  1985. fromArgs.alertText = fromArgs.title;
  1986. }
  1987. }
  1988. };
  1989. var getAppBaseInfo = {
  1990. returnValue: function returnValue(result) {
  1991. var _result = result,
  1992. version = _result.version,
  1993. language = _result.language,
  1994. SDKVersion = _result.SDKVersion,
  1995. theme = _result.theme;
  1996. var _hostName = getHostName(result);
  1997. var hostLanguage = language.replace('_', '-');
  1998. result = sortObject(Object.assign(result, {
  1999. appId: "__UNI__1C40FB4",
  2000. appName: "房票科技",
  2001. appVersion: "1.0.0",
  2002. appVersionCode: "100",
  2003. appLanguage: getAppLanguage(hostLanguage),
  2004. hostVersion: version,
  2005. hostLanguage: hostLanguage,
  2006. hostName: _hostName,
  2007. hostSDKVersion: SDKVersion,
  2008. hostTheme: theme
  2009. }));
  2010. }
  2011. };
  2012. var getDeviceInfo = {
  2013. returnValue: function returnValue(result) {
  2014. var _result2 = result,
  2015. brand = _result2.brand,
  2016. model = _result2.model;
  2017. var deviceType = getGetDeviceType(result, model);
  2018. var deviceBrand = getDeviceBrand(brand);
  2019. useDeviceId(result);
  2020. result = sortObject(Object.assign(result, {
  2021. deviceType: deviceType,
  2022. deviceBrand: deviceBrand,
  2023. deviceModel: model
  2024. }));
  2025. }
  2026. };
  2027. var getWindowInfo = {
  2028. returnValue: function returnValue(result) {
  2029. addSafeAreaInsets(result);
  2030. result = sortObject(Object.assign(result, {
  2031. windowTop: 0,
  2032. windowBottom: 0
  2033. }));
  2034. }
  2035. };
  2036. var getAppAuthorizeSetting = {
  2037. returnValue: function returnValue(result) {
  2038. var locationReducedAccuracy = result.locationReducedAccuracy;
  2039. result.locationAccuracy = 'unsupported';
  2040. if (locationReducedAccuracy === true) {
  2041. result.locationAccuracy = 'reduced';
  2042. } else if (locationReducedAccuracy === false) {
  2043. result.locationAccuracy = 'full';
  2044. }
  2045. }
  2046. };
  2047. // import navigateTo from 'uni-helpers/navigate-to'
  2048. var compressImage = {
  2049. args: function args(fromArgs) {
  2050. // https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
  2051. if (fromArgs.compressedHeight && !fromArgs.compressHeight) {
  2052. fromArgs.compressHeight = fromArgs.compressedHeight;
  2053. }
  2054. if (fromArgs.compressedWidth && !fromArgs.compressWidth) {
  2055. fromArgs.compressWidth = fromArgs.compressedWidth;
  2056. }
  2057. }
  2058. };
  2059. var protocols = {
  2060. redirectTo: redirectTo,
  2061. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  2062. previewImage: previewImage,
  2063. getSystemInfo: getSystemInfo,
  2064. getSystemInfoSync: getSystemInfo,
  2065. showActionSheet: showActionSheet,
  2066. getAppBaseInfo: getAppBaseInfo,
  2067. getDeviceInfo: getDeviceInfo,
  2068. getWindowInfo: getWindowInfo,
  2069. getAppAuthorizeSetting: getAppAuthorizeSetting,
  2070. compressImage: compressImage
  2071. };
  2072. var todos = ['vibrate', 'preloadPage', 'unPreloadPage', 'loadSubPackage'];
  2073. var canIUses = [];
  2074. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  2075. function processCallback(methodName, method, returnValue) {
  2076. return function (res) {
  2077. return method(processReturnValue(methodName, res, returnValue));
  2078. };
  2079. }
  2080. function processArgs(methodName, fromArgs) {
  2081. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2082. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  2083. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  2084. if (isPlainObject(fromArgs)) {
  2085. // 一般 api 的参数解析
  2086. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  2087. if (isFn(argsOption)) {
  2088. argsOption = argsOption(fromArgs, toArgs) || {};
  2089. }
  2090. for (var key in fromArgs) {
  2091. if (hasOwn(argsOption, key)) {
  2092. var keyOption = argsOption[key];
  2093. if (isFn(keyOption)) {
  2094. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  2095. }
  2096. if (!keyOption) {
  2097. // 不支持的参数
  2098. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  2099. } else if (isStr(keyOption)) {
  2100. // 重写参数 key
  2101. toArgs[keyOption] = fromArgs[key];
  2102. } else if (isPlainObject(keyOption)) {
  2103. // {name:newName,value:value}可重新指定参数 key:value
  2104. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  2105. }
  2106. } else if (CALLBACKS.indexOf(key) !== -1) {
  2107. if (isFn(fromArgs[key])) {
  2108. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  2109. }
  2110. } else {
  2111. if (!keepFromArgs) {
  2112. toArgs[key] = fromArgs[key];
  2113. }
  2114. }
  2115. }
  2116. return toArgs;
  2117. } else if (isFn(fromArgs)) {
  2118. fromArgs = processCallback(methodName, fromArgs, returnValue);
  2119. }
  2120. return fromArgs;
  2121. }
  2122. function processReturnValue(methodName, res, returnValue) {
  2123. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  2124. if (isFn(protocols.returnValue)) {
  2125. // 处理通用 returnValue
  2126. res = protocols.returnValue(methodName, res);
  2127. }
  2128. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  2129. }
  2130. function wrapper(methodName, method) {
  2131. if (hasOwn(protocols, methodName)) {
  2132. var protocol = protocols[methodName];
  2133. if (!protocol) {
  2134. // 暂不支持的 api
  2135. return function () {
  2136. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  2137. };
  2138. }
  2139. return function (arg1, arg2) {
  2140. // 目前 api 最多两个参数
  2141. var options = protocol;
  2142. if (isFn(protocol)) {
  2143. options = protocol(arg1);
  2144. }
  2145. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  2146. var args = [arg1];
  2147. if (typeof arg2 !== 'undefined') {
  2148. args.push(arg2);
  2149. }
  2150. if (isFn(options.name)) {
  2151. methodName = options.name(arg1);
  2152. } else if (isStr(options.name)) {
  2153. methodName = options.name;
  2154. }
  2155. var returnValue = wx[methodName].apply(wx, args);
  2156. if (isSyncApi(methodName)) {
  2157. // 同步 api
  2158. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  2159. }
  2160. return returnValue;
  2161. };
  2162. }
  2163. return method;
  2164. }
  2165. var todoApis = Object.create(null);
  2166. var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
  2167. function createTodoApi(name) {
  2168. return function todoApi(_ref) {
  2169. var fail = _ref.fail,
  2170. complete = _ref.complete;
  2171. var res = {
  2172. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  2173. };
  2174. isFn(fail) && fail(res);
  2175. isFn(complete) && complete(res);
  2176. };
  2177. }
  2178. TODOS.forEach(function (name) {
  2179. todoApis[name] = createTodoApi(name);
  2180. });
  2181. var providers = {
  2182. oauth: ['weixin'],
  2183. share: ['weixin'],
  2184. payment: ['wxpay'],
  2185. push: ['weixin']
  2186. };
  2187. function getProvider(_ref2) {
  2188. var service = _ref2.service,
  2189. success = _ref2.success,
  2190. fail = _ref2.fail,
  2191. complete = _ref2.complete;
  2192. var res = false;
  2193. if (providers[service]) {
  2194. res = {
  2195. errMsg: 'getProvider:ok',
  2196. service: service,
  2197. provider: providers[service]
  2198. };
  2199. isFn(success) && success(res);
  2200. } else {
  2201. res = {
  2202. errMsg: 'getProvider:fail service not found'
  2203. };
  2204. isFn(fail) && fail(res);
  2205. }
  2206. isFn(complete) && complete(res);
  2207. }
  2208. var extraApi = /*#__PURE__*/Object.freeze({
  2209. __proto__: null,
  2210. getProvider: getProvider
  2211. });
  2212. var getEmitter = function () {
  2213. var Emitter;
  2214. return function getUniEmitter() {
  2215. if (!Emitter) {
  2216. Emitter = new _vue.default();
  2217. }
  2218. return Emitter;
  2219. };
  2220. }();
  2221. function apply(ctx, method, args) {
  2222. return ctx[method].apply(ctx, args);
  2223. }
  2224. function $on() {
  2225. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  2226. }
  2227. function $off() {
  2228. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  2229. }
  2230. function $once() {
  2231. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  2232. }
  2233. function $emit() {
  2234. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  2235. }
  2236. var eventApi = /*#__PURE__*/Object.freeze({
  2237. __proto__: null,
  2238. $on: $on,
  2239. $off: $off,
  2240. $once: $once,
  2241. $emit: $emit
  2242. });
  2243. /**
  2244. * 框架内 try-catch
  2245. */
  2246. /**
  2247. * 开发者 try-catch
  2248. */
  2249. function tryCatch(fn) {
  2250. return function () {
  2251. try {
  2252. return fn.apply(fn, arguments);
  2253. } catch (e) {
  2254. // TODO
  2255. console.error(e);
  2256. }
  2257. };
  2258. }
  2259. function getApiCallbacks(params) {
  2260. var apiCallbacks = {};
  2261. for (var name in params) {
  2262. var param = params[name];
  2263. if (isFn(param)) {
  2264. apiCallbacks[name] = tryCatch(param);
  2265. delete params[name];
  2266. }
  2267. }
  2268. return apiCallbacks;
  2269. }
  2270. var cid;
  2271. var cidErrMsg;
  2272. var enabled;
  2273. function normalizePushMessage(message) {
  2274. try {
  2275. return JSON.parse(message);
  2276. } catch (e) {}
  2277. return message;
  2278. }
  2279. function invokePushCallback(args) {
  2280. if (args.type === 'enabled') {
  2281. enabled = true;
  2282. } else if (args.type === 'clientId') {
  2283. cid = args.cid;
  2284. cidErrMsg = args.errMsg;
  2285. invokeGetPushCidCallbacks(cid, args.errMsg);
  2286. } else if (args.type === 'pushMsg') {
  2287. var message = {
  2288. type: 'receive',
  2289. data: normalizePushMessage(args.message)
  2290. };
  2291. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  2292. var callback = onPushMessageCallbacks[i];
  2293. callback(message);
  2294. // 该消息已被阻止
  2295. if (message.stopped) {
  2296. break;
  2297. }
  2298. }
  2299. } else if (args.type === 'click') {
  2300. onPushMessageCallbacks.forEach(function (callback) {
  2301. callback({
  2302. type: 'click',
  2303. data: normalizePushMessage(args.message)
  2304. });
  2305. });
  2306. }
  2307. }
  2308. var getPushCidCallbacks = [];
  2309. function invokeGetPushCidCallbacks(cid, errMsg) {
  2310. getPushCidCallbacks.forEach(function (callback) {
  2311. callback(cid, errMsg);
  2312. });
  2313. getPushCidCallbacks.length = 0;
  2314. }
  2315. function getPushClientId(args) {
  2316. if (!isPlainObject(args)) {
  2317. args = {};
  2318. }
  2319. var _getApiCallbacks = getApiCallbacks(args),
  2320. success = _getApiCallbacks.success,
  2321. fail = _getApiCallbacks.fail,
  2322. complete = _getApiCallbacks.complete;
  2323. var hasSuccess = isFn(success);
  2324. var hasFail = isFn(fail);
  2325. var hasComplete = isFn(complete);
  2326. Promise.resolve().then(function () {
  2327. if (typeof enabled === 'undefined') {
  2328. enabled = false;
  2329. cid = '';
  2330. cidErrMsg = 'uniPush is not enabled';
  2331. }
  2332. getPushCidCallbacks.push(function (cid, errMsg) {
  2333. var res;
  2334. if (cid) {
  2335. res = {
  2336. errMsg: 'getPushClientId:ok',
  2337. cid: cid
  2338. };
  2339. hasSuccess && success(res);
  2340. } else {
  2341. res = {
  2342. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  2343. };
  2344. hasFail && fail(res);
  2345. }
  2346. hasComplete && complete(res);
  2347. });
  2348. if (typeof cid !== 'undefined') {
  2349. invokeGetPushCidCallbacks(cid, cidErrMsg);
  2350. }
  2351. });
  2352. }
  2353. var onPushMessageCallbacks = [];
  2354. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  2355. var onPushMessage = function onPushMessage(fn) {
  2356. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  2357. onPushMessageCallbacks.push(fn);
  2358. }
  2359. };
  2360. var offPushMessage = function offPushMessage(fn) {
  2361. if (!fn) {
  2362. onPushMessageCallbacks.length = 0;
  2363. } else {
  2364. var index = onPushMessageCallbacks.indexOf(fn);
  2365. if (index > -1) {
  2366. onPushMessageCallbacks.splice(index, 1);
  2367. }
  2368. }
  2369. };
  2370. var baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo();
  2371. if (!baseInfo) {
  2372. baseInfo = wx.getSystemInfoSync();
  2373. }
  2374. var host = baseInfo ? baseInfo.host : null;
  2375. var shareVideoMessage = host && host.env === 'SAAASDK' ? wx.miniapp.shareVideoMessage : wx.shareVideoMessage;
  2376. var api = /*#__PURE__*/Object.freeze({
  2377. __proto__: null,
  2378. shareVideoMessage: shareVideoMessage,
  2379. getPushClientId: getPushClientId,
  2380. onPushMessage: onPushMessage,
  2381. offPushMessage: offPushMessage,
  2382. invokePushCallback: invokePushCallback
  2383. });
  2384. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  2385. function findVmByVueId(vm, vuePid) {
  2386. var $children = vm.$children;
  2387. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  2388. for (var i = $children.length - 1; i >= 0; i--) {
  2389. var childVm = $children[i];
  2390. if (childVm.$scope._$vueId === vuePid) {
  2391. return childVm;
  2392. }
  2393. }
  2394. // 反向递归查找
  2395. var parentVm;
  2396. for (var _i = $children.length - 1; _i >= 0; _i--) {
  2397. parentVm = findVmByVueId($children[_i], vuePid);
  2398. if (parentVm) {
  2399. return parentVm;
  2400. }
  2401. }
  2402. }
  2403. function initBehavior(options) {
  2404. return Behavior(options);
  2405. }
  2406. function isPage() {
  2407. return !!this.route;
  2408. }
  2409. function initRelation(detail) {
  2410. this.triggerEvent('__l', detail);
  2411. }
  2412. function selectAllComponents(mpInstance, selector, $refs) {
  2413. var components = mpInstance.selectAllComponents(selector) || [];
  2414. components.forEach(function (component) {
  2415. var ref = component.dataset.ref;
  2416. $refs[ref] = component.$vm || toSkip(component);
  2417. {
  2418. if (component.dataset.vueGeneric === 'scoped') {
  2419. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  2420. selectAllComponents(scopedComponent, selector, $refs);
  2421. });
  2422. }
  2423. }
  2424. });
  2425. }
  2426. function syncRefs(refs, newRefs) {
  2427. var oldKeys = (0, _construct2.default)(Set, (0, _toConsumableArray2.default)(Object.keys(refs)));
  2428. var newKeys = Object.keys(newRefs);
  2429. newKeys.forEach(function (key) {
  2430. var oldValue = refs[key];
  2431. var newValue = newRefs[key];
  2432. if (Array.isArray(oldValue) && Array.isArray(newValue) && oldValue.length === newValue.length && newValue.every(function (value) {
  2433. return oldValue.includes(value);
  2434. })) {
  2435. return;
  2436. }
  2437. refs[key] = newValue;
  2438. oldKeys.delete(key);
  2439. });
  2440. oldKeys.forEach(function (key) {
  2441. delete refs[key];
  2442. });
  2443. return refs;
  2444. }
  2445. function initRefs(vm) {
  2446. var mpInstance = vm.$scope;
  2447. var refs = {};
  2448. Object.defineProperty(vm, '$refs', {
  2449. get: function get() {
  2450. var $refs = {};
  2451. selectAllComponents(mpInstance, '.vue-ref', $refs);
  2452. // TODO 暂不考虑 for 中的 scoped
  2453. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for') || [];
  2454. forComponents.forEach(function (component) {
  2455. var ref = component.dataset.ref;
  2456. if (!$refs[ref]) {
  2457. $refs[ref] = [];
  2458. }
  2459. $refs[ref].push(component.$vm || toSkip(component));
  2460. });
  2461. return syncRefs(refs, $refs);
  2462. }
  2463. });
  2464. }
  2465. function handleLink(event) {
  2466. var _ref3 = event.detail || event.value,
  2467. vuePid = _ref3.vuePid,
  2468. vueOptions = _ref3.vueOptions; // detail 是微信,value 是百度(dipatch)
  2469. var parentVm;
  2470. if (vuePid) {
  2471. parentVm = findVmByVueId(this.$vm, vuePid);
  2472. }
  2473. if (!parentVm) {
  2474. parentVm = this.$vm;
  2475. }
  2476. vueOptions.parent = parentVm;
  2477. }
  2478. function markMPComponent(component) {
  2479. // 在 Vue 中标记为小程序组件
  2480. var IS_MP = '__v_isMPComponent';
  2481. Object.defineProperty(component, IS_MP, {
  2482. configurable: true,
  2483. enumerable: false,
  2484. value: true
  2485. });
  2486. return component;
  2487. }
  2488. function toSkip(obj) {
  2489. var OB = '__ob__';
  2490. var SKIP = '__v_skip';
  2491. if (isObject(obj) && Object.isExtensible(obj)) {
  2492. // 避免被 @vue/composition-api 观测
  2493. Object.defineProperty(obj, OB, {
  2494. configurable: true,
  2495. enumerable: false,
  2496. value: (0, _defineProperty2.default)({}, SKIP, true)
  2497. });
  2498. }
  2499. return obj;
  2500. }
  2501. var WORKLET_RE = /_(.*)_worklet_factory_/;
  2502. function initWorkletMethods(mpMethods, vueMethods) {
  2503. if (vueMethods) {
  2504. Object.keys(vueMethods).forEach(function (name) {
  2505. var matches = name.match(WORKLET_RE);
  2506. if (matches) {
  2507. var workletName = matches[1];
  2508. mpMethods[name] = vueMethods[name];
  2509. mpMethods[workletName] = vueMethods[workletName];
  2510. }
  2511. });
  2512. }
  2513. }
  2514. var MPPage = Page;
  2515. var MPComponent = Component;
  2516. var customizeRE = /:/g;
  2517. var customize = cached(function (str) {
  2518. return camelize(str.replace(customizeRE, '-'));
  2519. });
  2520. function initTriggerEvent(mpInstance) {
  2521. var oldTriggerEvent = mpInstance.triggerEvent;
  2522. var newTriggerEvent = function newTriggerEvent(event) {
  2523. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  2524. args[_key3 - 1] = arguments[_key3];
  2525. }
  2526. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  2527. if (this.$vm || this.dataset && this.dataset.comType) {
  2528. event = customize(event);
  2529. } else {
  2530. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  2531. var newEvent = customize(event);
  2532. if (newEvent !== event) {
  2533. oldTriggerEvent.apply(this, [newEvent].concat(args));
  2534. }
  2535. }
  2536. return oldTriggerEvent.apply(this, [event].concat(args));
  2537. };
  2538. try {
  2539. // 京东小程序 triggerEvent 为只读
  2540. mpInstance.triggerEvent = newTriggerEvent;
  2541. } catch (error) {
  2542. mpInstance._triggerEvent = newTriggerEvent;
  2543. }
  2544. }
  2545. function initHook(name, options, isComponent) {
  2546. var oldHook = options[name];
  2547. options[name] = function () {
  2548. markMPComponent(this);
  2549. initTriggerEvent(this);
  2550. if (oldHook) {
  2551. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  2552. args[_key4] = arguments[_key4];
  2553. }
  2554. return oldHook.apply(this, args);
  2555. }
  2556. };
  2557. }
  2558. if (!MPPage.__$wrappered) {
  2559. MPPage.__$wrappered = true;
  2560. Page = function Page() {
  2561. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2562. initHook('onLoad', options);
  2563. return MPPage(options);
  2564. };
  2565. Page.after = MPPage.after;
  2566. Component = function Component() {
  2567. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2568. initHook('created', options);
  2569. return MPComponent(options);
  2570. };
  2571. }
  2572. var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
  2573. function initMocks(vm, mocks) {
  2574. var mpInstance = vm.$mp[vm.mpType];
  2575. mocks.forEach(function (mock) {
  2576. if (hasOwn(mpInstance, mock)) {
  2577. vm[mock] = mpInstance[mock];
  2578. }
  2579. });
  2580. }
  2581. function hasHook(hook, vueOptions) {
  2582. if (!vueOptions) {
  2583. return true;
  2584. }
  2585. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  2586. return true;
  2587. }
  2588. vueOptions = vueOptions.default || vueOptions;
  2589. if (isFn(vueOptions)) {
  2590. if (isFn(vueOptions.extendOptions[hook])) {
  2591. return true;
  2592. }
  2593. if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
  2594. return true;
  2595. }
  2596. return false;
  2597. }
  2598. if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
  2599. return true;
  2600. }
  2601. var mixins = vueOptions.mixins;
  2602. if (Array.isArray(mixins)) {
  2603. return !!mixins.find(function (mixin) {
  2604. return hasHook(hook, mixin);
  2605. });
  2606. }
  2607. }
  2608. function initHooks(mpOptions, hooks, vueOptions) {
  2609. hooks.forEach(function (hook) {
  2610. if (hasHook(hook, vueOptions)) {
  2611. mpOptions[hook] = function (args) {
  2612. return this.$vm && this.$vm.__call_hook(hook, args);
  2613. };
  2614. }
  2615. });
  2616. }
  2617. function initUnknownHooks(mpOptions, vueOptions) {
  2618. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  2619. findHooks(vueOptions).forEach(function (hook) {
  2620. return initHook$1(mpOptions, hook, excludes);
  2621. });
  2622. }
  2623. function findHooks(vueOptions) {
  2624. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2625. if (vueOptions) {
  2626. Object.keys(vueOptions).forEach(function (name) {
  2627. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  2628. hooks.push(name);
  2629. }
  2630. });
  2631. }
  2632. return hooks;
  2633. }
  2634. function initHook$1(mpOptions, hook, excludes) {
  2635. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  2636. mpOptions[hook] = function (args) {
  2637. return this.$vm && this.$vm.__call_hook(hook, args);
  2638. };
  2639. }
  2640. }
  2641. function initVueComponent(Vue, vueOptions) {
  2642. vueOptions = vueOptions.default || vueOptions;
  2643. var VueComponent;
  2644. if (isFn(vueOptions)) {
  2645. VueComponent = vueOptions;
  2646. } else {
  2647. VueComponent = Vue.extend(vueOptions);
  2648. }
  2649. vueOptions = VueComponent.options;
  2650. return [VueComponent, vueOptions];
  2651. }
  2652. function initSlots(vm, vueSlots) {
  2653. if (Array.isArray(vueSlots) && vueSlots.length) {
  2654. var $slots = Object.create(null);
  2655. vueSlots.forEach(function (slotName) {
  2656. $slots[slotName] = true;
  2657. });
  2658. vm.$scopedSlots = vm.$slots = $slots;
  2659. }
  2660. }
  2661. function initVueIds(vueIds, mpInstance) {
  2662. vueIds = (vueIds || '').split(',');
  2663. var len = vueIds.length;
  2664. if (len === 1) {
  2665. mpInstance._$vueId = vueIds[0];
  2666. } else if (len === 2) {
  2667. mpInstance._$vueId = vueIds[0];
  2668. mpInstance._$vuePid = vueIds[1];
  2669. }
  2670. }
  2671. function initData(vueOptions, context) {
  2672. var data = vueOptions.data || {};
  2673. var methods = vueOptions.methods || {};
  2674. if (typeof data === 'function') {
  2675. try {
  2676. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  2677. } catch (e) {
  2678. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  2679. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  2680. }
  2681. }
  2682. } else {
  2683. try {
  2684. // 对 data 格式化
  2685. data = JSON.parse(JSON.stringify(data));
  2686. } catch (e) {}
  2687. }
  2688. if (!isPlainObject(data)) {
  2689. data = {};
  2690. }
  2691. Object.keys(methods).forEach(function (methodName) {
  2692. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  2693. data[methodName] = methods[methodName];
  2694. }
  2695. });
  2696. return data;
  2697. }
  2698. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  2699. function createObserver(name) {
  2700. return function observer(newVal, oldVal) {
  2701. if (this.$vm) {
  2702. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  2703. }
  2704. };
  2705. }
  2706. function initBehaviors(vueOptions, initBehavior) {
  2707. var vueBehaviors = vueOptions.behaviors;
  2708. var vueExtends = vueOptions.extends;
  2709. var vueMixins = vueOptions.mixins;
  2710. var vueProps = vueOptions.props;
  2711. if (!vueProps) {
  2712. vueOptions.props = vueProps = [];
  2713. }
  2714. var behaviors = [];
  2715. if (Array.isArray(vueBehaviors)) {
  2716. vueBehaviors.forEach(function (behavior) {
  2717. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  2718. if (behavior === 'uni://form-field') {
  2719. if (Array.isArray(vueProps)) {
  2720. vueProps.push('name');
  2721. vueProps.push('value');
  2722. } else {
  2723. vueProps.name = {
  2724. type: String,
  2725. default: ''
  2726. };
  2727. vueProps.value = {
  2728. type: [String, Number, Boolean, Array, Object, Date],
  2729. default: ''
  2730. };
  2731. }
  2732. }
  2733. });
  2734. }
  2735. if (isPlainObject(vueExtends) && vueExtends.props) {
  2736. behaviors.push(initBehavior({
  2737. properties: initProperties(vueExtends.props, true)
  2738. }));
  2739. }
  2740. if (Array.isArray(vueMixins)) {
  2741. vueMixins.forEach(function (vueMixin) {
  2742. if (isPlainObject(vueMixin) && vueMixin.props) {
  2743. behaviors.push(initBehavior({
  2744. properties: initProperties(vueMixin.props, true)
  2745. }));
  2746. }
  2747. });
  2748. }
  2749. return behaviors;
  2750. }
  2751. function parsePropType(key, type, defaultValue, file) {
  2752. // [String]=>String
  2753. if (Array.isArray(type) && type.length === 1) {
  2754. return type[0];
  2755. }
  2756. return type;
  2757. }
  2758. function initProperties(props) {
  2759. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2760. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  2761. var options = arguments.length > 3 ? arguments[3] : undefined;
  2762. var properties = {};
  2763. if (!isBehavior) {
  2764. properties.vueId = {
  2765. type: String,
  2766. value: ''
  2767. };
  2768. {
  2769. if (options.virtualHost) {
  2770. properties.virtualHostStyle = {
  2771. type: null,
  2772. value: ''
  2773. };
  2774. properties.virtualHostClass = {
  2775. type: null,
  2776. value: ''
  2777. };
  2778. }
  2779. }
  2780. // scopedSlotsCompiler auto
  2781. properties.scopedSlotsCompiler = {
  2782. type: String,
  2783. value: ''
  2784. };
  2785. properties.vueSlots = {
  2786. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  2787. type: null,
  2788. value: [],
  2789. observer: function observer(newVal, oldVal) {
  2790. var $slots = Object.create(null);
  2791. newVal.forEach(function (slotName) {
  2792. $slots[slotName] = true;
  2793. });
  2794. this.setData({
  2795. $slots: $slots
  2796. });
  2797. }
  2798. };
  2799. }
  2800. if (Array.isArray(props)) {
  2801. // ['title']
  2802. props.forEach(function (key) {
  2803. properties[key] = {
  2804. type: null,
  2805. observer: createObserver(key)
  2806. };
  2807. });
  2808. } else if (isPlainObject(props)) {
  2809. // {title:{type:String,default:''},content:String}
  2810. Object.keys(props).forEach(function (key) {
  2811. var opts = props[key];
  2812. if (isPlainObject(opts)) {
  2813. // title:{type:String,default:''}
  2814. var value = opts.default;
  2815. if (isFn(value)) {
  2816. value = value();
  2817. }
  2818. opts.type = parsePropType(key, opts.type);
  2819. properties[key] = {
  2820. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  2821. value: value,
  2822. observer: createObserver(key)
  2823. };
  2824. } else {
  2825. // content:String
  2826. var type = parsePropType(key, opts);
  2827. properties[key] = {
  2828. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  2829. observer: createObserver(key)
  2830. };
  2831. }
  2832. });
  2833. }
  2834. return properties;
  2835. }
  2836. function wrapper$1(event) {
  2837. // TODO 又得兼容 mpvue 的 mp 对象
  2838. try {
  2839. event.mp = JSON.parse(JSON.stringify(event));
  2840. } catch (e) {}
  2841. event.stopPropagation = noop;
  2842. event.preventDefault = noop;
  2843. event.target = event.target || {};
  2844. if (!hasOwn(event, 'detail')) {
  2845. event.detail = {};
  2846. }
  2847. if (hasOwn(event, 'markerId')) {
  2848. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  2849. event.detail.markerId = event.markerId;
  2850. }
  2851. if (isPlainObject(event.detail)) {
  2852. event.target = Object.assign({}, event.target, event.detail);
  2853. }
  2854. return event;
  2855. }
  2856. function getExtraValue(vm, dataPathsArray) {
  2857. var context = vm;
  2858. dataPathsArray.forEach(function (dataPathArray) {
  2859. var dataPath = dataPathArray[0];
  2860. var value = dataPathArray[2];
  2861. if (dataPath || typeof value !== 'undefined') {
  2862. // ['','',index,'disable']
  2863. var propPath = dataPathArray[1];
  2864. var valuePath = dataPathArray[3];
  2865. var vFor;
  2866. if (Number.isInteger(dataPath)) {
  2867. vFor = dataPath;
  2868. } else if (!dataPath) {
  2869. vFor = context;
  2870. } else if (typeof dataPath === 'string' && dataPath) {
  2871. if (dataPath.indexOf('#s#') === 0) {
  2872. vFor = dataPath.substr(3);
  2873. } else {
  2874. vFor = vm.__get_value(dataPath, context);
  2875. }
  2876. }
  2877. if (Number.isInteger(vFor)) {
  2878. context = value;
  2879. } else if (!propPath) {
  2880. context = vFor[value];
  2881. } else {
  2882. if (Array.isArray(vFor)) {
  2883. context = vFor.find(function (vForItem) {
  2884. return vm.__get_value(propPath, vForItem) === value;
  2885. });
  2886. } else if (isPlainObject(vFor)) {
  2887. context = Object.keys(vFor).find(function (vForKey) {
  2888. return vm.__get_value(propPath, vFor[vForKey]) === value;
  2889. });
  2890. } else {
  2891. console.error('v-for 暂不支持循环数据:', vFor);
  2892. }
  2893. }
  2894. if (valuePath) {
  2895. context = vm.__get_value(valuePath, context);
  2896. }
  2897. }
  2898. });
  2899. return context;
  2900. }
  2901. function processEventExtra(vm, extra, event, __args__) {
  2902. var extraObj = {};
  2903. if (Array.isArray(extra) && extra.length) {
  2904. /**
  2905. *[
  2906. * ['data.items', 'data.id', item.data.id],
  2907. * ['metas', 'id', meta.id]
  2908. *],
  2909. *[
  2910. * ['data.items', 'data.id', item.data.id],
  2911. * ['metas', 'id', meta.id]
  2912. *],
  2913. *'test'
  2914. */
  2915. extra.forEach(function (dataPath, index) {
  2916. if (typeof dataPath === 'string') {
  2917. if (!dataPath) {
  2918. // model,prop.sync
  2919. extraObj['$' + index] = vm;
  2920. } else {
  2921. if (dataPath === '$event') {
  2922. // $event
  2923. extraObj['$' + index] = event;
  2924. } else if (dataPath === 'arguments') {
  2925. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  2926. } else if (dataPath.indexOf('$event.') === 0) {
  2927. // $event.target.value
  2928. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  2929. } else {
  2930. extraObj['$' + index] = vm.__get_value(dataPath);
  2931. }
  2932. }
  2933. } else {
  2934. extraObj['$' + index] = getExtraValue(vm, dataPath);
  2935. }
  2936. });
  2937. }
  2938. return extraObj;
  2939. }
  2940. function getObjByArray(arr) {
  2941. var obj = {};
  2942. for (var i = 1; i < arr.length; i++) {
  2943. var element = arr[i];
  2944. obj[element[0]] = element[1];
  2945. }
  2946. return obj;
  2947. }
  2948. function processEventArgs(vm, event) {
  2949. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  2950. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  2951. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  2952. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  2953. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  2954. // fixed 用户直接触发 mpInstance.triggerEvent
  2955. var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
  2956. if (isCustom) {
  2957. // 自定义事件
  2958. isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
  2959. if (!args.length) {
  2960. // 无参数,直接传入 event 或 detail 数组
  2961. if (isCustomMPEvent) {
  2962. return [event];
  2963. }
  2964. return __args__;
  2965. }
  2966. }
  2967. var extraObj = processEventExtra(vm, extra, event, __args__);
  2968. var ret = [];
  2969. args.forEach(function (arg) {
  2970. if (arg === '$event') {
  2971. if (methodName === '__set_model' && !isCustom) {
  2972. // input v-model value
  2973. ret.push(event.target.value);
  2974. } else {
  2975. if (isCustom && !isCustomMPEvent) {
  2976. ret.push(__args__[0]);
  2977. } else {
  2978. // wxcomponent 组件或内置组件
  2979. ret.push(event);
  2980. }
  2981. }
  2982. } else {
  2983. if (Array.isArray(arg) && arg[0] === 'o') {
  2984. ret.push(getObjByArray(arg));
  2985. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  2986. ret.push(extraObj[arg]);
  2987. } else {
  2988. ret.push(arg);
  2989. }
  2990. }
  2991. });
  2992. return ret;
  2993. }
  2994. var ONCE = '~';
  2995. var CUSTOM = '^';
  2996. function isMatchEventType(eventType, optType) {
  2997. return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
  2998. }
  2999. function getContextVm(vm) {
  3000. var $parent = vm.$parent;
  3001. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  3002. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  3003. $parent = $parent.$parent;
  3004. }
  3005. return $parent && $parent.$parent;
  3006. }
  3007. function handleEvent(event) {
  3008. var _this2 = this;
  3009. event = wrapper$1(event);
  3010. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  3011. var dataset = (event.currentTarget || event.target).dataset;
  3012. if (!dataset) {
  3013. return console.warn('事件信息不存在');
  3014. }
  3015. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  3016. if (!eventOpts) {
  3017. return console.warn('事件信息不存在');
  3018. }
  3019. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  3020. var eventType = event.type;
  3021. var ret = [];
  3022. eventOpts.forEach(function (eventOpt) {
  3023. var type = eventOpt[0];
  3024. var eventsArray = eventOpt[1];
  3025. var isCustom = type.charAt(0) === CUSTOM;
  3026. type = isCustom ? type.slice(1) : type;
  3027. var isOnce = type.charAt(0) === ONCE;
  3028. type = isOnce ? type.slice(1) : type;
  3029. if (eventsArray && isMatchEventType(eventType, type)) {
  3030. eventsArray.forEach(function (eventArray) {
  3031. var methodName = eventArray[0];
  3032. if (methodName) {
  3033. var handlerCtx = _this2.$vm;
  3034. if (handlerCtx.$options.generic) {
  3035. // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  3036. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  3037. }
  3038. if (methodName === '$emit') {
  3039. handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
  3040. return;
  3041. }
  3042. var handler = handlerCtx[methodName];
  3043. if (!isFn(handler)) {
  3044. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  3045. var path = _this2.route || _this2.is;
  3046. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  3047. }
  3048. if (isOnce) {
  3049. if (handler.once) {
  3050. return;
  3051. }
  3052. handler.once = true;
  3053. }
  3054. var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
  3055. params = Array.isArray(params) ? params : [];
  3056. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  3057. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  3058. // eslint-disable-next-line no-sparse-arrays
  3059. params = params.concat([,,,,,,,,,, event]);
  3060. }
  3061. ret.push(handler.apply(handlerCtx, params));
  3062. }
  3063. });
  3064. }
  3065. });
  3066. if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
  3067. return ret[0];
  3068. }
  3069. }
  3070. var eventChannels = {};
  3071. function getEventChannel(id) {
  3072. var eventChannel = eventChannels[id];
  3073. delete eventChannels[id];
  3074. return eventChannel;
  3075. }
  3076. var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
  3077. function initEventChannel() {
  3078. _vue.default.prototype.getOpenerEventChannel = function () {
  3079. // 微信小程序使用自身getOpenerEventChannel
  3080. {
  3081. return this.$scope.getOpenerEventChannel();
  3082. }
  3083. };
  3084. var callHook = _vue.default.prototype.__call_hook;
  3085. _vue.default.prototype.__call_hook = function (hook, args) {
  3086. if (hook === 'onLoad' && args && args.__id__) {
  3087. this.__eventChannel__ = getEventChannel(args.__id__);
  3088. delete args.__id__;
  3089. }
  3090. return callHook.call(this, hook, args);
  3091. };
  3092. }
  3093. function initScopedSlotsParams() {
  3094. var center = {};
  3095. var parents = {};
  3096. function currentId(fn) {
  3097. var vueIds = this.$options.propsData.vueId;
  3098. if (vueIds) {
  3099. var vueId = vueIds.split(',')[0];
  3100. fn(vueId);
  3101. }
  3102. }
  3103. _vue.default.prototype.$hasSSP = function (vueId) {
  3104. var slot = center[vueId];
  3105. if (!slot) {
  3106. parents[vueId] = this;
  3107. this.$on('hook:destroyed', function () {
  3108. delete parents[vueId];
  3109. });
  3110. }
  3111. return slot;
  3112. };
  3113. _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
  3114. var slot = center[vueId];
  3115. if (slot) {
  3116. var params = slot[name] || [];
  3117. if (needAll) {
  3118. return params;
  3119. }
  3120. return params[0];
  3121. }
  3122. };
  3123. _vue.default.prototype.$setSSP = function (name, value) {
  3124. var index = 0;
  3125. currentId.call(this, function (vueId) {
  3126. var slot = center[vueId];
  3127. var params = slot[name] = slot[name] || [];
  3128. params.push(value);
  3129. index = params.length - 1;
  3130. });
  3131. return index;
  3132. };
  3133. _vue.default.prototype.$initSSP = function () {
  3134. currentId.call(this, function (vueId) {
  3135. center[vueId] = {};
  3136. });
  3137. };
  3138. _vue.default.prototype.$callSSP = function () {
  3139. currentId.call(this, function (vueId) {
  3140. if (parents[vueId]) {
  3141. parents[vueId].$forceUpdate();
  3142. }
  3143. });
  3144. };
  3145. _vue.default.mixin({
  3146. destroyed: function destroyed() {
  3147. var propsData = this.$options.propsData;
  3148. var vueId = propsData && propsData.vueId;
  3149. if (vueId) {
  3150. delete center[vueId];
  3151. delete parents[vueId];
  3152. }
  3153. }
  3154. });
  3155. }
  3156. function parseBaseApp(vm, _ref4) {
  3157. var mocks = _ref4.mocks,
  3158. initRefs = _ref4.initRefs;
  3159. initEventChannel();
  3160. {
  3161. initScopedSlotsParams();
  3162. }
  3163. if (vm.$options.store) {
  3164. _vue.default.prototype.$store = vm.$options.store;
  3165. }
  3166. uniIdMixin(_vue.default);
  3167. _vue.default.prototype.mpHost = "mp-weixin";
  3168. _vue.default.mixin({
  3169. beforeCreate: function beforeCreate() {
  3170. if (!this.$options.mpType) {
  3171. return;
  3172. }
  3173. this.mpType = this.$options.mpType;
  3174. this.$mp = (0, _defineProperty2.default)({
  3175. data: {}
  3176. }, this.mpType, this.$options.mpInstance);
  3177. this.$scope = this.$options.mpInstance;
  3178. delete this.$options.mpType;
  3179. delete this.$options.mpInstance;
  3180. if (this.mpType === 'page' && typeof getApp === 'function') {
  3181. // hack vue-i18n
  3182. var app = getApp();
  3183. if (app.$vm && app.$vm.$i18n) {
  3184. this._i18n = app.$vm.$i18n;
  3185. }
  3186. }
  3187. if (this.mpType !== 'app') {
  3188. initRefs(this);
  3189. initMocks(this, mocks);
  3190. }
  3191. }
  3192. });
  3193. var appOptions = {
  3194. onLaunch: function onLaunch(args) {
  3195. if (this.$vm) {
  3196. // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  3197. return;
  3198. }
  3199. {
  3200. if (wx.canIUse && !wx.canIUse('nextTick')) {
  3201. // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  3202. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  3203. }
  3204. }
  3205. this.$vm = vm;
  3206. this.$vm.$mp = {
  3207. app: this
  3208. };
  3209. this.$vm.$scope = this;
  3210. // vm 上也挂载 globalData
  3211. this.$vm.globalData = this.globalData;
  3212. this.$vm._isMounted = true;
  3213. this.$vm.__call_hook('mounted', args);
  3214. this.$vm.__call_hook('onLaunch', args);
  3215. }
  3216. };
  3217. // 兼容旧版本 globalData
  3218. appOptions.globalData = vm.$options.globalData || {};
  3219. // 将 methods 中的方法挂在 getApp() 中
  3220. var methods = vm.$options.methods;
  3221. if (methods) {
  3222. Object.keys(methods).forEach(function (name) {
  3223. appOptions[name] = methods[name];
  3224. });
  3225. }
  3226. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  3227. initHooks(appOptions, hooks);
  3228. initUnknownHooks(appOptions, vm.$options);
  3229. return appOptions;
  3230. }
  3231. function parseApp(vm) {
  3232. return parseBaseApp(vm, {
  3233. mocks: mocks,
  3234. initRefs: initRefs
  3235. });
  3236. }
  3237. function createApp(vm) {
  3238. App(parseApp(vm));
  3239. return vm;
  3240. }
  3241. var encodeReserveRE = /[!'()*]/g;
  3242. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  3243. return '%' + c.charCodeAt(0).toString(16);
  3244. };
  3245. var commaRE = /%2C/g;
  3246. // fixed encodeURIComponent which is more conformant to RFC3986:
  3247. // - escapes [!'()*]
  3248. // - preserve commas
  3249. var encode = function encode(str) {
  3250. return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
  3251. };
  3252. function stringifyQuery(obj) {
  3253. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  3254. var res = obj ? Object.keys(obj).map(function (key) {
  3255. var val = obj[key];
  3256. if (val === undefined) {
  3257. return '';
  3258. }
  3259. if (val === null) {
  3260. return encodeStr(key);
  3261. }
  3262. if (Array.isArray(val)) {
  3263. var result = [];
  3264. val.forEach(function (val2) {
  3265. if (val2 === undefined) {
  3266. return;
  3267. }
  3268. if (val2 === null) {
  3269. result.push(encodeStr(key));
  3270. } else {
  3271. result.push(encodeStr(key) + '=' + encodeStr(val2));
  3272. }
  3273. });
  3274. return result.join('&');
  3275. }
  3276. return encodeStr(key) + '=' + encodeStr(val);
  3277. }).filter(function (x) {
  3278. return x.length > 0;
  3279. }).join('&') : null;
  3280. return res ? "?".concat(res) : '';
  3281. }
  3282. function parseBaseComponent(vueComponentOptions) {
  3283. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  3284. isPage = _ref5.isPage,
  3285. initRelation = _ref5.initRelation;
  3286. var needVueOptions = arguments.length > 2 ? arguments[2] : undefined;
  3287. var _initVueComponent = initVueComponent(_vue.default, vueComponentOptions),
  3288. _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
  3289. VueComponent = _initVueComponent2[0],
  3290. vueOptions = _initVueComponent2[1];
  3291. var options = _objectSpread({
  3292. multipleSlots: true,
  3293. // styleIsolation: 'apply-shared',
  3294. addGlobalClass: true
  3295. }, vueOptions.options || {});
  3296. {
  3297. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  3298. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  3299. Object.assign(options, vueOptions['mp-weixin'].options);
  3300. }
  3301. }
  3302. var componentOptions = {
  3303. options: options,
  3304. data: initData(vueOptions, _vue.default.prototype),
  3305. behaviors: initBehaviors(vueOptions, initBehavior),
  3306. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  3307. lifetimes: {
  3308. attached: function attached() {
  3309. var properties = this.properties;
  3310. var options = {
  3311. mpType: isPage.call(this) ? 'page' : 'component',
  3312. mpInstance: this,
  3313. propsData: properties
  3314. };
  3315. initVueIds(properties.vueId, this);
  3316. // 处理父子关系
  3317. initRelation.call(this, {
  3318. vuePid: this._$vuePid,
  3319. vueOptions: options
  3320. });
  3321. // 初始化 vue 实例
  3322. this.$vm = new VueComponent(options);
  3323. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  3324. initSlots(this.$vm, properties.vueSlots);
  3325. // 触发首次 setData
  3326. this.$vm.$mount();
  3327. },
  3328. ready: function ready() {
  3329. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  3330. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  3331. if (this.$vm) {
  3332. this.$vm._isMounted = true;
  3333. this.$vm.__call_hook('mounted');
  3334. this.$vm.__call_hook('onReady');
  3335. }
  3336. },
  3337. detached: function detached() {
  3338. this.$vm && this.$vm.$destroy();
  3339. }
  3340. },
  3341. pageLifetimes: {
  3342. show: function show(args) {
  3343. this.$vm && this.$vm.__call_hook('onPageShow', args);
  3344. },
  3345. hide: function hide() {
  3346. this.$vm && this.$vm.__call_hook('onPageHide');
  3347. },
  3348. resize: function resize(size) {
  3349. this.$vm && this.$vm.__call_hook('onPageResize', size);
  3350. }
  3351. },
  3352. methods: {
  3353. __l: handleLink,
  3354. __e: handleEvent
  3355. }
  3356. };
  3357. // externalClasses
  3358. if (vueOptions.externalClasses) {
  3359. componentOptions.externalClasses = vueOptions.externalClasses;
  3360. }
  3361. if (Array.isArray(vueOptions.wxsCallMethods)) {
  3362. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  3363. componentOptions.methods[callMethod] = function (args) {
  3364. return this.$vm[callMethod](args);
  3365. };
  3366. });
  3367. }
  3368. if (needVueOptions) {
  3369. return [componentOptions, vueOptions, VueComponent];
  3370. }
  3371. if (isPage) {
  3372. return componentOptions;
  3373. }
  3374. return [componentOptions, VueComponent];
  3375. }
  3376. function parseComponent(vueComponentOptions, needVueOptions) {
  3377. return parseBaseComponent(vueComponentOptions, {
  3378. isPage: isPage,
  3379. initRelation: initRelation
  3380. }, needVueOptions);
  3381. }
  3382. var hooks$1 = ['onShow', 'onHide', 'onUnload'];
  3383. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  3384. function parseBasePage(vuePageOptions) {
  3385. var _parseComponent = parseComponent(vuePageOptions, true),
  3386. _parseComponent2 = (0, _slicedToArray2.default)(_parseComponent, 2),
  3387. pageOptions = _parseComponent2[0],
  3388. vueOptions = _parseComponent2[1];
  3389. initHooks(pageOptions.methods, hooks$1, vueOptions);
  3390. pageOptions.methods.onLoad = function (query) {
  3391. this.options = query;
  3392. var copyQuery = Object.assign({}, query);
  3393. delete copyQuery.__id__;
  3394. this.$page = {
  3395. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
  3396. };
  3397. this.$vm.$mp.query = query; // 兼容 mpvue
  3398. this.$vm.__call_hook('onLoad', query);
  3399. };
  3400. {
  3401. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  3402. }
  3403. {
  3404. initWorkletMethods(pageOptions.methods, vueOptions.methods);
  3405. }
  3406. return pageOptions;
  3407. }
  3408. function parsePage(vuePageOptions) {
  3409. return parseBasePage(vuePageOptions);
  3410. }
  3411. function createPage(vuePageOptions) {
  3412. {
  3413. return Component(parsePage(vuePageOptions));
  3414. }
  3415. }
  3416. function createComponent(vueOptions) {
  3417. {
  3418. return Component(parseComponent(vueOptions));
  3419. }
  3420. }
  3421. function createSubpackageApp(vm) {
  3422. var appOptions = parseApp(vm);
  3423. var app = getApp({
  3424. allowDefault: true
  3425. });
  3426. vm.$scope = app;
  3427. var globalData = app.globalData;
  3428. if (globalData) {
  3429. Object.keys(appOptions.globalData).forEach(function (name) {
  3430. if (!hasOwn(globalData, name)) {
  3431. globalData[name] = appOptions.globalData[name];
  3432. }
  3433. });
  3434. }
  3435. Object.keys(appOptions).forEach(function (name) {
  3436. if (!hasOwn(app, name)) {
  3437. app[name] = appOptions[name];
  3438. }
  3439. });
  3440. if (isFn(appOptions.onShow) && wx.onAppShow) {
  3441. wx.onAppShow(function () {
  3442. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  3443. args[_key5] = arguments[_key5];
  3444. }
  3445. vm.__call_hook('onShow', args);
  3446. });
  3447. }
  3448. if (isFn(appOptions.onHide) && wx.onAppHide) {
  3449. wx.onAppHide(function () {
  3450. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  3451. args[_key6] = arguments[_key6];
  3452. }
  3453. vm.__call_hook('onHide', args);
  3454. });
  3455. }
  3456. if (isFn(appOptions.onLaunch)) {
  3457. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  3458. vm.__call_hook('onLaunch', args);
  3459. }
  3460. return vm;
  3461. }
  3462. function createPlugin(vm) {
  3463. var appOptions = parseApp(vm);
  3464. if (isFn(appOptions.onShow) && wx.onAppShow) {
  3465. wx.onAppShow(function () {
  3466. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  3467. args[_key7] = arguments[_key7];
  3468. }
  3469. vm.__call_hook('onShow', args);
  3470. });
  3471. }
  3472. if (isFn(appOptions.onHide) && wx.onAppHide) {
  3473. wx.onAppHide(function () {
  3474. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  3475. args[_key8] = arguments[_key8];
  3476. }
  3477. vm.__call_hook('onHide', args);
  3478. });
  3479. }
  3480. if (isFn(appOptions.onLaunch)) {
  3481. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  3482. vm.__call_hook('onLaunch', args);
  3483. }
  3484. return vm;
  3485. }
  3486. todos.forEach(function (todoApi) {
  3487. protocols[todoApi] = false;
  3488. });
  3489. canIUses.forEach(function (canIUseApi) {
  3490. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
  3491. if (!wx.canIUse(apiName)) {
  3492. protocols[canIUseApi] = false;
  3493. }
  3494. });
  3495. var uni = {};
  3496. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  3497. uni = new Proxy({}, {
  3498. get: function get(target, name) {
  3499. if (hasOwn(target, name)) {
  3500. return target[name];
  3501. }
  3502. if (baseApi[name]) {
  3503. return baseApi[name];
  3504. }
  3505. if (api[name]) {
  3506. return promisify(name, api[name]);
  3507. }
  3508. {
  3509. if (extraApi[name]) {
  3510. return promisify(name, extraApi[name]);
  3511. }
  3512. if (todoApis[name]) {
  3513. return promisify(name, todoApis[name]);
  3514. }
  3515. }
  3516. if (eventApi[name]) {
  3517. return eventApi[name];
  3518. }
  3519. return promisify(name, wrapper(name, wx[name]));
  3520. },
  3521. set: function set(target, name, value) {
  3522. target[name] = value;
  3523. return true;
  3524. }
  3525. });
  3526. } else {
  3527. Object.keys(baseApi).forEach(function (name) {
  3528. uni[name] = baseApi[name];
  3529. });
  3530. {
  3531. Object.keys(todoApis).forEach(function (name) {
  3532. uni[name] = promisify(name, todoApis[name]);
  3533. });
  3534. Object.keys(extraApi).forEach(function (name) {
  3535. uni[name] = promisify(name, extraApi[name]);
  3536. });
  3537. }
  3538. Object.keys(eventApi).forEach(function (name) {
  3539. uni[name] = eventApi[name];
  3540. });
  3541. Object.keys(api).forEach(function (name) {
  3542. uni[name] = promisify(name, api[name]);
  3543. });
  3544. Object.keys(wx).forEach(function (name) {
  3545. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  3546. uni[name] = promisify(name, wrapper(name, wx[name]));
  3547. }
  3548. });
  3549. }
  3550. wx.createApp = createApp;
  3551. wx.createPage = createPage;
  3552. wx.createComponent = createComponent;
  3553. wx.createSubpackageApp = createSubpackageApp;
  3554. wx.createPlugin = createPlugin;
  3555. var uni$1 = uni;
  3556. var _default = uni$1;
  3557. exports.default = _default;
  3558. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  3559. /***/ }),
  3560. /***/ 20:
  3561. /*!****************************************************************!*\
  3562. !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
  3563. \****************************************************************/
  3564. /*! no static exports found */
  3565. /***/ (function(module, exports) {
  3566. function _iterableToArray(iter) {
  3567. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  3568. }
  3569. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3570. /***/ }),
  3571. /***/ 21:
  3572. /*!******************************************************************!*\
  3573. !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
  3574. \******************************************************************/
  3575. /*! no static exports found */
  3576. /***/ (function(module, exports) {
  3577. function _nonIterableSpread() {
  3578. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  3579. }
  3580. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3581. /***/ }),
  3582. /***/ 22:
  3583. /*!*************************************************************!*\
  3584. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  3585. \*************************************************************/
  3586. /*! no static exports found */
  3587. /***/ (function(module, exports, __webpack_require__) {
  3588. "use strict";
  3589. /* WEBPACK VAR INJECTION */(function(uni, global) {
  3590. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  3591. Object.defineProperty(exports, "__esModule", {
  3592. value: true
  3593. });
  3594. exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
  3595. exports.compileI18nJsonStr = compileI18nJsonStr;
  3596. exports.hasI18nJson = hasI18nJson;
  3597. exports.initVueI18n = initVueI18n;
  3598. exports.isI18nStr = isI18nStr;
  3599. exports.isString = void 0;
  3600. exports.normalizeLocale = normalizeLocale;
  3601. exports.parseI18nJson = parseI18nJson;
  3602. exports.resolveLocale = resolveLocale;
  3603. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  3604. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  3605. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  3606. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  3607. var isObject = function isObject(val) {
  3608. return val !== null && (0, _typeof2.default)(val) === 'object';
  3609. };
  3610. var defaultDelimiters = ['{', '}'];
  3611. var BaseFormatter = /*#__PURE__*/function () {
  3612. function BaseFormatter() {
  3613. (0, _classCallCheck2.default)(this, BaseFormatter);
  3614. this._caches = Object.create(null);
  3615. }
  3616. (0, _createClass2.default)(BaseFormatter, [{
  3617. key: "interpolate",
  3618. value: function interpolate(message, values) {
  3619. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  3620. if (!values) {
  3621. return [message];
  3622. }
  3623. var tokens = this._caches[message];
  3624. if (!tokens) {
  3625. tokens = parse(message, delimiters);
  3626. this._caches[message] = tokens;
  3627. }
  3628. return compile(tokens, values);
  3629. }
  3630. }]);
  3631. return BaseFormatter;
  3632. }();
  3633. exports.Formatter = BaseFormatter;
  3634. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  3635. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  3636. function parse(format, _ref) {
  3637. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  3638. startDelimiter = _ref2[0],
  3639. endDelimiter = _ref2[1];
  3640. var tokens = [];
  3641. var position = 0;
  3642. var text = '';
  3643. while (position < format.length) {
  3644. var char = format[position++];
  3645. if (char === startDelimiter) {
  3646. if (text) {
  3647. tokens.push({
  3648. type: 'text',
  3649. value: text
  3650. });
  3651. }
  3652. text = '';
  3653. var sub = '';
  3654. char = format[position++];
  3655. while (char !== undefined && char !== endDelimiter) {
  3656. sub += char;
  3657. char = format[position++];
  3658. }
  3659. var isClosed = char === endDelimiter;
  3660. var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
  3661. tokens.push({
  3662. value: sub,
  3663. type: type
  3664. });
  3665. }
  3666. // else if (char === '%') {
  3667. // // when found rails i18n syntax, skip text capture
  3668. // if (format[position] !== '{') {
  3669. // text += char
  3670. // }
  3671. // }
  3672. else {
  3673. text += char;
  3674. }
  3675. }
  3676. text && tokens.push({
  3677. type: 'text',
  3678. value: text
  3679. });
  3680. return tokens;
  3681. }
  3682. function compile(tokens, values) {
  3683. var compiled = [];
  3684. var index = 0;
  3685. var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
  3686. if (mode === 'unknown') {
  3687. return compiled;
  3688. }
  3689. while (index < tokens.length) {
  3690. var token = tokens[index];
  3691. switch (token.type) {
  3692. case 'text':
  3693. compiled.push(token.value);
  3694. break;
  3695. case 'list':
  3696. compiled.push(values[parseInt(token.value, 10)]);
  3697. break;
  3698. case 'named':
  3699. if (mode === 'named') {
  3700. compiled.push(values[token.value]);
  3701. } else {
  3702. if (true) {
  3703. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  3704. }
  3705. }
  3706. break;
  3707. case 'unknown':
  3708. if (true) {
  3709. console.warn("Detect 'unknown' type of token!");
  3710. }
  3711. break;
  3712. }
  3713. index++;
  3714. }
  3715. return compiled;
  3716. }
  3717. var LOCALE_ZH_HANS = 'zh-Hans';
  3718. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  3719. var LOCALE_ZH_HANT = 'zh-Hant';
  3720. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  3721. var LOCALE_EN = 'en';
  3722. exports.LOCALE_EN = LOCALE_EN;
  3723. var LOCALE_FR = 'fr';
  3724. exports.LOCALE_FR = LOCALE_FR;
  3725. var LOCALE_ES = 'es';
  3726. exports.LOCALE_ES = LOCALE_ES;
  3727. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3728. var hasOwn = function hasOwn(val, key) {
  3729. return hasOwnProperty.call(val, key);
  3730. };
  3731. var defaultFormatter = new BaseFormatter();
  3732. function include(str, parts) {
  3733. return !!parts.find(function (part) {
  3734. return str.indexOf(part) !== -1;
  3735. });
  3736. }
  3737. function startsWith(str, parts) {
  3738. return parts.find(function (part) {
  3739. return str.indexOf(part) === 0;
  3740. });
  3741. }
  3742. function normalizeLocale(locale, messages) {
  3743. if (!locale) {
  3744. return;
  3745. }
  3746. locale = locale.trim().replace(/_/g, '-');
  3747. if (messages && messages[locale]) {
  3748. return locale;
  3749. }
  3750. locale = locale.toLowerCase();
  3751. if (locale === 'chinese') {
  3752. // 支付宝
  3753. return LOCALE_ZH_HANS;
  3754. }
  3755. if (locale.indexOf('zh') === 0) {
  3756. if (locale.indexOf('-hans') > -1) {
  3757. return LOCALE_ZH_HANS;
  3758. }
  3759. if (locale.indexOf('-hant') > -1) {
  3760. return LOCALE_ZH_HANT;
  3761. }
  3762. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  3763. return LOCALE_ZH_HANT;
  3764. }
  3765. return LOCALE_ZH_HANS;
  3766. }
  3767. var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  3768. if (messages && Object.keys(messages).length > 0) {
  3769. locales = Object.keys(messages);
  3770. }
  3771. var lang = startsWith(locale, locales);
  3772. if (lang) {
  3773. return lang;
  3774. }
  3775. }
  3776. var I18n = /*#__PURE__*/function () {
  3777. function I18n(_ref3) {
  3778. var locale = _ref3.locale,
  3779. fallbackLocale = _ref3.fallbackLocale,
  3780. messages = _ref3.messages,
  3781. watcher = _ref3.watcher,
  3782. formater = _ref3.formater;
  3783. (0, _classCallCheck2.default)(this, I18n);
  3784. this.locale = LOCALE_EN;
  3785. this.fallbackLocale = LOCALE_EN;
  3786. this.message = {};
  3787. this.messages = {};
  3788. this.watchers = [];
  3789. if (fallbackLocale) {
  3790. this.fallbackLocale = fallbackLocale;
  3791. }
  3792. this.formater = formater || defaultFormatter;
  3793. this.messages = messages || {};
  3794. this.setLocale(locale || LOCALE_EN);
  3795. if (watcher) {
  3796. this.watchLocale(watcher);
  3797. }
  3798. }
  3799. (0, _createClass2.default)(I18n, [{
  3800. key: "setLocale",
  3801. value: function setLocale(locale) {
  3802. var _this = this;
  3803. var oldLocale = this.locale;
  3804. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  3805. if (!this.messages[this.locale]) {
  3806. // 可能初始化时不存在
  3807. this.messages[this.locale] = {};
  3808. }
  3809. this.message = this.messages[this.locale];
  3810. // 仅发生变化时,通知
  3811. if (oldLocale !== this.locale) {
  3812. this.watchers.forEach(function (watcher) {
  3813. watcher(_this.locale, oldLocale);
  3814. });
  3815. }
  3816. }
  3817. }, {
  3818. key: "getLocale",
  3819. value: function getLocale() {
  3820. return this.locale;
  3821. }
  3822. }, {
  3823. key: "watchLocale",
  3824. value: function watchLocale(fn) {
  3825. var _this2 = this;
  3826. var index = this.watchers.push(fn) - 1;
  3827. return function () {
  3828. _this2.watchers.splice(index, 1);
  3829. };
  3830. }
  3831. }, {
  3832. key: "add",
  3833. value: function add(locale, message) {
  3834. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3835. var curMessages = this.messages[locale];
  3836. if (curMessages) {
  3837. if (override) {
  3838. Object.assign(curMessages, message);
  3839. } else {
  3840. Object.keys(message).forEach(function (key) {
  3841. if (!hasOwn(curMessages, key)) {
  3842. curMessages[key] = message[key];
  3843. }
  3844. });
  3845. }
  3846. } else {
  3847. this.messages[locale] = message;
  3848. }
  3849. }
  3850. }, {
  3851. key: "f",
  3852. value: function f(message, values, delimiters) {
  3853. return this.formater.interpolate(message, values, delimiters).join('');
  3854. }
  3855. }, {
  3856. key: "t",
  3857. value: function t(key, locale, values) {
  3858. var message = this.message;
  3859. if (typeof locale === 'string') {
  3860. locale = normalizeLocale(locale, this.messages);
  3861. locale && (message = this.messages[locale]);
  3862. } else {
  3863. values = locale;
  3864. }
  3865. if (!hasOwn(message, key)) {
  3866. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  3867. return key;
  3868. }
  3869. return this.formater.interpolate(message[key], values).join('');
  3870. }
  3871. }]);
  3872. return I18n;
  3873. }();
  3874. exports.I18n = I18n;
  3875. function watchAppLocale(appVm, i18n) {
  3876. // 需要保证 watch 的触发在组件渲染之前
  3877. if (appVm.$watchLocale) {
  3878. // vue2
  3879. appVm.$watchLocale(function (newLocale) {
  3880. i18n.setLocale(newLocale);
  3881. });
  3882. } else {
  3883. appVm.$watch(function () {
  3884. return appVm.$locale;
  3885. }, function (newLocale) {
  3886. i18n.setLocale(newLocale);
  3887. });
  3888. }
  3889. }
  3890. function getDefaultLocale() {
  3891. if (typeof uni !== 'undefined' && uni.getLocale) {
  3892. return uni.getLocale();
  3893. }
  3894. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  3895. if (typeof global !== 'undefined' && global.getLocale) {
  3896. return global.getLocale();
  3897. }
  3898. return LOCALE_EN;
  3899. }
  3900. function initVueI18n(locale) {
  3901. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3902. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  3903. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  3904. // 兼容旧版本入参
  3905. if (typeof locale !== 'string') {
  3906. var _ref4 = [messages, locale];
  3907. locale = _ref4[0];
  3908. messages = _ref4[1];
  3909. }
  3910. if (typeof locale !== 'string') {
  3911. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  3912. locale = getDefaultLocale();
  3913. }
  3914. if (typeof fallbackLocale !== 'string') {
  3915. fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
  3916. }
  3917. var i18n = new I18n({
  3918. locale: locale,
  3919. fallbackLocale: fallbackLocale,
  3920. messages: messages,
  3921. watcher: watcher
  3922. });
  3923. var _t = function t(key, values) {
  3924. if (typeof getApp !== 'function') {
  3925. // app view
  3926. /* eslint-disable no-func-assign */
  3927. _t = function t(key, values) {
  3928. return i18n.t(key, values);
  3929. };
  3930. } else {
  3931. var isWatchedAppLocale = false;
  3932. _t = function t(key, values) {
  3933. var appVm = getApp().$vm;
  3934. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  3935. // options: {
  3936. // type: Array,
  3937. // default () {
  3938. // return [{
  3939. // icon: 'shop',
  3940. // text: t("uni-goods-nav.options.shop"),
  3941. // }, {
  3942. // icon: 'cart',
  3943. // text: t("uni-goods-nav.options.cart")
  3944. // }]
  3945. // }
  3946. // },
  3947. if (appVm) {
  3948. // 触发响应式
  3949. appVm.$locale;
  3950. if (!isWatchedAppLocale) {
  3951. isWatchedAppLocale = true;
  3952. watchAppLocale(appVm, i18n);
  3953. }
  3954. }
  3955. return i18n.t(key, values);
  3956. };
  3957. }
  3958. return _t(key, values);
  3959. };
  3960. return {
  3961. i18n: i18n,
  3962. f: function f(message, values, delimiters) {
  3963. return i18n.f(message, values, delimiters);
  3964. },
  3965. t: function t(key, values) {
  3966. return _t(key, values);
  3967. },
  3968. add: function add(locale, message) {
  3969. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3970. return i18n.add(locale, message, override);
  3971. },
  3972. watch: function watch(fn) {
  3973. return i18n.watchLocale(fn);
  3974. },
  3975. getLocale: function getLocale() {
  3976. return i18n.getLocale();
  3977. },
  3978. setLocale: function setLocale(newLocale) {
  3979. return i18n.setLocale(newLocale);
  3980. }
  3981. };
  3982. }
  3983. var isString = function isString(val) {
  3984. return typeof val === 'string';
  3985. };
  3986. exports.isString = isString;
  3987. var formater;
  3988. function hasI18nJson(jsonObj, delimiters) {
  3989. if (!formater) {
  3990. formater = new BaseFormatter();
  3991. }
  3992. return walkJsonObj(jsonObj, function (jsonObj, key) {
  3993. var value = jsonObj[key];
  3994. if (isString(value)) {
  3995. if (isI18nStr(value, delimiters)) {
  3996. return true;
  3997. }
  3998. } else {
  3999. return hasI18nJson(value, delimiters);
  4000. }
  4001. });
  4002. }
  4003. function parseI18nJson(jsonObj, values, delimiters) {
  4004. if (!formater) {
  4005. formater = new BaseFormatter();
  4006. }
  4007. walkJsonObj(jsonObj, function (jsonObj, key) {
  4008. var value = jsonObj[key];
  4009. if (isString(value)) {
  4010. if (isI18nStr(value, delimiters)) {
  4011. jsonObj[key] = compileStr(value, values, delimiters);
  4012. }
  4013. } else {
  4014. parseI18nJson(value, values, delimiters);
  4015. }
  4016. });
  4017. return jsonObj;
  4018. }
  4019. function compileI18nJsonStr(jsonStr, _ref5) {
  4020. var locale = _ref5.locale,
  4021. locales = _ref5.locales,
  4022. delimiters = _ref5.delimiters;
  4023. if (!isI18nStr(jsonStr, delimiters)) {
  4024. return jsonStr;
  4025. }
  4026. if (!formater) {
  4027. formater = new BaseFormatter();
  4028. }
  4029. var localeValues = [];
  4030. Object.keys(locales).forEach(function (name) {
  4031. if (name !== locale) {
  4032. localeValues.push({
  4033. locale: name,
  4034. values: locales[name]
  4035. });
  4036. }
  4037. });
  4038. localeValues.unshift({
  4039. locale: locale,
  4040. values: locales[locale]
  4041. });
  4042. try {
  4043. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  4044. } catch (e) {}
  4045. return jsonStr;
  4046. }
  4047. function isI18nStr(value, delimiters) {
  4048. return value.indexOf(delimiters[0]) > -1;
  4049. }
  4050. function compileStr(value, values, delimiters) {
  4051. return formater.interpolate(value, values, delimiters).join('');
  4052. }
  4053. function compileValue(jsonObj, key, localeValues, delimiters) {
  4054. var value = jsonObj[key];
  4055. if (isString(value)) {
  4056. // 存在国际化
  4057. if (isI18nStr(value, delimiters)) {
  4058. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  4059. if (localeValues.length > 1) {
  4060. // 格式化国际化语言
  4061. var valueLocales = jsonObj[key + 'Locales'] = {};
  4062. localeValues.forEach(function (localValue) {
  4063. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  4064. });
  4065. }
  4066. }
  4067. } else {
  4068. compileJsonObj(value, localeValues, delimiters);
  4069. }
  4070. }
  4071. function compileJsonObj(jsonObj, localeValues, delimiters) {
  4072. walkJsonObj(jsonObj, function (jsonObj, key) {
  4073. compileValue(jsonObj, key, localeValues, delimiters);
  4074. });
  4075. return jsonObj;
  4076. }
  4077. function walkJsonObj(jsonObj, walk) {
  4078. if (Array.isArray(jsonObj)) {
  4079. for (var i = 0; i < jsonObj.length; i++) {
  4080. if (walk(jsonObj, i)) {
  4081. return true;
  4082. }
  4083. }
  4084. } else if (isObject(jsonObj)) {
  4085. for (var key in jsonObj) {
  4086. if (walk(jsonObj, key)) {
  4087. return true;
  4088. }
  4089. }
  4090. }
  4091. return false;
  4092. }
  4093. function resolveLocale(locales) {
  4094. return function (locale) {
  4095. if (!locale) {
  4096. return locale;
  4097. }
  4098. locale = normalizeLocale(locale) || locale;
  4099. return resolveLocaleChain(locale).find(function (locale) {
  4100. return locales.indexOf(locale) > -1;
  4101. });
  4102. };
  4103. }
  4104. function resolveLocaleChain(locale) {
  4105. var chain = [];
  4106. var tokens = locale.split('-');
  4107. while (tokens.length) {
  4108. chain.push(tokens.join('-'));
  4109. tokens.pop();
  4110. }
  4111. return chain;
  4112. }
  4113. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  4114. /***/ }),
  4115. /***/ 23:
  4116. /*!***************************************************************!*\
  4117. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  4118. \***************************************************************/
  4119. /*! no static exports found */
  4120. /***/ (function(module, exports) {
  4121. function _classCallCheck(instance, Constructor) {
  4122. if (!(instance instanceof Constructor)) {
  4123. throw new TypeError("Cannot call a class as a function");
  4124. }
  4125. }
  4126. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  4127. /***/ }),
  4128. /***/ 24:
  4129. /*!************************************************************!*\
  4130. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  4131. \************************************************************/
  4132. /*! no static exports found */
  4133. /***/ (function(module, exports, __webpack_require__) {
  4134. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  4135. function _defineProperties(target, props) {
  4136. for (var i = 0; i < props.length; i++) {
  4137. var descriptor = props[i];
  4138. descriptor.enumerable = descriptor.enumerable || false;
  4139. descriptor.configurable = true;
  4140. if ("value" in descriptor) descriptor.writable = true;
  4141. Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
  4142. }
  4143. }
  4144. function _createClass(Constructor, protoProps, staticProps) {
  4145. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  4146. if (staticProps) _defineProperties(Constructor, staticProps);
  4147. Object.defineProperty(Constructor, "prototype", {
  4148. writable: false
  4149. });
  4150. return Constructor;
  4151. }
  4152. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  4153. /***/ }),
  4154. /***/ 25:
  4155. /*!******************************************************************************************!*\
  4156. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  4157. \******************************************************************************************/
  4158. /*! exports provided: default */
  4159. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4160. "use strict";
  4161. __webpack_require__.r(__webpack_exports__);
  4162. /* WEBPACK VAR INJECTION */(function(global) {/*!
  4163. * Vue.js v2.6.11
  4164. * (c) 2014-2023 Evan You
  4165. * Released under the MIT License.
  4166. */
  4167. /* */
  4168. var emptyObject = Object.freeze({});
  4169. // These helpers produce better VM code in JS engines due to their
  4170. // explicitness and function inlining.
  4171. function isUndef (v) {
  4172. return v === undefined || v === null
  4173. }
  4174. function isDef (v) {
  4175. return v !== undefined && v !== null
  4176. }
  4177. function isTrue (v) {
  4178. return v === true
  4179. }
  4180. function isFalse (v) {
  4181. return v === false
  4182. }
  4183. /**
  4184. * Check if value is primitive.
  4185. */
  4186. function isPrimitive (value) {
  4187. return (
  4188. typeof value === 'string' ||
  4189. typeof value === 'number' ||
  4190. // $flow-disable-line
  4191. typeof value === 'symbol' ||
  4192. typeof value === 'boolean'
  4193. )
  4194. }
  4195. /**
  4196. * Quick object check - this is primarily used to tell
  4197. * Objects from primitive values when we know the value
  4198. * is a JSON-compliant type.
  4199. */
  4200. function isObject (obj) {
  4201. return obj !== null && typeof obj === 'object'
  4202. }
  4203. /**
  4204. * Get the raw type string of a value, e.g., [object Object].
  4205. */
  4206. var _toString = Object.prototype.toString;
  4207. function toRawType (value) {
  4208. return _toString.call(value).slice(8, -1)
  4209. }
  4210. /**
  4211. * Strict object type check. Only returns true
  4212. * for plain JavaScript objects.
  4213. */
  4214. function isPlainObject (obj) {
  4215. return _toString.call(obj) === '[object Object]'
  4216. }
  4217. function isRegExp (v) {
  4218. return _toString.call(v) === '[object RegExp]'
  4219. }
  4220. /**
  4221. * Check if val is a valid array index.
  4222. */
  4223. function isValidArrayIndex (val) {
  4224. var n = parseFloat(String(val));
  4225. return n >= 0 && Math.floor(n) === n && isFinite(val)
  4226. }
  4227. function isPromise (val) {
  4228. return (
  4229. isDef(val) &&
  4230. typeof val.then === 'function' &&
  4231. typeof val.catch === 'function'
  4232. )
  4233. }
  4234. /**
  4235. * Convert a value to a string that is actually rendered.
  4236. */
  4237. function toString (val) {
  4238. return val == null
  4239. ? ''
  4240. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  4241. ? JSON.stringify(val, null, 2)
  4242. : String(val)
  4243. }
  4244. /**
  4245. * Convert an input value to a number for persistence.
  4246. * If the conversion fails, return original string.
  4247. */
  4248. function toNumber (val) {
  4249. var n = parseFloat(val);
  4250. return isNaN(n) ? val : n
  4251. }
  4252. /**
  4253. * Make a map and return a function for checking if a key
  4254. * is in that map.
  4255. */
  4256. function makeMap (
  4257. str,
  4258. expectsLowerCase
  4259. ) {
  4260. var map = Object.create(null);
  4261. var list = str.split(',');
  4262. for (var i = 0; i < list.length; i++) {
  4263. map[list[i]] = true;
  4264. }
  4265. return expectsLowerCase
  4266. ? function (val) { return map[val.toLowerCase()]; }
  4267. : function (val) { return map[val]; }
  4268. }
  4269. /**
  4270. * Check if a tag is a built-in tag.
  4271. */
  4272. var isBuiltInTag = makeMap('slot,component', true);
  4273. /**
  4274. * Check if an attribute is a reserved attribute.
  4275. */
  4276. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  4277. /**
  4278. * Remove an item from an array.
  4279. */
  4280. function remove (arr, item) {
  4281. if (arr.length) {
  4282. var index = arr.indexOf(item);
  4283. if (index > -1) {
  4284. return arr.splice(index, 1)
  4285. }
  4286. }
  4287. }
  4288. /**
  4289. * Check whether an object has the property.
  4290. */
  4291. var hasOwnProperty = Object.prototype.hasOwnProperty;
  4292. function hasOwn (obj, key) {
  4293. return hasOwnProperty.call(obj, key)
  4294. }
  4295. /**
  4296. * Create a cached version of a pure function.
  4297. */
  4298. function cached (fn) {
  4299. var cache = Object.create(null);
  4300. return (function cachedFn (str) {
  4301. var hit = cache[str];
  4302. return hit || (cache[str] = fn(str))
  4303. })
  4304. }
  4305. /**
  4306. * Camelize a hyphen-delimited string.
  4307. */
  4308. var camelizeRE = /-(\w)/g;
  4309. var camelize = cached(function (str) {
  4310. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  4311. });
  4312. /**
  4313. * Capitalize a string.
  4314. */
  4315. var capitalize = cached(function (str) {
  4316. return str.charAt(0).toUpperCase() + str.slice(1)
  4317. });
  4318. /**
  4319. * Hyphenate a camelCase string.
  4320. */
  4321. var hyphenateRE = /\B([A-Z])/g;
  4322. var hyphenate = cached(function (str) {
  4323. return str.replace(hyphenateRE, '-$1').toLowerCase()
  4324. });
  4325. /**
  4326. * Simple bind polyfill for environments that do not support it,
  4327. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  4328. * since native bind is now performant enough in most browsers.
  4329. * But removing it would mean breaking code that was able to run in
  4330. * PhantomJS 1.x, so this must be kept for backward compatibility.
  4331. */
  4332. /* istanbul ignore next */
  4333. function polyfillBind (fn, ctx) {
  4334. function boundFn (a) {
  4335. var l = arguments.length;
  4336. return l
  4337. ? l > 1
  4338. ? fn.apply(ctx, arguments)
  4339. : fn.call(ctx, a)
  4340. : fn.call(ctx)
  4341. }
  4342. boundFn._length = fn.length;
  4343. return boundFn
  4344. }
  4345. function nativeBind (fn, ctx) {
  4346. return fn.bind(ctx)
  4347. }
  4348. var bind = Function.prototype.bind
  4349. ? nativeBind
  4350. : polyfillBind;
  4351. /**
  4352. * Convert an Array-like object to a real Array.
  4353. */
  4354. function toArray (list, start) {
  4355. start = start || 0;
  4356. var i = list.length - start;
  4357. var ret = new Array(i);
  4358. while (i--) {
  4359. ret[i] = list[i + start];
  4360. }
  4361. return ret
  4362. }
  4363. /**
  4364. * Mix properties into target object.
  4365. */
  4366. function extend (to, _from) {
  4367. for (var key in _from) {
  4368. to[key] = _from[key];
  4369. }
  4370. return to
  4371. }
  4372. /**
  4373. * Merge an Array of Objects into a single Object.
  4374. */
  4375. function toObject (arr) {
  4376. var res = {};
  4377. for (var i = 0; i < arr.length; i++) {
  4378. if (arr[i]) {
  4379. extend(res, arr[i]);
  4380. }
  4381. }
  4382. return res
  4383. }
  4384. /* eslint-disable no-unused-vars */
  4385. /**
  4386. * Perform no operation.
  4387. * Stubbing args to make Flow happy without leaving useless transpiled code
  4388. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  4389. */
  4390. function noop (a, b, c) {}
  4391. /**
  4392. * Always return false.
  4393. */
  4394. var no = function (a, b, c) { return false; };
  4395. /* eslint-enable no-unused-vars */
  4396. /**
  4397. * Return the same value.
  4398. */
  4399. var identity = function (_) { return _; };
  4400. /**
  4401. * Check if two values are loosely equal - that is,
  4402. * if they are plain objects, do they have the same shape?
  4403. */
  4404. function looseEqual (a, b) {
  4405. if (a === b) { return true }
  4406. var isObjectA = isObject(a);
  4407. var isObjectB = isObject(b);
  4408. if (isObjectA && isObjectB) {
  4409. try {
  4410. var isArrayA = Array.isArray(a);
  4411. var isArrayB = Array.isArray(b);
  4412. if (isArrayA && isArrayB) {
  4413. return a.length === b.length && a.every(function (e, i) {
  4414. return looseEqual(e, b[i])
  4415. })
  4416. } else if (a instanceof Date && b instanceof Date) {
  4417. return a.getTime() === b.getTime()
  4418. } else if (!isArrayA && !isArrayB) {
  4419. var keysA = Object.keys(a);
  4420. var keysB = Object.keys(b);
  4421. return keysA.length === keysB.length && keysA.every(function (key) {
  4422. return looseEqual(a[key], b[key])
  4423. })
  4424. } else {
  4425. /* istanbul ignore next */
  4426. return false
  4427. }
  4428. } catch (e) {
  4429. /* istanbul ignore next */
  4430. return false
  4431. }
  4432. } else if (!isObjectA && !isObjectB) {
  4433. return String(a) === String(b)
  4434. } else {
  4435. return false
  4436. }
  4437. }
  4438. /**
  4439. * Return the first index at which a loosely equal value can be
  4440. * found in the array (if value is a plain object, the array must
  4441. * contain an object of the same shape), or -1 if it is not present.
  4442. */
  4443. function looseIndexOf (arr, val) {
  4444. for (var i = 0; i < arr.length; i++) {
  4445. if (looseEqual(arr[i], val)) { return i }
  4446. }
  4447. return -1
  4448. }
  4449. /**
  4450. * Ensure a function is called only once.
  4451. */
  4452. function once (fn) {
  4453. var called = false;
  4454. return function () {
  4455. if (!called) {
  4456. called = true;
  4457. fn.apply(this, arguments);
  4458. }
  4459. }
  4460. }
  4461. var ASSET_TYPES = [
  4462. 'component',
  4463. 'directive',
  4464. 'filter'
  4465. ];
  4466. var LIFECYCLE_HOOKS = [
  4467. 'beforeCreate',
  4468. 'created',
  4469. 'beforeMount',
  4470. 'mounted',
  4471. 'beforeUpdate',
  4472. 'updated',
  4473. 'beforeDestroy',
  4474. 'destroyed',
  4475. 'activated',
  4476. 'deactivated',
  4477. 'errorCaptured',
  4478. 'serverPrefetch'
  4479. ];
  4480. /* */
  4481. var config = ({
  4482. /**
  4483. * Option merge strategies (used in core/util/options)
  4484. */
  4485. // $flow-disable-line
  4486. optionMergeStrategies: Object.create(null),
  4487. /**
  4488. * Whether to suppress warnings.
  4489. */
  4490. silent: false,
  4491. /**
  4492. * Show production mode tip message on boot?
  4493. */
  4494. productionTip: "development" !== 'production',
  4495. /**
  4496. * Whether to enable devtools
  4497. */
  4498. devtools: "development" !== 'production',
  4499. /**
  4500. * Whether to record perf
  4501. */
  4502. performance: false,
  4503. /**
  4504. * Error handler for watcher errors
  4505. */
  4506. errorHandler: null,
  4507. /**
  4508. * Warn handler for watcher warns
  4509. */
  4510. warnHandler: null,
  4511. /**
  4512. * Ignore certain custom elements
  4513. */
  4514. ignoredElements: [],
  4515. /**
  4516. * Custom user key aliases for v-on
  4517. */
  4518. // $flow-disable-line
  4519. keyCodes: Object.create(null),
  4520. /**
  4521. * Check if a tag is reserved so that it cannot be registered as a
  4522. * component. This is platform-dependent and may be overwritten.
  4523. */
  4524. isReservedTag: no,
  4525. /**
  4526. * Check if an attribute is reserved so that it cannot be used as a component
  4527. * prop. This is platform-dependent and may be overwritten.
  4528. */
  4529. isReservedAttr: no,
  4530. /**
  4531. * Check if a tag is an unknown element.
  4532. * Platform-dependent.
  4533. */
  4534. isUnknownElement: no,
  4535. /**
  4536. * Get the namespace of an element
  4537. */
  4538. getTagNamespace: noop,
  4539. /**
  4540. * Parse the real tag name for the specific platform.
  4541. */
  4542. parsePlatformTagName: identity,
  4543. /**
  4544. * Check if an attribute must be bound using property, e.g. value
  4545. * Platform-dependent.
  4546. */
  4547. mustUseProp: no,
  4548. /**
  4549. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  4550. * This will significantly reduce performance if set to false.
  4551. */
  4552. async: true,
  4553. /**
  4554. * Exposed for legacy reasons
  4555. */
  4556. _lifecycleHooks: LIFECYCLE_HOOKS
  4557. });
  4558. /* */
  4559. /**
  4560. * unicode letters used for parsing html tags, component names and property paths.
  4561. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  4562. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  4563. */
  4564. 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/;
  4565. /**
  4566. * Check if a string starts with $ or _
  4567. */
  4568. function isReserved (str) {
  4569. var c = (str + '').charCodeAt(0);
  4570. return c === 0x24 || c === 0x5F
  4571. }
  4572. /**
  4573. * Define a property.
  4574. */
  4575. function def (obj, key, val, enumerable) {
  4576. Object.defineProperty(obj, key, {
  4577. value: val,
  4578. enumerable: !!enumerable,
  4579. writable: true,
  4580. configurable: true
  4581. });
  4582. }
  4583. /**
  4584. * Parse simple path.
  4585. */
  4586. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  4587. function parsePath (path) {
  4588. if (bailRE.test(path)) {
  4589. return
  4590. }
  4591. var segments = path.split('.');
  4592. return function (obj) {
  4593. for (var i = 0; i < segments.length; i++) {
  4594. if (!obj) { return }
  4595. obj = obj[segments[i]];
  4596. }
  4597. return obj
  4598. }
  4599. }
  4600. /* */
  4601. // can we use __proto__?
  4602. var hasProto = '__proto__' in {};
  4603. // Browser environment sniffing
  4604. var inBrowser = typeof window !== 'undefined';
  4605. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  4606. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  4607. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  4608. var isIE = UA && /msie|trident/.test(UA);
  4609. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  4610. var isEdge = UA && UA.indexOf('edge/') > 0;
  4611. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  4612. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  4613. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  4614. var isPhantomJS = UA && /phantomjs/.test(UA);
  4615. var isFF = UA && UA.match(/firefox\/(\d+)/);
  4616. // Firefox has a "watch" function on Object.prototype...
  4617. var nativeWatch = ({}).watch;
  4618. if (inBrowser) {
  4619. try {
  4620. var opts = {};
  4621. Object.defineProperty(opts, 'passive', ({
  4622. get: function get () {
  4623. }
  4624. })); // https://github.com/facebook/flow/issues/285
  4625. window.addEventListener('test-passive', null, opts);
  4626. } catch (e) {}
  4627. }
  4628. // this needs to be lazy-evaled because vue may be required before
  4629. // vue-server-renderer can set VUE_ENV
  4630. var _isServer;
  4631. var isServerRendering = function () {
  4632. if (_isServer === undefined) {
  4633. /* istanbul ignore if */
  4634. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  4635. // detect presence of vue-server-renderer and avoid
  4636. // Webpack shimming the process
  4637. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  4638. } else {
  4639. _isServer = false;
  4640. }
  4641. }
  4642. return _isServer
  4643. };
  4644. // detect devtools
  4645. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  4646. /* istanbul ignore next */
  4647. function isNative (Ctor) {
  4648. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  4649. }
  4650. var hasSymbol =
  4651. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  4652. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  4653. var _Set;
  4654. /* istanbul ignore if */ // $flow-disable-line
  4655. if (typeof Set !== 'undefined' && isNative(Set)) {
  4656. // use native Set when available.
  4657. _Set = Set;
  4658. } else {
  4659. // a non-standard Set polyfill that only works with primitive keys.
  4660. _Set = /*@__PURE__*/(function () {
  4661. function Set () {
  4662. this.set = Object.create(null);
  4663. }
  4664. Set.prototype.has = function has (key) {
  4665. return this.set[key] === true
  4666. };
  4667. Set.prototype.add = function add (key) {
  4668. this.set[key] = true;
  4669. };
  4670. Set.prototype.clear = function clear () {
  4671. this.set = Object.create(null);
  4672. };
  4673. return Set;
  4674. }());
  4675. }
  4676. /* */
  4677. var warn = noop;
  4678. var tip = noop;
  4679. var generateComponentTrace = (noop); // work around flow check
  4680. var formatComponentName = (noop);
  4681. if (true) {
  4682. var hasConsole = typeof console !== 'undefined';
  4683. var classifyRE = /(?:^|[-_])(\w)/g;
  4684. var classify = function (str) { return str
  4685. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  4686. .replace(/[-_]/g, ''); };
  4687. warn = function (msg, vm) {
  4688. var trace = vm ? generateComponentTrace(vm) : '';
  4689. if (config.warnHandler) {
  4690. config.warnHandler.call(null, msg, vm, trace);
  4691. } else if (hasConsole && (!config.silent)) {
  4692. console.error(("[Vue warn]: " + msg + trace));
  4693. }
  4694. };
  4695. tip = function (msg, vm) {
  4696. if (hasConsole && (!config.silent)) {
  4697. console.warn("[Vue tip]: " + msg + (
  4698. vm ? generateComponentTrace(vm) : ''
  4699. ));
  4700. }
  4701. };
  4702. formatComponentName = function (vm, includeFile) {
  4703. if (vm.$root === vm) {
  4704. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  4705. return ('') + vm.$options.__file
  4706. }
  4707. return '<Root>'
  4708. }
  4709. var options = typeof vm === 'function' && vm.cid != null
  4710. ? vm.options
  4711. : vm._isVue
  4712. ? vm.$options || vm.constructor.options
  4713. : vm;
  4714. var name = options.name || options._componentTag;
  4715. var file = options.__file;
  4716. if (!name && file) {
  4717. var match = file.match(/([^/\\]+)\.vue$/);
  4718. name = match && match[1];
  4719. }
  4720. return (
  4721. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  4722. (file && includeFile !== false ? (" at " + file) : '')
  4723. )
  4724. };
  4725. var repeat = function (str, n) {
  4726. var res = '';
  4727. while (n) {
  4728. if (n % 2 === 1) { res += str; }
  4729. if (n > 1) { str += str; }
  4730. n >>= 1;
  4731. }
  4732. return res
  4733. };
  4734. generateComponentTrace = function (vm) {
  4735. if (vm._isVue && vm.$parent) {
  4736. var tree = [];
  4737. var currentRecursiveSequence = 0;
  4738. while (vm && vm.$options.name !== 'PageBody') {
  4739. if (tree.length > 0) {
  4740. var last = tree[tree.length - 1];
  4741. if (last.constructor === vm.constructor) {
  4742. currentRecursiveSequence++;
  4743. vm = vm.$parent;
  4744. continue
  4745. } else if (currentRecursiveSequence > 0) {
  4746. tree[tree.length - 1] = [last, currentRecursiveSequence];
  4747. currentRecursiveSequence = 0;
  4748. }
  4749. }
  4750. !vm.$options.isReserved && tree.push(vm);
  4751. vm = vm.$parent;
  4752. }
  4753. return '\n\nfound in\n\n' + tree
  4754. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  4755. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  4756. : formatComponentName(vm))); })
  4757. .join('\n')
  4758. } else {
  4759. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  4760. }
  4761. };
  4762. }
  4763. /* */
  4764. var uid = 0;
  4765. /**
  4766. * A dep is an observable that can have multiple
  4767. * directives subscribing to it.
  4768. */
  4769. var Dep = function Dep () {
  4770. this.id = uid++;
  4771. this.subs = [];
  4772. };
  4773. Dep.prototype.addSub = function addSub (sub) {
  4774. this.subs.push(sub);
  4775. };
  4776. Dep.prototype.removeSub = function removeSub (sub) {
  4777. remove(this.subs, sub);
  4778. };
  4779. Dep.prototype.depend = function depend () {
  4780. if (Dep.SharedObject.target) {
  4781. Dep.SharedObject.target.addDep(this);
  4782. }
  4783. };
  4784. Dep.prototype.notify = function notify () {
  4785. // stabilize the subscriber list first
  4786. var subs = this.subs.slice();
  4787. if ( true && !config.async) {
  4788. // subs aren't sorted in scheduler if not running async
  4789. // we need to sort them now to make sure they fire in correct
  4790. // order
  4791. subs.sort(function (a, b) { return a.id - b.id; });
  4792. }
  4793. for (var i = 0, l = subs.length; i < l; i++) {
  4794. subs[i].update();
  4795. }
  4796. };
  4797. // The current target watcher being evaluated.
  4798. // This is globally unique because only one watcher
  4799. // can be evaluated at a time.
  4800. // fixed by xxxxxx (nvue shared vuex)
  4801. /* eslint-disable no-undef */
  4802. Dep.SharedObject = {};
  4803. Dep.SharedObject.target = null;
  4804. Dep.SharedObject.targetStack = [];
  4805. function pushTarget (target) {
  4806. Dep.SharedObject.targetStack.push(target);
  4807. Dep.SharedObject.target = target;
  4808. Dep.target = target;
  4809. }
  4810. function popTarget () {
  4811. Dep.SharedObject.targetStack.pop();
  4812. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  4813. Dep.target = Dep.SharedObject.target;
  4814. }
  4815. /* */
  4816. var VNode = function VNode (
  4817. tag,
  4818. data,
  4819. children,
  4820. text,
  4821. elm,
  4822. context,
  4823. componentOptions,
  4824. asyncFactory
  4825. ) {
  4826. this.tag = tag;
  4827. this.data = data;
  4828. this.children = children;
  4829. this.text = text;
  4830. this.elm = elm;
  4831. this.ns = undefined;
  4832. this.context = context;
  4833. this.fnContext = undefined;
  4834. this.fnOptions = undefined;
  4835. this.fnScopeId = undefined;
  4836. this.key = data && data.key;
  4837. this.componentOptions = componentOptions;
  4838. this.componentInstance = undefined;
  4839. this.parent = undefined;
  4840. this.raw = false;
  4841. this.isStatic = false;
  4842. this.isRootInsert = true;
  4843. this.isComment = false;
  4844. this.isCloned = false;
  4845. this.isOnce = false;
  4846. this.asyncFactory = asyncFactory;
  4847. this.asyncMeta = undefined;
  4848. this.isAsyncPlaceholder = false;
  4849. };
  4850. var prototypeAccessors = { child: { configurable: true } };
  4851. // DEPRECATED: alias for componentInstance for backwards compat.
  4852. /* istanbul ignore next */
  4853. prototypeAccessors.child.get = function () {
  4854. return this.componentInstance
  4855. };
  4856. Object.defineProperties( VNode.prototype, prototypeAccessors );
  4857. var createEmptyVNode = function (text) {
  4858. if ( text === void 0 ) text = '';
  4859. var node = new VNode();
  4860. node.text = text;
  4861. node.isComment = true;
  4862. return node
  4863. };
  4864. function createTextVNode (val) {
  4865. return new VNode(undefined, undefined, undefined, String(val))
  4866. }
  4867. // optimized shallow clone
  4868. // used for static nodes and slot nodes because they may be reused across
  4869. // multiple renders, cloning them avoids errors when DOM manipulations rely
  4870. // on their elm reference.
  4871. function cloneVNode (vnode) {
  4872. var cloned = new VNode(
  4873. vnode.tag,
  4874. vnode.data,
  4875. // #7975
  4876. // clone children array to avoid mutating original in case of cloning
  4877. // a child.
  4878. vnode.children && vnode.children.slice(),
  4879. vnode.text,
  4880. vnode.elm,
  4881. vnode.context,
  4882. vnode.componentOptions,
  4883. vnode.asyncFactory
  4884. );
  4885. cloned.ns = vnode.ns;
  4886. cloned.isStatic = vnode.isStatic;
  4887. cloned.key = vnode.key;
  4888. cloned.isComment = vnode.isComment;
  4889. cloned.fnContext = vnode.fnContext;
  4890. cloned.fnOptions = vnode.fnOptions;
  4891. cloned.fnScopeId = vnode.fnScopeId;
  4892. cloned.asyncMeta = vnode.asyncMeta;
  4893. cloned.isCloned = true;
  4894. return cloned
  4895. }
  4896. /*
  4897. * not type checking this file because flow doesn't play well with
  4898. * dynamically accessing methods on Array prototype
  4899. */
  4900. var arrayProto = Array.prototype;
  4901. var arrayMethods = Object.create(arrayProto);
  4902. var methodsToPatch = [
  4903. 'push',
  4904. 'pop',
  4905. 'shift',
  4906. 'unshift',
  4907. 'splice',
  4908. 'sort',
  4909. 'reverse'
  4910. ];
  4911. /**
  4912. * Intercept mutating methods and emit events
  4913. */
  4914. methodsToPatch.forEach(function (method) {
  4915. // cache original method
  4916. var original = arrayProto[method];
  4917. def(arrayMethods, method, function mutator () {
  4918. var args = [], len = arguments.length;
  4919. while ( len-- ) args[ len ] = arguments[ len ];
  4920. var result = original.apply(this, args);
  4921. var ob = this.__ob__;
  4922. var inserted;
  4923. switch (method) {
  4924. case 'push':
  4925. case 'unshift':
  4926. inserted = args;
  4927. break
  4928. case 'splice':
  4929. inserted = args.slice(2);
  4930. break
  4931. }
  4932. if (inserted) { ob.observeArray(inserted); }
  4933. // notify change
  4934. ob.dep.notify();
  4935. return result
  4936. });
  4937. });
  4938. /* */
  4939. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  4940. /**
  4941. * In some cases we may want to disable observation inside a component's
  4942. * update computation.
  4943. */
  4944. var shouldObserve = true;
  4945. function toggleObserving (value) {
  4946. shouldObserve = value;
  4947. }
  4948. /**
  4949. * Observer class that is attached to each observed
  4950. * object. Once attached, the observer converts the target
  4951. * object's property keys into getter/setters that
  4952. * collect dependencies and dispatch updates.
  4953. */
  4954. var Observer = function Observer (value) {
  4955. this.value = value;
  4956. this.dep = new Dep();
  4957. this.vmCount = 0;
  4958. def(value, '__ob__', this);
  4959. if (Array.isArray(value)) {
  4960. if (hasProto) {
  4961. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  4962. if(value.push !== value.__proto__.push){
  4963. copyAugment(value, arrayMethods, arrayKeys);
  4964. } else {
  4965. protoAugment(value, arrayMethods);
  4966. }
  4967. }
  4968. } else {
  4969. copyAugment(value, arrayMethods, arrayKeys);
  4970. }
  4971. this.observeArray(value);
  4972. } else {
  4973. this.walk(value);
  4974. }
  4975. };
  4976. /**
  4977. * Walk through all properties and convert them into
  4978. * getter/setters. This method should only be called when
  4979. * value type is Object.
  4980. */
  4981. Observer.prototype.walk = function walk (obj) {
  4982. var keys = Object.keys(obj);
  4983. for (var i = 0; i < keys.length; i++) {
  4984. defineReactive$$1(obj, keys[i]);
  4985. }
  4986. };
  4987. /**
  4988. * Observe a list of Array items.
  4989. */
  4990. Observer.prototype.observeArray = function observeArray (items) {
  4991. for (var i = 0, l = items.length; i < l; i++) {
  4992. observe(items[i]);
  4993. }
  4994. };
  4995. // helpers
  4996. /**
  4997. * Augment a target Object or Array by intercepting
  4998. * the prototype chain using __proto__
  4999. */
  5000. function protoAugment (target, src) {
  5001. /* eslint-disable no-proto */
  5002. target.__proto__ = src;
  5003. /* eslint-enable no-proto */
  5004. }
  5005. /**
  5006. * Augment a target Object or Array by defining
  5007. * hidden properties.
  5008. */
  5009. /* istanbul ignore next */
  5010. function copyAugment (target, src, keys) {
  5011. for (var i = 0, l = keys.length; i < l; i++) {
  5012. var key = keys[i];
  5013. def(target, key, src[key]);
  5014. }
  5015. }
  5016. /**
  5017. * Attempt to create an observer instance for a value,
  5018. * returns the new observer if successfully observed,
  5019. * or the existing observer if the value already has one.
  5020. */
  5021. function observe (value, asRootData) {
  5022. if (!isObject(value) || value instanceof VNode) {
  5023. return
  5024. }
  5025. var ob;
  5026. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  5027. ob = value.__ob__;
  5028. } else if (
  5029. shouldObserve &&
  5030. !isServerRendering() &&
  5031. (Array.isArray(value) || isPlainObject(value)) &&
  5032. Object.isExtensible(value) &&
  5033. !value._isVue &&
  5034. !value.__v_isMPComponent
  5035. ) {
  5036. ob = new Observer(value);
  5037. }
  5038. if (asRootData && ob) {
  5039. ob.vmCount++;
  5040. }
  5041. return ob
  5042. }
  5043. /**
  5044. * Define a reactive property on an Object.
  5045. */
  5046. function defineReactive$$1 (
  5047. obj,
  5048. key,
  5049. val,
  5050. customSetter,
  5051. shallow
  5052. ) {
  5053. var dep = new Dep();
  5054. var property = Object.getOwnPropertyDescriptor(obj, key);
  5055. if (property && property.configurable === false) {
  5056. return
  5057. }
  5058. // cater for pre-defined getter/setters
  5059. var getter = property && property.get;
  5060. var setter = property && property.set;
  5061. if ((!getter || setter) && arguments.length === 2) {
  5062. val = obj[key];
  5063. }
  5064. var childOb = !shallow && observe(val);
  5065. Object.defineProperty(obj, key, {
  5066. enumerable: true,
  5067. configurable: true,
  5068. get: function reactiveGetter () {
  5069. var value = getter ? getter.call(obj) : val;
  5070. if (Dep.SharedObject.target) { // fixed by xxxxxx
  5071. dep.depend();
  5072. if (childOb) {
  5073. childOb.dep.depend();
  5074. if (Array.isArray(value)) {
  5075. dependArray(value);
  5076. }
  5077. }
  5078. }
  5079. return value
  5080. },
  5081. set: function reactiveSetter (newVal) {
  5082. var value = getter ? getter.call(obj) : val;
  5083. /* eslint-disable no-self-compare */
  5084. if (newVal === value || (newVal !== newVal && value !== value)) {
  5085. return
  5086. }
  5087. /* eslint-enable no-self-compare */
  5088. if ( true && customSetter) {
  5089. customSetter();
  5090. }
  5091. // #7981: for accessor properties without setter
  5092. if (getter && !setter) { return }
  5093. if (setter) {
  5094. setter.call(obj, newVal);
  5095. } else {
  5096. val = newVal;
  5097. }
  5098. childOb = !shallow && observe(newVal);
  5099. dep.notify();
  5100. }
  5101. });
  5102. }
  5103. /**
  5104. * Set a property on an object. Adds the new property and
  5105. * triggers change notification if the property doesn't
  5106. * already exist.
  5107. */
  5108. function set (target, key, val) {
  5109. if ( true &&
  5110. (isUndef(target) || isPrimitive(target))
  5111. ) {
  5112. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  5113. }
  5114. if (Array.isArray(target) && isValidArrayIndex(key)) {
  5115. target.length = Math.max(target.length, key);
  5116. target.splice(key, 1, val);
  5117. return val
  5118. }
  5119. if (key in target && !(key in Object.prototype)) {
  5120. target[key] = val;
  5121. return val
  5122. }
  5123. var ob = (target).__ob__;
  5124. if (target._isVue || (ob && ob.vmCount)) {
  5125. true && warn(
  5126. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  5127. 'at runtime - declare it upfront in the data option.'
  5128. );
  5129. return val
  5130. }
  5131. if (!ob) {
  5132. target[key] = val;
  5133. return val
  5134. }
  5135. defineReactive$$1(ob.value, key, val);
  5136. ob.dep.notify();
  5137. return val
  5138. }
  5139. /**
  5140. * Delete a property and trigger change if necessary.
  5141. */
  5142. function del (target, key) {
  5143. if ( true &&
  5144. (isUndef(target) || isPrimitive(target))
  5145. ) {
  5146. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  5147. }
  5148. if (Array.isArray(target) && isValidArrayIndex(key)) {
  5149. target.splice(key, 1);
  5150. return
  5151. }
  5152. var ob = (target).__ob__;
  5153. if (target._isVue || (ob && ob.vmCount)) {
  5154. true && warn(
  5155. 'Avoid deleting properties on a Vue instance or its root $data ' +
  5156. '- just set it to null.'
  5157. );
  5158. return
  5159. }
  5160. if (!hasOwn(target, key)) {
  5161. return
  5162. }
  5163. delete target[key];
  5164. if (!ob) {
  5165. return
  5166. }
  5167. ob.dep.notify();
  5168. }
  5169. /**
  5170. * Collect dependencies on array elements when the array is touched, since
  5171. * we cannot intercept array element access like property getters.
  5172. */
  5173. function dependArray (value) {
  5174. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  5175. e = value[i];
  5176. e && e.__ob__ && e.__ob__.dep.depend();
  5177. if (Array.isArray(e)) {
  5178. dependArray(e);
  5179. }
  5180. }
  5181. }
  5182. /* */
  5183. /**
  5184. * Option overwriting strategies are functions that handle
  5185. * how to merge a parent option value and a child option
  5186. * value into the final value.
  5187. */
  5188. var strats = config.optionMergeStrategies;
  5189. /**
  5190. * Options with restrictions
  5191. */
  5192. if (true) {
  5193. strats.el = strats.propsData = function (parent, child, vm, key) {
  5194. if (!vm) {
  5195. warn(
  5196. "option \"" + key + "\" can only be used during instance " +
  5197. 'creation with the `new` keyword.'
  5198. );
  5199. }
  5200. return defaultStrat(parent, child)
  5201. };
  5202. }
  5203. /**
  5204. * Helper that recursively merges two data objects together.
  5205. */
  5206. function mergeData (to, from) {
  5207. if (!from) { return to }
  5208. var key, toVal, fromVal;
  5209. var keys = hasSymbol
  5210. ? Reflect.ownKeys(from)
  5211. : Object.keys(from);
  5212. for (var i = 0; i < keys.length; i++) {
  5213. key = keys[i];
  5214. // in case the object is already observed...
  5215. if (key === '__ob__') { continue }
  5216. toVal = to[key];
  5217. fromVal = from[key];
  5218. if (!hasOwn(to, key)) {
  5219. set(to, key, fromVal);
  5220. } else if (
  5221. toVal !== fromVal &&
  5222. isPlainObject(toVal) &&
  5223. isPlainObject(fromVal)
  5224. ) {
  5225. mergeData(toVal, fromVal);
  5226. }
  5227. }
  5228. return to
  5229. }
  5230. /**
  5231. * Data
  5232. */
  5233. function mergeDataOrFn (
  5234. parentVal,
  5235. childVal,
  5236. vm
  5237. ) {
  5238. if (!vm) {
  5239. // in a Vue.extend merge, both should be functions
  5240. if (!childVal) {
  5241. return parentVal
  5242. }
  5243. if (!parentVal) {
  5244. return childVal
  5245. }
  5246. // when parentVal & childVal are both present,
  5247. // we need to return a function that returns the
  5248. // merged result of both functions... no need to
  5249. // check if parentVal is a function here because
  5250. // it has to be a function to pass previous merges.
  5251. return function mergedDataFn () {
  5252. return mergeData(
  5253. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  5254. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  5255. )
  5256. }
  5257. } else {
  5258. return function mergedInstanceDataFn () {
  5259. // instance merge
  5260. var instanceData = typeof childVal === 'function'
  5261. ? childVal.call(vm, vm)
  5262. : childVal;
  5263. var defaultData = typeof parentVal === 'function'
  5264. ? parentVal.call(vm, vm)
  5265. : parentVal;
  5266. if (instanceData) {
  5267. return mergeData(instanceData, defaultData)
  5268. } else {
  5269. return defaultData
  5270. }
  5271. }
  5272. }
  5273. }
  5274. strats.data = function (
  5275. parentVal,
  5276. childVal,
  5277. vm
  5278. ) {
  5279. if (!vm) {
  5280. if (childVal && typeof childVal !== 'function') {
  5281. true && warn(
  5282. 'The "data" option should be a function ' +
  5283. 'that returns a per-instance value in component ' +
  5284. 'definitions.',
  5285. vm
  5286. );
  5287. return parentVal
  5288. }
  5289. return mergeDataOrFn(parentVal, childVal)
  5290. }
  5291. return mergeDataOrFn(parentVal, childVal, vm)
  5292. };
  5293. /**
  5294. * Hooks and props are merged as arrays.
  5295. */
  5296. function mergeHook (
  5297. parentVal,
  5298. childVal
  5299. ) {
  5300. var res = childVal
  5301. ? parentVal
  5302. ? parentVal.concat(childVal)
  5303. : Array.isArray(childVal)
  5304. ? childVal
  5305. : [childVal]
  5306. : parentVal;
  5307. return res
  5308. ? dedupeHooks(res)
  5309. : res
  5310. }
  5311. function dedupeHooks (hooks) {
  5312. var res = [];
  5313. for (var i = 0; i < hooks.length; i++) {
  5314. if (res.indexOf(hooks[i]) === -1) {
  5315. res.push(hooks[i]);
  5316. }
  5317. }
  5318. return res
  5319. }
  5320. LIFECYCLE_HOOKS.forEach(function (hook) {
  5321. strats[hook] = mergeHook;
  5322. });
  5323. /**
  5324. * Assets
  5325. *
  5326. * When a vm is present (instance creation), we need to do
  5327. * a three-way merge between constructor options, instance
  5328. * options and parent options.
  5329. */
  5330. function mergeAssets (
  5331. parentVal,
  5332. childVal,
  5333. vm,
  5334. key
  5335. ) {
  5336. var res = Object.create(parentVal || null);
  5337. if (childVal) {
  5338. true && assertObjectType(key, childVal, vm);
  5339. return extend(res, childVal)
  5340. } else {
  5341. return res
  5342. }
  5343. }
  5344. ASSET_TYPES.forEach(function (type) {
  5345. strats[type + 's'] = mergeAssets;
  5346. });
  5347. /**
  5348. * Watchers.
  5349. *
  5350. * Watchers hashes should not overwrite one
  5351. * another, so we merge them as arrays.
  5352. */
  5353. strats.watch = function (
  5354. parentVal,
  5355. childVal,
  5356. vm,
  5357. key
  5358. ) {
  5359. // work around Firefox's Object.prototype.watch...
  5360. if (parentVal === nativeWatch) { parentVal = undefined; }
  5361. if (childVal === nativeWatch) { childVal = undefined; }
  5362. /* istanbul ignore if */
  5363. if (!childVal) { return Object.create(parentVal || null) }
  5364. if (true) {
  5365. assertObjectType(key, childVal, vm);
  5366. }
  5367. if (!parentVal) { return childVal }
  5368. var ret = {};
  5369. extend(ret, parentVal);
  5370. for (var key$1 in childVal) {
  5371. var parent = ret[key$1];
  5372. var child = childVal[key$1];
  5373. if (parent && !Array.isArray(parent)) {
  5374. parent = [parent];
  5375. }
  5376. ret[key$1] = parent
  5377. ? parent.concat(child)
  5378. : Array.isArray(child) ? child : [child];
  5379. }
  5380. return ret
  5381. };
  5382. /**
  5383. * Other object hashes.
  5384. */
  5385. strats.props =
  5386. strats.methods =
  5387. strats.inject =
  5388. strats.computed = function (
  5389. parentVal,
  5390. childVal,
  5391. vm,
  5392. key
  5393. ) {
  5394. if (childVal && "development" !== 'production') {
  5395. assertObjectType(key, childVal, vm);
  5396. }
  5397. if (!parentVal) { return childVal }
  5398. var ret = Object.create(null);
  5399. extend(ret, parentVal);
  5400. if (childVal) { extend(ret, childVal); }
  5401. return ret
  5402. };
  5403. strats.provide = mergeDataOrFn;
  5404. /**
  5405. * Default strategy.
  5406. */
  5407. var defaultStrat = function (parentVal, childVal) {
  5408. return childVal === undefined
  5409. ? parentVal
  5410. : childVal
  5411. };
  5412. /**
  5413. * Validate component names
  5414. */
  5415. function checkComponents (options) {
  5416. for (var key in options.components) {
  5417. validateComponentName(key);
  5418. }
  5419. }
  5420. function validateComponentName (name) {
  5421. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  5422. warn(
  5423. 'Invalid component name: "' + name + '". Component names ' +
  5424. 'should conform to valid custom element name in html5 specification.'
  5425. );
  5426. }
  5427. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  5428. warn(
  5429. 'Do not use built-in or reserved HTML elements as component ' +
  5430. 'id: ' + name
  5431. );
  5432. }
  5433. }
  5434. /**
  5435. * Ensure all props option syntax are normalized into the
  5436. * Object-based format.
  5437. */
  5438. function normalizeProps (options, vm) {
  5439. var props = options.props;
  5440. if (!props) { return }
  5441. var res = {};
  5442. var i, val, name;
  5443. if (Array.isArray(props)) {
  5444. i = props.length;
  5445. while (i--) {
  5446. val = props[i];
  5447. if (typeof val === 'string') {
  5448. name = camelize(val);
  5449. res[name] = { type: null };
  5450. } else if (true) {
  5451. warn('props must be strings when using array syntax.');
  5452. }
  5453. }
  5454. } else if (isPlainObject(props)) {
  5455. for (var key in props) {
  5456. val = props[key];
  5457. name = camelize(key);
  5458. res[name] = isPlainObject(val)
  5459. ? val
  5460. : { type: val };
  5461. }
  5462. } else if (true) {
  5463. warn(
  5464. "Invalid value for option \"props\": expected an Array or an Object, " +
  5465. "but got " + (toRawType(props)) + ".",
  5466. vm
  5467. );
  5468. }
  5469. options.props = res;
  5470. }
  5471. /**
  5472. * Normalize all injections into Object-based format
  5473. */
  5474. function normalizeInject (options, vm) {
  5475. var inject = options.inject;
  5476. if (!inject) { return }
  5477. var normalized = options.inject = {};
  5478. if (Array.isArray(inject)) {
  5479. for (var i = 0; i < inject.length; i++) {
  5480. normalized[inject[i]] = { from: inject[i] };
  5481. }
  5482. } else if (isPlainObject(inject)) {
  5483. for (var key in inject) {
  5484. var val = inject[key];
  5485. normalized[key] = isPlainObject(val)
  5486. ? extend({ from: key }, val)
  5487. : { from: val };
  5488. }
  5489. } else if (true) {
  5490. warn(
  5491. "Invalid value for option \"inject\": expected an Array or an Object, " +
  5492. "but got " + (toRawType(inject)) + ".",
  5493. vm
  5494. );
  5495. }
  5496. }
  5497. /**
  5498. * Normalize raw function directives into object format.
  5499. */
  5500. function normalizeDirectives (options) {
  5501. var dirs = options.directives;
  5502. if (dirs) {
  5503. for (var key in dirs) {
  5504. var def$$1 = dirs[key];
  5505. if (typeof def$$1 === 'function') {
  5506. dirs[key] = { bind: def$$1, update: def$$1 };
  5507. }
  5508. }
  5509. }
  5510. }
  5511. function assertObjectType (name, value, vm) {
  5512. if (!isPlainObject(value)) {
  5513. warn(
  5514. "Invalid value for option \"" + name + "\": expected an Object, " +
  5515. "but got " + (toRawType(value)) + ".",
  5516. vm
  5517. );
  5518. }
  5519. }
  5520. /**
  5521. * Merge two option objects into a new one.
  5522. * Core utility used in both instantiation and inheritance.
  5523. */
  5524. function mergeOptions (
  5525. parent,
  5526. child,
  5527. vm
  5528. ) {
  5529. if (true) {
  5530. checkComponents(child);
  5531. }
  5532. if (typeof child === 'function') {
  5533. child = child.options;
  5534. }
  5535. normalizeProps(child, vm);
  5536. normalizeInject(child, vm);
  5537. normalizeDirectives(child);
  5538. // Apply extends and mixins on the child options,
  5539. // but only if it is a raw options object that isn't
  5540. // the result of another mergeOptions call.
  5541. // Only merged options has the _base property.
  5542. if (!child._base) {
  5543. if (child.extends) {
  5544. parent = mergeOptions(parent, child.extends, vm);
  5545. }
  5546. if (child.mixins) {
  5547. for (var i = 0, l = child.mixins.length; i < l; i++) {
  5548. parent = mergeOptions(parent, child.mixins[i], vm);
  5549. }
  5550. }
  5551. }
  5552. var options = {};
  5553. var key;
  5554. for (key in parent) {
  5555. mergeField(key);
  5556. }
  5557. for (key in child) {
  5558. if (!hasOwn(parent, key)) {
  5559. mergeField(key);
  5560. }
  5561. }
  5562. function mergeField (key) {
  5563. var strat = strats[key] || defaultStrat;
  5564. options[key] = strat(parent[key], child[key], vm, key);
  5565. }
  5566. return options
  5567. }
  5568. /**
  5569. * Resolve an asset.
  5570. * This function is used because child instances need access
  5571. * to assets defined in its ancestor chain.
  5572. */
  5573. function resolveAsset (
  5574. options,
  5575. type,
  5576. id,
  5577. warnMissing
  5578. ) {
  5579. /* istanbul ignore if */
  5580. if (typeof id !== 'string') {
  5581. return
  5582. }
  5583. var assets = options[type];
  5584. // check local registration variations first
  5585. if (hasOwn(assets, id)) { return assets[id] }
  5586. var camelizedId = camelize(id);
  5587. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  5588. var PascalCaseId = capitalize(camelizedId);
  5589. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  5590. // fallback to prototype chain
  5591. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  5592. if ( true && warnMissing && !res) {
  5593. warn(
  5594. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  5595. options
  5596. );
  5597. }
  5598. return res
  5599. }
  5600. /* */
  5601. function validateProp (
  5602. key,
  5603. propOptions,
  5604. propsData,
  5605. vm
  5606. ) {
  5607. var prop = propOptions[key];
  5608. var absent = !hasOwn(propsData, key);
  5609. var value = propsData[key];
  5610. // boolean casting
  5611. var booleanIndex = getTypeIndex(Boolean, prop.type);
  5612. if (booleanIndex > -1) {
  5613. if (absent && !hasOwn(prop, 'default')) {
  5614. value = false;
  5615. } else if (value === '' || value === hyphenate(key)) {
  5616. // only cast empty string / same name to boolean if
  5617. // boolean has higher priority
  5618. var stringIndex = getTypeIndex(String, prop.type);
  5619. if (stringIndex < 0 || booleanIndex < stringIndex) {
  5620. value = true;
  5621. }
  5622. }
  5623. }
  5624. // check default value
  5625. if (value === undefined) {
  5626. value = getPropDefaultValue(vm, prop, key);
  5627. // since the default value is a fresh copy,
  5628. // make sure to observe it.
  5629. var prevShouldObserve = shouldObserve;
  5630. toggleObserving(true);
  5631. observe(value);
  5632. toggleObserving(prevShouldObserve);
  5633. }
  5634. if (
  5635. true
  5636. ) {
  5637. assertProp(prop, key, value, vm, absent);
  5638. }
  5639. return value
  5640. }
  5641. /**
  5642. * Get the default value of a prop.
  5643. */
  5644. function getPropDefaultValue (vm, prop, key) {
  5645. // no default, return undefined
  5646. if (!hasOwn(prop, 'default')) {
  5647. return undefined
  5648. }
  5649. var def = prop.default;
  5650. // warn against non-factory defaults for Object & Array
  5651. if ( true && isObject(def)) {
  5652. warn(
  5653. 'Invalid default value for prop "' + key + '": ' +
  5654. 'Props with type Object/Array must use a factory function ' +
  5655. 'to return the default value.',
  5656. vm
  5657. );
  5658. }
  5659. // the raw prop value was also undefined from previous render,
  5660. // return previous default value to avoid unnecessary watcher trigger
  5661. if (vm && vm.$options.propsData &&
  5662. vm.$options.propsData[key] === undefined &&
  5663. vm._props[key] !== undefined
  5664. ) {
  5665. return vm._props[key]
  5666. }
  5667. // call factory function for non-Function types
  5668. // a value is Function if its prototype is function even across different execution context
  5669. return typeof def === 'function' && getType(prop.type) !== 'Function'
  5670. ? def.call(vm)
  5671. : def
  5672. }
  5673. /**
  5674. * Assert whether a prop is valid.
  5675. */
  5676. function assertProp (
  5677. prop,
  5678. name,
  5679. value,
  5680. vm,
  5681. absent
  5682. ) {
  5683. if (prop.required && absent) {
  5684. warn(
  5685. 'Missing required prop: "' + name + '"',
  5686. vm
  5687. );
  5688. return
  5689. }
  5690. if (value == null && !prop.required) {
  5691. return
  5692. }
  5693. var type = prop.type;
  5694. var valid = !type || type === true;
  5695. var expectedTypes = [];
  5696. if (type) {
  5697. if (!Array.isArray(type)) {
  5698. type = [type];
  5699. }
  5700. for (var i = 0; i < type.length && !valid; i++) {
  5701. var assertedType = assertType(value, type[i]);
  5702. expectedTypes.push(assertedType.expectedType || '');
  5703. valid = assertedType.valid;
  5704. }
  5705. }
  5706. if (!valid) {
  5707. warn(
  5708. getInvalidTypeMessage(name, value, expectedTypes),
  5709. vm
  5710. );
  5711. return
  5712. }
  5713. var validator = prop.validator;
  5714. if (validator) {
  5715. if (!validator(value)) {
  5716. warn(
  5717. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  5718. vm
  5719. );
  5720. }
  5721. }
  5722. }
  5723. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  5724. function assertType (value, type) {
  5725. var valid;
  5726. var expectedType = getType(type);
  5727. if (simpleCheckRE.test(expectedType)) {
  5728. var t = typeof value;
  5729. valid = t === expectedType.toLowerCase();
  5730. // for primitive wrapper objects
  5731. if (!valid && t === 'object') {
  5732. valid = value instanceof type;
  5733. }
  5734. } else if (expectedType === 'Object') {
  5735. valid = isPlainObject(value);
  5736. } else if (expectedType === 'Array') {
  5737. valid = Array.isArray(value);
  5738. } else {
  5739. valid = value instanceof type;
  5740. }
  5741. return {
  5742. valid: valid,
  5743. expectedType: expectedType
  5744. }
  5745. }
  5746. /**
  5747. * Use function string name to check built-in types,
  5748. * because a simple equality check will fail when running
  5749. * across different vms / iframes.
  5750. */
  5751. function getType (fn) {
  5752. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  5753. return match ? match[1] : ''
  5754. }
  5755. function isSameType (a, b) {
  5756. return getType(a) === getType(b)
  5757. }
  5758. function getTypeIndex (type, expectedTypes) {
  5759. if (!Array.isArray(expectedTypes)) {
  5760. return isSameType(expectedTypes, type) ? 0 : -1
  5761. }
  5762. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  5763. if (isSameType(expectedTypes[i], type)) {
  5764. return i
  5765. }
  5766. }
  5767. return -1
  5768. }
  5769. function getInvalidTypeMessage (name, value, expectedTypes) {
  5770. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  5771. " Expected " + (expectedTypes.map(capitalize).join(', '));
  5772. var expectedType = expectedTypes[0];
  5773. var receivedType = toRawType(value);
  5774. var expectedValue = styleValue(value, expectedType);
  5775. var receivedValue = styleValue(value, receivedType);
  5776. // check if we need to specify expected value
  5777. if (expectedTypes.length === 1 &&
  5778. isExplicable(expectedType) &&
  5779. !isBoolean(expectedType, receivedType)) {
  5780. message += " with value " + expectedValue;
  5781. }
  5782. message += ", got " + receivedType + " ";
  5783. // check if we need to specify received value
  5784. if (isExplicable(receivedType)) {
  5785. message += "with value " + receivedValue + ".";
  5786. }
  5787. return message
  5788. }
  5789. function styleValue (value, type) {
  5790. if (type === 'String') {
  5791. return ("\"" + value + "\"")
  5792. } else if (type === 'Number') {
  5793. return ("" + (Number(value)))
  5794. } else {
  5795. return ("" + value)
  5796. }
  5797. }
  5798. function isExplicable (value) {
  5799. var explicitTypes = ['string', 'number', 'boolean'];
  5800. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  5801. }
  5802. function isBoolean () {
  5803. var args = [], len = arguments.length;
  5804. while ( len-- ) args[ len ] = arguments[ len ];
  5805. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  5806. }
  5807. /* */
  5808. function handleError (err, vm, info) {
  5809. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  5810. // See: https://github.com/vuejs/vuex/issues/1505
  5811. pushTarget();
  5812. try {
  5813. if (vm) {
  5814. var cur = vm;
  5815. while ((cur = cur.$parent)) {
  5816. var hooks = cur.$options.errorCaptured;
  5817. if (hooks) {
  5818. for (var i = 0; i < hooks.length; i++) {
  5819. try {
  5820. var capture = hooks[i].call(cur, err, vm, info) === false;
  5821. if (capture) { return }
  5822. } catch (e) {
  5823. globalHandleError(e, cur, 'errorCaptured hook');
  5824. }
  5825. }
  5826. }
  5827. }
  5828. }
  5829. globalHandleError(err, vm, info);
  5830. } finally {
  5831. popTarget();
  5832. }
  5833. }
  5834. function invokeWithErrorHandling (
  5835. handler,
  5836. context,
  5837. args,
  5838. vm,
  5839. info
  5840. ) {
  5841. var res;
  5842. try {
  5843. res = args ? handler.apply(context, args) : handler.call(context);
  5844. if (res && !res._isVue && isPromise(res) && !res._handled) {
  5845. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  5846. // issue #9511
  5847. // avoid catch triggering multiple times when nested calls
  5848. res._handled = true;
  5849. }
  5850. } catch (e) {
  5851. handleError(e, vm, info);
  5852. }
  5853. return res
  5854. }
  5855. function globalHandleError (err, vm, info) {
  5856. if (config.errorHandler) {
  5857. try {
  5858. return config.errorHandler.call(null, err, vm, info)
  5859. } catch (e) {
  5860. // if the user intentionally throws the original error in the handler,
  5861. // do not log it twice
  5862. if (e !== err) {
  5863. logError(e, null, 'config.errorHandler');
  5864. }
  5865. }
  5866. }
  5867. logError(err, vm, info);
  5868. }
  5869. function logError (err, vm, info) {
  5870. if (true) {
  5871. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  5872. }
  5873. /* istanbul ignore else */
  5874. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  5875. console.error(err);
  5876. } else {
  5877. throw err
  5878. }
  5879. }
  5880. /* */
  5881. var callbacks = [];
  5882. var pending = false;
  5883. function flushCallbacks () {
  5884. pending = false;
  5885. var copies = callbacks.slice(0);
  5886. callbacks.length = 0;
  5887. for (var i = 0; i < copies.length; i++) {
  5888. copies[i]();
  5889. }
  5890. }
  5891. // Here we have async deferring wrappers using microtasks.
  5892. // In 2.5 we used (macro) tasks (in combination with microtasks).
  5893. // However, it has subtle problems when state is changed right before repaint
  5894. // (e.g. #6813, out-in transitions).
  5895. // Also, using (macro) tasks in event handler would cause some weird behaviors
  5896. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  5897. // So we now use microtasks everywhere, again.
  5898. // A major drawback of this tradeoff is that there are some scenarios
  5899. // where microtasks have too high a priority and fire in between supposedly
  5900. // sequential events (e.g. #4521, #6690, which have workarounds)
  5901. // or even between bubbling of the same event (#6566).
  5902. var timerFunc;
  5903. // The nextTick behavior leverages the microtask queue, which can be accessed
  5904. // via either native Promise.then or MutationObserver.
  5905. // MutationObserver has wider support, however it is seriously bugged in
  5906. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  5907. // completely stops working after triggering a few times... so, if native
  5908. // Promise is available, we will use it:
  5909. /* istanbul ignore next, $flow-disable-line */
  5910. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  5911. var p = Promise.resolve();
  5912. timerFunc = function () {
  5913. p.then(flushCallbacks);
  5914. // In problematic UIWebViews, Promise.then doesn't completely break, but
  5915. // it can get stuck in a weird state where callbacks are pushed into the
  5916. // microtask queue but the queue isn't being flushed, until the browser
  5917. // needs to do some other work, e.g. handle a timer. Therefore we can
  5918. // "force" the microtask queue to be flushed by adding an empty timer.
  5919. if (isIOS) { setTimeout(noop); }
  5920. };
  5921. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  5922. isNative(MutationObserver) ||
  5923. // PhantomJS and iOS 7.x
  5924. MutationObserver.toString() === '[object MutationObserverConstructor]'
  5925. )) {
  5926. // Use MutationObserver where native Promise is not available,
  5927. // e.g. PhantomJS, iOS7, Android 4.4
  5928. // (#6466 MutationObserver is unreliable in IE11)
  5929. var counter = 1;
  5930. var observer = new MutationObserver(flushCallbacks);
  5931. var textNode = document.createTextNode(String(counter));
  5932. observer.observe(textNode, {
  5933. characterData: true
  5934. });
  5935. timerFunc = function () {
  5936. counter = (counter + 1) % 2;
  5937. textNode.data = String(counter);
  5938. };
  5939. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  5940. // Fallback to setImmediate.
  5941. // Technically it leverages the (macro) task queue,
  5942. // but it is still a better choice than setTimeout.
  5943. timerFunc = function () {
  5944. setImmediate(flushCallbacks);
  5945. };
  5946. } else {
  5947. // Fallback to setTimeout.
  5948. timerFunc = function () {
  5949. setTimeout(flushCallbacks, 0);
  5950. };
  5951. }
  5952. function nextTick (cb, ctx) {
  5953. var _resolve;
  5954. callbacks.push(function () {
  5955. if (cb) {
  5956. try {
  5957. cb.call(ctx);
  5958. } catch (e) {
  5959. handleError(e, ctx, 'nextTick');
  5960. }
  5961. } else if (_resolve) {
  5962. _resolve(ctx);
  5963. }
  5964. });
  5965. if (!pending) {
  5966. pending = true;
  5967. timerFunc();
  5968. }
  5969. // $flow-disable-line
  5970. if (!cb && typeof Promise !== 'undefined') {
  5971. return new Promise(function (resolve) {
  5972. _resolve = resolve;
  5973. })
  5974. }
  5975. }
  5976. /* */
  5977. /* not type checking this file because flow doesn't play well with Proxy */
  5978. var initProxy;
  5979. if (true) {
  5980. var allowedGlobals = makeMap(
  5981. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  5982. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  5983. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  5984. 'require' // for Webpack/Browserify
  5985. );
  5986. var warnNonPresent = function (target, key) {
  5987. warn(
  5988. "Property or method \"" + key + "\" is not defined on the instance but " +
  5989. 'referenced during render. Make sure that this property is reactive, ' +
  5990. 'either in the data option, or for class-based components, by ' +
  5991. 'initializing the property. ' +
  5992. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  5993. target
  5994. );
  5995. };
  5996. var warnReservedPrefix = function (target, key) {
  5997. warn(
  5998. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  5999. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  6000. 'prevent conflicts with Vue internals. ' +
  6001. 'See: https://vuejs.org/v2/api/#data',
  6002. target
  6003. );
  6004. };
  6005. var hasProxy =
  6006. typeof Proxy !== 'undefined' && isNative(Proxy);
  6007. if (hasProxy) {
  6008. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  6009. config.keyCodes = new Proxy(config.keyCodes, {
  6010. set: function set (target, key, value) {
  6011. if (isBuiltInModifier(key)) {
  6012. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  6013. return false
  6014. } else {
  6015. target[key] = value;
  6016. return true
  6017. }
  6018. }
  6019. });
  6020. }
  6021. var hasHandler = {
  6022. has: function has (target, key) {
  6023. var has = key in target;
  6024. var isAllowed = allowedGlobals(key) ||
  6025. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  6026. if (!has && !isAllowed) {
  6027. if (key in target.$data) { warnReservedPrefix(target, key); }
  6028. else { warnNonPresent(target, key); }
  6029. }
  6030. return has || !isAllowed
  6031. }
  6032. };
  6033. var getHandler = {
  6034. get: function get (target, key) {
  6035. if (typeof key === 'string' && !(key in target)) {
  6036. if (key in target.$data) { warnReservedPrefix(target, key); }
  6037. else { warnNonPresent(target, key); }
  6038. }
  6039. return target[key]
  6040. }
  6041. };
  6042. initProxy = function initProxy (vm) {
  6043. if (hasProxy) {
  6044. // determine which proxy handler to use
  6045. var options = vm.$options;
  6046. var handlers = options.render && options.render._withStripped
  6047. ? getHandler
  6048. : hasHandler;
  6049. vm._renderProxy = new Proxy(vm, handlers);
  6050. } else {
  6051. vm._renderProxy = vm;
  6052. }
  6053. };
  6054. }
  6055. /* */
  6056. var seenObjects = new _Set();
  6057. /**
  6058. * Recursively traverse an object to evoke all converted
  6059. * getters, so that every nested property inside the object
  6060. * is collected as a "deep" dependency.
  6061. */
  6062. function traverse (val) {
  6063. _traverse(val, seenObjects);
  6064. seenObjects.clear();
  6065. }
  6066. function _traverse (val, seen) {
  6067. var i, keys;
  6068. var isA = Array.isArray(val);
  6069. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  6070. return
  6071. }
  6072. if (val.__ob__) {
  6073. var depId = val.__ob__.dep.id;
  6074. if (seen.has(depId)) {
  6075. return
  6076. }
  6077. seen.add(depId);
  6078. }
  6079. if (isA) {
  6080. i = val.length;
  6081. while (i--) { _traverse(val[i], seen); }
  6082. } else {
  6083. keys = Object.keys(val);
  6084. i = keys.length;
  6085. while (i--) { _traverse(val[keys[i]], seen); }
  6086. }
  6087. }
  6088. var mark;
  6089. var measure;
  6090. if (true) {
  6091. var perf = inBrowser && window.performance;
  6092. /* istanbul ignore if */
  6093. if (
  6094. perf &&
  6095. perf.mark &&
  6096. perf.measure &&
  6097. perf.clearMarks &&
  6098. perf.clearMeasures
  6099. ) {
  6100. mark = function (tag) { return perf.mark(tag); };
  6101. measure = function (name, startTag, endTag) {
  6102. perf.measure(name, startTag, endTag);
  6103. perf.clearMarks(startTag);
  6104. perf.clearMarks(endTag);
  6105. // perf.clearMeasures(name)
  6106. };
  6107. }
  6108. }
  6109. /* */
  6110. var normalizeEvent = cached(function (name) {
  6111. var passive = name.charAt(0) === '&';
  6112. name = passive ? name.slice(1) : name;
  6113. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  6114. name = once$$1 ? name.slice(1) : name;
  6115. var capture = name.charAt(0) === '!';
  6116. name = capture ? name.slice(1) : name;
  6117. return {
  6118. name: name,
  6119. once: once$$1,
  6120. capture: capture,
  6121. passive: passive
  6122. }
  6123. });
  6124. function createFnInvoker (fns, vm) {
  6125. function invoker () {
  6126. var arguments$1 = arguments;
  6127. var fns = invoker.fns;
  6128. if (Array.isArray(fns)) {
  6129. var cloned = fns.slice();
  6130. for (var i = 0; i < cloned.length; i++) {
  6131. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  6132. }
  6133. } else {
  6134. // return handler return value for single handlers
  6135. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  6136. }
  6137. }
  6138. invoker.fns = fns;
  6139. return invoker
  6140. }
  6141. function updateListeners (
  6142. on,
  6143. oldOn,
  6144. add,
  6145. remove$$1,
  6146. createOnceHandler,
  6147. vm
  6148. ) {
  6149. var name, def$$1, cur, old, event;
  6150. for (name in on) {
  6151. def$$1 = cur = on[name];
  6152. old = oldOn[name];
  6153. event = normalizeEvent(name);
  6154. if (isUndef(cur)) {
  6155. true && warn(
  6156. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  6157. vm
  6158. );
  6159. } else if (isUndef(old)) {
  6160. if (isUndef(cur.fns)) {
  6161. cur = on[name] = createFnInvoker(cur, vm);
  6162. }
  6163. if (isTrue(event.once)) {
  6164. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  6165. }
  6166. add(event.name, cur, event.capture, event.passive, event.params);
  6167. } else if (cur !== old) {
  6168. old.fns = cur;
  6169. on[name] = old;
  6170. }
  6171. }
  6172. for (name in oldOn) {
  6173. if (isUndef(on[name])) {
  6174. event = normalizeEvent(name);
  6175. remove$$1(event.name, oldOn[name], event.capture);
  6176. }
  6177. }
  6178. }
  6179. /* */
  6180. /* */
  6181. // fixed by xxxxxx (mp properties)
  6182. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  6183. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  6184. if (isUndef(propOptions)) {
  6185. return res
  6186. }
  6187. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  6188. var attrs = data.attrs;
  6189. var props = data.props;
  6190. if (isDef(attrs) || isDef(props)) {
  6191. for (var key in propOptions) {
  6192. var altKey = hyphenate(key);
  6193. var result = checkProp(res, props, key, altKey, true) ||
  6194. checkProp(res, attrs, key, altKey, false);
  6195. // externalClass
  6196. if (
  6197. result &&
  6198. res[key] &&
  6199. externalClasses.indexOf(altKey) !== -1 &&
  6200. context[camelize(res[key])]
  6201. ) {
  6202. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  6203. res[key] = context[camelize(res[key])];
  6204. }
  6205. }
  6206. }
  6207. return res
  6208. }
  6209. function extractPropsFromVNodeData (
  6210. data,
  6211. Ctor,
  6212. tag,
  6213. context// fixed by xxxxxx
  6214. ) {
  6215. // we are only extracting raw values here.
  6216. // validation and default values are handled in the child
  6217. // component itself.
  6218. var propOptions = Ctor.options.props;
  6219. if (isUndef(propOptions)) {
  6220. // fixed by xxxxxx
  6221. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  6222. }
  6223. var res = {};
  6224. var attrs = data.attrs;
  6225. var props = data.props;
  6226. if (isDef(attrs) || isDef(props)) {
  6227. for (var key in propOptions) {
  6228. var altKey = hyphenate(key);
  6229. if (true) {
  6230. var keyInLowerCase = key.toLowerCase();
  6231. if (
  6232. key !== keyInLowerCase &&
  6233. attrs && hasOwn(attrs, keyInLowerCase)
  6234. ) {
  6235. tip(
  6236. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  6237. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  6238. " \"" + key + "\". " +
  6239. "Note that HTML attributes are case-insensitive and camelCased " +
  6240. "props need to use their kebab-case equivalents when using in-DOM " +
  6241. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  6242. );
  6243. }
  6244. }
  6245. checkProp(res, props, key, altKey, true) ||
  6246. checkProp(res, attrs, key, altKey, false);
  6247. }
  6248. }
  6249. // fixed by xxxxxx
  6250. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  6251. }
  6252. function checkProp (
  6253. res,
  6254. hash,
  6255. key,
  6256. altKey,
  6257. preserve
  6258. ) {
  6259. if (isDef(hash)) {
  6260. if (hasOwn(hash, key)) {
  6261. res[key] = hash[key];
  6262. if (!preserve) {
  6263. delete hash[key];
  6264. }
  6265. return true
  6266. } else if (hasOwn(hash, altKey)) {
  6267. res[key] = hash[altKey];
  6268. if (!preserve) {
  6269. delete hash[altKey];
  6270. }
  6271. return true
  6272. }
  6273. }
  6274. return false
  6275. }
  6276. /* */
  6277. // The template compiler attempts to minimize the need for normalization by
  6278. // statically analyzing the template at compile time.
  6279. //
  6280. // For plain HTML markup, normalization can be completely skipped because the
  6281. // generated render function is guaranteed to return Array<VNode>. There are
  6282. // two cases where extra normalization is needed:
  6283. // 1. When the children contains components - because a functional component
  6284. // may return an Array instead of a single root. In this case, just a simple
  6285. // normalization is needed - if any child is an Array, we flatten the whole
  6286. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  6287. // because functional components already normalize their own children.
  6288. function simpleNormalizeChildren (children) {
  6289. for (var i = 0; i < children.length; i++) {
  6290. if (Array.isArray(children[i])) {
  6291. return Array.prototype.concat.apply([], children)
  6292. }
  6293. }
  6294. return children
  6295. }
  6296. // 2. When the children contains constructs that always generated nested Arrays,
  6297. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  6298. // with hand-written render functions / JSX. In such cases a full normalization
  6299. // is needed to cater to all possible types of children values.
  6300. function normalizeChildren (children) {
  6301. return isPrimitive(children)
  6302. ? [createTextVNode(children)]
  6303. : Array.isArray(children)
  6304. ? normalizeArrayChildren(children)
  6305. : undefined
  6306. }
  6307. function isTextNode (node) {
  6308. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  6309. }
  6310. function normalizeArrayChildren (children, nestedIndex) {
  6311. var res = [];
  6312. var i, c, lastIndex, last;
  6313. for (i = 0; i < children.length; i++) {
  6314. c = children[i];
  6315. if (isUndef(c) || typeof c === 'boolean') { continue }
  6316. lastIndex = res.length - 1;
  6317. last = res[lastIndex];
  6318. // nested
  6319. if (Array.isArray(c)) {
  6320. if (c.length > 0) {
  6321. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  6322. // merge adjacent text nodes
  6323. if (isTextNode(c[0]) && isTextNode(last)) {
  6324. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  6325. c.shift();
  6326. }
  6327. res.push.apply(res, c);
  6328. }
  6329. } else if (isPrimitive(c)) {
  6330. if (isTextNode(last)) {
  6331. // merge adjacent text nodes
  6332. // this is necessary for SSR hydration because text nodes are
  6333. // essentially merged when rendered to HTML strings
  6334. res[lastIndex] = createTextVNode(last.text + c);
  6335. } else if (c !== '') {
  6336. // convert primitive to vnode
  6337. res.push(createTextVNode(c));
  6338. }
  6339. } else {
  6340. if (isTextNode(c) && isTextNode(last)) {
  6341. // merge adjacent text nodes
  6342. res[lastIndex] = createTextVNode(last.text + c.text);
  6343. } else {
  6344. // default key for nested array children (likely generated by v-for)
  6345. if (isTrue(children._isVList) &&
  6346. isDef(c.tag) &&
  6347. isUndef(c.key) &&
  6348. isDef(nestedIndex)) {
  6349. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  6350. }
  6351. res.push(c);
  6352. }
  6353. }
  6354. }
  6355. return res
  6356. }
  6357. /* */
  6358. function initProvide (vm) {
  6359. var provide = vm.$options.provide;
  6360. if (provide) {
  6361. vm._provided = typeof provide === 'function'
  6362. ? provide.call(vm)
  6363. : provide;
  6364. }
  6365. }
  6366. function initInjections (vm) {
  6367. var result = resolveInject(vm.$options.inject, vm);
  6368. if (result) {
  6369. toggleObserving(false);
  6370. Object.keys(result).forEach(function (key) {
  6371. /* istanbul ignore else */
  6372. if (true) {
  6373. defineReactive$$1(vm, key, result[key], function () {
  6374. warn(
  6375. "Avoid mutating an injected value directly since the changes will be " +
  6376. "overwritten whenever the provided component re-renders. " +
  6377. "injection being mutated: \"" + key + "\"",
  6378. vm
  6379. );
  6380. });
  6381. } else {}
  6382. });
  6383. toggleObserving(true);
  6384. }
  6385. }
  6386. function resolveInject (inject, vm) {
  6387. if (inject) {
  6388. // inject is :any because flow is not smart enough to figure out cached
  6389. var result = Object.create(null);
  6390. var keys = hasSymbol
  6391. ? Reflect.ownKeys(inject)
  6392. : Object.keys(inject);
  6393. for (var i = 0; i < keys.length; i++) {
  6394. var key = keys[i];
  6395. // #6574 in case the inject object is observed...
  6396. if (key === '__ob__') { continue }
  6397. var provideKey = inject[key].from;
  6398. var source = vm;
  6399. while (source) {
  6400. if (source._provided && hasOwn(source._provided, provideKey)) {
  6401. result[key] = source._provided[provideKey];
  6402. break
  6403. }
  6404. source = source.$parent;
  6405. }
  6406. if (!source) {
  6407. if ('default' in inject[key]) {
  6408. var provideDefault = inject[key].default;
  6409. result[key] = typeof provideDefault === 'function'
  6410. ? provideDefault.call(vm)
  6411. : provideDefault;
  6412. } else if (true) {
  6413. warn(("Injection \"" + key + "\" not found"), vm);
  6414. }
  6415. }
  6416. }
  6417. return result
  6418. }
  6419. }
  6420. /* */
  6421. /**
  6422. * Runtime helper for resolving raw children VNodes into a slot object.
  6423. */
  6424. function resolveSlots (
  6425. children,
  6426. context
  6427. ) {
  6428. if (!children || !children.length) {
  6429. return {}
  6430. }
  6431. var slots = {};
  6432. for (var i = 0, l = children.length; i < l; i++) {
  6433. var child = children[i];
  6434. var data = child.data;
  6435. // remove slot attribute if the node is resolved as a Vue slot node
  6436. if (data && data.attrs && data.attrs.slot) {
  6437. delete data.attrs.slot;
  6438. }
  6439. // named slots should only be respected if the vnode was rendered in the
  6440. // same context.
  6441. if ((child.context === context || child.fnContext === context) &&
  6442. data && data.slot != null
  6443. ) {
  6444. var name = data.slot;
  6445. var slot = (slots[name] || (slots[name] = []));
  6446. if (child.tag === 'template') {
  6447. slot.push.apply(slot, child.children || []);
  6448. } else {
  6449. slot.push(child);
  6450. }
  6451. } else {
  6452. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  6453. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  6454. (slots['page'] || (slots['page'] = [])).push(child);
  6455. }else{
  6456. (slots.default || (slots.default = [])).push(child);
  6457. }
  6458. }
  6459. }
  6460. // ignore slots that contains only whitespace
  6461. for (var name$1 in slots) {
  6462. if (slots[name$1].every(isWhitespace)) {
  6463. delete slots[name$1];
  6464. }
  6465. }
  6466. return slots
  6467. }
  6468. function isWhitespace (node) {
  6469. return (node.isComment && !node.asyncFactory) || node.text === ' '
  6470. }
  6471. /* */
  6472. function normalizeScopedSlots (
  6473. slots,
  6474. normalSlots,
  6475. prevSlots
  6476. ) {
  6477. var res;
  6478. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  6479. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  6480. var key = slots && slots.$key;
  6481. if (!slots) {
  6482. res = {};
  6483. } else if (slots._normalized) {
  6484. // fast path 1: child component re-render only, parent did not change
  6485. return slots._normalized
  6486. } else if (
  6487. isStable &&
  6488. prevSlots &&
  6489. prevSlots !== emptyObject &&
  6490. key === prevSlots.$key &&
  6491. !hasNormalSlots &&
  6492. !prevSlots.$hasNormal
  6493. ) {
  6494. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  6495. // only need to normalize once
  6496. return prevSlots
  6497. } else {
  6498. res = {};
  6499. for (var key$1 in slots) {
  6500. if (slots[key$1] && key$1[0] !== '$') {
  6501. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  6502. }
  6503. }
  6504. }
  6505. // expose normal slots on scopedSlots
  6506. for (var key$2 in normalSlots) {
  6507. if (!(key$2 in res)) {
  6508. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  6509. }
  6510. }
  6511. // avoriaz seems to mock a non-extensible $scopedSlots object
  6512. // and when that is passed down this would cause an error
  6513. if (slots && Object.isExtensible(slots)) {
  6514. (slots)._normalized = res;
  6515. }
  6516. def(res, '$stable', isStable);
  6517. def(res, '$key', key);
  6518. def(res, '$hasNormal', hasNormalSlots);
  6519. return res
  6520. }
  6521. function normalizeScopedSlot(normalSlots, key, fn) {
  6522. var normalized = function () {
  6523. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  6524. res = res && typeof res === 'object' && !Array.isArray(res)
  6525. ? [res] // single vnode
  6526. : normalizeChildren(res);
  6527. return res && (
  6528. res.length === 0 ||
  6529. (res.length === 1 && res[0].isComment) // #9658
  6530. ) ? undefined
  6531. : res
  6532. };
  6533. // this is a slot using the new v-slot syntax without scope. although it is
  6534. // compiled as a scoped slot, render fn users would expect it to be present
  6535. // on this.$slots because the usage is semantically a normal slot.
  6536. if (fn.proxy) {
  6537. Object.defineProperty(normalSlots, key, {
  6538. get: normalized,
  6539. enumerable: true,
  6540. configurable: true
  6541. });
  6542. }
  6543. return normalized
  6544. }
  6545. function proxyNormalSlot(slots, key) {
  6546. return function () { return slots[key]; }
  6547. }
  6548. /* */
  6549. /**
  6550. * Runtime helper for rendering v-for lists.
  6551. */
  6552. function renderList (
  6553. val,
  6554. render
  6555. ) {
  6556. var ret, i, l, keys, key;
  6557. if (Array.isArray(val) || typeof val === 'string') {
  6558. ret = new Array(val.length);
  6559. for (i = 0, l = val.length; i < l; i++) {
  6560. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  6561. }
  6562. } else if (typeof val === 'number') {
  6563. ret = new Array(val);
  6564. for (i = 0; i < val; i++) {
  6565. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  6566. }
  6567. } else if (isObject(val)) {
  6568. if (hasSymbol && val[Symbol.iterator]) {
  6569. ret = [];
  6570. var iterator = val[Symbol.iterator]();
  6571. var result = iterator.next();
  6572. while (!result.done) {
  6573. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  6574. result = iterator.next();
  6575. }
  6576. } else {
  6577. keys = Object.keys(val);
  6578. ret = new Array(keys.length);
  6579. for (i = 0, l = keys.length; i < l; i++) {
  6580. key = keys[i];
  6581. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  6582. }
  6583. }
  6584. }
  6585. if (!isDef(ret)) {
  6586. ret = [];
  6587. }
  6588. (ret)._isVList = true;
  6589. return ret
  6590. }
  6591. /* */
  6592. /**
  6593. * Runtime helper for rendering <slot>
  6594. */
  6595. function renderSlot (
  6596. name,
  6597. fallback,
  6598. props,
  6599. bindObject
  6600. ) {
  6601. var scopedSlotFn = this.$scopedSlots[name];
  6602. var nodes;
  6603. if (scopedSlotFn) { // scoped slot
  6604. props = props || {};
  6605. if (bindObject) {
  6606. if ( true && !isObject(bindObject)) {
  6607. warn(
  6608. 'slot v-bind without argument expects an Object',
  6609. this
  6610. );
  6611. }
  6612. props = extend(extend({}, bindObject), props);
  6613. }
  6614. // fixed by xxxxxx app-plus scopedSlot
  6615. nodes = scopedSlotFn(props, this, props._i) || fallback;
  6616. } else {
  6617. nodes = this.$slots[name] || fallback;
  6618. }
  6619. var target = props && props.slot;
  6620. if (target) {
  6621. return this.$createElement('template', { slot: target }, nodes)
  6622. } else {
  6623. return nodes
  6624. }
  6625. }
  6626. /* */
  6627. /**
  6628. * Runtime helper for resolving filters
  6629. */
  6630. function resolveFilter (id) {
  6631. return resolveAsset(this.$options, 'filters', id, true) || identity
  6632. }
  6633. /* */
  6634. function isKeyNotMatch (expect, actual) {
  6635. if (Array.isArray(expect)) {
  6636. return expect.indexOf(actual) === -1
  6637. } else {
  6638. return expect !== actual
  6639. }
  6640. }
  6641. /**
  6642. * Runtime helper for checking keyCodes from config.
  6643. * exposed as Vue.prototype._k
  6644. * passing in eventKeyName as last argument separately for backwards compat
  6645. */
  6646. function checkKeyCodes (
  6647. eventKeyCode,
  6648. key,
  6649. builtInKeyCode,
  6650. eventKeyName,
  6651. builtInKeyName
  6652. ) {
  6653. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  6654. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  6655. return isKeyNotMatch(builtInKeyName, eventKeyName)
  6656. } else if (mappedKeyCode) {
  6657. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  6658. } else if (eventKeyName) {
  6659. return hyphenate(eventKeyName) !== key
  6660. }
  6661. }
  6662. /* */
  6663. /**
  6664. * Runtime helper for merging v-bind="object" into a VNode's data.
  6665. */
  6666. function bindObjectProps (
  6667. data,
  6668. tag,
  6669. value,
  6670. asProp,
  6671. isSync
  6672. ) {
  6673. if (value) {
  6674. if (!isObject(value)) {
  6675. true && warn(
  6676. 'v-bind without argument expects an Object or Array value',
  6677. this
  6678. );
  6679. } else {
  6680. if (Array.isArray(value)) {
  6681. value = toObject(value);
  6682. }
  6683. var hash;
  6684. var loop = function ( key ) {
  6685. if (
  6686. key === 'class' ||
  6687. key === 'style' ||
  6688. isReservedAttribute(key)
  6689. ) {
  6690. hash = data;
  6691. } else {
  6692. var type = data.attrs && data.attrs.type;
  6693. hash = asProp || config.mustUseProp(tag, type, key)
  6694. ? data.domProps || (data.domProps = {})
  6695. : data.attrs || (data.attrs = {});
  6696. }
  6697. var camelizedKey = camelize(key);
  6698. var hyphenatedKey = hyphenate(key);
  6699. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  6700. hash[key] = value[key];
  6701. if (isSync) {
  6702. var on = data.on || (data.on = {});
  6703. on[("update:" + key)] = function ($event) {
  6704. value[key] = $event;
  6705. };
  6706. }
  6707. }
  6708. };
  6709. for (var key in value) loop( key );
  6710. }
  6711. }
  6712. return data
  6713. }
  6714. /* */
  6715. /**
  6716. * Runtime helper for rendering static trees.
  6717. */
  6718. function renderStatic (
  6719. index,
  6720. isInFor
  6721. ) {
  6722. var cached = this._staticTrees || (this._staticTrees = []);
  6723. var tree = cached[index];
  6724. // if has already-rendered static tree and not inside v-for,
  6725. // we can reuse the same tree.
  6726. if (tree && !isInFor) {
  6727. return tree
  6728. }
  6729. // otherwise, render a fresh tree.
  6730. tree = cached[index] = this.$options.staticRenderFns[index].call(
  6731. this._renderProxy,
  6732. null,
  6733. this // for render fns generated for functional component templates
  6734. );
  6735. markStatic(tree, ("__static__" + index), false);
  6736. return tree
  6737. }
  6738. /**
  6739. * Runtime helper for v-once.
  6740. * Effectively it means marking the node as static with a unique key.
  6741. */
  6742. function markOnce (
  6743. tree,
  6744. index,
  6745. key
  6746. ) {
  6747. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  6748. return tree
  6749. }
  6750. function markStatic (
  6751. tree,
  6752. key,
  6753. isOnce
  6754. ) {
  6755. if (Array.isArray(tree)) {
  6756. for (var i = 0; i < tree.length; i++) {
  6757. if (tree[i] && typeof tree[i] !== 'string') {
  6758. markStaticNode(tree[i], (key + "_" + i), isOnce);
  6759. }
  6760. }
  6761. } else {
  6762. markStaticNode(tree, key, isOnce);
  6763. }
  6764. }
  6765. function markStaticNode (node, key, isOnce) {
  6766. node.isStatic = true;
  6767. node.key = key;
  6768. node.isOnce = isOnce;
  6769. }
  6770. /* */
  6771. function bindObjectListeners (data, value) {
  6772. if (value) {
  6773. if (!isPlainObject(value)) {
  6774. true && warn(
  6775. 'v-on without argument expects an Object value',
  6776. this
  6777. );
  6778. } else {
  6779. var on = data.on = data.on ? extend({}, data.on) : {};
  6780. for (var key in value) {
  6781. var existing = on[key];
  6782. var ours = value[key];
  6783. on[key] = existing ? [].concat(existing, ours) : ours;
  6784. }
  6785. }
  6786. }
  6787. return data
  6788. }
  6789. /* */
  6790. function resolveScopedSlots (
  6791. fns, // see flow/vnode
  6792. res,
  6793. // the following are added in 2.6
  6794. hasDynamicKeys,
  6795. contentHashKey
  6796. ) {
  6797. res = res || { $stable: !hasDynamicKeys };
  6798. for (var i = 0; i < fns.length; i++) {
  6799. var slot = fns[i];
  6800. if (Array.isArray(slot)) {
  6801. resolveScopedSlots(slot, res, hasDynamicKeys);
  6802. } else if (slot) {
  6803. // marker for reverse proxying v-slot without scope on this.$slots
  6804. if (slot.proxy) {
  6805. slot.fn.proxy = true;
  6806. }
  6807. res[slot.key] = slot.fn;
  6808. }
  6809. }
  6810. if (contentHashKey) {
  6811. (res).$key = contentHashKey;
  6812. }
  6813. return res
  6814. }
  6815. /* */
  6816. function bindDynamicKeys (baseObj, values) {
  6817. for (var i = 0; i < values.length; i += 2) {
  6818. var key = values[i];
  6819. if (typeof key === 'string' && key) {
  6820. baseObj[values[i]] = values[i + 1];
  6821. } else if ( true && key !== '' && key !== null) {
  6822. // null is a special value for explicitly removing a binding
  6823. warn(
  6824. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  6825. this
  6826. );
  6827. }
  6828. }
  6829. return baseObj
  6830. }
  6831. // helper to dynamically append modifier runtime markers to event names.
  6832. // ensure only append when value is already string, otherwise it will be cast
  6833. // to string and cause the type check to miss.
  6834. function prependModifier (value, symbol) {
  6835. return typeof value === 'string' ? symbol + value : value
  6836. }
  6837. /* */
  6838. function installRenderHelpers (target) {
  6839. target._o = markOnce;
  6840. target._n = toNumber;
  6841. target._s = toString;
  6842. target._l = renderList;
  6843. target._t = renderSlot;
  6844. target._q = looseEqual;
  6845. target._i = looseIndexOf;
  6846. target._m = renderStatic;
  6847. target._f = resolveFilter;
  6848. target._k = checkKeyCodes;
  6849. target._b = bindObjectProps;
  6850. target._v = createTextVNode;
  6851. target._e = createEmptyVNode;
  6852. target._u = resolveScopedSlots;
  6853. target._g = bindObjectListeners;
  6854. target._d = bindDynamicKeys;
  6855. target._p = prependModifier;
  6856. }
  6857. /* */
  6858. function FunctionalRenderContext (
  6859. data,
  6860. props,
  6861. children,
  6862. parent,
  6863. Ctor
  6864. ) {
  6865. var this$1 = this;
  6866. var options = Ctor.options;
  6867. // ensure the createElement function in functional components
  6868. // gets a unique context - this is necessary for correct named slot check
  6869. var contextVm;
  6870. if (hasOwn(parent, '_uid')) {
  6871. contextVm = Object.create(parent);
  6872. // $flow-disable-line
  6873. contextVm._original = parent;
  6874. } else {
  6875. // the context vm passed in is a functional context as well.
  6876. // in this case we want to make sure we are able to get a hold to the
  6877. // real context instance.
  6878. contextVm = parent;
  6879. // $flow-disable-line
  6880. parent = parent._original;
  6881. }
  6882. var isCompiled = isTrue(options._compiled);
  6883. var needNormalization = !isCompiled;
  6884. this.data = data;
  6885. this.props = props;
  6886. this.children = children;
  6887. this.parent = parent;
  6888. this.listeners = data.on || emptyObject;
  6889. this.injections = resolveInject(options.inject, parent);
  6890. this.slots = function () {
  6891. if (!this$1.$slots) {
  6892. normalizeScopedSlots(
  6893. data.scopedSlots,
  6894. this$1.$slots = resolveSlots(children, parent)
  6895. );
  6896. }
  6897. return this$1.$slots
  6898. };
  6899. Object.defineProperty(this, 'scopedSlots', ({
  6900. enumerable: true,
  6901. get: function get () {
  6902. return normalizeScopedSlots(data.scopedSlots, this.slots())
  6903. }
  6904. }));
  6905. // support for compiled functional template
  6906. if (isCompiled) {
  6907. // exposing $options for renderStatic()
  6908. this.$options = options;
  6909. // pre-resolve slots for renderSlot()
  6910. this.$slots = this.slots();
  6911. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  6912. }
  6913. if (options._scopeId) {
  6914. this._c = function (a, b, c, d) {
  6915. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  6916. if (vnode && !Array.isArray(vnode)) {
  6917. vnode.fnScopeId = options._scopeId;
  6918. vnode.fnContext = parent;
  6919. }
  6920. return vnode
  6921. };
  6922. } else {
  6923. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  6924. }
  6925. }
  6926. installRenderHelpers(FunctionalRenderContext.prototype);
  6927. function createFunctionalComponent (
  6928. Ctor,
  6929. propsData,
  6930. data,
  6931. contextVm,
  6932. children
  6933. ) {
  6934. var options = Ctor.options;
  6935. var props = {};
  6936. var propOptions = options.props;
  6937. if (isDef(propOptions)) {
  6938. for (var key in propOptions) {
  6939. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  6940. }
  6941. } else {
  6942. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  6943. if (isDef(data.props)) { mergeProps(props, data.props); }
  6944. }
  6945. var renderContext = new FunctionalRenderContext(
  6946. data,
  6947. props,
  6948. children,
  6949. contextVm,
  6950. Ctor
  6951. );
  6952. var vnode = options.render.call(null, renderContext._c, renderContext);
  6953. if (vnode instanceof VNode) {
  6954. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  6955. } else if (Array.isArray(vnode)) {
  6956. var vnodes = normalizeChildren(vnode) || [];
  6957. var res = new Array(vnodes.length);
  6958. for (var i = 0; i < vnodes.length; i++) {
  6959. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  6960. }
  6961. return res
  6962. }
  6963. }
  6964. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  6965. // #7817 clone node before setting fnContext, otherwise if the node is reused
  6966. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  6967. // that should not be matched to match.
  6968. var clone = cloneVNode(vnode);
  6969. clone.fnContext = contextVm;
  6970. clone.fnOptions = options;
  6971. if (true) {
  6972. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  6973. }
  6974. if (data.slot) {
  6975. (clone.data || (clone.data = {})).slot = data.slot;
  6976. }
  6977. return clone
  6978. }
  6979. function mergeProps (to, from) {
  6980. for (var key in from) {
  6981. to[camelize(key)] = from[key];
  6982. }
  6983. }
  6984. /* */
  6985. /* */
  6986. /* */
  6987. /* */
  6988. // inline hooks to be invoked on component VNodes during patch
  6989. var componentVNodeHooks = {
  6990. init: function init (vnode, hydrating) {
  6991. if (
  6992. vnode.componentInstance &&
  6993. !vnode.componentInstance._isDestroyed &&
  6994. vnode.data.keepAlive
  6995. ) {
  6996. // kept-alive components, treat as a patch
  6997. var mountedNode = vnode; // work around flow
  6998. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  6999. } else {
  7000. var child = vnode.componentInstance = createComponentInstanceForVnode(
  7001. vnode,
  7002. activeInstance
  7003. );
  7004. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  7005. }
  7006. },
  7007. prepatch: function prepatch (oldVnode, vnode) {
  7008. var options = vnode.componentOptions;
  7009. var child = vnode.componentInstance = oldVnode.componentInstance;
  7010. updateChildComponent(
  7011. child,
  7012. options.propsData, // updated props
  7013. options.listeners, // updated listeners
  7014. vnode, // new parent vnode
  7015. options.children // new children
  7016. );
  7017. },
  7018. insert: function insert (vnode) {
  7019. var context = vnode.context;
  7020. var componentInstance = vnode.componentInstance;
  7021. if (!componentInstance._isMounted) {
  7022. callHook(componentInstance, 'onServiceCreated');
  7023. callHook(componentInstance, 'onServiceAttached');
  7024. componentInstance._isMounted = true;
  7025. callHook(componentInstance, 'mounted');
  7026. }
  7027. if (vnode.data.keepAlive) {
  7028. if (context._isMounted) {
  7029. // vue-router#1212
  7030. // During updates, a kept-alive component's child components may
  7031. // change, so directly walking the tree here may call activated hooks
  7032. // on incorrect children. Instead we push them into a queue which will
  7033. // be processed after the whole patch process ended.
  7034. queueActivatedComponent(componentInstance);
  7035. } else {
  7036. activateChildComponent(componentInstance, true /* direct */);
  7037. }
  7038. }
  7039. },
  7040. destroy: function destroy (vnode) {
  7041. var componentInstance = vnode.componentInstance;
  7042. if (!componentInstance._isDestroyed) {
  7043. if (!vnode.data.keepAlive) {
  7044. componentInstance.$destroy();
  7045. } else {
  7046. deactivateChildComponent(componentInstance, true /* direct */);
  7047. }
  7048. }
  7049. }
  7050. };
  7051. var hooksToMerge = Object.keys(componentVNodeHooks);
  7052. function createComponent (
  7053. Ctor,
  7054. data,
  7055. context,
  7056. children,
  7057. tag
  7058. ) {
  7059. if (isUndef(Ctor)) {
  7060. return
  7061. }
  7062. var baseCtor = context.$options._base;
  7063. // plain options object: turn it into a constructor
  7064. if (isObject(Ctor)) {
  7065. Ctor = baseCtor.extend(Ctor);
  7066. }
  7067. // if at this stage it's not a constructor or an async component factory,
  7068. // reject.
  7069. if (typeof Ctor !== 'function') {
  7070. if (true) {
  7071. warn(("Invalid Component definition: " + (String(Ctor))), context);
  7072. }
  7073. return
  7074. }
  7075. // async component
  7076. var asyncFactory;
  7077. if (isUndef(Ctor.cid)) {
  7078. asyncFactory = Ctor;
  7079. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  7080. if (Ctor === undefined) {
  7081. // return a placeholder node for async component, which is rendered
  7082. // as a comment node but preserves all the raw information for the node.
  7083. // the information will be used for async server-rendering and hydration.
  7084. return createAsyncPlaceholder(
  7085. asyncFactory,
  7086. data,
  7087. context,
  7088. children,
  7089. tag
  7090. )
  7091. }
  7092. }
  7093. data = data || {};
  7094. // resolve constructor options in case global mixins are applied after
  7095. // component constructor creation
  7096. resolveConstructorOptions(Ctor);
  7097. // transform component v-model data into props & events
  7098. if (isDef(data.model)) {
  7099. transformModel(Ctor.options, data);
  7100. }
  7101. // extract props
  7102. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  7103. // functional component
  7104. if (isTrue(Ctor.options.functional)) {
  7105. return createFunctionalComponent(Ctor, propsData, data, context, children)
  7106. }
  7107. // extract listeners, since these needs to be treated as
  7108. // child component listeners instead of DOM listeners
  7109. var listeners = data.on;
  7110. // replace with listeners with .native modifier
  7111. // so it gets processed during parent component patch.
  7112. data.on = data.nativeOn;
  7113. if (isTrue(Ctor.options.abstract)) {
  7114. // abstract components do not keep anything
  7115. // other than props & listeners & slot
  7116. // work around flow
  7117. var slot = data.slot;
  7118. data = {};
  7119. if (slot) {
  7120. data.slot = slot;
  7121. }
  7122. }
  7123. // install component management hooks onto the placeholder node
  7124. installComponentHooks(data);
  7125. // return a placeholder vnode
  7126. var name = Ctor.options.name || tag;
  7127. var vnode = new VNode(
  7128. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  7129. data, undefined, undefined, undefined, context,
  7130. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  7131. asyncFactory
  7132. );
  7133. return vnode
  7134. }
  7135. function createComponentInstanceForVnode (
  7136. vnode, // we know it's MountedComponentVNode but flow doesn't
  7137. parent // activeInstance in lifecycle state
  7138. ) {
  7139. var options = {
  7140. _isComponent: true,
  7141. _parentVnode: vnode,
  7142. parent: parent
  7143. };
  7144. // check inline-template render functions
  7145. var inlineTemplate = vnode.data.inlineTemplate;
  7146. if (isDef(inlineTemplate)) {
  7147. options.render = inlineTemplate.render;
  7148. options.staticRenderFns = inlineTemplate.staticRenderFns;
  7149. }
  7150. return new vnode.componentOptions.Ctor(options)
  7151. }
  7152. function installComponentHooks (data) {
  7153. var hooks = data.hook || (data.hook = {});
  7154. for (var i = 0; i < hooksToMerge.length; i++) {
  7155. var key = hooksToMerge[i];
  7156. var existing = hooks[key];
  7157. var toMerge = componentVNodeHooks[key];
  7158. if (existing !== toMerge && !(existing && existing._merged)) {
  7159. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  7160. }
  7161. }
  7162. }
  7163. function mergeHook$1 (f1, f2) {
  7164. var merged = function (a, b) {
  7165. // flow complains about extra args which is why we use any
  7166. f1(a, b);
  7167. f2(a, b);
  7168. };
  7169. merged._merged = true;
  7170. return merged
  7171. }
  7172. // transform component v-model info (value and callback) into
  7173. // prop and event handler respectively.
  7174. function transformModel (options, data) {
  7175. var prop = (options.model && options.model.prop) || 'value';
  7176. var event = (options.model && options.model.event) || 'input'
  7177. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  7178. var on = data.on || (data.on = {});
  7179. var existing = on[event];
  7180. var callback = data.model.callback;
  7181. if (isDef(existing)) {
  7182. if (
  7183. Array.isArray(existing)
  7184. ? existing.indexOf(callback) === -1
  7185. : existing !== callback
  7186. ) {
  7187. on[event] = [callback].concat(existing);
  7188. }
  7189. } else {
  7190. on[event] = callback;
  7191. }
  7192. }
  7193. /* */
  7194. var SIMPLE_NORMALIZE = 1;
  7195. var ALWAYS_NORMALIZE = 2;
  7196. // wrapper function for providing a more flexible interface
  7197. // without getting yelled at by flow
  7198. function createElement (
  7199. context,
  7200. tag,
  7201. data,
  7202. children,
  7203. normalizationType,
  7204. alwaysNormalize
  7205. ) {
  7206. if (Array.isArray(data) || isPrimitive(data)) {
  7207. normalizationType = children;
  7208. children = data;
  7209. data = undefined;
  7210. }
  7211. if (isTrue(alwaysNormalize)) {
  7212. normalizationType = ALWAYS_NORMALIZE;
  7213. }
  7214. return _createElement(context, tag, data, children, normalizationType)
  7215. }
  7216. function _createElement (
  7217. context,
  7218. tag,
  7219. data,
  7220. children,
  7221. normalizationType
  7222. ) {
  7223. if (isDef(data) && isDef((data).__ob__)) {
  7224. true && warn(
  7225. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  7226. 'Always create fresh vnode data objects in each render!',
  7227. context
  7228. );
  7229. return createEmptyVNode()
  7230. }
  7231. // object syntax in v-bind
  7232. if (isDef(data) && isDef(data.is)) {
  7233. tag = data.is;
  7234. }
  7235. if (!tag) {
  7236. // in case of component :is set to falsy value
  7237. return createEmptyVNode()
  7238. }
  7239. // warn against non-primitive key
  7240. if ( true &&
  7241. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  7242. ) {
  7243. {
  7244. warn(
  7245. 'Avoid using non-primitive value as key, ' +
  7246. 'use string/number value instead.',
  7247. context
  7248. );
  7249. }
  7250. }
  7251. // support single function children as default scoped slot
  7252. if (Array.isArray(children) &&
  7253. typeof children[0] === 'function'
  7254. ) {
  7255. data = data || {};
  7256. data.scopedSlots = { default: children[0] };
  7257. children.length = 0;
  7258. }
  7259. if (normalizationType === ALWAYS_NORMALIZE) {
  7260. children = normalizeChildren(children);
  7261. } else if (normalizationType === SIMPLE_NORMALIZE) {
  7262. children = simpleNormalizeChildren(children);
  7263. }
  7264. var vnode, ns;
  7265. if (typeof tag === 'string') {
  7266. var Ctor;
  7267. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  7268. if (config.isReservedTag(tag)) {
  7269. // platform built-in elements
  7270. if ( true && isDef(data) && isDef(data.nativeOn)) {
  7271. warn(
  7272. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  7273. context
  7274. );
  7275. }
  7276. vnode = new VNode(
  7277. config.parsePlatformTagName(tag), data, children,
  7278. undefined, undefined, context
  7279. );
  7280. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  7281. // component
  7282. vnode = createComponent(Ctor, data, context, children, tag);
  7283. } else {
  7284. // unknown or unlisted namespaced elements
  7285. // check at runtime because it may get assigned a namespace when its
  7286. // parent normalizes children
  7287. vnode = new VNode(
  7288. tag, data, children,
  7289. undefined, undefined, context
  7290. );
  7291. }
  7292. } else {
  7293. // direct component options / constructor
  7294. vnode = createComponent(tag, data, context, children);
  7295. }
  7296. if (Array.isArray(vnode)) {
  7297. return vnode
  7298. } else if (isDef(vnode)) {
  7299. if (isDef(ns)) { applyNS(vnode, ns); }
  7300. if (isDef(data)) { registerDeepBindings(data); }
  7301. return vnode
  7302. } else {
  7303. return createEmptyVNode()
  7304. }
  7305. }
  7306. function applyNS (vnode, ns, force) {
  7307. vnode.ns = ns;
  7308. if (vnode.tag === 'foreignObject') {
  7309. // use default namespace inside foreignObject
  7310. ns = undefined;
  7311. force = true;
  7312. }
  7313. if (isDef(vnode.children)) {
  7314. for (var i = 0, l = vnode.children.length; i < l; i++) {
  7315. var child = vnode.children[i];
  7316. if (isDef(child.tag) && (
  7317. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  7318. applyNS(child, ns, force);
  7319. }
  7320. }
  7321. }
  7322. }
  7323. // ref #5318
  7324. // necessary to ensure parent re-render when deep bindings like :style and
  7325. // :class are used on slot nodes
  7326. function registerDeepBindings (data) {
  7327. if (isObject(data.style)) {
  7328. traverse(data.style);
  7329. }
  7330. if (isObject(data.class)) {
  7331. traverse(data.class);
  7332. }
  7333. }
  7334. /* */
  7335. function initRender (vm) {
  7336. vm._vnode = null; // the root of the child tree
  7337. vm._staticTrees = null; // v-once cached trees
  7338. var options = vm.$options;
  7339. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  7340. var renderContext = parentVnode && parentVnode.context;
  7341. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  7342. vm.$scopedSlots = emptyObject;
  7343. // bind the createElement fn to this instance
  7344. // so that we get proper render context inside it.
  7345. // args order: tag, data, children, normalizationType, alwaysNormalize
  7346. // internal version is used by render functions compiled from templates
  7347. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  7348. // normalization is always applied for the public version, used in
  7349. // user-written render functions.
  7350. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  7351. // $attrs & $listeners are exposed for easier HOC creation.
  7352. // they need to be reactive so that HOCs using them are always updated
  7353. var parentData = parentVnode && parentVnode.data;
  7354. /* istanbul ignore else */
  7355. if (true) {
  7356. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  7357. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  7358. }, true);
  7359. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  7360. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  7361. }, true);
  7362. } else {}
  7363. }
  7364. var currentRenderingInstance = null;
  7365. function renderMixin (Vue) {
  7366. // install runtime convenience helpers
  7367. installRenderHelpers(Vue.prototype);
  7368. Vue.prototype.$nextTick = function (fn) {
  7369. return nextTick(fn, this)
  7370. };
  7371. Vue.prototype._render = function () {
  7372. var vm = this;
  7373. var ref = vm.$options;
  7374. var render = ref.render;
  7375. var _parentVnode = ref._parentVnode;
  7376. if (_parentVnode) {
  7377. vm.$scopedSlots = normalizeScopedSlots(
  7378. _parentVnode.data.scopedSlots,
  7379. vm.$slots,
  7380. vm.$scopedSlots
  7381. );
  7382. }
  7383. // set parent vnode. this allows render functions to have access
  7384. // to the data on the placeholder node.
  7385. vm.$vnode = _parentVnode;
  7386. // render self
  7387. var vnode;
  7388. try {
  7389. // There's no need to maintain a stack because all render fns are called
  7390. // separately from one another. Nested component's render fns are called
  7391. // when parent component is patched.
  7392. currentRenderingInstance = vm;
  7393. vnode = render.call(vm._renderProxy, vm.$createElement);
  7394. } catch (e) {
  7395. handleError(e, vm, "render");
  7396. // return error render result,
  7397. // or previous vnode to prevent render error causing blank component
  7398. /* istanbul ignore else */
  7399. if ( true && vm.$options.renderError) {
  7400. try {
  7401. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  7402. } catch (e) {
  7403. handleError(e, vm, "renderError");
  7404. vnode = vm._vnode;
  7405. }
  7406. } else {
  7407. vnode = vm._vnode;
  7408. }
  7409. } finally {
  7410. currentRenderingInstance = null;
  7411. }
  7412. // if the returned array contains only a single node, allow it
  7413. if (Array.isArray(vnode) && vnode.length === 1) {
  7414. vnode = vnode[0];
  7415. }
  7416. // return empty vnode in case the render function errored out
  7417. if (!(vnode instanceof VNode)) {
  7418. if ( true && Array.isArray(vnode)) {
  7419. warn(
  7420. 'Multiple root nodes returned from render function. Render function ' +
  7421. 'should return a single root node.',
  7422. vm
  7423. );
  7424. }
  7425. vnode = createEmptyVNode();
  7426. }
  7427. // set parent
  7428. vnode.parent = _parentVnode;
  7429. return vnode
  7430. };
  7431. }
  7432. /* */
  7433. function ensureCtor (comp, base) {
  7434. if (
  7435. comp.__esModule ||
  7436. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  7437. ) {
  7438. comp = comp.default;
  7439. }
  7440. return isObject(comp)
  7441. ? base.extend(comp)
  7442. : comp
  7443. }
  7444. function createAsyncPlaceholder (
  7445. factory,
  7446. data,
  7447. context,
  7448. children,
  7449. tag
  7450. ) {
  7451. var node = createEmptyVNode();
  7452. node.asyncFactory = factory;
  7453. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  7454. return node
  7455. }
  7456. function resolveAsyncComponent (
  7457. factory,
  7458. baseCtor
  7459. ) {
  7460. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  7461. return factory.errorComp
  7462. }
  7463. if (isDef(factory.resolved)) {
  7464. return factory.resolved
  7465. }
  7466. var owner = currentRenderingInstance;
  7467. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  7468. // already pending
  7469. factory.owners.push(owner);
  7470. }
  7471. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  7472. return factory.loadingComp
  7473. }
  7474. if (owner && !isDef(factory.owners)) {
  7475. var owners = factory.owners = [owner];
  7476. var sync = true;
  7477. var timerLoading = null;
  7478. var timerTimeout = null
  7479. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  7480. var forceRender = function (renderCompleted) {
  7481. for (var i = 0, l = owners.length; i < l; i++) {
  7482. (owners[i]).$forceUpdate();
  7483. }
  7484. if (renderCompleted) {
  7485. owners.length = 0;
  7486. if (timerLoading !== null) {
  7487. clearTimeout(timerLoading);
  7488. timerLoading = null;
  7489. }
  7490. if (timerTimeout !== null) {
  7491. clearTimeout(timerTimeout);
  7492. timerTimeout = null;
  7493. }
  7494. }
  7495. };
  7496. var resolve = once(function (res) {
  7497. // cache resolved
  7498. factory.resolved = ensureCtor(res, baseCtor);
  7499. // invoke callbacks only if this is not a synchronous resolve
  7500. // (async resolves are shimmed as synchronous during SSR)
  7501. if (!sync) {
  7502. forceRender(true);
  7503. } else {
  7504. owners.length = 0;
  7505. }
  7506. });
  7507. var reject = once(function (reason) {
  7508. true && warn(
  7509. "Failed to resolve async component: " + (String(factory)) +
  7510. (reason ? ("\nReason: " + reason) : '')
  7511. );
  7512. if (isDef(factory.errorComp)) {
  7513. factory.error = true;
  7514. forceRender(true);
  7515. }
  7516. });
  7517. var res = factory(resolve, reject);
  7518. if (isObject(res)) {
  7519. if (isPromise(res)) {
  7520. // () => Promise
  7521. if (isUndef(factory.resolved)) {
  7522. res.then(resolve, reject);
  7523. }
  7524. } else if (isPromise(res.component)) {
  7525. res.component.then(resolve, reject);
  7526. if (isDef(res.error)) {
  7527. factory.errorComp = ensureCtor(res.error, baseCtor);
  7528. }
  7529. if (isDef(res.loading)) {
  7530. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  7531. if (res.delay === 0) {
  7532. factory.loading = true;
  7533. } else {
  7534. timerLoading = setTimeout(function () {
  7535. timerLoading = null;
  7536. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  7537. factory.loading = true;
  7538. forceRender(false);
  7539. }
  7540. }, res.delay || 200);
  7541. }
  7542. }
  7543. if (isDef(res.timeout)) {
  7544. timerTimeout = setTimeout(function () {
  7545. timerTimeout = null;
  7546. if (isUndef(factory.resolved)) {
  7547. reject(
  7548. true
  7549. ? ("timeout (" + (res.timeout) + "ms)")
  7550. : undefined
  7551. );
  7552. }
  7553. }, res.timeout);
  7554. }
  7555. }
  7556. }
  7557. sync = false;
  7558. // return in case resolved synchronously
  7559. return factory.loading
  7560. ? factory.loadingComp
  7561. : factory.resolved
  7562. }
  7563. }
  7564. /* */
  7565. function isAsyncPlaceholder (node) {
  7566. return node.isComment && node.asyncFactory
  7567. }
  7568. /* */
  7569. function getFirstComponentChild (children) {
  7570. if (Array.isArray(children)) {
  7571. for (var i = 0; i < children.length; i++) {
  7572. var c = children[i];
  7573. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  7574. return c
  7575. }
  7576. }
  7577. }
  7578. }
  7579. /* */
  7580. /* */
  7581. function initEvents (vm) {
  7582. vm._events = Object.create(null);
  7583. vm._hasHookEvent = false;
  7584. // init parent attached events
  7585. var listeners = vm.$options._parentListeners;
  7586. if (listeners) {
  7587. updateComponentListeners(vm, listeners);
  7588. }
  7589. }
  7590. var target;
  7591. function add (event, fn) {
  7592. target.$on(event, fn);
  7593. }
  7594. function remove$1 (event, fn) {
  7595. target.$off(event, fn);
  7596. }
  7597. function createOnceHandler (event, fn) {
  7598. var _target = target;
  7599. return function onceHandler () {
  7600. var res = fn.apply(null, arguments);
  7601. if (res !== null) {
  7602. _target.$off(event, onceHandler);
  7603. }
  7604. }
  7605. }
  7606. function updateComponentListeners (
  7607. vm,
  7608. listeners,
  7609. oldListeners
  7610. ) {
  7611. target = vm;
  7612. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  7613. target = undefined;
  7614. }
  7615. function eventsMixin (Vue) {
  7616. var hookRE = /^hook:/;
  7617. Vue.prototype.$on = function (event, fn) {
  7618. var vm = this;
  7619. if (Array.isArray(event)) {
  7620. for (var i = 0, l = event.length; i < l; i++) {
  7621. vm.$on(event[i], fn);
  7622. }
  7623. } else {
  7624. (vm._events[event] || (vm._events[event] = [])).push(fn);
  7625. // optimize hook:event cost by using a boolean flag marked at registration
  7626. // instead of a hash lookup
  7627. if (hookRE.test(event)) {
  7628. vm._hasHookEvent = true;
  7629. }
  7630. }
  7631. return vm
  7632. };
  7633. Vue.prototype.$once = function (event, fn) {
  7634. var vm = this;
  7635. function on () {
  7636. vm.$off(event, on);
  7637. fn.apply(vm, arguments);
  7638. }
  7639. on.fn = fn;
  7640. vm.$on(event, on);
  7641. return vm
  7642. };
  7643. Vue.prototype.$off = function (event, fn) {
  7644. var vm = this;
  7645. // all
  7646. if (!arguments.length) {
  7647. vm._events = Object.create(null);
  7648. return vm
  7649. }
  7650. // array of events
  7651. if (Array.isArray(event)) {
  7652. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  7653. vm.$off(event[i$1], fn);
  7654. }
  7655. return vm
  7656. }
  7657. // specific event
  7658. var cbs = vm._events[event];
  7659. if (!cbs) {
  7660. return vm
  7661. }
  7662. if (!fn) {
  7663. vm._events[event] = null;
  7664. return vm
  7665. }
  7666. // specific handler
  7667. var cb;
  7668. var i = cbs.length;
  7669. while (i--) {
  7670. cb = cbs[i];
  7671. if (cb === fn || cb.fn === fn) {
  7672. cbs.splice(i, 1);
  7673. break
  7674. }
  7675. }
  7676. return vm
  7677. };
  7678. Vue.prototype.$emit = function (event) {
  7679. var vm = this;
  7680. if (true) {
  7681. var lowerCaseEvent = event.toLowerCase();
  7682. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  7683. tip(
  7684. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  7685. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  7686. "Note that HTML attributes are case-insensitive and you cannot use " +
  7687. "v-on to listen to camelCase events when using in-DOM templates. " +
  7688. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  7689. );
  7690. }
  7691. }
  7692. var cbs = vm._events[event];
  7693. if (cbs) {
  7694. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  7695. var args = toArray(arguments, 1);
  7696. var info = "event handler for \"" + event + "\"";
  7697. for (var i = 0, l = cbs.length; i < l; i++) {
  7698. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  7699. }
  7700. }
  7701. return vm
  7702. };
  7703. }
  7704. /* */
  7705. var activeInstance = null;
  7706. var isUpdatingChildComponent = false;
  7707. function setActiveInstance(vm) {
  7708. var prevActiveInstance = activeInstance;
  7709. activeInstance = vm;
  7710. return function () {
  7711. activeInstance = prevActiveInstance;
  7712. }
  7713. }
  7714. function initLifecycle (vm) {
  7715. var options = vm.$options;
  7716. // locate first non-abstract parent
  7717. var parent = options.parent;
  7718. if (parent && !options.abstract) {
  7719. while (parent.$options.abstract && parent.$parent) {
  7720. parent = parent.$parent;
  7721. }
  7722. parent.$children.push(vm);
  7723. }
  7724. vm.$parent = parent;
  7725. vm.$root = parent ? parent.$root : vm;
  7726. vm.$children = [];
  7727. vm.$refs = {};
  7728. vm._watcher = null;
  7729. vm._inactive = null;
  7730. vm._directInactive = false;
  7731. vm._isMounted = false;
  7732. vm._isDestroyed = false;
  7733. vm._isBeingDestroyed = false;
  7734. }
  7735. function lifecycleMixin (Vue) {
  7736. Vue.prototype._update = function (vnode, hydrating) {
  7737. var vm = this;
  7738. var prevEl = vm.$el;
  7739. var prevVnode = vm._vnode;
  7740. var restoreActiveInstance = setActiveInstance(vm);
  7741. vm._vnode = vnode;
  7742. // Vue.prototype.__patch__ is injected in entry points
  7743. // based on the rendering backend used.
  7744. if (!prevVnode) {
  7745. // initial render
  7746. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  7747. } else {
  7748. // updates
  7749. vm.$el = vm.__patch__(prevVnode, vnode);
  7750. }
  7751. restoreActiveInstance();
  7752. // update __vue__ reference
  7753. if (prevEl) {
  7754. prevEl.__vue__ = null;
  7755. }
  7756. if (vm.$el) {
  7757. vm.$el.__vue__ = vm;
  7758. }
  7759. // if parent is an HOC, update its $el as well
  7760. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  7761. vm.$parent.$el = vm.$el;
  7762. }
  7763. // updated hook is called by the scheduler to ensure that children are
  7764. // updated in a parent's updated hook.
  7765. };
  7766. Vue.prototype.$forceUpdate = function () {
  7767. var vm = this;
  7768. if (vm._watcher) {
  7769. vm._watcher.update();
  7770. }
  7771. };
  7772. Vue.prototype.$destroy = function () {
  7773. var vm = this;
  7774. if (vm._isBeingDestroyed) {
  7775. return
  7776. }
  7777. callHook(vm, 'beforeDestroy');
  7778. vm._isBeingDestroyed = true;
  7779. // remove self from parent
  7780. var parent = vm.$parent;
  7781. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  7782. remove(parent.$children, vm);
  7783. }
  7784. // teardown watchers
  7785. if (vm._watcher) {
  7786. vm._watcher.teardown();
  7787. }
  7788. var i = vm._watchers.length;
  7789. while (i--) {
  7790. vm._watchers[i].teardown();
  7791. }
  7792. // remove reference from data ob
  7793. // frozen object may not have observer.
  7794. if (vm._data.__ob__) {
  7795. vm._data.__ob__.vmCount--;
  7796. }
  7797. // call the last hook...
  7798. vm._isDestroyed = true;
  7799. // invoke destroy hooks on current rendered tree
  7800. vm.__patch__(vm._vnode, null);
  7801. // fire destroyed hook
  7802. callHook(vm, 'destroyed');
  7803. // turn off all instance listeners.
  7804. vm.$off();
  7805. // remove __vue__ reference
  7806. if (vm.$el) {
  7807. vm.$el.__vue__ = null;
  7808. }
  7809. // release circular reference (#6759)
  7810. if (vm.$vnode) {
  7811. vm.$vnode.parent = null;
  7812. }
  7813. };
  7814. }
  7815. function updateChildComponent (
  7816. vm,
  7817. propsData,
  7818. listeners,
  7819. parentVnode,
  7820. renderChildren
  7821. ) {
  7822. if (true) {
  7823. isUpdatingChildComponent = true;
  7824. }
  7825. // determine whether component has slot children
  7826. // we need to do this before overwriting $options._renderChildren.
  7827. // check if there are dynamic scopedSlots (hand-written or compiled but with
  7828. // dynamic slot names). Static scoped slots compiled from template has the
  7829. // "$stable" marker.
  7830. var newScopedSlots = parentVnode.data.scopedSlots;
  7831. var oldScopedSlots = vm.$scopedSlots;
  7832. var hasDynamicScopedSlot = !!(
  7833. (newScopedSlots && !newScopedSlots.$stable) ||
  7834. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  7835. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  7836. );
  7837. // Any static slot children from the parent may have changed during parent's
  7838. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  7839. // update is necessary to ensure correctness.
  7840. var needsForceUpdate = !!(
  7841. renderChildren || // has new static slots
  7842. vm.$options._renderChildren || // has old static slots
  7843. hasDynamicScopedSlot
  7844. );
  7845. vm.$options._parentVnode = parentVnode;
  7846. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  7847. if (vm._vnode) { // update child tree's parent
  7848. vm._vnode.parent = parentVnode;
  7849. }
  7850. vm.$options._renderChildren = renderChildren;
  7851. // update $attrs and $listeners hash
  7852. // these are also reactive so they may trigger child update if the child
  7853. // used them during render
  7854. vm.$attrs = parentVnode.data.attrs || emptyObject;
  7855. vm.$listeners = listeners || emptyObject;
  7856. // update props
  7857. if (propsData && vm.$options.props) {
  7858. toggleObserving(false);
  7859. var props = vm._props;
  7860. var propKeys = vm.$options._propKeys || [];
  7861. for (var i = 0; i < propKeys.length; i++) {
  7862. var key = propKeys[i];
  7863. var propOptions = vm.$options.props; // wtf flow?
  7864. props[key] = validateProp(key, propOptions, propsData, vm);
  7865. }
  7866. toggleObserving(true);
  7867. // keep a copy of raw propsData
  7868. vm.$options.propsData = propsData;
  7869. }
  7870. // fixed by xxxxxx update properties(mp runtime)
  7871. vm._$updateProperties && vm._$updateProperties(vm);
  7872. // update listeners
  7873. listeners = listeners || emptyObject;
  7874. var oldListeners = vm.$options._parentListeners;
  7875. vm.$options._parentListeners = listeners;
  7876. updateComponentListeners(vm, listeners, oldListeners);
  7877. // resolve slots + force update if has children
  7878. if (needsForceUpdate) {
  7879. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  7880. vm.$forceUpdate();
  7881. }
  7882. if (true) {
  7883. isUpdatingChildComponent = false;
  7884. }
  7885. }
  7886. function isInInactiveTree (vm) {
  7887. while (vm && (vm = vm.$parent)) {
  7888. if (vm._inactive) { return true }
  7889. }
  7890. return false
  7891. }
  7892. function activateChildComponent (vm, direct) {
  7893. if (direct) {
  7894. vm._directInactive = false;
  7895. if (isInInactiveTree(vm)) {
  7896. return
  7897. }
  7898. } else if (vm._directInactive) {
  7899. return
  7900. }
  7901. if (vm._inactive || vm._inactive === null) {
  7902. vm._inactive = false;
  7903. for (var i = 0; i < vm.$children.length; i++) {
  7904. activateChildComponent(vm.$children[i]);
  7905. }
  7906. callHook(vm, 'activated');
  7907. }
  7908. }
  7909. function deactivateChildComponent (vm, direct) {
  7910. if (direct) {
  7911. vm._directInactive = true;
  7912. if (isInInactiveTree(vm)) {
  7913. return
  7914. }
  7915. }
  7916. if (!vm._inactive) {
  7917. vm._inactive = true;
  7918. for (var i = 0; i < vm.$children.length; i++) {
  7919. deactivateChildComponent(vm.$children[i]);
  7920. }
  7921. callHook(vm, 'deactivated');
  7922. }
  7923. }
  7924. function callHook (vm, hook) {
  7925. // #7573 disable dep collection when invoking lifecycle hooks
  7926. pushTarget();
  7927. var handlers = vm.$options[hook];
  7928. var info = hook + " hook";
  7929. if (handlers) {
  7930. for (var i = 0, j = handlers.length; i < j; i++) {
  7931. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  7932. }
  7933. }
  7934. if (vm._hasHookEvent) {
  7935. vm.$emit('hook:' + hook);
  7936. }
  7937. popTarget();
  7938. }
  7939. /* */
  7940. var MAX_UPDATE_COUNT = 100;
  7941. var queue = [];
  7942. var activatedChildren = [];
  7943. var has = {};
  7944. var circular = {};
  7945. var waiting = false;
  7946. var flushing = false;
  7947. var index = 0;
  7948. /**
  7949. * Reset the scheduler's state.
  7950. */
  7951. function resetSchedulerState () {
  7952. index = queue.length = activatedChildren.length = 0;
  7953. has = {};
  7954. if (true) {
  7955. circular = {};
  7956. }
  7957. waiting = flushing = false;
  7958. }
  7959. // Async edge case #6566 requires saving the timestamp when event listeners are
  7960. // attached. However, calling performance.now() has a perf overhead especially
  7961. // if the page has thousands of event listeners. Instead, we take a timestamp
  7962. // every time the scheduler flushes and use that for all event listeners
  7963. // attached during that flush.
  7964. var currentFlushTimestamp = 0;
  7965. // Async edge case fix requires storing an event listener's attach timestamp.
  7966. var getNow = Date.now;
  7967. // Determine what event timestamp the browser is using. Annoyingly, the
  7968. // timestamp can either be hi-res (relative to page load) or low-res
  7969. // (relative to UNIX epoch), so in order to compare time we have to use the
  7970. // same timestamp type when saving the flush timestamp.
  7971. // All IE versions use low-res event timestamps, and have problematic clock
  7972. // implementations (#9632)
  7973. if (inBrowser && !isIE) {
  7974. var performance = window.performance;
  7975. if (
  7976. performance &&
  7977. typeof performance.now === 'function' &&
  7978. getNow() > document.createEvent('Event').timeStamp
  7979. ) {
  7980. // if the event timestamp, although evaluated AFTER the Date.now(), is
  7981. // smaller than it, it means the event is using a hi-res timestamp,
  7982. // and we need to use the hi-res version for event listener timestamps as
  7983. // well.
  7984. getNow = function () { return performance.now(); };
  7985. }
  7986. }
  7987. /**
  7988. * Flush both queues and run the watchers.
  7989. */
  7990. function flushSchedulerQueue () {
  7991. currentFlushTimestamp = getNow();
  7992. flushing = true;
  7993. var watcher, id;
  7994. // Sort queue before flush.
  7995. // This ensures that:
  7996. // 1. Components are updated from parent to child. (because parent is always
  7997. // created before the child)
  7998. // 2. A component's user watchers are run before its render watcher (because
  7999. // user watchers are created before the render watcher)
  8000. // 3. If a component is destroyed during a parent component's watcher run,
  8001. // its watchers can be skipped.
  8002. queue.sort(function (a, b) { return a.id - b.id; });
  8003. // do not cache length because more watchers might be pushed
  8004. // as we run existing watchers
  8005. for (index = 0; index < queue.length; index++) {
  8006. watcher = queue[index];
  8007. if (watcher.before) {
  8008. watcher.before();
  8009. }
  8010. id = watcher.id;
  8011. has[id] = null;
  8012. watcher.run();
  8013. // in dev build, check and stop circular updates.
  8014. if ( true && has[id] != null) {
  8015. circular[id] = (circular[id] || 0) + 1;
  8016. if (circular[id] > MAX_UPDATE_COUNT) {
  8017. warn(
  8018. 'You may have an infinite update loop ' + (
  8019. watcher.user
  8020. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  8021. : "in a component render function."
  8022. ),
  8023. watcher.vm
  8024. );
  8025. break
  8026. }
  8027. }
  8028. }
  8029. // keep copies of post queues before resetting state
  8030. var activatedQueue = activatedChildren.slice();
  8031. var updatedQueue = queue.slice();
  8032. resetSchedulerState();
  8033. // call component updated and activated hooks
  8034. callActivatedHooks(activatedQueue);
  8035. callUpdatedHooks(updatedQueue);
  8036. // devtool hook
  8037. /* istanbul ignore if */
  8038. if (devtools && config.devtools) {
  8039. devtools.emit('flush');
  8040. }
  8041. }
  8042. function callUpdatedHooks (queue) {
  8043. var i = queue.length;
  8044. while (i--) {
  8045. var watcher = queue[i];
  8046. var vm = watcher.vm;
  8047. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  8048. callHook(vm, 'updated');
  8049. }
  8050. }
  8051. }
  8052. /**
  8053. * Queue a kept-alive component that was activated during patch.
  8054. * The queue will be processed after the entire tree has been patched.
  8055. */
  8056. function queueActivatedComponent (vm) {
  8057. // setting _inactive to false here so that a render function can
  8058. // rely on checking whether it's in an inactive tree (e.g. router-view)
  8059. vm._inactive = false;
  8060. activatedChildren.push(vm);
  8061. }
  8062. function callActivatedHooks (queue) {
  8063. for (var i = 0; i < queue.length; i++) {
  8064. queue[i]._inactive = true;
  8065. activateChildComponent(queue[i], true /* true */);
  8066. }
  8067. }
  8068. /**
  8069. * Push a watcher into the watcher queue.
  8070. * Jobs with duplicate IDs will be skipped unless it's
  8071. * pushed when the queue is being flushed.
  8072. */
  8073. function queueWatcher (watcher) {
  8074. var id = watcher.id;
  8075. if (has[id] == null) {
  8076. has[id] = true;
  8077. if (!flushing) {
  8078. queue.push(watcher);
  8079. } else {
  8080. // if already flushing, splice the watcher based on its id
  8081. // if already past its id, it will be run next immediately.
  8082. var i = queue.length - 1;
  8083. while (i > index && queue[i].id > watcher.id) {
  8084. i--;
  8085. }
  8086. queue.splice(i + 1, 0, watcher);
  8087. }
  8088. // queue the flush
  8089. if (!waiting) {
  8090. waiting = true;
  8091. if ( true && !config.async) {
  8092. flushSchedulerQueue();
  8093. return
  8094. }
  8095. nextTick(flushSchedulerQueue);
  8096. }
  8097. }
  8098. }
  8099. /* */
  8100. var uid$2 = 0;
  8101. /**
  8102. * A watcher parses an expression, collects dependencies,
  8103. * and fires callback when the expression value changes.
  8104. * This is used for both the $watch() api and directives.
  8105. */
  8106. var Watcher = function Watcher (
  8107. vm,
  8108. expOrFn,
  8109. cb,
  8110. options,
  8111. isRenderWatcher
  8112. ) {
  8113. this.vm = vm;
  8114. if (isRenderWatcher) {
  8115. vm._watcher = this;
  8116. }
  8117. vm._watchers.push(this);
  8118. // options
  8119. if (options) {
  8120. this.deep = !!options.deep;
  8121. this.user = !!options.user;
  8122. this.lazy = !!options.lazy;
  8123. this.sync = !!options.sync;
  8124. this.before = options.before;
  8125. } else {
  8126. this.deep = this.user = this.lazy = this.sync = false;
  8127. }
  8128. this.cb = cb;
  8129. this.id = ++uid$2; // uid for batching
  8130. this.active = true;
  8131. this.dirty = this.lazy; // for lazy watchers
  8132. this.deps = [];
  8133. this.newDeps = [];
  8134. this.depIds = new _Set();
  8135. this.newDepIds = new _Set();
  8136. this.expression = true
  8137. ? expOrFn.toString()
  8138. : undefined;
  8139. // parse expression for getter
  8140. if (typeof expOrFn === 'function') {
  8141. this.getter = expOrFn;
  8142. } else {
  8143. this.getter = parsePath(expOrFn);
  8144. if (!this.getter) {
  8145. this.getter = noop;
  8146. true && warn(
  8147. "Failed watching path: \"" + expOrFn + "\" " +
  8148. 'Watcher only accepts simple dot-delimited paths. ' +
  8149. 'For full control, use a function instead.',
  8150. vm
  8151. );
  8152. }
  8153. }
  8154. this.value = this.lazy
  8155. ? undefined
  8156. : this.get();
  8157. };
  8158. /**
  8159. * Evaluate the getter, and re-collect dependencies.
  8160. */
  8161. Watcher.prototype.get = function get () {
  8162. pushTarget(this);
  8163. var value;
  8164. var vm = this.vm;
  8165. try {
  8166. value = this.getter.call(vm, vm);
  8167. } catch (e) {
  8168. if (this.user) {
  8169. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  8170. } else {
  8171. throw e
  8172. }
  8173. } finally {
  8174. // "touch" every property so they are all tracked as
  8175. // dependencies for deep watching
  8176. if (this.deep) {
  8177. traverse(value);
  8178. }
  8179. popTarget();
  8180. this.cleanupDeps();
  8181. }
  8182. return value
  8183. };
  8184. /**
  8185. * Add a dependency to this directive.
  8186. */
  8187. Watcher.prototype.addDep = function addDep (dep) {
  8188. var id = dep.id;
  8189. if (!this.newDepIds.has(id)) {
  8190. this.newDepIds.add(id);
  8191. this.newDeps.push(dep);
  8192. if (!this.depIds.has(id)) {
  8193. dep.addSub(this);
  8194. }
  8195. }
  8196. };
  8197. /**
  8198. * Clean up for dependency collection.
  8199. */
  8200. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  8201. var i = this.deps.length;
  8202. while (i--) {
  8203. var dep = this.deps[i];
  8204. if (!this.newDepIds.has(dep.id)) {
  8205. dep.removeSub(this);
  8206. }
  8207. }
  8208. var tmp = this.depIds;
  8209. this.depIds = this.newDepIds;
  8210. this.newDepIds = tmp;
  8211. this.newDepIds.clear();
  8212. tmp = this.deps;
  8213. this.deps = this.newDeps;
  8214. this.newDeps = tmp;
  8215. this.newDeps.length = 0;
  8216. };
  8217. /**
  8218. * Subscriber interface.
  8219. * Will be called when a dependency changes.
  8220. */
  8221. Watcher.prototype.update = function update () {
  8222. /* istanbul ignore else */
  8223. if (this.lazy) {
  8224. this.dirty = true;
  8225. } else if (this.sync) {
  8226. this.run();
  8227. } else {
  8228. queueWatcher(this);
  8229. }
  8230. };
  8231. /**
  8232. * Scheduler job interface.
  8233. * Will be called by the scheduler.
  8234. */
  8235. Watcher.prototype.run = function run () {
  8236. if (this.active) {
  8237. var value = this.get();
  8238. if (
  8239. value !== this.value ||
  8240. // Deep watchers and watchers on Object/Arrays should fire even
  8241. // when the value is the same, because the value may
  8242. // have mutated.
  8243. isObject(value) ||
  8244. this.deep
  8245. ) {
  8246. // set new value
  8247. var oldValue = this.value;
  8248. this.value = value;
  8249. if (this.user) {
  8250. try {
  8251. this.cb.call(this.vm, value, oldValue);
  8252. } catch (e) {
  8253. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  8254. }
  8255. } else {
  8256. this.cb.call(this.vm, value, oldValue);
  8257. }
  8258. }
  8259. }
  8260. };
  8261. /**
  8262. * Evaluate the value of the watcher.
  8263. * This only gets called for lazy watchers.
  8264. */
  8265. Watcher.prototype.evaluate = function evaluate () {
  8266. this.value = this.get();
  8267. this.dirty = false;
  8268. };
  8269. /**
  8270. * Depend on all deps collected by this watcher.
  8271. */
  8272. Watcher.prototype.depend = function depend () {
  8273. var i = this.deps.length;
  8274. while (i--) {
  8275. this.deps[i].depend();
  8276. }
  8277. };
  8278. /**
  8279. * Remove self from all dependencies' subscriber list.
  8280. */
  8281. Watcher.prototype.teardown = function teardown () {
  8282. if (this.active) {
  8283. // remove self from vm's watcher list
  8284. // this is a somewhat expensive operation so we skip it
  8285. // if the vm is being destroyed.
  8286. if (!this.vm._isBeingDestroyed) {
  8287. remove(this.vm._watchers, this);
  8288. }
  8289. var i = this.deps.length;
  8290. while (i--) {
  8291. this.deps[i].removeSub(this);
  8292. }
  8293. this.active = false;
  8294. }
  8295. };
  8296. /* */
  8297. var sharedPropertyDefinition = {
  8298. enumerable: true,
  8299. configurable: true,
  8300. get: noop,
  8301. set: noop
  8302. };
  8303. function proxy (target, sourceKey, key) {
  8304. sharedPropertyDefinition.get = function proxyGetter () {
  8305. return this[sourceKey][key]
  8306. };
  8307. sharedPropertyDefinition.set = function proxySetter (val) {
  8308. this[sourceKey][key] = val;
  8309. };
  8310. Object.defineProperty(target, key, sharedPropertyDefinition);
  8311. }
  8312. function initState (vm) {
  8313. vm._watchers = [];
  8314. var opts = vm.$options;
  8315. if (opts.props) { initProps(vm, opts.props); }
  8316. if (opts.methods) { initMethods(vm, opts.methods); }
  8317. if (opts.data) {
  8318. initData(vm);
  8319. } else {
  8320. observe(vm._data = {}, true /* asRootData */);
  8321. }
  8322. if (opts.computed) { initComputed(vm, opts.computed); }
  8323. if (opts.watch && opts.watch !== nativeWatch) {
  8324. initWatch(vm, opts.watch);
  8325. }
  8326. }
  8327. function initProps (vm, propsOptions) {
  8328. var propsData = vm.$options.propsData || {};
  8329. var props = vm._props = {};
  8330. // cache prop keys so that future props updates can iterate using Array
  8331. // instead of dynamic object key enumeration.
  8332. var keys = vm.$options._propKeys = [];
  8333. var isRoot = !vm.$parent;
  8334. // root instance props should be converted
  8335. if (!isRoot) {
  8336. toggleObserving(false);
  8337. }
  8338. var loop = function ( key ) {
  8339. keys.push(key);
  8340. var value = validateProp(key, propsOptions, propsData, vm);
  8341. /* istanbul ignore else */
  8342. if (true) {
  8343. var hyphenatedKey = hyphenate(key);
  8344. if (isReservedAttribute(hyphenatedKey) ||
  8345. config.isReservedAttr(hyphenatedKey)) {
  8346. warn(
  8347. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  8348. vm
  8349. );
  8350. }
  8351. defineReactive$$1(props, key, value, function () {
  8352. if (!isRoot && !isUpdatingChildComponent) {
  8353. {
  8354. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  8355. return
  8356. }
  8357. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  8358. if(
  8359. key === 'value' &&
  8360. Array.isArray(vm.$options.behaviors) &&
  8361. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  8362. ){
  8363. return
  8364. }
  8365. if(vm._getFormData){
  8366. return
  8367. }
  8368. var $parent = vm.$parent;
  8369. while($parent){
  8370. if($parent.__next_tick_pending){
  8371. return
  8372. }
  8373. $parent = $parent.$parent;
  8374. }
  8375. }
  8376. warn(
  8377. "Avoid mutating a prop directly since the value will be " +
  8378. "overwritten whenever the parent component re-renders. " +
  8379. "Instead, use a data or computed property based on the prop's " +
  8380. "value. Prop being mutated: \"" + key + "\"",
  8381. vm
  8382. );
  8383. }
  8384. });
  8385. } else {}
  8386. // static props are already proxied on the component's prototype
  8387. // during Vue.extend(). We only need to proxy props defined at
  8388. // instantiation here.
  8389. if (!(key in vm)) {
  8390. proxy(vm, "_props", key);
  8391. }
  8392. };
  8393. for (var key in propsOptions) loop( key );
  8394. toggleObserving(true);
  8395. }
  8396. function initData (vm) {
  8397. var data = vm.$options.data;
  8398. data = vm._data = typeof data === 'function'
  8399. ? getData(data, vm)
  8400. : data || {};
  8401. if (!isPlainObject(data)) {
  8402. data = {};
  8403. true && warn(
  8404. 'data functions should return an object:\n' +
  8405. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  8406. vm
  8407. );
  8408. }
  8409. // proxy data on instance
  8410. var keys = Object.keys(data);
  8411. var props = vm.$options.props;
  8412. var methods = vm.$options.methods;
  8413. var i = keys.length;
  8414. while (i--) {
  8415. var key = keys[i];
  8416. if (true) {
  8417. if (methods && hasOwn(methods, key)) {
  8418. warn(
  8419. ("Method \"" + key + "\" has already been defined as a data property."),
  8420. vm
  8421. );
  8422. }
  8423. }
  8424. if (props && hasOwn(props, key)) {
  8425. true && warn(
  8426. "The data property \"" + key + "\" is already declared as a prop. " +
  8427. "Use prop default value instead.",
  8428. vm
  8429. );
  8430. } else if (!isReserved(key)) {
  8431. proxy(vm, "_data", key);
  8432. }
  8433. }
  8434. // observe data
  8435. observe(data, true /* asRootData */);
  8436. }
  8437. function getData (data, vm) {
  8438. // #7573 disable dep collection when invoking data getters
  8439. pushTarget();
  8440. try {
  8441. return data.call(vm, vm)
  8442. } catch (e) {
  8443. handleError(e, vm, "data()");
  8444. return {}
  8445. } finally {
  8446. popTarget();
  8447. }
  8448. }
  8449. var computedWatcherOptions = { lazy: true };
  8450. function initComputed (vm, computed) {
  8451. // $flow-disable-line
  8452. var watchers = vm._computedWatchers = Object.create(null);
  8453. // computed properties are just getters during SSR
  8454. var isSSR = isServerRendering();
  8455. for (var key in computed) {
  8456. var userDef = computed[key];
  8457. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  8458. if ( true && getter == null) {
  8459. warn(
  8460. ("Getter is missing for computed property \"" + key + "\"."),
  8461. vm
  8462. );
  8463. }
  8464. if (!isSSR) {
  8465. // create internal watcher for the computed property.
  8466. watchers[key] = new Watcher(
  8467. vm,
  8468. getter || noop,
  8469. noop,
  8470. computedWatcherOptions
  8471. );
  8472. }
  8473. // component-defined computed properties are already defined on the
  8474. // component prototype. We only need to define computed properties defined
  8475. // at instantiation here.
  8476. if (!(key in vm)) {
  8477. defineComputed(vm, key, userDef);
  8478. } else if (true) {
  8479. if (key in vm.$data) {
  8480. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  8481. } else if (vm.$options.props && key in vm.$options.props) {
  8482. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  8483. }
  8484. }
  8485. }
  8486. }
  8487. function defineComputed (
  8488. target,
  8489. key,
  8490. userDef
  8491. ) {
  8492. var shouldCache = !isServerRendering();
  8493. if (typeof userDef === 'function') {
  8494. sharedPropertyDefinition.get = shouldCache
  8495. ? createComputedGetter(key)
  8496. : createGetterInvoker(userDef);
  8497. sharedPropertyDefinition.set = noop;
  8498. } else {
  8499. sharedPropertyDefinition.get = userDef.get
  8500. ? shouldCache && userDef.cache !== false
  8501. ? createComputedGetter(key)
  8502. : createGetterInvoker(userDef.get)
  8503. : noop;
  8504. sharedPropertyDefinition.set = userDef.set || noop;
  8505. }
  8506. if ( true &&
  8507. sharedPropertyDefinition.set === noop) {
  8508. sharedPropertyDefinition.set = function () {
  8509. warn(
  8510. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  8511. this
  8512. );
  8513. };
  8514. }
  8515. Object.defineProperty(target, key, sharedPropertyDefinition);
  8516. }
  8517. function createComputedGetter (key) {
  8518. return function computedGetter () {
  8519. var watcher = this._computedWatchers && this._computedWatchers[key];
  8520. if (watcher) {
  8521. if (watcher.dirty) {
  8522. watcher.evaluate();
  8523. }
  8524. if (Dep.SharedObject.target) {// fixed by xxxxxx
  8525. watcher.depend();
  8526. }
  8527. return watcher.value
  8528. }
  8529. }
  8530. }
  8531. function createGetterInvoker(fn) {
  8532. return function computedGetter () {
  8533. return fn.call(this, this)
  8534. }
  8535. }
  8536. function initMethods (vm, methods) {
  8537. var props = vm.$options.props;
  8538. for (var key in methods) {
  8539. if (true) {
  8540. if (typeof methods[key] !== 'function') {
  8541. warn(
  8542. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  8543. "Did you reference the function correctly?",
  8544. vm
  8545. );
  8546. }
  8547. if (props && hasOwn(props, key)) {
  8548. warn(
  8549. ("Method \"" + key + "\" has already been defined as a prop."),
  8550. vm
  8551. );
  8552. }
  8553. if ((key in vm) && isReserved(key)) {
  8554. warn(
  8555. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  8556. "Avoid defining component methods that start with _ or $."
  8557. );
  8558. }
  8559. }
  8560. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  8561. }
  8562. }
  8563. function initWatch (vm, watch) {
  8564. for (var key in watch) {
  8565. var handler = watch[key];
  8566. if (Array.isArray(handler)) {
  8567. for (var i = 0; i < handler.length; i++) {
  8568. createWatcher(vm, key, handler[i]);
  8569. }
  8570. } else {
  8571. createWatcher(vm, key, handler);
  8572. }
  8573. }
  8574. }
  8575. function createWatcher (
  8576. vm,
  8577. expOrFn,
  8578. handler,
  8579. options
  8580. ) {
  8581. if (isPlainObject(handler)) {
  8582. options = handler;
  8583. handler = handler.handler;
  8584. }
  8585. if (typeof handler === 'string') {
  8586. handler = vm[handler];
  8587. }
  8588. return vm.$watch(expOrFn, handler, options)
  8589. }
  8590. function stateMixin (Vue) {
  8591. // flow somehow has problems with directly declared definition object
  8592. // when using Object.defineProperty, so we have to procedurally build up
  8593. // the object here.
  8594. var dataDef = {};
  8595. dataDef.get = function () { return this._data };
  8596. var propsDef = {};
  8597. propsDef.get = function () { return this._props };
  8598. if (true) {
  8599. dataDef.set = function () {
  8600. warn(
  8601. 'Avoid replacing instance root $data. ' +
  8602. 'Use nested data properties instead.',
  8603. this
  8604. );
  8605. };
  8606. propsDef.set = function () {
  8607. warn("$props is readonly.", this);
  8608. };
  8609. }
  8610. Object.defineProperty(Vue.prototype, '$data', dataDef);
  8611. Object.defineProperty(Vue.prototype, '$props', propsDef);
  8612. Vue.prototype.$set = set;
  8613. Vue.prototype.$delete = del;
  8614. Vue.prototype.$watch = function (
  8615. expOrFn,
  8616. cb,
  8617. options
  8618. ) {
  8619. var vm = this;
  8620. if (isPlainObject(cb)) {
  8621. return createWatcher(vm, expOrFn, cb, options)
  8622. }
  8623. options = options || {};
  8624. options.user = true;
  8625. var watcher = new Watcher(vm, expOrFn, cb, options);
  8626. if (options.immediate) {
  8627. try {
  8628. cb.call(vm, watcher.value);
  8629. } catch (error) {
  8630. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  8631. }
  8632. }
  8633. return function unwatchFn () {
  8634. watcher.teardown();
  8635. }
  8636. };
  8637. }
  8638. /* */
  8639. var uid$3 = 0;
  8640. function initMixin (Vue) {
  8641. Vue.prototype._init = function (options) {
  8642. var vm = this;
  8643. // a uid
  8644. vm._uid = uid$3++;
  8645. var startTag, endTag;
  8646. /* istanbul ignore if */
  8647. if ( true && config.performance && mark) {
  8648. startTag = "vue-perf-start:" + (vm._uid);
  8649. endTag = "vue-perf-end:" + (vm._uid);
  8650. mark(startTag);
  8651. }
  8652. // a flag to avoid this being observed
  8653. vm._isVue = true;
  8654. // merge options
  8655. if (options && options._isComponent) {
  8656. // optimize internal component instantiation
  8657. // since dynamic options merging is pretty slow, and none of the
  8658. // internal component options needs special treatment.
  8659. initInternalComponent(vm, options);
  8660. } else {
  8661. vm.$options = mergeOptions(
  8662. resolveConstructorOptions(vm.constructor),
  8663. options || {},
  8664. vm
  8665. );
  8666. }
  8667. /* istanbul ignore else */
  8668. if (true) {
  8669. initProxy(vm);
  8670. } else {}
  8671. // expose real self
  8672. vm._self = vm;
  8673. initLifecycle(vm);
  8674. initEvents(vm);
  8675. initRender(vm);
  8676. callHook(vm, 'beforeCreate');
  8677. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  8678. initState(vm);
  8679. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  8680. !vm._$fallback && callHook(vm, 'created');
  8681. /* istanbul ignore if */
  8682. if ( true && config.performance && mark) {
  8683. vm._name = formatComponentName(vm, false);
  8684. mark(endTag);
  8685. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  8686. }
  8687. if (vm.$options.el) {
  8688. vm.$mount(vm.$options.el);
  8689. }
  8690. };
  8691. }
  8692. function initInternalComponent (vm, options) {
  8693. var opts = vm.$options = Object.create(vm.constructor.options);
  8694. // doing this because it's faster than dynamic enumeration.
  8695. var parentVnode = options._parentVnode;
  8696. opts.parent = options.parent;
  8697. opts._parentVnode = parentVnode;
  8698. var vnodeComponentOptions = parentVnode.componentOptions;
  8699. opts.propsData = vnodeComponentOptions.propsData;
  8700. opts._parentListeners = vnodeComponentOptions.listeners;
  8701. opts._renderChildren = vnodeComponentOptions.children;
  8702. opts._componentTag = vnodeComponentOptions.tag;
  8703. if (options.render) {
  8704. opts.render = options.render;
  8705. opts.staticRenderFns = options.staticRenderFns;
  8706. }
  8707. }
  8708. function resolveConstructorOptions (Ctor) {
  8709. var options = Ctor.options;
  8710. if (Ctor.super) {
  8711. var superOptions = resolveConstructorOptions(Ctor.super);
  8712. var cachedSuperOptions = Ctor.superOptions;
  8713. if (superOptions !== cachedSuperOptions) {
  8714. // super option changed,
  8715. // need to resolve new options.
  8716. Ctor.superOptions = superOptions;
  8717. // check if there are any late-modified/attached options (#4976)
  8718. var modifiedOptions = resolveModifiedOptions(Ctor);
  8719. // update base extend options
  8720. if (modifiedOptions) {
  8721. extend(Ctor.extendOptions, modifiedOptions);
  8722. }
  8723. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  8724. if (options.name) {
  8725. options.components[options.name] = Ctor;
  8726. }
  8727. }
  8728. }
  8729. return options
  8730. }
  8731. function resolveModifiedOptions (Ctor) {
  8732. var modified;
  8733. var latest = Ctor.options;
  8734. var sealed = Ctor.sealedOptions;
  8735. for (var key in latest) {
  8736. if (latest[key] !== sealed[key]) {
  8737. if (!modified) { modified = {}; }
  8738. modified[key] = latest[key];
  8739. }
  8740. }
  8741. return modified
  8742. }
  8743. function Vue (options) {
  8744. if ( true &&
  8745. !(this instanceof Vue)
  8746. ) {
  8747. warn('Vue is a constructor and should be called with the `new` keyword');
  8748. }
  8749. this._init(options);
  8750. }
  8751. initMixin(Vue);
  8752. stateMixin(Vue);
  8753. eventsMixin(Vue);
  8754. lifecycleMixin(Vue);
  8755. renderMixin(Vue);
  8756. /* */
  8757. function initUse (Vue) {
  8758. Vue.use = function (plugin) {
  8759. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  8760. if (installedPlugins.indexOf(plugin) > -1) {
  8761. return this
  8762. }
  8763. // additional parameters
  8764. var args = toArray(arguments, 1);
  8765. args.unshift(this);
  8766. if (typeof plugin.install === 'function') {
  8767. plugin.install.apply(plugin, args);
  8768. } else if (typeof plugin === 'function') {
  8769. plugin.apply(null, args);
  8770. }
  8771. installedPlugins.push(plugin);
  8772. return this
  8773. };
  8774. }
  8775. /* */
  8776. function initMixin$1 (Vue) {
  8777. Vue.mixin = function (mixin) {
  8778. this.options = mergeOptions(this.options, mixin);
  8779. return this
  8780. };
  8781. }
  8782. /* */
  8783. function initExtend (Vue) {
  8784. /**
  8785. * Each instance constructor, including Vue, has a unique
  8786. * cid. This enables us to create wrapped "child
  8787. * constructors" for prototypal inheritance and cache them.
  8788. */
  8789. Vue.cid = 0;
  8790. var cid = 1;
  8791. /**
  8792. * Class inheritance
  8793. */
  8794. Vue.extend = function (extendOptions) {
  8795. extendOptions = extendOptions || {};
  8796. var Super = this;
  8797. var SuperId = Super.cid;
  8798. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  8799. if (cachedCtors[SuperId]) {
  8800. return cachedCtors[SuperId]
  8801. }
  8802. var name = extendOptions.name || Super.options.name;
  8803. if ( true && name) {
  8804. validateComponentName(name);
  8805. }
  8806. var Sub = function VueComponent (options) {
  8807. this._init(options);
  8808. };
  8809. Sub.prototype = Object.create(Super.prototype);
  8810. Sub.prototype.constructor = Sub;
  8811. Sub.cid = cid++;
  8812. Sub.options = mergeOptions(
  8813. Super.options,
  8814. extendOptions
  8815. );
  8816. Sub['super'] = Super;
  8817. // For props and computed properties, we define the proxy getters on
  8818. // the Vue instances at extension time, on the extended prototype. This
  8819. // avoids Object.defineProperty calls for each instance created.
  8820. if (Sub.options.props) {
  8821. initProps$1(Sub);
  8822. }
  8823. if (Sub.options.computed) {
  8824. initComputed$1(Sub);
  8825. }
  8826. // allow further extension/mixin/plugin usage
  8827. Sub.extend = Super.extend;
  8828. Sub.mixin = Super.mixin;
  8829. Sub.use = Super.use;
  8830. // create asset registers, so extended classes
  8831. // can have their private assets too.
  8832. ASSET_TYPES.forEach(function (type) {
  8833. Sub[type] = Super[type];
  8834. });
  8835. // enable recursive self-lookup
  8836. if (name) {
  8837. Sub.options.components[name] = Sub;
  8838. }
  8839. // keep a reference to the super options at extension time.
  8840. // later at instantiation we can check if Super's options have
  8841. // been updated.
  8842. Sub.superOptions = Super.options;
  8843. Sub.extendOptions = extendOptions;
  8844. Sub.sealedOptions = extend({}, Sub.options);
  8845. // cache constructor
  8846. cachedCtors[SuperId] = Sub;
  8847. return Sub
  8848. };
  8849. }
  8850. function initProps$1 (Comp) {
  8851. var props = Comp.options.props;
  8852. for (var key in props) {
  8853. proxy(Comp.prototype, "_props", key);
  8854. }
  8855. }
  8856. function initComputed$1 (Comp) {
  8857. var computed = Comp.options.computed;
  8858. for (var key in computed) {
  8859. defineComputed(Comp.prototype, key, computed[key]);
  8860. }
  8861. }
  8862. /* */
  8863. function initAssetRegisters (Vue) {
  8864. /**
  8865. * Create asset registration methods.
  8866. */
  8867. ASSET_TYPES.forEach(function (type) {
  8868. Vue[type] = function (
  8869. id,
  8870. definition
  8871. ) {
  8872. if (!definition) {
  8873. return this.options[type + 's'][id]
  8874. } else {
  8875. /* istanbul ignore if */
  8876. if ( true && type === 'component') {
  8877. validateComponentName(id);
  8878. }
  8879. if (type === 'component' && isPlainObject(definition)) {
  8880. definition.name = definition.name || id;
  8881. definition = this.options._base.extend(definition);
  8882. }
  8883. if (type === 'directive' && typeof definition === 'function') {
  8884. definition = { bind: definition, update: definition };
  8885. }
  8886. this.options[type + 's'][id] = definition;
  8887. return definition
  8888. }
  8889. };
  8890. });
  8891. }
  8892. /* */
  8893. function getComponentName (opts) {
  8894. return opts && (opts.Ctor.options.name || opts.tag)
  8895. }
  8896. function matches (pattern, name) {
  8897. if (Array.isArray(pattern)) {
  8898. return pattern.indexOf(name) > -1
  8899. } else if (typeof pattern === 'string') {
  8900. return pattern.split(',').indexOf(name) > -1
  8901. } else if (isRegExp(pattern)) {
  8902. return pattern.test(name)
  8903. }
  8904. /* istanbul ignore next */
  8905. return false
  8906. }
  8907. function pruneCache (keepAliveInstance, filter) {
  8908. var cache = keepAliveInstance.cache;
  8909. var keys = keepAliveInstance.keys;
  8910. var _vnode = keepAliveInstance._vnode;
  8911. for (var key in cache) {
  8912. var cachedNode = cache[key];
  8913. if (cachedNode) {
  8914. var name = getComponentName(cachedNode.componentOptions);
  8915. if (name && !filter(name)) {
  8916. pruneCacheEntry(cache, key, keys, _vnode);
  8917. }
  8918. }
  8919. }
  8920. }
  8921. function pruneCacheEntry (
  8922. cache,
  8923. key,
  8924. keys,
  8925. current
  8926. ) {
  8927. var cached$$1 = cache[key];
  8928. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  8929. cached$$1.componentInstance.$destroy();
  8930. }
  8931. cache[key] = null;
  8932. remove(keys, key);
  8933. }
  8934. var patternTypes = [String, RegExp, Array];
  8935. var KeepAlive = {
  8936. name: 'keep-alive',
  8937. abstract: true,
  8938. props: {
  8939. include: patternTypes,
  8940. exclude: patternTypes,
  8941. max: [String, Number]
  8942. },
  8943. created: function created () {
  8944. this.cache = Object.create(null);
  8945. this.keys = [];
  8946. },
  8947. destroyed: function destroyed () {
  8948. for (var key in this.cache) {
  8949. pruneCacheEntry(this.cache, key, this.keys);
  8950. }
  8951. },
  8952. mounted: function mounted () {
  8953. var this$1 = this;
  8954. this.$watch('include', function (val) {
  8955. pruneCache(this$1, function (name) { return matches(val, name); });
  8956. });
  8957. this.$watch('exclude', function (val) {
  8958. pruneCache(this$1, function (name) { return !matches(val, name); });
  8959. });
  8960. },
  8961. render: function render () {
  8962. var slot = this.$slots.default;
  8963. var vnode = getFirstComponentChild(slot);
  8964. var componentOptions = vnode && vnode.componentOptions;
  8965. if (componentOptions) {
  8966. // check pattern
  8967. var name = getComponentName(componentOptions);
  8968. var ref = this;
  8969. var include = ref.include;
  8970. var exclude = ref.exclude;
  8971. if (
  8972. // not included
  8973. (include && (!name || !matches(include, name))) ||
  8974. // excluded
  8975. (exclude && name && matches(exclude, name))
  8976. ) {
  8977. return vnode
  8978. }
  8979. var ref$1 = this;
  8980. var cache = ref$1.cache;
  8981. var keys = ref$1.keys;
  8982. var key = vnode.key == null
  8983. // same constructor may get registered as different local components
  8984. // so cid alone is not enough (#3269)
  8985. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  8986. : vnode.key;
  8987. if (cache[key]) {
  8988. vnode.componentInstance = cache[key].componentInstance;
  8989. // make current key freshest
  8990. remove(keys, key);
  8991. keys.push(key);
  8992. } else {
  8993. cache[key] = vnode;
  8994. keys.push(key);
  8995. // prune oldest entry
  8996. if (this.max && keys.length > parseInt(this.max)) {
  8997. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  8998. }
  8999. }
  9000. vnode.data.keepAlive = true;
  9001. }
  9002. return vnode || (slot && slot[0])
  9003. }
  9004. };
  9005. var builtInComponents = {
  9006. KeepAlive: KeepAlive
  9007. };
  9008. /* */
  9009. function initGlobalAPI (Vue) {
  9010. // config
  9011. var configDef = {};
  9012. configDef.get = function () { return config; };
  9013. if (true) {
  9014. configDef.set = function () {
  9015. warn(
  9016. 'Do not replace the Vue.config object, set individual fields instead.'
  9017. );
  9018. };
  9019. }
  9020. Object.defineProperty(Vue, 'config', configDef);
  9021. // exposed util methods.
  9022. // NOTE: these are not considered part of the public API - avoid relying on
  9023. // them unless you are aware of the risk.
  9024. Vue.util = {
  9025. warn: warn,
  9026. extend: extend,
  9027. mergeOptions: mergeOptions,
  9028. defineReactive: defineReactive$$1
  9029. };
  9030. Vue.set = set;
  9031. Vue.delete = del;
  9032. Vue.nextTick = nextTick;
  9033. // 2.6 explicit observable API
  9034. Vue.observable = function (obj) {
  9035. observe(obj);
  9036. return obj
  9037. };
  9038. Vue.options = Object.create(null);
  9039. ASSET_TYPES.forEach(function (type) {
  9040. Vue.options[type + 's'] = Object.create(null);
  9041. });
  9042. // this is used to identify the "base" constructor to extend all plain-object
  9043. // components with in Weex's multi-instance scenarios.
  9044. Vue.options._base = Vue;
  9045. extend(Vue.options.components, builtInComponents);
  9046. initUse(Vue);
  9047. initMixin$1(Vue);
  9048. initExtend(Vue);
  9049. initAssetRegisters(Vue);
  9050. }
  9051. initGlobalAPI(Vue);
  9052. Object.defineProperty(Vue.prototype, '$isServer', {
  9053. get: isServerRendering
  9054. });
  9055. Object.defineProperty(Vue.prototype, '$ssrContext', {
  9056. get: function get () {
  9057. /* istanbul ignore next */
  9058. return this.$vnode && this.$vnode.ssrContext
  9059. }
  9060. });
  9061. // expose FunctionalRenderContext for ssr runtime helper installation
  9062. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  9063. value: FunctionalRenderContext
  9064. });
  9065. Vue.version = '2.6.11';
  9066. /**
  9067. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  9068. */
  9069. var ARRAYTYPE = '[object Array]';
  9070. var OBJECTTYPE = '[object Object]';
  9071. var NULLTYPE = '[object Null]';
  9072. var UNDEFINEDTYPE = '[object Undefined]';
  9073. // const FUNCTIONTYPE = '[object Function]'
  9074. function diff(current, pre) {
  9075. var result = {};
  9076. syncKeys(current, pre);
  9077. _diff(current, pre, '', result);
  9078. return result
  9079. }
  9080. function syncKeys(current, pre) {
  9081. if (current === pre) { return }
  9082. var rootCurrentType = type(current);
  9083. var rootPreType = type(pre);
  9084. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  9085. if(Object.keys(current).length >= Object.keys(pre).length){
  9086. for (var key in pre) {
  9087. var currentValue = current[key];
  9088. if (currentValue === undefined) {
  9089. current[key] = null;
  9090. } else {
  9091. syncKeys(currentValue, pre[key]);
  9092. }
  9093. }
  9094. }
  9095. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  9096. if (current.length >= pre.length) {
  9097. pre.forEach(function (item, index) {
  9098. syncKeys(current[index], item);
  9099. });
  9100. }
  9101. }
  9102. }
  9103. function nullOrUndefined(currentType, preType) {
  9104. if(
  9105. (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
  9106. (preType === NULLTYPE || preType === UNDEFINEDTYPE)
  9107. ) {
  9108. return false
  9109. }
  9110. return true
  9111. }
  9112. function _diff(current, pre, path, result) {
  9113. if (current === pre) { return }
  9114. var rootCurrentType = type(current);
  9115. var rootPreType = type(pre);
  9116. if (rootCurrentType == OBJECTTYPE) {
  9117. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  9118. setResult(result, path, current);
  9119. } else {
  9120. var loop = function ( key ) {
  9121. var currentValue = current[key];
  9122. var preValue = pre[key];
  9123. var currentType = type(currentValue);
  9124. var preType = type(preValue);
  9125. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  9126. if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
  9127. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9128. }
  9129. } else if (currentType == ARRAYTYPE) {
  9130. if (preType != ARRAYTYPE) {
  9131. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9132. } else {
  9133. if (currentValue.length < preValue.length) {
  9134. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9135. } else {
  9136. currentValue.forEach(function (item, index) {
  9137. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  9138. });
  9139. }
  9140. }
  9141. } else if (currentType == OBJECTTYPE) {
  9142. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  9143. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9144. } else {
  9145. for (var subKey in currentValue) {
  9146. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  9147. }
  9148. }
  9149. }
  9150. };
  9151. for (var key in current) loop( key );
  9152. }
  9153. } else if (rootCurrentType == ARRAYTYPE) {
  9154. if (rootPreType != ARRAYTYPE) {
  9155. setResult(result, path, current);
  9156. } else {
  9157. if (current.length < pre.length) {
  9158. setResult(result, path, current);
  9159. } else {
  9160. current.forEach(function (item, index) {
  9161. _diff(item, pre[index], path + '[' + index + ']', result);
  9162. });
  9163. }
  9164. }
  9165. } else {
  9166. setResult(result, path, current);
  9167. }
  9168. }
  9169. function setResult(result, k, v) {
  9170. // if (type(v) != FUNCTIONTYPE) {
  9171. result[k] = v;
  9172. // }
  9173. }
  9174. function type(obj) {
  9175. return Object.prototype.toString.call(obj)
  9176. }
  9177. /* */
  9178. function flushCallbacks$1(vm) {
  9179. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  9180. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  9181. var mpInstance = vm.$scope;
  9182. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  9183. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  9184. }
  9185. var copies = vm.__next_tick_callbacks.slice(0);
  9186. vm.__next_tick_callbacks.length = 0;
  9187. for (var i = 0; i < copies.length; i++) {
  9188. copies[i]();
  9189. }
  9190. }
  9191. }
  9192. function hasRenderWatcher(vm) {
  9193. return queue.find(function (watcher) { return vm._watcher === watcher; })
  9194. }
  9195. function nextTick$1(vm, cb) {
  9196. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  9197. //2.nextTick 之前存在 render watcher
  9198. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  9199. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  9200. var mpInstance = vm.$scope;
  9201. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  9202. ']:nextVueTick');
  9203. }
  9204. return nextTick(cb, vm)
  9205. }else{
  9206. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  9207. var mpInstance$1 = vm.$scope;
  9208. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  9209. ']:nextMPTick');
  9210. }
  9211. }
  9212. var _resolve;
  9213. if (!vm.__next_tick_callbacks) {
  9214. vm.__next_tick_callbacks = [];
  9215. }
  9216. vm.__next_tick_callbacks.push(function () {
  9217. if (cb) {
  9218. try {
  9219. cb.call(vm);
  9220. } catch (e) {
  9221. handleError(e, vm, 'nextTick');
  9222. }
  9223. } else if (_resolve) {
  9224. _resolve(vm);
  9225. }
  9226. });
  9227. // $flow-disable-line
  9228. if (!cb && typeof Promise !== 'undefined') {
  9229. return new Promise(function (resolve) {
  9230. _resolve = resolve;
  9231. })
  9232. }
  9233. }
  9234. /* */
  9235. function clearInstance(key, value) {
  9236. // 简易去除 Vue 和小程序组件实例
  9237. if (value) {
  9238. if (value._isVue || value.__v_isMPComponent) {
  9239. return {}
  9240. }
  9241. }
  9242. return value
  9243. }
  9244. function cloneWithData(vm) {
  9245. // 确保当前 vm 所有数据被同步
  9246. var ret = Object.create(null);
  9247. var dataKeys = [].concat(
  9248. Object.keys(vm._data || {}),
  9249. Object.keys(vm._computedWatchers || {}));
  9250. dataKeys.reduce(function(ret, key) {
  9251. ret[key] = vm[key];
  9252. return ret
  9253. }, ret);
  9254. // vue-composition-api
  9255. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  9256. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  9257. if (rawBindings) {
  9258. Object.keys(rawBindings).forEach(function (key) {
  9259. ret[key] = vm[key];
  9260. });
  9261. }
  9262. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  9263. Object.assign(ret, vm.$mp.data || {});
  9264. if (
  9265. Array.isArray(vm.$options.behaviors) &&
  9266. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  9267. ) { //form-field
  9268. ret['name'] = vm.name;
  9269. ret['value'] = vm.value;
  9270. }
  9271. return JSON.parse(JSON.stringify(ret, clearInstance))
  9272. }
  9273. var patch = function(oldVnode, vnode) {
  9274. var this$1 = this;
  9275. if (vnode === null) { //destroy
  9276. return
  9277. }
  9278. if (this.mpType === 'page' || this.mpType === 'component') {
  9279. var mpInstance = this.$scope;
  9280. var data = Object.create(null);
  9281. try {
  9282. data = cloneWithData(this);
  9283. } catch (err) {
  9284. console.error(err);
  9285. }
  9286. data.__webviewId__ = mpInstance.data.__webviewId__;
  9287. var mpData = Object.create(null);
  9288. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  9289. mpData[key] = mpInstance.data[key];
  9290. });
  9291. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  9292. if (Object.keys(diffData).length) {
  9293. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  9294. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  9295. ']差量更新',
  9296. JSON.stringify(diffData));
  9297. }
  9298. this.__next_tick_pending = true;
  9299. mpInstance.setData(diffData, function () {
  9300. this$1.__next_tick_pending = false;
  9301. flushCallbacks$1(this$1);
  9302. });
  9303. } else {
  9304. flushCallbacks$1(this);
  9305. }
  9306. }
  9307. };
  9308. /* */
  9309. function createEmptyRender() {
  9310. }
  9311. function mountComponent$1(
  9312. vm,
  9313. el,
  9314. hydrating
  9315. ) {
  9316. if (!vm.mpType) {//main.js 中的 new Vue
  9317. return vm
  9318. }
  9319. if (vm.mpType === 'app') {
  9320. vm.$options.render = createEmptyRender;
  9321. }
  9322. if (!vm.$options.render) {
  9323. vm.$options.render = createEmptyRender;
  9324. if (true) {
  9325. /* istanbul ignore if */
  9326. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  9327. vm.$options.el || el) {
  9328. warn(
  9329. 'You are using the runtime-only build of Vue where the template ' +
  9330. 'compiler is not available. Either pre-compile the templates into ' +
  9331. 'render functions, or use the compiler-included build.',
  9332. vm
  9333. );
  9334. } else {
  9335. warn(
  9336. 'Failed to mount component: template or render function not defined.',
  9337. vm
  9338. );
  9339. }
  9340. }
  9341. }
  9342. !vm._$fallback && callHook(vm, 'beforeMount');
  9343. var updateComponent = function () {
  9344. vm._update(vm._render(), hydrating);
  9345. };
  9346. // we set this to vm._watcher inside the watcher's constructor
  9347. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  9348. // component's mounted hook), which relies on vm._watcher being already defined
  9349. new Watcher(vm, updateComponent, noop, {
  9350. before: function before() {
  9351. if (vm._isMounted && !vm._isDestroyed) {
  9352. callHook(vm, 'beforeUpdate');
  9353. }
  9354. }
  9355. }, true /* isRenderWatcher */);
  9356. hydrating = false;
  9357. return vm
  9358. }
  9359. /* */
  9360. function renderClass (
  9361. staticClass,
  9362. dynamicClass
  9363. ) {
  9364. if (isDef(staticClass) || isDef(dynamicClass)) {
  9365. return concat(staticClass, stringifyClass(dynamicClass))
  9366. }
  9367. /* istanbul ignore next */
  9368. return ''
  9369. }
  9370. function concat (a, b) {
  9371. return a ? b ? (a + ' ' + b) : a : (b || '')
  9372. }
  9373. function stringifyClass (value) {
  9374. if (Array.isArray(value)) {
  9375. return stringifyArray(value)
  9376. }
  9377. if (isObject(value)) {
  9378. return stringifyObject(value)
  9379. }
  9380. if (typeof value === 'string') {
  9381. return value
  9382. }
  9383. /* istanbul ignore next */
  9384. return ''
  9385. }
  9386. function stringifyArray (value) {
  9387. var res = '';
  9388. var stringified;
  9389. for (var i = 0, l = value.length; i < l; i++) {
  9390. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  9391. if (res) { res += ' '; }
  9392. res += stringified;
  9393. }
  9394. }
  9395. return res
  9396. }
  9397. function stringifyObject (value) {
  9398. var res = '';
  9399. for (var key in value) {
  9400. if (value[key]) {
  9401. if (res) { res += ' '; }
  9402. res += key;
  9403. }
  9404. }
  9405. return res
  9406. }
  9407. /* */
  9408. var parseStyleText = cached(function (cssText) {
  9409. var res = {};
  9410. var listDelimiter = /;(?![^(]*\))/g;
  9411. var propertyDelimiter = /:(.+)/;
  9412. cssText.split(listDelimiter).forEach(function (item) {
  9413. if (item) {
  9414. var tmp = item.split(propertyDelimiter);
  9415. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  9416. }
  9417. });
  9418. return res
  9419. });
  9420. // normalize possible array / string values into Object
  9421. function normalizeStyleBinding (bindingStyle) {
  9422. if (Array.isArray(bindingStyle)) {
  9423. return toObject(bindingStyle)
  9424. }
  9425. if (typeof bindingStyle === 'string') {
  9426. return parseStyleText(bindingStyle)
  9427. }
  9428. return bindingStyle
  9429. }
  9430. /* */
  9431. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  9432. function getTarget(obj, path) {
  9433. var parts = path.split('.');
  9434. var key = parts[0];
  9435. if (key.indexOf('__$n') === 0) { //number index
  9436. key = parseInt(key.replace('__$n', ''));
  9437. }
  9438. if (parts.length === 1) {
  9439. return obj[key]
  9440. }
  9441. return getTarget(obj[key], parts.slice(1).join('.'))
  9442. }
  9443. function internalMixin(Vue) {
  9444. Vue.config.errorHandler = function(err, vm, info) {
  9445. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  9446. console.error(err);
  9447. /* eslint-disable no-undef */
  9448. var app = typeof getApp === 'function' && getApp();
  9449. if (app && app.onError) {
  9450. app.onError(err);
  9451. }
  9452. };
  9453. var oldEmit = Vue.prototype.$emit;
  9454. Vue.prototype.$emit = function(event) {
  9455. if (this.$scope && event) {
  9456. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  9457. if (triggerEvent) {
  9458. try {
  9459. triggerEvent.call(this.$scope, event, {
  9460. __args__: toArray(arguments, 1)
  9461. });
  9462. } catch (error) {
  9463. }
  9464. }
  9465. }
  9466. return oldEmit.apply(this, arguments)
  9467. };
  9468. Vue.prototype.$nextTick = function(fn) {
  9469. return nextTick$1(this, fn)
  9470. };
  9471. MP_METHODS.forEach(function (method) {
  9472. Vue.prototype[method] = function(args) {
  9473. if (this.$scope && this.$scope[method]) {
  9474. return this.$scope[method](args)
  9475. }
  9476. // mp-alipay
  9477. if (typeof my === 'undefined') {
  9478. return
  9479. }
  9480. if (method === 'createSelectorQuery') {
  9481. /* eslint-disable no-undef */
  9482. return my.createSelectorQuery(args)
  9483. } else if (method === 'createIntersectionObserver') {
  9484. /* eslint-disable no-undef */
  9485. return my.createIntersectionObserver(args)
  9486. }
  9487. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  9488. };
  9489. });
  9490. Vue.prototype.__init_provide = initProvide;
  9491. Vue.prototype.__init_injections = initInjections;
  9492. Vue.prototype.__call_hook = function(hook, args) {
  9493. var vm = this;
  9494. // #7573 disable dep collection when invoking lifecycle hooks
  9495. pushTarget();
  9496. var handlers = vm.$options[hook];
  9497. var info = hook + " hook";
  9498. var ret;
  9499. if (handlers) {
  9500. for (var i = 0, j = handlers.length; i < j; i++) {
  9501. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  9502. }
  9503. }
  9504. if (vm._hasHookEvent) {
  9505. vm.$emit('hook:' + hook, args);
  9506. }
  9507. popTarget();
  9508. return ret
  9509. };
  9510. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  9511. if (Array.isArray(modifiers)) {
  9512. if (modifiers.indexOf('trim') !== -1) {
  9513. value = value.trim();
  9514. }
  9515. if (modifiers.indexOf('number') !== -1) {
  9516. value = this._n(value);
  9517. }
  9518. }
  9519. if (!target) {
  9520. target = this;
  9521. }
  9522. // 解决动态属性添加
  9523. Vue.set(target, key, value);
  9524. };
  9525. Vue.prototype.__set_sync = function(target, key, value) {
  9526. if (!target) {
  9527. target = this;
  9528. }
  9529. // 解决动态属性添加
  9530. Vue.set(target, key, value);
  9531. };
  9532. Vue.prototype.__get_orig = function(item) {
  9533. if (isPlainObject(item)) {
  9534. return item['$orig'] || item
  9535. }
  9536. return item
  9537. };
  9538. Vue.prototype.__get_value = function(dataPath, target) {
  9539. return getTarget(target || this, dataPath)
  9540. };
  9541. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  9542. return renderClass(staticClass, dynamicClass)
  9543. };
  9544. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  9545. if (!dynamicStyle && !staticStyle) {
  9546. return ''
  9547. }
  9548. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  9549. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  9550. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  9551. };
  9552. Vue.prototype.__map = function(val, iteratee) {
  9553. //TODO 暂不考虑 string
  9554. var ret, i, l, keys, key;
  9555. if (Array.isArray(val)) {
  9556. ret = new Array(val.length);
  9557. for (i = 0, l = val.length; i < l; i++) {
  9558. ret[i] = iteratee(val[i], i);
  9559. }
  9560. return ret
  9561. } else if (isObject(val)) {
  9562. keys = Object.keys(val);
  9563. ret = Object.create(null);
  9564. for (i = 0, l = keys.length; i < l; i++) {
  9565. key = keys[i];
  9566. ret[key] = iteratee(val[key], key, i);
  9567. }
  9568. return ret
  9569. } else if (typeof val === 'number') {
  9570. ret = new Array(val);
  9571. for (i = 0, l = val; i < l; i++) {
  9572. // 第一个参数暂时仍和小程序一致
  9573. ret[i] = iteratee(i, i);
  9574. }
  9575. return ret
  9576. }
  9577. return []
  9578. };
  9579. }
  9580. /* */
  9581. var LIFECYCLE_HOOKS$1 = [
  9582. //App
  9583. 'onLaunch',
  9584. 'onShow',
  9585. 'onHide',
  9586. 'onUniNViewMessage',
  9587. 'onPageNotFound',
  9588. 'onThemeChange',
  9589. 'onError',
  9590. 'onUnhandledRejection',
  9591. //Page
  9592. 'onInit',
  9593. 'onLoad',
  9594. // 'onShow',
  9595. 'onReady',
  9596. // 'onHide',
  9597. 'onUnload',
  9598. 'onPullDownRefresh',
  9599. 'onReachBottom',
  9600. 'onTabItemTap',
  9601. 'onAddToFavorites',
  9602. 'onShareTimeline',
  9603. 'onShareAppMessage',
  9604. 'onResize',
  9605. 'onPageScroll',
  9606. 'onNavigationBarButtonTap',
  9607. 'onBackPress',
  9608. 'onNavigationBarSearchInputChanged',
  9609. 'onNavigationBarSearchInputConfirmed',
  9610. 'onNavigationBarSearchInputClicked',
  9611. 'onUploadDouyinVideo',
  9612. 'onNFCReadMessage',
  9613. //Component
  9614. // 'onReady', // 兼容旧版本,应该移除该事件
  9615. 'onPageShow',
  9616. 'onPageHide',
  9617. 'onPageResize'
  9618. ];
  9619. function lifecycleMixin$1(Vue) {
  9620. //fixed vue-class-component
  9621. var oldExtend = Vue.extend;
  9622. Vue.extend = function(extendOptions) {
  9623. extendOptions = extendOptions || {};
  9624. var methods = extendOptions.methods;
  9625. if (methods) {
  9626. Object.keys(methods).forEach(function (methodName) {
  9627. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  9628. extendOptions[methodName] = methods[methodName];
  9629. delete methods[methodName];
  9630. }
  9631. });
  9632. }
  9633. return oldExtend.call(this, extendOptions)
  9634. };
  9635. var strategies = Vue.config.optionMergeStrategies;
  9636. var mergeHook = strategies.created;
  9637. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  9638. strategies[hook] = mergeHook;
  9639. });
  9640. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  9641. }
  9642. /* */
  9643. // install platform patch function
  9644. Vue.prototype.__patch__ = patch;
  9645. // public mount method
  9646. Vue.prototype.$mount = function(
  9647. el ,
  9648. hydrating
  9649. ) {
  9650. return mountComponent$1(this, el, hydrating)
  9651. };
  9652. lifecycleMixin$1(Vue);
  9653. internalMixin(Vue);
  9654. /* */
  9655. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  9656. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  9657. /***/ }),
  9658. /***/ 26:
  9659. /*!********************************!*\
  9660. !*** E:/work/mdapp/pages.json ***!
  9661. \********************************/
  9662. /*! no static exports found */
  9663. /***/ (function(module, exports) {
  9664. /***/ }),
  9665. /***/ 294:
  9666. /*!*******************************************************!*\
  9667. !*** E:/work/mdapp/node_modules/image-tools/index.js ***!
  9668. \*******************************************************/
  9669. /*! no static exports found */
  9670. /***/ (function(module, exports, __webpack_require__) {
  9671. "use strict";
  9672. /* WEBPACK VAR INJECTION */(function(wx) {
  9673. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9674. Object.defineProperty(exports, "__esModule", {
  9675. value: true
  9676. });
  9677. exports.base64ToPath = base64ToPath;
  9678. exports.pathToBase64 = pathToBase64;
  9679. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  9680. function getLocalFilePath(path) {
  9681. if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf('_downloads') === 0) {
  9682. return path;
  9683. }
  9684. if (path.indexOf('file://') === 0) {
  9685. return path;
  9686. }
  9687. if (path.indexOf('/storage/emulated/0/') === 0) {
  9688. return path;
  9689. }
  9690. if (path.indexOf('/') === 0) {
  9691. var localFilePath = plus.io.convertAbsoluteFileSystem(path);
  9692. if (localFilePath !== path) {
  9693. return localFilePath;
  9694. } else {
  9695. path = path.substr(1);
  9696. }
  9697. }
  9698. return '_www/' + path;
  9699. }
  9700. function dataUrlToBase64(str) {
  9701. var array = str.split(',');
  9702. return array[array.length - 1];
  9703. }
  9704. var index = 0;
  9705. function getNewFileId() {
  9706. return Date.now() + String(index++);
  9707. }
  9708. function biggerThan(v1, v2) {
  9709. var v1Array = v1.split('.');
  9710. var v2Array = v2.split('.');
  9711. var update = false;
  9712. for (var index = 0; index < v2Array.length; index++) {
  9713. var diff = v1Array[index] - v2Array[index];
  9714. if (diff !== 0) {
  9715. update = diff > 0;
  9716. break;
  9717. }
  9718. }
  9719. return update;
  9720. }
  9721. function pathToBase64(path) {
  9722. return new Promise(function (resolve, reject) {
  9723. if ((typeof window === "undefined" ? "undefined" : (0, _typeof2.default)(window)) === 'object' && 'document' in window) {
  9724. if (typeof FileReader === 'function') {
  9725. var xhr = new XMLHttpRequest();
  9726. xhr.open('GET', path, true);
  9727. xhr.responseType = 'blob';
  9728. xhr.onload = function () {
  9729. if (this.status === 200) {
  9730. var fileReader = new FileReader();
  9731. fileReader.onload = function (e) {
  9732. resolve(e.target.result);
  9733. };
  9734. fileReader.onerror = reject;
  9735. fileReader.readAsDataURL(this.response);
  9736. }
  9737. };
  9738. xhr.onerror = reject;
  9739. xhr.send();
  9740. return;
  9741. }
  9742. var canvas = document.createElement('canvas');
  9743. var c2x = canvas.getContext('2d');
  9744. var img = new Image();
  9745. img.onload = function () {
  9746. canvas.width = img.width;
  9747. canvas.height = img.height;
  9748. c2x.drawImage(img, 0, 0);
  9749. resolve(canvas.toDataURL());
  9750. canvas.height = canvas.width = 0;
  9751. };
  9752. img.onerror = reject;
  9753. img.src = path;
  9754. return;
  9755. }
  9756. if ((typeof plus === "undefined" ? "undefined" : (0, _typeof2.default)(plus)) === 'object') {
  9757. plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function (entry) {
  9758. entry.file(function (file) {
  9759. var fileReader = new plus.io.FileReader();
  9760. fileReader.onload = function (data) {
  9761. resolve(data.target.result);
  9762. };
  9763. fileReader.onerror = function (error) {
  9764. reject(error);
  9765. };
  9766. fileReader.readAsDataURL(file);
  9767. }, function (error) {
  9768. reject(error);
  9769. });
  9770. }, function (error) {
  9771. reject(error);
  9772. });
  9773. return;
  9774. }
  9775. if ((typeof wx === "undefined" ? "undefined" : (0, _typeof2.default)(wx)) === 'object' && wx.canIUse('getFileSystemManager')) {
  9776. wx.getFileSystemManager().readFile({
  9777. filePath: path,
  9778. encoding: 'base64',
  9779. success: function success(res) {
  9780. resolve('data:image/png;base64,' + res.data);
  9781. },
  9782. fail: function fail(error) {
  9783. reject(error);
  9784. }
  9785. });
  9786. return;
  9787. }
  9788. reject(new Error('not support'));
  9789. });
  9790. }
  9791. function base64ToPath(base64) {
  9792. return new Promise(function (resolve, reject) {
  9793. if ((typeof window === "undefined" ? "undefined" : (0, _typeof2.default)(window)) === 'object' && 'document' in window) {
  9794. base64 = base64.split(',');
  9795. var type = base64[0].match(/:(.*?);/)[1];
  9796. var str = atob(base64[1]);
  9797. var n = str.length;
  9798. var array = new Uint8Array(n);
  9799. while (n--) {
  9800. array[n] = str.charCodeAt(n);
  9801. }
  9802. return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], {
  9803. type: type
  9804. })));
  9805. }
  9806. var extName = base64.split(',')[0].match(/data\:\S+\/(\S+);/);
  9807. if (extName) {
  9808. extName = extName[1];
  9809. } else {
  9810. reject(new Error('base64 error'));
  9811. }
  9812. var fileName = getNewFileId() + '.' + extName;
  9813. if ((typeof plus === "undefined" ? "undefined" : (0, _typeof2.default)(plus)) === 'object') {
  9814. var basePath = '_doc';
  9815. var dirPath = 'uniapp_temp';
  9816. var filePath = basePath + '/' + dirPath + '/' + fileName;
  9817. if (!biggerThan(plus.os.name === 'Android' ? '1.9.9.80627' : '1.9.9.80472', plus.runtime.innerVersion)) {
  9818. plus.io.resolveLocalFileSystemURL(basePath, function (entry) {
  9819. entry.getDirectory(dirPath, {
  9820. create: true,
  9821. exclusive: false
  9822. }, function (entry) {
  9823. entry.getFile(fileName, {
  9824. create: true,
  9825. exclusive: false
  9826. }, function (entry) {
  9827. entry.createWriter(function (writer) {
  9828. writer.onwrite = function () {
  9829. resolve(filePath);
  9830. };
  9831. writer.onerror = reject;
  9832. writer.seek(0);
  9833. writer.writeAsBinary(dataUrlToBase64(base64));
  9834. }, reject);
  9835. }, reject);
  9836. }, reject);
  9837. }, reject);
  9838. return;
  9839. }
  9840. var bitmap = new plus.nativeObj.Bitmap(fileName);
  9841. bitmap.loadBase64Data(base64, function () {
  9842. bitmap.save(filePath, {}, function () {
  9843. bitmap.clear();
  9844. resolve(filePath);
  9845. }, function (error) {
  9846. bitmap.clear();
  9847. reject(error);
  9848. });
  9849. }, function (error) {
  9850. bitmap.clear();
  9851. reject(error);
  9852. });
  9853. return;
  9854. }
  9855. if ((typeof wx === "undefined" ? "undefined" : (0, _typeof2.default)(wx)) === 'object' && wx.canIUse('getFileSystemManager')) {
  9856. var filePath = wx.env.USER_DATA_PATH + '/' + fileName;
  9857. wx.getFileSystemManager().writeFile({
  9858. filePath: filePath,
  9859. data: dataUrlToBase64(base64),
  9860. encoding: 'base64',
  9861. success: function success() {
  9862. resolve(filePath);
  9863. },
  9864. fail: function fail(error) {
  9865. reject(error);
  9866. }
  9867. });
  9868. return;
  9869. }
  9870. reject(new Error('not support'));
  9871. });
  9872. }
  9873. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  9874. /***/ }),
  9875. /***/ 3:
  9876. /*!***********************************!*\
  9877. !*** (webpack)/buildin/global.js ***!
  9878. \***********************************/
  9879. /*! no static exports found */
  9880. /***/ (function(module, exports) {
  9881. var g;
  9882. // This works in non-strict mode
  9883. g = (function() {
  9884. return this;
  9885. })();
  9886. try {
  9887. // This works if eval is allowed (see CSP)
  9888. g = g || new Function("return this")();
  9889. } catch (e) {
  9890. // This works if the window reference is available
  9891. if (typeof window === "object") g = window;
  9892. }
  9893. // g can still be undefined, but nothing to do about it...
  9894. // We return undefined, instead of nothing here, so it's
  9895. // easier to handle this case. if(!global) { ...}
  9896. module.exports = g;
  9897. /***/ }),
  9898. /***/ 32:
  9899. /*!**********************************************************************************************************!*\
  9900. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  9901. \**********************************************************************************************************/
  9902. /*! exports provided: default */
  9903. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9904. "use strict";
  9905. __webpack_require__.r(__webpack_exports__);
  9906. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  9907. /* globals __VUE_SSR_CONTEXT__ */
  9908. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  9909. // This module is a runtime utility for cleaner component module output and will
  9910. // be included in the final webpack user bundle.
  9911. function normalizeComponent (
  9912. scriptExports,
  9913. render,
  9914. staticRenderFns,
  9915. functionalTemplate,
  9916. injectStyles,
  9917. scopeId,
  9918. moduleIdentifier, /* server only */
  9919. shadowMode, /* vue-cli only */
  9920. components, // fixed by xxxxxx auto components
  9921. renderjs // fixed by xxxxxx renderjs
  9922. ) {
  9923. // Vue.extend constructor export interop
  9924. var options = typeof scriptExports === 'function'
  9925. ? scriptExports.options
  9926. : scriptExports
  9927. // fixed by xxxxxx auto components
  9928. if (components) {
  9929. if (!options.components) {
  9930. options.components = {}
  9931. }
  9932. var hasOwn = Object.prototype.hasOwnProperty
  9933. for (var name in components) {
  9934. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  9935. options.components[name] = components[name]
  9936. }
  9937. }
  9938. }
  9939. // fixed by xxxxxx renderjs
  9940. if (renderjs) {
  9941. if(typeof renderjs.beforeCreate === 'function'){
  9942. renderjs.beforeCreate = [renderjs.beforeCreate]
  9943. }
  9944. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  9945. this[renderjs.__module] = this
  9946. });
  9947. (options.mixins || (options.mixins = [])).push(renderjs)
  9948. }
  9949. // render functions
  9950. if (render) {
  9951. options.render = render
  9952. options.staticRenderFns = staticRenderFns
  9953. options._compiled = true
  9954. }
  9955. // functional template
  9956. if (functionalTemplate) {
  9957. options.functional = true
  9958. }
  9959. // scopedId
  9960. if (scopeId) {
  9961. options._scopeId = 'data-v-' + scopeId
  9962. }
  9963. var hook
  9964. if (moduleIdentifier) { // server build
  9965. hook = function (context) {
  9966. // 2.3 injection
  9967. context =
  9968. context || // cached call
  9969. (this.$vnode && this.$vnode.ssrContext) || // stateful
  9970. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  9971. // 2.2 with runInNewContext: true
  9972. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  9973. context = __VUE_SSR_CONTEXT__
  9974. }
  9975. // inject component styles
  9976. if (injectStyles) {
  9977. injectStyles.call(this, context)
  9978. }
  9979. // register component module identifier for async chunk inferrence
  9980. if (context && context._registeredComponents) {
  9981. context._registeredComponents.add(moduleIdentifier)
  9982. }
  9983. }
  9984. // used by ssr in case component is cached and beforeCreate
  9985. // never gets called
  9986. options._ssrRegister = hook
  9987. } else if (injectStyles) {
  9988. hook = shadowMode
  9989. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  9990. : injectStyles
  9991. }
  9992. if (hook) {
  9993. if (options.functional) {
  9994. // for template-only hot-reload because in that case the render fn doesn't
  9995. // go through the normalizer
  9996. options._injectStyles = hook
  9997. // register for functioal component in vue file
  9998. var originalRender = options.render
  9999. options.render = function renderWithStyleInjection (h, context) {
  10000. hook.call(context)
  10001. return originalRender(h, context)
  10002. }
  10003. } else {
  10004. // inject component registration as beforeCreate hook
  10005. var existing = options.beforeCreate
  10006. options.beforeCreate = existing
  10007. ? [].concat(existing, hook)
  10008. : [hook]
  10009. }
  10010. }
  10011. return {
  10012. exports: scriptExports,
  10013. options: options
  10014. }
  10015. }
  10016. /***/ }),
  10017. /***/ 33:
  10018. /*!******************************************************!*\
  10019. !*** E:/work/mdapp/uni_modules/vk-uview-ui/index.js ***!
  10020. \******************************************************/
  10021. /*! no static exports found */
  10022. /***/ (function(module, exports, __webpack_require__) {
  10023. "use strict";
  10024. /* WEBPACK VAR INJECTION */(function(uni) {
  10025. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10026. Object.defineProperty(exports, "__esModule", {
  10027. value: true
  10028. });
  10029. exports.default = void 0;
  10030. var _mixin = _interopRequireDefault(__webpack_require__(/*! ./libs/mixin/mixin.js */ 34));
  10031. var _request = _interopRequireDefault(__webpack_require__(/*! ./libs/request */ 35));
  10032. var _queryParams = _interopRequireDefault(__webpack_require__(/*! ./libs/function/queryParams.js */ 39));
  10033. var _route = _interopRequireDefault(__webpack_require__(/*! ./libs/function/route.js */ 40));
  10034. var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFormat.js */ 44));
  10035. var _timeFrom = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFrom.js */ 45));
  10036. var _colorGradient = _interopRequireDefault(__webpack_require__(/*! ./libs/function/colorGradient.js */ 46));
  10037. var _guid = _interopRequireDefault(__webpack_require__(/*! ./libs/function/guid.js */ 47));
  10038. var _color = _interopRequireDefault(__webpack_require__(/*! ./libs/function/color.js */ 48));
  10039. var _type2icon = _interopRequireDefault(__webpack_require__(/*! ./libs/function/type2icon.js */ 49));
  10040. var _randomArray = _interopRequireDefault(__webpack_require__(/*! ./libs/function/randomArray.js */ 50));
  10041. var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepClone.js */ 37));
  10042. var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepMerge.js */ 36));
  10043. var _addUnit = _interopRequireDefault(__webpack_require__(/*! ./libs/function/addUnit.js */ 51));
  10044. var _test = _interopRequireDefault(__webpack_require__(/*! ./libs/function/test.js */ 38));
  10045. var _random = _interopRequireDefault(__webpack_require__(/*! ./libs/function/random.js */ 52));
  10046. var _trim = _interopRequireDefault(__webpack_require__(/*! ./libs/function/trim.js */ 53));
  10047. var _toast = _interopRequireDefault(__webpack_require__(/*! ./libs/function/toast.js */ 54));
  10048. var _getParent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/getParent.js */ 55));
  10049. var _$parent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/$parent.js */ 56));
  10050. var _sys = __webpack_require__(/*! ./libs/function/sys.js */ 57);
  10051. var _debounce = _interopRequireDefault(__webpack_require__(/*! ./libs/function/debounce.js */ 58));
  10052. var _throttle = _interopRequireDefault(__webpack_require__(/*! ./libs/function/throttle.js */ 59));
  10053. var _addStyle = _interopRequireDefault(__webpack_require__(/*! ./libs/function/addStyle.js */ 60));
  10054. var _config = _interopRequireDefault(__webpack_require__(/*! ./libs/config/config.js */ 61));
  10055. var _zIndex = _interopRequireDefault(__webpack_require__(/*! ./libs/config/zIndex.js */ 62));
  10056. // 引入全局mixin
  10057. // 引入关于是否mixin集成小程序分享的配置
  10058. // import wxshare from './libs/mixin/mpShare.js'
  10059. // 全局挂载引入http相关请求拦截插件
  10060. function wranning(str) {
  10061. // 开发环境进行信息输出,主要是一些报错信息
  10062. // 这个环境的来由是在程序编写时候,点击hx编辑器运行调试代码的时候,详见:
  10063. // https://uniapp.dcloud.io/frame?id=%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%e5%92%8c%e7%94%9f%e4%ba%a7%e7%8e%af%e5%a2%83
  10064. if (true) {
  10065. console.warn(str);
  10066. }
  10067. }
  10068. // 尝试判断在根目录的/store中是否有$u.mixin.js,此文件uView默认为需要挂在到全局的vuex的state变量
  10069. // HX2.6.11版本,放到try中,控制台依然会警告,暂时不用此方式,
  10070. // let vuexStore = {};
  10071. // try {
  10072. // vuexStore = require("@/store/$u.mixin.js");
  10073. // } catch (e) {
  10074. // //TODO handle the exception
  10075. // }
  10076. // post类型对象参数转为get类型url参数
  10077. var $u = {
  10078. queryParams: _queryParams.default,
  10079. route: _route.default,
  10080. timeFormat: _timeFormat.default,
  10081. date: _timeFormat.default,
  10082. // 另名date
  10083. timeFrom: _timeFrom.default,
  10084. colorGradient: _colorGradient.default.colorGradient,
  10085. colorToRgba: _colorGradient.default.colorToRgba,
  10086. guid: _guid.default,
  10087. color: _color.default,
  10088. sys: _sys.sys,
  10089. os: _sys.os,
  10090. type2icon: _type2icon.default,
  10091. randomArray: _randomArray.default,
  10092. wranning: wranning,
  10093. get: _request.default.get,
  10094. post: _request.default.post,
  10095. put: _request.default.put,
  10096. 'delete': _request.default.delete,
  10097. hexToRgb: _colorGradient.default.hexToRgb,
  10098. rgbToHex: _colorGradient.default.rgbToHex,
  10099. test: _test.default,
  10100. random: _random.default,
  10101. deepClone: _deepClone.default,
  10102. deepMerge: _deepMerge.default,
  10103. getParent: _getParent.default,
  10104. $parent: _$parent.default,
  10105. addUnit: _addUnit.default,
  10106. trim: _trim.default,
  10107. type: ['primary', 'success', 'error', 'warning', 'info'],
  10108. http: _request.default,
  10109. toast: _toast.default,
  10110. config: _config.default,
  10111. // uView配置信息相关,比如版本号
  10112. zIndex: _zIndex.default,
  10113. debounce: _debounce.default,
  10114. throttle: _throttle.default,
  10115. addStyle: _addStyle.default
  10116. };
  10117. // $u挂载到uni对象上
  10118. uni.$u = $u;
  10119. var install = function install(Vue) {
  10120. Vue.mixin(_mixin.default);
  10121. if (Vue.prototype.openShare) {
  10122. Vue.mixin(mpShare);
  10123. }
  10124. // Vue.mixin(vuexStore);
  10125. // 时间格式化,同时两个名称,date和timeFormat
  10126. Vue.filter('timeFormat', function (timestamp, format) {
  10127. return (0, _timeFormat.default)(timestamp, format);
  10128. });
  10129. Vue.filter('date', function (timestamp, format) {
  10130. return (0, _timeFormat.default)(timestamp, format);
  10131. });
  10132. // 将多久以前的方法,注入到全局过滤器
  10133. Vue.filter('timeFrom', function (timestamp, format) {
  10134. return (0, _timeFrom.default)(timestamp, format);
  10135. });
  10136. Vue.prototype.$u = $u;
  10137. };
  10138. var _default = {
  10139. install: install
  10140. };
  10141. exports.default = _default;
  10142. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10143. /***/ }),
  10144. /***/ 34:
  10145. /*!*****************************************************************!*\
  10146. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/mixin/mixin.js ***!
  10147. \*****************************************************************/
  10148. /*! no static exports found */
  10149. /***/ (function(module, exports, __webpack_require__) {
  10150. "use strict";
  10151. /* WEBPACK VAR INJECTION */(function(uni) {
  10152. Object.defineProperty(exports, "__esModule", {
  10153. value: true
  10154. });
  10155. exports.default = void 0;
  10156. var _default = {
  10157. data: function data() {
  10158. return {};
  10159. },
  10160. onLoad: function onLoad() {
  10161. // getRect挂载到$u上,因为这方法需要使用in(this),所以无法把它独立成一个单独的文件导出
  10162. this.$u.getRect = this.$uGetRect;
  10163. },
  10164. methods: {
  10165. // 查询节点信息
  10166. // 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
  10167. // 解决办法为在组件根部再套一个没有任何作用的view元素
  10168. $uGetRect: function $uGetRect(selector, all) {
  10169. var _this = this;
  10170. return new Promise(function (resolve) {
  10171. uni.createSelectorQuery().in(_this)[all ? 'selectAll' : 'select'](selector).boundingClientRect(function (rect) {
  10172. if (all && Array.isArray(rect) && rect.length) {
  10173. resolve(rect);
  10174. }
  10175. if (!all && rect) {
  10176. resolve(rect);
  10177. }
  10178. }).exec();
  10179. });
  10180. },
  10181. getParentData: function getParentData() {
  10182. var _this2 = this;
  10183. var parentName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  10184. // 避免在created中去定义parent变量
  10185. if (!this.parent) this.parent = false;
  10186. // 这里的本质原理是,通过获取父组件实例(也即u-radio-group的this)
  10187. // 将父组件this中对应的参数,赋值给本组件(u-radio的this)的parentData对象中对应的属性
  10188. // 之所以需要这么做,是因为所有端中,头条小程序不支持通过this.parent.xxx去监听父组件参数的变化
  10189. this.parent = this.$u.$parent.call(this, parentName);
  10190. if (this.parent) {
  10191. // 历遍parentData中的属性,将parent中的同名属性赋值给parentData
  10192. Object.keys(this.parentData).map(function (key) {
  10193. _this2.parentData[key] = _this2.parent[key];
  10194. });
  10195. }
  10196. },
  10197. // 阻止事件冒泡
  10198. preventEvent: function preventEvent(e) {
  10199. e && e.stopPropagation && e.stopPropagation();
  10200. }
  10201. },
  10202. onReachBottom: function onReachBottom() {
  10203. uni.$emit('uOnReachBottom');
  10204. },
  10205. beforeDestroy: function beforeDestroy() {
  10206. var _this3 = this;
  10207. // 判断当前页面是否存在parent和chldren,一般在checkbox和checkbox-group父子联动的场景会有此情况
  10208. // 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
  10209. if (this.parent && uni.$u.test.array(this.parent.children)) {
  10210. // 组件销毁时,移除父组件中的children数组中对应的实例
  10211. var childrenList = this.parent.children;
  10212. childrenList.map(function (child, index) {
  10213. // 如果相等,则移除
  10214. if (child === _this3) {
  10215. childrenList.splice(index, 1);
  10216. }
  10217. });
  10218. }
  10219. }
  10220. };
  10221. exports.default = _default;
  10222. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10223. /***/ }),
  10224. /***/ 345:
  10225. /*!**************************************************!*\
  10226. !*** E:/work/mdapp/pages/estate/img/i_house.png ***!
  10227. \**************************************************/
  10228. /*! no static exports found */
  10229. /***/ (function(module, exports) {
  10230. module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADqklEQVR4Xu1b71XbMBDXWQOUDQoTNH4+8xWYoGUDmKCwQTsBMEHTCcoGha9EfqYTlE7QZID4+o7KeY5t2VaebJxE/kZ8Pt39dLp/OkDs+QN7rr/wAHgL2HME/BHYcwOwc4JPT0+TIAhOAOCgb+CIaJ5l2ePx8fFzn2t1PgKz2ewGAK76FKaONxHdxnF83de6nQBIkuSKiG76EqKNLwBcR1F020a3yftOACilUiHEZJMFHH3zjIihI15rbLoCQH0sbsMTETvJasOTaTsxVUp5AJqQBYDHLMu+5DRBEEyafAYRfRVCPOT02rl+bFpjzBawkFIehmE4LyqglGKn9blGqe+IeFH+XSn1IoR4bwJhtADw7kdRdFoWfDabnQLAz/LvvPtxHK+sJX+fJMkDEZ14AAwIjNYChBAviHhUltuUO+ycBWjFrxDxLgchTdPD5XLJ5n9Ys6Gc4p4VU9wkSS6I6FtLCJsi4qVtmGuj35ow2KaIjir3xY3o8M325AFdlNE0VpaySxawwoiIzuI4XuUZjTlMF2THkAl2kTOnMTnaOh47aQGm3KRvABYA8ExE3Cz50GHHfgHAnIg4UhgzwA58KiSDAwAAl1EUTUthkM9gnWKcOk/CMOTU9/VRSn0SQvzYRNnaXTVkp31ZwB9ErMR714mQDTiDWsBQtYAHwAKBQS1ACDGXUh45KId/G1JnC9X/kw4NAK/Jpewtt7L5DynlKRFVSt5CnGbaey3sAQBwf4AdoZPnLQBwIrgrJh6AgcOgq41zxsdbgLeA+j5lX5kg810IIaZ5FAiCgKOAscGp2+jFtjhHAWf1wOBHQOcBq9xe5/cc5iq9/jrh0jQ9WC6X/P07F45gUABMi5kKnE2bojbAjAIA1/cCowVACFF7c2vq9O6cBfDOZFkWlic5lFLcFq/cGDFgUsqzYu2gJ0+Y3snkyaBHQJsm1wDFURbuD9TdCeSWzA6v6DR59sCk/ILrjOJlqq4huHbg6FFxnG8BgM0RtaJt6vCami47BUDTnaDJ0XoAdikV9hbQMBvkj4BhCMP7AO8Dhi+HrWK7DfGbO0Fdqv61EdolbV2pnfM3VZzOfIBWnmeEK2NtLpVs4fUgpTwv3zvoMRy+TzSN8J4j4mvrvelZXY/rgoSVrStg2vhsw3u+iZ6WJ89XACilajs426CZpYxrluEByNHjIyCl5CsrYzPTEumxkb82bhFx7Z8+Oo3IjE0Tl/J4AFyiuY28vAVs4665lHnvLeAf8XaCXwWtufUAAAAASUVORK5CYII="
  10231. /***/ }),
  10232. /***/ 346:
  10233. /*!************************************************!*\
  10234. !*** E:/work/mdapp/pages/estate/img/i_pos.png ***!
  10235. \************************************************/
  10236. /*! no static exports found */
  10237. /***/ (function(module, exports) {
  10238. module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAHDklEQVR4Xs1bfYhVRRQ/565uGSomWX8kFQlhmq28ObOsq0mitiFhYiSVUFFa4T+aEIaE2hdKkUYQfWBlJaWpRQlZoSmEtrt37t21WrOMRJCiDJfUlF323ROjd2Vddt+dmTvv7Q68v+45v3POb2bOfJx5CBVoR48evby9vf1GZta/cQAwPv31tn4EAL4MgmB/oVA4UQHXAMtpJI7jWUmS3AMA+jfGxhYz7waA/Yi4hYgO2+jayHonoKWlZVSxWFyUBl1n40w/skUA2MrMW6WUX3jAuwTCKwFKqXkAsBoAJvt2VOMhYlgsFlfV1tZ+5QvfCwG615MkWc3My3w5loGzkojW+rCVmwClVAEA3ilXr5cIcjszr5BS/p6HiFwExHE8PUmSDwHgujxO5NBtC4JgQaFQOOSK4UxAGIZzgiDYzMxXuhr3pJeLBCcCdLJj5u2IWOUpiLwwziRYE5Auc3sHYM5nkdQybNiw6RMnTjyTJdjzuzUBURRtqGC2t4lFy64lopU2SlYEpOv8ZzYGKi2LiNOFEN+Z2rUiIIqikJnJFHwg5BBxlxBijqltYwLCMHwQEd83BS4htw0AtgVB0NbZ2Xlcy1VXV49NkmQiANyb/vKaeZiIjHw1JkAppRPf7Tk8WwcAHxHRj6UwmpqaplRVVT2Zhwhm3imlnGviqxEBURTNZ+YdJoD9yCwgIt3zxi0MwzWIqM8VTi0IgsmFQuFglrIRAUqpnQBwVxaYr+C7ccIwnI2I3zjafZ6IVmXpZhLAzFVxHJ9w3PFZ93xvh5VS+tDzdFYgvb8j4iEhhM4rJVsmAXEcT0mS5EAWUO/vzLxBSrncVq+3fBzHY5Ik+R4A9E2SVWPmOVLKXaWUMglQSi0FgFetLAOcHjp06ISamprzWT5vU0otAYDXHXAyN0aZBERRpA88Cy2N7yOiGZY6/Yq3trZe29XV5ULmB0T0UK4REIbhAUScYhMMMz8rpVxjo5MlG0XRQWa+NUuu53dm3iOlnJWLAKWUXrdvsTS8SEqpL0m8NaXUJw57g8NEdHNeAo7ZXngg4p1CiK+9RQ8AYRiuR0S9QTJuzHxaSjkyFwFRFJ20XQKZeYaUcp+xpwaCjqfQf4io5HV8ZhIMw7DL9uKjHAQopfQpVN8627T9RDQt1whQSv0EAJkbil7Jx3sSVEr9ZrsXQMR3hRCP5iVgIwCUBOnDQBsRWSXOUk4qpXQp7Webrtey6a3xS3kJeAIA3rA1joiPCyHettXrS951OxwEwd2FQqFkNSkzBzQ3N9frYqVDIBER5b48SesOeit+ma0PzDxeSvlLrhGwd+/e4cOHDz+GiKNtHdAXH0S0wEHvoorLRqxbmYgyOzhTQIMppTYDgO12+LwfeXaFOe8EPiaiB7LINyIgiqKFzKxJcGqIuAkRXzat4Ohhz8xPIeJ9TgYvED9PSvl5lr4RAW1tbaPPnj17xHEadPtwSh+Ri8Xip3V1dT/0k+wmAYDuNb3js57zPTD/6+zsHFNfX3/OCwF5p0EfTuxj5uOIqE94IxFxbHrQuSHLYZPviPieEOIRI1kTIS2TdxqY2vEhx8z3Sym3mGAZTQEN5GkamPiUSwYR/+jo6JhUX19/0gTImAANFobhm3qDYwI8UDK2q44VAU1NTTVVVVXNupYxUAGWsqt7X1euiOhPU/+sCEiTob4f1PeEg67Z9r4OwJqA1tbWm7q6ukKdvQcTAy6970RAmgvWIeKKwUSAS+87E6CU0m+C9Ci4ejCQ4Nr7zgSkoyBX7c4nca69n4uANCHqut1sn8HYYjGzKhaLM+vq6k7Z6uYmoLGxsW7IkCF7AOAKF+OedBqIyLWAar8K9HY6juPlSZK84ikYW5jVRPScrVJPeetlsC9jURTtYOb5eRyx1WXmXVJK46cw/eF7ISCO4wlJknwLANfYBuIo387MM6WULY76F9W8EKDRoihazMxeLkENglpCRNYXtX3heiMgXRU2AUDJaqxBcFkimRXfLADvOaAbUCl1FQDot/zCxglTWWZura6ubqipqfnbVCdLzusISKfCbcysSfC9NOoSXYMQQucab807ASkJjzHzW968vAC0lIhe84yZfx/Qn0NhGG5ARF//INlIRIt9B6/xyjICeuQEPRUacjreSERWL1Rs7JWVgCiK9OuMXcx8vY1TPWTPdHR0jJs6daq3pNfbj7ISoI01NzfPD4LA6ZVpkiRza2tr9SPNsrWyE5AmxWW6KGITBSK+KIR4xkbHRbYiBKQkrGdmozc+iLhbCFGRY3bFCEhJ0H9103+jLdUy3/W49HR/OhUlQJfaR4wYoe8PaksEMYqI/vUZZCmsihKgHUmfu+gH0Jc8eGLmv4IguEMI0WfhtFyEVJyA7kB0rREAZjHzKET89dy5cy9MmzbtdLkC7Q/3fxMowF8w/lVXAAAAAElFTkSuQmCC"
  10239. /***/ }),
  10240. /***/ 35:
  10241. /*!*******************************************************************!*\
  10242. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/request/index.js ***!
  10243. \*******************************************************************/
  10244. /*! no static exports found */
  10245. /***/ (function(module, exports, __webpack_require__) {
  10246. "use strict";
  10247. /* WEBPACK VAR INJECTION */(function(uni) {
  10248. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10249. Object.defineProperty(exports, "__esModule", {
  10250. value: true
  10251. });
  10252. exports.default = void 0;
  10253. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  10254. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  10255. var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ../function/deepMerge */ 36));
  10256. var _test = _interopRequireDefault(__webpack_require__(/*! ../function/test */ 38));
  10257. var Request = /*#__PURE__*/function () {
  10258. function Request() {
  10259. var _this = this;
  10260. (0, _classCallCheck2.default)(this, Request);
  10261. this.config = {
  10262. baseUrl: '',
  10263. // 请求的根域名
  10264. // 默认的请求头
  10265. header: {},
  10266. method: 'POST',
  10267. // 设置为json,返回后uni.request会对数据进行一次JSON.parse
  10268. dataType: 'json',
  10269. // 此参数无需处理,因为5+和支付宝小程序不支持,默认为text即可
  10270. responseType: 'text',
  10271. showLoading: true,
  10272. // 是否显示请求中的loading
  10273. loadingText: '请求中...',
  10274. loadingTime: 800,
  10275. // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
  10276. timer: null,
  10277. // 定时器
  10278. originalData: false,
  10279. // 是否在拦截器中返回服务端的原始数据,见文档说明
  10280. loadingMask: true // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
  10281. };
  10282. // 拦截器
  10283. this.interceptor = {
  10284. // 请求前的拦截
  10285. request: null,
  10286. // 请求后的拦截
  10287. response: null
  10288. };
  10289. // get请求
  10290. this.get = function (url) {
  10291. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10292. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10293. return _this.request({
  10294. method: 'GET',
  10295. url: url,
  10296. header: header,
  10297. data: data
  10298. });
  10299. };
  10300. // post请求
  10301. this.post = function (url) {
  10302. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10303. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10304. return _this.request({
  10305. url: url,
  10306. method: 'POST',
  10307. header: header,
  10308. data: data
  10309. });
  10310. };
  10311. // put请求,不支持支付宝小程序(HX2.6.15)
  10312. this.put = function (url) {
  10313. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10314. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10315. return _this.request({
  10316. url: url,
  10317. method: 'PUT',
  10318. header: header,
  10319. data: data
  10320. });
  10321. };
  10322. // delete请求,不支持支付宝和头条小程序(HX2.6.15)
  10323. this.delete = function (url) {
  10324. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10325. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10326. return _this.request({
  10327. url: url,
  10328. method: 'DELETE',
  10329. header: header,
  10330. data: data
  10331. });
  10332. };
  10333. }
  10334. (0, _createClass2.default)(Request, [{
  10335. key: "setConfig",
  10336. value:
  10337. // 设置全局默认配置
  10338. function setConfig(customConfig) {
  10339. // 深度合并对象,否则会造成对象深层属性丢失
  10340. this.config = (0, _deepMerge.default)(this.config, customConfig);
  10341. }
  10342. // 主要请求部分
  10343. }, {
  10344. key: "request",
  10345. value: function request() {
  10346. var _this2 = this;
  10347. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  10348. // 检查请求拦截
  10349. if (this.interceptor.request && typeof this.interceptor.request === 'function') {
  10350. var tmpConfig = {};
  10351. var interceptorRequest = this.interceptor.request(options);
  10352. if (interceptorRequest === false) {
  10353. // 返回一个处于pending状态中的Promise,来取消原promise,避免进入then()回调
  10354. return new Promise(function () {});
  10355. }
  10356. this.options = interceptorRequest;
  10357. }
  10358. options.dataType = options.dataType || this.config.dataType;
  10359. options.responseType = options.responseType || this.config.responseType;
  10360. options.url = options.url || '';
  10361. options.params = options.params || {};
  10362. options.header = Object.assign({}, this.config.header, options.header);
  10363. options.method = options.method || this.config.method;
  10364. return new Promise(function (resolve, reject) {
  10365. options.complete = function (response) {
  10366. // 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
  10367. uni.hideLoading();
  10368. // 清除定时器,如果请求回来了,就无需loading
  10369. clearTimeout(_this2.config.timer);
  10370. _this2.config.timer = null;
  10371. // 判断用户对拦截返回数据的要求,如果originalData为true,返回所有的数据(response)到拦截器,否则只返回response.data
  10372. if (_this2.config.originalData) {
  10373. // 判断是否存在拦截器
  10374. if (_this2.interceptor.response && typeof _this2.interceptor.response === 'function') {
  10375. var resInterceptors = _this2.interceptor.response(response);
  10376. // 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
  10377. if (resInterceptors !== false) {
  10378. resolve(resInterceptors);
  10379. } else {
  10380. // 如果拦截器返回false,意味着拦截器定义者认为返回有问题,直接接入catch回调
  10381. reject(response);
  10382. }
  10383. } else {
  10384. // 如果要求返回原始数据,就算没有拦截器,也返回最原始的数据
  10385. resolve(response);
  10386. }
  10387. } else {
  10388. if (response.statusCode == 200) {
  10389. if (_this2.interceptor.response && typeof _this2.interceptor.response === 'function') {
  10390. var _resInterceptors = _this2.interceptor.response(response.data);
  10391. if (_resInterceptors !== false) {
  10392. resolve(_resInterceptors);
  10393. } else {
  10394. reject(response.data);
  10395. }
  10396. } else {
  10397. // 如果不是返回原始数据(originalData=false),且没有拦截器的情况下,返回纯数据给then回调
  10398. resolve(response.data);
  10399. }
  10400. } else {
  10401. // 不返回原始数据的情况下,服务器状态码不为200,modal弹框提示
  10402. // if(response.errMsg) {
  10403. // uni.showModal({
  10404. // title: response.errMsg
  10405. // });
  10406. // }
  10407. reject(response);
  10408. }
  10409. }
  10410. };
  10411. // 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
  10412. options.url = _test.default.url(options.url) ? options.url : _this2.config.baseUrl + (options.url.indexOf('/') == 0 ? options.url : '/' + options.url);
  10413. // 是否显示loading
  10414. // 加一个是否已有timer定时器的判断,否则有两个同时请求的时候,后者会清除前者的定时器id
  10415. // 而没有清除前者的定时器,导致前者超时,一直显示loading
  10416. if (_this2.config.showLoading && !_this2.config.timer) {
  10417. _this2.config.timer = setTimeout(function () {
  10418. uni.showLoading({
  10419. title: _this2.config.loadingText,
  10420. mask: _this2.config.loadingMask
  10421. });
  10422. _this2.config.timer = null;
  10423. }, _this2.config.loadingTime);
  10424. }
  10425. uni.request(options);
  10426. });
  10427. // .catch(res => {
  10428. // // 如果返回reject(),不让其进入this.$u.post().then().catch()后面的catct()
  10429. // // 因为很多人都会忘了写后面的catch(),导致报错捕获不到catch
  10430. // return new Promise(()=>{});
  10431. // })
  10432. }
  10433. }]);
  10434. return Request;
  10435. }();
  10436. var _default = new Request();
  10437. exports.default = _default;
  10438. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10439. /***/ }),
  10440. /***/ 36:
  10441. /*!************************************************************************!*\
  10442. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/deepMerge.js ***!
  10443. \************************************************************************/
  10444. /*! no static exports found */
  10445. /***/ (function(module, exports, __webpack_require__) {
  10446. "use strict";
  10447. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10448. Object.defineProperty(exports, "__esModule", {
  10449. value: true
  10450. });
  10451. exports.default = void 0;
  10452. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  10453. var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./deepClone */ 37));
  10454. // JS对象深度合并
  10455. function deepMerge() {
  10456. var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  10457. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10458. target = (0, _deepClone.default)(target);
  10459. if ((0, _typeof2.default)(target) !== 'object' || (0, _typeof2.default)(source) !== 'object') return false;
  10460. for (var prop in source) {
  10461. if (!source.hasOwnProperty(prop)) continue;
  10462. if (prop in target) {
  10463. if ((0, _typeof2.default)(target[prop]) !== 'object') {
  10464. target[prop] = source[prop];
  10465. } else {
  10466. if ((0, _typeof2.default)(source[prop]) !== 'object') {
  10467. target[prop] = source[prop];
  10468. } else {
  10469. if (target[prop].concat && source[prop].concat) {
  10470. target[prop] = target[prop].concat(source[prop]);
  10471. } else {
  10472. target[prop] = deepMerge(target[prop], source[prop]);
  10473. }
  10474. }
  10475. }
  10476. } else {
  10477. target[prop] = source[prop];
  10478. }
  10479. }
  10480. return target;
  10481. }
  10482. var _default = deepMerge;
  10483. exports.default = _default;
  10484. /***/ }),
  10485. /***/ 37:
  10486. /*!************************************************************************!*\
  10487. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/deepClone.js ***!
  10488. \************************************************************************/
  10489. /*! no static exports found */
  10490. /***/ (function(module, exports, __webpack_require__) {
  10491. "use strict";
  10492. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10493. Object.defineProperty(exports, "__esModule", {
  10494. value: true
  10495. });
  10496. exports.default = void 0;
  10497. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  10498. // 判断arr是否为一个数组,返回一个bool值
  10499. function isArray(arr) {
  10500. return Object.prototype.toString.call(arr) === '[object Array]';
  10501. }
  10502. // 深度克隆
  10503. function deepClone(obj) {
  10504. // 对常见的“非”值,直接返回原来值
  10505. if ([null, undefined, NaN, false].includes(obj)) return obj;
  10506. if ((0, _typeof2.default)(obj) !== "object" && typeof obj !== 'function') {
  10507. //原始类型直接返回
  10508. return obj;
  10509. }
  10510. var o = isArray(obj) ? [] : {};
  10511. for (var i in obj) {
  10512. if (obj.hasOwnProperty(i)) {
  10513. o[i] = (0, _typeof2.default)(obj[i]) === "object" ? deepClone(obj[i]) : obj[i];
  10514. }
  10515. }
  10516. return o;
  10517. }
  10518. var _default = deepClone;
  10519. exports.default = _default;
  10520. /***/ }),
  10521. /***/ 38:
  10522. /*!*******************************************************************!*\
  10523. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/test.js ***!
  10524. \*******************************************************************/
  10525. /*! no static exports found */
  10526. /***/ (function(module, exports, __webpack_require__) {
  10527. "use strict";
  10528. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10529. Object.defineProperty(exports, "__esModule", {
  10530. value: true
  10531. });
  10532. exports.default = void 0;
  10533. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  10534. /**
  10535. * 验证电子邮箱格式
  10536. */
  10537. function email(value) {
  10538. return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value);
  10539. }
  10540. /**
  10541. * 验证手机格式
  10542. */
  10543. function mobile(value) {
  10544. return /^1[23456789]\d{9}$/.test(value);
  10545. }
  10546. /**
  10547. * 验证URL格式
  10548. */
  10549. function url(value) {
  10550. return /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?/.test(value);
  10551. }
  10552. /**
  10553. * 验证日期格式
  10554. */
  10555. function date(value) {
  10556. return !/Invalid|NaN/.test(new Date(value).toString());
  10557. }
  10558. /**
  10559. * 验证ISO类型的日期格式
  10560. */
  10561. function dateISO(value) {
  10562. return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
  10563. }
  10564. /**
  10565. * 验证十进制数字
  10566. */
  10567. function number(value) {
  10568. return /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
  10569. }
  10570. /**
  10571. * 验证整数
  10572. */
  10573. function digits(value) {
  10574. return /^\d+$/.test(value);
  10575. }
  10576. /**
  10577. * 验证身份证号码
  10578. */
  10579. function idCard(value) {
  10580. return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value);
  10581. }
  10582. /**
  10583. * 是否车牌号
  10584. */
  10585. function carNo(value) {
  10586. // 新能源车牌
  10587. var xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
  10588. // 旧车牌
  10589. var creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
  10590. if (value.length === 7) {
  10591. return creg.test(value);
  10592. } else if (value.length === 8) {
  10593. return xreg.test(value);
  10594. } else {
  10595. return false;
  10596. }
  10597. }
  10598. /**
  10599. * 金额,只允许2位小数
  10600. */
  10601. function amount(value) {
  10602. //金额,只允许保留两位小数
  10603. return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
  10604. }
  10605. /**
  10606. * 中文
  10607. */
  10608. function chinese(value) {
  10609. var reg = /^[\u4e00-\u9fa5]+$/gi;
  10610. return reg.test(value);
  10611. }
  10612. /**
  10613. * 只能输入字母
  10614. */
  10615. function letter(value) {
  10616. return /^[a-zA-Z]*$/.test(value);
  10617. }
  10618. /**
  10619. * 只能是字母或者数字
  10620. */
  10621. function enOrNum(value) {
  10622. //英文或者数字
  10623. var reg = /^[0-9a-zA-Z]*$/g;
  10624. return reg.test(value);
  10625. }
  10626. /**
  10627. * 验证是否包含某个值
  10628. */
  10629. function contains(value, param) {
  10630. return value.indexOf(param) >= 0;
  10631. }
  10632. /**
  10633. * 验证一个值范围[min, max]
  10634. */
  10635. function range(value, param) {
  10636. return value >= param[0] && value <= param[1];
  10637. }
  10638. /**
  10639. * 验证一个长度范围[min, max]
  10640. */
  10641. function rangeLength(value, param) {
  10642. return value.length >= param[0] && value.length <= param[1];
  10643. }
  10644. /**
  10645. * 是否固定电话
  10646. */
  10647. function landline(value) {
  10648. var reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
  10649. return reg.test(value);
  10650. }
  10651. /**
  10652. * 判断是否为空
  10653. */
  10654. function empty(value) {
  10655. switch ((0, _typeof2.default)(value)) {
  10656. case 'undefined':
  10657. return true;
  10658. case 'string':
  10659. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  10660. break;
  10661. case 'boolean':
  10662. if (!value) return true;
  10663. break;
  10664. case 'number':
  10665. if (0 === value || isNaN(value)) return true;
  10666. break;
  10667. case 'object':
  10668. if (null === value || value.length === 0) return true;
  10669. for (var i in value) {
  10670. return false;
  10671. }
  10672. return true;
  10673. }
  10674. return false;
  10675. }
  10676. /**
  10677. * 是否json字符串
  10678. */
  10679. function jsonString(value) {
  10680. if (typeof value == 'string') {
  10681. try {
  10682. var obj = JSON.parse(value);
  10683. if ((0, _typeof2.default)(obj) == 'object' && obj) {
  10684. return true;
  10685. } else {
  10686. return false;
  10687. }
  10688. } catch (e) {
  10689. return false;
  10690. }
  10691. }
  10692. return false;
  10693. }
  10694. /**
  10695. * 是否数组
  10696. */
  10697. function array(value) {
  10698. if (typeof Array.isArray === "function") {
  10699. return Array.isArray(value);
  10700. } else {
  10701. return Object.prototype.toString.call(value) === "[object Array]";
  10702. }
  10703. }
  10704. /**
  10705. * 是否对象
  10706. */
  10707. function object(value) {
  10708. return Object.prototype.toString.call(value) === '[object Object]';
  10709. }
  10710. /**
  10711. * 是否短信验证码
  10712. */
  10713. function code(value) {
  10714. var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
  10715. return new RegExp("^\\d{".concat(len, "}$")).test(value);
  10716. }
  10717. /**
  10718. * 是否函数方法
  10719. * @param {Object} value
  10720. */
  10721. function func(value) {
  10722. return typeof value === 'function';
  10723. }
  10724. /**
  10725. * 是否promise对象
  10726. * @param {Object} value
  10727. */
  10728. function promise(value) {
  10729. return object(value) && func(value.then) && func(value.catch);
  10730. }
  10731. /** 是否图片格式
  10732. * @param {Object} value
  10733. */
  10734. function image(value) {
  10735. var newValue = value.split('?')[0];
  10736. return new RegExp(/\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)$/).test(newValue);
  10737. }
  10738. /**
  10739. * 是否视频格式
  10740. * @param {Object} value
  10741. */
  10742. function video(value) {
  10743. var newValue = value.split('?')[0];
  10744. return new RegExp(/\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8|3gp)$/).test(newValue);
  10745. }
  10746. /**
  10747. * 是否为正则对象
  10748. * @param {Object}
  10749. * @return {Boolean}
  10750. */
  10751. function regExp(o) {
  10752. return o && Object.prototype.toString.call(o) === '[object RegExp]';
  10753. }
  10754. /**
  10755. * 验证字符串
  10756. */
  10757. function string(value) {
  10758. return typeof value === 'string';
  10759. }
  10760. var _default = {
  10761. email: email,
  10762. mobile: mobile,
  10763. url: url,
  10764. date: date,
  10765. dateISO: dateISO,
  10766. number: number,
  10767. digits: digits,
  10768. idCard: idCard,
  10769. carNo: carNo,
  10770. amount: amount,
  10771. chinese: chinese,
  10772. letter: letter,
  10773. enOrNum: enOrNum,
  10774. contains: contains,
  10775. range: range,
  10776. rangeLength: rangeLength,
  10777. empty: empty,
  10778. isEmpty: empty,
  10779. jsonString: jsonString,
  10780. landline: landline,
  10781. object: object,
  10782. array: array,
  10783. code: code,
  10784. func: func,
  10785. promise: promise,
  10786. video: video,
  10787. image: image,
  10788. regExp: regExp,
  10789. string: string
  10790. };
  10791. exports.default = _default;
  10792. /***/ }),
  10793. /***/ 39:
  10794. /*!**************************************************************************!*\
  10795. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/queryParams.js ***!
  10796. \**************************************************************************/
  10797. /*! no static exports found */
  10798. /***/ (function(module, exports, __webpack_require__) {
  10799. "use strict";
  10800. Object.defineProperty(exports, "__esModule", {
  10801. value: true
  10802. });
  10803. exports.default = void 0;
  10804. /**
  10805. * 对象转url参数
  10806. * @param {*} data,对象
  10807. * @param {*} isPrefix,是否自动加上"?"
  10808. */
  10809. function queryParams() {
  10810. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  10811. var isPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  10812. var arrayFormat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'brackets';
  10813. var prefix = isPrefix ? '?' : '';
  10814. var _result = [];
  10815. if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';
  10816. var _loop = function _loop(key) {
  10817. var value = data[key];
  10818. // 去掉为空的参数
  10819. if (['', undefined, null].indexOf(value) >= 0) {
  10820. return "continue";
  10821. }
  10822. // 如果值为数组,另行处理
  10823. if (value.constructor === Array) {
  10824. // e.g. {ids: [1, 2, 3]}
  10825. switch (arrayFormat) {
  10826. case 'indices':
  10827. // 结果: ids[0]=1&ids[1]=2&ids[2]=3
  10828. for (var i = 0; i < value.length; i++) {
  10829. _result.push(key + '[' + i + ']=' + value[i]);
  10830. }
  10831. break;
  10832. case 'brackets':
  10833. // 结果: ids[]=1&ids[]=2&ids[]=3
  10834. value.forEach(function (_value) {
  10835. _result.push(key + '[]=' + _value);
  10836. });
  10837. break;
  10838. case 'repeat':
  10839. // 结果: ids=1&ids=2&ids=3
  10840. value.forEach(function (_value) {
  10841. _result.push(key + '=' + _value);
  10842. });
  10843. break;
  10844. case 'comma':
  10845. // 结果: ids=1,2,3
  10846. var commaStr = "";
  10847. value.forEach(function (_value) {
  10848. commaStr += (commaStr ? "," : "") + _value;
  10849. });
  10850. _result.push(key + '=' + commaStr);
  10851. break;
  10852. default:
  10853. value.forEach(function (_value) {
  10854. _result.push(key + '[]=' + _value);
  10855. });
  10856. }
  10857. } else {
  10858. _result.push(key + '=' + value);
  10859. }
  10860. };
  10861. for (var key in data) {
  10862. var _ret = _loop(key);
  10863. if (_ret === "continue") continue;
  10864. }
  10865. return _result.length ? prefix + _result.join('&') : '';
  10866. }
  10867. var _default = queryParams;
  10868. exports.default = _default;
  10869. /***/ }),
  10870. /***/ 4:
  10871. /*!**********************************************************************!*\
  10872. !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
  10873. \**********************************************************************/
  10874. /*! no static exports found */
  10875. /***/ (function(module, exports) {
  10876. function _interopRequireDefault(obj) {
  10877. return obj && obj.__esModule ? obj : {
  10878. "default": obj
  10879. };
  10880. }
  10881. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  10882. /***/ }),
  10883. /***/ 40:
  10884. /*!********************************************************************!*\
  10885. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/route.js ***!
  10886. \********************************************************************/
  10887. /*! no static exports found */
  10888. /***/ (function(module, exports, __webpack_require__) {
  10889. "use strict";
  10890. /* WEBPACK VAR INJECTION */(function(uni) {
  10891. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10892. Object.defineProperty(exports, "__esModule", {
  10893. value: true
  10894. });
  10895. exports.default = void 0;
  10896. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 41));
  10897. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 43));
  10898. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  10899. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  10900. /**
  10901. * 路由跳转方法,该方法相对于直接使用uni.xxx的好处是使用更加简单快捷
  10902. * 并且带有路由拦截功能
  10903. */
  10904. var Router = /*#__PURE__*/function () {
  10905. function Router() {
  10906. (0, _classCallCheck2.default)(this, Router);
  10907. // 原始属性定义
  10908. this.config = {
  10909. type: 'navigateTo',
  10910. url: '',
  10911. delta: 1,
  10912. // navigateBack页面后退时,回退的层数
  10913. params: {},
  10914. // 传递的参数
  10915. animationType: 'pop-in',
  10916. // 窗口动画,只在APP有效
  10917. animationDuration: 300,
  10918. // 窗口动画持续时间,单位毫秒,只在APP有效
  10919. intercept: false // 是否需要拦截
  10920. };
  10921. // 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
  10922. // 这里在构造函数中进行this绑定
  10923. this.route = this.route.bind(this);
  10924. }
  10925. // 判断url前面是否有"/",如果没有则加上,否则无法跳转
  10926. (0, _createClass2.default)(Router, [{
  10927. key: "addRootPath",
  10928. value: function addRootPath(url) {
  10929. return url[0] === '/' ? url : "/".concat(url);
  10930. }
  10931. // 整合路由参数
  10932. }, {
  10933. key: "mixinParam",
  10934. value: function mixinParam(url, params) {
  10935. url = url && this.addRootPath(url);
  10936. // 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
  10937. // 如果有url中有get参数,转换后无需带上"?"
  10938. var query = '';
  10939. if (/.*\/.*\?.*=.*/.test(url)) {
  10940. // object对象转为get类型的参数
  10941. query = uni.$u.queryParams(params, false);
  10942. // 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
  10943. return url += "&" + query;
  10944. } else {
  10945. // 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
  10946. query = uni.$u.queryParams(params);
  10947. return url += query;
  10948. }
  10949. }
  10950. // 对外的方法名称
  10951. }, {
  10952. key: "route",
  10953. value: function () {
  10954. var _route = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  10955. var options,
  10956. params,
  10957. mergeConfig,
  10958. isNext,
  10959. _args = arguments;
  10960. return _regenerator.default.wrap(function _callee$(_context) {
  10961. while (1) {
  10962. switch (_context.prev = _context.next) {
  10963. case 0:
  10964. options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
  10965. params = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  10966. // 合并用户的配置和内部的默认配置
  10967. mergeConfig = {};
  10968. if (typeof options === 'string') {
  10969. // 如果options为字符串,则为route(url, params)的形式
  10970. mergeConfig.url = this.mixinParam(options, params);
  10971. mergeConfig.type = 'navigateTo';
  10972. } else {
  10973. mergeConfig = uni.$u.deepClone(options, this.config);
  10974. // 否则正常使用mergeConfig中的url和params进行拼接
  10975. mergeConfig.url = this.mixinParam(options.url, options.params);
  10976. }
  10977. if (params.intercept) {
  10978. this.config.intercept = params.intercept;
  10979. }
  10980. // params参数也带给拦截器
  10981. mergeConfig.params = params;
  10982. // 合并内外部参数
  10983. mergeConfig = uni.$u.deepMerge(this.config, mergeConfig);
  10984. // 判断用户是否定义了拦截器
  10985. if (!(typeof uni.$u.routeIntercept === 'function')) {
  10986. _context.next = 14;
  10987. break;
  10988. }
  10989. _context.next = 10;
  10990. return new Promise(function (resolve, reject) {
  10991. uni.$u.routeIntercept(mergeConfig, resolve);
  10992. });
  10993. case 10:
  10994. isNext = _context.sent;
  10995. // 如果isNext为true,则执行路由跳转
  10996. isNext && this.openPage(mergeConfig);
  10997. _context.next = 15;
  10998. break;
  10999. case 14:
  11000. this.openPage(mergeConfig);
  11001. case 15:
  11002. case "end":
  11003. return _context.stop();
  11004. }
  11005. }
  11006. }, _callee, this);
  11007. }));
  11008. function route() {
  11009. return _route.apply(this, arguments);
  11010. }
  11011. return route;
  11012. }() // 执行路由跳转
  11013. }, {
  11014. key: "openPage",
  11015. value: function openPage(config) {
  11016. // 解构参数
  11017. var url = config.url,
  11018. type = config.type,
  11019. delta = config.delta,
  11020. animationType = config.animationType,
  11021. animationDuration = config.animationDuration;
  11022. if (config.type == 'navigateTo' || config.type == 'to') {
  11023. uni.navigateTo({
  11024. url: url,
  11025. animationType: animationType,
  11026. animationDuration: animationDuration
  11027. });
  11028. }
  11029. if (config.type == 'redirectTo' || config.type == 'redirect') {
  11030. uni.redirectTo({
  11031. url: url
  11032. });
  11033. }
  11034. if (config.type == 'switchTab' || config.type == 'tab') {
  11035. uni.switchTab({
  11036. url: url
  11037. });
  11038. }
  11039. if (config.type == 'reLaunch' || config.type == 'launch') {
  11040. uni.reLaunch({
  11041. url: url
  11042. });
  11043. }
  11044. if (config.type == 'navigateBack' || config.type == 'back') {
  11045. uni.navigateBack({
  11046. delta: delta
  11047. });
  11048. }
  11049. }
  11050. }]);
  11051. return Router;
  11052. }();
  11053. var _default = new Router().route;
  11054. exports.default = _default;
  11055. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  11056. /***/ }),
  11057. /***/ 41:
  11058. /*!************************************************************************************************!*\
  11059. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator/index.js ***!
  11060. \************************************************************************************************/
  11061. /*! no static exports found */
  11062. /***/ (function(module, exports, __webpack_require__) {
  11063. // TODO(Babel 8): Remove this file.
  11064. var runtime = __webpack_require__(/*! @babel/runtime/helpers/regeneratorRuntime */ 42)();
  11065. module.exports = runtime;
  11066. /***/ }),
  11067. /***/ 42:
  11068. /*!*******************************************************************!*\
  11069. !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
  11070. \*******************************************************************/
  11071. /*! no static exports found */
  11072. /***/ (function(module, exports, __webpack_require__) {
  11073. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  11074. function _regeneratorRuntime() {
  11075. "use strict";
  11076. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  11077. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  11078. return exports;
  11079. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11080. var exports = {},
  11081. Op = Object.prototype,
  11082. hasOwn = Op.hasOwnProperty,
  11083. defineProperty = Object.defineProperty || function (obj, key, desc) {
  11084. obj[key] = desc.value;
  11085. },
  11086. $Symbol = "function" == typeof Symbol ? Symbol : {},
  11087. iteratorSymbol = $Symbol.iterator || "@@iterator",
  11088. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  11089. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  11090. function define(obj, key, value) {
  11091. return Object.defineProperty(obj, key, {
  11092. value: value,
  11093. enumerable: !0,
  11094. configurable: !0,
  11095. writable: !0
  11096. }), obj[key];
  11097. }
  11098. try {
  11099. define({}, "");
  11100. } catch (err) {
  11101. define = function define(obj, key, value) {
  11102. return obj[key] = value;
  11103. };
  11104. }
  11105. function wrap(innerFn, outerFn, self, tryLocsList) {
  11106. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  11107. generator = Object.create(protoGenerator.prototype),
  11108. context = new Context(tryLocsList || []);
  11109. return defineProperty(generator, "_invoke", {
  11110. value: makeInvokeMethod(innerFn, self, context)
  11111. }), generator;
  11112. }
  11113. function tryCatch(fn, obj, arg) {
  11114. try {
  11115. return {
  11116. type: "normal",
  11117. arg: fn.call(obj, arg)
  11118. };
  11119. } catch (err) {
  11120. return {
  11121. type: "throw",
  11122. arg: err
  11123. };
  11124. }
  11125. }
  11126. exports.wrap = wrap;
  11127. var ContinueSentinel = {};
  11128. function Generator() {}
  11129. function GeneratorFunction() {}
  11130. function GeneratorFunctionPrototype() {}
  11131. var IteratorPrototype = {};
  11132. define(IteratorPrototype, iteratorSymbol, function () {
  11133. return this;
  11134. });
  11135. var getProto = Object.getPrototypeOf,
  11136. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  11137. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  11138. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  11139. function defineIteratorMethods(prototype) {
  11140. ["next", "throw", "return"].forEach(function (method) {
  11141. define(prototype, method, function (arg) {
  11142. return this._invoke(method, arg);
  11143. });
  11144. });
  11145. }
  11146. function AsyncIterator(generator, PromiseImpl) {
  11147. function invoke(method, arg, resolve, reject) {
  11148. var record = tryCatch(generator[method], generator, arg);
  11149. if ("throw" !== record.type) {
  11150. var result = record.arg,
  11151. value = result.value;
  11152. return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  11153. invoke("next", value, resolve, reject);
  11154. }, function (err) {
  11155. invoke("throw", err, resolve, reject);
  11156. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  11157. result.value = unwrapped, resolve(result);
  11158. }, function (error) {
  11159. return invoke("throw", error, resolve, reject);
  11160. });
  11161. }
  11162. reject(record.arg);
  11163. }
  11164. var previousPromise;
  11165. defineProperty(this, "_invoke", {
  11166. value: function value(method, arg) {
  11167. function callInvokeWithMethodAndArg() {
  11168. return new PromiseImpl(function (resolve, reject) {
  11169. invoke(method, arg, resolve, reject);
  11170. });
  11171. }
  11172. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  11173. }
  11174. });
  11175. }
  11176. function makeInvokeMethod(innerFn, self, context) {
  11177. var state = "suspendedStart";
  11178. return function (method, arg) {
  11179. if ("executing" === state) throw new Error("Generator is already running");
  11180. if ("completed" === state) {
  11181. if ("throw" === method) throw arg;
  11182. return doneResult();
  11183. }
  11184. for (context.method = method, context.arg = arg;;) {
  11185. var delegate = context.delegate;
  11186. if (delegate) {
  11187. var delegateResult = maybeInvokeDelegate(delegate, context);
  11188. if (delegateResult) {
  11189. if (delegateResult === ContinueSentinel) continue;
  11190. return delegateResult;
  11191. }
  11192. }
  11193. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  11194. if ("suspendedStart" === state) throw state = "completed", context.arg;
  11195. context.dispatchException(context.arg);
  11196. } else "return" === context.method && context.abrupt("return", context.arg);
  11197. state = "executing";
  11198. var record = tryCatch(innerFn, self, context);
  11199. if ("normal" === record.type) {
  11200. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  11201. return {
  11202. value: record.arg,
  11203. done: context.done
  11204. };
  11205. }
  11206. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  11207. }
  11208. };
  11209. }
  11210. function maybeInvokeDelegate(delegate, context) {
  11211. var methodName = context.method,
  11212. method = delegate.iterator[methodName];
  11213. if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
  11214. var record = tryCatch(method, delegate.iterator, context.arg);
  11215. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  11216. var info = record.arg;
  11217. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  11218. }
  11219. function pushTryEntry(locs) {
  11220. var entry = {
  11221. tryLoc: locs[0]
  11222. };
  11223. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  11224. }
  11225. function resetTryEntry(entry) {
  11226. var record = entry.completion || {};
  11227. record.type = "normal", delete record.arg, entry.completion = record;
  11228. }
  11229. function Context(tryLocsList) {
  11230. this.tryEntries = [{
  11231. tryLoc: "root"
  11232. }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
  11233. }
  11234. function values(iterable) {
  11235. if (iterable) {
  11236. var iteratorMethod = iterable[iteratorSymbol];
  11237. if (iteratorMethod) return iteratorMethod.call(iterable);
  11238. if ("function" == typeof iterable.next) return iterable;
  11239. if (!isNaN(iterable.length)) {
  11240. var i = -1,
  11241. next = function next() {
  11242. for (; ++i < iterable.length;) {
  11243. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  11244. }
  11245. return next.value = undefined, next.done = !0, next;
  11246. };
  11247. return next.next = next;
  11248. }
  11249. }
  11250. return {
  11251. next: doneResult
  11252. };
  11253. }
  11254. function doneResult() {
  11255. return {
  11256. value: undefined,
  11257. done: !0
  11258. };
  11259. }
  11260. return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
  11261. value: GeneratorFunctionPrototype,
  11262. configurable: !0
  11263. }), defineProperty(GeneratorFunctionPrototype, "constructor", {
  11264. value: GeneratorFunction,
  11265. configurable: !0
  11266. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  11267. var ctor = "function" == typeof genFun && genFun.constructor;
  11268. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  11269. }, exports.mark = function (genFun) {
  11270. return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
  11271. }, exports.awrap = function (arg) {
  11272. return {
  11273. __await: arg
  11274. };
  11275. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  11276. return this;
  11277. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  11278. void 0 === PromiseImpl && (PromiseImpl = Promise);
  11279. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  11280. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  11281. return result.done ? result.value : iter.next();
  11282. });
  11283. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  11284. return this;
  11285. }), define(Gp, "toString", function () {
  11286. return "[object Generator]";
  11287. }), exports.keys = function (val) {
  11288. var object = Object(val),
  11289. keys = [];
  11290. for (var key in object) {
  11291. keys.push(key);
  11292. }
  11293. return keys.reverse(), function next() {
  11294. for (; keys.length;) {
  11295. var key = keys.pop();
  11296. if (key in object) return next.value = key, next.done = !1, next;
  11297. }
  11298. return next.done = !0, next;
  11299. };
  11300. }, exports.values = values, Context.prototype = {
  11301. constructor: Context,
  11302. reset: function reset(skipTempReset) {
  11303. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
  11304. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
  11305. }
  11306. },
  11307. stop: function stop() {
  11308. this.done = !0;
  11309. var rootRecord = this.tryEntries[0].completion;
  11310. if ("throw" === rootRecord.type) throw rootRecord.arg;
  11311. return this.rval;
  11312. },
  11313. dispatchException: function dispatchException(exception) {
  11314. if (this.done) throw exception;
  11315. var context = this;
  11316. function handle(loc, caught) {
  11317. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  11318. }
  11319. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  11320. var entry = this.tryEntries[i],
  11321. record = entry.completion;
  11322. if ("root" === entry.tryLoc) return handle("end");
  11323. if (entry.tryLoc <= this.prev) {
  11324. var hasCatch = hasOwn.call(entry, "catchLoc"),
  11325. hasFinally = hasOwn.call(entry, "finallyLoc");
  11326. if (hasCatch && hasFinally) {
  11327. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  11328. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  11329. } else if (hasCatch) {
  11330. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  11331. } else {
  11332. if (!hasFinally) throw new Error("try statement without catch or finally");
  11333. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  11334. }
  11335. }
  11336. }
  11337. },
  11338. abrupt: function abrupt(type, arg) {
  11339. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  11340. var entry = this.tryEntries[i];
  11341. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  11342. var finallyEntry = entry;
  11343. break;
  11344. }
  11345. }
  11346. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  11347. var record = finallyEntry ? finallyEntry.completion : {};
  11348. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  11349. },
  11350. complete: function complete(record, afterLoc) {
  11351. if ("throw" === record.type) throw record.arg;
  11352. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  11353. },
  11354. finish: function finish(finallyLoc) {
  11355. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  11356. var entry = this.tryEntries[i];
  11357. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  11358. }
  11359. },
  11360. "catch": function _catch(tryLoc) {
  11361. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  11362. var entry = this.tryEntries[i];
  11363. if (entry.tryLoc === tryLoc) {
  11364. var record = entry.completion;
  11365. if ("throw" === record.type) {
  11366. var thrown = record.arg;
  11367. resetTryEntry(entry);
  11368. }
  11369. return thrown;
  11370. }
  11371. }
  11372. throw new Error("illegal catch attempt");
  11373. },
  11374. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  11375. return this.delegate = {
  11376. iterator: values(iterable),
  11377. resultName: resultName,
  11378. nextLoc: nextLoc
  11379. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  11380. }
  11381. }, exports;
  11382. }
  11383. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11384. /***/ }),
  11385. /***/ 43:
  11386. /*!*****************************************************************!*\
  11387. !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
  11388. \*****************************************************************/
  11389. /*! no static exports found */
  11390. /***/ (function(module, exports) {
  11391. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  11392. try {
  11393. var info = gen[key](arg);
  11394. var value = info.value;
  11395. } catch (error) {
  11396. reject(error);
  11397. return;
  11398. }
  11399. if (info.done) {
  11400. resolve(value);
  11401. } else {
  11402. Promise.resolve(value).then(_next, _throw);
  11403. }
  11404. }
  11405. function _asyncToGenerator(fn) {
  11406. return function () {
  11407. var self = this,
  11408. args = arguments;
  11409. return new Promise(function (resolve, reject) {
  11410. var gen = fn.apply(self, args);
  11411. function _next(value) {
  11412. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  11413. }
  11414. function _throw(err) {
  11415. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  11416. }
  11417. _next(undefined);
  11418. });
  11419. };
  11420. }
  11421. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11422. /***/ }),
  11423. /***/ 44:
  11424. /*!*************************************************************************!*\
  11425. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/timeFormat.js ***!
  11426. \*************************************************************************/
  11427. /*! no static exports found */
  11428. /***/ (function(module, exports, __webpack_require__) {
  11429. "use strict";
  11430. Object.defineProperty(exports, "__esModule", {
  11431. value: true
  11432. });
  11433. exports.default = void 0;
  11434. // padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
  11435. // 所以这里做一个兼容polyfill的兼容处理
  11436. if (!String.prototype.padStart) {
  11437. // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
  11438. String.prototype.padStart = function (maxLength) {
  11439. var fillString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
  11440. if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError('fillString must be String');
  11441. var str = this;
  11442. // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
  11443. if (str.length >= maxLength) return String(str);
  11444. var fillLength = maxLength - str.length,
  11445. times = Math.ceil(fillLength / fillString.length);
  11446. while (times >>= 1) {
  11447. fillString += fillString;
  11448. if (times === 1) {
  11449. fillString += fillString;
  11450. }
  11451. }
  11452. return fillString.slice(0, fillLength) + str;
  11453. };
  11454. }
  11455. // 其他更多是格式化有如下:
  11456. // yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
  11457. function timeFormat() {
  11458. var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  11459. var fmt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  11460. // 如果为null,则格式化当前时间
  11461. if (!dateTime) dateTime = Number(new Date());
  11462. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  11463. if (dateTime.toString().length == 10) dateTime *= 1000;
  11464. var date = new Date(dateTime);
  11465. var ret;
  11466. var opt = {
  11467. "y+": date.getFullYear().toString(),
  11468. // 年
  11469. "m+": (date.getMonth() + 1).toString(),
  11470. // 月
  11471. "d+": date.getDate().toString(),
  11472. // 日
  11473. "h+": date.getHours().toString(),
  11474. // 时
  11475. "M+": date.getMinutes().toString(),
  11476. // 分
  11477. "s+": date.getSeconds().toString() // 秒
  11478. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  11479. };
  11480. for (var k in opt) {
  11481. ret = new RegExp("(" + k + ")").exec(fmt);
  11482. if (ret) {
  11483. fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"));
  11484. }
  11485. ;
  11486. }
  11487. ;
  11488. return fmt;
  11489. }
  11490. var _default = timeFormat;
  11491. exports.default = _default;
  11492. /***/ }),
  11493. /***/ 45:
  11494. /*!***********************************************************************!*\
  11495. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/timeFrom.js ***!
  11496. \***********************************************************************/
  11497. /*! no static exports found */
  11498. /***/ (function(module, exports, __webpack_require__) {
  11499. "use strict";
  11500. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11501. Object.defineProperty(exports, "__esModule", {
  11502. value: true
  11503. });
  11504. exports.default = void 0;
  11505. var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ../../libs/function/timeFormat.js */ 44));
  11506. /**
  11507. * 时间戳转为多久之前
  11508. * @param String timestamp 时间戳
  11509. * @param String | Boolean format 如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;
  11510. * 如果为布尔值false,无论什么时间,都返回多久以前的格式
  11511. */
  11512. function timeFrom() {
  11513. var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  11514. var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  11515. // 如果为null,则格式化当前时间
  11516. if (!dateTime) dateTime = Number(new Date());
  11517. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  11518. if (dateTime.toString().length == 10) dateTime *= 1000;
  11519. var timestamp = +new Date(Number(dateTime));
  11520. var timer = (Number(new Date()) - timestamp) / 1000;
  11521. // 如果小于5分钟,则返回"刚刚",其他以此类推
  11522. var tips = '';
  11523. switch (true) {
  11524. case timer < 300:
  11525. tips = '刚刚';
  11526. break;
  11527. case timer >= 300 && timer < 3600:
  11528. tips = parseInt(timer / 60) + '分钟前';
  11529. break;
  11530. case timer >= 3600 && timer < 86400:
  11531. tips = parseInt(timer / 3600) + '小时前';
  11532. break;
  11533. case timer >= 86400 && timer < 2592000:
  11534. tips = parseInt(timer / 86400) + '天前';
  11535. break;
  11536. default:
  11537. // 如果format为false,则无论什么时间戳,都显示xx之前
  11538. if (format === false) {
  11539. if (timer >= 2592000 && timer < 365 * 86400) {
  11540. tips = parseInt(timer / (86400 * 30)) + '个月前';
  11541. } else {
  11542. tips = parseInt(timer / (86400 * 365)) + '年前';
  11543. }
  11544. } else {
  11545. tips = (0, _timeFormat.default)(timestamp, format);
  11546. }
  11547. }
  11548. return tips;
  11549. }
  11550. var _default = timeFrom;
  11551. exports.default = _default;
  11552. /***/ }),
  11553. /***/ 46:
  11554. /*!****************************************************************************!*\
  11555. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/colorGradient.js ***!
  11556. \****************************************************************************/
  11557. /*! no static exports found */
  11558. /***/ (function(module, exports, __webpack_require__) {
  11559. "use strict";
  11560. Object.defineProperty(exports, "__esModule", {
  11561. value: true
  11562. });
  11563. exports.default = void 0;
  11564. /**
  11565. * 求两个颜色之间的渐变值
  11566. * @param {string} startColor 开始的颜色
  11567. * @param {string} endColor 结束的颜色
  11568. * @param {number} step 颜色等分的份额
  11569. * */
  11570. function colorGradient() {
  11571. var startColor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'rgb(0, 0, 0)';
  11572. var endColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rgb(255, 255, 255)';
  11573. var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
  11574. var startRGB = hexToRgb(startColor, false); //转换为rgb数组模式
  11575. var startR = startRGB[0];
  11576. var startG = startRGB[1];
  11577. var startB = startRGB[2];
  11578. var endRGB = hexToRgb(endColor, false);
  11579. var endR = endRGB[0];
  11580. var endG = endRGB[1];
  11581. var endB = endRGB[2];
  11582. var sR = (endR - startR) / step; //总差值
  11583. var sG = (endG - startG) / step;
  11584. var sB = (endB - startB) / step;
  11585. var colorArr = [];
  11586. for (var i = 0; i < step; i++) {
  11587. //计算每一步的hex值
  11588. var hex = rgbToHex('rgb(' + Math.round(sR * i + startR) + ',' + Math.round(sG * i + startG) + ',' + Math.round(sB * i + startB) + ')');
  11589. colorArr.push(hex);
  11590. }
  11591. return colorArr;
  11592. }
  11593. // 将hex表示方式转换为rgb表示方式(这里返回rgb数组模式)
  11594. function hexToRgb(sColor) {
  11595. var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  11596. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  11597. sColor = sColor.toLowerCase();
  11598. if (sColor && reg.test(sColor)) {
  11599. if (sColor.length === 4) {
  11600. var sColorNew = "#";
  11601. for (var i = 1; i < 4; i += 1) {
  11602. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  11603. }
  11604. sColor = sColorNew;
  11605. }
  11606. //处理六位的颜色值
  11607. var sColorChange = [];
  11608. for (var _i = 1; _i < 7; _i += 2) {
  11609. sColorChange.push(parseInt("0x" + sColor.slice(_i, _i + 2)));
  11610. }
  11611. if (!str) {
  11612. return sColorChange;
  11613. } else {
  11614. return "rgb(".concat(sColorChange[0], ",").concat(sColorChange[1], ",").concat(sColorChange[2], ")");
  11615. }
  11616. } else if (/^(rgb|RGB)/.test(sColor)) {
  11617. var arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  11618. return arr.map(function (val) {
  11619. return Number(val);
  11620. });
  11621. } else {
  11622. return sColor;
  11623. }
  11624. }
  11625. ;
  11626. // 将rgb表示方式转换为hex表示方式
  11627. function rgbToHex(rgb) {
  11628. var _this = rgb;
  11629. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  11630. if (/^(rgb|RGB)/.test(_this)) {
  11631. var aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  11632. var strHex = "#";
  11633. for (var i = 0; i < aColor.length; i++) {
  11634. var hex = Number(aColor[i]).toString(16);
  11635. hex = String(hex).length == 1 ? 0 + '' + hex : hex; // 保证每个rgb的值为2位
  11636. if (hex === "0") {
  11637. hex += hex;
  11638. }
  11639. strHex += hex;
  11640. }
  11641. if (strHex.length !== 7) {
  11642. strHex = _this;
  11643. }
  11644. return strHex;
  11645. } else if (reg.test(_this)) {
  11646. var aNum = _this.replace(/#/, "").split("");
  11647. if (aNum.length === 6) {
  11648. return _this;
  11649. } else if (aNum.length === 3) {
  11650. var numHex = "#";
  11651. for (var _i2 = 0; _i2 < aNum.length; _i2 += 1) {
  11652. numHex += aNum[_i2] + aNum[_i2];
  11653. }
  11654. return numHex;
  11655. }
  11656. } else {
  11657. return _this;
  11658. }
  11659. }
  11660. /**
  11661. * JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba(255,255,255,0.5)字符串
  11662. * sHex为传入的十六进制的色值
  11663. * alpha为rgba的透明度
  11664. */
  11665. function colorToRgba(color) {
  11666. var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.3;
  11667. color = rgbToHex(color);
  11668. // 十六进制颜色值的正则表达式
  11669. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  11670. /* 16进制颜色转为RGB格式 */
  11671. var sColor = color.toLowerCase();
  11672. if (sColor && reg.test(sColor)) {
  11673. if (sColor.length === 4) {
  11674. var sColorNew = '#';
  11675. for (var i = 1; i < 4; i += 1) {
  11676. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  11677. }
  11678. sColor = sColorNew;
  11679. }
  11680. // 处理六位的颜色值
  11681. var sColorChange = [];
  11682. for (var _i3 = 1; _i3 < 7; _i3 += 2) {
  11683. sColorChange.push(parseInt('0x' + sColor.slice(_i3, _i3 + 2)));
  11684. }
  11685. // return sColorChange.join(',')
  11686. return 'rgba(' + sColorChange.join(',') + ',' + alpha + ')';
  11687. } else {
  11688. return sColor;
  11689. }
  11690. }
  11691. var _default = {
  11692. colorGradient: colorGradient,
  11693. hexToRgb: hexToRgb,
  11694. rgbToHex: rgbToHex,
  11695. colorToRgba: colorToRgba
  11696. };
  11697. exports.default = _default;
  11698. /***/ }),
  11699. /***/ 47:
  11700. /*!*******************************************************************!*\
  11701. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/guid.js ***!
  11702. \*******************************************************************/
  11703. /*! no static exports found */
  11704. /***/ (function(module, exports, __webpack_require__) {
  11705. "use strict";
  11706. Object.defineProperty(exports, "__esModule", {
  11707. value: true
  11708. });
  11709. exports.default = void 0;
  11710. /**
  11711. * 本算法来源于简书开源代码,详见:https://www.jianshu.com/p/fdbf293d0a85
  11712. * 全局唯一标识符(uuid,Globally Unique Identifier),也称作 uuid(Universally Unique IDentifier)
  11713. * 一般用于多个组件之间,给它一个唯一的标识符,或者v-for循环的时候,如果使用数组的index可能会导致更新列表出现问题
  11714. * 最可能的情况是左滑删除item或者对某条信息流"不喜欢"并去掉它的时候,会导致组件内的数据可能出现错乱
  11715. * v-for的时候,推荐使用后端返回的id而不是循环的index
  11716. * @param {Number} len uuid的长度
  11717. * @param {Boolean} firstU 将返回的首字母置为"u"
  11718. * @param {Nubmer} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
  11719. */
  11720. function guid() {
  11721. var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32;
  11722. var firstU = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  11723. var radix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  11724. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  11725. var uuid = [];
  11726. radix = radix || chars.length;
  11727. if (len) {
  11728. // 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位
  11729. for (var i = 0; i < len; i++) {
  11730. uuid[i] = chars[0 | Math.random() * radix];
  11731. }
  11732. } else {
  11733. var r;
  11734. // rfc4122标准要求返回的uuid中,某些位为固定的字符
  11735. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  11736. uuid[14] = '4';
  11737. for (var _i = 0; _i < 36; _i++) {
  11738. if (!uuid[_i]) {
  11739. r = 0 | Math.random() * 16;
  11740. uuid[_i] = chars[_i == 19 ? r & 0x3 | 0x8 : r];
  11741. }
  11742. }
  11743. }
  11744. // 移除第一个字符,并用u替代,因为第一个字符为数值时,该guuid不能用作id或者class
  11745. if (firstU) {
  11746. uuid.shift();
  11747. return 'u' + uuid.join('');
  11748. } else {
  11749. return uuid.join('');
  11750. }
  11751. }
  11752. var _default = guid;
  11753. exports.default = _default;
  11754. /***/ }),
  11755. /***/ 48:
  11756. /*!********************************************************************!*\
  11757. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/color.js ***!
  11758. \********************************************************************/
  11759. /*! no static exports found */
  11760. /***/ (function(module, exports, __webpack_require__) {
  11761. "use strict";
  11762. Object.defineProperty(exports, "__esModule", {
  11763. value: true
  11764. });
  11765. exports.default = void 0;
  11766. // 为了让用户能够自定义主题,会逐步弃用此文件,各颜色通过css提供
  11767. // 为了给某些特殊场景使用和向后兼容,无需删除此文件(2020-06-20)
  11768. var color = {
  11769. primary: "#2979ff",
  11770. primaryDark: "#2b85e4",
  11771. primaryDisabled: "#a0cfff",
  11772. primaryLight: "#ecf5ff",
  11773. bgColor: "#f3f4f6",
  11774. info: "#909399",
  11775. infoDark: "#82848a",
  11776. infoDisabled: "#c8c9cc",
  11777. infoLight: "#f4f4f5",
  11778. warning: "#ff9900",
  11779. warningDark: "#f29100",
  11780. warningDisabled: "#fcbd71",
  11781. warningLight: "#fdf6ec",
  11782. error: "#fa3534",
  11783. errorDark: "#dd6161",
  11784. errorDisabled: "#fab6b6",
  11785. errorLight: "#fef0f0",
  11786. success: "#19be6b",
  11787. successDark: "#18b566",
  11788. successDisabled: "#71d5a1",
  11789. successLight: "#dbf1e1",
  11790. mainColor: "#303133",
  11791. contentColor: "#606266",
  11792. tipsColor: "#909399",
  11793. lightColor: "#c0c4cc",
  11794. borderColor: "#e4e7ed"
  11795. };
  11796. var _default = color;
  11797. exports.default = _default;
  11798. /***/ }),
  11799. /***/ 49:
  11800. /*!************************************************************************!*\
  11801. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/type2icon.js ***!
  11802. \************************************************************************/
  11803. /*! no static exports found */
  11804. /***/ (function(module, exports, __webpack_require__) {
  11805. "use strict";
  11806. Object.defineProperty(exports, "__esModule", {
  11807. value: true
  11808. });
  11809. exports.default = void 0;
  11810. /**
  11811. * 根据主题type值,获取对应的图标
  11812. * @param String type 主题名称,primary|info|error|warning|success
  11813. * @param String fill 是否使用fill填充实体的图标
  11814. */
  11815. function type2icon() {
  11816. var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'success';
  11817. var fill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11818. // 如果非预置值,默认为success
  11819. if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success';
  11820. var iconName = '';
  11821. // 目前(2019-12-12),info和primary使用同一个图标
  11822. switch (type) {
  11823. case 'primary':
  11824. iconName = 'info-circle';
  11825. break;
  11826. case 'info':
  11827. iconName = 'info-circle';
  11828. break;
  11829. case 'error':
  11830. iconName = 'close-circle';
  11831. break;
  11832. case 'warning':
  11833. iconName = 'error-circle';
  11834. break;
  11835. case 'success':
  11836. iconName = 'checkmark-circle';
  11837. break;
  11838. default:
  11839. iconName = 'checkmark-circle';
  11840. }
  11841. // 是否是实体类型,加上-fill,在icon组件库中,实体的类名是后面加-fill的
  11842. if (fill) iconName += '-fill';
  11843. return iconName;
  11844. }
  11845. var _default = type2icon;
  11846. exports.default = _default;
  11847. /***/ }),
  11848. /***/ 5:
  11849. /*!**************************************************************!*\
  11850. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  11851. \**************************************************************/
  11852. /*! no static exports found */
  11853. /***/ (function(module, exports, __webpack_require__) {
  11854. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 6);
  11855. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 7);
  11856. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  11857. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 10);
  11858. function _slicedToArray(arr, i) {
  11859. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  11860. }
  11861. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11862. /***/ }),
  11863. /***/ 50:
  11864. /*!**************************************************************************!*\
  11865. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/randomArray.js ***!
  11866. \**************************************************************************/
  11867. /*! no static exports found */
  11868. /***/ (function(module, exports, __webpack_require__) {
  11869. "use strict";
  11870. Object.defineProperty(exports, "__esModule", {
  11871. value: true
  11872. });
  11873. exports.default = void 0;
  11874. // 打乱数组
  11875. function randomArray() {
  11876. var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  11877. // 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
  11878. return array.sort(function () {
  11879. return Math.random() - 0.5;
  11880. });
  11881. }
  11882. var _default = randomArray;
  11883. exports.default = _default;
  11884. /***/ }),
  11885. /***/ 51:
  11886. /*!**********************************************************************!*\
  11887. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/addUnit.js ***!
  11888. \**********************************************************************/
  11889. /*! no static exports found */
  11890. /***/ (function(module, exports, __webpack_require__) {
  11891. "use strict";
  11892. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11893. Object.defineProperty(exports, "__esModule", {
  11894. value: true
  11895. });
  11896. exports.default = addUnit;
  11897. var _test = _interopRequireDefault(__webpack_require__(/*! ./test.js */ 38));
  11898. // 添加单位,如果有rpx,%,px等单位结尾或者值为auto,直接返回,否则加上rpx单位结尾
  11899. function addUnit() {
  11900. var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'auto';
  11901. var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rpx';
  11902. value = String(value);
  11903. // 用uView内置验证规则中的number判断是否为数值
  11904. return _test.default.number(value) ? "".concat(value).concat(unit) : value;
  11905. }
  11906. /***/ }),
  11907. /***/ 52:
  11908. /*!*********************************************************************!*\
  11909. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/random.js ***!
  11910. \*********************************************************************/
  11911. /*! no static exports found */
  11912. /***/ (function(module, exports, __webpack_require__) {
  11913. "use strict";
  11914. Object.defineProperty(exports, "__esModule", {
  11915. value: true
  11916. });
  11917. exports.default = void 0;
  11918. function random(min, max) {
  11919. if (min >= 0 && max > 0 && max >= min) {
  11920. var gab = max - min + 1;
  11921. return Math.floor(Math.random() * gab + min);
  11922. } else {
  11923. return 0;
  11924. }
  11925. }
  11926. var _default = random;
  11927. exports.default = _default;
  11928. /***/ }),
  11929. /***/ 522:
  11930. /*!*************************************************************************************!*\
  11931. !*** E:/work/mdapp/uni_modules/vk-uview-ui/components/u-parse/libs/MpHtmlParser.js ***!
  11932. \*************************************************************************************/
  11933. /*! no static exports found */
  11934. /***/ (function(module, exports, __webpack_require__) {
  11935. "use strict";
  11936. /* WEBPACK VAR INJECTION */(function(uni) {
  11937. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11938. Object.defineProperty(exports, "__esModule", {
  11939. value: true
  11940. });
  11941. exports.default = void 0;
  11942. var _config = _interopRequireDefault(__webpack_require__(/*! ./config.js */ 523));
  11943. var _CssHandler = _interopRequireDefault(__webpack_require__(/*! ./CssHandler.js */ 524));
  11944. /**
  11945. * html 解析器
  11946. * @tutorial https://github.com/jin-yufeng/Parser
  11947. * @version 20201029
  11948. * @author JinYufeng
  11949. * @listens MIT
  11950. */
  11951. var blankChar = _config.default.blankChar;
  11952. var windowWidth = uni.getSystemInfoSync().windowWidth;
  11953. var emoji;
  11954. function MpHtmlParser(data) {
  11955. var _this = this;
  11956. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  11957. this.attrs = {};
  11958. this.CssHandler = new _CssHandler.default(options.tagStyle, windowWidth);
  11959. this.data = data;
  11960. this.domain = options.domain;
  11961. this.DOM = [];
  11962. this.i = this.start = this.audioNum = this.imgNum = this.videoNum = 0;
  11963. options.prot = (this.domain || '').includes('://') ? this.domain.split('://')[0] : 'http';
  11964. this.options = options;
  11965. this.state = this.Text;
  11966. this.STACK = [];
  11967. // 工具函数
  11968. this.bubble = function () {
  11969. for (var i = _this.STACK.length, item; item = _this.STACK[--i];) {
  11970. if (_config.default.richOnlyTags[item.name]) return false;
  11971. item.c = 1;
  11972. }
  11973. return true;
  11974. };
  11975. this.decode = function (val, amp) {
  11976. var i = -1,
  11977. j,
  11978. en;
  11979. while (1) {
  11980. if ((i = val.indexOf('&', i + 1)) == -1) break;
  11981. if ((j = val.indexOf(';', i + 2)) == -1) break;
  11982. if (val[i + 1] == '#') {
  11983. en = parseInt((val[i + 2] == 'x' ? '0' : '') + val.substring(i + 2, j));
  11984. if (!isNaN(en)) val = val.substr(0, i) + String.fromCharCode(en) + val.substr(j + 1);
  11985. } else {
  11986. en = val.substring(i + 1, j);
  11987. if (_config.default.entities[en] || en == amp) val = val.substr(0, i) + (_config.default.entities[en] || '&') + val.substr(j + 1);
  11988. }
  11989. }
  11990. return val;
  11991. };
  11992. this.getUrl = function (url) {
  11993. if (url[0] == '/') {
  11994. if (url[1] == '/') url = _this.options.prot + ':' + url;else if (_this.domain) url = _this.domain + url;
  11995. } else if (_this.domain && url.indexOf('data:') != 0 && !url.includes('://')) url = _this.domain + '/' + url;
  11996. return url;
  11997. };
  11998. this.isClose = function () {
  11999. return _this.data[_this.i] == '>' || _this.data[_this.i] == '/' && _this.data[_this.i + 1] == '>';
  12000. };
  12001. this.section = function () {
  12002. return _this.data.substring(_this.start, _this.i);
  12003. };
  12004. this.parent = function () {
  12005. return _this.STACK[_this.STACK.length - 1];
  12006. };
  12007. this.siblings = function () {
  12008. return _this.STACK.length ? _this.parent().children : _this.DOM;
  12009. };
  12010. }
  12011. MpHtmlParser.prototype.parse = function () {
  12012. if (emoji) this.data = emoji.parseEmoji(this.data);
  12013. for (var c; c = this.data[this.i]; this.i++) {
  12014. this.state(c);
  12015. }
  12016. if (this.state == this.Text) this.setText();
  12017. while (this.STACK.length) {
  12018. this.popNode(this.STACK.pop());
  12019. }
  12020. return this.DOM;
  12021. };
  12022. // 设置属性
  12023. MpHtmlParser.prototype.setAttr = function () {
  12024. var name = this.attrName.toLowerCase(),
  12025. val = this.attrVal;
  12026. if (_config.default.boolAttrs[name]) this.attrs[name] = 'T';else if (val) {
  12027. if (name == 'src' || name == 'data-src' && !this.attrs.src) this.attrs.src = this.getUrl(this.decode(val, 'amp'));else if (name == 'href' || name == 'style') this.attrs[name] = this.decode(val, 'amp');else if (name.substr(0, 5) != 'data-') this.attrs[name] = val;
  12028. }
  12029. this.attrVal = '';
  12030. while (blankChar[this.data[this.i]]) {
  12031. this.i++;
  12032. }
  12033. if (this.isClose()) this.setNode();else {
  12034. this.start = this.i;
  12035. this.state = this.AttrName;
  12036. }
  12037. };
  12038. // 设置文本节点
  12039. MpHtmlParser.prototype.setText = function () {
  12040. var back,
  12041. text = this.section();
  12042. if (!text) return;
  12043. text = _config.default.onText && _config.default.onText(text, function () {
  12044. return back = true;
  12045. }) || text;
  12046. if (back) {
  12047. this.data = this.data.substr(0, this.start) + text + this.data.substr(this.i);
  12048. var j = this.start + text.length;
  12049. for (this.i = this.start; this.i < j; this.i++) {
  12050. this.state(this.data[this.i]);
  12051. }
  12052. return;
  12053. }
  12054. if (!this.pre) {
  12055. // 合并空白符
  12056. var flag,
  12057. tmp = [];
  12058. for (var i = text.length, c; c = text[--i];) {
  12059. if (!blankChar[c]) {
  12060. tmp.unshift(c);
  12061. if (!flag) flag = 1;
  12062. } else {
  12063. if (tmp[0] != ' ') tmp.unshift(' ');
  12064. if (c == '\n' && flag == void 0) flag = 0;
  12065. }
  12066. }
  12067. if (flag == 0) return;
  12068. text = tmp.join('');
  12069. }
  12070. this.siblings().push({
  12071. type: 'text',
  12072. text: this.decode(text)
  12073. });
  12074. };
  12075. // 设置元素节点
  12076. MpHtmlParser.prototype.setNode = function () {
  12077. var node = {
  12078. name: this.tagName.toLowerCase(),
  12079. attrs: this.attrs
  12080. },
  12081. close = _config.default.selfClosingTags[node.name];
  12082. if (this.options.nodes.length) node.type = 'node';
  12083. this.attrs = {};
  12084. if (!_config.default.ignoreTags[node.name]) {
  12085. // 处理属性
  12086. var attrs = node.attrs,
  12087. style = this.CssHandler.match(node.name, attrs, node) + (attrs.style || ''),
  12088. styleObj = {};
  12089. if (attrs.id) {
  12090. if (this.options.compress & 1) attrs.id = void 0;else if (this.options.useAnchor) this.bubble();
  12091. }
  12092. if (this.options.compress & 2 && attrs.class) attrs.class = void 0;
  12093. switch (node.name) {
  12094. case 'a':
  12095. case 'ad':
  12096. this.bubble();
  12097. break;
  12098. case 'font':
  12099. if (attrs.color) {
  12100. styleObj['color'] = attrs.color;
  12101. attrs.color = void 0;
  12102. }
  12103. if (attrs.face) {
  12104. styleObj['font-family'] = attrs.face;
  12105. attrs.face = void 0;
  12106. }
  12107. if (attrs.size) {
  12108. var size = parseInt(attrs.size);
  12109. if (size < 1) size = 1;else if (size > 7) size = 7;
  12110. var map = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
  12111. styleObj['font-size'] = map[size - 1];
  12112. attrs.size = void 0;
  12113. }
  12114. break;
  12115. case 'embed':
  12116. var src = node.attrs.src || '',
  12117. type = node.attrs.type || '';
  12118. if (type.includes('video') || src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8')) node.name = 'video';else if (type.includes('audio') || src.includes('.m4a') || src.includes('.wav') || src.includes('.mp3') || src.includes('.aac')) node.name = 'audio';else break;
  12119. if (node.attrs.autostart) node.attrs.autoplay = 'T';
  12120. node.attrs.controls = 'T';
  12121. case 'video':
  12122. case 'audio':
  12123. if (!attrs.id) attrs.id = node.name + ++this["".concat(node.name, "Num")];else this["".concat(node.name, "Num")]++;
  12124. if (node.name == 'video') {
  12125. if (this.videoNum > 3) node.lazyLoad = 1;
  12126. if (attrs.width) {
  12127. styleObj.width = parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px');
  12128. attrs.width = void 0;
  12129. }
  12130. if (attrs.height) {
  12131. styleObj.height = parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px');
  12132. attrs.height = void 0;
  12133. }
  12134. }
  12135. if (!attrs.controls && !attrs.autoplay) attrs.controls = 'T';
  12136. attrs.source = [];
  12137. if (attrs.src) {
  12138. attrs.source.push(attrs.src);
  12139. attrs.src = void 0;
  12140. }
  12141. this.bubble();
  12142. break;
  12143. case 'td':
  12144. case 'th':
  12145. if (attrs.colspan || attrs.rowspan) for (var k = this.STACK.length, item; item = this.STACK[--k];) {
  12146. if (item.name == 'table') {
  12147. item.flag = 1;
  12148. break;
  12149. }
  12150. }
  12151. }
  12152. if (attrs.align) {
  12153. if (node.name == 'table') {
  12154. if (attrs.align == 'center') styleObj['margin-inline-start'] = styleObj['margin-inline-end'] = 'auto';else styleObj['float'] = attrs.align;
  12155. } else styleObj['text-align'] = attrs.align;
  12156. attrs.align = void 0;
  12157. }
  12158. // 压缩 style
  12159. var styles = style.split(';');
  12160. style = '';
  12161. for (var i = 0, len = styles.length; i < len; i++) {
  12162. var info = styles[i].split(':');
  12163. if (info.length < 2) continue;
  12164. var _key = info[0].trim().toLowerCase(),
  12165. _value = info.slice(1).join(':').trim();
  12166. if (_value[0] == '-' || _value.includes('safe')) style += ";".concat(_key, ":").concat(_value);else if (!styleObj[_key] || _value.includes('import') || !styleObj[_key].includes('import')) styleObj[_key] = _value;
  12167. }
  12168. if (node.name == 'img') {
  12169. if (attrs.src && !attrs.ignore) {
  12170. if (this.bubble()) attrs.i = (this.imgNum++).toString();else attrs.ignore = 'T';
  12171. }
  12172. if (attrs.ignore) {
  12173. style += ';-webkit-touch-callout:none';
  12174. styleObj['max-width'] = '100%';
  12175. }
  12176. var width;
  12177. if (styleObj.width) width = styleObj.width;else if (attrs.width) width = attrs.width.includes('%') ? attrs.width : parseFloat(attrs.width) + 'px';
  12178. if (width) {
  12179. styleObj.width = width;
  12180. attrs.width = '100%';
  12181. if (parseInt(width) > windowWidth) {
  12182. styleObj.height = '';
  12183. if (attrs.height) attrs.height = void 0;
  12184. }
  12185. }
  12186. if (styleObj.height) {
  12187. attrs.height = styleObj.height;
  12188. styleObj.height = '';
  12189. } else if (attrs.height && !attrs.height.includes('%')) attrs.height = parseFloat(attrs.height) + 'px';
  12190. }
  12191. for (var key in styleObj) {
  12192. var value = styleObj[key];
  12193. if (!value) continue;
  12194. if (key.includes('flex') || key == 'order' || key == 'self-align') node.c = 1;
  12195. // 填充链接
  12196. if (value.includes('url')) {
  12197. var j = value.indexOf('(');
  12198. if (j++ != -1) {
  12199. while (value[j] == '"' || value[j] == "'" || blankChar[value[j]]) {
  12200. j++;
  12201. }
  12202. value = value.substr(0, j) + this.getUrl(value.substr(j));
  12203. }
  12204. }
  12205. // 转换 rpx
  12206. else if (value.includes('rpx')) value = value.replace(/[0-9.]+\s*rpx/g, function ($) {
  12207. return parseFloat($) * windowWidth / 750 + 'px';
  12208. });else if (key == 'white-space' && value.includes('pre') && !close) this.pre = node.pre = true;
  12209. style += ";".concat(key, ":").concat(value);
  12210. }
  12211. style = style.substr(1);
  12212. if (style) attrs.style = style;
  12213. if (!close) {
  12214. node.children = [];
  12215. if (node.name == 'pre' && _config.default.highlight) {
  12216. this.remove(node);
  12217. this.pre = node.pre = true;
  12218. }
  12219. this.siblings().push(node);
  12220. this.STACK.push(node);
  12221. } else if (!_config.default.filter || _config.default.filter(node, this) != false) this.siblings().push(node);
  12222. } else {
  12223. if (!close) this.remove(node);else if (node.name == 'source') {
  12224. var parent = this.parent();
  12225. if (parent && (parent.name == 'video' || parent.name == 'audio') && node.attrs.src) parent.attrs.source.push(node.attrs.src);
  12226. } else if (node.name == 'base' && !this.domain) this.domain = node.attrs.href;
  12227. }
  12228. if (this.data[this.i] == '/') this.i++;
  12229. this.start = this.i + 1;
  12230. this.state = this.Text;
  12231. };
  12232. // 移除标签
  12233. MpHtmlParser.prototype.remove = function (node) {
  12234. var _this2 = this;
  12235. var name = node.name,
  12236. j = this.i;
  12237. // 处理 svg
  12238. var handleSvg = function handleSvg() {
  12239. var src = _this2.data.substring(j, _this2.i + 1);
  12240. node.attrs.xmlns = 'http://www.w3.org/2000/svg';
  12241. for (var key in node.attrs) {
  12242. if (key == 'viewbox') src = " viewBox=\"".concat(node.attrs.viewbox, "\"") + src;else if (key != 'style') src = " ".concat(key, "=\"").concat(node.attrs[key], "\"") + src;
  12243. }
  12244. src = '<svg' + src;
  12245. var parent = _this2.parent();
  12246. if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline')) parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style;
  12247. _this2.siblings().push({
  12248. name: 'img',
  12249. attrs: {
  12250. src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'),
  12251. style: node.attrs.style,
  12252. ignore: 'T'
  12253. }
  12254. });
  12255. };
  12256. if (node.name == 'svg' && this.data[j] == '/') return handleSvg(this.i++);
  12257. while (1) {
  12258. if ((this.i = this.data.indexOf('</', this.i + 1)) == -1) {
  12259. if (name == 'pre' || name == 'svg') this.i = j;else this.i = this.data.length;
  12260. return;
  12261. }
  12262. this.start = this.i += 2;
  12263. while (!blankChar[this.data[this.i]] && !this.isClose()) {
  12264. this.i++;
  12265. }
  12266. if (this.section().toLowerCase() == name) {
  12267. // 代码块高亮
  12268. if (name == 'pre') {
  12269. this.data = this.data.substr(0, j + 1) + _config.default.highlight(this.data.substring(j + 1, this.i - 5), node.attrs) + this.data.substr(this.i - 5);
  12270. return this.i = j;
  12271. } else if (name == 'style') this.CssHandler.getStyle(this.data.substring(j + 1, this.i - 7));else if (name == 'title') this.DOM.title = this.data.substring(j + 1, this.i - 7);
  12272. if ((this.i = this.data.indexOf('>', this.i)) == -1) this.i = this.data.length;
  12273. if (name == 'svg') handleSvg();
  12274. return;
  12275. }
  12276. }
  12277. };
  12278. // 节点出栈处理
  12279. MpHtmlParser.prototype.popNode = function (node) {
  12280. // 空白符处理
  12281. if (node.pre) {
  12282. node.pre = this.pre = void 0;
  12283. for (var i = this.STACK.length; i--;) {
  12284. if (this.STACK[i].pre) this.pre = true;
  12285. }
  12286. }
  12287. var siblings = this.siblings(),
  12288. len = siblings.length,
  12289. childs = node.children;
  12290. if (node.name == 'head' || _config.default.filter && _config.default.filter(node, this) == false) return siblings.pop();
  12291. var attrs = node.attrs;
  12292. // 替换一些标签名
  12293. if (_config.default.blockTags[node.name]) node.name = 'div';else if (!_config.default.trustTags[node.name]) node.name = 'span';
  12294. // 处理列表
  12295. if (node.c && (node.name == 'ul' || node.name == 'ol')) {
  12296. if ((node.attrs.style || '').includes('list-style:none')) {
  12297. for (var _i = 0, child; child = childs[_i++];) {
  12298. if (child.name == 'li') child.name = 'div';
  12299. }
  12300. } else if (node.name == 'ul') {
  12301. var floor = 1;
  12302. for (var _i2 = this.STACK.length; _i2--;) {
  12303. if (this.STACK[_i2].name == 'ul') floor++;
  12304. }
  12305. if (floor != 1) for (var _i3 = childs.length; _i3--;) {
  12306. childs[_i3].floor = floor;
  12307. }
  12308. } else {
  12309. for (var _i4 = 0, num = 1, _child; _child = childs[_i4++];) {
  12310. if (_child.name == 'li') {
  12311. _child.type = 'ol';
  12312. _child.num = function (num, type) {
  12313. if (type == 'a') return String.fromCharCode(97 + (num - 1) % 26);
  12314. if (type == 'A') return String.fromCharCode(65 + (num - 1) % 26);
  12315. if (type == 'i' || type == 'I') {
  12316. num = (num - 1) % 99 + 1;
  12317. var one = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'],
  12318. ten = ['X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'],
  12319. res = (ten[Math.floor(num / 10) - 1] || '') + (one[num % 10 - 1] || '');
  12320. if (type == 'i') return res.toLowerCase();
  12321. return res;
  12322. }
  12323. return num;
  12324. }(num++, attrs.type) + '.';
  12325. }
  12326. }
  12327. }
  12328. }
  12329. // 处理表格
  12330. if (node.name == 'table') {
  12331. var padding = parseFloat(attrs.cellpadding),
  12332. spacing = parseFloat(attrs.cellspacing),
  12333. border = parseFloat(attrs.border);
  12334. if (node.c) {
  12335. if (isNaN(padding)) padding = 2;
  12336. if (isNaN(spacing)) spacing = 2;
  12337. }
  12338. if (border) attrs.style = "border:".concat(border, "px solid gray;").concat(attrs.style || '');
  12339. if (node.flag && node.c) {
  12340. // 有 colspan 或 rowspan 且含有链接的表格转为 grid 布局实现
  12341. attrs.style = "".concat(attrs.style || '', ";").concat(spacing ? ";grid-gap:".concat(spacing, "px") : ';border-left:0;border-top:0');
  12342. var row = 1,
  12343. col = 1,
  12344. colNum,
  12345. trs = [],
  12346. children = [],
  12347. map = {};
  12348. (function f(ns) {
  12349. for (var i = 0; i < ns.length; i++) {
  12350. if (ns[i].name == 'tr') trs.push(ns[i]);else f(ns[i].children || []);
  12351. }
  12352. })(node.children);
  12353. for (var _i5 = 0; _i5 < trs.length; _i5++) {
  12354. for (var j = 0, td; td = trs[_i5].children[j]; j++) {
  12355. if (td.name == 'td' || td.name == 'th') {
  12356. while (map[row + '.' + col]) {
  12357. col++;
  12358. }
  12359. var cell = {
  12360. name: 'div',
  12361. c: 1,
  12362. attrs: {
  12363. style: (td.attrs.style || '') + (border ? ";border:".concat(border, "px solid gray") + (spacing ? '' : ';border-right:0;border-bottom:0') : '') + (padding ? ";padding:".concat(padding, "px") : '')
  12364. },
  12365. children: td.children
  12366. };
  12367. if (td.attrs.colspan) {
  12368. cell.attrs.style += ';grid-column-start:' + col + ';grid-column-end:' + (col + parseInt(td.attrs.colspan));
  12369. if (!td.attrs.rowspan) cell.attrs.style += ';grid-row-start:' + row + ';grid-row-end:' + (row + 1);
  12370. col += parseInt(td.attrs.colspan) - 1;
  12371. }
  12372. if (td.attrs.rowspan) {
  12373. cell.attrs.style += ';grid-row-start:' + row + ';grid-row-end:' + (row + parseInt(td.attrs.rowspan));
  12374. if (!td.attrs.colspan) cell.attrs.style += ';grid-column-start:' + col + ';grid-column-end:' + (col + 1);
  12375. for (var k = 1; k < td.attrs.rowspan; k++) {
  12376. map[row + k + '.' + col] = 1;
  12377. }
  12378. }
  12379. children.push(cell);
  12380. col++;
  12381. }
  12382. }
  12383. if (!colNum) {
  12384. colNum = col - 1;
  12385. attrs.style += ";grid-template-columns:repeat(".concat(colNum, ",auto)");
  12386. }
  12387. col = 1;
  12388. row++;
  12389. }
  12390. node.children = children;
  12391. } else {
  12392. attrs.style = "border-spacing:".concat(spacing, "px;").concat(attrs.style || '');
  12393. if (border || padding) (function f(ns) {
  12394. for (var i = 0, n; n = ns[i]; i++) {
  12395. if (n.name == 'th' || n.name == 'td') {
  12396. if (border) n.attrs.style = "border:".concat(border, "px solid gray;").concat(n.attrs.style || '');
  12397. if (padding) n.attrs.style = "padding:".concat(padding, "px;").concat(n.attrs.style || '');
  12398. } else f(n.children || []);
  12399. }
  12400. })(childs);
  12401. }
  12402. if (this.options.autoscroll) {
  12403. var table = Object.assign({}, node);
  12404. node.name = 'div';
  12405. node.attrs = {
  12406. style: 'overflow:scroll'
  12407. };
  12408. node.children = [table];
  12409. }
  12410. }
  12411. this.CssHandler.pop && this.CssHandler.pop(node);
  12412. // 自动压缩
  12413. if (node.name == 'div' && !Object.keys(attrs).length && childs.length == 1 && childs[0].name == 'div') siblings[len - 1] = childs[0];
  12414. };
  12415. // 状态机
  12416. MpHtmlParser.prototype.Text = function (c) {
  12417. if (c == '<') {
  12418. var next = this.data[this.i + 1],
  12419. isLetter = function isLetter(c) {
  12420. return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
  12421. };
  12422. if (isLetter(next)) {
  12423. this.setText();
  12424. this.start = this.i + 1;
  12425. this.state = this.TagName;
  12426. } else if (next == '/') {
  12427. this.setText();
  12428. if (isLetter(this.data[++this.i + 1])) {
  12429. this.start = this.i + 1;
  12430. this.state = this.EndTag;
  12431. } else this.Comment();
  12432. } else if (next == '!' || next == '?') {
  12433. this.setText();
  12434. this.Comment();
  12435. }
  12436. }
  12437. };
  12438. MpHtmlParser.prototype.Comment = function () {
  12439. var key;
  12440. if (this.data.substring(this.i + 2, this.i + 4) == '--') key = '-->';else if (this.data.substring(this.i + 2, this.i + 9) == '[CDATA[') key = ']]>';else key = '>';
  12441. if ((this.i = this.data.indexOf(key, this.i + 2)) == -1) this.i = this.data.length;else this.i += key.length - 1;
  12442. this.start = this.i + 1;
  12443. this.state = this.Text;
  12444. };
  12445. MpHtmlParser.prototype.TagName = function (c) {
  12446. if (blankChar[c]) {
  12447. this.tagName = this.section();
  12448. while (blankChar[this.data[this.i]]) {
  12449. this.i++;
  12450. }
  12451. if (this.isClose()) this.setNode();else {
  12452. this.start = this.i;
  12453. this.state = this.AttrName;
  12454. }
  12455. } else if (this.isClose()) {
  12456. this.tagName = this.section();
  12457. this.setNode();
  12458. }
  12459. };
  12460. MpHtmlParser.prototype.AttrName = function (c) {
  12461. if (c == '=' || blankChar[c] || this.isClose()) {
  12462. this.attrName = this.section();
  12463. if (blankChar[c]) while (blankChar[this.data[++this.i]]) {
  12464. ;
  12465. }
  12466. if (this.data[this.i] == '=') {
  12467. while (blankChar[this.data[++this.i]]) {
  12468. ;
  12469. }
  12470. this.start = this.i--;
  12471. this.state = this.AttrValue;
  12472. } else this.setAttr();
  12473. }
  12474. };
  12475. MpHtmlParser.prototype.AttrValue = function (c) {
  12476. if (c == '"' || c == "'") {
  12477. this.start++;
  12478. if ((this.i = this.data.indexOf(c, this.i + 1)) == -1) return this.i = this.data.length;
  12479. this.attrVal = this.section();
  12480. this.i++;
  12481. } else {
  12482. for (; !blankChar[this.data[this.i]] && !this.isClose(); this.i++) {
  12483. ;
  12484. }
  12485. this.attrVal = this.section();
  12486. }
  12487. this.setAttr();
  12488. };
  12489. MpHtmlParser.prototype.EndTag = function (c) {
  12490. if (blankChar[c] || c == '>' || c == '/') {
  12491. var name = this.section().toLowerCase();
  12492. for (var i = this.STACK.length; i--;) {
  12493. if (this.STACK[i].name == name) break;
  12494. }
  12495. if (i != -1) {
  12496. var node;
  12497. while ((node = this.STACK.pop()).name != name) {
  12498. this.popNode(node);
  12499. }
  12500. this.popNode(node);
  12501. } else if (name == 'p' || name == 'br') this.siblings().push({
  12502. name: name,
  12503. attrs: {}
  12504. });
  12505. this.i = this.data.indexOf('>', this.i);
  12506. this.start = this.i + 1;
  12507. if (this.i == -1) this.i = this.data.length;else this.state = this.Text;
  12508. }
  12509. };
  12510. var _default = MpHtmlParser;
  12511. exports.default = _default;
  12512. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  12513. /***/ }),
  12514. /***/ 523:
  12515. /*!*******************************************************************************!*\
  12516. !*** E:/work/mdapp/uni_modules/vk-uview-ui/components/u-parse/libs/config.js ***!
  12517. \*******************************************************************************/
  12518. /*! no static exports found */
  12519. /***/ (function(module, exports, __webpack_require__) {
  12520. "use strict";
  12521. /* WEBPACK VAR INJECTION */(function(wx) {
  12522. Object.defineProperty(exports, "__esModule", {
  12523. value: true
  12524. });
  12525. exports.default = void 0;
  12526. /* 配置文件 */
  12527. var cfg = {
  12528. // 出错占位图
  12529. errorImg: null,
  12530. // 过滤器函数
  12531. filter: null,
  12532. // 代码高亮函数
  12533. highlight: null,
  12534. // 文本处理函数
  12535. onText: null,
  12536. // 实体编码列表
  12537. entities: {
  12538. quot: '"',
  12539. apos: "'",
  12540. semi: ';',
  12541. nbsp: '\xA0',
  12542. ensp: "\u2002",
  12543. emsp: "\u2003",
  12544. ndash: '–',
  12545. mdash: '—',
  12546. middot: '·',
  12547. lsquo: '‘',
  12548. rsquo: '’',
  12549. ldquo: '“',
  12550. rdquo: '”',
  12551. bull: '•',
  12552. hellip: '…'
  12553. },
  12554. blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'),
  12555. boolAttrs: makeMap('allowfullscreen,autoplay,autostart,controls,ignore,loop,muted'),
  12556. // 块级标签,将被转为 div
  12557. blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
  12558. // 将被移除的标签
  12559. ignoreTags: makeMap('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'),
  12560. // 只能被 rich-text 显示的标签
  12561. richOnlyTags: makeMap('a,colgroup,fieldset,legend'),
  12562. // 自闭合的标签
  12563. selfClosingTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
  12564. // 信任的标签
  12565. trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'),
  12566. // 默认的标签样式
  12567. userAgentStyles: {
  12568. address: 'font-style:italic',
  12569. big: 'display:inline;font-size:1.2em',
  12570. blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px',
  12571. caption: 'display:table-caption;text-align:center',
  12572. center: 'text-align:center',
  12573. cite: 'font-style:italic',
  12574. dd: 'margin-left:40px',
  12575. mark: 'background-color:yellow',
  12576. pre: 'font-family:monospace;white-space:pre;overflow:scroll',
  12577. s: 'text-decoration:line-through',
  12578. small: 'display:inline;font-size:0.8em',
  12579. u: 'text-decoration:underline'
  12580. }
  12581. };
  12582. function makeMap(str) {
  12583. var map = Object.create(null),
  12584. list = str.split(',');
  12585. for (var i = list.length; i--;) {
  12586. map[list[i]] = true;
  12587. }
  12588. return map;
  12589. }
  12590. if (wx.canIUse('editor')) {
  12591. cfg.blockTags.pre = void 0;
  12592. cfg.ignoreTags.rp = true;
  12593. Object.assign(cfg.richOnlyTags, makeMap('bdi,bdo,caption,rt,ruby'));
  12594. Object.assign(cfg.trustTags, makeMap('bdi,bdo,caption,pre,rt,ruby'));
  12595. }
  12596. var _default = cfg;
  12597. exports.default = _default;
  12598. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  12599. /***/ }),
  12600. /***/ 524:
  12601. /*!***********************************************************************************!*\
  12602. !*** E:/work/mdapp/uni_modules/vk-uview-ui/components/u-parse/libs/CssHandler.js ***!
  12603. \***********************************************************************************/
  12604. /*! no static exports found */
  12605. /***/ (function(module, exports, __webpack_require__) {
  12606. "use strict";
  12607. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  12608. Object.defineProperty(exports, "__esModule", {
  12609. value: true
  12610. });
  12611. exports.default = void 0;
  12612. var _config = _interopRequireDefault(__webpack_require__(/*! ./config.js */ 523));
  12613. var isLetter = function isLetter(c) {
  12614. return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
  12615. };
  12616. function CssHandler(tagStyle) {
  12617. var styles = Object.assign(Object.create(null), _config.default.userAgentStyles);
  12618. for (var item in tagStyle) {
  12619. styles[item] = (styles[item] ? styles[item] + ';' : '') + tagStyle[item];
  12620. }
  12621. this.styles = styles;
  12622. }
  12623. CssHandler.prototype.getStyle = function (data) {
  12624. this.styles = new parser(data, this.styles).parse();
  12625. };
  12626. CssHandler.prototype.match = function (name, attrs) {
  12627. var tmp,
  12628. matched = (tmp = this.styles[name]) ? tmp + ';' : '';
  12629. if (attrs.class) {
  12630. var items = attrs.class.split(' ');
  12631. for (var i = 0, item; item = items[i]; i++) {
  12632. if (tmp = this.styles['.' + item]) matched += tmp + ';';
  12633. }
  12634. }
  12635. if (tmp = this.styles['#' + attrs.id]) matched += tmp + ';';
  12636. return matched;
  12637. };
  12638. var _default = CssHandler;
  12639. exports.default = _default;
  12640. function parser(data, init) {
  12641. this.data = data;
  12642. this.floor = 0;
  12643. this.i = 0;
  12644. this.list = [];
  12645. this.res = init;
  12646. this.state = this.Space;
  12647. }
  12648. parser.prototype.parse = function () {
  12649. for (var c; c = this.data[this.i]; this.i++) {
  12650. this.state(c);
  12651. }
  12652. return this.res;
  12653. };
  12654. parser.prototype.section = function () {
  12655. return this.data.substring(this.start, this.i);
  12656. };
  12657. // 状态机
  12658. parser.prototype.Space = function (c) {
  12659. if (c == '.' || c == '#' || isLetter(c)) {
  12660. this.start = this.i;
  12661. this.state = this.Name;
  12662. } else if (c == '/' && this.data[this.i + 1] == '*') this.Comment();else if (!_config.default.blankChar[c] && c != ';') this.state = this.Ignore;
  12663. };
  12664. parser.prototype.Comment = function () {
  12665. this.i = this.data.indexOf('*/', this.i) + 1;
  12666. if (!this.i) this.i = this.data.length;
  12667. this.state = this.Space;
  12668. };
  12669. parser.prototype.Ignore = function (c) {
  12670. if (c == '{') this.floor++;else if (c == '}' && ! --this.floor) {
  12671. this.list = [];
  12672. this.state = this.Space;
  12673. }
  12674. };
  12675. parser.prototype.Name = function (c) {
  12676. if (_config.default.blankChar[c]) {
  12677. this.list.push(this.section());
  12678. this.state = this.NameSpace;
  12679. } else if (c == '{') {
  12680. this.list.push(this.section());
  12681. this.Content();
  12682. } else if (c == ',') {
  12683. this.list.push(this.section());
  12684. this.Comma();
  12685. } else if (!isLetter(c) && (c < '0' || c > '9') && c != '-' && c != '_') this.state = this.Ignore;
  12686. };
  12687. parser.prototype.NameSpace = function (c) {
  12688. if (c == '{') this.Content();else if (c == ',') this.Comma();else if (!_config.default.blankChar[c]) this.state = this.Ignore;
  12689. };
  12690. parser.prototype.Comma = function () {
  12691. while (_config.default.blankChar[this.data[++this.i]]) {
  12692. ;
  12693. }
  12694. if (this.data[this.i] == '{') this.Content();else {
  12695. this.start = this.i--;
  12696. this.state = this.Name;
  12697. }
  12698. };
  12699. parser.prototype.Content = function () {
  12700. this.start = ++this.i;
  12701. if ((this.i = this.data.indexOf('}', this.i)) == -1) this.i = this.data.length;
  12702. var content = this.section();
  12703. for (var i = 0, item; item = this.list[i++];) {
  12704. if (this.res[item]) this.res[item] += ';' + content;else this.res[item] = content;
  12705. }
  12706. this.list = [];
  12707. this.state = this.Space;
  12708. };
  12709. /***/ }),
  12710. /***/ 53:
  12711. /*!*******************************************************************!*\
  12712. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/trim.js ***!
  12713. \*******************************************************************/
  12714. /*! no static exports found */
  12715. /***/ (function(module, exports, __webpack_require__) {
  12716. "use strict";
  12717. Object.defineProperty(exports, "__esModule", {
  12718. value: true
  12719. });
  12720. exports.default = void 0;
  12721. function trim(str) {
  12722. var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'both';
  12723. if (pos == 'both') {
  12724. return str.replace(/^\s+|\s+$/g, "");
  12725. } else if (pos == "left") {
  12726. return str.replace(/^\s*/, '');
  12727. } else if (pos == 'right') {
  12728. return str.replace(/(\s*$)/g, "");
  12729. } else if (pos == 'all') {
  12730. return str.replace(/\s+/g, "");
  12731. } else {
  12732. return str;
  12733. }
  12734. }
  12735. var _default = trim;
  12736. exports.default = _default;
  12737. /***/ }),
  12738. /***/ 54:
  12739. /*!********************************************************************!*\
  12740. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/toast.js ***!
  12741. \********************************************************************/
  12742. /*! no static exports found */
  12743. /***/ (function(module, exports, __webpack_require__) {
  12744. "use strict";
  12745. /* WEBPACK VAR INJECTION */(function(uni) {
  12746. Object.defineProperty(exports, "__esModule", {
  12747. value: true
  12748. });
  12749. exports.default = void 0;
  12750. function toast(title) {
  12751. var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1500;
  12752. uni.showToast({
  12753. title: title,
  12754. icon: 'none',
  12755. duration: duration
  12756. });
  12757. }
  12758. var _default = toast;
  12759. exports.default = _default;
  12760. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  12761. /***/ }),
  12762. /***/ 55:
  12763. /*!************************************************************************!*\
  12764. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/getParent.js ***!
  12765. \************************************************************************/
  12766. /*! no static exports found */
  12767. /***/ (function(module, exports, __webpack_require__) {
  12768. "use strict";
  12769. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  12770. Object.defineProperty(exports, "__esModule", {
  12771. value: true
  12772. });
  12773. exports.default = getParent;
  12774. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  12775. // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  12776. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  12777. function getParent(name, keys) {
  12778. var parent = this.$parent;
  12779. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  12780. while (parent) {
  12781. // 父组件
  12782. if (parent.$options.name !== name) {
  12783. // 如果组件的name不相等,继续上一级寻找
  12784. parent = parent.$parent;
  12785. } else {
  12786. var _ret = function () {
  12787. var data = {};
  12788. // 判断keys是否数组,如果传过来的是一个数组,那么直接使用数组元素值当做键值去父组件寻找
  12789. if (Array.isArray(keys)) {
  12790. keys.map(function (val) {
  12791. data[val] = parent[val] ? parent[val] : '';
  12792. });
  12793. } else {
  12794. // 历遍传过来的对象参数
  12795. for (var i in keys) {
  12796. // 如果子组件有此值则用,无此值则用父组件的值
  12797. // 判断是否空数组,如果是,则用父组件的值,否则用子组件的值
  12798. if (Array.isArray(keys[i])) {
  12799. if (keys[i].length) {
  12800. data[i] = keys[i];
  12801. } else {
  12802. data[i] = parent[i];
  12803. }
  12804. } else if (keys[i].constructor === Object) {
  12805. // 判断是否对象,如果是对象,且有属性,那么使用子组件的值,否则使用父组件的值
  12806. if (Object.keys(keys[i]).length) {
  12807. data[i] = keys[i];
  12808. } else {
  12809. data[i] = parent[i];
  12810. }
  12811. } else {
  12812. // 只要子组件有传值,即使是false值,也是“传值”了,也需要覆盖父组件的同名参数
  12813. data[i] = keys[i] || keys[i] === false ? keys[i] : parent[i];
  12814. }
  12815. }
  12816. }
  12817. return {
  12818. v: data
  12819. };
  12820. }();
  12821. if ((0, _typeof2.default)(_ret) === "object") return _ret.v;
  12822. }
  12823. }
  12824. return {};
  12825. }
  12826. /***/ }),
  12827. /***/ 56:
  12828. /*!**********************************************************************!*\
  12829. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/$parent.js ***!
  12830. \**********************************************************************/
  12831. /*! no static exports found */
  12832. /***/ (function(module, exports, __webpack_require__) {
  12833. "use strict";
  12834. Object.defineProperty(exports, "__esModule", {
  12835. value: true
  12836. });
  12837. exports.default = $parent;
  12838. // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  12839. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  12840. // 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
  12841. // 值(默认为undefined),就是查找最顶层的$parent
  12842. function $parent() {
  12843. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
  12844. var parent = this.$parent;
  12845. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  12846. while (parent) {
  12847. // 父组件
  12848. if (parent.$options && parent.$options.name !== name) {
  12849. // 如果组件的name不相等,继续上一级寻找
  12850. parent = parent.$parent;
  12851. } else {
  12852. return parent;
  12853. }
  12854. }
  12855. return false;
  12856. }
  12857. /***/ }),
  12858. /***/ 560:
  12859. /*!******************************************************************!*\
  12860. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/util/emitter.js ***!
  12861. \******************************************************************/
  12862. /*! no static exports found */
  12863. /***/ (function(module, exports, __webpack_require__) {
  12864. "use strict";
  12865. Object.defineProperty(exports, "__esModule", {
  12866. value: true
  12867. });
  12868. exports.default = void 0;
  12869. /**
  12870. * 递归使用 call 方式this指向
  12871. * @param componentName // 需要找的组件的名称
  12872. * @param eventName // 事件名称
  12873. * @param params // 需要传递的参数
  12874. */
  12875. function _broadcast(componentName, eventName, params) {
  12876. // 循环子节点找到名称一样的子节点 否则 递归 当前子节点
  12877. var $children;
  12878. $children = this.$children;
  12879. $children.map(function (child) {
  12880. if (componentName === child.$options.name) {
  12881. child.$emit.apply(child, [eventName].concat(params));
  12882. } else {
  12883. _broadcast.apply(child, [componentName, eventName].concat(params));
  12884. }
  12885. });
  12886. }
  12887. var _default = {
  12888. methods: {
  12889. /**
  12890. * 派发 (向上查找) (一个)
  12891. * @param componentName // 需要找的组件的名称
  12892. * @param eventName // 事件名称
  12893. * @param params // 需要传递的参数
  12894. */
  12895. dispatch: function dispatch(componentName, eventName, params) {
  12896. var parent = this.$parent || this.$root; //$parent 找到最近的父节点 $root 根节点
  12897. var name = parent.$options.name; // 获取当前组件实例的name
  12898. // 如果当前有节点 && 当前没名称 且 当前名称等于需要传进来的名称的时候就去查找当前的节点
  12899. // 循环出当前名称的一样的组件实例
  12900. while (parent && (!name || name !== componentName)) {
  12901. parent = parent.$parent;
  12902. if (parent) {
  12903. name = parent.$options.name;
  12904. }
  12905. }
  12906. // 有节点表示当前找到了name一样的实例
  12907. if (parent) {
  12908. parent.$emit.apply(parent, [eventName].concat(params));
  12909. }
  12910. },
  12911. /**
  12912. * 广播 (向下查找) (广播多个)
  12913. * @param componentName // 需要找的组件的名称
  12914. * @param eventName // 事件名称
  12915. * @param params // 需要传递的参数
  12916. */
  12917. broadcast: function broadcast(componentName, eventName, params) {
  12918. _broadcast.call(this, componentName, eventName, params);
  12919. }
  12920. }
  12921. };
  12922. exports.default = _default;
  12923. /***/ }),
  12924. /***/ 561:
  12925. /*!**************************************************************************!*\
  12926. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/util/async-validator.js ***!
  12927. \**************************************************************************/
  12928. /*! no static exports found */
  12929. /***/ (function(module, exports, __webpack_require__) {
  12930. "use strict";
  12931. /* WEBPACK VAR INJECTION */(function(process) {
  12932. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  12933. Object.defineProperty(exports, "__esModule", {
  12934. value: true
  12935. });
  12936. exports.default = void 0;
  12937. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  12938. function _extends() {
  12939. _extends = Object.assign || function (target) {
  12940. for (var i = 1; i < arguments.length; i++) {
  12941. var source = arguments[i];
  12942. for (var key in source) {
  12943. if (Object.prototype.hasOwnProperty.call(source, key)) {
  12944. target[key] = source[key];
  12945. }
  12946. }
  12947. }
  12948. return target;
  12949. };
  12950. return _extends.apply(this, arguments);
  12951. }
  12952. /* eslint no-console:0 */
  12953. var formatRegExp = /%[sdj%]/g;
  12954. var warning = function warning() {}; // don't print warning message when in production env or node runtime
  12955. if (typeof process !== 'undefined' && Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}) && "development" !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
  12956. warning = function warning(type, errors) {
  12957. if (typeof console !== 'undefined' && console.warn) {
  12958. if (errors.every(function (e) {
  12959. return typeof e === 'string';
  12960. })) {
  12961. console.warn(type, errors);
  12962. }
  12963. }
  12964. };
  12965. }
  12966. function convertFieldsError(errors) {
  12967. if (!errors || !errors.length) return null;
  12968. var fields = {};
  12969. errors.forEach(function (error) {
  12970. var field = error.field;
  12971. fields[field] = fields[field] || [];
  12972. fields[field].push(error);
  12973. });
  12974. return fields;
  12975. }
  12976. function format() {
  12977. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  12978. args[_key] = arguments[_key];
  12979. }
  12980. var i = 1;
  12981. var f = args[0];
  12982. var len = args.length;
  12983. if (typeof f === 'function') {
  12984. return f.apply(null, args.slice(1));
  12985. }
  12986. if (typeof f === 'string') {
  12987. var str = String(f).replace(formatRegExp, function (x) {
  12988. if (x === '%%') {
  12989. return '%';
  12990. }
  12991. if (i >= len) {
  12992. return x;
  12993. }
  12994. switch (x) {
  12995. case '%s':
  12996. return String(args[i++]);
  12997. case '%d':
  12998. return Number(args[i++]);
  12999. case '%j':
  13000. try {
  13001. return JSON.stringify(args[i++]);
  13002. } catch (_) {
  13003. return '[Circular]';
  13004. }
  13005. break;
  13006. default:
  13007. return x;
  13008. }
  13009. });
  13010. for (var arg = args[i]; i < len; arg = args[++i]) {
  13011. str += " " + arg;
  13012. }
  13013. return str;
  13014. }
  13015. return f;
  13016. }
  13017. function isNativeStringType(type) {
  13018. return type === 'string' || type === 'url' || type === 'hex' || type === 'email' || type === 'pattern';
  13019. }
  13020. function isEmptyValue(value, type) {
  13021. if (value === undefined || value === null) {
  13022. return true;
  13023. }
  13024. if (type === 'array' && Array.isArray(value) && !value.length) {
  13025. return true;
  13026. }
  13027. if (isNativeStringType(type) && typeof value === 'string' && !value) {
  13028. return true;
  13029. }
  13030. return false;
  13031. }
  13032. function asyncParallelArray(arr, func, callback) {
  13033. var results = [];
  13034. var total = 0;
  13035. var arrLength = arr.length;
  13036. function count(errors) {
  13037. results.push.apply(results, errors);
  13038. total++;
  13039. if (total === arrLength) {
  13040. callback(results);
  13041. }
  13042. }
  13043. arr.forEach(function (a) {
  13044. func(a, count);
  13045. });
  13046. }
  13047. function asyncSerialArray(arr, func, callback) {
  13048. var index = 0;
  13049. var arrLength = arr.length;
  13050. function next(errors) {
  13051. if (errors && errors.length) {
  13052. callback(errors);
  13053. return;
  13054. }
  13055. var original = index;
  13056. index = index + 1;
  13057. if (original < arrLength) {
  13058. func(arr[original], next);
  13059. } else {
  13060. callback([]);
  13061. }
  13062. }
  13063. next([]);
  13064. }
  13065. function flattenObjArr(objArr) {
  13066. var ret = [];
  13067. Object.keys(objArr).forEach(function (k) {
  13068. ret.push.apply(ret, objArr[k]);
  13069. });
  13070. return ret;
  13071. }
  13072. function asyncMap(objArr, option, func, callback) {
  13073. if (option.first) {
  13074. var _pending = new Promise(function (resolve, reject) {
  13075. var next = function next(errors) {
  13076. callback(errors);
  13077. return errors.length ? reject({
  13078. errors: errors,
  13079. fields: convertFieldsError(errors)
  13080. }) : resolve();
  13081. };
  13082. var flattenArr = flattenObjArr(objArr);
  13083. asyncSerialArray(flattenArr, func, next);
  13084. });
  13085. _pending["catch"](function (e) {
  13086. return e;
  13087. });
  13088. return _pending;
  13089. }
  13090. var firstFields = option.firstFields || [];
  13091. if (firstFields === true) {
  13092. firstFields = Object.keys(objArr);
  13093. }
  13094. var objArrKeys = Object.keys(objArr);
  13095. var objArrLength = objArrKeys.length;
  13096. var total = 0;
  13097. var results = [];
  13098. var pending = new Promise(function (resolve, reject) {
  13099. var next = function next(errors) {
  13100. results.push.apply(results, errors);
  13101. total++;
  13102. if (total === objArrLength) {
  13103. callback(results);
  13104. return results.length ? reject({
  13105. errors: results,
  13106. fields: convertFieldsError(results)
  13107. }) : resolve();
  13108. }
  13109. };
  13110. if (!objArrKeys.length) {
  13111. callback(results);
  13112. resolve();
  13113. }
  13114. objArrKeys.forEach(function (key) {
  13115. var arr = objArr[key];
  13116. if (firstFields.indexOf(key) !== -1) {
  13117. asyncSerialArray(arr, func, next);
  13118. } else {
  13119. asyncParallelArray(arr, func, next);
  13120. }
  13121. });
  13122. });
  13123. pending["catch"](function (e) {
  13124. return e;
  13125. });
  13126. return pending;
  13127. }
  13128. function complementError(rule) {
  13129. return function (oe) {
  13130. if (oe && oe.message) {
  13131. oe.field = oe.field || rule.fullField;
  13132. return oe;
  13133. }
  13134. return {
  13135. message: typeof oe === 'function' ? oe() : oe,
  13136. field: oe.field || rule.fullField
  13137. };
  13138. };
  13139. }
  13140. function deepMerge(target, source) {
  13141. if (source) {
  13142. for (var s in source) {
  13143. if (source.hasOwnProperty(s)) {
  13144. var value = source[s];
  13145. if ((0, _typeof2.default)(value) === 'object' && (0, _typeof2.default)(target[s]) === 'object') {
  13146. target[s] = _extends({}, target[s], {}, value);
  13147. } else {
  13148. target[s] = value;
  13149. }
  13150. }
  13151. }
  13152. }
  13153. return target;
  13154. }
  13155. /**
  13156. * Rule for validating required fields.
  13157. *
  13158. * @param rule The validation rule.
  13159. * @param value The value of the field on the source object.
  13160. * @param source The source object being validated.
  13161. * @param errors An array of errors that this rule may add
  13162. * validation errors to.
  13163. * @param options The validation options.
  13164. * @param options.messages The validation messages.
  13165. */
  13166. function required(rule, value, source, errors, options, type) {
  13167. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type || rule.type))) {
  13168. errors.push(format(options.messages.required, rule.fullField));
  13169. }
  13170. }
  13171. /**
  13172. * Rule for validating whitespace.
  13173. *
  13174. * @param rule The validation rule.
  13175. * @param value The value of the field on the source object.
  13176. * @param source The source object being validated.
  13177. * @param errors An array of errors that this rule may add
  13178. * validation errors to.
  13179. * @param options The validation options.
  13180. * @param options.messages The validation messages.
  13181. */
  13182. function whitespace(rule, value, source, errors, options) {
  13183. if (/^\s+$/.test(value) || value === '') {
  13184. errors.push(format(options.messages.whitespace, rule.fullField));
  13185. }
  13186. }
  13187. /* eslint max-len:0 */
  13188. var pattern = {
  13189. // http://emailregex.com/
  13190. email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
  13191. url: new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", 'i'),
  13192. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  13193. };
  13194. var types = {
  13195. integer: function integer(value) {
  13196. return types.number(value) && parseInt(value, 10) === value;
  13197. },
  13198. "float": function float(value) {
  13199. return types.number(value) && !types.integer(value);
  13200. },
  13201. array: function array(value) {
  13202. return Array.isArray(value);
  13203. },
  13204. regexp: function regexp(value) {
  13205. if (value instanceof RegExp) {
  13206. return true;
  13207. }
  13208. try {
  13209. return !!new RegExp(value);
  13210. } catch (e) {
  13211. return false;
  13212. }
  13213. },
  13214. date: function date(value) {
  13215. return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear === 'function';
  13216. },
  13217. number: function number(value) {
  13218. if (isNaN(value)) {
  13219. return false;
  13220. }
  13221. // 修改源码,将字符串数值先转为数值
  13222. return typeof +value === 'number';
  13223. },
  13224. object: function object(value) {
  13225. return (0, _typeof2.default)(value) === 'object' && !types.array(value);
  13226. },
  13227. method: function method(value) {
  13228. return typeof value === 'function';
  13229. },
  13230. email: function email(value) {
  13231. return typeof value === 'string' && !!value.match(pattern.email) && value.length < 255;
  13232. },
  13233. url: function url(value) {
  13234. return typeof value === 'string' && !!value.match(pattern.url);
  13235. },
  13236. hex: function hex(value) {
  13237. return typeof value === 'string' && !!value.match(pattern.hex);
  13238. }
  13239. };
  13240. /**
  13241. * Rule for validating the type of a value.
  13242. *
  13243. * @param rule The validation rule.
  13244. * @param value The value of the field on the source object.
  13245. * @param source The source object being validated.
  13246. * @param errors An array of errors that this rule may add
  13247. * validation errors to.
  13248. * @param options The validation options.
  13249. * @param options.messages The validation messages.
  13250. */
  13251. function type(rule, value, source, errors, options) {
  13252. if (rule.required && value === undefined) {
  13253. required(rule, value, source, errors, options);
  13254. return;
  13255. }
  13256. var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'number', 'date', 'url', 'hex'];
  13257. var ruleType = rule.type;
  13258. if (custom.indexOf(ruleType) > -1) {
  13259. if (!types[ruleType](value)) {
  13260. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  13261. } // straight typeof check
  13262. } else if (ruleType && (0, _typeof2.default)(value) !== rule.type) {
  13263. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  13264. }
  13265. }
  13266. /**
  13267. * Rule for validating minimum and maximum allowed values.
  13268. *
  13269. * @param rule The validation rule.
  13270. * @param value The value of the field on the source object.
  13271. * @param source The source object being validated.
  13272. * @param errors An array of errors that this rule may add
  13273. * validation errors to.
  13274. * @param options The validation options.
  13275. * @param options.messages The validation messages.
  13276. */
  13277. function range(rule, value, source, errors, options) {
  13278. var len = typeof rule.len === 'number';
  13279. var min = typeof rule.min === 'number';
  13280. var max = typeof rule.max === 'number'; // 正则匹配码点范围从U+010000一直到U+10FFFF的文字(补充平面Supplementary Plane)
  13281. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  13282. var val = value;
  13283. var key = null;
  13284. var num = typeof value === 'number';
  13285. var str = typeof value === 'string';
  13286. var arr = Array.isArray(value);
  13287. if (num) {
  13288. key = 'number';
  13289. } else if (str) {
  13290. key = 'string';
  13291. } else if (arr) {
  13292. key = 'array';
  13293. } // if the value is not of a supported type for range validation
  13294. // the validation rule rule should use the
  13295. // type property to also test for a particular type
  13296. if (!key) {
  13297. return false;
  13298. }
  13299. if (arr) {
  13300. val = value.length;
  13301. }
  13302. if (str) {
  13303. // 处理码点大于U+010000的文字length属性不准确的bug,如"𠮷𠮷𠮷".lenght !== 3
  13304. val = value.replace(spRegexp, '_').length;
  13305. }
  13306. if (len) {
  13307. if (val !== rule.len) {
  13308. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  13309. }
  13310. } else if (min && !max && val < rule.min) {
  13311. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  13312. } else if (max && !min && val > rule.max) {
  13313. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  13314. } else if (min && max && (val < rule.min || val > rule.max)) {
  13315. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  13316. }
  13317. }
  13318. var ENUM = 'enum';
  13319. /**
  13320. * Rule for validating a value exists in an enumerable list.
  13321. *
  13322. * @param rule The validation rule.
  13323. * @param value The value of the field on the source object.
  13324. * @param source The source object being validated.
  13325. * @param errors An array of errors that this rule may add
  13326. * validation errors to.
  13327. * @param options The validation options.
  13328. * @param options.messages The validation messages.
  13329. */
  13330. function enumerable(rule, value, source, errors, options) {
  13331. rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];
  13332. if (rule[ENUM].indexOf(value) === -1) {
  13333. errors.push(format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', ')));
  13334. }
  13335. }
  13336. /**
  13337. * Rule for validating a regular expression pattern.
  13338. *
  13339. * @param rule The validation rule.
  13340. * @param value The value of the field on the source object.
  13341. * @param source The source object being validated.
  13342. * @param errors An array of errors that this rule may add
  13343. * validation errors to.
  13344. * @param options The validation options.
  13345. * @param options.messages The validation messages.
  13346. */
  13347. function pattern$1(rule, value, source, errors, options) {
  13348. if (rule.pattern) {
  13349. if (rule.pattern instanceof RegExp) {
  13350. // if a RegExp instance is passed, reset `lastIndex` in case its `global`
  13351. // flag is accidentally set to `true`, which in a validation scenario
  13352. // is not necessary and the result might be misleading
  13353. rule.pattern.lastIndex = 0;
  13354. if (!rule.pattern.test(value)) {
  13355. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  13356. }
  13357. } else if (typeof rule.pattern === 'string') {
  13358. var _pattern = new RegExp(rule.pattern);
  13359. if (!_pattern.test(value)) {
  13360. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  13361. }
  13362. }
  13363. }
  13364. }
  13365. var rules = {
  13366. required: required,
  13367. whitespace: whitespace,
  13368. type: type,
  13369. range: range,
  13370. "enum": enumerable,
  13371. pattern: pattern$1
  13372. };
  13373. /**
  13374. * Performs validation for string types.
  13375. *
  13376. * @param rule The validation rule.
  13377. * @param value The value of the field on the source object.
  13378. * @param callback The callback function.
  13379. * @param source The source object being validated.
  13380. * @param options The validation options.
  13381. * @param options.messages The validation messages.
  13382. */
  13383. function string(rule, value, callback, source, options) {
  13384. var errors = [];
  13385. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13386. if (validate) {
  13387. if (isEmptyValue(value, 'string') && !rule.required) {
  13388. return callback();
  13389. }
  13390. rules.required(rule, value, source, errors, options, 'string');
  13391. if (!isEmptyValue(value, 'string')) {
  13392. rules.type(rule, value, source, errors, options);
  13393. rules.range(rule, value, source, errors, options);
  13394. rules.pattern(rule, value, source, errors, options);
  13395. if (rule.whitespace === true) {
  13396. rules.whitespace(rule, value, source, errors, options);
  13397. }
  13398. }
  13399. }
  13400. callback(errors);
  13401. }
  13402. /**
  13403. * Validates a function.
  13404. *
  13405. * @param rule The validation rule.
  13406. * @param value The value of the field on the source object.
  13407. * @param callback The callback function.
  13408. * @param source The source object being validated.
  13409. * @param options The validation options.
  13410. * @param options.messages The validation messages.
  13411. */
  13412. function method(rule, value, callback, source, options) {
  13413. var errors = [];
  13414. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13415. if (validate) {
  13416. if (isEmptyValue(value) && !rule.required) {
  13417. return callback();
  13418. }
  13419. rules.required(rule, value, source, errors, options);
  13420. if (value !== undefined) {
  13421. rules.type(rule, value, source, errors, options);
  13422. }
  13423. }
  13424. callback(errors);
  13425. }
  13426. /**
  13427. * Validates a number.
  13428. *
  13429. * @param rule The validation rule.
  13430. * @param value The value of the field on the source object.
  13431. * @param callback The callback function.
  13432. * @param source The source object being validated.
  13433. * @param options The validation options.
  13434. * @param options.messages The validation messages.
  13435. */
  13436. function number(rule, value, callback, source, options) {
  13437. var errors = [];
  13438. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13439. if (validate) {
  13440. if (value === '') {
  13441. value = undefined;
  13442. }
  13443. if (isEmptyValue(value) && !rule.required) {
  13444. return callback();
  13445. }
  13446. rules.required(rule, value, source, errors, options);
  13447. if (value !== undefined) {
  13448. rules.type(rule, value, source, errors, options);
  13449. rules.range(rule, value, source, errors, options);
  13450. }
  13451. }
  13452. callback(errors);
  13453. }
  13454. /**
  13455. * Validates a boolean.
  13456. *
  13457. * @param rule The validation rule.
  13458. * @param value The value of the field on the source object.
  13459. * @param callback The callback function.
  13460. * @param source The source object being validated.
  13461. * @param options The validation options.
  13462. * @param options.messages The validation messages.
  13463. */
  13464. function _boolean(rule, value, callback, source, options) {
  13465. var errors = [];
  13466. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13467. if (validate) {
  13468. if (isEmptyValue(value) && !rule.required) {
  13469. return callback();
  13470. }
  13471. rules.required(rule, value, source, errors, options);
  13472. if (value !== undefined) {
  13473. rules.type(rule, value, source, errors, options);
  13474. }
  13475. }
  13476. callback(errors);
  13477. }
  13478. /**
  13479. * Validates the regular expression type.
  13480. *
  13481. * @param rule The validation rule.
  13482. * @param value The value of the field on the source object.
  13483. * @param callback The callback function.
  13484. * @param source The source object being validated.
  13485. * @param options The validation options.
  13486. * @param options.messages The validation messages.
  13487. */
  13488. function regexp(rule, value, callback, source, options) {
  13489. var errors = [];
  13490. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13491. if (validate) {
  13492. if (isEmptyValue(value) && !rule.required) {
  13493. return callback();
  13494. }
  13495. rules.required(rule, value, source, errors, options);
  13496. if (!isEmptyValue(value)) {
  13497. rules.type(rule, value, source, errors, options);
  13498. }
  13499. }
  13500. callback(errors);
  13501. }
  13502. /**
  13503. * Validates a number is an integer.
  13504. *
  13505. * @param rule The validation rule.
  13506. * @param value The value of the field on the source object.
  13507. * @param callback The callback function.
  13508. * @param source The source object being validated.
  13509. * @param options The validation options.
  13510. * @param options.messages The validation messages.
  13511. */
  13512. function integer(rule, value, callback, source, options) {
  13513. var errors = [];
  13514. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13515. if (validate) {
  13516. if (isEmptyValue(value) && !rule.required) {
  13517. return callback();
  13518. }
  13519. rules.required(rule, value, source, errors, options);
  13520. if (value !== undefined) {
  13521. rules.type(rule, value, source, errors, options);
  13522. rules.range(rule, value, source, errors, options);
  13523. }
  13524. }
  13525. callback(errors);
  13526. }
  13527. /**
  13528. * Validates a number is a floating point number.
  13529. *
  13530. * @param rule The validation rule.
  13531. * @param value The value of the field on the source object.
  13532. * @param callback The callback function.
  13533. * @param source The source object being validated.
  13534. * @param options The validation options.
  13535. * @param options.messages The validation messages.
  13536. */
  13537. function floatFn(rule, value, callback, source, options) {
  13538. var errors = [];
  13539. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13540. if (validate) {
  13541. if (isEmptyValue(value) && !rule.required) {
  13542. return callback();
  13543. }
  13544. rules.required(rule, value, source, errors, options);
  13545. if (value !== undefined) {
  13546. rules.type(rule, value, source, errors, options);
  13547. rules.range(rule, value, source, errors, options);
  13548. }
  13549. }
  13550. callback(errors);
  13551. }
  13552. /**
  13553. * Validates an array.
  13554. *
  13555. * @param rule The validation rule.
  13556. * @param value The value of the field on the source object.
  13557. * @param callback The callback function.
  13558. * @param source The source object being validated.
  13559. * @param options The validation options.
  13560. * @param options.messages The validation messages.
  13561. */
  13562. function array(rule, value, callback, source, options) {
  13563. var errors = [];
  13564. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13565. if (validate) {
  13566. if (isEmptyValue(value, 'array') && !rule.required) {
  13567. return callback();
  13568. }
  13569. rules.required(rule, value, source, errors, options, 'array');
  13570. if (!isEmptyValue(value, 'array')) {
  13571. rules.type(rule, value, source, errors, options);
  13572. rules.range(rule, value, source, errors, options);
  13573. }
  13574. }
  13575. callback(errors);
  13576. }
  13577. /**
  13578. * Validates an object.
  13579. *
  13580. * @param rule The validation rule.
  13581. * @param value The value of the field on the source object.
  13582. * @param callback The callback function.
  13583. * @param source The source object being validated.
  13584. * @param options The validation options.
  13585. * @param options.messages The validation messages.
  13586. */
  13587. function object(rule, value, callback, source, options) {
  13588. var errors = [];
  13589. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13590. if (validate) {
  13591. if (isEmptyValue(value) && !rule.required) {
  13592. return callback();
  13593. }
  13594. rules.required(rule, value, source, errors, options);
  13595. if (value !== undefined) {
  13596. rules.type(rule, value, source, errors, options);
  13597. }
  13598. }
  13599. callback(errors);
  13600. }
  13601. var ENUM$1 = 'enum';
  13602. /**
  13603. * Validates an enumerable list.
  13604. *
  13605. * @param rule The validation rule.
  13606. * @param value The value of the field on the source object.
  13607. * @param callback The callback function.
  13608. * @param source The source object being validated.
  13609. * @param options The validation options.
  13610. * @param options.messages The validation messages.
  13611. */
  13612. function enumerable$1(rule, value, callback, source, options) {
  13613. var errors = [];
  13614. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13615. if (validate) {
  13616. if (isEmptyValue(value) && !rule.required) {
  13617. return callback();
  13618. }
  13619. rules.required(rule, value, source, errors, options);
  13620. if (value !== undefined) {
  13621. rules[ENUM$1](rule, value, source, errors, options);
  13622. }
  13623. }
  13624. callback(errors);
  13625. }
  13626. /**
  13627. * Validates a regular expression pattern.
  13628. *
  13629. * Performs validation when a rule only contains
  13630. * a pattern property but is not declared as a string type.
  13631. *
  13632. * @param rule The validation rule.
  13633. * @param value The value of the field on the source object.
  13634. * @param callback The callback function.
  13635. * @param source The source object being validated.
  13636. * @param options The validation options.
  13637. * @param options.messages The validation messages.
  13638. */
  13639. function pattern$2(rule, value, callback, source, options) {
  13640. var errors = [];
  13641. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13642. if (validate) {
  13643. if (isEmptyValue(value, 'string') && !rule.required) {
  13644. return callback();
  13645. }
  13646. rules.required(rule, value, source, errors, options);
  13647. if (!isEmptyValue(value, 'string')) {
  13648. rules.pattern(rule, value, source, errors, options);
  13649. }
  13650. }
  13651. callback(errors);
  13652. }
  13653. function date(rule, value, callback, source, options) {
  13654. var errors = [];
  13655. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13656. if (validate) {
  13657. if (isEmptyValue(value) && !rule.required) {
  13658. return callback();
  13659. }
  13660. rules.required(rule, value, source, errors, options);
  13661. if (!isEmptyValue(value)) {
  13662. var dateObject;
  13663. if (typeof value === 'number') {
  13664. dateObject = new Date(value);
  13665. } else {
  13666. dateObject = value;
  13667. }
  13668. rules.type(rule, dateObject, source, errors, options);
  13669. if (dateObject) {
  13670. rules.range(rule, dateObject.getTime(), source, errors, options);
  13671. }
  13672. }
  13673. }
  13674. callback(errors);
  13675. }
  13676. function required$1(rule, value, callback, source, options) {
  13677. var errors = [];
  13678. var type = Array.isArray(value) ? 'array' : (0, _typeof2.default)(value);
  13679. rules.required(rule, value, source, errors, options, type);
  13680. callback(errors);
  13681. }
  13682. function type$1(rule, value, callback, source, options) {
  13683. var ruleType = rule.type;
  13684. var errors = [];
  13685. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13686. if (validate) {
  13687. if (isEmptyValue(value, ruleType) && !rule.required) {
  13688. return callback();
  13689. }
  13690. rules.required(rule, value, source, errors, options, ruleType);
  13691. if (!isEmptyValue(value, ruleType)) {
  13692. rules.type(rule, value, source, errors, options);
  13693. }
  13694. }
  13695. callback(errors);
  13696. }
  13697. /**
  13698. * Performs validation for any type.
  13699. *
  13700. * @param rule The validation rule.
  13701. * @param value The value of the field on the source object.
  13702. * @param callback The callback function.
  13703. * @param source The source object being validated.
  13704. * @param options The validation options.
  13705. * @param options.messages The validation messages.
  13706. */
  13707. function any(rule, value, callback, source, options) {
  13708. var errors = [];
  13709. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13710. if (validate) {
  13711. if (isEmptyValue(value) && !rule.required) {
  13712. return callback();
  13713. }
  13714. rules.required(rule, value, source, errors, options);
  13715. }
  13716. callback(errors);
  13717. }
  13718. var validators = {
  13719. string: string,
  13720. method: method,
  13721. number: number,
  13722. "boolean": _boolean,
  13723. regexp: regexp,
  13724. integer: integer,
  13725. "float": floatFn,
  13726. array: array,
  13727. object: object,
  13728. "enum": enumerable$1,
  13729. pattern: pattern$2,
  13730. date: date,
  13731. url: type$1,
  13732. hex: type$1,
  13733. email: type$1,
  13734. required: required$1,
  13735. any: any
  13736. };
  13737. function newMessages() {
  13738. return {
  13739. "default": 'Validation error on field %s',
  13740. required: '%s is required',
  13741. "enum": '%s must be one of %s',
  13742. whitespace: '%s cannot be empty',
  13743. date: {
  13744. format: '%s date %s is invalid for format %s',
  13745. parse: '%s date could not be parsed, %s is invalid ',
  13746. invalid: '%s date %s is invalid'
  13747. },
  13748. types: {
  13749. string: '%s is not a %s',
  13750. method: '%s is not a %s (function)',
  13751. array: '%s is not an %s',
  13752. object: '%s is not an %s',
  13753. number: '%s is not a %s',
  13754. date: '%s is not a %s',
  13755. "boolean": '%s is not a %s',
  13756. integer: '%s is not an %s',
  13757. "float": '%s is not a %s',
  13758. regexp: '%s is not a valid %s',
  13759. email: '%s is not a valid %s',
  13760. url: '%s is not a valid %s',
  13761. hex: '%s is not a valid %s'
  13762. },
  13763. string: {
  13764. len: '%s must be exactly %s characters',
  13765. min: '%s must be at least %s characters',
  13766. max: '%s cannot be longer than %s characters',
  13767. range: '%s must be between %s and %s characters'
  13768. },
  13769. number: {
  13770. len: '%s must equal %s',
  13771. min: '%s cannot be less than %s',
  13772. max: '%s cannot be greater than %s',
  13773. range: '%s must be between %s and %s'
  13774. },
  13775. array: {
  13776. len: '%s must be exactly %s in length',
  13777. min: '%s cannot be less than %s in length',
  13778. max: '%s cannot be greater than %s in length',
  13779. range: '%s must be between %s and %s in length'
  13780. },
  13781. pattern: {
  13782. mismatch: '%s value %s does not match pattern %s'
  13783. },
  13784. clone: function clone() {
  13785. var cloned = JSON.parse(JSON.stringify(this));
  13786. cloned.clone = this.clone;
  13787. return cloned;
  13788. }
  13789. };
  13790. }
  13791. var messages = newMessages();
  13792. /**
  13793. * Encapsulates a validation schema.
  13794. *
  13795. * @param descriptor An object declaring validation rules
  13796. * for this schema.
  13797. */
  13798. function Schema(descriptor) {
  13799. this.rules = null;
  13800. this._messages = messages;
  13801. this.define(descriptor);
  13802. }
  13803. Schema.prototype = {
  13804. messages: function messages(_messages) {
  13805. if (_messages) {
  13806. this._messages = deepMerge(newMessages(), _messages);
  13807. }
  13808. return this._messages;
  13809. },
  13810. define: function define(rules) {
  13811. if (!rules) {
  13812. throw new Error('Cannot configure a schema with no rules');
  13813. }
  13814. if ((0, _typeof2.default)(rules) !== 'object' || Array.isArray(rules)) {
  13815. throw new Error('Rules must be an object');
  13816. }
  13817. this.rules = {};
  13818. var z;
  13819. var item;
  13820. for (z in rules) {
  13821. if (rules.hasOwnProperty(z)) {
  13822. item = rules[z];
  13823. this.rules[z] = Array.isArray(item) ? item : [item];
  13824. }
  13825. }
  13826. },
  13827. validate: function validate(source_, o, oc) {
  13828. var _this = this;
  13829. if (o === void 0) {
  13830. o = {};
  13831. }
  13832. if (oc === void 0) {
  13833. oc = function oc() {};
  13834. }
  13835. var source = source_;
  13836. var options = o;
  13837. var callback = oc;
  13838. if (typeof options === 'function') {
  13839. callback = options;
  13840. options = {};
  13841. }
  13842. if (!this.rules || Object.keys(this.rules).length === 0) {
  13843. if (callback) {
  13844. callback();
  13845. }
  13846. return Promise.resolve();
  13847. }
  13848. function complete(results) {
  13849. var i;
  13850. var errors = [];
  13851. var fields = {};
  13852. function add(e) {
  13853. if (Array.isArray(e)) {
  13854. var _errors;
  13855. errors = (_errors = errors).concat.apply(_errors, e);
  13856. } else {
  13857. errors.push(e);
  13858. }
  13859. }
  13860. for (i = 0; i < results.length; i++) {
  13861. add(results[i]);
  13862. }
  13863. if (!errors.length) {
  13864. errors = null;
  13865. fields = null;
  13866. } else {
  13867. fields = convertFieldsError(errors);
  13868. }
  13869. callback(errors, fields);
  13870. }
  13871. if (options.messages) {
  13872. var messages$1 = this.messages();
  13873. if (messages$1 === messages) {
  13874. messages$1 = newMessages();
  13875. }
  13876. deepMerge(messages$1, options.messages);
  13877. options.messages = messages$1;
  13878. } else {
  13879. options.messages = this.messages();
  13880. }
  13881. var arr;
  13882. var value;
  13883. var series = {};
  13884. var keys = options.keys || Object.keys(this.rules);
  13885. keys.forEach(function (z) {
  13886. arr = _this.rules[z];
  13887. value = source[z];
  13888. arr.forEach(function (r) {
  13889. var rule = r;
  13890. if (typeof rule.transform === 'function') {
  13891. if (source === source_) {
  13892. source = _extends({}, source);
  13893. }
  13894. value = source[z] = rule.transform(value);
  13895. }
  13896. if (typeof rule === 'function') {
  13897. rule = {
  13898. validator: rule
  13899. };
  13900. } else {
  13901. rule = _extends({}, rule);
  13902. }
  13903. rule.validator = _this.getValidationMethod(rule);
  13904. rule.field = z;
  13905. rule.fullField = rule.fullField || z;
  13906. rule.type = _this.getType(rule);
  13907. if (!rule.validator) {
  13908. return;
  13909. }
  13910. series[z] = series[z] || [];
  13911. series[z].push({
  13912. rule: rule,
  13913. value: value,
  13914. source: source,
  13915. field: z
  13916. });
  13917. });
  13918. });
  13919. var errorFields = {};
  13920. return asyncMap(series, options, function (data, doIt) {
  13921. var rule = data.rule;
  13922. var deep = (rule.type === 'object' || rule.type === 'array') && ((0, _typeof2.default)(rule.fields) === 'object' || (0, _typeof2.default)(rule.defaultField) === 'object');
  13923. deep = deep && (rule.required || !rule.required && data.value);
  13924. rule.field = data.field;
  13925. function addFullfield(key, schema) {
  13926. return _extends({}, schema, {
  13927. fullField: rule.fullField + "." + key
  13928. });
  13929. }
  13930. function cb(e) {
  13931. if (e === void 0) {
  13932. e = [];
  13933. }
  13934. var errors = e;
  13935. if (!Array.isArray(errors)) {
  13936. errors = [errors];
  13937. }
  13938. if (!options.suppressWarning && errors.length) {
  13939. Schema.warning('async-validator:', errors);
  13940. }
  13941. if (errors.length && rule.message) {
  13942. errors = [].concat(rule.message);
  13943. }
  13944. errors = errors.map(complementError(rule));
  13945. if (options.first && errors.length) {
  13946. errorFields[rule.field] = 1;
  13947. return doIt(errors);
  13948. }
  13949. if (!deep) {
  13950. doIt(errors);
  13951. } else {
  13952. // if rule is required but the target object
  13953. // does not exist fail at the rule level and don't
  13954. // go deeper
  13955. if (rule.required && !data.value) {
  13956. if (rule.message) {
  13957. errors = [].concat(rule.message).map(complementError(rule));
  13958. } else if (options.error) {
  13959. errors = [options.error(rule, format(options.messages.required, rule.field))];
  13960. } else {
  13961. errors = [];
  13962. }
  13963. return doIt(errors);
  13964. }
  13965. var fieldsSchema = {};
  13966. if (rule.defaultField) {
  13967. for (var k in data.value) {
  13968. if (data.value.hasOwnProperty(k)) {
  13969. fieldsSchema[k] = rule.defaultField;
  13970. }
  13971. }
  13972. }
  13973. fieldsSchema = _extends({}, fieldsSchema, {}, data.rule.fields);
  13974. for (var f in fieldsSchema) {
  13975. if (fieldsSchema.hasOwnProperty(f)) {
  13976. var fieldSchema = Array.isArray(fieldsSchema[f]) ? fieldsSchema[f] : [fieldsSchema[f]];
  13977. fieldsSchema[f] = fieldSchema.map(addFullfield.bind(null, f));
  13978. }
  13979. }
  13980. var schema = new Schema(fieldsSchema);
  13981. schema.messages(options.messages);
  13982. if (data.rule.options) {
  13983. data.rule.options.messages = options.messages;
  13984. data.rule.options.error = options.error;
  13985. }
  13986. schema.validate(data.value, data.rule.options || options, function (errs) {
  13987. var finalErrors = [];
  13988. if (errors && errors.length) {
  13989. finalErrors.push.apply(finalErrors, errors);
  13990. }
  13991. if (errs && errs.length) {
  13992. finalErrors.push.apply(finalErrors, errs);
  13993. }
  13994. doIt(finalErrors.length ? finalErrors : null);
  13995. });
  13996. }
  13997. }
  13998. var res;
  13999. if (rule.asyncValidator) {
  14000. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  14001. } else if (rule.validator) {
  14002. res = rule.validator(rule, data.value, cb, data.source, options);
  14003. if (res === true) {
  14004. cb();
  14005. } else if (res === false) {
  14006. cb(rule.message || rule.field + " fails");
  14007. } else if (res instanceof Array) {
  14008. cb(res);
  14009. } else if (res instanceof Error) {
  14010. cb(res.message);
  14011. }
  14012. }
  14013. if (res && res.then) {
  14014. res.then(function () {
  14015. return cb();
  14016. }, function (e) {
  14017. return cb(e);
  14018. });
  14019. }
  14020. }, function (results) {
  14021. complete(results);
  14022. });
  14023. },
  14024. getType: function getType(rule) {
  14025. if (rule.type === undefined && rule.pattern instanceof RegExp) {
  14026. rule.type = 'pattern';
  14027. }
  14028. if (typeof rule.validator !== 'function' && rule.type && !validators.hasOwnProperty(rule.type)) {
  14029. throw new Error(format('Unknown rule type %s', rule.type));
  14030. }
  14031. return rule.type || 'string';
  14032. },
  14033. getValidationMethod: function getValidationMethod(rule) {
  14034. if (typeof rule.validator === 'function') {
  14035. return rule.validator;
  14036. }
  14037. var keys = Object.keys(rule);
  14038. var messageIndex = keys.indexOf('message');
  14039. if (messageIndex !== -1) {
  14040. keys.splice(messageIndex, 1);
  14041. }
  14042. if (keys.length === 1 && keys[0] === 'required') {
  14043. return validators.required;
  14044. }
  14045. return validators[this.getType(rule)] || false;
  14046. }
  14047. };
  14048. Schema.register = function register(type, validator) {
  14049. if (typeof validator !== 'function') {
  14050. throw new Error('Cannot register a validator by type, validator is not a function');
  14051. }
  14052. validators[type] = validator;
  14053. };
  14054. Schema.warning = warning;
  14055. Schema.messages = messages;
  14056. var _default = Schema;
  14057. exports.default = _default;
  14058. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/node-libs-browser/mock/process.js */ 562)))
  14059. /***/ }),
  14060. /***/ 562:
  14061. /*!********************************************************!*\
  14062. !*** ./node_modules/node-libs-browser/mock/process.js ***!
  14063. \********************************************************/
  14064. /*! no static exports found */
  14065. /***/ (function(module, exports, __webpack_require__) {
  14066. exports.nextTick = function nextTick(fn) {
  14067. var args = Array.prototype.slice.call(arguments);
  14068. args.shift();
  14069. setTimeout(function () {
  14070. fn.apply(null, args);
  14071. }, 0);
  14072. };
  14073. exports.platform = exports.arch =
  14074. exports.execPath = exports.title = 'browser';
  14075. exports.pid = 1;
  14076. exports.browser = true;
  14077. exports.env = {};
  14078. exports.argv = [];
  14079. exports.binding = function (name) {
  14080. throw new Error('No such module. (Possibly not yet loaded)')
  14081. };
  14082. (function () {
  14083. var cwd = '/';
  14084. var path;
  14085. exports.cwd = function () { return cwd };
  14086. exports.chdir = function (dir) {
  14087. if (!path) path = __webpack_require__(/*! path */ 563);
  14088. cwd = path.resolve(dir, cwd);
  14089. };
  14090. })();
  14091. exports.exit = exports.kill =
  14092. exports.umask = exports.dlopen =
  14093. exports.uptime = exports.memoryUsage =
  14094. exports.uvCounters = function() {};
  14095. exports.features = {};
  14096. /***/ }),
  14097. /***/ 563:
  14098. /*!***********************************************!*\
  14099. !*** ./node_modules/path-browserify/index.js ***!
  14100. \***********************************************/
  14101. /*! no static exports found */
  14102. /***/ (function(module, exports, __webpack_require__) {
  14103. /* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
  14104. // backported and transplited with Babel, with backwards-compat fixes
  14105. // Copyright Joyent, Inc. and other Node contributors.
  14106. //
  14107. // Permission is hereby granted, free of charge, to any person obtaining a
  14108. // copy of this software and associated documentation files (the
  14109. // "Software"), to deal in the Software without restriction, including
  14110. // without limitation the rights to use, copy, modify, merge, publish,
  14111. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14112. // persons to whom the Software is furnished to do so, subject to the
  14113. // following conditions:
  14114. //
  14115. // The above copyright notice and this permission notice shall be included
  14116. // in all copies or substantial portions of the Software.
  14117. //
  14118. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14119. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14120. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14121. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14122. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14123. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14124. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14125. // resolves . and .. elements in a path array with directory names there
  14126. // must be no slashes, empty elements, or device names (c:\) in the array
  14127. // (so also no leading and trailing slashes - it does not distinguish
  14128. // relative and absolute paths)
  14129. function normalizeArray(parts, allowAboveRoot) {
  14130. // if the path tries to go above the root, `up` ends up > 0
  14131. var up = 0;
  14132. for (var i = parts.length - 1; i >= 0; i--) {
  14133. var last = parts[i];
  14134. if (last === '.') {
  14135. parts.splice(i, 1);
  14136. } else if (last === '..') {
  14137. parts.splice(i, 1);
  14138. up++;
  14139. } else if (up) {
  14140. parts.splice(i, 1);
  14141. up--;
  14142. }
  14143. }
  14144. // if the path is allowed to go above the root, restore leading ..s
  14145. if (allowAboveRoot) {
  14146. for (; up--; up) {
  14147. parts.unshift('..');
  14148. }
  14149. }
  14150. return parts;
  14151. }
  14152. // path.resolve([from ...], to)
  14153. // posix version
  14154. exports.resolve = function() {
  14155. var resolvedPath = '',
  14156. resolvedAbsolute = false;
  14157. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  14158. var path = (i >= 0) ? arguments[i] : process.cwd();
  14159. // Skip empty and invalid entries
  14160. if (typeof path !== 'string') {
  14161. throw new TypeError('Arguments to path.resolve must be strings');
  14162. } else if (!path) {
  14163. continue;
  14164. }
  14165. resolvedPath = path + '/' + resolvedPath;
  14166. resolvedAbsolute = path.charAt(0) === '/';
  14167. }
  14168. // At this point the path should be resolved to a full absolute path, but
  14169. // handle relative paths to be safe (might happen when process.cwd() fails)
  14170. // Normalize the path
  14171. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
  14172. return !!p;
  14173. }), !resolvedAbsolute).join('/');
  14174. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  14175. };
  14176. // path.normalize(path)
  14177. // posix version
  14178. exports.normalize = function(path) {
  14179. var isAbsolute = exports.isAbsolute(path),
  14180. trailingSlash = substr(path, -1) === '/';
  14181. // Normalize the path
  14182. path = normalizeArray(filter(path.split('/'), function(p) {
  14183. return !!p;
  14184. }), !isAbsolute).join('/');
  14185. if (!path && !isAbsolute) {
  14186. path = '.';
  14187. }
  14188. if (path && trailingSlash) {
  14189. path += '/';
  14190. }
  14191. return (isAbsolute ? '/' : '') + path;
  14192. };
  14193. // posix version
  14194. exports.isAbsolute = function(path) {
  14195. return path.charAt(0) === '/';
  14196. };
  14197. // posix version
  14198. exports.join = function() {
  14199. var paths = Array.prototype.slice.call(arguments, 0);
  14200. return exports.normalize(filter(paths, function(p, index) {
  14201. if (typeof p !== 'string') {
  14202. throw new TypeError('Arguments to path.join must be strings');
  14203. }
  14204. return p;
  14205. }).join('/'));
  14206. };
  14207. // path.relative(from, to)
  14208. // posix version
  14209. exports.relative = function(from, to) {
  14210. from = exports.resolve(from).substr(1);
  14211. to = exports.resolve(to).substr(1);
  14212. function trim(arr) {
  14213. var start = 0;
  14214. for (; start < arr.length; start++) {
  14215. if (arr[start] !== '') break;
  14216. }
  14217. var end = arr.length - 1;
  14218. for (; end >= 0; end--) {
  14219. if (arr[end] !== '') break;
  14220. }
  14221. if (start > end) return [];
  14222. return arr.slice(start, end - start + 1);
  14223. }
  14224. var fromParts = trim(from.split('/'));
  14225. var toParts = trim(to.split('/'));
  14226. var length = Math.min(fromParts.length, toParts.length);
  14227. var samePartsLength = length;
  14228. for (var i = 0; i < length; i++) {
  14229. if (fromParts[i] !== toParts[i]) {
  14230. samePartsLength = i;
  14231. break;
  14232. }
  14233. }
  14234. var outputParts = [];
  14235. for (var i = samePartsLength; i < fromParts.length; i++) {
  14236. outputParts.push('..');
  14237. }
  14238. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  14239. return outputParts.join('/');
  14240. };
  14241. exports.sep = '/';
  14242. exports.delimiter = ':';
  14243. exports.dirname = function (path) {
  14244. if (typeof path !== 'string') path = path + '';
  14245. if (path.length === 0) return '.';
  14246. var code = path.charCodeAt(0);
  14247. var hasRoot = code === 47 /*/*/;
  14248. var end = -1;
  14249. var matchedSlash = true;
  14250. for (var i = path.length - 1; i >= 1; --i) {
  14251. code = path.charCodeAt(i);
  14252. if (code === 47 /*/*/) {
  14253. if (!matchedSlash) {
  14254. end = i;
  14255. break;
  14256. }
  14257. } else {
  14258. // We saw the first non-path separator
  14259. matchedSlash = false;
  14260. }
  14261. }
  14262. if (end === -1) return hasRoot ? '/' : '.';
  14263. if (hasRoot && end === 1) {
  14264. // return '//';
  14265. // Backwards-compat fix:
  14266. return '/';
  14267. }
  14268. return path.slice(0, end);
  14269. };
  14270. function basename(path) {
  14271. if (typeof path !== 'string') path = path + '';
  14272. var start = 0;
  14273. var end = -1;
  14274. var matchedSlash = true;
  14275. var i;
  14276. for (i = path.length - 1; i >= 0; --i) {
  14277. if (path.charCodeAt(i) === 47 /*/*/) {
  14278. // If we reached a path separator that was not part of a set of path
  14279. // separators at the end of the string, stop now
  14280. if (!matchedSlash) {
  14281. start = i + 1;
  14282. break;
  14283. }
  14284. } else if (end === -1) {
  14285. // We saw the first non-path separator, mark this as the end of our
  14286. // path component
  14287. matchedSlash = false;
  14288. end = i + 1;
  14289. }
  14290. }
  14291. if (end === -1) return '';
  14292. return path.slice(start, end);
  14293. }
  14294. // Uses a mixed approach for backwards-compatibility, as ext behavior changed
  14295. // in new Node.js versions, so only basename() above is backported here
  14296. exports.basename = function (path, ext) {
  14297. var f = basename(path);
  14298. if (ext && f.substr(-1 * ext.length) === ext) {
  14299. f = f.substr(0, f.length - ext.length);
  14300. }
  14301. return f;
  14302. };
  14303. exports.extname = function (path) {
  14304. if (typeof path !== 'string') path = path + '';
  14305. var startDot = -1;
  14306. var startPart = 0;
  14307. var end = -1;
  14308. var matchedSlash = true;
  14309. // Track the state of characters (if any) we see before our first dot and
  14310. // after any path separator we find
  14311. var preDotState = 0;
  14312. for (var i = path.length - 1; i >= 0; --i) {
  14313. var code = path.charCodeAt(i);
  14314. if (code === 47 /*/*/) {
  14315. // If we reached a path separator that was not part of a set of path
  14316. // separators at the end of the string, stop now
  14317. if (!matchedSlash) {
  14318. startPart = i + 1;
  14319. break;
  14320. }
  14321. continue;
  14322. }
  14323. if (end === -1) {
  14324. // We saw the first non-path separator, mark this as the end of our
  14325. // extension
  14326. matchedSlash = false;
  14327. end = i + 1;
  14328. }
  14329. if (code === 46 /*.*/) {
  14330. // If this is our first dot, mark it as the start of our extension
  14331. if (startDot === -1)
  14332. startDot = i;
  14333. else if (preDotState !== 1)
  14334. preDotState = 1;
  14335. } else if (startDot !== -1) {
  14336. // We saw a non-dot and non-path separator before our dot, so we should
  14337. // have a good chance at having a non-empty extension
  14338. preDotState = -1;
  14339. }
  14340. }
  14341. if (startDot === -1 || end === -1 ||
  14342. // We saw a non-dot character immediately before the dot
  14343. preDotState === 0 ||
  14344. // The (right-most) trimmed path component is exactly '..'
  14345. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  14346. return '';
  14347. }
  14348. return path.slice(startDot, end);
  14349. };
  14350. function filter (xs, f) {
  14351. if (xs.filter) return xs.filter(f);
  14352. var res = [];
  14353. for (var i = 0; i < xs.length; i++) {
  14354. if (f(xs[i], i, xs)) res.push(xs[i]);
  14355. }
  14356. return res;
  14357. }
  14358. // String.prototype.substr - negative index don't work in IE8
  14359. var substr = 'ab'.substr(-1) === 'b'
  14360. ? function (str, start, len) { return str.substr(start, len) }
  14361. : function (str, start, len) {
  14362. if (start < 0) start = str.length + start;
  14363. return str.substr(start, len);
  14364. }
  14365. ;
  14366. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 562)))
  14367. /***/ }),
  14368. /***/ 57:
  14369. /*!******************************************************************!*\
  14370. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/sys.js ***!
  14371. \******************************************************************/
  14372. /*! no static exports found */
  14373. /***/ (function(module, exports, __webpack_require__) {
  14374. "use strict";
  14375. /* WEBPACK VAR INJECTION */(function(uni) {
  14376. Object.defineProperty(exports, "__esModule", {
  14377. value: true
  14378. });
  14379. exports.os = os;
  14380. exports.sys = sys;
  14381. function os() {
  14382. return uni.getSystemInfoSync().platform;
  14383. }
  14384. ;
  14385. function sys() {
  14386. return uni.getSystemInfoSync();
  14387. }
  14388. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  14389. /***/ }),
  14390. /***/ 58:
  14391. /*!***********************************************************************!*\
  14392. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/debounce.js ***!
  14393. \***********************************************************************/
  14394. /*! no static exports found */
  14395. /***/ (function(module, exports, __webpack_require__) {
  14396. "use strict";
  14397. Object.defineProperty(exports, "__esModule", {
  14398. value: true
  14399. });
  14400. exports.default = void 0;
  14401. var timeout = null;
  14402. /**
  14403. * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
  14404. *
  14405. * @param {Function} func 要执行的回调函数
  14406. * @param {Number} wait 延时的时间
  14407. * @param {Boolean} immediate 是否立即执行
  14408. * @return null
  14409. */
  14410. function debounce(func) {
  14411. var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
  14412. var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  14413. // 清除定时器
  14414. if (timeout !== null) clearTimeout(timeout);
  14415. // 立即执行,此类情况一般用不到
  14416. if (immediate) {
  14417. var callNow = !timeout;
  14418. timeout = setTimeout(function () {
  14419. timeout = null;
  14420. }, wait);
  14421. if (callNow) typeof func === 'function' && func();
  14422. } else {
  14423. // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
  14424. timeout = setTimeout(function () {
  14425. typeof func === 'function' && func();
  14426. }, wait);
  14427. }
  14428. }
  14429. var _default = debounce;
  14430. exports.default = _default;
  14431. /***/ }),
  14432. /***/ 59:
  14433. /*!***********************************************************************!*\
  14434. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/throttle.js ***!
  14435. \***********************************************************************/
  14436. /*! no static exports found */
  14437. /***/ (function(module, exports, __webpack_require__) {
  14438. "use strict";
  14439. Object.defineProperty(exports, "__esModule", {
  14440. value: true
  14441. });
  14442. exports.default = void 0;
  14443. var timeoutArr = [];
  14444. var flagArr = [];
  14445. /**
  14446. * 节流函数
  14447. * 节流原理:在一定时间内,只能触发一次
  14448. * @param {Function} fn 要执行的回调函数
  14449. * @param {Number} time 延时的时间
  14450. * @param {Boolean} isImmediate 是否立即执行
  14451. * @param {String} timeoutName 定时器ID
  14452. * @return null
  14453. */
  14454. function throttle(fn) {
  14455. var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
  14456. var isImmediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  14457. var timeoutName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "default";
  14458. if (!timeoutArr[timeoutName]) timeoutArr[timeoutName] = null;
  14459. if (isImmediate) {
  14460. if (!flagArr[timeoutName]) {
  14461. flagArr[timeoutName] = true;
  14462. // 如果是立即执行,则在time毫秒内开始时执行
  14463. if (typeof fn === 'function') fn();
  14464. timeoutArr[timeoutName] = setTimeout(function () {
  14465. flagArr[timeoutName] = false;
  14466. }, time);
  14467. }
  14468. } else {
  14469. if (!flagArr[timeoutName]) {
  14470. flagArr[timeoutName] = true;
  14471. // 如果是非立即执行,则在time毫秒内的结束处执行
  14472. timeoutArr[timeoutName] = setTimeout(function () {
  14473. flagArr[timeoutName] = false;
  14474. if (typeof fn === 'function') fn();
  14475. }, time);
  14476. }
  14477. }
  14478. }
  14479. ;
  14480. var _default = throttle;
  14481. exports.default = _default;
  14482. /***/ }),
  14483. /***/ 6:
  14484. /*!***************************************************************!*\
  14485. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  14486. \***************************************************************/
  14487. /*! no static exports found */
  14488. /***/ (function(module, exports) {
  14489. function _arrayWithHoles(arr) {
  14490. if (Array.isArray(arr)) return arr;
  14491. }
  14492. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  14493. /***/ }),
  14494. /***/ 60:
  14495. /*!***********************************************************************!*\
  14496. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/addStyle.js ***!
  14497. \***********************************************************************/
  14498. /*! no static exports found */
  14499. /***/ (function(module, exports, __webpack_require__) {
  14500. "use strict";
  14501. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  14502. Object.defineProperty(exports, "__esModule", {
  14503. value: true
  14504. });
  14505. exports.default = void 0;
  14506. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  14507. var _test = _interopRequireDefault(__webpack_require__(/*! ./test.js */ 38));
  14508. /**
  14509. * @description 样式转换
  14510. * 对象转字符串,或者字符串转对象
  14511. * @param {object | string} customStyle 需要转换的目标
  14512. * @param {String} target 转换的目的,object-转为对象,string-转为字符串
  14513. * @returns {object|string}
  14514. */
  14515. function addStyle(customStyle) {
  14516. var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'object';
  14517. // 字符串转字符串,对象转对象情形,直接返回
  14518. if (_test.default.empty(customStyle) || (0, _typeof2.default)(customStyle) === 'object' && target === 'object' || target === 'string' && typeof customStyle === 'string') {
  14519. return customStyle;
  14520. }
  14521. // 字符串转对象
  14522. if (target === 'object') {
  14523. // 去除字符串样式中的两端空格(中间的空格不能去掉,比如padding: 20px 0如果去掉了就错了),空格是无用的
  14524. customStyle = trim(customStyle);
  14525. // 根据";"将字符串转为数组形式
  14526. var styleArray = customStyle.split(';');
  14527. var style = {};
  14528. // 历遍数组,拼接成对象
  14529. for (var i = 0; i < styleArray.length; i++) {
  14530. // 'font-size:20px;color:red;',如此最后字符串有";"的话,会导致styleArray最后一个元素为空字符串,这里需要过滤
  14531. if (styleArray[i]) {
  14532. var item = styleArray[i].split(':');
  14533. style[trim(item[0])] = trim(item[1]);
  14534. }
  14535. }
  14536. return style;
  14537. }
  14538. // 这里为对象转字符串形式
  14539. var string = '';
  14540. for (var _i in customStyle) {
  14541. // 驼峰转为中划线的形式,否则css内联样式,无法识别驼峰样式属性名
  14542. var key = _i.replace(/([A-Z])/g, '-$1').toLowerCase();
  14543. string += "".concat(key, ":").concat(customStyle[_i], ";");
  14544. }
  14545. // 去除两端空格
  14546. return trim(string);
  14547. }
  14548. var _default = addStyle;
  14549. exports.default = _default;
  14550. /***/ }),
  14551. /***/ 61:
  14552. /*!*******************************************************************!*\
  14553. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/config/config.js ***!
  14554. \*******************************************************************/
  14555. /*! no static exports found */
  14556. /***/ (function(module, exports, __webpack_require__) {
  14557. "use strict";
  14558. Object.defineProperty(exports, "__esModule", {
  14559. value: true
  14560. });
  14561. exports.default = void 0;
  14562. // 第一版 1.10.1 版本发布于2021-11-18
  14563. var version = '1.10.1';
  14564. var _default = {
  14565. v: version,
  14566. version: version,
  14567. // 主题名称
  14568. type: ['primary', 'success', 'info', 'error', 'warning']
  14569. };
  14570. exports.default = _default;
  14571. /***/ }),
  14572. /***/ 62:
  14573. /*!*******************************************************************!*\
  14574. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/config/zIndex.js ***!
  14575. \*******************************************************************/
  14576. /*! no static exports found */
  14577. /***/ (function(module, exports, __webpack_require__) {
  14578. "use strict";
  14579. Object.defineProperty(exports, "__esModule", {
  14580. value: true
  14581. });
  14582. exports.default = void 0;
  14583. // uniapp在H5中各API的z-index值如下:
  14584. /**
  14585. * actionsheet: 999
  14586. * modal: 999
  14587. * navigate: 998
  14588. * tabbar: 998
  14589. * toast: 999
  14590. */
  14591. var _default = {
  14592. toast: 10090,
  14593. noNetwork: 10080,
  14594. // popup包含popup,actionsheet,keyboard,picker的值
  14595. popup: 10075,
  14596. mask: 10070,
  14597. navbar: 980,
  14598. topTips: 975,
  14599. sticky: 970,
  14600. indexListSticky: 965
  14601. };
  14602. exports.default = _default;
  14603. /***/ }),
  14604. /***/ 63:
  14605. /*!**********************************!*\
  14606. !*** E:/work/mdapp/api/index.js ***!
  14607. \**********************************/
  14608. /*! no static exports found */
  14609. /***/ (function(module, exports, __webpack_require__) {
  14610. "use strict";
  14611. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  14612. Object.defineProperty(exports, "__esModule", {
  14613. value: true
  14614. });
  14615. exports.default = void 0;
  14616. var _base = _interopRequireDefault(__webpack_require__(/*! ./base */ 64));
  14617. var _estate = _interopRequireDefault(__webpack_require__(/*! ./estate */ 67));
  14618. var _cust = _interopRequireDefault(__webpack_require__(/*! ./cust */ 68));
  14619. var _default = {
  14620. base: _base.default,
  14621. estate: _estate.default,
  14622. cust: _cust.default
  14623. };
  14624. exports.default = _default;
  14625. /***/ }),
  14626. /***/ 64:
  14627. /*!*********************************!*\
  14628. !*** E:/work/mdapp/api/base.js ***!
  14629. \*********************************/
  14630. /*! no static exports found */
  14631. /***/ (function(module, exports, __webpack_require__) {
  14632. "use strict";
  14633. Object.defineProperty(exports, "__esModule", {
  14634. value: true
  14635. });
  14636. exports.default = void 0;
  14637. var _http = __webpack_require__(/*! @/utils/http */ 65);
  14638. var _default = {
  14639. apilogin: function apilogin(params) {
  14640. // 登录
  14641. return (0, _http.request)('api/login', params, 'loading');
  14642. },
  14643. apiregister: function apiregister(params) {
  14644. // 注册
  14645. return (0, _http.request)('api/register', params, 'loading');
  14646. },
  14647. apisendsms: function apisendsms(params) {
  14648. // 发送短信
  14649. return (0, _http.request)('api/send/sms', params, 'loading');
  14650. },
  14651. apicaptcha: function apicaptcha(params) {
  14652. // 验证码图片
  14653. return (0, _http.request)('api/captcha', params, 'loading');
  14654. },
  14655. apicheckcaptcha: function apicheckcaptcha(params) {
  14656. // 检查手机号
  14657. return (0, _http.request)('api/check/captcha', params);
  14658. },
  14659. apiwxlogin: function apiwxlogin(params) {
  14660. // 微信登录
  14661. return (0, _http.request)('api/wx/login', params, 'loading');
  14662. },
  14663. apiwxautologin: function apiwxautologin(params) {
  14664. // 微信登录 自动
  14665. return (0, _http.request)('api/wx/autologin', params, 'loading');
  14666. },
  14667. apiuserinfo: function apiuserinfo(params) {
  14668. // 用户信息
  14669. return (0, _http.request)('api/user/info', params, 'loading');
  14670. },
  14671. apiuseredit: function apiuseredit(params) {
  14672. // 用户编辑
  14673. return (0, _http.request)('api/user/edit', params, 'loading');
  14674. },
  14675. apiuserbindwechat: function apiuserbindwechat(params) {
  14676. // 绑定微信
  14677. return (0, _http.request)('api/user/bind/wechat', params, 'loading');
  14678. },
  14679. apiuserauthadd: function apiuserauthadd(params) {
  14680. // 用户认证 - 提交认证
  14681. return (0, _http.request)('api/user/auth/add', params, 'loading');
  14682. },
  14683. apiuserauthinfo: function apiuserauthinfo(params) {
  14684. // 用户认证 - 认证详情
  14685. return (0, _http.request)('api/user/auth/info', params, 'loading');
  14686. },
  14687. apiuploadcloudpiv: function apiuploadcloudpiv(params) {
  14688. // 图片上传云接口
  14689. return (0, _http.request)('api/upload/cloudpiv', params, 'loading');
  14690. },
  14691. apidicttree: function apidicttree(params) {
  14692. // 字典
  14693. return (0, _http.request)('api/dict/tree', params, 'loading');
  14694. },
  14695. apiuserauthlist: function apiuserauthlist(params) {
  14696. // 认证列表
  14697. return (0, _http.request)('api/user/auth/list', params, 'loading');
  14698. },
  14699. apiuserauthedit: function apiuserauthedit(params) {
  14700. // 认证 审核 中介
  14701. return (0, _http.request)('api/user/auth/edit', params, 'loading');
  14702. },
  14703. apideptauthedit: function apideptauthedit(params) {
  14704. // 认证 审核 渠道
  14705. return (0, _http.request)('api/dept/auth/edit', params, 'loading');
  14706. },
  14707. apiuserreferreredit: function apiuserreferreredit(params) {
  14708. // 修改推荐人
  14709. return (0, _http.request)('api/user/referrer/edit', params, 'loading');
  14710. },
  14711. apiusernoticeopen: function apiusernoticeopen(params) {
  14712. // 公众号 推送 打开
  14713. return (0, _http.request)('api/user/notice/open', params, 'loading');
  14714. },
  14715. apiusernoticeclose: function apiusernoticeclose(params) {
  14716. // 公众号 推送 关闭
  14717. return (0, _http.request)('api/user/notice/close', params, 'loading');
  14718. },
  14719. apicontractlist: function apicontractlist(params) {
  14720. // pdf合同管理 列表
  14721. return (0, _http.request)('api/contract/list', params, 'loading');
  14722. },
  14723. apicontractadd: function apicontractadd(params) {
  14724. // pdf合同管理 添加
  14725. return (0, _http.request)('api/contract/add', params, 'loading');
  14726. },
  14727. apicontractedit: function apicontractedit(params) {
  14728. // pdf合同管理 编辑
  14729. return (0, _http.request)('api/contract/edit', params, 'loading');
  14730. },
  14731. apicontractdetail: function apicontractdetail(params) {
  14732. // pdf合同管理 详情
  14733. return (0, _http.request)('api/contract/detail', params, 'loading');
  14734. },
  14735. apicontractdel: function apicontractdel(params) {
  14736. // pdf合同管理 删除
  14737. return (0, _http.request)('api/contract/del', params, 'loading');
  14738. }
  14739. };
  14740. exports.default = _default;
  14741. /***/ }),
  14742. /***/ 65:
  14743. /*!***********************************!*\
  14744. !*** E:/work/mdapp/utils/http.js ***!
  14745. \***********************************/
  14746. /*! no static exports found */
  14747. /***/ (function(module, exports, __webpack_require__) {
  14748. "use strict";
  14749. /* WEBPACK VAR INJECTION */(function(uni) {
  14750. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  14751. Object.defineProperty(exports, "__esModule", {
  14752. value: true
  14753. });
  14754. exports.request = request;
  14755. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  14756. var _utils = __webpack_require__(/*! @utils */ 66);
  14757. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  14758. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  14759. var Http = function Http() {
  14760. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  14761. data: {}
  14762. };
  14763. return new Promise(function (resolve, reject) {
  14764. if (options.loadingStr === 'loading') {
  14765. uni.showLoading({
  14766. mask: true,
  14767. title: '加载中..'
  14768. });
  14769. }
  14770. var token = uni.getStorageSync('MD_token') || '';
  14771. var header = {
  14772. 'Content-Type': 'application/json',
  14773. 'token': token
  14774. // 'Content-Type': 'application/x-www-form-urlencoded'
  14775. };
  14776. var params = _objectSpread({}, options.data);
  14777. if (uni.getStorageSync('APP_token')) params.token = uni.getStorageSync('APP_token');
  14778. for (var key in options.data) {
  14779. if (options.data[key] === undefined || options.data[key] === 'undefined') {
  14780. params[key] = '';
  14781. }
  14782. }
  14783. var url = uni.baseUrl + options.url;
  14784. // let url = options.url
  14785. if (options.queryData) {
  14786. var qStr = '';
  14787. for (var k in options.queryData) {
  14788. qStr += "".concat(k, "=").concat(options.queryData[k], "&");
  14789. }
  14790. qStr = qStr.substr(0, qStr.length - 1);
  14791. url += "?".concat(qStr);
  14792. }
  14793. uni.request({
  14794. url: url,
  14795. data: _objectSpread({}, params),
  14796. header: header,
  14797. method: options.method || 'POST',
  14798. complete: function complete(res) {
  14799. if (options.loadingStr === 'loading') {
  14800. uni.hideLoading();
  14801. }
  14802. },
  14803. success: function success(res) {
  14804. var cData = res.data;
  14805. var code = cData.errno;
  14806. switch (code) {
  14807. case 0:
  14808. return resolve((0, _utils.noEmpty)(cData.data) ? cData.data : cData);
  14809. break;
  14810. case 401:
  14811. case 404:
  14812. case 405:
  14813. uni.removeStorageSync('MD_userInfo');
  14814. var u2 = uni.getStorageSync('MD_userInfo2');
  14815. if (u2.bind_wechat === '1' && uni.getStorageSync('MD_token')) {
  14816. uni.login({
  14817. success: function success(res) {
  14818. if (res.code) {
  14819. uni.api.base.apiwxautologin({
  14820. code: res.code
  14821. }).then(function (cData) {
  14822. if (cData.token === 'error') {
  14823. uni.removeStorageSync('MD_token');
  14824. } else {
  14825. uni.setStorageSync('MD_userInfo', cData);
  14826. uni.setStorageSync('MD_token', cData.token);
  14827. uni.api.base.apidicttree().then(function (res) {
  14828. var cObj = res || {};
  14829. var newDict = {};
  14830. for (var _k in cObj) {
  14831. var cArr = cObj[_k].map(function (item) {
  14832. return _objectSpread(_objectSpread({}, item), {}, {
  14833. key: item.dict_label,
  14834. val: item.dict_value
  14835. });
  14836. });
  14837. newDict[_k] = cArr;
  14838. }
  14839. uni.setStorageSync('MD_dict', newDict);
  14840. });
  14841. uni.api.base.apiuserinfo().then(function (res2) {
  14842. uni.setStorageSync('MD_userInfo2', res2);
  14843. uni.reLaunch({
  14844. url: '/pages/index/index'
  14845. });
  14846. });
  14847. }
  14848. });
  14849. }
  14850. }
  14851. });
  14852. } else {
  14853. uni.showToast({
  14854. title: "\u8BF7\u5148\u767B\u5F55~",
  14855. icon: 'none'
  14856. });
  14857. uni.navigateTo({
  14858. url: '/pages/user/login/login'
  14859. });
  14860. }
  14861. break;
  14862. default:
  14863. uni.showModal({
  14864. title: '提示',
  14865. content: "".concat(cData.errmsg, "(").concat(code, ")")
  14866. });
  14867. return reject(cData);
  14868. }
  14869. // resolve()
  14870. },
  14871. fail: function fail(err) {
  14872. console.log(err);
  14873. reject(err);
  14874. }
  14875. });
  14876. });
  14877. };
  14878. // export default Http
  14879. function request(url, data, loadingStr, queryData) {
  14880. return Http({
  14881. url: url,
  14882. data: data,
  14883. loadingStr: loadingStr,
  14884. queryData: queryData
  14885. });
  14886. }
  14887. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  14888. /***/ }),
  14889. /***/ 66:
  14890. /*!************************************!*\
  14891. !*** E:/work/mdapp/utils/index.js ***!
  14892. \************************************/
  14893. /*! no static exports found */
  14894. /***/ (function(module, exports, __webpack_require__) {
  14895. "use strict";
  14896. Object.defineProperty(exports, "__esModule", {
  14897. value: true
  14898. });
  14899. exports.arrToObj = arrToObj;
  14900. exports.comGetTime = comGetTime;
  14901. exports.noEmpty = noEmpty;
  14902. exports.numFormat3 = numFormat3;
  14903. exports.strTrim = strTrim;
  14904. /**
  14905. * @param {string} str
  14906. * @returns {string}
  14907. */
  14908. function strTrim(str) {
  14909. return str.replace(/(^\s*)|(\s*$)/g, '');
  14910. }
  14911. /**
  14912. * @param {Number} num
  14913. * @returns {string}
  14914. */
  14915. function numFormat3(num) {
  14916. var dotNum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  14917. var numArr = Number(num).toFixed(dotNum).toString().split('.');
  14918. var arr = numArr[0].split('').reverse();
  14919. var res = [];
  14920. for (var i = 0; i < arr.length; i++) {
  14921. if (i % 3 === 0 && i !== 0) {
  14922. res.push(',');
  14923. }
  14924. res.push(arr[i]);
  14925. }
  14926. res.reverse();
  14927. if (numArr[1]) {
  14928. res = res.join('').concat('.' + numArr[1]);
  14929. } else {
  14930. res = res.join('');
  14931. }
  14932. // let res = num.toString().replace(/\d+/, function(n){
  14933. // return n.replace(/(\d)(?=(\d{3})+$)/g,function($1){
  14934. // return $1 + ","
  14935. // })
  14936. // })
  14937. // toLocaleString()
  14938. return res;
  14939. }
  14940. /**
  14941. * @param {Array} arr
  14942. * @returns {Object}
  14943. */
  14944. function arrToObj(arr) {
  14945. var obj = {};
  14946. if (Object.prototype.toString.call(arr) === '[object Array]') {
  14947. if (arr.length > 0) {
  14948. arr.forEach(function (item) {
  14949. obj[item.val] = item.key;
  14950. });
  14951. }
  14952. }
  14953. return obj;
  14954. }
  14955. /**
  14956. * @param {any} val
  14957. * @returns {Boolean}
  14958. */
  14959. function noEmpty(val) {
  14960. if (val === null || val === undefined || val === '') {
  14961. return false;
  14962. } else {
  14963. return true;
  14964. }
  14965. }
  14966. /**
  14967. * @param {Number} date
  14968. * @param {Boolean} onlyDate
  14969. * @returns {String}
  14970. * function time(time = +new Date()) {
  14971. var date = new Date(time + 8 * 3600 * 1000); // 增加8小时
  14972. return date.toJSON().substr(0, 19).replace('T', ' ');
  14973. }
  14974. */
  14975. function comGetTime() {
  14976. var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  14977. var onlyDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  14978. var year = date.getFullYear();
  14979. var month = date.getMonth() + 1;
  14980. month = month > 9 ? month : '0' + month;
  14981. var day = date.getDate();
  14982. day = day > 9 ? day : '0' + day;
  14983. var hour = date.getHours();
  14984. hour = hour > 9 ? hour : '0' + hour;
  14985. var minute = date.getMinutes();
  14986. minute = minute > 9 ? minute : '0' + minute;
  14987. var second = date.getSeconds();
  14988. second = second > 9 ? second : '0' + second;
  14989. var milli = date.getMilliseconds();
  14990. milli = milli > 100 ? milli : milli > 10 ? '0' + milli : '00' + milli;
  14991. return onlyDate ? "".concat(year, "-").concat(month, "-").concat(day) : "".concat(year).concat(month).concat(day).concat(hour).concat(minute).concat(second).concat(milli);
  14992. }
  14993. /***/ }),
  14994. /***/ 67:
  14995. /*!***********************************!*\
  14996. !*** E:/work/mdapp/api/estate.js ***!
  14997. \***********************************/
  14998. /*! no static exports found */
  14999. /***/ (function(module, exports, __webpack_require__) {
  15000. "use strict";
  15001. Object.defineProperty(exports, "__esModule", {
  15002. value: true
  15003. });
  15004. exports.default = void 0;
  15005. var _http = __webpack_require__(/*! @/utils/http */ 65);
  15006. var _default = {
  15007. apiestatelist: function apiestatelist(params) {
  15008. // 楼盘列表
  15009. return (0, _http.request)('api/estate/list', params, 'loading');
  15010. },
  15011. apiestatecontentdetail: function apiestatecontentdetail(params) {
  15012. // 楼盘 介绍详情
  15013. return (0, _http.request)('api/estate/content/detail', params, 'loading');
  15014. },
  15015. apireportadd: function apireportadd(params) {
  15016. // 报备 - 添加报备
  15017. return (0, _http.request)('api/report/add', params, 'loading');
  15018. },
  15019. apireportlist: function apireportlist(params) {
  15020. // 报备 - 报备列表
  15021. return (0, _http.request)('api/report/list', params, 'loading');
  15022. },
  15023. apireportdetail: function apireportdetail(params) {
  15024. // 报备 - 报备详情
  15025. return (0, _http.request)('api/report/detail', params, 'loading');
  15026. },
  15027. apireport2detail: function apireport2detail(params) {
  15028. // 报备 - 报备详情2 普通的报备详情
  15029. return (0, _http.request)('api/report2/detail', params, 'loading');
  15030. },
  15031. apigoverndetail: function apigoverndetail(params) {
  15032. // 报备 - 报备详情 /govern/detail
  15033. return (0, _http.request)('api/govern/detail', params, 'loading');
  15034. },
  15035. apireportsite: function apireportsite(params) {
  15036. // 案场 - 报备详情
  15037. return (0, _http.request)('api/report/site', params, 'loading');
  15038. },
  15039. apireportconfirm: function apireportconfirm(params) {
  15040. // 报备 - 报备确认
  15041. return (0, _http.request)('api/report/confirm', params, 'loading');
  15042. },
  15043. apireportcount: function apireportcount(params) {
  15044. // 报备 - 报备统计
  15045. return (0, _http.request)('api/report/count', params, 'loading');
  15046. },
  15047. apireportgroupcount: function apireportgroupcount(params) {
  15048. // 报备 - 报备分组统计
  15049. return (0, _http.request)('api/report/group/count', params, 'loading');
  15050. },
  15051. apiestateinfodetail: function apiestateinfodetail(params) {
  15052. // 楼盘一页纸
  15053. return (0, _http.request)('api/estate/info/detail', params, 'loading');
  15054. },
  15055. apiestatedetail: function apiestatedetail(params) {
  15056. // 楼盘详情 copy plus
  15057. return (0, _http.request)('api/estate/detail', params, 'loading');
  15058. },
  15059. apigovernlist: function apigovernlist(params) {
  15060. // 案场缺课列表
  15061. return (0, _http.request)('api/govern/list', params, 'loading');
  15062. },
  15063. apireportedit: function apireportedit(params) {
  15064. // 报备修改 接口
  15065. return (0, _http.request)('api/report/edit', params, 'loading');
  15066. },
  15067. apireportsubscrlist: function apireportsubscrlist(params) {
  15068. // 认购审核列表
  15069. return (0, _http.request)('api/report/subscr/list', params, 'loading');
  15070. },
  15071. apireportsubscrDeal: function apireportsubscrDeal(params) {
  15072. // 已认购审核
  15073. return (0, _http.request)('api/report/subscr', params, 'loading');
  15074. },
  15075. apireportsignupDeal: function apireportsignupDeal(params) {
  15076. // 已签约审核
  15077. return (0, _http.request)('api/report/signup', params, 'loading');
  15078. },
  15079. apiestateliblist: function apiestateliblist(params) {
  15080. // 内部 各楼盘各平台佣金汇集
  15081. return (0, _http.request)('api/estate/lib/list', params, 'loading');
  15082. },
  15083. apiestatelibdetail: function apiestatelibdetail(params) {
  15084. // 内部 各楼盘各平台佣金汇集 详情
  15085. return (0, _http.request)('api/estate/lib/detail', params, 'loading');
  15086. },
  15087. apideptstorelist: function apideptstorelist(params) {
  15088. // 渠道门店所有列表
  15089. return (0, _http.request)('api/dept/store/list', params, 'loading');
  15090. },
  15091. apideptstorecount: function apideptstorecount(params) {
  15092. // 渠道门店 品牌统计
  15093. return (0, _http.request)('api/dept/store/count', params, 'loading');
  15094. },
  15095. apistorechart: function apistorechart(params) {
  15096. // 内部门店 报备统计
  15097. return (0, _http.request)('api/store/chart', params, 'loading');
  15098. }
  15099. };
  15100. exports.default = _default;
  15101. /***/ }),
  15102. /***/ 68:
  15103. /*!*********************************!*\
  15104. !*** E:/work/mdapp/api/cust.js ***!
  15105. \*********************************/
  15106. /*! no static exports found */
  15107. /***/ (function(module, exports, __webpack_require__) {
  15108. "use strict";
  15109. Object.defineProperty(exports, "__esModule", {
  15110. value: true
  15111. });
  15112. exports.default = void 0;
  15113. var _http = __webpack_require__(/*! @/utils/http */ 65);
  15114. var _default = {
  15115. apicustomerlist: function apicustomerlist(params) {
  15116. // 客户 列表
  15117. return (0, _http.request)('api/customer/list', params);
  15118. },
  15119. apicustomeradd: function apicustomeradd(params) {
  15120. // 客户 添加
  15121. return (0, _http.request)('api/customer/add', params, 'loading');
  15122. },
  15123. apicustomeredit: function apicustomeredit(params) {
  15124. // 客户 编辑
  15125. return (0, _http.request)('api/customer/edit', params, 'loading');
  15126. },
  15127. apicustomerdel: function apicustomerdel(params) {
  15128. // 客户 删除
  15129. return (0, _http.request)('api/customer/del', params, 'loading');
  15130. },
  15131. apicustomerdetail: function apicustomerdetail(params) {
  15132. // 客户 详情
  15133. return (0, _http.request)('api/customer/detail', params, 'loading');
  15134. },
  15135. apireportvisitchange: function apireportvisitchange(params) {
  15136. // 到访材料添加
  15137. return (0, _http.request)('api/report/visit/change', params, 'loading');
  15138. },
  15139. apireportvisitdetail: function apireportvisitdetail(params) {
  15140. // 到访材料详情
  15141. return (0, _http.request)('api/report/visit/detail', params, 'loading');
  15142. },
  15143. apireportvisit: function apireportvisit(params) {
  15144. // 报备到访
  15145. return (0, _http.request)('api/report/visit', params, 'loading');
  15146. },
  15147. apireportverify: function apireportverify(params) {
  15148. // 报备审核
  15149. return (0, _http.request)('api/report/verify', params, 'loading');
  15150. },
  15151. apideptuserlist: function apideptuserlist(params) {
  15152. // 我的门店下级人员
  15153. return (0, _http.request)('api/dept/user/list', params, 'loading');
  15154. },
  15155. apiprivatecustomerlist: function apiprivatecustomerlist(params) {
  15156. // 内部客户 列表
  15157. return (0, _http.request)('api/private/customer/list', params);
  15158. },
  15159. apiprivatecustomeradd: function apiprivatecustomeradd(params) {
  15160. // 内部客户 添加
  15161. return (0, _http.request)('api/private/customer/add', params, 'loading');
  15162. },
  15163. apiprivatecustomeredit: function apiprivatecustomeredit(params) {
  15164. // 内部客户 编辑
  15165. return (0, _http.request)('api/private/customer/edit', params, 'loading');
  15166. },
  15167. apiprivatecustomerdel: function apiprivatecustomerdel(params) {
  15168. // 内部客户 删除
  15169. return (0, _http.request)('api/private/customer/del', params, 'loading');
  15170. },
  15171. apiprivatecustomerdetail: function apiprivatecustomerdetail(params) {
  15172. // 内部客户 详情
  15173. return (0, _http.request)('api/private/customer/detail', params, 'loading');
  15174. },
  15175. apiprivaterecordlist: function apiprivaterecordlist(params) {
  15176. // 内部客户 - 跟进记录 - 列表
  15177. return (0, _http.request)('api/private/record/list', params);
  15178. },
  15179. apiprivaterecordadd: function apiprivaterecordadd(params) {
  15180. // 内部客户 - 跟进记录 - 添加
  15181. return (0, _http.request)('api/private/record/add', params, 'loading');
  15182. },
  15183. apiprivaterecordedit: function apiprivaterecordedit(params) {
  15184. // 内部客户 - 跟进记录 - 编辑
  15185. return (0, _http.request)('api/private/record/edit', params, 'loading');
  15186. },
  15187. apiprivaterecorddel: function apiprivaterecorddel(params) {
  15188. // 内部客户 - 跟进记录 - 删除
  15189. return (0, _http.request)('api/private/record/del', params, 'loading');
  15190. },
  15191. apirecordremindcount: function apirecordremindcount(params) {
  15192. // 内部客户 - 跟进记录 - 数量统计
  15193. return (0, _http.request)('api/record/remind/count', params, 'loading');
  15194. },
  15195. apitradelist: function apitradelist(params) {
  15196. // 成交 - 列表
  15197. return (0, _http.request)('api/trade/list', params);
  15198. },
  15199. apitradeadd: function apitradeadd(params) {
  15200. // 成交 - 添加
  15201. return (0, _http.request)('api/trade/add', params, 'loading');
  15202. },
  15203. apitradeedit: function apitradeedit(params) {
  15204. // 成交 - 编辑
  15205. return (0, _http.request)('api/trade/edit', params, 'loading');
  15206. },
  15207. apitradedetail: function apitradedetail(params) {
  15208. // 成交 - 详情
  15209. return (0, _http.request)('api/trade/detail', params, 'loading');
  15210. },
  15211. apitradedel: function apitradedel(params) {
  15212. // 成交 - 删除
  15213. return (0, _http.request)('api/trade/del', params, 'loading');
  15214. },
  15215. apitraderecordlist: function apitraderecordlist(params) {
  15216. // 成交 更新记录 - 列表
  15217. return (0, _http.request)('api/trade/record/list', params);
  15218. },
  15219. apitraderecordadd: function apitraderecordadd(params) {
  15220. // 成交 更新记录 - 添加
  15221. return (0, _http.request)('api/trade/record/add', params, 'loading');
  15222. },
  15223. apitraderecordedit: function apitraderecordedit(params) {
  15224. // 成交 更新记录 - 编辑
  15225. return (0, _http.request)('api/trade/record/edit', params, 'loading');
  15226. },
  15227. apitraderecorddel: function apitraderecorddel(params) {
  15228. // 成交 更新记录 - 删除
  15229. return (0, _http.request)('api/trade/record/del', params, 'loading');
  15230. },
  15231. apitradesubmit: function apitradesubmit(params) {
  15232. // 成交审核 - 提交审核
  15233. return (0, _http.request)('api/trade/submit', params, 'loading');
  15234. },
  15235. apitradereview: function apitradereview(params) {
  15236. // 成交审核 - 一二三审 审核
  15237. return (0, _http.request)('api/trade/review', params, 'loading');
  15238. },
  15239. apitradesubtotal: function apitradesubtotal(params) {
  15240. // 成交审核 - 成交月度小计
  15241. return (0, _http.request)('api/trade/subtotal', params, 'loading');
  15242. },
  15243. apiactivitylist: function apiactivitylist(params) {
  15244. // 活动 列表
  15245. return (0, _http.request)('api/activity/list', params, 'loading');
  15246. },
  15247. apiactivityinfo: function apiactivityinfo(params) {
  15248. // 活动 详情
  15249. return (0, _http.request)('api/activity/info', params, 'loading');
  15250. },
  15251. apiactivityenroll: function apiactivityenroll(params) {
  15252. // 活动 报名
  15253. return (0, _http.request)('api/activity/enroll', params, 'loading');
  15254. },
  15255. apiactivitysign: function apiactivitysign(params) {
  15256. // 活动 报名 扫码签到
  15257. return (0, _http.request)('api/activity/sign', params, 'loading');
  15258. },
  15259. apitradestepinfo: function apitradestepinfo(params) {
  15260. // 二手房成交步骤管理 - 成交步骤明细
  15261. return (0, _http.request)('api/trade/step/info', params, 'loading');
  15262. },
  15263. apitradecontractedit: function apitradecontractedit(params) {
  15264. // 二手房成交步骤管理 - 成交合同修改
  15265. return (0, _http.request)('api/trade/contract/edit', params, 'loading');
  15266. },
  15267. apitradestepedit: function apitradestepedit(params) {
  15268. // 二手房成交步骤管理 - 成交步骤修改
  15269. return (0, _http.request)('api/trade/step/edit', params, 'loading');
  15270. },
  15271. apitradehouselist: function apitradehouselist(params) {
  15272. // 二手房 洪楼plus 房源列表
  15273. return (0, _http.request)('api/trade/house/list', params, 'loading');
  15274. }
  15275. };
  15276. exports.default = _default;
  15277. /***/ }),
  15278. /***/ 69:
  15279. /*!***********************************!*\
  15280. !*** E:/work/mdapp/utils/tool.js ***!
  15281. \***********************************/
  15282. /*! no static exports found */
  15283. /***/ (function(module, exports, __webpack_require__) {
  15284. "use strict";
  15285. /* WEBPACK VAR INJECTION */(function(uni) {
  15286. Object.defineProperty(exports, "__esModule", {
  15287. value: true
  15288. });
  15289. exports.msgBase = exports.getRandomNum = exports.confirmMsgFn = void 0;
  15290. var getRandomNum = function getRandomNum(len, radix) {
  15291. // getRandomNum(24, 16)
  15292. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  15293. var uuid = [];
  15294. radix = radix || chars.length;
  15295. if (len) {
  15296. // Compact form
  15297. for (var i = 0; i < len; i++) {
  15298. uuid[i] = chars[0 | Math.random() * radix];
  15299. }
  15300. } else {
  15301. // rfc4122, version 4 form
  15302. var r;
  15303. // rfc4122 requires these characters
  15304. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  15305. uuid[14] = '4';
  15306. // Fill in random data.  At i==19 set the high bits of clock sequence as
  15307. // per rfc4122, sec. 4.1.5
  15308. for (var _i = 0; _i < 36; _i++) {
  15309. if (!uuid[_i]) {
  15310. r = 0 | Math.random() * 16;
  15311. uuid[_i] = chars[_i === 19 ? r & 0x3 | 0x8 : r];
  15312. }
  15313. }
  15314. }
  15315. return uuid.join('') + new Date().getTime();
  15316. };
  15317. exports.getRandomNum = getRandomNum;
  15318. var msgBase = function msgBase(msgText, bc) {
  15319. uni.showToast({
  15320. title: msgText,
  15321. icon: 'none',
  15322. duration: 2000
  15323. }).then(function () {
  15324. if (bc) bc();
  15325. });
  15326. };
  15327. exports.msgBase = msgBase;
  15328. var confirmMsgFn = function confirmMsgFn(msgText, successBc, errorBc) {
  15329. var title = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '提示';
  15330. uni.showModal({
  15331. title: title,
  15332. content: msgText,
  15333. success: function success(res) {
  15334. if (res.confirm) {
  15335. if (successBc) successBc();
  15336. } else if (res.cancel) {
  15337. if (errorBc) errorBc();
  15338. }
  15339. }
  15340. });
  15341. };
  15342. exports.confirmMsgFn = confirmMsgFn;
  15343. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  15344. /***/ }),
  15345. /***/ 697:
  15346. /*!************************************************************************************!*\
  15347. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js ***!
  15348. \************************************************************************************/
  15349. /*! no static exports found */
  15350. /***/ (function(module, exports, __webpack_require__) {
  15351. "use strict";
  15352. /* WEBPACK VAR INJECTION */(function(global, uni, wx) {
  15353. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  15354. Object.defineProperty(exports, "__esModule", {
  15355. value: true
  15356. });
  15357. exports.default = void 0;
  15358. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 41));
  15359. var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ 698));
  15360. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  15361. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  15362. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  15363. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 43));
  15364. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  15365. var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ 699));
  15366. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ 700));
  15367. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ 701));
  15368. var _wrapNativeSuper2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ 702));
  15369. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  15370. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  15371. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
  15372. var _pages = _interopRequireDefault(__webpack_require__(/*! @/pages.json */ 704));
  15373. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e35) { throw _e35; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e36) { didErr = true; err = _e36; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
  15374. 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); }
  15375. 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; }
  15376. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  15377. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  15378. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
  15379. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  15380. "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self;
  15381. function n(e) {
  15382. return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
  15383. }
  15384. function s(e, t, n) {
  15385. return e(n = {
  15386. path: t,
  15387. exports: {},
  15388. require: function require(e, t) {
  15389. return function () {
  15390. throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
  15391. }(null == t && n.path);
  15392. }
  15393. }, n.exports), n.exports;
  15394. }
  15395. var r = s(function (e, t) {
  15396. var n;
  15397. e.exports = (n = n || function (e, t) {
  15398. var n = Object.create || function () {
  15399. function e() {}
  15400. return function (t) {
  15401. var n;
  15402. return e.prototype = t, n = new e(), e.prototype = null, n;
  15403. };
  15404. }(),
  15405. s = {},
  15406. r = s.lib = {},
  15407. i = r.Base = {
  15408. extend: function extend(e) {
  15409. var t = n(this);
  15410. return e && t.mixIn(e), t.hasOwnProperty("init") && this.init !== t.init || (t.init = function () {
  15411. t.$super.init.apply(this, arguments);
  15412. }), t.init.prototype = t, t.$super = this, t;
  15413. },
  15414. create: function create() {
  15415. var e = this.extend();
  15416. return e.init.apply(e, arguments), e;
  15417. },
  15418. init: function init() {},
  15419. mixIn: function mixIn(e) {
  15420. for (var t in e) {
  15421. e.hasOwnProperty(t) && (this[t] = e[t]);
  15422. }
  15423. e.hasOwnProperty("toString") && (this.toString = e.toString);
  15424. },
  15425. clone: function clone() {
  15426. return this.init.prototype.extend(this);
  15427. }
  15428. },
  15429. o = r.WordArray = i.extend({
  15430. init: function init(e, n) {
  15431. e = this.words = e || [], this.sigBytes = n != t ? n : 4 * e.length;
  15432. },
  15433. toString: function toString(e) {
  15434. return (e || c).stringify(this);
  15435. },
  15436. concat: function concat(e) {
  15437. var t = this.words,
  15438. n = e.words,
  15439. s = this.sigBytes,
  15440. r = e.sigBytes;
  15441. if (this.clamp(), s % 4) for (var i = 0; i < r; i++) {
  15442. var o = n[i >>> 2] >>> 24 - i % 4 * 8 & 255;
  15443. t[s + i >>> 2] |= o << 24 - (s + i) % 4 * 8;
  15444. } else for (i = 0; i < r; i += 4) {
  15445. t[s + i >>> 2] = n[i >>> 2];
  15446. }
  15447. return this.sigBytes += r, this;
  15448. },
  15449. clamp: function clamp() {
  15450. var t = this.words,
  15451. n = this.sigBytes;
  15452. t[n >>> 2] &= 4294967295 << 32 - n % 4 * 8, t.length = e.ceil(n / 4);
  15453. },
  15454. clone: function clone() {
  15455. var e = i.clone.call(this);
  15456. return e.words = this.words.slice(0), e;
  15457. },
  15458. random: function random(t) {
  15459. for (var n, s = [], r = function r(t) {
  15460. t = t;
  15461. var n = 987654321,
  15462. s = 4294967295;
  15463. return function () {
  15464. var r = ((n = 36969 * (65535 & n) + (n >> 16) & s) << 16) + (t = 18e3 * (65535 & t) + (t >> 16) & s) & s;
  15465. return r /= 4294967296, (r += .5) * (e.random() > .5 ? 1 : -1);
  15466. };
  15467. }, i = 0; i < t; i += 4) {
  15468. var a = r(4294967296 * (n || e.random()));
  15469. n = 987654071 * a(), s.push(4294967296 * a() | 0);
  15470. }
  15471. return new o.init(s, t);
  15472. }
  15473. }),
  15474. a = s.enc = {},
  15475. c = a.Hex = {
  15476. stringify: function stringify(e) {
  15477. for (var t = e.words, n = e.sigBytes, s = [], r = 0; r < n; r++) {
  15478. var i = t[r >>> 2] >>> 24 - r % 4 * 8 & 255;
  15479. s.push((i >>> 4).toString(16)), s.push((15 & i).toString(16));
  15480. }
  15481. return s.join("");
  15482. },
  15483. parse: function parse(e) {
  15484. for (var t = e.length, n = [], s = 0; s < t; s += 2) {
  15485. n[s >>> 3] |= parseInt(e.substr(s, 2), 16) << 24 - s % 8 * 4;
  15486. }
  15487. return new o.init(n, t / 2);
  15488. }
  15489. },
  15490. u = a.Latin1 = {
  15491. stringify: function stringify(e) {
  15492. for (var t = e.words, n = e.sigBytes, s = [], r = 0; r < n; r++) {
  15493. var i = t[r >>> 2] >>> 24 - r % 4 * 8 & 255;
  15494. s.push(String.fromCharCode(i));
  15495. }
  15496. return s.join("");
  15497. },
  15498. parse: function parse(e) {
  15499. for (var t = e.length, n = [], s = 0; s < t; s++) {
  15500. n[s >>> 2] |= (255 & e.charCodeAt(s)) << 24 - s % 4 * 8;
  15501. }
  15502. return new o.init(n, t);
  15503. }
  15504. },
  15505. h = a.Utf8 = {
  15506. stringify: function stringify(e) {
  15507. try {
  15508. return decodeURIComponent(escape(u.stringify(e)));
  15509. } catch (e) {
  15510. throw new Error("Malformed UTF-8 data");
  15511. }
  15512. },
  15513. parse: function parse(e) {
  15514. return u.parse(unescape(encodeURIComponent(e)));
  15515. }
  15516. },
  15517. l = r.BufferedBlockAlgorithm = i.extend({
  15518. reset: function reset() {
  15519. this._data = new o.init(), this._nDataBytes = 0;
  15520. },
  15521. _append: function _append(e) {
  15522. "string" == typeof e && (e = h.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes;
  15523. },
  15524. _process: function _process(t) {
  15525. var n = this._data,
  15526. s = n.words,
  15527. r = n.sigBytes,
  15528. i = this.blockSize,
  15529. a = r / (4 * i),
  15530. c = (a = t ? e.ceil(a) : e.max((0 | a) - this._minBufferSize, 0)) * i,
  15531. u = e.min(4 * c, r);
  15532. if (c) {
  15533. for (var h = 0; h < c; h += i) {
  15534. this._doProcessBlock(s, h);
  15535. }
  15536. var l = s.splice(0, c);
  15537. n.sigBytes -= u;
  15538. }
  15539. return new o.init(l, u);
  15540. },
  15541. clone: function clone() {
  15542. var e = i.clone.call(this);
  15543. return e._data = this._data.clone(), e;
  15544. },
  15545. _minBufferSize: 0
  15546. });
  15547. r.Hasher = l.extend({
  15548. cfg: i.extend(),
  15549. init: function init(e) {
  15550. this.cfg = this.cfg.extend(e), this.reset();
  15551. },
  15552. reset: function reset() {
  15553. l.reset.call(this), this._doReset();
  15554. },
  15555. update: function update(e) {
  15556. return this._append(e), this._process(), this;
  15557. },
  15558. finalize: function finalize(e) {
  15559. return e && this._append(e), this._doFinalize();
  15560. },
  15561. blockSize: 16,
  15562. _createHelper: function _createHelper(e) {
  15563. return function (t, n) {
  15564. return new e.init(n).finalize(t);
  15565. };
  15566. },
  15567. _createHmacHelper: function _createHmacHelper(e) {
  15568. return function (t, n) {
  15569. return new d.HMAC.init(e, n).finalize(t);
  15570. };
  15571. }
  15572. });
  15573. var d = s.algo = {};
  15574. return s;
  15575. }(Math), n);
  15576. }),
  15577. i = r,
  15578. o = (s(function (e, t) {
  15579. var n;
  15580. e.exports = (n = i, function (e) {
  15581. var t = n,
  15582. s = t.lib,
  15583. r = s.WordArray,
  15584. i = s.Hasher,
  15585. o = t.algo,
  15586. a = [];
  15587. !function () {
  15588. for (var t = 0; t < 64; t++) {
  15589. a[t] = 4294967296 * e.abs(e.sin(t + 1)) | 0;
  15590. }
  15591. }();
  15592. var c = o.MD5 = i.extend({
  15593. _doReset: function _doReset() {
  15594. this._hash = new r.init([1732584193, 4023233417, 2562383102, 271733878]);
  15595. },
  15596. _doProcessBlock: function _doProcessBlock(e, t) {
  15597. for (var n = 0; n < 16; n++) {
  15598. var s = t + n,
  15599. r = e[s];
  15600. e[s] = 16711935 & (r << 8 | r >>> 24) | 4278255360 & (r << 24 | r >>> 8);
  15601. }
  15602. var i = this._hash.words,
  15603. o = e[t + 0],
  15604. c = e[t + 1],
  15605. p = e[t + 2],
  15606. f = e[t + 3],
  15607. g = e[t + 4],
  15608. m = e[t + 5],
  15609. y = e[t + 6],
  15610. _ = e[t + 7],
  15611. w = e[t + 8],
  15612. v = e[t + 9],
  15613. I = e[t + 10],
  15614. S = e[t + 11],
  15615. b = e[t + 12],
  15616. k = e[t + 13],
  15617. C = e[t + 14],
  15618. T = e[t + 15],
  15619. P = i[0],
  15620. A = i[1],
  15621. E = i[2],
  15622. O = i[3];
  15623. P = u(P, A, E, O, o, 7, a[0]), O = u(O, P, A, E, c, 12, a[1]), E = u(E, O, P, A, p, 17, a[2]), A = u(A, E, O, P, f, 22, a[3]), P = u(P, A, E, O, g, 7, a[4]), O = u(O, P, A, E, m, 12, a[5]), E = u(E, O, P, A, y, 17, a[6]), A = u(A, E, O, P, _, 22, a[7]), P = u(P, A, E, O, w, 7, a[8]), O = u(O, P, A, E, v, 12, a[9]), E = u(E, O, P, A, I, 17, a[10]), A = u(A, E, O, P, S, 22, a[11]), P = u(P, A, E, O, b, 7, a[12]), O = u(O, P, A, E, k, 12, a[13]), E = u(E, O, P, A, C, 17, a[14]), P = h(P, A = u(A, E, O, P, T, 22, a[15]), E, O, c, 5, a[16]), O = h(O, P, A, E, y, 9, a[17]), E = h(E, O, P, A, S, 14, a[18]), A = h(A, E, O, P, o, 20, a[19]), P = h(P, A, E, O, m, 5, a[20]), O = h(O, P, A, E, I, 9, a[21]), E = h(E, O, P, A, T, 14, a[22]), A = h(A, E, O, P, g, 20, a[23]), P = h(P, A, E, O, v, 5, a[24]), O = h(O, P, A, E, C, 9, a[25]), E = h(E, O, P, A, f, 14, a[26]), A = h(A, E, O, P, w, 20, a[27]), P = h(P, A, E, O, k, 5, a[28]), O = h(O, P, A, E, p, 9, a[29]), E = h(E, O, P, A, _, 14, a[30]), P = l(P, A = h(A, E, O, P, b, 20, a[31]), E, O, m, 4, a[32]), O = l(O, P, A, E, w, 11, a[33]), E = l(E, O, P, A, S, 16, a[34]), A = l(A, E, O, P, C, 23, a[35]), P = l(P, A, E, O, c, 4, a[36]), O = l(O, P, A, E, g, 11, a[37]), E = l(E, O, P, A, _, 16, a[38]), A = l(A, E, O, P, I, 23, a[39]), P = l(P, A, E, O, k, 4, a[40]), O = l(O, P, A, E, o, 11, a[41]), E = l(E, O, P, A, f, 16, a[42]), A = l(A, E, O, P, y, 23, a[43]), P = l(P, A, E, O, v, 4, a[44]), O = l(O, P, A, E, b, 11, a[45]), E = l(E, O, P, A, T, 16, a[46]), P = d(P, A = l(A, E, O, P, p, 23, a[47]), E, O, o, 6, a[48]), O = d(O, P, A, E, _, 10, a[49]), E = d(E, O, P, A, C, 15, a[50]), A = d(A, E, O, P, m, 21, a[51]), P = d(P, A, E, O, b, 6, a[52]), O = d(O, P, A, E, f, 10, a[53]), E = d(E, O, P, A, I, 15, a[54]), A = d(A, E, O, P, c, 21, a[55]), P = d(P, A, E, O, w, 6, a[56]), O = d(O, P, A, E, T, 10, a[57]), E = d(E, O, P, A, y, 15, a[58]), A = d(A, E, O, P, k, 21, a[59]), P = d(P, A, E, O, g, 6, a[60]), O = d(O, P, A, E, S, 10, a[61]), E = d(E, O, P, A, p, 15, a[62]), A = d(A, E, O, P, v, 21, a[63]), i[0] = i[0] + P | 0, i[1] = i[1] + A | 0, i[2] = i[2] + E | 0, i[3] = i[3] + O | 0;
  15624. },
  15625. _doFinalize: function _doFinalize() {
  15626. var t = this._data,
  15627. n = t.words,
  15628. s = 8 * this._nDataBytes,
  15629. r = 8 * t.sigBytes;
  15630. n[r >>> 5] |= 128 << 24 - r % 32;
  15631. var i = e.floor(s / 4294967296),
  15632. o = s;
  15633. n[15 + (r + 64 >>> 9 << 4)] = 16711935 & (i << 8 | i >>> 24) | 4278255360 & (i << 24 | i >>> 8), n[14 + (r + 64 >>> 9 << 4)] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), t.sigBytes = 4 * (n.length + 1), this._process();
  15634. for (var a = this._hash, c = a.words, u = 0; u < 4; u++) {
  15635. var h = c[u];
  15636. c[u] = 16711935 & (h << 8 | h >>> 24) | 4278255360 & (h << 24 | h >>> 8);
  15637. }
  15638. return a;
  15639. },
  15640. clone: function clone() {
  15641. var e = i.clone.call(this);
  15642. return e._hash = this._hash.clone(), e;
  15643. }
  15644. });
  15645. function u(e, t, n, s, r, i, o) {
  15646. var a = e + (t & n | ~t & s) + r + o;
  15647. return (a << i | a >>> 32 - i) + t;
  15648. }
  15649. function h(e, t, n, s, r, i, o) {
  15650. var a = e + (t & s | n & ~s) + r + o;
  15651. return (a << i | a >>> 32 - i) + t;
  15652. }
  15653. function l(e, t, n, s, r, i, o) {
  15654. var a = e + (t ^ n ^ s) + r + o;
  15655. return (a << i | a >>> 32 - i) + t;
  15656. }
  15657. function d(e, t, n, s, r, i, o) {
  15658. var a = e + (n ^ (t | ~s)) + r + o;
  15659. return (a << i | a >>> 32 - i) + t;
  15660. }
  15661. t.MD5 = i._createHelper(c), t.HmacMD5 = i._createHmacHelper(c);
  15662. }(Math), n.MD5);
  15663. }), s(function (e, t) {
  15664. var n;
  15665. e.exports = (n = i, void function () {
  15666. var e = n,
  15667. t = e.lib.Base,
  15668. s = e.enc.Utf8;
  15669. e.algo.HMAC = t.extend({
  15670. init: function init(e, t) {
  15671. e = this._hasher = new e.init(), "string" == typeof t && (t = s.parse(t));
  15672. var n = e.blockSize,
  15673. r = 4 * n;
  15674. t.sigBytes > r && (t = e.finalize(t)), t.clamp();
  15675. for (var i = this._oKey = t.clone(), o = this._iKey = t.clone(), a = i.words, c = o.words, u = 0; u < n; u++) {
  15676. a[u] ^= 1549556828, c[u] ^= 909522486;
  15677. }
  15678. i.sigBytes = o.sigBytes = r, this.reset();
  15679. },
  15680. reset: function reset() {
  15681. var e = this._hasher;
  15682. e.reset(), e.update(this._iKey);
  15683. },
  15684. update: function update(e) {
  15685. return this._hasher.update(e), this;
  15686. },
  15687. finalize: function finalize(e) {
  15688. var t = this._hasher,
  15689. n = t.finalize(e);
  15690. return t.reset(), t.finalize(this._oKey.clone().concat(n));
  15691. }
  15692. });
  15693. }());
  15694. }), s(function (e, t) {
  15695. e.exports = i.HmacMD5;
  15696. })),
  15697. a = s(function (e, t) {
  15698. e.exports = i.enc.Utf8;
  15699. }),
  15700. c = s(function (e, t) {
  15701. var n;
  15702. e.exports = (n = i, function () {
  15703. var e = n,
  15704. t = e.lib.WordArray;
  15705. function s(e, n, s) {
  15706. for (var r = [], i = 0, o = 0; o < n; o++) {
  15707. if (o % 4) {
  15708. var a = s[e.charCodeAt(o - 1)] << o % 4 * 2,
  15709. c = s[e.charCodeAt(o)] >>> 6 - o % 4 * 2;
  15710. r[i >>> 2] |= (a | c) << 24 - i % 4 * 8, i++;
  15711. }
  15712. }
  15713. return t.create(r, i);
  15714. }
  15715. e.enc.Base64 = {
  15716. stringify: function stringify(e) {
  15717. var t = e.words,
  15718. n = e.sigBytes,
  15719. s = this._map;
  15720. e.clamp();
  15721. for (var r = [], i = 0; i < n; i += 3) {
  15722. for (var o = (t[i >>> 2] >>> 24 - i % 4 * 8 & 255) << 16 | (t[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 255) << 8 | t[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255, a = 0; a < 4 && i + .75 * a < n; a++) {
  15723. r.push(s.charAt(o >>> 6 * (3 - a) & 63));
  15724. }
  15725. }
  15726. var c = s.charAt(64);
  15727. if (c) for (; r.length % 4;) {
  15728. r.push(c);
  15729. }
  15730. return r.join("");
  15731. },
  15732. parse: function parse(e) {
  15733. var t = e.length,
  15734. n = this._map,
  15735. r = this._reverseMap;
  15736. if (!r) {
  15737. r = this._reverseMap = [];
  15738. for (var i = 0; i < n.length; i++) {
  15739. r[n.charCodeAt(i)] = i;
  15740. }
  15741. }
  15742. var o = n.charAt(64);
  15743. if (o) {
  15744. var a = e.indexOf(o);
  15745. -1 !== a && (t = a);
  15746. }
  15747. return s(e, t, r);
  15748. },
  15749. _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
  15750. };
  15751. }(), n.enc.Base64);
  15752. });
  15753. var u = "FUNCTION",
  15754. h = "OBJECT",
  15755. l = "CLIENT_DB",
  15756. d = "pending",
  15757. p = "fullfilled",
  15758. f = "rejected";
  15759. function g(e) {
  15760. return Object.prototype.toString.call(e).slice(8, -1).toLowerCase();
  15761. }
  15762. function m(e) {
  15763. return "object" === g(e);
  15764. }
  15765. function y(e) {
  15766. return "function" == typeof e;
  15767. }
  15768. function _(e) {
  15769. return function () {
  15770. try {
  15771. return e.apply(e, arguments);
  15772. } catch (e) {
  15773. console.error(e);
  15774. }
  15775. };
  15776. }
  15777. var w = "REJECTED",
  15778. v = "NOT_PENDING";
  15779. var I = /*#__PURE__*/function () {
  15780. function I() {
  15781. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  15782. e = _ref.createPromise,
  15783. _ref$retryRule = _ref.retryRule,
  15784. t = _ref$retryRule === void 0 ? w : _ref$retryRule;
  15785. (0, _classCallCheck2.default)(this, I);
  15786. this.createPromise = e, this.status = null, this.promise = null, this.retryRule = t;
  15787. }
  15788. (0, _createClass2.default)(I, [{
  15789. key: "needRetry",
  15790. get: function get() {
  15791. if (!this.status) return !0;
  15792. switch (this.retryRule) {
  15793. case w:
  15794. return this.status === f;
  15795. case v:
  15796. return this.status !== d;
  15797. }
  15798. }
  15799. }, {
  15800. key: "exec",
  15801. value: function exec() {
  15802. var _this = this;
  15803. return this.needRetry ? (this.status = d, this.promise = this.createPromise().then(function (e) {
  15804. return _this.status = p, Promise.resolve(e);
  15805. }, function (e) {
  15806. return _this.status = f, Promise.reject(e);
  15807. }), this.promise) : this.promise;
  15808. }
  15809. }]);
  15810. return I;
  15811. }();
  15812. function S(e) {
  15813. return e && "string" == typeof e ? JSON.parse(e) : e;
  15814. }
  15815. var b = "development" === "development",
  15816. k = "mp-weixin",
  15817. C = "true" === undefined || !0 === undefined,
  15818. T = S([]),
  15819. P = "h5" === k ? "web" : "app-plus" === k ? "app" : k,
  15820. A = S(undefined),
  15821. E = S(undefined) || [],
  15822. O = true;
  15823. var x = "";
  15824. try {
  15825. x = (__webpack_require__(/*! uni-stat-config */ 705).default || __webpack_require__(/*! uni-stat-config */ 705)).appid;
  15826. } catch (e) {}
  15827. var R = {};
  15828. function U(e) {
  15829. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  15830. var n, s;
  15831. return n = R, s = e, Object.prototype.hasOwnProperty.call(n, s) || (R[e] = t), R[e];
  15832. }
  15833. "app" === P && (R = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {});
  15834. var L = ["invoke", "success", "fail", "complete"],
  15835. N = U("_globalUniCloudInterceptor");
  15836. function D(e, t) {
  15837. N[e] || (N[e] = {}), m(t) && Object.keys(t).forEach(function (n) {
  15838. L.indexOf(n) > -1 && function (e, t, n) {
  15839. var s = N[e][t];
  15840. s || (s = N[e][t] = []), -1 === s.indexOf(n) && y(n) && s.push(n);
  15841. }(e, n, t[n]);
  15842. });
  15843. }
  15844. function F(e, t) {
  15845. N[e] || (N[e] = {}), m(t) ? Object.keys(t).forEach(function (n) {
  15846. L.indexOf(n) > -1 && function (e, t, n) {
  15847. var s = N[e][t];
  15848. if (!s) return;
  15849. var r = s.indexOf(n);
  15850. r > -1 && s.splice(r, 1);
  15851. }(e, n, t[n]);
  15852. }) : delete N[e];
  15853. }
  15854. function q(e, t) {
  15855. return e && 0 !== e.length ? e.reduce(function (e, n) {
  15856. return e.then(function () {
  15857. return n(t);
  15858. });
  15859. }, Promise.resolve()) : Promise.resolve();
  15860. }
  15861. function M(e, t) {
  15862. return N[e] && N[e][t] || [];
  15863. }
  15864. function K(e) {
  15865. D("callObject", e);
  15866. }
  15867. var j = U("_globalUniCloudListener"),
  15868. B = "response",
  15869. $ = "needLogin",
  15870. W = "refreshToken",
  15871. z = "clientdb",
  15872. J = "cloudfunction",
  15873. H = "cloudobject";
  15874. function G(e) {
  15875. return j[e] || (j[e] = []), j[e];
  15876. }
  15877. function V(e, t) {
  15878. var n = G(e);
  15879. n.includes(t) || n.push(t);
  15880. }
  15881. function Y(e, t) {
  15882. var n = G(e),
  15883. s = n.indexOf(t);
  15884. -1 !== s && n.splice(s, 1);
  15885. }
  15886. function Q(e, t) {
  15887. var n = G(e);
  15888. for (var _e2 = 0; _e2 < n.length; _e2++) {
  15889. (0, n[_e2])(t);
  15890. }
  15891. }
  15892. var X,
  15893. Z = !1;
  15894. function ee() {
  15895. return X || (X = new Promise(function (e) {
  15896. Z && e(), function t() {
  15897. if ("function" == typeof getCurrentPages) {
  15898. var _t2 = getCurrentPages();
  15899. _t2 && _t2[0] && (Z = !0, e());
  15900. }
  15901. Z || setTimeout(function () {
  15902. t();
  15903. }, 30);
  15904. }();
  15905. }), X);
  15906. }
  15907. function te(e) {
  15908. var t = {};
  15909. for (var _n2 in e) {
  15910. var _s2 = e[_n2];
  15911. y(_s2) && (t[_n2] = _(_s2));
  15912. }
  15913. return t;
  15914. }
  15915. var ne = /*#__PURE__*/function (_Error) {
  15916. (0, _inherits2.default)(ne, _Error);
  15917. var _super = _createSuper(ne);
  15918. function ne(e) {
  15919. var _this2;
  15920. (0, _classCallCheck2.default)(this, ne);
  15921. _this2 = _super.call(this, e.message), _this2.errMsg = e.message || e.errMsg || "unknown system error", _this2.code = _this2.errCode = e.code || e.errCode || "SYSTEM_ERROR", _this2.errSubject = _this2.subject = e.subject || e.errSubject, _this2.cause = e.cause, _this2.requestId = e.requestId;
  15922. return _this2;
  15923. }
  15924. (0, _createClass2.default)(ne, [{
  15925. key: "toJson",
  15926. value: function toJson() {
  15927. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  15928. if (!(e >= 10)) return e++, {
  15929. errCode: this.errCode,
  15930. errMsg: this.errMsg,
  15931. errSubject: this.errSubject,
  15932. cause: this.cause && this.cause.toJson ? this.cause.toJson(e) : this.cause
  15933. };
  15934. }
  15935. }]);
  15936. return ne;
  15937. }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
  15938. var se = {
  15939. request: function request(e) {
  15940. return uni.request(e);
  15941. },
  15942. uploadFile: function uploadFile(e) {
  15943. return uni.uploadFile(e);
  15944. },
  15945. setStorageSync: function setStorageSync(e, t) {
  15946. return uni.setStorageSync(e, t);
  15947. },
  15948. getStorageSync: function getStorageSync(e) {
  15949. return uni.getStorageSync(e);
  15950. },
  15951. removeStorageSync: function removeStorageSync(e) {
  15952. return uni.removeStorageSync(e);
  15953. },
  15954. clearStorageSync: function clearStorageSync() {
  15955. return uni.clearStorageSync();
  15956. }
  15957. };
  15958. function re() {
  15959. return {
  15960. token: se.getStorageSync("uni_id_token") || se.getStorageSync("uniIdToken"),
  15961. tokenExpired: se.getStorageSync("uni_id_token_expired")
  15962. };
  15963. }
  15964. function ie() {
  15965. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  15966. e = _ref2.token,
  15967. t = _ref2.tokenExpired;
  15968. e && se.setStorageSync("uni_id_token", e), t && se.setStorageSync("uni_id_token_expired", t);
  15969. }
  15970. var oe, ae;
  15971. function ce() {
  15972. return oe || (oe = uni.getSystemInfoSync()), oe;
  15973. }
  15974. function ue() {
  15975. var e, t;
  15976. try {
  15977. if (uni.getLaunchOptionsSync) {
  15978. if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1) return;
  15979. var _uni$getLaunchOptions = uni.getLaunchOptionsSync(),
  15980. _n3 = _uni$getLaunchOptions.scene,
  15981. _s3 = _uni$getLaunchOptions.channel;
  15982. e = _s3, t = _n3;
  15983. }
  15984. } catch (e) {}
  15985. return {
  15986. channel: e,
  15987. scene: t
  15988. };
  15989. }
  15990. function he() {
  15991. var e = uni.getLocale && uni.getLocale() || "en";
  15992. if (ae) return _objectSpread(_objectSpread({}, ae), {}, {
  15993. locale: e,
  15994. LOCALE: e
  15995. });
  15996. var t = ce(),
  15997. n = t.deviceId,
  15998. s = t.osName,
  15999. r = t.uniPlatform,
  16000. i = t.appId,
  16001. o = ["pixelRatio", "brand", "model", "system", "language", "version", "platform", "host", "SDKVersion", "swanNativeVersion", "app", "AppPlatform", "fontSizeSetting"];
  16002. for (var _e3 = 0; _e3 < o.length; _e3++) {
  16003. delete t[o[_e3]];
  16004. }
  16005. return ae = _objectSpread(_objectSpread({
  16006. PLATFORM: r,
  16007. OS: s,
  16008. APPID: i,
  16009. DEVICEID: n
  16010. }, ue()), t), _objectSpread(_objectSpread({}, ae), {}, {
  16011. locale: e,
  16012. LOCALE: e
  16013. });
  16014. }
  16015. var le = {
  16016. sign: function sign(e, t) {
  16017. var n = "";
  16018. return Object.keys(e).sort().forEach(function (t) {
  16019. e[t] && (n = n + "&" + t + "=" + e[t]);
  16020. }), n = n.slice(1), o(n, t).toString();
  16021. },
  16022. wrappedRequest: function wrappedRequest(e, t) {
  16023. return new Promise(function (n, s) {
  16024. t(Object.assign(e, {
  16025. complete: function complete(e) {
  16026. e || (e = {}), b && "web" === P && e.errMsg && 0 === e.errMsg.indexOf("request:fail") && console.warn("发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5");
  16027. var t = e.data && e.data.header && e.data.header["x-serverless-request-id"] || e.header && e.header["request-id"];
  16028. if (!e.statusCode || e.statusCode >= 400) return s(new ne({
  16029. code: "SYS_ERR",
  16030. message: e.errMsg || "request:fail",
  16031. requestId: t
  16032. }));
  16033. var r = e.data;
  16034. if (r.error) return s(new ne({
  16035. code: r.error.code,
  16036. message: r.error.message,
  16037. requestId: t
  16038. }));
  16039. r.result = r.data, r.requestId = t, delete r.data, n(r);
  16040. }
  16041. }));
  16042. });
  16043. },
  16044. toBase64: function toBase64(e) {
  16045. return c.stringify(a.parse(e));
  16046. }
  16047. },
  16048. de = {
  16049. "uniCloud.init.paramRequired": "{param} required",
  16050. "uniCloud.uploadFile.fileError": "filePath should be instance of File"
  16051. };
  16052. var _e4 = (0, _uniI18n.initVueI18n)({
  16053. "zh-Hans": {
  16054. "uniCloud.init.paramRequired": "缺少参数:{param}",
  16055. "uniCloud.uploadFile.fileError": "filePath应为File对象"
  16056. },
  16057. "zh-Hant": {
  16058. "uniCloud.init.paramRequired": "缺少参数:{param}",
  16059. "uniCloud.uploadFile.fileError": "filePath应为File对象"
  16060. },
  16061. en: de,
  16062. fr: {
  16063. "uniCloud.init.paramRequired": "{param} required",
  16064. "uniCloud.uploadFile.fileError": "filePath should be instance of File"
  16065. },
  16066. es: {
  16067. "uniCloud.init.paramRequired": "{param} required",
  16068. "uniCloud.uploadFile.fileError": "filePath should be instance of File"
  16069. },
  16070. ja: de
  16071. }, "zh-Hans"),
  16072. pe = _e4.t;
  16073. var fe = /*#__PURE__*/function () {
  16074. function fe(e) {
  16075. var _this3 = this;
  16076. (0, _classCallCheck2.default)(this, fe);
  16077. ["spaceId", "clientSecret"].forEach(function (t) {
  16078. if (!Object.prototype.hasOwnProperty.call(e, t)) throw new Error(pe("uniCloud.init.paramRequired", {
  16079. param: t
  16080. }));
  16081. }), this.config = Object.assign({}, {
  16082. endpoint: 0 === e.spaceId.indexOf("mp-") ? "https://api.next.bspapp.com" : "https://api.bspapp.com"
  16083. }, e), this.config.provider = "aliyun", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.config.accessTokenKey = "access_token_" + this.config.spaceId, this.adapter = se, this._getAccessTokenPromiseHub = new I({
  16084. createPromise: function createPromise() {
  16085. return _this3.requestAuth(_this3.setupRequest({
  16086. method: "serverless.auth.user.anonymousAuthorize",
  16087. params: "{}"
  16088. }, "auth")).then(function (e) {
  16089. if (!e.result || !e.result.accessToken) throw new ne({
  16090. code: "AUTH_FAILED",
  16091. message: "获取accessToken失败"
  16092. });
  16093. _this3.setAccessToken(e.result.accessToken);
  16094. });
  16095. },
  16096. retryRule: v
  16097. });
  16098. }
  16099. (0, _createClass2.default)(fe, [{
  16100. key: "hasAccessToken",
  16101. get: function get() {
  16102. return !!this.accessToken;
  16103. }
  16104. }, {
  16105. key: "setAccessToken",
  16106. value: function setAccessToken(e) {
  16107. this.accessToken = e;
  16108. }
  16109. }, {
  16110. key: "requestWrapped",
  16111. value: function requestWrapped(e) {
  16112. return le.wrappedRequest(e, this.adapter.request);
  16113. }
  16114. }, {
  16115. key: "requestAuth",
  16116. value: function requestAuth(e) {
  16117. return this.requestWrapped(e);
  16118. }
  16119. }, {
  16120. key: "request",
  16121. value: function request(e, t) {
  16122. var _this4 = this;
  16123. return Promise.resolve().then(function () {
  16124. return _this4.hasAccessToken ? t ? _this4.requestWrapped(e) : _this4.requestWrapped(e).catch(function (t) {
  16125. return new Promise(function (e, n) {
  16126. !t || "GATEWAY_INVALID_TOKEN" !== t.code && "InvalidParameter.InvalidToken" !== t.code ? n(t) : e();
  16127. }).then(function () {
  16128. return _this4.getAccessToken();
  16129. }).then(function () {
  16130. var t = _this4.rebuildRequest(e);
  16131. return _this4.request(t, !0);
  16132. });
  16133. }) : _this4.getAccessToken().then(function () {
  16134. var t = _this4.rebuildRequest(e);
  16135. return _this4.request(t, !0);
  16136. });
  16137. });
  16138. }
  16139. }, {
  16140. key: "rebuildRequest",
  16141. value: function rebuildRequest(e) {
  16142. var t = Object.assign({}, e);
  16143. return t.data.token = this.accessToken, t.header["x-basement-token"] = this.accessToken, t.header["x-serverless-sign"] = le.sign(t.data, this.config.clientSecret), t;
  16144. }
  16145. }, {
  16146. key: "setupRequest",
  16147. value: function setupRequest(e, t) {
  16148. var n = Object.assign({}, e, {
  16149. spaceId: this.config.spaceId,
  16150. timestamp: Date.now()
  16151. }),
  16152. s = {
  16153. "Content-Type": "application/json"
  16154. };
  16155. return "auth" !== t && (n.token = this.accessToken, s["x-basement-token"] = this.accessToken), s["x-serverless-sign"] = le.sign(n, this.config.clientSecret), {
  16156. url: this.config.requestUrl,
  16157. method: "POST",
  16158. data: n,
  16159. dataType: "json",
  16160. header: s
  16161. };
  16162. }
  16163. }, {
  16164. key: "getAccessToken",
  16165. value: function getAccessToken() {
  16166. return this._getAccessTokenPromiseHub.exec();
  16167. }
  16168. }, {
  16169. key: "authorize",
  16170. value: function () {
  16171. var _authorize = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  16172. return _regenerator.default.wrap(function _callee$(_context) {
  16173. while (1) {
  16174. switch (_context.prev = _context.next) {
  16175. case 0:
  16176. _context.next = 2;
  16177. return this.getAccessToken();
  16178. case 2:
  16179. case "end":
  16180. return _context.stop();
  16181. }
  16182. }
  16183. }, _callee, this);
  16184. }));
  16185. function authorize() {
  16186. return _authorize.apply(this, arguments);
  16187. }
  16188. return authorize;
  16189. }()
  16190. }, {
  16191. key: "callFunction",
  16192. value: function callFunction(e) {
  16193. var t = {
  16194. method: "serverless.function.runtime.invoke",
  16195. params: JSON.stringify({
  16196. functionTarget: e.name,
  16197. functionArgs: e.data || {}
  16198. })
  16199. };
  16200. return this.request(this.setupRequest(t));
  16201. }
  16202. }, {
  16203. key: "getOSSUploadOptionsFromPath",
  16204. value: function getOSSUploadOptionsFromPath(e) {
  16205. var t = {
  16206. method: "serverless.file.resource.generateProximalSign",
  16207. params: JSON.stringify(e)
  16208. };
  16209. return this.request(this.setupRequest(t));
  16210. }
  16211. }, {
  16212. key: "uploadFileToOSS",
  16213. value: function uploadFileToOSS(_ref3) {
  16214. var _this5 = this;
  16215. var e = _ref3.url,
  16216. t = _ref3.formData,
  16217. n = _ref3.name,
  16218. s = _ref3.filePath,
  16219. r = _ref3.fileType,
  16220. i = _ref3.onUploadProgress;
  16221. return new Promise(function (o, a) {
  16222. var c = _this5.adapter.uploadFile({
  16223. url: e,
  16224. formData: t,
  16225. name: n,
  16226. filePath: s,
  16227. fileType: r,
  16228. header: {
  16229. "X-OSS-server-side-encrpytion": "AES256"
  16230. },
  16231. success: function success(e) {
  16232. e && e.statusCode < 400 ? o(e) : a(new ne({
  16233. code: "UPLOAD_FAILED",
  16234. message: "文件上传失败"
  16235. }));
  16236. },
  16237. fail: function fail(e) {
  16238. a(new ne({
  16239. code: e.code || "UPLOAD_FAILED",
  16240. message: e.message || e.errMsg || "文件上传失败"
  16241. }));
  16242. }
  16243. });
  16244. "function" == typeof i && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {
  16245. i({
  16246. loaded: e.totalBytesSent,
  16247. total: e.totalBytesExpectedToSend
  16248. });
  16249. });
  16250. });
  16251. }
  16252. }, {
  16253. key: "reportOSSUpload",
  16254. value: function reportOSSUpload(e) {
  16255. var t = {
  16256. method: "serverless.file.resource.report",
  16257. params: JSON.stringify(e)
  16258. };
  16259. return this.request(this.setupRequest(t));
  16260. }
  16261. }, {
  16262. key: "uploadFile",
  16263. value: function () {
  16264. var _uploadFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref4) {
  16265. var e, t, _ref4$fileType, n, _ref4$cloudPathAsReal, s, r, i, o, a, c, u, h, l, d, p, f, m, y, _, _e5, w;
  16266. return _regenerator.default.wrap(function _callee2$(_context2) {
  16267. while (1) {
  16268. switch (_context2.prev = _context2.next) {
  16269. case 0:
  16270. e = _ref4.filePath, t = _ref4.cloudPath, _ref4$fileType = _ref4.fileType, n = _ref4$fileType === void 0 ? "image" : _ref4$fileType, _ref4$cloudPathAsReal = _ref4.cloudPathAsRealPath, s = _ref4$cloudPathAsReal === void 0 ? !1 : _ref4$cloudPathAsReal, r = _ref4.onUploadProgress, i = _ref4.config;
  16271. if (!("string" !== g(t))) {
  16272. _context2.next = 3;
  16273. break;
  16274. }
  16275. throw new ne({
  16276. code: "INVALID_PARAM",
  16277. message: "cloudPath必须为字符串类型"
  16278. });
  16279. case 3:
  16280. if (t = t.trim()) {
  16281. _context2.next = 5;
  16282. break;
  16283. }
  16284. throw new ne({
  16285. code: "INVALID_PARAM",
  16286. message: "cloudPath不可为空"
  16287. });
  16288. case 5:
  16289. if (!/:\/\//.test(t)) {
  16290. _context2.next = 7;
  16291. break;
  16292. }
  16293. throw new ne({
  16294. code: "INVALID_PARAM",
  16295. message: "cloudPath不合法"
  16296. });
  16297. case 7:
  16298. o = i && i.envType || this.config.envType;
  16299. if (!(s && ("/" !== t[0] && (t = "/" + t), t.indexOf("\\") > -1))) {
  16300. _context2.next = 10;
  16301. break;
  16302. }
  16303. throw new ne({
  16304. code: "INVALID_PARAM",
  16305. message: "使用cloudPath作为路径时,cloudPath不可包含“\\”"
  16306. });
  16307. case 10:
  16308. _context2.next = 12;
  16309. return this.getOSSUploadOptionsFromPath({
  16310. env: o,
  16311. filename: s ? t.split("/").pop() : t,
  16312. fileId: s ? t : void 0
  16313. });
  16314. case 12:
  16315. a = _context2.sent.result;
  16316. c = "https://" + a.cdnDomain + "/" + a.ossPath;
  16317. u = a.securityToken;
  16318. h = a.accessKeyId;
  16319. l = a.signature;
  16320. d = a.host;
  16321. p = a.ossPath;
  16322. f = a.id;
  16323. m = a.policy;
  16324. y = a.ossCallbackUrl;
  16325. _ = {
  16326. "Cache-Control": "max-age=2592000",
  16327. "Content-Disposition": "attachment",
  16328. OSSAccessKeyId: h,
  16329. Signature: l,
  16330. host: d,
  16331. id: f,
  16332. key: p,
  16333. policy: m,
  16334. success_action_status: 200
  16335. };
  16336. if (u && (_["x-oss-security-token"] = u), y) {
  16337. _e5 = JSON.stringify({
  16338. callbackUrl: y,
  16339. callbackBody: JSON.stringify({
  16340. fileId: f,
  16341. spaceId: this.config.spaceId
  16342. }),
  16343. callbackBodyType: "application/json"
  16344. });
  16345. _.callback = le.toBase64(_e5);
  16346. }
  16347. w = {
  16348. url: "https://" + a.host,
  16349. formData: _,
  16350. fileName: "file",
  16351. name: "file",
  16352. filePath: e,
  16353. fileType: n
  16354. };
  16355. _context2.next = 27;
  16356. return this.uploadFileToOSS(Object.assign({}, w, {
  16357. onUploadProgress: r
  16358. }));
  16359. case 27:
  16360. if (!y) {
  16361. _context2.next = 29;
  16362. break;
  16363. }
  16364. return _context2.abrupt("return", {
  16365. success: !0,
  16366. filePath: e,
  16367. fileID: c
  16368. });
  16369. case 29:
  16370. _context2.next = 31;
  16371. return this.reportOSSUpload({
  16372. id: f
  16373. });
  16374. case 31:
  16375. if (!_context2.sent.success) {
  16376. _context2.next = 33;
  16377. break;
  16378. }
  16379. return _context2.abrupt("return", {
  16380. success: !0,
  16381. filePath: e,
  16382. fileID: c
  16383. });
  16384. case 33:
  16385. throw new ne({
  16386. code: "UPLOAD_FAILED",
  16387. message: "文件上传失败"
  16388. });
  16389. case 34:
  16390. case "end":
  16391. return _context2.stop();
  16392. }
  16393. }
  16394. }, _callee2, this);
  16395. }));
  16396. function uploadFile(_x) {
  16397. return _uploadFile.apply(this, arguments);
  16398. }
  16399. return uploadFile;
  16400. }()
  16401. }, {
  16402. key: "getTempFileURL",
  16403. value: function getTempFileURL() {
  16404. var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  16405. e = _ref5.fileList;
  16406. return new Promise(function (t, n) {
  16407. Array.isArray(e) && 0 !== e.length || n(new ne({
  16408. code: "INVALID_PARAM",
  16409. message: "fileList的元素必须是非空的字符串"
  16410. })), t({
  16411. fileList: e.map(function (e) {
  16412. return {
  16413. fileID: e,
  16414. tempFileURL: e
  16415. };
  16416. })
  16417. });
  16418. });
  16419. }
  16420. }, {
  16421. key: "getFileInfo",
  16422. value: function () {
  16423. var _getFileInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
  16424. var _ref6,
  16425. e,
  16426. t,
  16427. _args3 = arguments;
  16428. return _regenerator.default.wrap(function _callee3$(_context3) {
  16429. while (1) {
  16430. switch (_context3.prev = _context3.next) {
  16431. case 0:
  16432. _ref6 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, e = _ref6.fileList;
  16433. if (!(!Array.isArray(e) || 0 === e.length)) {
  16434. _context3.next = 3;
  16435. break;
  16436. }
  16437. throw new ne({
  16438. code: "INVALID_PARAM",
  16439. message: "fileList的元素必须是非空的字符串"
  16440. });
  16441. case 3:
  16442. t = {
  16443. method: "serverless.file.resource.info",
  16444. params: JSON.stringify({
  16445. id: e.map(function (e) {
  16446. return e.split("?")[0];
  16447. }).join(",")
  16448. })
  16449. };
  16450. _context3.next = 6;
  16451. return this.request(this.setupRequest(t));
  16452. case 6:
  16453. _context3.t0 = _context3.sent.result;
  16454. return _context3.abrupt("return", {
  16455. fileList: _context3.t0
  16456. });
  16457. case 8:
  16458. case "end":
  16459. return _context3.stop();
  16460. }
  16461. }
  16462. }, _callee3, this);
  16463. }));
  16464. function getFileInfo() {
  16465. return _getFileInfo.apply(this, arguments);
  16466. }
  16467. return getFileInfo;
  16468. }()
  16469. }]);
  16470. return fe;
  16471. }();
  16472. var ge = {
  16473. init: function init(e) {
  16474. var t = new fe(e),
  16475. n = {
  16476. signInAnonymously: function signInAnonymously() {
  16477. return t.authorize();
  16478. },
  16479. getLoginState: function getLoginState() {
  16480. return Promise.resolve(!1);
  16481. }
  16482. };
  16483. return t.auth = function () {
  16484. return n;
  16485. }, t.customAuth = t.auth, t;
  16486. }
  16487. };
  16488. var me = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:";
  16489. var ye;
  16490. !function (e) {
  16491. e.local = "local", e.none = "none", e.session = "session";
  16492. }(ye || (ye = {}));
  16493. var _e = function _e() {};
  16494. var we = function we() {
  16495. var e;
  16496. if (!Promise) {
  16497. e = function e() {}, e.promise = {};
  16498. var _t3 = function _t3() {
  16499. throw new ne({
  16500. message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'
  16501. });
  16502. };
  16503. return Object.defineProperty(e.promise, "then", {
  16504. get: _t3
  16505. }), Object.defineProperty(e.promise, "catch", {
  16506. get: _t3
  16507. }), e;
  16508. }
  16509. var t = new Promise(function (t, n) {
  16510. e = function e(_e6, s) {
  16511. return _e6 ? n(_e6) : t(s);
  16512. };
  16513. });
  16514. return e.promise = t, e;
  16515. };
  16516. function ve(e) {
  16517. return void 0 === e;
  16518. }
  16519. function Ie(e) {
  16520. return "[object Null]" === Object.prototype.toString.call(e);
  16521. }
  16522. var Se;
  16523. function be(e) {
  16524. var t = (n = e, "[object Array]" === Object.prototype.toString.call(n) ? e : [e]);
  16525. var n;
  16526. var _iterator = _createForOfIteratorHelper(t),
  16527. _step;
  16528. try {
  16529. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  16530. var _e7 = _step.value;
  16531. var _t4 = _e7.isMatch,
  16532. _n4 = _e7.genAdapter,
  16533. _s4 = _e7.runtime;
  16534. if (_t4()) return {
  16535. adapter: _n4(),
  16536. runtime: _s4
  16537. };
  16538. }
  16539. } catch (err) {
  16540. _iterator.e(err);
  16541. } finally {
  16542. _iterator.f();
  16543. }
  16544. }
  16545. !function (e) {
  16546. e.WEB = "web", e.WX_MP = "wx_mp";
  16547. }(Se || (Se = {}));
  16548. var ke = {
  16549. adapter: null,
  16550. runtime: void 0
  16551. },
  16552. Ce = ["anonymousUuidKey"];
  16553. var Te = /*#__PURE__*/function (_e8) {
  16554. (0, _inherits2.default)(Te, _e8);
  16555. var _super2 = _createSuper(Te);
  16556. function Te() {
  16557. var _this6;
  16558. (0, _classCallCheck2.default)(this, Te);
  16559. _this6 = _super2.call(this), ke.adapter.root.tcbObject || (ke.adapter.root.tcbObject = {});
  16560. return _this6;
  16561. }
  16562. (0, _createClass2.default)(Te, [{
  16563. key: "setItem",
  16564. value: function setItem(e, t) {
  16565. ke.adapter.root.tcbObject[e] = t;
  16566. }
  16567. }, {
  16568. key: "getItem",
  16569. value: function getItem(e) {
  16570. return ke.adapter.root.tcbObject[e];
  16571. }
  16572. }, {
  16573. key: "removeItem",
  16574. value: function removeItem(e) {
  16575. delete ke.adapter.root.tcbObject[e];
  16576. }
  16577. }, {
  16578. key: "clear",
  16579. value: function clear() {
  16580. delete ke.adapter.root.tcbObject;
  16581. }
  16582. }]);
  16583. return Te;
  16584. }(_e);
  16585. function Pe(e, t) {
  16586. switch (e) {
  16587. case "local":
  16588. return t.localStorage || new Te();
  16589. case "none":
  16590. return new Te();
  16591. default:
  16592. return t.sessionStorage || new Te();
  16593. }
  16594. }
  16595. var Ae = /*#__PURE__*/function () {
  16596. function Ae(e) {
  16597. (0, _classCallCheck2.default)(this, Ae);
  16598. if (!this._storage) {
  16599. this._persistence = ke.adapter.primaryStorage || e.persistence, this._storage = Pe(this._persistence, ke.adapter);
  16600. var _t5 = "access_token_".concat(e.env),
  16601. _n5 = "access_token_expire_".concat(e.env),
  16602. _s5 = "refresh_token_".concat(e.env),
  16603. _r = "anonymous_uuid_".concat(e.env),
  16604. _i = "login_type_".concat(e.env),
  16605. _o = "user_info_".concat(e.env);
  16606. this.keys = {
  16607. accessTokenKey: _t5,
  16608. accessTokenExpireKey: _n5,
  16609. refreshTokenKey: _s5,
  16610. anonymousUuidKey: _r,
  16611. loginTypeKey: _i,
  16612. userInfoKey: _o
  16613. };
  16614. }
  16615. }
  16616. (0, _createClass2.default)(Ae, [{
  16617. key: "updatePersistence",
  16618. value: function updatePersistence(e) {
  16619. if (e === this._persistence) return;
  16620. var t = "local" === this._persistence;
  16621. this._persistence = e;
  16622. var n = Pe(e, ke.adapter);
  16623. for (var _e9 in this.keys) {
  16624. var _s6 = this.keys[_e9];
  16625. if (t && Ce.includes(_e9)) continue;
  16626. var _r2 = this._storage.getItem(_s6);
  16627. ve(_r2) || Ie(_r2) || (n.setItem(_s6, _r2), this._storage.removeItem(_s6));
  16628. }
  16629. this._storage = n;
  16630. }
  16631. }, {
  16632. key: "setStore",
  16633. value: function setStore(e, t, n) {
  16634. if (!this._storage) return;
  16635. var s = {
  16636. version: n || "localCachev1",
  16637. content: t
  16638. },
  16639. r = JSON.stringify(s);
  16640. try {
  16641. this._storage.setItem(e, r);
  16642. } catch (e) {
  16643. throw e;
  16644. }
  16645. }
  16646. }, {
  16647. key: "getStore",
  16648. value: function getStore(e, t) {
  16649. try {
  16650. if (!this._storage) return;
  16651. } catch (e) {
  16652. return "";
  16653. }
  16654. t = t || "localCachev1";
  16655. var n = this._storage.getItem(e);
  16656. if (!n) return "";
  16657. if (n.indexOf(t) >= 0) {
  16658. return JSON.parse(n).content;
  16659. }
  16660. return "";
  16661. }
  16662. }, {
  16663. key: "removeStore",
  16664. value: function removeStore(e) {
  16665. this._storage.removeItem(e);
  16666. }
  16667. }]);
  16668. return Ae;
  16669. }();
  16670. var Ee = {},
  16671. Oe = {};
  16672. function xe(e) {
  16673. return Ee[e];
  16674. }
  16675. var Re = /*#__PURE__*/(0, _createClass2.default)(function Re(e, t) {
  16676. (0, _classCallCheck2.default)(this, Re);
  16677. this.data = t || null, this.name = e;
  16678. });
  16679. var Ue = /*#__PURE__*/function (_Re) {
  16680. (0, _inherits2.default)(Ue, _Re);
  16681. var _super3 = _createSuper(Ue);
  16682. function Ue(e, t) {
  16683. var _this7;
  16684. (0, _classCallCheck2.default)(this, Ue);
  16685. _this7 = _super3.call(this, "error", {
  16686. error: e,
  16687. data: t
  16688. }), _this7.error = e;
  16689. return _this7;
  16690. }
  16691. return (0, _createClass2.default)(Ue);
  16692. }(Re);
  16693. var Le = new ( /*#__PURE__*/function () {
  16694. function _class() {
  16695. (0, _classCallCheck2.default)(this, _class);
  16696. this._listeners = {};
  16697. }
  16698. (0, _createClass2.default)(_class, [{
  16699. key: "on",
  16700. value: function on(e, t) {
  16701. return function (e, t, n) {
  16702. n[e] = n[e] || [], n[e].push(t);
  16703. }(e, t, this._listeners), this;
  16704. }
  16705. }, {
  16706. key: "off",
  16707. value: function off(e, t) {
  16708. return function (e, t, n) {
  16709. if (n && n[e]) {
  16710. var _s7 = n[e].indexOf(t);
  16711. -1 !== _s7 && n[e].splice(_s7, 1);
  16712. }
  16713. }(e, t, this._listeners), this;
  16714. }
  16715. }, {
  16716. key: "fire",
  16717. value: function fire(e, t) {
  16718. if (e instanceof Ue) return console.error(e.error), this;
  16719. var n = "string" == typeof e ? new Re(e, t || {}) : e;
  16720. var s = n.name;
  16721. if (this._listens(s)) {
  16722. n.target = this;
  16723. var _e10 = this._listeners[s] ? (0, _toConsumableArray2.default)(this._listeners[s]) : [];
  16724. var _iterator2 = _createForOfIteratorHelper(_e10),
  16725. _step2;
  16726. try {
  16727. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  16728. var _t6 = _step2.value;
  16729. _t6.call(this, n);
  16730. }
  16731. } catch (err) {
  16732. _iterator2.e(err);
  16733. } finally {
  16734. _iterator2.f();
  16735. }
  16736. }
  16737. return this;
  16738. }
  16739. }, {
  16740. key: "_listens",
  16741. value: function _listens(e) {
  16742. return this._listeners[e] && this._listeners[e].length > 0;
  16743. }
  16744. }]);
  16745. return _class;
  16746. }())();
  16747. function Ne(e, t) {
  16748. Le.on(e, t);
  16749. }
  16750. function De(e) {
  16751. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  16752. Le.fire(e, t);
  16753. }
  16754. function Fe(e, t) {
  16755. Le.off(e, t);
  16756. }
  16757. var qe = "loginStateChanged",
  16758. Me = "loginStateExpire",
  16759. Ke = "loginTypeChanged",
  16760. je = "anonymousConverted",
  16761. Be = "refreshAccessToken";
  16762. var $e;
  16763. !function (e) {
  16764. e.ANONYMOUS = "ANONYMOUS", e.WECHAT = "WECHAT", e.WECHAT_PUBLIC = "WECHAT-PUBLIC", e.WECHAT_OPEN = "WECHAT-OPEN", e.CUSTOM = "CUSTOM", e.EMAIL = "EMAIL", e.USERNAME = "USERNAME", e.NULL = "NULL";
  16765. }($e || ($e = {}));
  16766. var We = ["auth.getJwt", "auth.logout", "auth.signInWithTicket", "auth.signInAnonymously", "auth.signIn", "auth.fetchAccessTokenWithRefreshToken", "auth.signUpWithEmailAndPassword", "auth.activateEndUserMail", "auth.sendPasswordResetEmail", "auth.resetPasswordWithToken", "auth.isUsernameRegistered"],
  16767. ze = {
  16768. "X-SDK-Version": "1.3.5"
  16769. };
  16770. function Je(e, t, n) {
  16771. var s = e[t];
  16772. e[t] = function (t) {
  16773. var r = {},
  16774. i = {};
  16775. n.forEach(function (n) {
  16776. var _n$call = n.call(e, t),
  16777. s = _n$call.data,
  16778. o = _n$call.headers;
  16779. Object.assign(r, s), Object.assign(i, o);
  16780. });
  16781. var o = t.data;
  16782. return o && function () {
  16783. var e;
  16784. if (e = o, "[object FormData]" !== Object.prototype.toString.call(e)) t.data = _objectSpread(_objectSpread({}, o), r);else for (var _e11 in r) {
  16785. o.append(_e11, r[_e11]);
  16786. }
  16787. }(), t.headers = _objectSpread(_objectSpread({}, t.headers || {}), i), s.call(e, t);
  16788. };
  16789. }
  16790. function He() {
  16791. var e = Math.random().toString(16).slice(2);
  16792. return {
  16793. data: {
  16794. seqId: e
  16795. },
  16796. headers: _objectSpread(_objectSpread({}, ze), {}, {
  16797. "x-seqid": e
  16798. })
  16799. };
  16800. }
  16801. var Ge = /*#__PURE__*/function () {
  16802. function Ge() {
  16803. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  16804. (0, _classCallCheck2.default)(this, Ge);
  16805. var t;
  16806. this.config = e, this._reqClass = new ke.adapter.reqClass({
  16807. timeout: this.config.timeout,
  16808. timeoutMsg: "\u8BF7\u6C42\u5728".concat(this.config.timeout / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD"),
  16809. restrictedMethods: ["post"]
  16810. }), this._cache = xe(this.config.env), this._localCache = (t = this.config.env, Oe[t]), Je(this._reqClass, "post", [He]), Je(this._reqClass, "upload", [He]), Je(this._reqClass, "download", [He]);
  16811. }
  16812. (0, _createClass2.default)(Ge, [{
  16813. key: "post",
  16814. value: function () {
  16815. var _post = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(e) {
  16816. return _regenerator.default.wrap(function _callee4$(_context4) {
  16817. while (1) {
  16818. switch (_context4.prev = _context4.next) {
  16819. case 0:
  16820. _context4.next = 2;
  16821. return this._reqClass.post(e);
  16822. case 2:
  16823. return _context4.abrupt("return", _context4.sent);
  16824. case 3:
  16825. case "end":
  16826. return _context4.stop();
  16827. }
  16828. }
  16829. }, _callee4, this);
  16830. }));
  16831. function post(_x2) {
  16832. return _post.apply(this, arguments);
  16833. }
  16834. return post;
  16835. }()
  16836. }, {
  16837. key: "upload",
  16838. value: function () {
  16839. var _upload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(e) {
  16840. return _regenerator.default.wrap(function _callee5$(_context5) {
  16841. while (1) {
  16842. switch (_context5.prev = _context5.next) {
  16843. case 0:
  16844. _context5.next = 2;
  16845. return this._reqClass.upload(e);
  16846. case 2:
  16847. return _context5.abrupt("return", _context5.sent);
  16848. case 3:
  16849. case "end":
  16850. return _context5.stop();
  16851. }
  16852. }
  16853. }, _callee5, this);
  16854. }));
  16855. function upload(_x3) {
  16856. return _upload.apply(this, arguments);
  16857. }
  16858. return upload;
  16859. }()
  16860. }, {
  16861. key: "download",
  16862. value: function () {
  16863. var _download = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(e) {
  16864. return _regenerator.default.wrap(function _callee6$(_context6) {
  16865. while (1) {
  16866. switch (_context6.prev = _context6.next) {
  16867. case 0:
  16868. _context6.next = 2;
  16869. return this._reqClass.download(e);
  16870. case 2:
  16871. return _context6.abrupt("return", _context6.sent);
  16872. case 3:
  16873. case "end":
  16874. return _context6.stop();
  16875. }
  16876. }
  16877. }, _callee6, this);
  16878. }));
  16879. function download(_x4) {
  16880. return _download.apply(this, arguments);
  16881. }
  16882. return download;
  16883. }()
  16884. }, {
  16885. key: "refreshAccessToken",
  16886. value: function () {
  16887. var _refreshAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
  16888. var e, t;
  16889. return _regenerator.default.wrap(function _callee7$(_context7) {
  16890. while (1) {
  16891. switch (_context7.prev = _context7.next) {
  16892. case 0:
  16893. this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken());
  16894. _context7.prev = 1;
  16895. _context7.next = 4;
  16896. return this._refreshAccessTokenPromise;
  16897. case 4:
  16898. e = _context7.sent;
  16899. _context7.next = 10;
  16900. break;
  16901. case 7:
  16902. _context7.prev = 7;
  16903. _context7.t0 = _context7["catch"](1);
  16904. t = _context7.t0;
  16905. case 10:
  16906. if (!(this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t)) {
  16907. _context7.next = 12;
  16908. break;
  16909. }
  16910. throw t;
  16911. case 12:
  16912. return _context7.abrupt("return", e);
  16913. case 13:
  16914. case "end":
  16915. return _context7.stop();
  16916. }
  16917. }
  16918. }, _callee7, this, [[1, 7]]);
  16919. }));
  16920. function refreshAccessToken() {
  16921. return _refreshAccessToken2.apply(this, arguments);
  16922. }
  16923. return refreshAccessToken;
  16924. }()
  16925. }, {
  16926. key: "_refreshAccessToken",
  16927. value: function () {
  16928. var _refreshAccessToken3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
  16929. var _this$_cache$keys, e, t, n, s, r, i, o, a, _e12, _e13, _t7, _s8;
  16930. return _regenerator.default.wrap(function _callee8$(_context8) {
  16931. while (1) {
  16932. switch (_context8.prev = _context8.next) {
  16933. case 0:
  16934. _this$_cache$keys = this._cache.keys, e = _this$_cache$keys.accessTokenKey, t = _this$_cache$keys.accessTokenExpireKey, n = _this$_cache$keys.refreshTokenKey, s = _this$_cache$keys.loginTypeKey, r = _this$_cache$keys.anonymousUuidKey;
  16935. this._cache.removeStore(e), this._cache.removeStore(t);
  16936. i = this._cache.getStore(n);
  16937. if (i) {
  16938. _context8.next = 5;
  16939. break;
  16940. }
  16941. throw new ne({
  16942. message: "未登录CloudBase"
  16943. });
  16944. case 5:
  16945. o = {
  16946. refresh_token: i
  16947. };
  16948. _context8.next = 8;
  16949. return this.request("auth.fetchAccessTokenWithRefreshToken", o);
  16950. case 8:
  16951. a = _context8.sent;
  16952. if (!a.data.code) {
  16953. _context8.next = 21;
  16954. break;
  16955. }
  16956. _e12 = a.data.code;
  16957. if (!("SIGN_PARAM_INVALID" === _e12 || "REFRESH_TOKEN_EXPIRED" === _e12 || "INVALID_REFRESH_TOKEN" === _e12)) {
  16958. _context8.next = 20;
  16959. break;
  16960. }
  16961. if (!(this._cache.getStore(s) === $e.ANONYMOUS && "INVALID_REFRESH_TOKEN" === _e12)) {
  16962. _context8.next = 19;
  16963. break;
  16964. }
  16965. _e13 = this._cache.getStore(r);
  16966. _t7 = this._cache.getStore(n);
  16967. _context8.next = 17;
  16968. return this.send("auth.signInAnonymously", {
  16969. anonymous_uuid: _e13,
  16970. refresh_token: _t7
  16971. });
  16972. case 17:
  16973. _s8 = _context8.sent;
  16974. return _context8.abrupt("return", (this.setRefreshToken(_s8.refresh_token), this._refreshAccessToken()));
  16975. case 19:
  16976. De(Me), this._cache.removeStore(n);
  16977. case 20:
  16978. throw new ne({
  16979. code: a.data.code,
  16980. message: "\u5237\u65B0access token\u5931\u8D25\uFF1A".concat(a.data.code)
  16981. });
  16982. case 21:
  16983. if (!a.data.access_token) {
  16984. _context8.next = 23;
  16985. break;
  16986. }
  16987. return _context8.abrupt("return", (De(Be), this._cache.setStore(e, a.data.access_token), this._cache.setStore(t, a.data.access_token_expire + Date.now()), {
  16988. accessToken: a.data.access_token,
  16989. accessTokenExpire: a.data.access_token_expire
  16990. }));
  16991. case 23:
  16992. a.data.refresh_token && (this._cache.removeStore(n), this._cache.setStore(n, a.data.refresh_token), this._refreshAccessToken());
  16993. case 24:
  16994. case "end":
  16995. return _context8.stop();
  16996. }
  16997. }
  16998. }, _callee8, this);
  16999. }));
  17000. function _refreshAccessToken() {
  17001. return _refreshAccessToken3.apply(this, arguments);
  17002. }
  17003. return _refreshAccessToken;
  17004. }()
  17005. }, {
  17006. key: "getAccessToken",
  17007. value: function () {
  17008. var _getAccessToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
  17009. var _this$_cache$keys2, e, t, n, s, r, i;
  17010. return _regenerator.default.wrap(function _callee9$(_context9) {
  17011. while (1) {
  17012. switch (_context9.prev = _context9.next) {
  17013. case 0:
  17014. _this$_cache$keys2 = this._cache.keys, e = _this$_cache$keys2.accessTokenKey, t = _this$_cache$keys2.accessTokenExpireKey, n = _this$_cache$keys2.refreshTokenKey;
  17015. if (this._cache.getStore(n)) {
  17016. _context9.next = 3;
  17017. break;
  17018. }
  17019. throw new ne({
  17020. message: "refresh token不存在,登录状态异常"
  17021. });
  17022. case 3:
  17023. s = this._cache.getStore(e), r = this._cache.getStore(t), i = !0;
  17024. _context9.t0 = this._shouldRefreshAccessTokenHook;
  17025. if (!_context9.t0) {
  17026. _context9.next = 9;
  17027. break;
  17028. }
  17029. _context9.next = 8;
  17030. return this._shouldRefreshAccessTokenHook(s, r);
  17031. case 8:
  17032. _context9.t0 = !_context9.sent;
  17033. case 9:
  17034. _context9.t1 = _context9.t0;
  17035. if (!_context9.t1) {
  17036. _context9.next = 12;
  17037. break;
  17038. }
  17039. i = !1;
  17040. case 12:
  17041. return _context9.abrupt("return", (!s || !r || r < Date.now()) && i ? this.refreshAccessToken() : {
  17042. accessToken: s,
  17043. accessTokenExpire: r
  17044. });
  17045. case 13:
  17046. case "end":
  17047. return _context9.stop();
  17048. }
  17049. }
  17050. }, _callee9, this);
  17051. }));
  17052. function getAccessToken() {
  17053. return _getAccessToken.apply(this, arguments);
  17054. }
  17055. return getAccessToken;
  17056. }()
  17057. }, {
  17058. key: "request",
  17059. value: function () {
  17060. var _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e, t, n) {
  17061. var s, r, i, _e14, o, _e15, _e16, a, c, u, h, l, d, p, f, g;
  17062. return _regenerator.default.wrap(function _callee10$(_context10) {
  17063. while (1) {
  17064. switch (_context10.prev = _context10.next) {
  17065. case 0:
  17066. s = "x-tcb-trace_".concat(this.config.env);
  17067. r = "application/x-www-form-urlencoded";
  17068. i = _objectSpread({
  17069. action: e,
  17070. env: this.config.env,
  17071. dataVersion: "2019-08-16"
  17072. }, t);
  17073. if (!(-1 === We.indexOf(e))) {
  17074. _context10.next = 10;
  17075. break;
  17076. }
  17077. _e14 = this._cache.keys.refreshTokenKey;
  17078. _context10.t0 = this._cache.getStore(_e14);
  17079. if (!_context10.t0) {
  17080. _context10.next = 10;
  17081. break;
  17082. }
  17083. _context10.next = 9;
  17084. return this.getAccessToken();
  17085. case 9:
  17086. i.access_token = _context10.sent.accessToken;
  17087. case 10:
  17088. if ("storage.uploadFile" === e) {
  17089. o = new FormData();
  17090. for (_e15 in o) {
  17091. o.hasOwnProperty(_e15) && void 0 !== o[_e15] && o.append(_e15, i[_e15]);
  17092. }
  17093. r = "multipart/form-data";
  17094. } else {
  17095. r = "application/json", o = {};
  17096. for (_e16 in i) {
  17097. void 0 !== i[_e16] && (o[_e16] = i[_e16]);
  17098. }
  17099. }
  17100. a = {
  17101. headers: {
  17102. "content-type": r
  17103. }
  17104. };
  17105. n && n.onUploadProgress && (a.onUploadProgress = n.onUploadProgress);
  17106. c = this._localCache.getStore(s);
  17107. c && (a.headers["X-TCB-Trace"] = c);
  17108. u = t.parse, h = t.inQuery, l = t.search;
  17109. d = {
  17110. env: this.config.env
  17111. };
  17112. u && (d.parse = !0), h && (d = _objectSpread(_objectSpread({}, h), d));
  17113. p = function (e, t) {
  17114. var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  17115. var s = /\?/.test(t);
  17116. var r = "";
  17117. for (var _e17 in n) {
  17118. "" === r ? !s && (t += "?") : r += "&", r += "".concat(_e17, "=").concat(encodeURIComponent(n[_e17]));
  17119. }
  17120. return /^http(s)?\:\/\//.test(t += r) ? t : "".concat(e).concat(t);
  17121. }(me, "//tcb-api.tencentcloudapi.com/web", d);
  17122. l && (p += l);
  17123. _context10.next = 22;
  17124. return this.post(_objectSpread({
  17125. url: p,
  17126. data: o
  17127. }, a));
  17128. case 22:
  17129. f = _context10.sent;
  17130. g = f.header && f.header["x-tcb-trace"];
  17131. if (!(g && this._localCache.setStore(s, g), 200 !== Number(f.status) && 200 !== Number(f.statusCode) || !f.data)) {
  17132. _context10.next = 26;
  17133. break;
  17134. }
  17135. throw new ne({
  17136. code: "NETWORK_ERROR",
  17137. message: "network request error"
  17138. });
  17139. case 26:
  17140. return _context10.abrupt("return", f);
  17141. case 27:
  17142. case "end":
  17143. return _context10.stop();
  17144. }
  17145. }
  17146. }, _callee10, this);
  17147. }));
  17148. function request(_x5, _x6, _x7) {
  17149. return _request.apply(this, arguments);
  17150. }
  17151. return request;
  17152. }()
  17153. }, {
  17154. key: "send",
  17155. value: function () {
  17156. var _send = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e) {
  17157. var t,
  17158. n,
  17159. _n6,
  17160. _args11 = arguments;
  17161. return _regenerator.default.wrap(function _callee11$(_context11) {
  17162. while (1) {
  17163. switch (_context11.prev = _context11.next) {
  17164. case 0:
  17165. t = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
  17166. _context11.next = 3;
  17167. return this.request(e, t, {
  17168. onUploadProgress: t.onUploadProgress
  17169. });
  17170. case 3:
  17171. n = _context11.sent;
  17172. if (!("ACCESS_TOKEN_EXPIRED" === n.data.code && -1 === We.indexOf(e))) {
  17173. _context11.next = 13;
  17174. break;
  17175. }
  17176. _context11.next = 7;
  17177. return this.refreshAccessToken();
  17178. case 7:
  17179. _context11.next = 9;
  17180. return this.request(e, t, {
  17181. onUploadProgress: t.onUploadProgress
  17182. });
  17183. case 9:
  17184. _n6 = _context11.sent;
  17185. if (!_n6.data.code) {
  17186. _context11.next = 12;
  17187. break;
  17188. }
  17189. throw new ne({
  17190. code: _n6.data.code,
  17191. message: _n6.data.message
  17192. });
  17193. case 12:
  17194. return _context11.abrupt("return", _n6.data);
  17195. case 13:
  17196. if (!n.data.code) {
  17197. _context11.next = 15;
  17198. break;
  17199. }
  17200. throw new ne({
  17201. code: n.data.code,
  17202. message: n.data.message
  17203. });
  17204. case 15:
  17205. return _context11.abrupt("return", n.data);
  17206. case 16:
  17207. case "end":
  17208. return _context11.stop();
  17209. }
  17210. }
  17211. }, _callee11, this);
  17212. }));
  17213. function send(_x8) {
  17214. return _send.apply(this, arguments);
  17215. }
  17216. return send;
  17217. }()
  17218. }, {
  17219. key: "setRefreshToken",
  17220. value: function setRefreshToken(e) {
  17221. var _this$_cache$keys3 = this._cache.keys,
  17222. t = _this$_cache$keys3.accessTokenKey,
  17223. n = _this$_cache$keys3.accessTokenExpireKey,
  17224. s = _this$_cache$keys3.refreshTokenKey;
  17225. this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);
  17226. }
  17227. }]);
  17228. return Ge;
  17229. }();
  17230. var Ve = {};
  17231. function Ye(e) {
  17232. return Ve[e];
  17233. }
  17234. var Qe = /*#__PURE__*/function () {
  17235. function Qe(e) {
  17236. (0, _classCallCheck2.default)(this, Qe);
  17237. this.config = e, this._cache = xe(e.env), this._request = Ye(e.env);
  17238. }
  17239. (0, _createClass2.default)(Qe, [{
  17240. key: "setRefreshToken",
  17241. value: function setRefreshToken(e) {
  17242. var _this$_cache$keys4 = this._cache.keys,
  17243. t = _this$_cache$keys4.accessTokenKey,
  17244. n = _this$_cache$keys4.accessTokenExpireKey,
  17245. s = _this$_cache$keys4.refreshTokenKey;
  17246. this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);
  17247. }
  17248. }, {
  17249. key: "setAccessToken",
  17250. value: function setAccessToken(e, t) {
  17251. var _this$_cache$keys5 = this._cache.keys,
  17252. n = _this$_cache$keys5.accessTokenKey,
  17253. s = _this$_cache$keys5.accessTokenExpireKey;
  17254. this._cache.setStore(n, e), this._cache.setStore(s, t);
  17255. }
  17256. }, {
  17257. key: "refreshUserInfo",
  17258. value: function () {
  17259. var _refreshUserInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
  17260. var _yield$this$_request$, e;
  17261. return _regenerator.default.wrap(function _callee12$(_context12) {
  17262. while (1) {
  17263. switch (_context12.prev = _context12.next) {
  17264. case 0:
  17265. _context12.next = 2;
  17266. return this._request.send("auth.getUserInfo", {});
  17267. case 2:
  17268. _yield$this$_request$ = _context12.sent;
  17269. e = _yield$this$_request$.data;
  17270. return _context12.abrupt("return", (this.setLocalUserInfo(e), e));
  17271. case 5:
  17272. case "end":
  17273. return _context12.stop();
  17274. }
  17275. }
  17276. }, _callee12, this);
  17277. }));
  17278. function refreshUserInfo() {
  17279. return _refreshUserInfo.apply(this, arguments);
  17280. }
  17281. return refreshUserInfo;
  17282. }()
  17283. }, {
  17284. key: "setLocalUserInfo",
  17285. value: function setLocalUserInfo(e) {
  17286. var t = this._cache.keys.userInfoKey;
  17287. this._cache.setStore(t, e);
  17288. }
  17289. }]);
  17290. return Qe;
  17291. }();
  17292. var Xe = /*#__PURE__*/function () {
  17293. function Xe(e) {
  17294. (0, _classCallCheck2.default)(this, Xe);
  17295. if (!e) throw new ne({
  17296. code: "PARAM_ERROR",
  17297. message: "envId is not defined"
  17298. });
  17299. this._envId = e, this._cache = xe(this._envId), this._request = Ye(this._envId), this.setUserInfo();
  17300. }
  17301. (0, _createClass2.default)(Xe, [{
  17302. key: "linkWithTicket",
  17303. value: function linkWithTicket(e) {
  17304. if ("string" != typeof e) throw new ne({
  17305. code: "PARAM_ERROR",
  17306. message: "ticket must be string"
  17307. });
  17308. return this._request.send("auth.linkWithTicket", {
  17309. ticket: e
  17310. });
  17311. }
  17312. }, {
  17313. key: "linkWithRedirect",
  17314. value: function linkWithRedirect(e) {
  17315. e.signInWithRedirect();
  17316. }
  17317. }, {
  17318. key: "updatePassword",
  17319. value: function updatePassword(e, t) {
  17320. return this._request.send("auth.updatePassword", {
  17321. oldPassword: t,
  17322. newPassword: e
  17323. });
  17324. }
  17325. }, {
  17326. key: "updateEmail",
  17327. value: function updateEmail(e) {
  17328. return this._request.send("auth.updateEmail", {
  17329. newEmail: e
  17330. });
  17331. }
  17332. }, {
  17333. key: "updateUsername",
  17334. value: function updateUsername(e) {
  17335. if ("string" != typeof e) throw new ne({
  17336. code: "PARAM_ERROR",
  17337. message: "username must be a string"
  17338. });
  17339. return this._request.send("auth.updateUsername", {
  17340. username: e
  17341. });
  17342. }
  17343. }, {
  17344. key: "getLinkedUidList",
  17345. value: function () {
  17346. var _getLinkedUidList = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
  17347. var _yield$this$_request$2, e, t, n;
  17348. return _regenerator.default.wrap(function _callee13$(_context13) {
  17349. while (1) {
  17350. switch (_context13.prev = _context13.next) {
  17351. case 0:
  17352. _context13.next = 2;
  17353. return this._request.send("auth.getLinkedUidList", {});
  17354. case 2:
  17355. _yield$this$_request$2 = _context13.sent;
  17356. e = _yield$this$_request$2.data;
  17357. t = !1;
  17358. n = e.users;
  17359. return _context13.abrupt("return", (n.forEach(function (e) {
  17360. e.wxOpenId && e.wxPublicId && (t = !0);
  17361. }), {
  17362. users: n,
  17363. hasPrimaryUid: t
  17364. }));
  17365. case 7:
  17366. case "end":
  17367. return _context13.stop();
  17368. }
  17369. }
  17370. }, _callee13, this);
  17371. }));
  17372. function getLinkedUidList() {
  17373. return _getLinkedUidList.apply(this, arguments);
  17374. }
  17375. return getLinkedUidList;
  17376. }()
  17377. }, {
  17378. key: "setPrimaryUid",
  17379. value: function setPrimaryUid(e) {
  17380. return this._request.send("auth.setPrimaryUid", {
  17381. uid: e
  17382. });
  17383. }
  17384. }, {
  17385. key: "unlink",
  17386. value: function unlink(e) {
  17387. return this._request.send("auth.unlink", {
  17388. platform: e
  17389. });
  17390. }
  17391. }, {
  17392. key: "update",
  17393. value: function () {
  17394. var _update = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(e) {
  17395. var t, n, s, r, i, o, _yield$this$_request$3, a;
  17396. return _regenerator.default.wrap(function _callee14$(_context14) {
  17397. while (1) {
  17398. switch (_context14.prev = _context14.next) {
  17399. case 0:
  17400. t = e.nickName;
  17401. n = e.gender;
  17402. s = e.avatarUrl;
  17403. r = e.province;
  17404. i = e.country;
  17405. o = e.city;
  17406. _context14.next = 8;
  17407. return this._request.send("auth.updateUserInfo", {
  17408. nickName: t,
  17409. gender: n,
  17410. avatarUrl: s,
  17411. province: r,
  17412. country: i,
  17413. city: o
  17414. });
  17415. case 8:
  17416. _yield$this$_request$3 = _context14.sent;
  17417. a = _yield$this$_request$3.data;
  17418. this.setLocalUserInfo(a);
  17419. case 11:
  17420. case "end":
  17421. return _context14.stop();
  17422. }
  17423. }
  17424. }, _callee14, this);
  17425. }));
  17426. function update(_x9) {
  17427. return _update.apply(this, arguments);
  17428. }
  17429. return update;
  17430. }()
  17431. }, {
  17432. key: "refresh",
  17433. value: function () {
  17434. var _refresh = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
  17435. var _yield$this$_request$4, e;
  17436. return _regenerator.default.wrap(function _callee15$(_context15) {
  17437. while (1) {
  17438. switch (_context15.prev = _context15.next) {
  17439. case 0:
  17440. _context15.next = 2;
  17441. return this._request.send("auth.getUserInfo", {});
  17442. case 2:
  17443. _yield$this$_request$4 = _context15.sent;
  17444. e = _yield$this$_request$4.data;
  17445. return _context15.abrupt("return", (this.setLocalUserInfo(e), e));
  17446. case 5:
  17447. case "end":
  17448. return _context15.stop();
  17449. }
  17450. }
  17451. }, _callee15, this);
  17452. }));
  17453. function refresh() {
  17454. return _refresh.apply(this, arguments);
  17455. }
  17456. return refresh;
  17457. }()
  17458. }, {
  17459. key: "setUserInfo",
  17460. value: function setUserInfo() {
  17461. var _this8 = this;
  17462. var e = this._cache.keys.userInfoKey,
  17463. t = this._cache.getStore(e);
  17464. ["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach(function (e) {
  17465. _this8[e] = t[e];
  17466. }), this.location = {
  17467. country: t.country,
  17468. province: t.province,
  17469. city: t.city
  17470. };
  17471. }
  17472. }, {
  17473. key: "setLocalUserInfo",
  17474. value: function setLocalUserInfo(e) {
  17475. var t = this._cache.keys.userInfoKey;
  17476. this._cache.setStore(t, e), this.setUserInfo();
  17477. }
  17478. }]);
  17479. return Xe;
  17480. }();
  17481. var Ze = /*#__PURE__*/function () {
  17482. function Ze(e) {
  17483. (0, _classCallCheck2.default)(this, Ze);
  17484. if (!e) throw new ne({
  17485. code: "PARAM_ERROR",
  17486. message: "envId is not defined"
  17487. });
  17488. this._cache = xe(e);
  17489. var _this$_cache$keys6 = this._cache.keys,
  17490. t = _this$_cache$keys6.refreshTokenKey,
  17491. n = _this$_cache$keys6.accessTokenKey,
  17492. s = _this$_cache$keys6.accessTokenExpireKey,
  17493. r = this._cache.getStore(t),
  17494. i = this._cache.getStore(n),
  17495. o = this._cache.getStore(s);
  17496. this.credential = {
  17497. refreshToken: r,
  17498. accessToken: i,
  17499. accessTokenExpire: o
  17500. }, this.user = new Xe(e);
  17501. }
  17502. (0, _createClass2.default)(Ze, [{
  17503. key: "isAnonymousAuth",
  17504. get: function get() {
  17505. return this.loginType === $e.ANONYMOUS;
  17506. }
  17507. }, {
  17508. key: "isCustomAuth",
  17509. get: function get() {
  17510. return this.loginType === $e.CUSTOM;
  17511. }
  17512. }, {
  17513. key: "isWeixinAuth",
  17514. get: function get() {
  17515. return this.loginType === $e.WECHAT || this.loginType === $e.WECHAT_OPEN || this.loginType === $e.WECHAT_PUBLIC;
  17516. }
  17517. }, {
  17518. key: "loginType",
  17519. get: function get() {
  17520. return this._cache.getStore(this._cache.keys.loginTypeKey);
  17521. }
  17522. }]);
  17523. return Ze;
  17524. }();
  17525. var et = /*#__PURE__*/function (_Qe) {
  17526. (0, _inherits2.default)(et, _Qe);
  17527. var _super4 = _createSuper(et);
  17528. function et() {
  17529. (0, _classCallCheck2.default)(this, et);
  17530. return _super4.apply(this, arguments);
  17531. }
  17532. (0, _createClass2.default)(et, [{
  17533. key: "signIn",
  17534. value: function () {
  17535. var _signIn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
  17536. var _this$_cache$keys7, e, t, n, s, r, _e18;
  17537. return _regenerator.default.wrap(function _callee16$(_context16) {
  17538. while (1) {
  17539. switch (_context16.prev = _context16.next) {
  17540. case 0:
  17541. this._cache.updatePersistence("local");
  17542. _this$_cache$keys7 = this._cache.keys;
  17543. e = _this$_cache$keys7.anonymousUuidKey;
  17544. t = _this$_cache$keys7.refreshTokenKey;
  17545. n = this._cache.getStore(e) || void 0;
  17546. s = this._cache.getStore(t) || void 0;
  17547. _context16.next = 8;
  17548. return this._request.send("auth.signInAnonymously", {
  17549. anonymous_uuid: n,
  17550. refresh_token: s
  17551. });
  17552. case 8:
  17553. r = _context16.sent;
  17554. if (!(r.uuid && r.refresh_token)) {
  17555. _context16.next = 20;
  17556. break;
  17557. }
  17558. this._setAnonymousUUID(r.uuid);
  17559. this.setRefreshToken(r.refresh_token);
  17560. _context16.next = 14;
  17561. return this._request.refreshAccessToken();
  17562. case 14:
  17563. De(qe);
  17564. De(Ke, {
  17565. env: this.config.env,
  17566. loginType: $e.ANONYMOUS,
  17567. persistence: "local"
  17568. });
  17569. _e18 = new Ze(this.config.env);
  17570. _context16.next = 19;
  17571. return _e18.user.refresh();
  17572. case 19:
  17573. return _context16.abrupt("return", _e18);
  17574. case 20:
  17575. throw new ne({
  17576. message: "匿名登录失败"
  17577. });
  17578. case 21:
  17579. case "end":
  17580. return _context16.stop();
  17581. }
  17582. }
  17583. }, _callee16, this);
  17584. }));
  17585. function signIn() {
  17586. return _signIn.apply(this, arguments);
  17587. }
  17588. return signIn;
  17589. }()
  17590. }, {
  17591. key: "linkAndRetrieveDataWithTicket",
  17592. value: function () {
  17593. var _linkAndRetrieveDataWithTicket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(e) {
  17594. var _this$_cache$keys8, t, n, s, r, i;
  17595. return _regenerator.default.wrap(function _callee17$(_context17) {
  17596. while (1) {
  17597. switch (_context17.prev = _context17.next) {
  17598. case 0:
  17599. _this$_cache$keys8 = this._cache.keys;
  17600. t = _this$_cache$keys8.anonymousUuidKey;
  17601. n = _this$_cache$keys8.refreshTokenKey;
  17602. s = this._cache.getStore(t);
  17603. r = this._cache.getStore(n);
  17604. _context17.next = 7;
  17605. return this._request.send("auth.linkAndRetrieveDataWithTicket", {
  17606. anonymous_uuid: s,
  17607. refresh_token: r,
  17608. ticket: e
  17609. });
  17610. case 7:
  17611. i = _context17.sent;
  17612. if (!i.refresh_token) {
  17613. _context17.next = 16;
  17614. break;
  17615. }
  17616. this._clearAnonymousUUID();
  17617. this.setRefreshToken(i.refresh_token);
  17618. _context17.next = 13;
  17619. return this._request.refreshAccessToken();
  17620. case 13:
  17621. De(je, {
  17622. env: this.config.env
  17623. });
  17624. De(Ke, {
  17625. loginType: $e.CUSTOM,
  17626. persistence: "local"
  17627. });
  17628. return _context17.abrupt("return", {
  17629. credential: {
  17630. refreshToken: i.refresh_token
  17631. }
  17632. });
  17633. case 16:
  17634. throw new ne({
  17635. message: "匿名转化失败"
  17636. });
  17637. case 17:
  17638. case "end":
  17639. return _context17.stop();
  17640. }
  17641. }
  17642. }, _callee17, this);
  17643. }));
  17644. function linkAndRetrieveDataWithTicket(_x10) {
  17645. return _linkAndRetrieveDataWithTicket.apply(this, arguments);
  17646. }
  17647. return linkAndRetrieveDataWithTicket;
  17648. }()
  17649. }, {
  17650. key: "_setAnonymousUUID",
  17651. value: function _setAnonymousUUID(e) {
  17652. var _this$_cache$keys9 = this._cache.keys,
  17653. t = _this$_cache$keys9.anonymousUuidKey,
  17654. n = _this$_cache$keys9.loginTypeKey;
  17655. this._cache.removeStore(t), this._cache.setStore(t, e), this._cache.setStore(n, $e.ANONYMOUS);
  17656. }
  17657. }, {
  17658. key: "_clearAnonymousUUID",
  17659. value: function _clearAnonymousUUID() {
  17660. this._cache.removeStore(this._cache.keys.anonymousUuidKey);
  17661. }
  17662. }]);
  17663. return et;
  17664. }(Qe);
  17665. var tt = /*#__PURE__*/function (_Qe2) {
  17666. (0, _inherits2.default)(tt, _Qe2);
  17667. var _super5 = _createSuper(tt);
  17668. function tt() {
  17669. (0, _classCallCheck2.default)(this, tt);
  17670. return _super5.apply(this, arguments);
  17671. }
  17672. (0, _createClass2.default)(tt, [{
  17673. key: "signIn",
  17674. value: function () {
  17675. var _signIn2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(e) {
  17676. var t, n;
  17677. return _regenerator.default.wrap(function _callee18$(_context18) {
  17678. while (1) {
  17679. switch (_context18.prev = _context18.next) {
  17680. case 0:
  17681. if (!("string" != typeof e)) {
  17682. _context18.next = 2;
  17683. break;
  17684. }
  17685. throw new ne({
  17686. code: "PARAM_ERROR",
  17687. message: "ticket must be a string"
  17688. });
  17689. case 2:
  17690. t = this._cache.keys.refreshTokenKey;
  17691. _context18.next = 5;
  17692. return this._request.send("auth.signInWithTicket", {
  17693. ticket: e,
  17694. refresh_token: this._cache.getStore(t) || ""
  17695. });
  17696. case 5:
  17697. n = _context18.sent;
  17698. if (!n.refresh_token) {
  17699. _context18.next = 15;
  17700. break;
  17701. }
  17702. this.setRefreshToken(n.refresh_token);
  17703. _context18.next = 10;
  17704. return this._request.refreshAccessToken();
  17705. case 10:
  17706. De(qe);
  17707. De(Ke, {
  17708. env: this.config.env,
  17709. loginType: $e.CUSTOM,
  17710. persistence: this.config.persistence
  17711. });
  17712. _context18.next = 14;
  17713. return this.refreshUserInfo();
  17714. case 14:
  17715. return _context18.abrupt("return", new Ze(this.config.env));
  17716. case 15:
  17717. throw new ne({
  17718. message: "自定义登录失败"
  17719. });
  17720. case 16:
  17721. case "end":
  17722. return _context18.stop();
  17723. }
  17724. }
  17725. }, _callee18, this);
  17726. }));
  17727. function signIn(_x11) {
  17728. return _signIn2.apply(this, arguments);
  17729. }
  17730. return signIn;
  17731. }()
  17732. }]);
  17733. return tt;
  17734. }(Qe);
  17735. var nt = /*#__PURE__*/function (_Qe3) {
  17736. (0, _inherits2.default)(nt, _Qe3);
  17737. var _super6 = _createSuper(nt);
  17738. function nt() {
  17739. (0, _classCallCheck2.default)(this, nt);
  17740. return _super6.apply(this, arguments);
  17741. }
  17742. (0, _createClass2.default)(nt, [{
  17743. key: "signIn",
  17744. value: function () {
  17745. var _signIn3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(e, t) {
  17746. var n, s, r, i, o;
  17747. return _regenerator.default.wrap(function _callee19$(_context19) {
  17748. while (1) {
  17749. switch (_context19.prev = _context19.next) {
  17750. case 0:
  17751. if (!("string" != typeof e)) {
  17752. _context19.next = 2;
  17753. break;
  17754. }
  17755. throw new ne({
  17756. code: "PARAM_ERROR",
  17757. message: "email must be a string"
  17758. });
  17759. case 2:
  17760. n = this._cache.keys.refreshTokenKey;
  17761. _context19.next = 5;
  17762. return this._request.send("auth.signIn", {
  17763. loginType: "EMAIL",
  17764. email: e,
  17765. password: t,
  17766. refresh_token: this._cache.getStore(n) || ""
  17767. });
  17768. case 5:
  17769. s = _context19.sent;
  17770. r = s.refresh_token;
  17771. i = s.access_token;
  17772. o = s.access_token_expire;
  17773. if (!r) {
  17774. _context19.next = 22;
  17775. break;
  17776. }
  17777. this.setRefreshToken(r);
  17778. if (!(i && o)) {
  17779. _context19.next = 15;
  17780. break;
  17781. }
  17782. this.setAccessToken(i, o);
  17783. _context19.next = 17;
  17784. break;
  17785. case 15:
  17786. _context19.next = 17;
  17787. return this._request.refreshAccessToken();
  17788. case 17:
  17789. _context19.next = 19;
  17790. return this.refreshUserInfo();
  17791. case 19:
  17792. De(qe);
  17793. De(Ke, {
  17794. env: this.config.env,
  17795. loginType: $e.EMAIL,
  17796. persistence: this.config.persistence
  17797. });
  17798. return _context19.abrupt("return", new Ze(this.config.env));
  17799. case 22:
  17800. throw s.code ? new ne({
  17801. code: s.code,
  17802. message: "\u90AE\u7BB1\u767B\u5F55\u5931\u8D25: ".concat(s.message)
  17803. }) : new ne({
  17804. message: "邮箱登录失败"
  17805. });
  17806. case 23:
  17807. case "end":
  17808. return _context19.stop();
  17809. }
  17810. }
  17811. }, _callee19, this);
  17812. }));
  17813. function signIn(_x12, _x13) {
  17814. return _signIn3.apply(this, arguments);
  17815. }
  17816. return signIn;
  17817. }()
  17818. }, {
  17819. key: "activate",
  17820. value: function () {
  17821. var _activate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(e) {
  17822. return _regenerator.default.wrap(function _callee20$(_context20) {
  17823. while (1) {
  17824. switch (_context20.prev = _context20.next) {
  17825. case 0:
  17826. return _context20.abrupt("return", this._request.send("auth.activateEndUserMail", {
  17827. token: e
  17828. }));
  17829. case 1:
  17830. case "end":
  17831. return _context20.stop();
  17832. }
  17833. }
  17834. }, _callee20, this);
  17835. }));
  17836. function activate(_x14) {
  17837. return _activate.apply(this, arguments);
  17838. }
  17839. return activate;
  17840. }()
  17841. }, {
  17842. key: "resetPasswordWithToken",
  17843. value: function () {
  17844. var _resetPasswordWithToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(e, t) {
  17845. return _regenerator.default.wrap(function _callee21$(_context21) {
  17846. while (1) {
  17847. switch (_context21.prev = _context21.next) {
  17848. case 0:
  17849. return _context21.abrupt("return", this._request.send("auth.resetPasswordWithToken", {
  17850. token: e,
  17851. newPassword: t
  17852. }));
  17853. case 1:
  17854. case "end":
  17855. return _context21.stop();
  17856. }
  17857. }
  17858. }, _callee21, this);
  17859. }));
  17860. function resetPasswordWithToken(_x15, _x16) {
  17861. return _resetPasswordWithToken.apply(this, arguments);
  17862. }
  17863. return resetPasswordWithToken;
  17864. }()
  17865. }]);
  17866. return nt;
  17867. }(Qe);
  17868. var st = /*#__PURE__*/function (_Qe4) {
  17869. (0, _inherits2.default)(st, _Qe4);
  17870. var _super7 = _createSuper(st);
  17871. function st() {
  17872. (0, _classCallCheck2.default)(this, st);
  17873. return _super7.apply(this, arguments);
  17874. }
  17875. (0, _createClass2.default)(st, [{
  17876. key: "signIn",
  17877. value: function () {
  17878. var _signIn4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(e, t) {
  17879. var n, s, r, i, o;
  17880. return _regenerator.default.wrap(function _callee22$(_context22) {
  17881. while (1) {
  17882. switch (_context22.prev = _context22.next) {
  17883. case 0:
  17884. if (!("string" != typeof e)) {
  17885. _context22.next = 2;
  17886. break;
  17887. }
  17888. throw new ne({
  17889. code: "PARAM_ERROR",
  17890. message: "username must be a string"
  17891. });
  17892. case 2:
  17893. "string" != typeof t && (t = "", console.warn("password is empty"));
  17894. n = this._cache.keys.refreshTokenKey;
  17895. _context22.next = 6;
  17896. return this._request.send("auth.signIn", {
  17897. loginType: $e.USERNAME,
  17898. username: e,
  17899. password: t,
  17900. refresh_token: this._cache.getStore(n) || ""
  17901. });
  17902. case 6:
  17903. s = _context22.sent;
  17904. r = s.refresh_token;
  17905. i = s.access_token_expire;
  17906. o = s.access_token;
  17907. if (!r) {
  17908. _context22.next = 23;
  17909. break;
  17910. }
  17911. this.setRefreshToken(r);
  17912. if (!(o && i)) {
  17913. _context22.next = 16;
  17914. break;
  17915. }
  17916. this.setAccessToken(o, i);
  17917. _context22.next = 18;
  17918. break;
  17919. case 16:
  17920. _context22.next = 18;
  17921. return this._request.refreshAccessToken();
  17922. case 18:
  17923. _context22.next = 20;
  17924. return this.refreshUserInfo();
  17925. case 20:
  17926. De(qe);
  17927. De(Ke, {
  17928. env: this.config.env,
  17929. loginType: $e.USERNAME,
  17930. persistence: this.config.persistence
  17931. });
  17932. return _context22.abrupt("return", new Ze(this.config.env));
  17933. case 23:
  17934. throw s.code ? new ne({
  17935. code: s.code,
  17936. message: "\u7528\u6237\u540D\u5BC6\u7801\u767B\u5F55\u5931\u8D25: ".concat(s.message)
  17937. }) : new ne({
  17938. message: "用户名密码登录失败"
  17939. });
  17940. case 24:
  17941. case "end":
  17942. return _context22.stop();
  17943. }
  17944. }
  17945. }, _callee22, this);
  17946. }));
  17947. function signIn(_x17, _x18) {
  17948. return _signIn4.apply(this, arguments);
  17949. }
  17950. return signIn;
  17951. }()
  17952. }]);
  17953. return st;
  17954. }(Qe);
  17955. var rt = /*#__PURE__*/function () {
  17956. function rt(e) {
  17957. (0, _classCallCheck2.default)(this, rt);
  17958. this.config = e, this._cache = xe(e.env), this._request = Ye(e.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), Ne(Ke, this._onLoginTypeChanged);
  17959. }
  17960. (0, _createClass2.default)(rt, [{
  17961. key: "currentUser",
  17962. get: function get() {
  17963. var e = this.hasLoginState();
  17964. return e && e.user || null;
  17965. }
  17966. }, {
  17967. key: "loginType",
  17968. get: function get() {
  17969. return this._cache.getStore(this._cache.keys.loginTypeKey);
  17970. }
  17971. }, {
  17972. key: "anonymousAuthProvider",
  17973. value: function anonymousAuthProvider() {
  17974. return new et(this.config);
  17975. }
  17976. }, {
  17977. key: "customAuthProvider",
  17978. value: function customAuthProvider() {
  17979. return new tt(this.config);
  17980. }
  17981. }, {
  17982. key: "emailAuthProvider",
  17983. value: function emailAuthProvider() {
  17984. return new nt(this.config);
  17985. }
  17986. }, {
  17987. key: "usernameAuthProvider",
  17988. value: function usernameAuthProvider() {
  17989. return new st(this.config);
  17990. }
  17991. }, {
  17992. key: "signInAnonymously",
  17993. value: function () {
  17994. var _signInAnonymously = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
  17995. return _regenerator.default.wrap(function _callee23$(_context23) {
  17996. while (1) {
  17997. switch (_context23.prev = _context23.next) {
  17998. case 0:
  17999. return _context23.abrupt("return", new et(this.config).signIn());
  18000. case 1:
  18001. case "end":
  18002. return _context23.stop();
  18003. }
  18004. }
  18005. }, _callee23, this);
  18006. }));
  18007. function signInAnonymously() {
  18008. return _signInAnonymously.apply(this, arguments);
  18009. }
  18010. return signInAnonymously;
  18011. }()
  18012. }, {
  18013. key: "signInWithEmailAndPassword",
  18014. value: function () {
  18015. var _signInWithEmailAndPassword = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(e, t) {
  18016. return _regenerator.default.wrap(function _callee24$(_context24) {
  18017. while (1) {
  18018. switch (_context24.prev = _context24.next) {
  18019. case 0:
  18020. return _context24.abrupt("return", new nt(this.config).signIn(e, t));
  18021. case 1:
  18022. case "end":
  18023. return _context24.stop();
  18024. }
  18025. }
  18026. }, _callee24, this);
  18027. }));
  18028. function signInWithEmailAndPassword(_x19, _x20) {
  18029. return _signInWithEmailAndPassword.apply(this, arguments);
  18030. }
  18031. return signInWithEmailAndPassword;
  18032. }()
  18033. }, {
  18034. key: "signInWithUsernameAndPassword",
  18035. value: function signInWithUsernameAndPassword(e, t) {
  18036. return new st(this.config).signIn(e, t);
  18037. }
  18038. }, {
  18039. key: "linkAndRetrieveDataWithTicket",
  18040. value: function () {
  18041. var _linkAndRetrieveDataWithTicket2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(e) {
  18042. return _regenerator.default.wrap(function _callee25$(_context25) {
  18043. while (1) {
  18044. switch (_context25.prev = _context25.next) {
  18045. case 0:
  18046. this._anonymousAuthProvider || (this._anonymousAuthProvider = new et(this.config)), Ne(je, this._onAnonymousConverted);
  18047. _context25.next = 3;
  18048. return this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e);
  18049. case 3:
  18050. return _context25.abrupt("return", _context25.sent);
  18051. case 4:
  18052. case "end":
  18053. return _context25.stop();
  18054. }
  18055. }
  18056. }, _callee25, this);
  18057. }));
  18058. function linkAndRetrieveDataWithTicket(_x21) {
  18059. return _linkAndRetrieveDataWithTicket2.apply(this, arguments);
  18060. }
  18061. return linkAndRetrieveDataWithTicket;
  18062. }()
  18063. }, {
  18064. key: "signOut",
  18065. value: function () {
  18066. var _signOut = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
  18067. var _this$_cache$keys10, e, t, n, s, r;
  18068. return _regenerator.default.wrap(function _callee26$(_context26) {
  18069. while (1) {
  18070. switch (_context26.prev = _context26.next) {
  18071. case 0:
  18072. if (!(this.loginType === $e.ANONYMOUS)) {
  18073. _context26.next = 2;
  18074. break;
  18075. }
  18076. throw new ne({
  18077. message: "匿名用户不支持登出操作"
  18078. });
  18079. case 2:
  18080. _this$_cache$keys10 = this._cache.keys, e = _this$_cache$keys10.refreshTokenKey, t = _this$_cache$keys10.accessTokenKey, n = _this$_cache$keys10.accessTokenExpireKey, s = this._cache.getStore(e);
  18081. if (s) {
  18082. _context26.next = 5;
  18083. break;
  18084. }
  18085. return _context26.abrupt("return");
  18086. case 5:
  18087. _context26.next = 7;
  18088. return this._request.send("auth.logout", {
  18089. refresh_token: s
  18090. });
  18091. case 7:
  18092. r = _context26.sent;
  18093. return _context26.abrupt("return", (this._cache.removeStore(e), this._cache.removeStore(t), this._cache.removeStore(n), De(qe), De(Ke, {
  18094. env: this.config.env,
  18095. loginType: $e.NULL,
  18096. persistence: this.config.persistence
  18097. }), r));
  18098. case 9:
  18099. case "end":
  18100. return _context26.stop();
  18101. }
  18102. }
  18103. }, _callee26, this);
  18104. }));
  18105. function signOut() {
  18106. return _signOut.apply(this, arguments);
  18107. }
  18108. return signOut;
  18109. }()
  18110. }, {
  18111. key: "signUpWithEmailAndPassword",
  18112. value: function () {
  18113. var _signUpWithEmailAndPassword = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(e, t) {
  18114. return _regenerator.default.wrap(function _callee27$(_context27) {
  18115. while (1) {
  18116. switch (_context27.prev = _context27.next) {
  18117. case 0:
  18118. return _context27.abrupt("return", this._request.send("auth.signUpWithEmailAndPassword", {
  18119. email: e,
  18120. password: t
  18121. }));
  18122. case 1:
  18123. case "end":
  18124. return _context27.stop();
  18125. }
  18126. }
  18127. }, _callee27, this);
  18128. }));
  18129. function signUpWithEmailAndPassword(_x22, _x23) {
  18130. return _signUpWithEmailAndPassword.apply(this, arguments);
  18131. }
  18132. return signUpWithEmailAndPassword;
  18133. }()
  18134. }, {
  18135. key: "sendPasswordResetEmail",
  18136. value: function () {
  18137. var _sendPasswordResetEmail = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(e) {
  18138. return _regenerator.default.wrap(function _callee28$(_context28) {
  18139. while (1) {
  18140. switch (_context28.prev = _context28.next) {
  18141. case 0:
  18142. return _context28.abrupt("return", this._request.send("auth.sendPasswordResetEmail", {
  18143. email: e
  18144. }));
  18145. case 1:
  18146. case "end":
  18147. return _context28.stop();
  18148. }
  18149. }
  18150. }, _callee28, this);
  18151. }));
  18152. function sendPasswordResetEmail(_x24) {
  18153. return _sendPasswordResetEmail.apply(this, arguments);
  18154. }
  18155. return sendPasswordResetEmail;
  18156. }()
  18157. }, {
  18158. key: "onLoginStateChanged",
  18159. value: function onLoginStateChanged(e) {
  18160. var _this9 = this;
  18161. Ne(qe, function () {
  18162. var t = _this9.hasLoginState();
  18163. e.call(_this9, t);
  18164. });
  18165. var t = this.hasLoginState();
  18166. e.call(this, t);
  18167. }
  18168. }, {
  18169. key: "onLoginStateExpired",
  18170. value: function onLoginStateExpired(e) {
  18171. Ne(Me, e.bind(this));
  18172. }
  18173. }, {
  18174. key: "onAccessTokenRefreshed",
  18175. value: function onAccessTokenRefreshed(e) {
  18176. Ne(Be, e.bind(this));
  18177. }
  18178. }, {
  18179. key: "onAnonymousConverted",
  18180. value: function onAnonymousConverted(e) {
  18181. Ne(je, e.bind(this));
  18182. }
  18183. }, {
  18184. key: "onLoginTypeChanged",
  18185. value: function onLoginTypeChanged(e) {
  18186. var _this10 = this;
  18187. Ne(Ke, function () {
  18188. var t = _this10.hasLoginState();
  18189. e.call(_this10, t);
  18190. });
  18191. }
  18192. }, {
  18193. key: "getAccessToken",
  18194. value: function () {
  18195. var _getAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29() {
  18196. return _regenerator.default.wrap(function _callee29$(_context29) {
  18197. while (1) {
  18198. switch (_context29.prev = _context29.next) {
  18199. case 0:
  18200. _context29.next = 2;
  18201. return this._request.getAccessToken();
  18202. case 2:
  18203. _context29.t0 = _context29.sent.accessToken;
  18204. _context29.t1 = this.config.env;
  18205. return _context29.abrupt("return", {
  18206. accessToken: _context29.t0,
  18207. env: _context29.t1
  18208. });
  18209. case 5:
  18210. case "end":
  18211. return _context29.stop();
  18212. }
  18213. }
  18214. }, _callee29, this);
  18215. }));
  18216. function getAccessToken() {
  18217. return _getAccessToken2.apply(this, arguments);
  18218. }
  18219. return getAccessToken;
  18220. }()
  18221. }, {
  18222. key: "hasLoginState",
  18223. value: function hasLoginState() {
  18224. var e = this._cache.keys.refreshTokenKey;
  18225. return this._cache.getStore(e) ? new Ze(this.config.env) : null;
  18226. }
  18227. }, {
  18228. key: "isUsernameRegistered",
  18229. value: function () {
  18230. var _isUsernameRegistered = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(e) {
  18231. var _yield$this$_request$5, t;
  18232. return _regenerator.default.wrap(function _callee30$(_context30) {
  18233. while (1) {
  18234. switch (_context30.prev = _context30.next) {
  18235. case 0:
  18236. if (!("string" != typeof e)) {
  18237. _context30.next = 2;
  18238. break;
  18239. }
  18240. throw new ne({
  18241. code: "PARAM_ERROR",
  18242. message: "username must be a string"
  18243. });
  18244. case 2:
  18245. _context30.next = 4;
  18246. return this._request.send("auth.isUsernameRegistered", {
  18247. username: e
  18248. });
  18249. case 4:
  18250. _yield$this$_request$5 = _context30.sent;
  18251. t = _yield$this$_request$5.data;
  18252. return _context30.abrupt("return", t && t.isRegistered);
  18253. case 7:
  18254. case "end":
  18255. return _context30.stop();
  18256. }
  18257. }
  18258. }, _callee30, this);
  18259. }));
  18260. function isUsernameRegistered(_x25) {
  18261. return _isUsernameRegistered.apply(this, arguments);
  18262. }
  18263. return isUsernameRegistered;
  18264. }()
  18265. }, {
  18266. key: "getLoginState",
  18267. value: function getLoginState() {
  18268. return Promise.resolve(this.hasLoginState());
  18269. }
  18270. }, {
  18271. key: "signInWithTicket",
  18272. value: function () {
  18273. var _signInWithTicket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31(e) {
  18274. return _regenerator.default.wrap(function _callee31$(_context31) {
  18275. while (1) {
  18276. switch (_context31.prev = _context31.next) {
  18277. case 0:
  18278. return _context31.abrupt("return", new tt(this.config).signIn(e));
  18279. case 1:
  18280. case "end":
  18281. return _context31.stop();
  18282. }
  18283. }
  18284. }, _callee31, this);
  18285. }));
  18286. function signInWithTicket(_x26) {
  18287. return _signInWithTicket.apply(this, arguments);
  18288. }
  18289. return signInWithTicket;
  18290. }()
  18291. }, {
  18292. key: "shouldRefreshAccessToken",
  18293. value: function shouldRefreshAccessToken(e) {
  18294. this._request._shouldRefreshAccessTokenHook = e.bind(this);
  18295. }
  18296. }, {
  18297. key: "getUserInfo",
  18298. value: function getUserInfo() {
  18299. return this._request.send("auth.getUserInfo", {}).then(function (e) {
  18300. return e.code ? e : _objectSpread(_objectSpread({}, e.data), {}, {
  18301. requestId: e.seqId
  18302. });
  18303. });
  18304. }
  18305. }, {
  18306. key: "getAuthHeader",
  18307. value: function getAuthHeader() {
  18308. var _this$_cache$keys11 = this._cache.keys,
  18309. e = _this$_cache$keys11.refreshTokenKey,
  18310. t = _this$_cache$keys11.accessTokenKey,
  18311. n = this._cache.getStore(e);
  18312. return {
  18313. "x-cloudbase-credentials": this._cache.getStore(t) + "/@@/" + n
  18314. };
  18315. }
  18316. }, {
  18317. key: "_onAnonymousConverted",
  18318. value: function _onAnonymousConverted(e) {
  18319. var t = e.data.env;
  18320. t === this.config.env && this._cache.updatePersistence(this.config.persistence);
  18321. }
  18322. }, {
  18323. key: "_onLoginTypeChanged",
  18324. value: function _onLoginTypeChanged(e) {
  18325. var _e$data = e.data,
  18326. t = _e$data.loginType,
  18327. n = _e$data.persistence,
  18328. s = _e$data.env;
  18329. s === this.config.env && (this._cache.updatePersistence(n), this._cache.setStore(this._cache.keys.loginTypeKey, t));
  18330. }
  18331. }]);
  18332. return rt;
  18333. }();
  18334. var it = function it(e, t) {
  18335. t = t || we();
  18336. var n = Ye(this.config.env),
  18337. s = e.cloudPath,
  18338. r = e.filePath,
  18339. i = e.onUploadProgress,
  18340. _e$fileType = e.fileType,
  18341. o = _e$fileType === void 0 ? "image" : _e$fileType;
  18342. return n.send("storage.getUploadMetadata", {
  18343. path: s
  18344. }).then(function (e) {
  18345. var _e$data2 = e.data,
  18346. a = _e$data2.url,
  18347. c = _e$data2.authorization,
  18348. u = _e$data2.token,
  18349. h = _e$data2.fileId,
  18350. l = _e$data2.cosFileId,
  18351. d = e.requestId,
  18352. p = {
  18353. key: s,
  18354. signature: c,
  18355. "x-cos-meta-fileid": l,
  18356. success_action_status: "201",
  18357. "x-cos-security-token": u
  18358. };
  18359. n.upload({
  18360. url: a,
  18361. data: p,
  18362. file: r,
  18363. name: s,
  18364. fileType: o,
  18365. onUploadProgress: i
  18366. }).then(function (e) {
  18367. 201 === e.statusCode ? t(null, {
  18368. fileID: h,
  18369. requestId: d
  18370. }) : t(new ne({
  18371. code: "STORAGE_REQUEST_FAIL",
  18372. message: "STORAGE_REQUEST_FAIL: ".concat(e.data)
  18373. }));
  18374. }).catch(function (e) {
  18375. t(e);
  18376. });
  18377. }).catch(function (e) {
  18378. t(e);
  18379. }), t.promise;
  18380. },
  18381. ot = function ot(e, t) {
  18382. t = t || we();
  18383. var n = Ye(this.config.env),
  18384. s = e.cloudPath;
  18385. return n.send("storage.getUploadMetadata", {
  18386. path: s
  18387. }).then(function (e) {
  18388. t(null, e);
  18389. }).catch(function (e) {
  18390. t(e);
  18391. }), t.promise;
  18392. },
  18393. at = function at(_ref7, t) {
  18394. var e = _ref7.fileList;
  18395. if (t = t || we(), !e || !Array.isArray(e)) return {
  18396. code: "INVALID_PARAM",
  18397. message: "fileList必须是非空的数组"
  18398. };
  18399. var _iterator3 = _createForOfIteratorHelper(e),
  18400. _step3;
  18401. try {
  18402. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  18403. var _t8 = _step3.value;
  18404. if (!_t8 || "string" != typeof _t8) return {
  18405. code: "INVALID_PARAM",
  18406. message: "fileList的元素必须是非空的字符串"
  18407. };
  18408. }
  18409. } catch (err) {
  18410. _iterator3.e(err);
  18411. } finally {
  18412. _iterator3.f();
  18413. }
  18414. var n = {
  18415. fileid_list: e
  18416. };
  18417. return Ye(this.config.env).send("storage.batchDeleteFile", n).then(function (e) {
  18418. e.code ? t(null, e) : t(null, {
  18419. fileList: e.data.delete_list,
  18420. requestId: e.requestId
  18421. });
  18422. }).catch(function (e) {
  18423. t(e);
  18424. }), t.promise;
  18425. },
  18426. ct = function ct(_ref8, t) {
  18427. var e = _ref8.fileList;
  18428. t = t || we(), e && Array.isArray(e) || t(null, {
  18429. code: "INVALID_PARAM",
  18430. message: "fileList必须是非空的数组"
  18431. });
  18432. var n = [];
  18433. var _iterator4 = _createForOfIteratorHelper(e),
  18434. _step4;
  18435. try {
  18436. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  18437. var _s9 = _step4.value;
  18438. "object" == (0, _typeof2.default)(_s9) ? (_s9.hasOwnProperty("fileID") && _s9.hasOwnProperty("maxAge") || t(null, {
  18439. code: "INVALID_PARAM",
  18440. message: "fileList的元素必须是包含fileID和maxAge的对象"
  18441. }), n.push({
  18442. fileid: _s9.fileID,
  18443. max_age: _s9.maxAge
  18444. })) : "string" == typeof _s9 ? n.push({
  18445. fileid: _s9
  18446. }) : t(null, {
  18447. code: "INVALID_PARAM",
  18448. message: "fileList的元素必须是字符串"
  18449. });
  18450. }
  18451. } catch (err) {
  18452. _iterator4.e(err);
  18453. } finally {
  18454. _iterator4.f();
  18455. }
  18456. var s = {
  18457. file_list: n
  18458. };
  18459. return Ye(this.config.env).send("storage.batchGetDownloadUrl", s).then(function (e) {
  18460. e.code ? t(null, e) : t(null, {
  18461. fileList: e.data.download_list,
  18462. requestId: e.requestId
  18463. });
  18464. }).catch(function (e) {
  18465. t(e);
  18466. }), t.promise;
  18467. },
  18468. ut = /*#__PURE__*/function () {
  18469. var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32(_ref9, t) {
  18470. var e, n, s, r;
  18471. return _regenerator.default.wrap(function _callee32$(_context32) {
  18472. while (1) {
  18473. switch (_context32.prev = _context32.next) {
  18474. case 0:
  18475. e = _ref9.fileID;
  18476. _context32.next = 3;
  18477. return ct.call(this, {
  18478. fileList: [{
  18479. fileID: e,
  18480. maxAge: 600
  18481. }]
  18482. });
  18483. case 3:
  18484. n = _context32.sent.fileList[0];
  18485. if (!("SUCCESS" !== n.code)) {
  18486. _context32.next = 6;
  18487. break;
  18488. }
  18489. return _context32.abrupt("return", t ? t(n) : new Promise(function (e) {
  18490. e(n);
  18491. }));
  18492. case 6:
  18493. s = Ye(this.config.env);
  18494. r = n.download_url;
  18495. if (!(r = encodeURI(r), !t)) {
  18496. _context32.next = 10;
  18497. break;
  18498. }
  18499. return _context32.abrupt("return", s.download({
  18500. url: r
  18501. }));
  18502. case 10:
  18503. _context32.t0 = t;
  18504. _context32.next = 13;
  18505. return s.download({
  18506. url: r
  18507. });
  18508. case 13:
  18509. _context32.t1 = _context32.sent;
  18510. (0, _context32.t0)(_context32.t1);
  18511. case 15:
  18512. case "end":
  18513. return _context32.stop();
  18514. }
  18515. }
  18516. }, _callee32, this);
  18517. }));
  18518. return function ut(_x27, _x28) {
  18519. return _ref10.apply(this, arguments);
  18520. };
  18521. }(),
  18522. ht = function ht(_ref11, i) {
  18523. var e = _ref11.name,
  18524. t = _ref11.data,
  18525. n = _ref11.query,
  18526. s = _ref11.parse,
  18527. r = _ref11.search;
  18528. var o = i || we();
  18529. var a;
  18530. try {
  18531. a = t ? JSON.stringify(t) : "";
  18532. } catch (e) {
  18533. return Promise.reject(e);
  18534. }
  18535. if (!e) return Promise.reject(new ne({
  18536. code: "PARAM_ERROR",
  18537. message: "函数名不能为空"
  18538. }));
  18539. var c = {
  18540. inQuery: n,
  18541. parse: s,
  18542. search: r,
  18543. function_name: e,
  18544. request_data: a
  18545. };
  18546. return Ye(this.config.env).send("functions.invokeFunction", c).then(function (e) {
  18547. if (e.code) o(null, e);else {
  18548. var _t9 = e.data.response_data;
  18549. if (s) o(null, {
  18550. result: _t9,
  18551. requestId: e.requestId
  18552. });else try {
  18553. _t9 = JSON.parse(e.data.response_data), o(null, {
  18554. result: _t9,
  18555. requestId: e.requestId
  18556. });
  18557. } catch (e) {
  18558. o(new ne({
  18559. message: "response data must be json"
  18560. }));
  18561. }
  18562. }
  18563. return o.promise;
  18564. }).catch(function (e) {
  18565. o(e);
  18566. }), o.promise;
  18567. },
  18568. lt = {
  18569. timeout: 15e3,
  18570. persistence: "session"
  18571. },
  18572. dt = {};
  18573. var pt = /*#__PURE__*/function () {
  18574. function pt(e) {
  18575. (0, _classCallCheck2.default)(this, pt);
  18576. this.config = e || this.config, this.authObj = void 0;
  18577. }
  18578. (0, _createClass2.default)(pt, [{
  18579. key: "init",
  18580. value: function init(e) {
  18581. switch (ke.adapter || (this.requestClient = new ke.adapter.reqClass({
  18582. timeout: e.timeout || 5e3,
  18583. timeoutMsg: "\u8BF7\u6C42\u5728".concat((e.timeout || 5e3) / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD")
  18584. })), this.config = _objectSpread(_objectSpread({}, lt), e), !0) {
  18585. case this.config.timeout > 6e5:
  18586. console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = 6e5;
  18587. break;
  18588. case this.config.timeout < 100:
  18589. console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100;
  18590. }
  18591. return new pt(this.config);
  18592. }
  18593. }, {
  18594. key: "auth",
  18595. value: function auth() {
  18596. var _ref12 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  18597. e = _ref12.persistence;
  18598. if (this.authObj) return this.authObj;
  18599. var t = e || ke.adapter.primaryStorage || lt.persistence;
  18600. var n;
  18601. return t !== this.config.persistence && (this.config.persistence = t), function (e) {
  18602. var t = e.env;
  18603. Ee[t] = new Ae(e), Oe[t] = new Ae(_objectSpread(_objectSpread({}, e), {}, {
  18604. persistence: "local"
  18605. }));
  18606. }(this.config), n = this.config, Ve[n.env] = new Ge(n), this.authObj = new rt(this.config), this.authObj;
  18607. }
  18608. }, {
  18609. key: "on",
  18610. value: function on(e, t) {
  18611. return Ne.apply(this, [e, t]);
  18612. }
  18613. }, {
  18614. key: "off",
  18615. value: function off(e, t) {
  18616. return Fe.apply(this, [e, t]);
  18617. }
  18618. }, {
  18619. key: "callFunction",
  18620. value: function callFunction(e, t) {
  18621. return ht.apply(this, [e, t]);
  18622. }
  18623. }, {
  18624. key: "deleteFile",
  18625. value: function deleteFile(e, t) {
  18626. return at.apply(this, [e, t]);
  18627. }
  18628. }, {
  18629. key: "getTempFileURL",
  18630. value: function getTempFileURL(e, t) {
  18631. return ct.apply(this, [e, t]);
  18632. }
  18633. }, {
  18634. key: "downloadFile",
  18635. value: function downloadFile(e, t) {
  18636. return ut.apply(this, [e, t]);
  18637. }
  18638. }, {
  18639. key: "uploadFile",
  18640. value: function uploadFile(e, t) {
  18641. return it.apply(this, [e, t]);
  18642. }
  18643. }, {
  18644. key: "getUploadMetadata",
  18645. value: function getUploadMetadata(e, t) {
  18646. return ot.apply(this, [e, t]);
  18647. }
  18648. }, {
  18649. key: "registerExtension",
  18650. value: function registerExtension(e) {
  18651. dt[e.name] = e;
  18652. }
  18653. }, {
  18654. key: "invokeExtension",
  18655. value: function () {
  18656. var _invokeExtension = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33(e, t) {
  18657. var n;
  18658. return _regenerator.default.wrap(function _callee33$(_context33) {
  18659. while (1) {
  18660. switch (_context33.prev = _context33.next) {
  18661. case 0:
  18662. n = dt[e];
  18663. if (n) {
  18664. _context33.next = 3;
  18665. break;
  18666. }
  18667. throw new ne({
  18668. message: "\u6269\u5C55".concat(e, " \u5FC5\u987B\u5148\u6CE8\u518C")
  18669. });
  18670. case 3:
  18671. _context33.next = 5;
  18672. return n.invoke(t, this);
  18673. case 5:
  18674. return _context33.abrupt("return", _context33.sent);
  18675. case 6:
  18676. case "end":
  18677. return _context33.stop();
  18678. }
  18679. }
  18680. }, _callee33, this);
  18681. }));
  18682. function invokeExtension(_x29, _x30) {
  18683. return _invokeExtension.apply(this, arguments);
  18684. }
  18685. return invokeExtension;
  18686. }()
  18687. }, {
  18688. key: "useAdapters",
  18689. value: function useAdapters(e) {
  18690. var _ref13 = be(e) || {},
  18691. t = _ref13.adapter,
  18692. n = _ref13.runtime;
  18693. t && (ke.adapter = t), n && (ke.runtime = n);
  18694. }
  18695. }]);
  18696. return pt;
  18697. }();
  18698. var ft = new pt();
  18699. function gt(e, t, n) {
  18700. void 0 === n && (n = {});
  18701. var s = /\?/.test(t),
  18702. r = "";
  18703. for (var i in n) {
  18704. "" === r ? !s && (t += "?") : r += "&", r += i + "=" + encodeURIComponent(n[i]);
  18705. }
  18706. return /^http(s)?:\/\//.test(t += r) ? t : "" + e + t;
  18707. }
  18708. var mt = /*#__PURE__*/function () {
  18709. function mt() {
  18710. (0, _classCallCheck2.default)(this, mt);
  18711. }
  18712. (0, _createClass2.default)(mt, [{
  18713. key: "post",
  18714. value: function post(e) {
  18715. var t = e.url,
  18716. n = e.data,
  18717. s = e.headers;
  18718. return new Promise(function (e, r) {
  18719. se.request({
  18720. url: gt("https:", t),
  18721. data: n,
  18722. method: "POST",
  18723. header: s,
  18724. success: function success(t) {
  18725. e(t);
  18726. },
  18727. fail: function fail(e) {
  18728. r(e);
  18729. }
  18730. });
  18731. });
  18732. }
  18733. }, {
  18734. key: "upload",
  18735. value: function upload(e) {
  18736. return new Promise(function (t, n) {
  18737. var s = e.url,
  18738. r = e.file,
  18739. i = e.data,
  18740. o = e.headers,
  18741. a = e.fileType,
  18742. c = se.uploadFile({
  18743. url: gt("https:", s),
  18744. name: "file",
  18745. formData: Object.assign({}, i),
  18746. filePath: r,
  18747. fileType: a,
  18748. header: o,
  18749. success: function success(e) {
  18750. var n = {
  18751. statusCode: e.statusCode,
  18752. data: e.data || {}
  18753. };
  18754. 200 === e.statusCode && i.success_action_status && (n.statusCode = parseInt(i.success_action_status, 10)), t(n);
  18755. },
  18756. fail: function fail(e) {
  18757. n(new Error(e.errMsg || "uploadFile:fail"));
  18758. }
  18759. });
  18760. "function" == typeof e.onUploadProgress && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (t) {
  18761. e.onUploadProgress({
  18762. loaded: t.totalBytesSent,
  18763. total: t.totalBytesExpectedToSend
  18764. });
  18765. });
  18766. });
  18767. }
  18768. }]);
  18769. return mt;
  18770. }();
  18771. var yt = {
  18772. setItem: function setItem(e, t) {
  18773. se.setStorageSync(e, t);
  18774. },
  18775. getItem: function getItem(e) {
  18776. return se.getStorageSync(e);
  18777. },
  18778. removeItem: function removeItem(e) {
  18779. se.removeStorageSync(e);
  18780. },
  18781. clear: function clear() {
  18782. se.clearStorageSync();
  18783. }
  18784. };
  18785. var _t = {
  18786. genAdapter: function genAdapter() {
  18787. return {
  18788. root: {},
  18789. reqClass: mt,
  18790. localStorage: yt,
  18791. primaryStorage: "local"
  18792. };
  18793. },
  18794. isMatch: function isMatch() {
  18795. return !0;
  18796. },
  18797. runtime: "uni_app"
  18798. };
  18799. ft.useAdapters(_t);
  18800. var wt = ft,
  18801. vt = wt.init;
  18802. wt.init = function (e) {
  18803. e.env = e.spaceId;
  18804. var t = vt.call(this, e);
  18805. t.config.provider = "tencent", t.config.spaceId = e.spaceId;
  18806. var n = t.auth;
  18807. return t.auth = function (e) {
  18808. var t = n.call(this, e);
  18809. return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach(function (e) {
  18810. var n;
  18811. t[e] = (n = t[e], function (e) {
  18812. e = e || {};
  18813. var _te = te(e),
  18814. t = _te.success,
  18815. s = _te.fail,
  18816. r = _te.complete;
  18817. if (!(t || s || r)) return n.call(this, e);
  18818. n.call(this, e).then(function (e) {
  18819. t && t(e), r && r(e);
  18820. }, function (e) {
  18821. s && s(e), r && r(e);
  18822. });
  18823. }).bind(t);
  18824. }), t;
  18825. }, t.customAuth = t.auth, t;
  18826. };
  18827. var It = wt;
  18828. var St = /*#__PURE__*/function (_fe) {
  18829. (0, _inherits2.default)(St, _fe);
  18830. var _super8 = _createSuper(St);
  18831. function St() {
  18832. (0, _classCallCheck2.default)(this, St);
  18833. return _super8.apply(this, arguments);
  18834. }
  18835. (0, _createClass2.default)(St, [{
  18836. key: "getAccessToken",
  18837. value: function getAccessToken() {
  18838. var _this11 = this;
  18839. return new Promise(function (e, t) {
  18840. var n = "Anonymous_Access_token";
  18841. _this11.setAccessToken(n), e(n);
  18842. });
  18843. }
  18844. }, {
  18845. key: "setupRequest",
  18846. value: function setupRequest(e, t) {
  18847. var n = Object.assign({}, e, {
  18848. spaceId: this.config.spaceId,
  18849. timestamp: Date.now()
  18850. }),
  18851. s = {
  18852. "Content-Type": "application/json"
  18853. };
  18854. "auth" !== t && (n.token = this.accessToken, s["x-basement-token"] = this.accessToken), s["x-serverless-sign"] = le.sign(n, this.config.clientSecret);
  18855. var r = he();
  18856. s["x-client-info"] = encodeURIComponent(JSON.stringify(r));
  18857. var _re = re(),
  18858. i = _re.token;
  18859. return s["x-client-token"] = i, {
  18860. url: this.config.requestUrl,
  18861. method: "POST",
  18862. data: n,
  18863. dataType: "json",
  18864. header: JSON.parse(JSON.stringify(s))
  18865. };
  18866. }
  18867. }, {
  18868. key: "uploadFileToOSS",
  18869. value: function uploadFileToOSS(_ref14) {
  18870. var _this12 = this;
  18871. var e = _ref14.url,
  18872. t = _ref14.formData,
  18873. n = _ref14.name,
  18874. s = _ref14.filePath,
  18875. r = _ref14.fileType,
  18876. i = _ref14.onUploadProgress;
  18877. return new Promise(function (o, a) {
  18878. var c = _this12.adapter.uploadFile({
  18879. url: e,
  18880. formData: t,
  18881. name: n,
  18882. filePath: s,
  18883. fileType: r,
  18884. success: function success(e) {
  18885. e && e.statusCode < 400 ? o(e) : a(new ne({
  18886. code: "UPLOAD_FAILED",
  18887. message: "文件上传失败"
  18888. }));
  18889. },
  18890. fail: function fail(e) {
  18891. a(new ne({
  18892. code: e.code || "UPLOAD_FAILED",
  18893. message: e.message || e.errMsg || "文件上传失败"
  18894. }));
  18895. }
  18896. });
  18897. "function" == typeof i && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {
  18898. i({
  18899. loaded: e.totalBytesSent,
  18900. total: e.totalBytesExpectedToSend
  18901. });
  18902. });
  18903. });
  18904. }
  18905. }, {
  18906. key: "uploadFile",
  18907. value: function uploadFile(_ref15) {
  18908. var _this13 = this;
  18909. var e = _ref15.filePath,
  18910. t = _ref15.cloudPath,
  18911. _ref15$fileType = _ref15.fileType,
  18912. n = _ref15$fileType === void 0 ? "image" : _ref15$fileType,
  18913. s = _ref15.onUploadProgress;
  18914. if (!t) throw new ne({
  18915. code: "CLOUDPATH_REQUIRED",
  18916. message: "cloudPath不可为空"
  18917. });
  18918. var r;
  18919. return this.getOSSUploadOptionsFromPath({
  18920. cloudPath: t
  18921. }).then(function (t) {
  18922. var _t$result = t.result,
  18923. i = _t$result.url,
  18924. o = _t$result.formData,
  18925. a = _t$result.name;
  18926. r = t.result.fileUrl;
  18927. var c = {
  18928. url: i,
  18929. formData: o,
  18930. name: a,
  18931. filePath: e,
  18932. fileType: n
  18933. };
  18934. return _this13.uploadFileToOSS(Object.assign({}, c, {
  18935. onUploadProgress: s
  18936. }));
  18937. }).then(function () {
  18938. return _this13.reportOSSUpload({
  18939. cloudPath: t
  18940. });
  18941. }).then(function (t) {
  18942. return new Promise(function (n, s) {
  18943. t.success ? n({
  18944. success: !0,
  18945. filePath: e,
  18946. fileID: r
  18947. }) : s(new ne({
  18948. code: "UPLOAD_FAILED",
  18949. message: "文件上传失败"
  18950. }));
  18951. });
  18952. });
  18953. }
  18954. }, {
  18955. key: "deleteFile",
  18956. value: function deleteFile(_ref16) {
  18957. var e = _ref16.fileList;
  18958. var t = {
  18959. method: "serverless.file.resource.delete",
  18960. params: JSON.stringify({
  18961. fileList: e
  18962. })
  18963. };
  18964. return this.request(this.setupRequest(t)).then(function (e) {
  18965. if (e.success) return e.result;
  18966. throw new ne({
  18967. code: "DELETE_FILE_FAILED",
  18968. message: "删除文件失败"
  18969. });
  18970. });
  18971. }
  18972. }, {
  18973. key: "getTempFileURL",
  18974. value: function getTempFileURL() {
  18975. var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  18976. e = _ref17.fileList;
  18977. if (!Array.isArray(e) || 0 === e.length) throw new ne({
  18978. code: "INVALID_PARAM",
  18979. message: "fileList的元素必须是非空的字符串"
  18980. });
  18981. var t = {
  18982. method: "serverless.file.resource.getTempFileURL",
  18983. params: JSON.stringify({
  18984. fileList: e
  18985. })
  18986. };
  18987. return this.request(this.setupRequest(t)).then(function (e) {
  18988. if (e.success) return {
  18989. fileList: e.result.fileList.map(function (e) {
  18990. return {
  18991. fileID: e.fileID,
  18992. tempFileURL: e.tempFileURL
  18993. };
  18994. })
  18995. };
  18996. throw new ne({
  18997. code: "GET_TEMP_FILE_URL_FAILED",
  18998. message: "获取临时文件链接失败"
  18999. });
  19000. });
  19001. }
  19002. }]);
  19003. return St;
  19004. }(fe);
  19005. var bt = {
  19006. init: function init(e) {
  19007. var t = new St(e),
  19008. n = {
  19009. signInAnonymously: function signInAnonymously() {
  19010. return t.authorize();
  19011. },
  19012. getLoginState: function getLoginState() {
  19013. return Promise.resolve(!1);
  19014. }
  19015. };
  19016. return t.auth = function () {
  19017. return n;
  19018. }, t.customAuth = t.auth, t;
  19019. }
  19020. };
  19021. function kt(_ref18) {
  19022. var e = _ref18.data;
  19023. var t;
  19024. t = he();
  19025. var n = JSON.parse(JSON.stringify(e || {}));
  19026. if (Object.assign(n, {
  19027. clientInfo: t
  19028. }), !n.uniIdToken) {
  19029. var _re2 = re(),
  19030. _e19 = _re2.token;
  19031. _e19 && (n.uniIdToken = _e19);
  19032. }
  19033. return n;
  19034. }
  19035. function Ct() {
  19036. return _Ct.apply(this, arguments);
  19037. }
  19038. function _Ct() {
  19039. _Ct = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54() {
  19040. var _this26 = this;
  19041. var _ref60,
  19042. e,
  19043. t,
  19044. _this$__dev__,
  19045. n,
  19046. s,
  19047. r,
  19048. i,
  19049. o,
  19050. a,
  19051. _args6 = arguments;
  19052. return _regenerator.default.wrap(function _callee54$(_context54) {
  19053. while (1) {
  19054. switch (_context54.prev = _context54.next) {
  19055. case 0:
  19056. _ref60 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, e = _ref60.name, t = _ref60.data;
  19057. _context54.next = 3;
  19058. return this.__dev__.initLocalNetwork();
  19059. case 3:
  19060. _this$__dev__ = this.__dev__, n = _this$__dev__.localAddress, s = _this$__dev__.localPort, r = {
  19061. aliyun: "aliyun",
  19062. tencent: "tcb"
  19063. }[this.config.provider], i = this.config.spaceId, o = "http://".concat(n, ":").concat(s, "/system/check-function"), a = "http://".concat(n, ":").concat(s, "/cloudfunctions/").concat(e);
  19064. return _context54.abrupt("return", new Promise(function (t, n) {
  19065. se.request({
  19066. method: "POST",
  19067. url: o,
  19068. data: {
  19069. name: e,
  19070. platform: P,
  19071. provider: r,
  19072. spaceId: i
  19073. },
  19074. timeout: 3e3,
  19075. success: function success(e) {
  19076. t(e);
  19077. },
  19078. fail: function fail() {
  19079. t({
  19080. data: {
  19081. code: "NETWORK_ERROR",
  19082. message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。"
  19083. }
  19084. });
  19085. }
  19086. });
  19087. }).then(function () {
  19088. var _ref61 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  19089. e = _ref61.data;
  19090. var _ref62 = e || {},
  19091. t = _ref62.code,
  19092. n = _ref62.message;
  19093. return {
  19094. code: 0 === t ? 0 : t || "SYS_ERR",
  19095. message: n || "SYS_ERR"
  19096. };
  19097. }).then(function (_ref63) {
  19098. var n = _ref63.code,
  19099. s = _ref63.message;
  19100. if (0 !== n) {
  19101. switch (n) {
  19102. case "MODULE_ENCRYPTED":
  19103. console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e, "\uFF09\u4F9D\u8D56\u52A0\u5BC6\u516C\u5171\u6A21\u5757\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));
  19104. break;
  19105. case "FUNCTION_ENCRYPTED":
  19106. console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e, "\uFF09\u5DF2\u52A0\u5BC6\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));
  19107. break;
  19108. case "ACTION_ENCRYPTED":
  19109. console.error(s || "需要访问加密的uni-clientDB-action,自动切换为云端环境");
  19110. break;
  19111. case "NETWORK_ERROR":
  19112. {
  19113. var _e31 = "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下";
  19114. throw console.error(_e31), new Error(_e31);
  19115. }
  19116. case "SWITCH_TO_CLOUD":
  19117. break;
  19118. default:
  19119. {
  19120. var _e32 = "\u68C0\u6D4B\u672C\u5730\u8C03\u8BD5\u670D\u52A1\u51FA\u73B0\u9519\u8BEF\uFF1A".concat(s, "\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u73AF\u5883\u6216\u91CD\u542F\u5BA2\u6237\u7AEF\u518D\u8BD5");
  19121. throw console.error(_e32), new Error(_e32);
  19122. }
  19123. }
  19124. return _this26._callCloudFunction({
  19125. name: e,
  19126. data: t
  19127. });
  19128. }
  19129. return new Promise(function (e, n) {
  19130. var s = kt.call(_this26, {
  19131. data: t
  19132. });
  19133. se.request({
  19134. method: "POST",
  19135. url: a,
  19136. data: {
  19137. provider: r,
  19138. platform: P,
  19139. param: s
  19140. },
  19141. success: function success() {
  19142. var _ref64 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  19143. t = _ref64.statusCode,
  19144. s = _ref64.data;
  19145. return !t || t >= 400 ? n(new ne({
  19146. code: s.code || "SYS_ERR",
  19147. message: s.message || "request:fail"
  19148. })) : e({
  19149. result: s
  19150. });
  19151. },
  19152. fail: function fail(e) {
  19153. n(new ne({
  19154. code: e.code || e.errCode || "SYS_ERR",
  19155. message: e.message || e.errMsg || "request:fail"
  19156. }));
  19157. }
  19158. });
  19159. });
  19160. }));
  19161. case 5:
  19162. case "end":
  19163. return _context54.stop();
  19164. }
  19165. }
  19166. }, _callee54, this);
  19167. }));
  19168. return _Ct.apply(this, arguments);
  19169. }
  19170. var Tt = [{
  19171. rule: /fc_function_not_found|FUNCTION_NOT_FOUND/,
  19172. content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",
  19173. mode: "append"
  19174. }];
  19175. var Pt = /[\\^$.*+?()[\]{}|]/g,
  19176. At = RegExp(Pt.source);
  19177. function Et(e, t, n) {
  19178. return e.replace(new RegExp((s = t) && At.test(s) ? s.replace(Pt, "\\$&") : s, "g"), n);
  19179. var s;
  19180. }
  19181. var Ot = "none",
  19182. xt = "request",
  19183. Rt = "response",
  19184. Ut = "both";
  19185. var Lt = /*#__PURE__*/function () {
  19186. function Lt() {
  19187. var _ref19 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  19188. e = _ref19.secretType,
  19189. t = _ref19.uniCloudIns;
  19190. (0, _classCallCheck2.default)(this, Lt);
  19191. this.clientType = "", this.secretType = e || Ot, this.uniCloudIns = t;
  19192. var _this$uniCloudIns$con = this.uniCloudIns.config,
  19193. n = _this$uniCloudIns$con.provider,
  19194. s = _this$uniCloudIns$con.spaceId;
  19195. var r;
  19196. this.provider = n, this.spaceId = s, this.scopedGlobalCache = (r = this.uniCloudIns, U("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}", r.config.spaceId)));
  19197. }
  19198. (0, _createClass2.default)(Lt, [{
  19199. key: "getSystemInfo",
  19200. value: function getSystemInfo() {
  19201. return this._systemInfo || (this._systemInfo = ce()), this._systemInfo;
  19202. }
  19203. }, {
  19204. key: "appId",
  19205. get: function get() {
  19206. return this.getSystemInfo().appId;
  19207. }
  19208. }, {
  19209. key: "deviceId",
  19210. get: function get() {
  19211. return this.getSystemInfo().deviceId;
  19212. }
  19213. }, {
  19214. key: "encryptData",
  19215. value: function () {
  19216. var _encryptData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(e) {
  19217. return _regenerator.default.wrap(function _callee34$(_context34) {
  19218. while (1) {
  19219. switch (_context34.prev = _context34.next) {
  19220. case 0:
  19221. return _context34.abrupt("return", this.secretType === Ot ? e : this.platformEncryptData(e));
  19222. case 1:
  19223. case "end":
  19224. return _context34.stop();
  19225. }
  19226. }
  19227. }, _callee34, this);
  19228. }));
  19229. function encryptData(_x31) {
  19230. return _encryptData.apply(this, arguments);
  19231. }
  19232. return encryptData;
  19233. }()
  19234. }, {
  19235. key: "decryptResult",
  19236. value: function () {
  19237. var _decryptResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(e) {
  19238. var _ref20, t, n;
  19239. return _regenerator.default.wrap(function _callee35$(_context35) {
  19240. while (1) {
  19241. switch (_context35.prev = _context35.next) {
  19242. case 0:
  19243. if (!(this.secretType === Ot)) {
  19244. _context35.next = 2;
  19245. break;
  19246. }
  19247. return _context35.abrupt("return", e);
  19248. case 2:
  19249. _ref20 = e || {}, t = _ref20.errCode, n = _ref20.content;
  19250. return _context35.abrupt("return", t || !n ? e : this.secretType === xt ? n : this.platformDecryptResult(e));
  19251. case 4:
  19252. case "end":
  19253. return _context35.stop();
  19254. }
  19255. }
  19256. }, _callee35, this);
  19257. }));
  19258. function decryptResult(_x32) {
  19259. return _decryptResult.apply(this, arguments);
  19260. }
  19261. return decryptResult;
  19262. }()
  19263. }, {
  19264. key: "wrapVerifyClientCallFunction",
  19265. value: function wrapVerifyClientCallFunction(e) {
  19266. var t = this;
  19267. return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36() {
  19268. var _ref22,
  19269. n,
  19270. _ref22$data,
  19271. s,
  19272. r,
  19273. _args36 = arguments;
  19274. return _regenerator.default.wrap(function _callee36$(_context36) {
  19275. while (1) {
  19276. switch (_context36.prev = _context36.next) {
  19277. case 0:
  19278. _ref22 = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {}, n = _ref22.name, _ref22$data = _ref22.data, s = _ref22$data === void 0 ? {} : _ref22$data;
  19279. _context36.next = 3;
  19280. return t.prepare();
  19281. case 3:
  19282. _context36.next = 5;
  19283. return t.platformGetSignOption();
  19284. case 5:
  19285. (s = JSON.parse(JSON.stringify(s)))._uniCloudOptions = _context36.sent;
  19286. _context36.next = 8;
  19287. return e({
  19288. name: n,
  19289. data: s
  19290. });
  19291. case 8:
  19292. r = _context36.sent;
  19293. _context36.t0 = t.isClientKeyNotFound(r);
  19294. if (!_context36.t0) {
  19295. _context36.next = 19;
  19296. break;
  19297. }
  19298. _context36.next = 13;
  19299. return t.prepare({
  19300. forceUpdate: !0
  19301. });
  19302. case 13:
  19303. _context36.next = 15;
  19304. return t.platformGetSignOption();
  19305. case 15:
  19306. s._uniCloudOptions = _context36.sent;
  19307. _context36.next = 18;
  19308. return e({
  19309. name: n,
  19310. data: s
  19311. });
  19312. case 18:
  19313. r = _context36.sent;
  19314. case 19:
  19315. return _context36.abrupt("return", r);
  19316. case 20:
  19317. case "end":
  19318. return _context36.stop();
  19319. }
  19320. }
  19321. }, _callee36);
  19322. }));
  19323. }
  19324. }, {
  19325. key: "wrapEncryptDataCallFunction",
  19326. value: function wrapEncryptDataCallFunction(e) {
  19327. var t = this;
  19328. return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37() {
  19329. var _ref24,
  19330. n,
  19331. _ref24$data,
  19332. s,
  19333. r,
  19334. i,
  19335. _r3,
  19336. _args37 = arguments;
  19337. return _regenerator.default.wrap(function _callee37$(_context37) {
  19338. while (1) {
  19339. switch (_context37.prev = _context37.next) {
  19340. case 0:
  19341. _ref24 = _args37.length > 0 && _args37[0] !== undefined ? _args37[0] : {}, n = _ref24.name, _ref24$data = _ref24.data, s = _ref24$data === void 0 ? {} : _ref24$data;
  19342. _context37.next = 3;
  19343. return t.prepare();
  19344. case 3:
  19345. _context37.next = 5;
  19346. return t.encryptData(s);
  19347. case 5:
  19348. r = _context37.sent;
  19349. _context37.next = 8;
  19350. return e({
  19351. name: n,
  19352. data: r
  19353. });
  19354. case 8:
  19355. i = _context37.sent;
  19356. if (!t.isClientKeyNotFound(i)) {
  19357. _context37.next = 21;
  19358. break;
  19359. }
  19360. _context37.next = 12;
  19361. return t.prepare({
  19362. forceUpdate: !0
  19363. });
  19364. case 12:
  19365. _context37.next = 14;
  19366. return t.encryptData(s);
  19367. case 14:
  19368. _r3 = _context37.sent;
  19369. _context37.next = 17;
  19370. return t.platformGetSignOption();
  19371. case 17:
  19372. s._uniCloudOptions = _context37.sent;
  19373. _context37.next = 20;
  19374. return e({
  19375. name: n,
  19376. data: _r3
  19377. });
  19378. case 20:
  19379. i = _context37.sent;
  19380. case 21:
  19381. _context37.next = 23;
  19382. return t.decryptResult(i.result);
  19383. case 23:
  19384. i.result = _context37.sent;
  19385. return _context37.abrupt("return", i);
  19386. case 25:
  19387. case "end":
  19388. return _context37.stop();
  19389. }
  19390. }
  19391. }, _callee37);
  19392. }));
  19393. }
  19394. }]);
  19395. return Lt;
  19396. }();
  19397. /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
  19398. function Nt(e) {
  19399. return parseInt(e) === e;
  19400. }
  19401. function Dt(e) {
  19402. if (!Nt(e.length)) return !1;
  19403. for (var t = 0; t < e.length; t++) {
  19404. if (!Nt(e[t]) || e[t] < 0 || e[t] > 255) return !1;
  19405. }
  19406. return !0;
  19407. }
  19408. function Ft(e, t) {
  19409. if (e.buffer && "Uint8Array" === e.name) return t && (e = e.slice ? e.slice() : Array.prototype.slice.call(e)), e;
  19410. if (Array.isArray(e)) {
  19411. if (!Dt(e)) throw new Error("Array contains invalid value: " + e);
  19412. return new Uint8Array(e);
  19413. }
  19414. if (Nt(e.length) && Dt(e)) return new Uint8Array(e);
  19415. throw new Error("unsupported array-like object");
  19416. }
  19417. function qt(e) {
  19418. return new Uint8Array(e);
  19419. }
  19420. function Mt(e, t, n, s, r) {
  19421. null == s && null == r || (e = e.slice ? e.slice(s, r) : Array.prototype.slice.call(e, s, r)), t.set(e, n);
  19422. }
  19423. var Kt,
  19424. jt = {
  19425. toBytes: function toBytes(e) {
  19426. var t = [],
  19427. n = 0;
  19428. for (e = encodeURI(e); n < e.length;) {
  19429. var s = e.charCodeAt(n++);
  19430. 37 === s ? (t.push(parseInt(e.substr(n, 2), 16)), n += 2) : t.push(s);
  19431. }
  19432. return Ft(t);
  19433. },
  19434. fromBytes: function fromBytes(e) {
  19435. for (var t = [], n = 0; n < e.length;) {
  19436. var s = e[n];
  19437. s < 128 ? (t.push(String.fromCharCode(s)), n++) : s > 191 && s < 224 ? (t.push(String.fromCharCode((31 & s) << 6 | 63 & e[n + 1])), n += 2) : (t.push(String.fromCharCode((15 & s) << 12 | (63 & e[n + 1]) << 6 | 63 & e[n + 2])), n += 3);
  19438. }
  19439. return t.join("");
  19440. }
  19441. },
  19442. Bt = (Kt = "0123456789abcdef", {
  19443. toBytes: function toBytes(e) {
  19444. for (var t = [], n = 0; n < e.length; n += 2) {
  19445. t.push(parseInt(e.substr(n, 2), 16));
  19446. }
  19447. return t;
  19448. },
  19449. fromBytes: function fromBytes(e) {
  19450. for (var t = [], n = 0; n < e.length; n++) {
  19451. var s = e[n];
  19452. t.push(Kt[(240 & s) >> 4] + Kt[15 & s]);
  19453. }
  19454. return t.join("");
  19455. }
  19456. }),
  19457. $t = {
  19458. 16: 10,
  19459. 24: 12,
  19460. 32: 14
  19461. },
  19462. Wt = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145],
  19463. zt = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22],
  19464. Jt = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125],
  19465. Ht = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986],
  19466. Gt = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766],
  19467. Vt = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126],
  19468. Yt = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436],
  19469. Qt = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890],
  19470. Xt = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935],
  19471. Zt = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600],
  19472. en = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480],
  19473. tn = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795],
  19474. nn = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855],
  19475. sn = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150],
  19476. rn = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925];
  19477. function on(e) {
  19478. for (var t = [], n = 0; n < e.length; n += 4) {
  19479. t.push(e[n] << 24 | e[n + 1] << 16 | e[n + 2] << 8 | e[n + 3]);
  19480. }
  19481. return t;
  19482. }
  19483. var an = /*#__PURE__*/function () {
  19484. function an(e) {
  19485. (0, _classCallCheck2.default)(this, an);
  19486. if (!(this instanceof an)) throw Error("AES must be instanitated with `new`");
  19487. Object.defineProperty(this, "key", {
  19488. value: Ft(e, !0)
  19489. }), this._prepare();
  19490. }
  19491. (0, _createClass2.default)(an, [{
  19492. key: "_prepare",
  19493. value: function _prepare() {
  19494. var e = $t[this.key.length];
  19495. if (null == e) throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
  19496. this._Ke = [], this._Kd = [];
  19497. for (var t = 0; t <= e; t++) {
  19498. this._Ke.push([0, 0, 0, 0]), this._Kd.push([0, 0, 0, 0]);
  19499. }
  19500. var n,
  19501. s = 4 * (e + 1),
  19502. r = this.key.length / 4,
  19503. i = on(this.key);
  19504. for (t = 0; t < r; t++) {
  19505. n = t >> 2, this._Ke[n][t % 4] = i[t], this._Kd[e - n][t % 4] = i[t];
  19506. }
  19507. for (var o, a = 0, c = r; c < s;) {
  19508. if (o = i[r - 1], i[0] ^= zt[o >> 16 & 255] << 24 ^ zt[o >> 8 & 255] << 16 ^ zt[255 & o] << 8 ^ zt[o >> 24 & 255] ^ Wt[a] << 24, a += 1, 8 != r) for (t = 1; t < r; t++) {
  19509. i[t] ^= i[t - 1];
  19510. } else {
  19511. for (t = 1; t < r / 2; t++) {
  19512. i[t] ^= i[t - 1];
  19513. }
  19514. o = i[r / 2 - 1], i[r / 2] ^= zt[255 & o] ^ zt[o >> 8 & 255] << 8 ^ zt[o >> 16 & 255] << 16 ^ zt[o >> 24 & 255] << 24;
  19515. for (t = r / 2 + 1; t < r; t++) {
  19516. i[t] ^= i[t - 1];
  19517. }
  19518. }
  19519. for (t = 0; t < r && c < s;) {
  19520. u = c >> 2, h = c % 4, this._Ke[u][h] = i[t], this._Kd[e - u][h] = i[t++], c++;
  19521. }
  19522. }
  19523. for (var u = 1; u < e; u++) {
  19524. for (var h = 0; h < 4; h++) {
  19525. o = this._Kd[u][h], this._Kd[u][h] = tn[o >> 24 & 255] ^ nn[o >> 16 & 255] ^ sn[o >> 8 & 255] ^ rn[255 & o];
  19526. }
  19527. }
  19528. }
  19529. }, {
  19530. key: "encrypt",
  19531. value: function encrypt(e) {
  19532. if (16 != e.length) throw new Error("invalid plaintext size (must be 16 bytes)");
  19533. for (var t = this._Ke.length - 1, n = [0, 0, 0, 0], s = on(e), r = 0; r < 4; r++) {
  19534. s[r] ^= this._Ke[0][r];
  19535. }
  19536. for (var i = 1; i < t; i++) {
  19537. for (r = 0; r < 4; r++) {
  19538. n[r] = Ht[s[r] >> 24 & 255] ^ Gt[s[(r + 1) % 4] >> 16 & 255] ^ Vt[s[(r + 2) % 4] >> 8 & 255] ^ Yt[255 & s[(r + 3) % 4]] ^ this._Ke[i][r];
  19539. }
  19540. s = n.slice();
  19541. }
  19542. var o,
  19543. a = qt(16);
  19544. for (r = 0; r < 4; r++) {
  19545. o = this._Ke[t][r], a[4 * r] = 255 & (zt[s[r] >> 24 & 255] ^ o >> 24), a[4 * r + 1] = 255 & (zt[s[(r + 1) % 4] >> 16 & 255] ^ o >> 16), a[4 * r + 2] = 255 & (zt[s[(r + 2) % 4] >> 8 & 255] ^ o >> 8), a[4 * r + 3] = 255 & (zt[255 & s[(r + 3) % 4]] ^ o);
  19546. }
  19547. return a;
  19548. }
  19549. }, {
  19550. key: "decrypt",
  19551. value: function decrypt(e) {
  19552. if (16 != e.length) throw new Error("invalid ciphertext size (must be 16 bytes)");
  19553. for (var t = this._Kd.length - 1, n = [0, 0, 0, 0], s = on(e), r = 0; r < 4; r++) {
  19554. s[r] ^= this._Kd[0][r];
  19555. }
  19556. for (var i = 1; i < t; i++) {
  19557. for (r = 0; r < 4; r++) {
  19558. n[r] = Qt[s[r] >> 24 & 255] ^ Xt[s[(r + 3) % 4] >> 16 & 255] ^ Zt[s[(r + 2) % 4] >> 8 & 255] ^ en[255 & s[(r + 1) % 4]] ^ this._Kd[i][r];
  19559. }
  19560. s = n.slice();
  19561. }
  19562. var o,
  19563. a = qt(16);
  19564. for (r = 0; r < 4; r++) {
  19565. o = this._Kd[t][r], a[4 * r] = 255 & (Jt[s[r] >> 24 & 255] ^ o >> 24), a[4 * r + 1] = 255 & (Jt[s[(r + 3) % 4] >> 16 & 255] ^ o >> 16), a[4 * r + 2] = 255 & (Jt[s[(r + 2) % 4] >> 8 & 255] ^ o >> 8), a[4 * r + 3] = 255 & (Jt[255 & s[(r + 1) % 4]] ^ o);
  19566. }
  19567. return a;
  19568. }
  19569. }]);
  19570. return an;
  19571. }();
  19572. var cn = /*#__PURE__*/function () {
  19573. function cn(e) {
  19574. (0, _classCallCheck2.default)(this, cn);
  19575. if (!(this instanceof cn)) throw Error("AES must be instanitated with `new`");
  19576. this.description = "Electronic Code Block", this.name = "ecb", this._aes = new an(e);
  19577. }
  19578. (0, _createClass2.default)(cn, [{
  19579. key: "encrypt",
  19580. value: function encrypt(e) {
  19581. if ((e = Ft(e)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
  19582. for (var t = qt(e.length), n = qt(16), s = 0; s < e.length; s += 16) {
  19583. Mt(e, n, 0, s, s + 16), Mt(n = this._aes.encrypt(n), t, s);
  19584. }
  19585. return t;
  19586. }
  19587. }, {
  19588. key: "decrypt",
  19589. value: function decrypt(e) {
  19590. if ((e = Ft(e)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
  19591. for (var t = qt(e.length), n = qt(16), s = 0; s < e.length; s += 16) {
  19592. Mt(e, n, 0, s, s + 16), Mt(n = this._aes.decrypt(n), t, s);
  19593. }
  19594. return t;
  19595. }
  19596. }]);
  19597. return cn;
  19598. }();
  19599. var un = /*#__PURE__*/function () {
  19600. function un(e, t) {
  19601. (0, _classCallCheck2.default)(this, un);
  19602. if (!(this instanceof un)) throw Error("AES must be instanitated with `new`");
  19603. if (this.description = "Cipher Block Chaining", this.name = "cbc", t) {
  19604. if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 bytes)");
  19605. } else t = qt(16);
  19606. this._lastCipherblock = Ft(t, !0), this._aes = new an(e);
  19607. }
  19608. (0, _createClass2.default)(un, [{
  19609. key: "encrypt",
  19610. value: function encrypt(e) {
  19611. if ((e = Ft(e)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
  19612. for (var t = qt(e.length), n = qt(16), s = 0; s < e.length; s += 16) {
  19613. Mt(e, n, 0, s, s + 16);
  19614. for (var r = 0; r < 16; r++) {
  19615. n[r] ^= this._lastCipherblock[r];
  19616. }
  19617. this._lastCipherblock = this._aes.encrypt(n), Mt(this._lastCipherblock, t, s);
  19618. }
  19619. return t;
  19620. }
  19621. }, {
  19622. key: "decrypt",
  19623. value: function decrypt(e) {
  19624. if ((e = Ft(e)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
  19625. for (var t = qt(e.length), n = qt(16), s = 0; s < e.length; s += 16) {
  19626. Mt(e, n, 0, s, s + 16), n = this._aes.decrypt(n);
  19627. for (var r = 0; r < 16; r++) {
  19628. t[s + r] = n[r] ^ this._lastCipherblock[r];
  19629. }
  19630. Mt(e, this._lastCipherblock, 0, s, s + 16);
  19631. }
  19632. return t;
  19633. }
  19634. }]);
  19635. return un;
  19636. }();
  19637. var hn = /*#__PURE__*/function () {
  19638. function hn(e, t, n) {
  19639. (0, _classCallCheck2.default)(this, hn);
  19640. if (!(this instanceof hn)) throw Error("AES must be instanitated with `new`");
  19641. if (this.description = "Cipher Feedback", this.name = "cfb", t) {
  19642. if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 size)");
  19643. } else t = qt(16);
  19644. n || (n = 1), this.segmentSize = n, this._shiftRegister = Ft(t, !0), this._aes = new an(e);
  19645. }
  19646. (0, _createClass2.default)(hn, [{
  19647. key: "encrypt",
  19648. value: function encrypt(e) {
  19649. if (e.length % this.segmentSize != 0) throw new Error("invalid plaintext size (must be segmentSize bytes)");
  19650. for (var t, n = Ft(e, !0), s = 0; s < n.length; s += this.segmentSize) {
  19651. t = this._aes.encrypt(this._shiftRegister);
  19652. for (var r = 0; r < this.segmentSize; r++) {
  19653. n[s + r] ^= t[r];
  19654. }
  19655. Mt(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), Mt(n, this._shiftRegister, 16 - this.segmentSize, s, s + this.segmentSize);
  19656. }
  19657. return n;
  19658. }
  19659. }, {
  19660. key: "decrypt",
  19661. value: function decrypt(e) {
  19662. if (e.length % this.segmentSize != 0) throw new Error("invalid ciphertext size (must be segmentSize bytes)");
  19663. for (var t, n = Ft(e, !0), s = 0; s < n.length; s += this.segmentSize) {
  19664. t = this._aes.encrypt(this._shiftRegister);
  19665. for (var r = 0; r < this.segmentSize; r++) {
  19666. n[s + r] ^= t[r];
  19667. }
  19668. Mt(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), Mt(e, this._shiftRegister, 16 - this.segmentSize, s, s + this.segmentSize);
  19669. }
  19670. return n;
  19671. }
  19672. }]);
  19673. return hn;
  19674. }();
  19675. var ln = /*#__PURE__*/function () {
  19676. function ln(e, t) {
  19677. (0, _classCallCheck2.default)(this, ln);
  19678. if (!(this instanceof ln)) throw Error("AES must be instanitated with `new`");
  19679. if (this.description = "Output Feedback", this.name = "ofb", t) {
  19680. if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 bytes)");
  19681. } else t = qt(16);
  19682. this._lastPrecipher = Ft(t, !0), this._lastPrecipherIndex = 16, this._aes = new an(e);
  19683. }
  19684. (0, _createClass2.default)(ln, [{
  19685. key: "encrypt",
  19686. value: function encrypt(e) {
  19687. for (var t = Ft(e, !0), n = 0; n < t.length; n++) {
  19688. 16 === this._lastPrecipherIndex && (this._lastPrecipher = this._aes.encrypt(this._lastPrecipher), this._lastPrecipherIndex = 0), t[n] ^= this._lastPrecipher[this._lastPrecipherIndex++];
  19689. }
  19690. return t;
  19691. }
  19692. }, {
  19693. key: "decrypt",
  19694. value: function decrypt(e) {
  19695. return this.encrypt(e);
  19696. }
  19697. }]);
  19698. return ln;
  19699. }();
  19700. var dn = /*#__PURE__*/function () {
  19701. function dn(e) {
  19702. (0, _classCallCheck2.default)(this, dn);
  19703. if (!(this instanceof dn)) throw Error("Counter must be instanitated with `new`");
  19704. 0 === e || e || (e = 1), "number" == typeof e ? (this._counter = qt(16), this.setValue(e)) : this.setBytes(e);
  19705. }
  19706. (0, _createClass2.default)(dn, [{
  19707. key: "setValue",
  19708. value: function setValue(e) {
  19709. if ("number" != typeof e || parseInt(e) != e) throw new Error("invalid counter value (must be an integer)");
  19710. if (e > Number.MAX_SAFE_INTEGER) throw new Error("integer value out of safe range");
  19711. for (var t = 15; t >= 0; --t) {
  19712. this._counter[t] = e % 256, e = parseInt(e / 256);
  19713. }
  19714. }
  19715. }, {
  19716. key: "setBytes",
  19717. value: function setBytes(e) {
  19718. if (16 != (e = Ft(e, !0)).length) throw new Error("invalid counter bytes size (must be 16 bytes)");
  19719. this._counter = e;
  19720. }
  19721. }, {
  19722. key: "increment",
  19723. value: function increment() {
  19724. for (var e = 15; e >= 0; e--) {
  19725. if (255 !== this._counter[e]) {
  19726. this._counter[e]++;
  19727. break;
  19728. }
  19729. this._counter[e] = 0;
  19730. }
  19731. }
  19732. }]);
  19733. return dn;
  19734. }();
  19735. var pn = /*#__PURE__*/function () {
  19736. function pn(e, t) {
  19737. (0, _classCallCheck2.default)(this, pn);
  19738. if (!(this instanceof pn)) throw Error("AES must be instanitated with `new`");
  19739. this.description = "Counter", this.name = "ctr", t instanceof dn || (t = new dn(t)), this._counter = t, this._remainingCounter = null, this._remainingCounterIndex = 16, this._aes = new an(e);
  19740. }
  19741. (0, _createClass2.default)(pn, [{
  19742. key: "encrypt",
  19743. value: function encrypt(e) {
  19744. for (var t = Ft(e, !0), n = 0; n < t.length; n++) {
  19745. 16 === this._remainingCounterIndex && (this._remainingCounter = this._aes.encrypt(this._counter._counter), this._remainingCounterIndex = 0, this._counter.increment()), t[n] ^= this._remainingCounter[this._remainingCounterIndex++];
  19746. }
  19747. return t;
  19748. }
  19749. }, {
  19750. key: "decrypt",
  19751. value: function decrypt(e) {
  19752. return this.encrypt(e);
  19753. }
  19754. }]);
  19755. return pn;
  19756. }();
  19757. var fn = {
  19758. AES: an,
  19759. Counter: dn,
  19760. ModeOfOperation: {
  19761. ecb: cn,
  19762. cbc: un,
  19763. cfb: hn,
  19764. ofb: ln,
  19765. ctr: pn
  19766. },
  19767. utils: {
  19768. hex: Bt,
  19769. utf8: jt
  19770. },
  19771. padding: {
  19772. pkcs7: {
  19773. pad: function pad(e) {
  19774. var t = 16 - (e = Ft(e, !0)).length % 16,
  19775. n = qt(e.length + t);
  19776. Mt(e, n);
  19777. for (var s = e.length; s < n.length; s++) {
  19778. n[s] = t;
  19779. }
  19780. return n;
  19781. },
  19782. strip: function strip(e) {
  19783. if ((e = Ft(e, !0)).length < 16) throw new Error("PKCS#7 invalid length");
  19784. var t = e[e.length - 1];
  19785. if (t > 16) throw new Error("PKCS#7 padding byte out of range");
  19786. for (var n = e.length - t, s = 0; s < t; s++) {
  19787. if (e[n + s] !== t) throw new Error("PKCS#7 invalid padding byte");
  19788. }
  19789. var r = qt(n);
  19790. return Mt(e, r, 0, 0, n), r;
  19791. }
  19792. }
  19793. },
  19794. _arrayTest: {
  19795. coerceArray: Ft,
  19796. createArray: qt,
  19797. copyArray: Mt
  19798. }
  19799. };
  19800. function gn(e, t, n) {
  19801. var s = new Uint8Array(uni.base64ToArrayBuffer(t)),
  19802. r = fn.utils.utf8.toBytes(n),
  19803. i = fn.utils.utf8.toBytes(e),
  19804. o = new fn.ModeOfOperation.cbc(s, r),
  19805. a = fn.padding.pkcs7.pad(i),
  19806. c = o.encrypt(a);
  19807. return uni.arrayBufferToBase64(c);
  19808. }
  19809. var mn = {
  19810. code: 2e4,
  19811. message: "System error"
  19812. },
  19813. yn = {
  19814. code: 20101,
  19815. message: "Invalid client"
  19816. },
  19817. _n = {
  19818. code: 20102,
  19819. message: "Get encrypt key failed"
  19820. },
  19821. wn = {
  19822. 10001: "Secure network is not supported on current playground or unimpsdk",
  19823. 10003: "Config missing in current app. If the problem pesist, please contact DCloud.",
  19824. 10009: "Encrypt payload failed",
  19825. 10010: "Decrypt response failed"
  19826. };
  19827. function vn(e) {
  19828. var _ref25 = e || {},
  19829. t = _ref25.errSubject,
  19830. n = _ref25.subject,
  19831. s = _ref25.errCode,
  19832. r = _ref25.errMsg,
  19833. i = _ref25.code,
  19834. o = _ref25.message,
  19835. a = _ref25.cause;
  19836. return new ne({
  19837. subject: t || n || "uni-secure-network",
  19838. code: s || i || mn.code,
  19839. message: r || o,
  19840. cause: a
  19841. });
  19842. }
  19843. var In,
  19844. Sn,
  19845. bn = null;
  19846. var kn = /*#__PURE__*/function (_Lt) {
  19847. (0, _inherits2.default)(kn, _Lt);
  19848. var _super9 = _createSuper(kn);
  19849. function kn(e) {
  19850. var _this14;
  19851. (0, _classCallCheck2.default)(this, kn);
  19852. _this14 = _super9.call(this, e), _this14.clientType = "mp-weixin", _this14.userEncryptKey = null;
  19853. return _this14;
  19854. }
  19855. (0, _createClass2.default)(kn, [{
  19856. key: "isLogin",
  19857. value: function isLogin() {
  19858. return !!this.scopedGlobalCache.mpWeixinCode || !!this.scopedGlobalCache.mpWeixinOpenid;
  19859. }
  19860. }, {
  19861. key: "prepare",
  19862. value: function () {
  19863. var _prepare2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38() {
  19864. return _regenerator.default.wrap(function _callee38$(_context38) {
  19865. while (1) {
  19866. switch (_context38.prev = _context38.next) {
  19867. case 0:
  19868. if (this.isLogin()) {
  19869. _context38.next = 7;
  19870. break;
  19871. }
  19872. if (this.scopedGlobalCache.initPromise) {
  19873. _context38.next = 3;
  19874. break;
  19875. }
  19876. throw new Error("`uniCloud.initSecureNetworkByWeixin` has not yet been called");
  19877. case 3:
  19878. _context38.next = 5;
  19879. return this.scopedGlobalCache.initPromise;
  19880. case 5:
  19881. if (this.isLogin()) {
  19882. _context38.next = 7;
  19883. break;
  19884. }
  19885. throw new Error("uniCloud.initSecureNetworkByWeixin` has not yet been called or successfully excuted");
  19886. case 7:
  19887. case "end":
  19888. return _context38.stop();
  19889. }
  19890. }
  19891. }, _callee38, this);
  19892. }));
  19893. function prepare() {
  19894. return _prepare2.apply(this, arguments);
  19895. }
  19896. return prepare;
  19897. }()
  19898. }, {
  19899. key: "getUserEncryptKey",
  19900. value: function () {
  19901. var _getUserEncryptKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39() {
  19902. var _this15 = this;
  19903. var e;
  19904. return _regenerator.default.wrap(function _callee39$(_context39) {
  19905. while (1) {
  19906. switch (_context39.prev = _context39.next) {
  19907. case 0:
  19908. if (!this.userEncryptKey) {
  19909. _context39.next = 2;
  19910. break;
  19911. }
  19912. return _context39.abrupt("return", this.userEncryptKey);
  19913. case 2:
  19914. if (!(bn && bn.expireTime)) {
  19915. _context39.next = 6;
  19916. break;
  19917. }
  19918. e = Date.now();
  19919. if (!(bn.expireTime - e > 0)) {
  19920. _context39.next = 6;
  19921. break;
  19922. }
  19923. return _context39.abrupt("return", (this.userEncryptKey = bn, this.userEncryptKey));
  19924. case 6:
  19925. return _context39.abrupt("return", new Promise(function (e, t) {
  19926. uni.getUserCryptoManager().getLatestUserKey({
  19927. success: function success(t) {
  19928. bn = t, _this15.userEncryptKey = t, e(_this15.userEncryptKey);
  19929. },
  19930. fail: function fail(e) {
  19931. t(vn(_objectSpread(_objectSpread({}, _n), {}, {
  19932. cause: e
  19933. })));
  19934. }
  19935. });
  19936. }));
  19937. case 7:
  19938. case "end":
  19939. return _context39.stop();
  19940. }
  19941. }
  19942. }, _callee39, this);
  19943. }));
  19944. function getUserEncryptKey() {
  19945. return _getUserEncryptKey.apply(this, arguments);
  19946. }
  19947. return getUserEncryptKey;
  19948. }()
  19949. }, {
  19950. key: "getWxAppId",
  19951. value: function getWxAppId() {
  19952. return wx.getAccountInfoSync().miniProgram.appId;
  19953. }
  19954. }, {
  19955. key: "platformGetSignOption",
  19956. value: function () {
  19957. var _platformGetSignOption = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40() {
  19958. var _yield$this$getUserEn, e, t, n;
  19959. return _regenerator.default.wrap(function _callee40$(_context40) {
  19960. while (1) {
  19961. switch (_context40.prev = _context40.next) {
  19962. case 0:
  19963. _context40.next = 2;
  19964. return this.getUserEncryptKey();
  19965. case 2:
  19966. _yield$this$getUserEn = _context40.sent;
  19967. e = _yield$this$getUserEn.encryptKey;
  19968. t = _yield$this$getUserEn.iv;
  19969. n = _yield$this$getUserEn.version;
  19970. return _context40.abrupt("return", {
  19971. verifyClientSign: gn(JSON.stringify({
  19972. data: JSON.stringify({}),
  19973. appId: this.appId,
  19974. deviceId: this.deviceId,
  19975. wxAppId: this.getWxAppId(),
  19976. simulator: "devtools" === ce().platform,
  19977. timestamp: Date.now()
  19978. }), e, t),
  19979. encryptKeyId: n,
  19980. mpWeixinCode: this.scopedGlobalCache.mpWeixinCode,
  19981. mpWeixinOpenid: this.scopedGlobalCache.mpWeixinOpenid
  19982. });
  19983. case 7:
  19984. case "end":
  19985. return _context40.stop();
  19986. }
  19987. }
  19988. }, _callee40, this);
  19989. }));
  19990. function platformGetSignOption() {
  19991. return _platformGetSignOption.apply(this, arguments);
  19992. }
  19993. return platformGetSignOption;
  19994. }()
  19995. }, {
  19996. key: "platformEncryptData",
  19997. value: function () {
  19998. var _platformEncryptData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41(e) {
  19999. var _yield$this$getUserEn2, t, n, s, r;
  20000. return _regenerator.default.wrap(function _callee41$(_context41) {
  20001. while (1) {
  20002. switch (_context41.prev = _context41.next) {
  20003. case 0:
  20004. _context41.next = 2;
  20005. return this.getUserEncryptKey();
  20006. case 2:
  20007. _yield$this$getUserEn2 = _context41.sent;
  20008. t = _yield$this$getUserEn2.encryptKey;
  20009. n = _yield$this$getUserEn2.iv;
  20010. s = _yield$this$getUserEn2.version;
  20011. r = {
  20012. secretType: this.secretType,
  20013. encryptKeyId: s,
  20014. mpWeixinCode: this.scopedGlobalCache.mpWeixinCode,
  20015. mpWeixinOpenid: this.scopedGlobalCache.mpWeixinOpenid
  20016. };
  20017. return _context41.abrupt("return", this.secretType === Rt ? {
  20018. content: e,
  20019. _uniCloudOptions: r
  20020. } : {
  20021. content: gn(JSON.stringify({
  20022. data: JSON.stringify(e),
  20023. appId: this.appId,
  20024. deviceId: this.deviceId,
  20025. wxAppId: this.getWxAppId(),
  20026. simulator: "devtools" === ce().platform,
  20027. timestamp: Date.now()
  20028. }), t, n),
  20029. _uniCloudOptions: r
  20030. });
  20031. case 8:
  20032. case "end":
  20033. return _context41.stop();
  20034. }
  20035. }
  20036. }, _callee41, this);
  20037. }));
  20038. function platformEncryptData(_x33) {
  20039. return _platformEncryptData.apply(this, arguments);
  20040. }
  20041. return platformEncryptData;
  20042. }()
  20043. }, {
  20044. key: "platformDecryptResult",
  20045. value: function () {
  20046. var _platformDecryptResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42(e) {
  20047. var t, _yield$this$getUserEn3, n, s;
  20048. return _regenerator.default.wrap(function _callee42$(_context42) {
  20049. while (1) {
  20050. switch (_context42.prev = _context42.next) {
  20051. case 0:
  20052. t = e.content;
  20053. _context42.next = 3;
  20054. return this.getUserEncryptKey();
  20055. case 3:
  20056. _yield$this$getUserEn3 = _context42.sent;
  20057. n = _yield$this$getUserEn3.encryptKey;
  20058. s = _yield$this$getUserEn3.iv;
  20059. return _context42.abrupt("return", JSON.parse(function (e, t, n) {
  20060. var s = new Uint8Array(uni.base64ToArrayBuffer(e)),
  20061. r = new Uint8Array(uni.base64ToArrayBuffer(t)),
  20062. i = fn.utils.utf8.toBytes(n),
  20063. o = new fn.ModeOfOperation.cbc(r, i),
  20064. a = fn.padding.pkcs7.strip(o.decrypt(s));
  20065. return fn.utils.utf8.fromBytes(a);
  20066. }(t, n, s)));
  20067. case 7:
  20068. case "end":
  20069. return _context42.stop();
  20070. }
  20071. }
  20072. }, _callee42, this);
  20073. }));
  20074. function platformDecryptResult(_x34) {
  20075. return _platformDecryptResult.apply(this, arguments);
  20076. }
  20077. return platformDecryptResult;
  20078. }()
  20079. }, {
  20080. key: "isClientKeyNotFound",
  20081. value: function isClientKeyNotFound() {
  20082. return !1;
  20083. }
  20084. }]);
  20085. return kn;
  20086. }(Lt);
  20087. function Cn(e) {
  20088. var t = ["hasClientKey", "encryptGetClientKeyPayload", "setClientKey", "encrypt", "decrypt"],
  20089. n = {};
  20090. var _loop = function _loop(_s10) {
  20091. var r = t[_s10];
  20092. n[r] = function () {
  20093. for (var _len = arguments.length, t = new Array(_len), _key = 0; _key < _len; _key++) {
  20094. t[_key] = arguments[_key];
  20095. }
  20096. return new Promise(function (n, s) {
  20097. "function" == typeof e[r] ? e[r].apply(e, t.concat([function () {
  20098. var _ref26 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20099. e = _ref26.type,
  20100. t = _ref26.data,
  20101. r = _ref26.errCode,
  20102. i = _ref26.errMsg,
  20103. o = _ref26.errSubject,
  20104. a = _ref26.message;
  20105. "success" === e ? n(t) : s(vn({
  20106. errCode: r,
  20107. errMsg: wn[r] || i || a,
  20108. errSubject: o
  20109. }));
  20110. }])) : s(vn({
  20111. message: "请检查manifest.json内是否开启安全网络模块,另外注意标准基座不支持安全网络模块"
  20112. }));
  20113. });
  20114. };
  20115. };
  20116. for (var _s10 = 0; _s10 < t.length; _s10++) {
  20117. _loop(_s10);
  20118. }
  20119. return n;
  20120. }
  20121. var Tn = /*#__PURE__*/function (_Lt2) {
  20122. (0, _inherits2.default)(Tn, _Lt2);
  20123. var _super10 = _createSuper(Tn);
  20124. function Tn(e) {
  20125. var _this16;
  20126. (0, _classCallCheck2.default)(this, Tn);
  20127. _this16 = _super10.call(this, e), _this16.clientType = "app", _this16.appUtils = _objectSpread({}, Cn(uni.requireNativePlugin("plus"))), _this16.systemInfo = In || (In = ce());
  20128. return _this16;
  20129. }
  20130. (0, _createClass2.default)(Tn, [{
  20131. key: "hasClientKey",
  20132. value: function () {
  20133. var _hasClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43() {
  20134. return _regenerator.default.wrap(function _callee43$(_context43) {
  20135. while (1) {
  20136. switch (_context43.prev = _context43.next) {
  20137. case 0:
  20138. _context43.next = 2;
  20139. return this.appUtils.hasClientKey({
  20140. provider: this.provider,
  20141. spaceId: this.spaceId
  20142. });
  20143. case 2:
  20144. this._hasClientKey = _context43.sent;
  20145. return _context43.abrupt("return", this._hasClientKey);
  20146. case 4:
  20147. case "end":
  20148. return _context43.stop();
  20149. }
  20150. }
  20151. }, _callee43, this);
  20152. }));
  20153. function hasClientKey() {
  20154. return _hasClientKey.apply(this, arguments);
  20155. }
  20156. return hasClientKey;
  20157. }()
  20158. }, {
  20159. key: "getAppClientKey",
  20160. value: function () {
  20161. var _getAppClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44() {
  20162. var _yield$this$appUtils$, e, t, n, s, r;
  20163. return _regenerator.default.wrap(function _callee44$(_context44) {
  20164. while (1) {
  20165. switch (_context44.prev = _context44.next) {
  20166. case 0:
  20167. _context44.next = 2;
  20168. return this.appUtils.encryptGetClientKeyPayload({
  20169. data: JSON.stringify({})
  20170. });
  20171. case 2:
  20172. _yield$this$appUtils$ = _context44.sent;
  20173. e = _yield$this$appUtils$.data;
  20174. t = _yield$this$appUtils$.key;
  20175. _context44.next = 7;
  20176. return this.uniCloudIns.callFunction({
  20177. name: "DCloud-clientDB",
  20178. data: {
  20179. redirectTo: "encryption",
  20180. action: "getAppClientKey",
  20181. data: e,
  20182. key: t
  20183. }
  20184. });
  20185. case 7:
  20186. _context44.t0 = _context44.sent.result;
  20187. if (_context44.t0) {
  20188. _context44.next = 10;
  20189. break;
  20190. }
  20191. _context44.t0 = {};
  20192. case 10:
  20193. n = _context44.t0;
  20194. if (!(0 !== n.errCode)) {
  20195. _context44.next = 13;
  20196. break;
  20197. }
  20198. throw function (e) {
  20199. return new ne({
  20200. subject: e.errSubject || "uni-secure-network",
  20201. code: e.errCode || e.code || mn.code,
  20202. message: e.errMsg || e.message
  20203. });
  20204. }(n);
  20205. case 13:
  20206. s = n.clientKey, r = n.key;
  20207. _context44.next = 16;
  20208. return this.appUtils.setClientKey({
  20209. provider: this.provider,
  20210. spaceId: this.spaceId,
  20211. clientKey: s,
  20212. key: r
  20213. });
  20214. case 16:
  20215. case "end":
  20216. return _context44.stop();
  20217. }
  20218. }
  20219. }, _callee44, this);
  20220. }));
  20221. function getAppClientKey() {
  20222. return _getAppClientKey.apply(this, arguments);
  20223. }
  20224. return getAppClientKey;
  20225. }()
  20226. }, {
  20227. key: "ensureClientKey",
  20228. value: function () {
  20229. var _ensureClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45() {
  20230. var _this17 = this;
  20231. var _ref27,
  20232. _ref27$forceUpdate,
  20233. e,
  20234. _args45 = arguments;
  20235. return _regenerator.default.wrap(function _callee45$(_context45) {
  20236. while (1) {
  20237. switch (_context45.prev = _context45.next) {
  20238. case 0:
  20239. _ref27 = _args45.length > 0 && _args45[0] !== undefined ? _args45[0] : {}, _ref27$forceUpdate = _ref27.forceUpdate, e = _ref27$forceUpdate === void 0 ? !1 : _ref27$forceUpdate;
  20240. _context45.t1 = !0;
  20241. _context45.next = 4;
  20242. return this.hasClientKey();
  20243. case 4:
  20244. _context45.t2 = _context45.sent;
  20245. _context45.t0 = _context45.t1 !== _context45.t2;
  20246. if (_context45.t0) {
  20247. _context45.next = 8;
  20248. break;
  20249. }
  20250. _context45.t0 = e;
  20251. case 8:
  20252. if (!_context45.t0) {
  20253. _context45.next = 10;
  20254. break;
  20255. }
  20256. return _context45.abrupt("return", (e && this.scopedGlobalCache.initPromise && this.scopedGlobalCache.initStatus === d || !e && this.scopedGlobalCache.initPromise && this.scopedGlobalCache.initStatus !== f || (this.scopedGlobalCache.initPromise = this.getAppClientKey(), this.scopedGlobalCache.initPromise.then(function (e) {
  20257. _this17.scopedGlobalCache.initStatus = p;
  20258. }).catch(function (e) {
  20259. throw _this17.scopedGlobalCache.initStatus = f, e;
  20260. }), this.scopedGlobalCache.initStatus = d), this.scopedGlobalCache.initPromise));
  20261. case 10:
  20262. case "end":
  20263. return _context45.stop();
  20264. }
  20265. }
  20266. }, _callee45, this);
  20267. }));
  20268. function ensureClientKey() {
  20269. return _ensureClientKey.apply(this, arguments);
  20270. }
  20271. return ensureClientKey;
  20272. }()
  20273. }, {
  20274. key: "prepare",
  20275. value: function () {
  20276. var _prepare3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46() {
  20277. var _ref28,
  20278. _ref28$forceUpdate,
  20279. e,
  20280. _args46 = arguments;
  20281. return _regenerator.default.wrap(function _callee46$(_context46) {
  20282. while (1) {
  20283. switch (_context46.prev = _context46.next) {
  20284. case 0:
  20285. _ref28 = _args46.length > 0 && _args46[0] !== undefined ? _args46[0] : {}, _ref28$forceUpdate = _ref28.forceUpdate, e = _ref28$forceUpdate === void 0 ? !1 : _ref28$forceUpdate;
  20286. _context46.next = 3;
  20287. return this.ensureClientKey({
  20288. forceUpdate: e
  20289. });
  20290. case 3:
  20291. case "end":
  20292. return _context46.stop();
  20293. }
  20294. }
  20295. }, _callee46, this);
  20296. }));
  20297. function prepare() {
  20298. return _prepare3.apply(this, arguments);
  20299. }
  20300. return prepare;
  20301. }()
  20302. }, {
  20303. key: "platformGetSignOption",
  20304. value: function () {
  20305. var _platformGetSignOption2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47() {
  20306. var _yield$this$appUtils$2, e, t;
  20307. return _regenerator.default.wrap(function _callee47$(_context47) {
  20308. while (1) {
  20309. switch (_context47.prev = _context47.next) {
  20310. case 0:
  20311. _context47.next = 2;
  20312. return this.appUtils.encrypt({
  20313. provider: this.provider,
  20314. spaceId: this.spaceId,
  20315. data: JSON.stringify({})
  20316. });
  20317. case 2:
  20318. _yield$this$appUtils$2 = _context47.sent;
  20319. e = _yield$this$appUtils$2.data;
  20320. t = _yield$this$appUtils$2.key;
  20321. return _context47.abrupt("return", {
  20322. verifyClientSign: e,
  20323. encryptKeyId: t
  20324. });
  20325. case 6:
  20326. case "end":
  20327. return _context47.stop();
  20328. }
  20329. }
  20330. }, _callee47, this);
  20331. }));
  20332. function platformGetSignOption() {
  20333. return _platformGetSignOption2.apply(this, arguments);
  20334. }
  20335. return platformGetSignOption;
  20336. }()
  20337. }, {
  20338. key: "platformEncryptData",
  20339. value: function () {
  20340. var _platformEncryptData2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(e) {
  20341. var _yield$this$appUtils$3, t, n, s;
  20342. return _regenerator.default.wrap(function _callee48$(_context48) {
  20343. while (1) {
  20344. switch (_context48.prev = _context48.next) {
  20345. case 0:
  20346. _context48.next = 2;
  20347. return this.appUtils.encrypt({
  20348. provider: this.provider,
  20349. spaceId: this.spaceId,
  20350. data: JSON.stringify(e)
  20351. });
  20352. case 2:
  20353. _yield$this$appUtils$3 = _context48.sent;
  20354. t = _yield$this$appUtils$3.data;
  20355. n = _yield$this$appUtils$3.key;
  20356. s = {
  20357. secretType: this.secretType,
  20358. encryptKeyId: n
  20359. };
  20360. return _context48.abrupt("return", this.secretType === Rt ? {
  20361. content: e,
  20362. _uniCloudOptions: s
  20363. } : {
  20364. content: t,
  20365. _uniCloudOptions: s
  20366. });
  20367. case 7:
  20368. case "end":
  20369. return _context48.stop();
  20370. }
  20371. }
  20372. }, _callee48, this);
  20373. }));
  20374. function platformEncryptData(_x35) {
  20375. return _platformEncryptData2.apply(this, arguments);
  20376. }
  20377. return platformEncryptData;
  20378. }()
  20379. }, {
  20380. key: "platformDecryptResult",
  20381. value: function () {
  20382. var _platformDecryptResult2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49(e) {
  20383. var t, _e$_uniCloudOptions, n, s, r;
  20384. return _regenerator.default.wrap(function _callee49$(_context49) {
  20385. while (1) {
  20386. switch (_context49.prev = _context49.next) {
  20387. case 0:
  20388. t = e.content;
  20389. _e$_uniCloudOptions = e._uniCloudOptions;
  20390. n = _e$_uniCloudOptions === void 0 ? {} : _e$_uniCloudOptions;
  20391. s = n.encryptKeyId;
  20392. _context49.next = 6;
  20393. return this.appUtils.decrypt({
  20394. provider: this.provider,
  20395. spaceId: this.spaceId,
  20396. data: t,
  20397. key: s
  20398. });
  20399. case 6:
  20400. r = _context49.sent;
  20401. return _context49.abrupt("return", JSON.parse(r.data));
  20402. case 8:
  20403. case "end":
  20404. return _context49.stop();
  20405. }
  20406. }
  20407. }, _callee49, this);
  20408. }));
  20409. function platformDecryptResult(_x36) {
  20410. return _platformDecryptResult2.apply(this, arguments);
  20411. }
  20412. return platformDecryptResult;
  20413. }()
  20414. }, {
  20415. key: "isClientKeyNotFound",
  20416. value: function isClientKeyNotFound() {
  20417. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20418. var t = e.result || {};
  20419. return 70009 === t.errCode && "uni-secure-network" === t.errSubject;
  20420. }
  20421. }]);
  20422. return Tn;
  20423. }(Lt);
  20424. function Pn() {
  20425. var _ref29 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20426. e = _ref29.secretType;
  20427. return e === xt || e === Rt || e === Ut;
  20428. }
  20429. function An() {
  20430. var _ref30 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20431. e = _ref30.name,
  20432. _ref30$data = _ref30.data,
  20433. t = _ref30$data === void 0 ? {} : _ref30$data;
  20434. return "app" === P && "DCloud-clientDB" === e && "encryption" === t.redirectTo && "getAppClientKey" === t.action;
  20435. }
  20436. function En() {
  20437. var _ref31 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20438. e = _ref31.provider,
  20439. t = _ref31.spaceId,
  20440. n = _ref31.functionName;
  20441. var _ce = ce(),
  20442. s = _ce.appId,
  20443. r = _ce.uniPlatform,
  20444. i = _ce.osName;
  20445. var o = r;
  20446. "app" === r && (o = i);
  20447. var a = function () {
  20448. var _ref32 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20449. e = _ref32.provider,
  20450. t = _ref32.spaceId;
  20451. var n = T;
  20452. if (!n) return {};
  20453. e = function (e) {
  20454. return "tencent" === e ? "tcb" : e;
  20455. }(e);
  20456. var s = n.find(function (n) {
  20457. return n.provider === e && n.spaceId === t;
  20458. });
  20459. return s && s.config;
  20460. }({
  20461. provider: e,
  20462. spaceId: t
  20463. });
  20464. if (!a || !a.accessControl || !a.accessControl.enable) return !1;
  20465. var c = a.accessControl.function || {},
  20466. u = Object.keys(c);
  20467. if (0 === u.length) return !0;
  20468. var h = function (e, t) {
  20469. var n, s, r;
  20470. for (var _i2 = 0; _i2 < e.length; _i2++) {
  20471. var _o2 = e[_i2];
  20472. _o2 !== t ? "*" !== _o2 ? _o2.split(",").map(function (e) {
  20473. return e.trim();
  20474. }).indexOf(t) > -1 && (s = _o2) : r = _o2 : n = _o2;
  20475. }
  20476. return n || s || r;
  20477. }(u, n);
  20478. if (!h) return !1;
  20479. if ((c[h] || []).find(function () {
  20480. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20481. return e.appId === s && (e.platform || "").toLowerCase() === o.toLowerCase();
  20482. })) return !0;
  20483. throw console.error("\u6B64\u5E94\u7528[appId: ".concat(s, ", platform: ").concat(o, "]\u4E0D\u5728\u4E91\u7AEF\u914D\u7F6E\u7684\u5141\u8BB8\u8BBF\u95EE\u7684\u5E94\u7528\u5217\u8868\u5185\uFF0C\u53C2\u8003\uFF1Ahttps://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client")), vn(yn);
  20484. }
  20485. function On(_ref33) {
  20486. var e = _ref33.functionName,
  20487. t = _ref33.result,
  20488. n = _ref33.logPvd;
  20489. if (b && this.__dev__.debugLog && t && t.requestId) {
  20490. var _s11 = JSON.stringify({
  20491. spaceId: this.config.spaceId,
  20492. functionName: e,
  20493. requestId: t.requestId
  20494. });
  20495. console.log("[".concat(n, "-request]").concat(_s11, "[/").concat(n, "-request]"));
  20496. }
  20497. }
  20498. function xn(e) {
  20499. var t = e.callFunction,
  20500. n = function n(_n7) {
  20501. var _this18 = this;
  20502. var s = _n7.name;
  20503. _n7.data = kt.call(e, {
  20504. data: _n7.data
  20505. });
  20506. var r = {
  20507. aliyun: "aliyun",
  20508. tencent: "tcb",
  20509. tcb: "tcb"
  20510. }[this.config.provider],
  20511. i = Pn(_n7),
  20512. o = An(_n7),
  20513. a = i || o;
  20514. return t.call(this, _n7).then(function (e) {
  20515. return e.errCode = 0, !a && On.call(_this18, {
  20516. functionName: s,
  20517. result: e,
  20518. logPvd: r
  20519. }), Promise.resolve(e);
  20520. }, function (e) {
  20521. return !a && On.call(_this18, {
  20522. functionName: s,
  20523. result: e,
  20524. logPvd: r
  20525. }), e && e.message && (e.message = function () {
  20526. var _ref34 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20527. _ref34$message = _ref34.message,
  20528. e = _ref34$message === void 0 ? "" : _ref34$message,
  20529. _ref34$extraInfo = _ref34.extraInfo,
  20530. t = _ref34$extraInfo === void 0 ? {} : _ref34$extraInfo,
  20531. _ref34$formatter = _ref34.formatter,
  20532. n = _ref34$formatter === void 0 ? [] : _ref34$formatter;
  20533. for (var _s12 = 0; _s12 < n.length; _s12++) {
  20534. var _n$_s = n[_s12],
  20535. _r4 = _n$_s.rule,
  20536. _i3 = _n$_s.content,
  20537. _o3 = _n$_s.mode,
  20538. _a = e.match(_r4);
  20539. if (!_a) continue;
  20540. var _c = _i3;
  20541. for (var _e20 = 1; _e20 < _a.length; _e20++) {
  20542. _c = Et(_c, "{$".concat(_e20, "}"), _a[_e20]);
  20543. }
  20544. for (var _e21 in t) {
  20545. _c = Et(_c, "{".concat(_e21, "}"), t[_e21]);
  20546. }
  20547. return "replace" === _o3 ? _c : e + _c;
  20548. }
  20549. return e;
  20550. }({
  20551. message: "[".concat(_n7.name, "]: ").concat(e.message),
  20552. formatter: Tt,
  20553. extraInfo: {
  20554. functionName: s
  20555. }
  20556. })), Promise.reject(e);
  20557. });
  20558. };
  20559. e.callFunction = function (t) {
  20560. var _e$config = e.config,
  20561. s = _e$config.provider,
  20562. r = _e$config.spaceId,
  20563. i = t.name;
  20564. var o, a;
  20565. if (t.data = t.data || {}, b && e.__dev__.debugInfo && !e.__dev__.debugInfo.forceRemote && E ? (e._callCloudFunction || (e._callCloudFunction = n, e._callLocalFunction = Ct), o = Ct) : o = n, o = o.bind(e), An(t)) a = n.call(e, t);else if (function (_ref35) {
  20566. var e = _ref35.name,
  20567. _ref35$data = _ref35.data,
  20568. t = _ref35$data === void 0 ? {} : _ref35$data;
  20569. return "mp-weixin" === P && "uni-id-co" === e && "secureNetworkHandshakeByWeixin" === t.method;
  20570. }(t)) a = o.call(e, t);else if (Pn(t)) {
  20571. a = new Sn({
  20572. secretType: t.secretType,
  20573. uniCloudIns: e
  20574. }).wrapEncryptDataCallFunction(n.bind(e))(t);
  20575. } else if (En({
  20576. provider: s,
  20577. spaceId: r,
  20578. functionName: i
  20579. })) {
  20580. a = new Sn({
  20581. secretType: t.secretType,
  20582. uniCloudIns: e
  20583. }).wrapVerifyClientCallFunction(n.bind(e))(t);
  20584. } else a = o(t);
  20585. return Object.defineProperty(a, "result", {
  20586. get: function get() {
  20587. return console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"), {};
  20588. }
  20589. }), a;
  20590. };
  20591. }
  20592. Sn = "mp-weixin" !== P && "app" !== P ? /*#__PURE__*/function () {
  20593. function _class2() {
  20594. (0, _classCallCheck2.default)(this, _class2);
  20595. throw vn({
  20596. message: "Platform ".concat(P, " is not supported by secure network")
  20597. });
  20598. }
  20599. return (0, _createClass2.default)(_class2);
  20600. }() : C ? "mp-weixin" === P ? kn : Tn : /*#__PURE__*/function () {
  20601. function _class3() {
  20602. (0, _classCallCheck2.default)(this, _class3);
  20603. throw vn({
  20604. message: "Platform ".concat(P, " is not enabled, please check whether secure network module is enabled in your manifest.json")
  20605. });
  20606. }
  20607. return (0, _createClass2.default)(_class3);
  20608. }();
  20609. var Rn = Symbol("CLIENT_DB_INTERNAL");
  20610. function Un(e, t) {
  20611. return e.then = "DoNotReturnProxyWithAFunctionNamedThen", e._internalType = Rn, e.inspect = null, e.__ob__ = void 0, new Proxy(e, {
  20612. get: function get(e, n, s) {
  20613. if ("_uniClient" === n) return null;
  20614. if ("symbol" == (0, _typeof2.default)(n)) return e[n];
  20615. if (n in e || "string" != typeof n) {
  20616. var _t10 = e[n];
  20617. return "function" == typeof _t10 ? _t10.bind(e) : _t10;
  20618. }
  20619. return t.get(e, n, s);
  20620. }
  20621. });
  20622. }
  20623. function Ln(e) {
  20624. return {
  20625. on: function on(t, n) {
  20626. e[t] = e[t] || [], e[t].indexOf(n) > -1 || e[t].push(n);
  20627. },
  20628. off: function off(t, n) {
  20629. e[t] = e[t] || [];
  20630. var s = e[t].indexOf(n);
  20631. -1 !== s && e[t].splice(s, 1);
  20632. }
  20633. };
  20634. }
  20635. var Nn = ["db.Geo", "db.command", "command.aggregate"];
  20636. function Dn(e, t) {
  20637. return Nn.indexOf("".concat(e, ".").concat(t)) > -1;
  20638. }
  20639. function Fn(e) {
  20640. switch (g(e)) {
  20641. case "array":
  20642. return e.map(function (e) {
  20643. return Fn(e);
  20644. });
  20645. case "object":
  20646. return e._internalType === Rn || Object.keys(e).forEach(function (t) {
  20647. e[t] = Fn(e[t]);
  20648. }), e;
  20649. case "regexp":
  20650. return {
  20651. $regexp: {
  20652. source: e.source,
  20653. flags: e.flags
  20654. }
  20655. };
  20656. case "date":
  20657. return {
  20658. $date: e.toISOString()
  20659. };
  20660. default:
  20661. return e;
  20662. }
  20663. }
  20664. function qn(e) {
  20665. return e && e.content && e.content.$method;
  20666. }
  20667. var Mn = /*#__PURE__*/function () {
  20668. function Mn(e, t, n) {
  20669. (0, _classCallCheck2.default)(this, Mn);
  20670. this.content = e, this.prevStage = t || null, this.udb = null, this._database = n;
  20671. }
  20672. (0, _createClass2.default)(Mn, [{
  20673. key: "toJSON",
  20674. value: function toJSON() {
  20675. var e = this;
  20676. var t = [e.content];
  20677. for (; e.prevStage;) {
  20678. e = e.prevStage, t.push(e.content);
  20679. }
  20680. return {
  20681. $db: t.reverse().map(function (e) {
  20682. return {
  20683. $method: e.$method,
  20684. $param: Fn(e.$param)
  20685. };
  20686. })
  20687. };
  20688. }
  20689. }, {
  20690. key: "toString",
  20691. value: function toString() {
  20692. return JSON.stringify(this.toJSON());
  20693. }
  20694. }, {
  20695. key: "getAction",
  20696. value: function getAction() {
  20697. var e = this.toJSON().$db.find(function (e) {
  20698. return "action" === e.$method;
  20699. });
  20700. return e && e.$param && e.$param[0];
  20701. }
  20702. }, {
  20703. key: "getCommand",
  20704. value: function getCommand() {
  20705. return {
  20706. $db: this.toJSON().$db.filter(function (e) {
  20707. return "action" !== e.$method;
  20708. })
  20709. };
  20710. }
  20711. }, {
  20712. key: "isAggregate",
  20713. get: function get() {
  20714. var e = this;
  20715. for (; e;) {
  20716. var t = qn(e),
  20717. _n8 = qn(e.prevStage);
  20718. if ("aggregate" === t && "collection" === _n8 || "pipeline" === t) return !0;
  20719. e = e.prevStage;
  20720. }
  20721. return !1;
  20722. }
  20723. }, {
  20724. key: "isCommand",
  20725. get: function get() {
  20726. var e = this;
  20727. for (; e;) {
  20728. if ("command" === qn(e)) return !0;
  20729. e = e.prevStage;
  20730. }
  20731. return !1;
  20732. }
  20733. }, {
  20734. key: "isAggregateCommand",
  20735. get: function get() {
  20736. var e = this;
  20737. for (; e;) {
  20738. var t = qn(e),
  20739. _n9 = qn(e.prevStage);
  20740. if ("aggregate" === t && "command" === _n9) return !0;
  20741. e = e.prevStage;
  20742. }
  20743. return !1;
  20744. }
  20745. }, {
  20746. key: "getNextStageFn",
  20747. value: function getNextStageFn(e) {
  20748. var t = this;
  20749. return function () {
  20750. return Kn({
  20751. $method: e,
  20752. $param: Fn(Array.from(arguments))
  20753. }, t, t._database);
  20754. };
  20755. }
  20756. }, {
  20757. key: "count",
  20758. get: function get() {
  20759. return this.isAggregate ? this.getNextStageFn("count") : function () {
  20760. return this._send("count", Array.from(arguments));
  20761. };
  20762. }
  20763. }, {
  20764. key: "remove",
  20765. get: function get() {
  20766. return this.isCommand ? this.getNextStageFn("remove") : function () {
  20767. return this._send("remove", Array.from(arguments));
  20768. };
  20769. }
  20770. }, {
  20771. key: "get",
  20772. value: function get() {
  20773. return this._send("get", Array.from(arguments));
  20774. }
  20775. }, {
  20776. key: "add",
  20777. get: function get() {
  20778. return this.isCommand ? this.getNextStageFn("add") : function () {
  20779. return this._send("add", Array.from(arguments));
  20780. };
  20781. }
  20782. }, {
  20783. key: "update",
  20784. value: function update() {
  20785. return this._send("update", Array.from(arguments));
  20786. }
  20787. }, {
  20788. key: "end",
  20789. value: function end() {
  20790. return this._send("end", Array.from(arguments));
  20791. }
  20792. }, {
  20793. key: "set",
  20794. get: function get() {
  20795. return this.isCommand ? this.getNextStageFn("set") : function () {
  20796. throw new Error("JQL禁止使用set方法");
  20797. };
  20798. }
  20799. }, {
  20800. key: "_send",
  20801. value: function _send(e, t) {
  20802. var n = this.getAction(),
  20803. s = this.getCommand();
  20804. if (s.$db.push({
  20805. $method: e,
  20806. $param: Fn(t)
  20807. }), b) {
  20808. var _e22 = s.$db.find(function (e) {
  20809. return "collection" === e.$method;
  20810. }),
  20811. _t11 = _e22 && _e22.$param;
  20812. _t11 && 1 === _t11.length && "string" == typeof _e22.$param[0] && _e22.$param[0].indexOf(",") > -1 && console.warn("检测到使用JQL语法联表查询时,未使用getTemp先过滤主表数据,在主表数据量大的情况下可能会查询缓慢。\n- 如何优化请参考此文档:https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp \n- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。");
  20813. }
  20814. return this._database._callCloudFunction({
  20815. action: n,
  20816. command: s
  20817. });
  20818. }
  20819. }]);
  20820. return Mn;
  20821. }();
  20822. function Kn(e, t, n) {
  20823. return Un(new Mn(e, t, n), {
  20824. get: function get(e, t) {
  20825. var s = "db";
  20826. return e && e.content && (s = e.content.$method), Dn(s, t) ? Kn({
  20827. $method: t
  20828. }, e, n) : function () {
  20829. return Kn({
  20830. $method: t,
  20831. $param: Fn(Array.from(arguments))
  20832. }, e, n);
  20833. };
  20834. }
  20835. });
  20836. }
  20837. function jn(_ref36) {
  20838. var e = _ref36.path,
  20839. t = _ref36.method;
  20840. return /*#__PURE__*/function () {
  20841. function _class4() {
  20842. (0, _classCallCheck2.default)(this, _class4);
  20843. this.param = Array.from(arguments);
  20844. }
  20845. (0, _createClass2.default)(_class4, [{
  20846. key: "toJSON",
  20847. value: function toJSON() {
  20848. return {
  20849. $newDb: [].concat((0, _toConsumableArray2.default)(e.map(function (e) {
  20850. return {
  20851. $method: e
  20852. };
  20853. })), [{
  20854. $method: t,
  20855. $param: this.param
  20856. }])
  20857. };
  20858. }
  20859. }, {
  20860. key: "toString",
  20861. value: function toString() {
  20862. return JSON.stringify(this.toJSON());
  20863. }
  20864. }]);
  20865. return _class4;
  20866. }();
  20867. }
  20868. function Bn(e) {
  20869. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20870. return Un(new e(t), {
  20871. get: function get(e, t) {
  20872. return Dn("db", t) ? Kn({
  20873. $method: t
  20874. }, null, e) : function () {
  20875. return Kn({
  20876. $method: t,
  20877. $param: Fn(Array.from(arguments))
  20878. }, null, e);
  20879. };
  20880. }
  20881. });
  20882. }
  20883. var $n = /*#__PURE__*/function (_ref37) {
  20884. (0, _inherits2.default)($n, _ref37);
  20885. var _super11 = _createSuper($n);
  20886. function $n() {
  20887. (0, _classCallCheck2.default)(this, $n);
  20888. return _super11.apply(this, arguments);
  20889. }
  20890. (0, _createClass2.default)($n, [{
  20891. key: "_parseResult",
  20892. value: function _parseResult(e) {
  20893. return this._isJQL ? e.result : e;
  20894. }
  20895. }, {
  20896. key: "_callCloudFunction",
  20897. value: function _callCloudFunction(_ref38) {
  20898. var _this19 = this;
  20899. var e = _ref38.action,
  20900. t = _ref38.command,
  20901. n = _ref38.multiCommand,
  20902. s = _ref38.queryList;
  20903. function r(e, t) {
  20904. if (n && s) for (var _n10 = 0; _n10 < s.length; _n10++) {
  20905. var _r5 = s[_n10];
  20906. _r5.udb && "function" == typeof _r5.udb.setResult && (t ? _r5.udb.setResult(t) : _r5.udb.setResult(e.result.dataList[_n10]));
  20907. }
  20908. }
  20909. var i = this,
  20910. o = this._isJQL ? "databaseForJQL" : "database";
  20911. function a(e) {
  20912. return i._callback("error", [e]), q(M(o, "fail"), e).then(function () {
  20913. return q(M(o, "complete"), e);
  20914. }).then(function () {
  20915. return r(null, e), Q(B, {
  20916. type: z,
  20917. content: e
  20918. }), Promise.reject(e);
  20919. });
  20920. }
  20921. var c = q(M(o, "invoke")),
  20922. u = this._uniClient;
  20923. return c.then(function () {
  20924. return u.callFunction({
  20925. name: "DCloud-clientDB",
  20926. type: l,
  20927. data: {
  20928. action: e,
  20929. command: t,
  20930. multiCommand: n
  20931. }
  20932. });
  20933. }).then(function (e) {
  20934. var _e$result = e.result,
  20935. t = _e$result.code,
  20936. n = _e$result.message,
  20937. s = _e$result.token,
  20938. c = _e$result.tokenExpired,
  20939. _e$result$systemInfo = _e$result.systemInfo,
  20940. u = _e$result$systemInfo === void 0 ? [] : _e$result$systemInfo;
  20941. if (u) for (var _e23 = 0; _e23 < u.length; _e23++) {
  20942. var _u$_e = u[_e23],
  20943. _t12 = _u$_e.level,
  20944. _n11 = _u$_e.message,
  20945. _s13 = _u$_e.detail,
  20946. _r6 = console["app" === P && "warn" === _t12 ? "error" : _t12] || console.log;
  20947. var _i4 = "[System Info]" + _n11;
  20948. _s13 && (_i4 = "".concat(_i4, "\n\u8BE6\u7EC6\u4FE1\u606F\uFF1A").concat(_s13)), _r6(_i4);
  20949. }
  20950. if (t) {
  20951. return a(new ne({
  20952. code: t,
  20953. message: n,
  20954. requestId: e.requestId
  20955. }));
  20956. }
  20957. e.result.errCode = e.result.errCode || e.result.code, e.result.errMsg = e.result.errMsg || e.result.message, s && c && (ie({
  20958. token: s,
  20959. tokenExpired: c
  20960. }), _this19._callbackAuth("refreshToken", [{
  20961. token: s,
  20962. tokenExpired: c
  20963. }]), _this19._callback("refreshToken", [{
  20964. token: s,
  20965. tokenExpired: c
  20966. }]), Q(W, {
  20967. token: s,
  20968. tokenExpired: c
  20969. }));
  20970. var h = [{
  20971. prop: "affectedDocs",
  20972. tips: "affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代"
  20973. }, {
  20974. prop: "code",
  20975. tips: "code不再推荐使用,请使用errCode替代"
  20976. }, {
  20977. prop: "message",
  20978. tips: "message不再推荐使用,请使用errMsg替代"
  20979. }];
  20980. var _loop2 = function _loop2(_t13) {
  20981. var _h$_t = h[_t13],
  20982. n = _h$_t.prop,
  20983. s = _h$_t.tips;
  20984. if (n in e.result) {
  20985. var _t14 = e.result[n];
  20986. Object.defineProperty(e.result, n, {
  20987. get: function get() {
  20988. return console.warn(s), _t14;
  20989. }
  20990. });
  20991. }
  20992. };
  20993. for (var _t13 = 0; _t13 < h.length; _t13++) {
  20994. _loop2(_t13);
  20995. }
  20996. return function (e) {
  20997. return q(M(o, "success"), e).then(function () {
  20998. return q(M(o, "complete"), e);
  20999. }).then(function () {
  21000. r(e, null);
  21001. var t = i._parseResult(e);
  21002. return Q(B, {
  21003. type: z,
  21004. content: t
  21005. }), Promise.resolve(t);
  21006. });
  21007. }(e);
  21008. }, function (e) {
  21009. /fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message) && console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB");
  21010. return a(new ne({
  21011. code: e.code || "SYSTEM_ERROR",
  21012. message: e.message,
  21013. requestId: e.requestId
  21014. }));
  21015. });
  21016. }
  21017. }]);
  21018. return $n;
  21019. }( /*#__PURE__*/function () {
  21020. function _class5() {
  21021. var _ref39 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  21022. _ref39$uniClient = _ref39.uniClient,
  21023. e = _ref39$uniClient === void 0 ? {} : _ref39$uniClient,
  21024. _ref39$isJQL = _ref39.isJQL,
  21025. t = _ref39$isJQL === void 0 ? !1 : _ref39$isJQL;
  21026. (0, _classCallCheck2.default)(this, _class5);
  21027. this._uniClient = e, this._authCallBacks = {}, this._dbCallBacks = {}, e._isDefault && (this._dbCallBacks = U("_globalUniCloudDatabaseCallback")), t || (this.auth = Ln(this._authCallBacks)), this._isJQL = t, Object.assign(this, Ln(this._dbCallBacks)), this.env = Un({}, {
  21028. get: function get(e, t) {
  21029. return {
  21030. $env: t
  21031. };
  21032. }
  21033. }), this.Geo = Un({}, {
  21034. get: function get(e, t) {
  21035. return jn({
  21036. path: ["Geo"],
  21037. method: t
  21038. });
  21039. }
  21040. }), this.serverDate = jn({
  21041. path: [],
  21042. method: "serverDate"
  21043. }), this.RegExp = jn({
  21044. path: [],
  21045. method: "RegExp"
  21046. });
  21047. }
  21048. (0, _createClass2.default)(_class5, [{
  21049. key: "getCloudEnv",
  21050. value: function getCloudEnv(e) {
  21051. if ("string" != typeof e || !e.trim()) throw new Error("getCloudEnv参数错误");
  21052. return {
  21053. $env: e.replace("$cloudEnv_", "")
  21054. };
  21055. }
  21056. }, {
  21057. key: "_callback",
  21058. value: function _callback(e, t) {
  21059. var n = this._dbCallBacks;
  21060. n[e] && n[e].forEach(function (e) {
  21061. e.apply(void 0, (0, _toConsumableArray2.default)(t));
  21062. });
  21063. }
  21064. }, {
  21065. key: "_callbackAuth",
  21066. value: function _callbackAuth(e, t) {
  21067. var n = this._authCallBacks;
  21068. n[e] && n[e].forEach(function (e) {
  21069. e.apply(void 0, (0, _toConsumableArray2.default)(t));
  21070. });
  21071. }
  21072. }, {
  21073. key: "multiSend",
  21074. value: function multiSend() {
  21075. var e = Array.from(arguments),
  21076. t = e.map(function (e) {
  21077. var t = e.getAction(),
  21078. n = e.getCommand();
  21079. if ("getTemp" !== n.$db[n.$db.length - 1].$method) throw new Error("multiSend只支持子命令内使用getTemp");
  21080. return {
  21081. action: t,
  21082. command: n
  21083. };
  21084. });
  21085. return this._callCloudFunction({
  21086. multiCommand: t,
  21087. queryList: e
  21088. });
  21089. }
  21090. }]);
  21091. return _class5;
  21092. }());
  21093. var Wn = "token无效,跳转登录页面",
  21094. zn = "token过期,跳转登录页面",
  21095. Jn = {
  21096. TOKEN_INVALID_TOKEN_EXPIRED: zn,
  21097. TOKEN_INVALID_INVALID_CLIENTID: Wn,
  21098. TOKEN_INVALID: Wn,
  21099. TOKEN_INVALID_WRONG_TOKEN: Wn,
  21100. TOKEN_INVALID_ANONYMOUS_USER: Wn
  21101. },
  21102. Hn = {
  21103. "uni-id-token-expired": zn,
  21104. "uni-id-check-token-failed": Wn,
  21105. "uni-id-token-not-exist": Wn,
  21106. "uni-id-check-device-feature-failed": Wn
  21107. };
  21108. function Gn(e, t) {
  21109. var n = "";
  21110. return n = e ? "".concat(e, "/").concat(t) : t, n.replace(/^\//, "");
  21111. }
  21112. function Vn() {
  21113. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  21114. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
  21115. var n = [],
  21116. s = [];
  21117. return e.forEach(function (e) {
  21118. !0 === e.needLogin ? n.push(Gn(t, e.path)) : !1 === e.needLogin && s.push(Gn(t, e.path));
  21119. }), {
  21120. needLoginPage: n,
  21121. notNeedLoginPage: s
  21122. };
  21123. }
  21124. function Yn(e) {
  21125. return e.split("?")[0].replace(/^\//, "");
  21126. }
  21127. function Qn() {
  21128. return function (e) {
  21129. var t = e && e.$page && e.$page.fullPath || "";
  21130. return t ? ("/" !== t.charAt(0) && (t = "/" + t), t) : t;
  21131. }(function () {
  21132. var e = getCurrentPages();
  21133. return e[e.length - 1];
  21134. }());
  21135. }
  21136. function Xn() {
  21137. return Yn(Qn());
  21138. }
  21139. function Zn() {
  21140. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
  21141. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  21142. if (!e) return !1;
  21143. if (!(t && t.list && t.list.length)) return !1;
  21144. var n = t.list,
  21145. s = Yn(e);
  21146. return n.some(function (e) {
  21147. return e.pagePath === s;
  21148. });
  21149. }
  21150. var es = !!_pages.default.uniIdRouter;
  21151. var _ref40 = function () {
  21152. var _ref21 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _pages.default,
  21153. _ref21$pages = _ref21.pages,
  21154. e = _ref21$pages === void 0 ? [] : _ref21$pages,
  21155. _ref21$subPackages = _ref21.subPackages,
  21156. n = _ref21$subPackages === void 0 ? [] : _ref21$subPackages,
  21157. _ref21$uniIdRouter = _ref21.uniIdRouter,
  21158. s = _ref21$uniIdRouter === void 0 ? {} : _ref21$uniIdRouter,
  21159. _ref21$tabBar = _ref21.tabBar,
  21160. r = _ref21$tabBar === void 0 ? {} : _ref21$tabBar;
  21161. var i = s.loginPage,
  21162. _s$needLogin = s.needLogin,
  21163. o = _s$needLogin === void 0 ? [] : _s$needLogin,
  21164. _s$resToLogin = s.resToLogin,
  21165. a = _s$resToLogin === void 0 ? !0 : _s$resToLogin,
  21166. _Vn = Vn(e),
  21167. c = _Vn.needLoginPage,
  21168. u = _Vn.notNeedLoginPage,
  21169. _ref23 = function () {
  21170. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  21171. var t = [],
  21172. n = [];
  21173. return e.forEach(function (e) {
  21174. var s = e.root,
  21175. _e$pages = e.pages,
  21176. r = _e$pages === void 0 ? [] : _e$pages,
  21177. _Vn2 = Vn(r, s),
  21178. i = _Vn2.needLoginPage,
  21179. o = _Vn2.notNeedLoginPage;
  21180. t.push.apply(t, (0, _toConsumableArray2.default)(i)), n.push.apply(n, (0, _toConsumableArray2.default)(o));
  21181. }), {
  21182. needLoginPage: t,
  21183. notNeedLoginPage: n
  21184. };
  21185. }(n),
  21186. h = _ref23.needLoginPage,
  21187. l = _ref23.notNeedLoginPage;
  21188. return {
  21189. loginPage: i,
  21190. routerNeedLogin: o,
  21191. resToLogin: a,
  21192. needLoginPage: [].concat((0, _toConsumableArray2.default)(c), (0, _toConsumableArray2.default)(h)),
  21193. notNeedLoginPage: [].concat((0, _toConsumableArray2.default)(u), (0, _toConsumableArray2.default)(l)),
  21194. loginPageInTabBar: Zn(i, r)
  21195. };
  21196. }(),
  21197. ts = _ref40.loginPage,
  21198. ns = _ref40.routerNeedLogin,
  21199. ss = _ref40.resToLogin,
  21200. rs = _ref40.needLoginPage,
  21201. is = _ref40.notNeedLoginPage,
  21202. os = _ref40.loginPageInTabBar;
  21203. if (rs.indexOf(ts) > -1) throw new Error("Login page [".concat(ts, "] should not be \"needLogin\", please check your pages.json"));
  21204. function as(e) {
  21205. var t = Xn();
  21206. if ("/" === e.charAt(0)) return e;
  21207. var _e$split = e.split("?"),
  21208. _e$split2 = (0, _slicedToArray2.default)(_e$split, 2),
  21209. n = _e$split2[0],
  21210. s = _e$split2[1],
  21211. r = n.replace(/^\//, "").split("/"),
  21212. i = t.split("/");
  21213. i.pop();
  21214. for (var _e24 = 0; _e24 < r.length; _e24++) {
  21215. var _t15 = r[_e24];
  21216. ".." === _t15 ? i.pop() : "." !== _t15 && i.push(_t15);
  21217. }
  21218. return "" === i[0] && i.shift(), "/" + i.join("/") + (s ? "?" + s : "");
  21219. }
  21220. function cs(e) {
  21221. var t = Yn(as(e));
  21222. return !(is.indexOf(t) > -1) && (rs.indexOf(t) > -1 || ns.some(function (t) {
  21223. return function (e, t) {
  21224. return new RegExp(t).test(e);
  21225. }(e, t);
  21226. }));
  21227. }
  21228. function us(_ref41) {
  21229. var e = _ref41.redirect;
  21230. var t = Yn(e),
  21231. n = Yn(ts);
  21232. return Xn() !== n && t !== n;
  21233. }
  21234. function hs() {
  21235. var _ref42 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  21236. e = _ref42.api,
  21237. t = _ref42.redirect;
  21238. if (!t || !us({
  21239. redirect: t
  21240. })) return;
  21241. var n = function (e, t) {
  21242. return "/" !== e.charAt(0) && (e = "/" + e), t ? e.indexOf("?") > -1 ? e + "&uniIdRedirectUrl=".concat(encodeURIComponent(t)) : e + "?uniIdRedirectUrl=".concat(encodeURIComponent(t)) : e;
  21243. }(ts, t);
  21244. os ? "navigateTo" !== e && "redirectTo" !== e || (e = "switchTab") : "switchTab" === e && (e = "navigateTo");
  21245. var s = {
  21246. navigateTo: uni.navigateTo,
  21247. redirectTo: uni.redirectTo,
  21248. switchTab: uni.switchTab,
  21249. reLaunch: uni.reLaunch
  21250. };
  21251. setTimeout(function () {
  21252. s[e]({
  21253. url: n
  21254. });
  21255. });
  21256. }
  21257. function ls() {
  21258. var _ref43 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  21259. e = _ref43.url;
  21260. var t = {
  21261. abortLoginPageJump: !1,
  21262. autoToLoginPage: !1
  21263. },
  21264. n = function () {
  21265. var _re3 = re(),
  21266. e = _re3.token,
  21267. t = _re3.tokenExpired;
  21268. var n;
  21269. if (e) {
  21270. if (t < Date.now()) {
  21271. var _e25 = "uni-id-token-expired";
  21272. n = {
  21273. errCode: _e25,
  21274. errMsg: Hn[_e25]
  21275. };
  21276. }
  21277. } else {
  21278. var _e26 = "uni-id-check-token-failed";
  21279. n = {
  21280. errCode: _e26,
  21281. errMsg: Hn[_e26]
  21282. };
  21283. }
  21284. return n;
  21285. }();
  21286. if (cs(e) && n) {
  21287. n.uniIdRedirectUrl = e;
  21288. if (G($).length > 0) return setTimeout(function () {
  21289. Q($, n);
  21290. }, 0), t.abortLoginPageJump = !0, t;
  21291. t.autoToLoginPage = !0;
  21292. }
  21293. return t;
  21294. }
  21295. function ds() {
  21296. !function () {
  21297. var e = Qn(),
  21298. _ls = ls({
  21299. url: e
  21300. }),
  21301. t = _ls.abortLoginPageJump,
  21302. n = _ls.autoToLoginPage;
  21303. t || n && hs({
  21304. api: "redirectTo",
  21305. redirect: e
  21306. });
  21307. }();
  21308. var e = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
  21309. var _loop3 = function _loop3(_t16) {
  21310. var n = e[_t16];
  21311. uni.addInterceptor(n, {
  21312. invoke: function invoke(e) {
  21313. var _ls2 = ls({
  21314. url: e.url
  21315. }),
  21316. t = _ls2.abortLoginPageJump,
  21317. s = _ls2.autoToLoginPage;
  21318. return t ? e : s ? (hs({
  21319. api: n,
  21320. redirect: as(e.url)
  21321. }), !1) : e;
  21322. }
  21323. });
  21324. };
  21325. for (var _t16 = 0; _t16 < e.length; _t16++) {
  21326. _loop3(_t16);
  21327. }
  21328. }
  21329. function ps() {
  21330. this.onResponse(function (e) {
  21331. var t = e.type,
  21332. n = e.content;
  21333. var s = !1;
  21334. switch (t) {
  21335. case "cloudobject":
  21336. s = function (e) {
  21337. if ("object" != (0, _typeof2.default)(e)) return !1;
  21338. var _ref44 = e || {},
  21339. t = _ref44.errCode;
  21340. return t in Hn;
  21341. }(n);
  21342. break;
  21343. case "clientdb":
  21344. s = function (e) {
  21345. if ("object" != (0, _typeof2.default)(e)) return !1;
  21346. var _ref45 = e || {},
  21347. t = _ref45.errCode;
  21348. return t in Jn;
  21349. }(n);
  21350. }
  21351. s && function () {
  21352. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  21353. var t = G($);
  21354. ee().then(function () {
  21355. var n = Qn();
  21356. if (n && us({
  21357. redirect: n
  21358. })) return t.length > 0 ? Q($, Object.assign({
  21359. uniIdRedirectUrl: n
  21360. }, e)) : void (ts && hs({
  21361. api: "navigateTo",
  21362. redirect: n
  21363. }));
  21364. });
  21365. }(n);
  21366. });
  21367. }
  21368. function fs(e) {
  21369. !function (e) {
  21370. e.onResponse = function (e) {
  21371. V(B, e);
  21372. }, e.offResponse = function (e) {
  21373. Y(B, e);
  21374. };
  21375. }(e), function (e) {
  21376. e.onNeedLogin = function (e) {
  21377. V($, e);
  21378. }, e.offNeedLogin = function (e) {
  21379. Y($, e);
  21380. }, es && (U("_globalUniCloudStatus").needLoginInit || (U("_globalUniCloudStatus").needLoginInit = !0, ee().then(function () {
  21381. ds.call(e);
  21382. }), ss && ps.call(e)));
  21383. }(e), function (e) {
  21384. e.onRefreshToken = function (e) {
  21385. V(W, e);
  21386. }, e.offRefreshToken = function (e) {
  21387. Y(W, e);
  21388. };
  21389. }(e);
  21390. }
  21391. var gs;
  21392. var ms = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
  21393. ys = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  21394. function _s() {
  21395. var e = re().token || "",
  21396. t = e.split(".");
  21397. if (!e || 3 !== t.length) return {
  21398. uid: null,
  21399. role: [],
  21400. permission: [],
  21401. tokenExpired: 0
  21402. };
  21403. var n;
  21404. try {
  21405. n = JSON.parse((s = t[1], decodeURIComponent(gs(s).split("").map(function (e) {
  21406. return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
  21407. }).join(""))));
  21408. } catch (e) {
  21409. throw new Error("获取当前用户信息出错,详细错误信息为:" + e.message);
  21410. }
  21411. var s;
  21412. return n.tokenExpired = 1e3 * n.exp, delete n.exp, delete n.iat, n;
  21413. }
  21414. gs = "function" != typeof atob ? function (e) {
  21415. if (e = String(e).replace(/[\t\n\f\r ]+/g, ""), !ys.test(e)) throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  21416. var t;
  21417. e += "==".slice(2 - (3 & e.length));
  21418. for (var n, s, r = "", i = 0; i < e.length;) {
  21419. t = ms.indexOf(e.charAt(i++)) << 18 | ms.indexOf(e.charAt(i++)) << 12 | (n = ms.indexOf(e.charAt(i++))) << 6 | (s = ms.indexOf(e.charAt(i++))), r += 64 === n ? String.fromCharCode(t >> 16 & 255) : 64 === s ? String.fromCharCode(t >> 16 & 255, t >> 8 & 255) : String.fromCharCode(t >> 16 & 255, t >> 8 & 255, 255 & t);
  21420. }
  21421. return r;
  21422. } : atob;
  21423. var ws = s(function (e, t) {
  21424. Object.defineProperty(t, "__esModule", {
  21425. value: !0
  21426. });
  21427. var n = "chooseAndUploadFile:ok",
  21428. s = "chooseAndUploadFile:fail";
  21429. function r(e, t) {
  21430. return e.tempFiles.forEach(function (e, n) {
  21431. e.name || (e.name = e.path.substring(e.path.lastIndexOf("/") + 1)), t && (e.fileType = t), e.cloudPath = Date.now() + "_" + n + e.name.substring(e.name.lastIndexOf("."));
  21432. }), e.tempFilePaths || (e.tempFilePaths = e.tempFiles.map(function (e) {
  21433. return e.path;
  21434. })), e;
  21435. }
  21436. function i(e, t, _ref46) {
  21437. var s = _ref46.onChooseFile,
  21438. r = _ref46.onUploadProgress;
  21439. return t.then(function (e) {
  21440. if (s) {
  21441. var _t17 = s(e);
  21442. if (void 0 !== _t17) return Promise.resolve(_t17).then(function (t) {
  21443. return void 0 === t ? e : t;
  21444. });
  21445. }
  21446. return e;
  21447. }).then(function (t) {
  21448. return !1 === t ? {
  21449. errMsg: n,
  21450. tempFilePaths: [],
  21451. tempFiles: []
  21452. } : function (e, t) {
  21453. var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
  21454. var r = arguments.length > 3 ? arguments[3] : undefined;
  21455. (t = Object.assign({}, t)).errMsg = n;
  21456. var i = t.tempFiles,
  21457. o = i.length;
  21458. var a = 0;
  21459. return new Promise(function (n) {
  21460. for (; a < s;) {
  21461. c();
  21462. }
  21463. function c() {
  21464. var s = a++;
  21465. if (s >= o) return void (!i.find(function (e) {
  21466. return !e.url && !e.errMsg;
  21467. }) && n(t));
  21468. var u = i[s];
  21469. e.uploadFile({
  21470. filePath: u.path,
  21471. cloudPath: u.cloudPath,
  21472. fileType: u.fileType,
  21473. onUploadProgress: function onUploadProgress(e) {
  21474. e.index = s, e.tempFile = u, e.tempFilePath = u.path, r && r(e);
  21475. }
  21476. }).then(function (e) {
  21477. u.url = e.fileID, s < o && c();
  21478. }).catch(function (e) {
  21479. u.errMsg = e.errMsg || e.message, s < o && c();
  21480. });
  21481. }
  21482. });
  21483. }(e, t, 5, r);
  21484. });
  21485. }
  21486. t.initChooseAndUploadFile = function (e) {
  21487. return function () {
  21488. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  21489. type: "all"
  21490. };
  21491. return "image" === t.type ? i(e, function (e) {
  21492. var t = e.count,
  21493. n = e.sizeType,
  21494. _e$sourceType = e.sourceType,
  21495. i = _e$sourceType === void 0 ? ["album", "camera"] : _e$sourceType,
  21496. o = e.extension;
  21497. return new Promise(function (e, a) {
  21498. uni.chooseImage({
  21499. count: t,
  21500. sizeType: n,
  21501. sourceType: i,
  21502. extension: o,
  21503. success: function success(t) {
  21504. e(r(t, "image"));
  21505. },
  21506. fail: function fail(e) {
  21507. a({
  21508. errMsg: e.errMsg.replace("chooseImage:fail", s)
  21509. });
  21510. }
  21511. });
  21512. });
  21513. }(t), t) : "video" === t.type ? i(e, function (e) {
  21514. var t = e.camera,
  21515. n = e.compressed,
  21516. i = e.maxDuration,
  21517. _e$sourceType2 = e.sourceType,
  21518. o = _e$sourceType2 === void 0 ? ["album", "camera"] : _e$sourceType2,
  21519. a = e.extension;
  21520. return new Promise(function (e, c) {
  21521. uni.chooseVideo({
  21522. camera: t,
  21523. compressed: n,
  21524. maxDuration: i,
  21525. sourceType: o,
  21526. extension: a,
  21527. success: function success(t) {
  21528. var n = t.tempFilePath,
  21529. s = t.duration,
  21530. i = t.size,
  21531. o = t.height,
  21532. a = t.width;
  21533. e(r({
  21534. errMsg: "chooseVideo:ok",
  21535. tempFilePaths: [n],
  21536. tempFiles: [{
  21537. name: t.tempFile && t.tempFile.name || "",
  21538. path: n,
  21539. size: i,
  21540. type: t.tempFile && t.tempFile.type || "",
  21541. width: a,
  21542. height: o,
  21543. duration: s,
  21544. fileType: "video",
  21545. cloudPath: ""
  21546. }]
  21547. }, "video"));
  21548. },
  21549. fail: function fail(e) {
  21550. c({
  21551. errMsg: e.errMsg.replace("chooseVideo:fail", s)
  21552. });
  21553. }
  21554. });
  21555. });
  21556. }(t), t) : i(e, function (e) {
  21557. var t = e.count,
  21558. n = e.extension;
  21559. return new Promise(function (e, i) {
  21560. var o = uni.chooseFile;
  21561. if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (o = wx.chooseMessageFile), "function" != typeof o) return i({
  21562. errMsg: s + " 请指定 type 类型,该平台仅支持选择 image 或 video。"
  21563. });
  21564. o({
  21565. type: "all",
  21566. count: t,
  21567. extension: n,
  21568. success: function success(t) {
  21569. e(r(t));
  21570. },
  21571. fail: function fail(e) {
  21572. i({
  21573. errMsg: e.errMsg.replace("chooseFile:fail", s)
  21574. });
  21575. }
  21576. });
  21577. });
  21578. }(t), t);
  21579. };
  21580. };
  21581. }),
  21582. vs = n(ws);
  21583. var Is = "manual";
  21584. function Ss(e) {
  21585. return {
  21586. props: {
  21587. localdata: {
  21588. type: Array,
  21589. default: function _default() {
  21590. return [];
  21591. }
  21592. },
  21593. options: {
  21594. type: [Object, Array],
  21595. default: function _default() {
  21596. return {};
  21597. }
  21598. },
  21599. spaceInfo: {
  21600. type: Object,
  21601. default: function _default() {
  21602. return {};
  21603. }
  21604. },
  21605. collection: {
  21606. type: [String, Array],
  21607. default: ""
  21608. },
  21609. action: {
  21610. type: String,
  21611. default: ""
  21612. },
  21613. field: {
  21614. type: String,
  21615. default: ""
  21616. },
  21617. orderby: {
  21618. type: String,
  21619. default: ""
  21620. },
  21621. where: {
  21622. type: [String, Object],
  21623. default: ""
  21624. },
  21625. pageData: {
  21626. type: String,
  21627. default: "add"
  21628. },
  21629. pageCurrent: {
  21630. type: Number,
  21631. default: 1
  21632. },
  21633. pageSize: {
  21634. type: Number,
  21635. default: 20
  21636. },
  21637. getcount: {
  21638. type: [Boolean, String],
  21639. default: !1
  21640. },
  21641. gettree: {
  21642. type: [Boolean, String],
  21643. default: !1
  21644. },
  21645. gettreepath: {
  21646. type: [Boolean, String],
  21647. default: !1
  21648. },
  21649. startwith: {
  21650. type: String,
  21651. default: ""
  21652. },
  21653. limitlevel: {
  21654. type: Number,
  21655. default: 10
  21656. },
  21657. groupby: {
  21658. type: String,
  21659. default: ""
  21660. },
  21661. groupField: {
  21662. type: String,
  21663. default: ""
  21664. },
  21665. distinct: {
  21666. type: [Boolean, String],
  21667. default: !1
  21668. },
  21669. foreignKey: {
  21670. type: String,
  21671. default: ""
  21672. },
  21673. loadtime: {
  21674. type: String,
  21675. default: "auto"
  21676. },
  21677. manual: {
  21678. type: Boolean,
  21679. default: !1
  21680. }
  21681. },
  21682. data: function data() {
  21683. return {
  21684. mixinDatacomLoading: !1,
  21685. mixinDatacomHasMore: !1,
  21686. mixinDatacomResData: [],
  21687. mixinDatacomErrorMessage: "",
  21688. mixinDatacomPage: {}
  21689. };
  21690. },
  21691. created: function created() {
  21692. var _this20 = this;
  21693. this.mixinDatacomPage = {
  21694. current: this.pageCurrent,
  21695. size: this.pageSize,
  21696. count: 0
  21697. }, this.$watch(function () {
  21698. var e = [];
  21699. return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach(function (t) {
  21700. e.push(_this20[t]);
  21701. }), e;
  21702. }, function (e, t) {
  21703. if (_this20.loadtime === Is) return;
  21704. var n = !1;
  21705. var s = [];
  21706. for (var _r7 = 2; _r7 < e.length; _r7++) {
  21707. e[_r7] !== t[_r7] && (s.push(e[_r7]), n = !0);
  21708. }
  21709. e[0] !== t[0] && (_this20.mixinDatacomPage.current = _this20.pageCurrent), _this20.mixinDatacomPage.size = _this20.pageSize, _this20.onMixinDatacomPropsChange(n, s);
  21710. });
  21711. },
  21712. methods: {
  21713. onMixinDatacomPropsChange: function onMixinDatacomPropsChange(e, t) {},
  21714. mixinDatacomEasyGet: function mixinDatacomEasyGet() {
  21715. var _this21 = this;
  21716. var _ref47 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  21717. _ref47$getone = _ref47.getone,
  21718. e = _ref47$getone === void 0 ? !1 : _ref47$getone,
  21719. t = _ref47.success,
  21720. n = _ref47.fail;
  21721. this.mixinDatacomLoading || (this.mixinDatacomLoading = !0, this.mixinDatacomErrorMessage = "", this.mixinDatacomGet().then(function (n) {
  21722. _this21.mixinDatacomLoading = !1;
  21723. var _n$result = n.result,
  21724. s = _n$result.data,
  21725. r = _n$result.count;
  21726. _this21.getcount && (_this21.mixinDatacomPage.count = r), _this21.mixinDatacomHasMore = s.length < _this21.pageSize;
  21727. var i = e ? s.length ? s[0] : void 0 : s;
  21728. _this21.mixinDatacomResData = i, t && t(i);
  21729. }).catch(function (e) {
  21730. _this21.mixinDatacomLoading = !1, _this21.mixinDatacomErrorMessage = e, n && n(e);
  21731. }));
  21732. },
  21733. mixinDatacomGet: function mixinDatacomGet() {
  21734. var _n12;
  21735. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  21736. var n = e.database(this.spaceInfo);
  21737. var s = t.action || this.action;
  21738. s && (n = n.action(s));
  21739. var r = t.collection || this.collection;
  21740. n = Array.isArray(r) ? (_n12 = n).collection.apply(_n12, (0, _toConsumableArray2.default)(r)) : n.collection(r);
  21741. var i = t.where || this.where;
  21742. i && Object.keys(i).length && (n = n.where(i));
  21743. var o = t.field || this.field;
  21744. o && (n = n.field(o));
  21745. var a = t.foreignKey || this.foreignKey;
  21746. a && (n = n.foreignKey(a));
  21747. var c = t.groupby || this.groupby;
  21748. c && (n = n.groupBy(c));
  21749. var u = t.groupField || this.groupField;
  21750. u && (n = n.groupField(u));
  21751. !0 === (void 0 !== t.distinct ? t.distinct : this.distinct) && (n = n.distinct());
  21752. var h = t.orderby || this.orderby;
  21753. h && (n = n.orderBy(h));
  21754. var l = void 0 !== t.pageCurrent ? t.pageCurrent : this.mixinDatacomPage.current,
  21755. d = void 0 !== t.pageSize ? t.pageSize : this.mixinDatacomPage.size,
  21756. p = void 0 !== t.getcount ? t.getcount : this.getcount,
  21757. f = void 0 !== t.gettree ? t.gettree : this.gettree,
  21758. g = void 0 !== t.gettreepath ? t.gettreepath : this.gettreepath,
  21759. m = {
  21760. getCount: p
  21761. },
  21762. y = {
  21763. limitLevel: void 0 !== t.limitlevel ? t.limitlevel : this.limitlevel,
  21764. startWith: void 0 !== t.startwith ? t.startwith : this.startwith
  21765. };
  21766. return f && (m.getTree = y), g && (m.getTreePath = y), n = n.skip(d * (l - 1)).limit(d).get(m), n;
  21767. }
  21768. }
  21769. };
  21770. }
  21771. function bs(e) {
  21772. return function (t) {
  21773. var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  21774. n = function (e) {
  21775. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  21776. return e.customUI = t.customUI || e.customUI, e.parseSystemError = t.parseSystemError || e.parseSystemError, Object.assign(e.loadingOptions, t.loadingOptions), Object.assign(e.errorOptions, t.errorOptions), "object" == (0, _typeof2.default)(t.secretMethods) && (e.secretMethods = t.secretMethods), e;
  21777. }({
  21778. customUI: !1,
  21779. loadingOptions: {
  21780. title: "加载中...",
  21781. mask: !0
  21782. },
  21783. errorOptions: {
  21784. type: "modal",
  21785. retry: !1
  21786. }
  21787. }, n);
  21788. var _n13 = n,
  21789. s = _n13.customUI,
  21790. r = _n13.loadingOptions,
  21791. i = _n13.errorOptions,
  21792. o = _n13.parseSystemError,
  21793. a = !s;
  21794. return new Proxy({}, {
  21795. get: function get(s, c) {
  21796. return function () {
  21797. var _ref48 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  21798. e = _ref48.fn,
  21799. t = _ref48.interceptorName,
  21800. n = _ref48.getCallbackArgs;
  21801. return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50() {
  21802. var _len2,
  21803. s,
  21804. _key2,
  21805. r,
  21806. i,
  21807. o,
  21808. _args = arguments;
  21809. return _regenerator.default.wrap(function _callee50$(_context50) {
  21810. while (1) {
  21811. switch (_context50.prev = _context50.next) {
  21812. case 0:
  21813. for (_len2 = _args.length, s = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  21814. s[_key2] = _args[_key2];
  21815. }
  21816. r = n ? n({
  21817. params: s
  21818. }) : {};
  21819. _context50.prev = 2;
  21820. _context50.next = 5;
  21821. return q(M(t, "invoke"), _objectSpread({}, r));
  21822. case 5:
  21823. _context50.next = 7;
  21824. return e.apply(void 0, s);
  21825. case 7:
  21826. i = _context50.sent;
  21827. _context50.next = 10;
  21828. return q(M(t, "success"), _objectSpread(_objectSpread({}, r), {}, {
  21829. result: i
  21830. }));
  21831. case 10:
  21832. return _context50.abrupt("return", i);
  21833. case 13:
  21834. _context50.prev = 13;
  21835. _context50.t0 = _context50["catch"](2);
  21836. o = _context50.t0;
  21837. _context50.next = 18;
  21838. return q(M(t, "fail"), _objectSpread(_objectSpread({}, r), {}, {
  21839. error: o
  21840. }));
  21841. case 18:
  21842. throw o;
  21843. case 19:
  21844. _context50.prev = 19;
  21845. _context50.next = 22;
  21846. return q(M(t, "complete"), o ? _objectSpread(_objectSpread({}, r), {}, {
  21847. error: o
  21848. }) : _objectSpread(_objectSpread({}, r), {}, {
  21849. result: i
  21850. }));
  21851. case 22:
  21852. return _context50.finish(19);
  21853. case 23:
  21854. case "end":
  21855. return _context50.stop();
  21856. }
  21857. }
  21858. }, _callee50, null, [[2, 13, 19, 23]]);
  21859. }));
  21860. }({
  21861. fn: function () {
  21862. var _s14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52() {
  21863. var l,
  21864. _len3,
  21865. u,
  21866. _key3,
  21867. d,
  21868. p,
  21869. _ref50,
  21870. f,
  21871. g,
  21872. m,
  21873. y,
  21874. _e27,
  21875. _yield,
  21876. _t18,
  21877. _n14,
  21878. _args4 = arguments;
  21879. return _regenerator.default.wrap(function _callee52$(_context52) {
  21880. while (1) {
  21881. switch (_context52.prev = _context52.next) {
  21882. case 0:
  21883. a && uni.showLoading({
  21884. title: r.title,
  21885. mask: r.mask
  21886. });
  21887. for (_len3 = _args4.length, u = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  21888. u[_key3] = _args4[_key3];
  21889. }
  21890. d = {
  21891. name: t,
  21892. type: h,
  21893. data: {
  21894. method: c,
  21895. params: u
  21896. }
  21897. };
  21898. "object" == (0, _typeof2.default)(n.secretMethods) && function (e, t) {
  21899. var n = t.data.method,
  21900. s = e.secretMethods || {},
  21901. r = s[n] || s["*"];
  21902. r && (t.secretType = r);
  21903. }(n, d);
  21904. p = !1;
  21905. _context52.prev = 5;
  21906. _context52.next = 8;
  21907. return e.callFunction(d);
  21908. case 8:
  21909. l = _context52.sent;
  21910. _context52.next = 14;
  21911. break;
  21912. case 11:
  21913. _context52.prev = 11;
  21914. _context52.t0 = _context52["catch"](5);
  21915. p = !0, l = {
  21916. result: new ne(_context52.t0)
  21917. };
  21918. case 14:
  21919. _ref50 = l.result || {}, f = _ref50.errSubject, g = _ref50.errCode, m = _ref50.errMsg, y = _ref50.newToken;
  21920. if (!(a && uni.hideLoading(), y && y.token && y.tokenExpired && (ie(y), Q(W, _objectSpread({}, y))), g)) {
  21921. _context52.next = 39;
  21922. break;
  21923. }
  21924. _e27 = m;
  21925. if (!(p && o)) {
  21926. _context52.next = 24;
  21927. break;
  21928. }
  21929. _context52.next = 20;
  21930. return o({
  21931. objectName: t,
  21932. methodName: c,
  21933. params: u,
  21934. errSubject: f,
  21935. errCode: g,
  21936. errMsg: m
  21937. });
  21938. case 20:
  21939. _context52.t1 = _context52.sent.errMsg;
  21940. if (_context52.t1) {
  21941. _context52.next = 23;
  21942. break;
  21943. }
  21944. _context52.t1 = m;
  21945. case 23:
  21946. _e27 = _context52.t1;
  21947. case 24:
  21948. if (!a) {
  21949. _context52.next = 37;
  21950. break;
  21951. }
  21952. if (!("toast" === i.type)) {
  21953. _context52.next = 29;
  21954. break;
  21955. }
  21956. uni.showToast({
  21957. title: _e27,
  21958. icon: "none"
  21959. });
  21960. _context52.next = 37;
  21961. break;
  21962. case 29:
  21963. if (!("modal" !== i.type)) {
  21964. _context52.next = 31;
  21965. break;
  21966. }
  21967. throw new Error("Invalid errorOptions.type: ".concat(i.type));
  21968. case 31:
  21969. _context52.next = 33;
  21970. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
  21971. var _ref52,
  21972. e,
  21973. t,
  21974. n,
  21975. s,
  21976. r,
  21977. _args2 = arguments;
  21978. return _regenerator.default.wrap(function _callee51$(_context51) {
  21979. while (1) {
  21980. switch (_context51.prev = _context51.next) {
  21981. case 0:
  21982. _ref52 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, e = _ref52.title, t = _ref52.content, n = _ref52.showCancel, s = _ref52.cancelText, r = _ref52.confirmText;
  21983. return _context51.abrupt("return", new Promise(function (i, o) {
  21984. uni.showModal({
  21985. title: e,
  21986. content: t,
  21987. showCancel: n,
  21988. cancelText: s,
  21989. confirmText: r,
  21990. success: function success(e) {
  21991. i(e);
  21992. },
  21993. fail: function fail() {
  21994. i({
  21995. confirm: !1,
  21996. cancel: !0
  21997. });
  21998. }
  21999. });
  22000. }));
  22001. case 2:
  22002. case "end":
  22003. return _context51.stop();
  22004. }
  22005. }
  22006. }, _callee51);
  22007. }))({
  22008. title: "提示",
  22009. content: _e27,
  22010. showCancel: i.retry,
  22011. cancelText: "取消",
  22012. confirmText: i.retry ? "重试" : "确定"
  22013. });
  22014. case 33:
  22015. _yield = _context52.sent;
  22016. _t18 = _yield.confirm;
  22017. if (!(i.retry && _t18)) {
  22018. _context52.next = 37;
  22019. break;
  22020. }
  22021. return _context52.abrupt("return", s.apply(void 0, u));
  22022. case 37:
  22023. _n14 = new ne({
  22024. subject: f,
  22025. code: g,
  22026. message: m,
  22027. requestId: l.requestId
  22028. });
  22029. throw _n14.detail = l.result, Q(B, {
  22030. type: H,
  22031. content: _n14
  22032. }), _n14;
  22033. case 39:
  22034. return _context52.abrupt("return", (Q(B, {
  22035. type: H,
  22036. content: l.result
  22037. }), l.result));
  22038. case 40:
  22039. case "end":
  22040. return _context52.stop();
  22041. }
  22042. }
  22043. }, _callee52, null, [[5, 11]]);
  22044. }));
  22045. function s() {
  22046. return _s14.apply(this, arguments);
  22047. }
  22048. return s;
  22049. }(),
  22050. interceptorName: "callObject",
  22051. getCallbackArgs: function getCallbackArgs() {
  22052. var _ref53 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  22053. e = _ref53.params;
  22054. return {
  22055. objectName: t,
  22056. methodName: c,
  22057. params: e
  22058. };
  22059. }
  22060. });
  22061. }
  22062. });
  22063. };
  22064. }
  22065. function ks(e) {
  22066. return U("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}", e.config.spaceId));
  22067. }
  22068. function Cs() {
  22069. return _Cs.apply(this, arguments);
  22070. }
  22071. function _Cs() {
  22072. _Cs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55() {
  22073. var _ref65,
  22074. e,
  22075. _ref65$callLoginByWei,
  22076. t,
  22077. n,
  22078. s,
  22079. r,
  22080. _args7 = arguments;
  22081. return _regenerator.default.wrap(function _callee55$(_context55) {
  22082. while (1) {
  22083. switch (_context55.prev = _context55.next) {
  22084. case 0:
  22085. _ref65 = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {}, e = _ref65.openid, _ref65$callLoginByWei = _ref65.callLoginByWeixin, t = _ref65$callLoginByWei === void 0 ? !1 : _ref65$callLoginByWei;
  22086. n = ks(this);
  22087. if (!("mp-weixin" !== P)) {
  22088. _context55.next = 4;
  22089. break;
  22090. }
  22091. throw new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `".concat(P, "`"));
  22092. case 4:
  22093. if (!(e && t)) {
  22094. _context55.next = 6;
  22095. break;
  22096. }
  22097. throw new Error("[SecureNetwork] openid and callLoginByWeixin cannot be passed at the same time");
  22098. case 6:
  22099. if (!e) {
  22100. _context55.next = 8;
  22101. break;
  22102. }
  22103. return _context55.abrupt("return", (n.mpWeixinOpenid = e, {}));
  22104. case 8:
  22105. _context55.next = 10;
  22106. return new Promise(function (e, t) {
  22107. uni.login({
  22108. success: function success(t) {
  22109. e(t.code);
  22110. },
  22111. fail: function fail(e) {
  22112. t(new Error(e.errMsg));
  22113. }
  22114. });
  22115. });
  22116. case 10:
  22117. s = _context55.sent;
  22118. r = this.importObject("uni-id-co", {
  22119. customUI: !0
  22120. });
  22121. _context55.next = 14;
  22122. return r.secureNetworkHandshakeByWeixin({
  22123. code: s,
  22124. callLoginByWeixin: t
  22125. });
  22126. case 14:
  22127. n.mpWeixinCode = s;
  22128. return _context55.abrupt("return", {
  22129. code: s
  22130. });
  22131. case 16:
  22132. case "end":
  22133. return _context55.stop();
  22134. }
  22135. }
  22136. }, _callee55, this);
  22137. }));
  22138. return _Cs.apply(this, arguments);
  22139. }
  22140. function Ts(_x37) {
  22141. return _Ts.apply(this, arguments);
  22142. }
  22143. function _Ts() {
  22144. _Ts = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(e) {
  22145. var t;
  22146. return _regenerator.default.wrap(function _callee56$(_context56) {
  22147. while (1) {
  22148. switch (_context56.prev = _context56.next) {
  22149. case 0:
  22150. t = ks(this);
  22151. return _context56.abrupt("return", (t.initPromise || (t.initPromise = Cs.call(this, e)), t.initPromise));
  22152. case 2:
  22153. case "end":
  22154. return _context56.stop();
  22155. }
  22156. }
  22157. }, _callee56, this);
  22158. }));
  22159. return _Ts.apply(this, arguments);
  22160. }
  22161. function Ps(e) {
  22162. return function () {
  22163. var _ref54 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  22164. t = _ref54.openid,
  22165. _ref54$callLoginByWei = _ref54.callLoginByWeixin,
  22166. n = _ref54$callLoginByWei === void 0 ? !1 : _ref54$callLoginByWei;
  22167. return Ts.call(e, {
  22168. openid: t,
  22169. callLoginByWeixin: n
  22170. });
  22171. };
  22172. }
  22173. function As(e) {
  22174. var t = {
  22175. getSystemInfo: uni.getSystemInfo,
  22176. getPushClientId: uni.getPushClientId
  22177. };
  22178. return function (n) {
  22179. return new Promise(function (s, r) {
  22180. t[e](_objectSpread(_objectSpread({}, n), {}, {
  22181. success: function success(e) {
  22182. s(e);
  22183. },
  22184. fail: function fail(e) {
  22185. r(e);
  22186. }
  22187. }));
  22188. });
  22189. };
  22190. }
  22191. var Es = /*#__PURE__*/function (_ref55) {
  22192. (0, _inherits2.default)(Es, _ref55);
  22193. var _super12 = _createSuper(Es);
  22194. function Es() {
  22195. var _this22;
  22196. (0, _classCallCheck2.default)(this, Es);
  22197. _this22 = _super12.call(this), _this22._uniPushMessageCallback = _this22._receivePushMessage.bind((0, _assertThisInitialized2.default)(_this22)), _this22._currentMessageId = -1, _this22._payloadQueue = [];
  22198. return _this22;
  22199. }
  22200. (0, _createClass2.default)(Es, [{
  22201. key: "init",
  22202. value: function init() {
  22203. var _this23 = this;
  22204. return Promise.all([As("getSystemInfo")(), As("getPushClientId")()]).then(function () {
  22205. var _ref56 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [],
  22206. _ref57 = (0, _slicedToArray2.default)(_ref56, 2),
  22207. _ref57$ = _ref57[0];
  22208. _ref57$ = _ref57$ === void 0 ? {} : _ref57$;
  22209. var e = _ref57$.appId,
  22210. _ref57$2 = _ref57[1];
  22211. _ref57$2 = _ref57$2 === void 0 ? {} : _ref57$2;
  22212. var t = _ref57$2.cid;
  22213. if (!e) throw new Error("Invalid appId, please check the manifest.json file");
  22214. if (!t) throw new Error("Invalid push client id");
  22215. _this23._appId = e, _this23._pushClientId = t, _this23._seqId = Date.now() + "-" + Math.floor(9e5 * Math.random() + 1e5), _this23.emit("open"), _this23._initMessageListener();
  22216. }, function (e) {
  22217. throw _this23.emit("error", e), _this23.close(), e;
  22218. });
  22219. }
  22220. }, {
  22221. key: "open",
  22222. value: function () {
  22223. var _open = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53() {
  22224. return _regenerator.default.wrap(function _callee53$(_context53) {
  22225. while (1) {
  22226. switch (_context53.prev = _context53.next) {
  22227. case 0:
  22228. return _context53.abrupt("return", this.init());
  22229. case 1:
  22230. case "end":
  22231. return _context53.stop();
  22232. }
  22233. }
  22234. }, _callee53, this);
  22235. }));
  22236. function open() {
  22237. return _open.apply(this, arguments);
  22238. }
  22239. return open;
  22240. }()
  22241. }, {
  22242. key: "_isUniCloudSSE",
  22243. value: function _isUniCloudSSE(e) {
  22244. if ("receive" !== e.type) return !1;
  22245. var t = e && e.data && e.data.payload;
  22246. return !(!t || "UNI_CLOUD_SSE" !== t.channel || t.seqId !== this._seqId);
  22247. }
  22248. }, {
  22249. key: "_receivePushMessage",
  22250. value: function _receivePushMessage(e) {
  22251. if (!this._isUniCloudSSE(e)) return;
  22252. var t = e && e.data && e.data.payload,
  22253. n = t.action,
  22254. s = t.messageId,
  22255. r = t.message;
  22256. this._payloadQueue.push({
  22257. action: n,
  22258. messageId: s,
  22259. message: r
  22260. }), this._consumMessage();
  22261. }
  22262. }, {
  22263. key: "_consumMessage",
  22264. value: function _consumMessage() {
  22265. var _this24 = this;
  22266. for (;;) {
  22267. var _e28 = this._payloadQueue.find(function (e) {
  22268. return e.messageId === _this24._currentMessageId + 1;
  22269. });
  22270. if (!_e28) break;
  22271. this._currentMessageId++, this._parseMessagePayload(_e28);
  22272. }
  22273. }
  22274. }, {
  22275. key: "_parseMessagePayload",
  22276. value: function _parseMessagePayload(e) {
  22277. var t = e.action,
  22278. n = e.messageId,
  22279. s = e.message;
  22280. "end" === t ? this._end({
  22281. messageId: n,
  22282. message: s
  22283. }) : "message" === t && this._appendMessage({
  22284. messageId: n,
  22285. message: s
  22286. });
  22287. }
  22288. }, {
  22289. key: "_appendMessage",
  22290. value: function _appendMessage() {
  22291. var _ref58 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  22292. e = _ref58.messageId,
  22293. t = _ref58.message;
  22294. this.emit("message", t);
  22295. }
  22296. }, {
  22297. key: "_end",
  22298. value: function _end() {
  22299. var _ref59 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  22300. e = _ref59.messageId,
  22301. t = _ref59.message;
  22302. this.emit("end", t), this.close();
  22303. }
  22304. }, {
  22305. key: "_initMessageListener",
  22306. value: function _initMessageListener() {
  22307. uni.onPushMessage(this._uniPushMessageCallback);
  22308. }
  22309. }, {
  22310. key: "_destroy",
  22311. value: function _destroy() {
  22312. uni.offPushMessage(this._uniPushMessageCallback);
  22313. }
  22314. }, {
  22315. key: "toJSON",
  22316. value: function toJSON() {
  22317. return {
  22318. appId: this._appId,
  22319. pushClientId: this._pushClientId,
  22320. seqId: this._seqId
  22321. };
  22322. }
  22323. }, {
  22324. key: "close",
  22325. value: function close() {
  22326. this._destroy(), this.emit("close");
  22327. }
  22328. }]);
  22329. return Es;
  22330. }( /*#__PURE__*/function () {
  22331. function _class6() {
  22332. (0, _classCallCheck2.default)(this, _class6);
  22333. this._callback = {};
  22334. }
  22335. (0, _createClass2.default)(_class6, [{
  22336. key: "addListener",
  22337. value: function addListener(e, t) {
  22338. this._callback[e] || (this._callback[e] = []), this._callback[e].push(t);
  22339. }
  22340. }, {
  22341. key: "on",
  22342. value: function on(e, t) {
  22343. return this.addListener(e, t);
  22344. }
  22345. }, {
  22346. key: "removeListener",
  22347. value: function removeListener(e, t) {
  22348. if (!t) throw new Error('The "listener" argument must be of type function. Received undefined');
  22349. var n = this._callback[e];
  22350. if (!n) return;
  22351. var s = function (e, t) {
  22352. for (var _n15 = e.length - 1; _n15 >= 0; _n15--) {
  22353. if (e[_n15] === t) return _n15;
  22354. }
  22355. return -1;
  22356. }(n, t);
  22357. n.splice(s, 1);
  22358. }
  22359. }, {
  22360. key: "off",
  22361. value: function off(e, t) {
  22362. return this.removeListener(e, t);
  22363. }
  22364. }, {
  22365. key: "removeAllListener",
  22366. value: function removeAllListener(e) {
  22367. delete this._callback[e];
  22368. }
  22369. }, {
  22370. key: "emit",
  22371. value: function emit(e) {
  22372. var n = this._callback[e];
  22373. for (var _len4 = arguments.length, t = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
  22374. t[_key4 - 1] = arguments[_key4];
  22375. }
  22376. if (n) for (var _e29 = 0; _e29 < n.length; _e29++) {
  22377. n[_e29].apply(n, t);
  22378. }
  22379. }
  22380. }]);
  22381. return _class6;
  22382. }());
  22383. function Os(_x38, _x39) {
  22384. return _Os.apply(this, arguments);
  22385. }
  22386. function _Os() {
  22387. _Os = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(e, t) {
  22388. var n, _e33, s;
  22389. return _regenerator.default.wrap(function _callee57$(_context57) {
  22390. while (1) {
  22391. switch (_context57.prev = _context57.next) {
  22392. case 0:
  22393. n = "http://".concat(e, ":").concat(t, "/system/ping");
  22394. _context57.prev = 1;
  22395. _context57.next = 4;
  22396. return s = {
  22397. url: n,
  22398. timeout: 500
  22399. }, new Promise(function (e, t) {
  22400. se.request(_objectSpread(_objectSpread({}, s), {}, {
  22401. success: function success(t) {
  22402. e(t);
  22403. },
  22404. fail: function fail(e) {
  22405. t(e);
  22406. }
  22407. }));
  22408. });
  22409. case 4:
  22410. _e33 = _context57.sent;
  22411. return _context57.abrupt("return", !(!_e33.data || 0 !== _e33.data.code));
  22412. case 8:
  22413. _context57.prev = 8;
  22414. _context57.t0 = _context57["catch"](1);
  22415. return _context57.abrupt("return", !1);
  22416. case 11:
  22417. case "end":
  22418. return _context57.stop();
  22419. }
  22420. }
  22421. }, _callee57, null, [[1, 8]]);
  22422. }));
  22423. return _Os.apply(this, arguments);
  22424. }
  22425. function xs(_x40) {
  22426. return _xs.apply(this, arguments);
  22427. }
  22428. function _xs() {
  22429. _xs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(e) {
  22430. var _ce2, _e34, _t20, t, _t$debugInfo, n, s, _yield2, r, i, o;
  22431. return _regenerator.default.wrap(function _callee59$(_context59) {
  22432. while (1) {
  22433. switch (_context59.prev = _context59.next) {
  22434. case 0:
  22435. if (b) {
  22436. _context59.next = 2;
  22437. break;
  22438. }
  22439. return _context59.abrupt("return", Promise.resolve());
  22440. case 2:
  22441. if ("app" === P) {
  22442. _ce2 = ce(), _e34 = _ce2.osName, _t20 = _ce2.osVersion;
  22443. "ios" === _e34 && function (e) {
  22444. if (!e || "string" != typeof e) return 0;
  22445. var t = e.match(/^(\d+)./);
  22446. return t && t[1] ? parseInt(t[1]) : 0;
  22447. }(_t20) >= 14 && console.warn("iOS 14及以上版本连接uniCloud本地调试服务需要允许客户端查找并连接到本地网络上的设备(仅开发模式生效,发行模式会连接uniCloud云端服务)");
  22448. }
  22449. t = e.__dev__;
  22450. if (t.debugInfo) {
  22451. _context59.next = 6;
  22452. break;
  22453. }
  22454. return _context59.abrupt("return");
  22455. case 6:
  22456. _t$debugInfo = t.debugInfo;
  22457. n = _t$debugInfo.address;
  22458. s = _t$debugInfo.servePort;
  22459. _context59.next = 11;
  22460. return function () {
  22461. var _ref66 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58(e, t) {
  22462. var n, _s15, _r8;
  22463. return _regenerator.default.wrap(function _callee58$(_context58) {
  22464. while (1) {
  22465. switch (_context58.prev = _context58.next) {
  22466. case 0:
  22467. _s15 = 0;
  22468. case 1:
  22469. if (!(_s15 < e.length)) {
  22470. _context58.next = 11;
  22471. break;
  22472. }
  22473. _r8 = e[_s15];
  22474. _context58.next = 5;
  22475. return Os(_r8, t);
  22476. case 5:
  22477. if (!_context58.sent) {
  22478. _context58.next = 8;
  22479. break;
  22480. }
  22481. n = _r8;
  22482. return _context58.abrupt("break", 11);
  22483. case 8:
  22484. _s15++;
  22485. _context58.next = 1;
  22486. break;
  22487. case 11:
  22488. return _context58.abrupt("return", {
  22489. address: n,
  22490. port: t
  22491. });
  22492. case 12:
  22493. case "end":
  22494. return _context58.stop();
  22495. }
  22496. }
  22497. }, _callee58);
  22498. }));
  22499. return function (_x41, _x42) {
  22500. return _ref66.apply(this, arguments);
  22501. };
  22502. }()(n, s);
  22503. case 11:
  22504. _yield2 = _context59.sent;
  22505. r = _yield2.address;
  22506. if (!r) {
  22507. _context59.next = 15;
  22508. break;
  22509. }
  22510. return _context59.abrupt("return", (t.localAddress = r, void (t.localPort = s)));
  22511. case 15:
  22512. i = console["app" === P ? "error" : "warn"];
  22513. o = "";
  22514. if (!("remote" === t.debugInfo.initialLaunchType ? (t.debugInfo.forceRemote = !0, o = "当前客户端和HBuilderX不在同一局域网下(或其他网络原因无法连接HBuilderX),uniCloud本地调试服务不对当前客户端生效。\n- 如果不使用uniCloud本地调试服务,请直接忽略此信息。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。") : o = "无法连接uniCloud本地调试服务,请检查当前客户端是否与主机在同一局域网下。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。", o += "\n- 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs\n- 检查是否错误的使用拦截器修改uni.request方法的参数", "web" === P && (o += "\n- 部分浏览器开启节流模式之后访问本地地址受限,请检查是否启用了节流模式"), 0 === P.indexOf("mp-") && (o += "\n- 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp"), !t.debugInfo.forceRemote)) {
  22515. _context59.next = 19;
  22516. break;
  22517. }
  22518. throw new Error(o);
  22519. case 19:
  22520. i(o);
  22521. case 20:
  22522. case "end":
  22523. return _context59.stop();
  22524. }
  22525. }
  22526. }, _callee59);
  22527. }));
  22528. return _xs.apply(this, arguments);
  22529. }
  22530. function Rs(e) {
  22531. e._initPromiseHub || (e._initPromiseHub = new I({
  22532. createPromise: function createPromise() {
  22533. var t = Promise.resolve();
  22534. var n;
  22535. n = 1, t = new Promise(function (e) {
  22536. setTimeout(function () {
  22537. e();
  22538. }, n);
  22539. });
  22540. var s = e.auth();
  22541. return t.then(function () {
  22542. return s.getLoginState();
  22543. }).then(function (e) {
  22544. return e ? Promise.resolve() : s.signInAnonymously();
  22545. });
  22546. }
  22547. }));
  22548. }
  22549. var Us = {
  22550. tcb: It,
  22551. tencent: It,
  22552. aliyun: ge,
  22553. private: bt
  22554. };
  22555. var Ls = new ( /*#__PURE__*/function () {
  22556. function _class7() {
  22557. (0, _classCallCheck2.default)(this, _class7);
  22558. }
  22559. (0, _createClass2.default)(_class7, [{
  22560. key: "init",
  22561. value: function init(e) {
  22562. var t = {};
  22563. var n = Us[e.provider];
  22564. if (!n) throw new Error("未提供正确的provider参数");
  22565. t = n.init(e), b && function (e) {
  22566. if (!b) return;
  22567. var t = {};
  22568. e.__dev__ = t, t.debugLog = b && ("web" === P && navigator.userAgent.indexOf("HBuilderX") > 0 || "app" === P);
  22569. var n = A;
  22570. n && !n.code && (t.debugInfo = n);
  22571. var s = new I({
  22572. createPromise: function createPromise() {
  22573. return xs(e);
  22574. }
  22575. });
  22576. t.initLocalNetwork = function () {
  22577. return s.exec();
  22578. };
  22579. }(t), Rs(t), xn(t), function (e) {
  22580. var t = e.uploadFile;
  22581. e.uploadFile = function (e) {
  22582. return t.call(this, e);
  22583. };
  22584. }(t), function (e) {
  22585. e.database = function (t) {
  22586. if (t && Object.keys(t).length > 0) return e.init(t).database();
  22587. if (this._database) return this._database;
  22588. var n = Bn($n, {
  22589. uniClient: e
  22590. });
  22591. return this._database = n, n;
  22592. }, e.databaseForJQL = function (t) {
  22593. if (t && Object.keys(t).length > 0) return e.init(t).databaseForJQL();
  22594. if (this._databaseForJQL) return this._databaseForJQL;
  22595. var n = Bn($n, {
  22596. uniClient: e,
  22597. isJQL: !0
  22598. });
  22599. return this._databaseForJQL = n, n;
  22600. };
  22601. }(t), function (e) {
  22602. e.getCurrentUserInfo = _s, e.chooseAndUploadFile = vs.initChooseAndUploadFile(e), Object.assign(e, {
  22603. get mixinDatacom() {
  22604. return Ss(e);
  22605. }
  22606. }), e.SSEChannel = Es, e.initSecureNetworkByWeixin = Ps(e), e.importObject = bs(e);
  22607. }(t);
  22608. return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach(function (e) {
  22609. if (!t[e]) return;
  22610. var n = t[e];
  22611. t[e] = function () {
  22612. return n.apply(t, Array.from(arguments));
  22613. }, t[e] = function (e, t) {
  22614. return function (n) {
  22615. var _this25 = this;
  22616. var s = !1;
  22617. if ("callFunction" === t) {
  22618. var _e30 = n && n.type || u;
  22619. s = _e30 !== u;
  22620. }
  22621. var r = "callFunction" === t && !s,
  22622. i = this._initPromiseHub.exec();
  22623. n = n || {};
  22624. var _te2 = te(n),
  22625. o = _te2.success,
  22626. a = _te2.fail,
  22627. c = _te2.complete,
  22628. h = i.then(function () {
  22629. return s ? Promise.resolve() : q(M(t, "invoke"), n);
  22630. }).then(function () {
  22631. return e.call(_this25, n);
  22632. }).then(function (e) {
  22633. return s ? Promise.resolve(e) : q(M(t, "success"), e).then(function () {
  22634. return q(M(t, "complete"), e);
  22635. }).then(function () {
  22636. return r && Q(B, {
  22637. type: J,
  22638. content: e
  22639. }), Promise.resolve(e);
  22640. });
  22641. }, function (e) {
  22642. return s ? Promise.reject(e) : q(M(t, "fail"), e).then(function () {
  22643. return q(M(t, "complete"), e);
  22644. }).then(function () {
  22645. return Q(B, {
  22646. type: J,
  22647. content: e
  22648. }), Promise.reject(e);
  22649. });
  22650. });
  22651. if (!(o || a || c)) return h;
  22652. h.then(function (e) {
  22653. o && o(e), c && c(e), r && Q(B, {
  22654. type: J,
  22655. content: e
  22656. });
  22657. }, function (e) {
  22658. a && a(e), c && c(e), r && Q(B, {
  22659. type: J,
  22660. content: e
  22661. });
  22662. });
  22663. };
  22664. }(t[e], e).bind(t);
  22665. }), t.init = this.init, t;
  22666. }
  22667. }]);
  22668. return _class7;
  22669. }())();
  22670. (function () {
  22671. var e = E;
  22672. var t = {};
  22673. if (e && 1 === e.length) t = e[0], Ls = Ls.init(t), Ls._isDefault = !0;else {
  22674. var _t19 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "database", "getCurrentUSerInfo", "importObject"];
  22675. var _n16;
  22676. _n16 = e && e.length > 0 ? "应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间" : O ? "应用未关联服务空间,请在uniCloud目录右键关联服务空间" : "uni-app cli项目内使用uniCloud需要使用HBuilderX的运行菜单运行项目,且需要在uniCloud目录关联服务空间", _t19.forEach(function (e) {
  22677. Ls[e] = function () {
  22678. return console.error(_n16), Promise.reject(new ne({
  22679. code: "SYS_ERR",
  22680. message: _n16
  22681. }));
  22682. };
  22683. });
  22684. }
  22685. Object.assign(Ls, {
  22686. get mixinDatacom() {
  22687. return Ss(Ls);
  22688. }
  22689. }), fs(Ls), Ls.addInterceptor = D, Ls.removeInterceptor = F, Ls.interceptObject = K, b && "web" === P && (window.uniCloud = Ls);
  22690. })();
  22691. var Ns = Ls;
  22692. exports.default = Ns;
  22693. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  22694. /***/ }),
  22695. /***/ 698:
  22696. /*!**********************************************************************!*\
  22697. !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
  22698. \**********************************************************************/
  22699. /*! no static exports found */
  22700. /***/ (function(module, exports) {
  22701. function _assertThisInitialized(self) {
  22702. if (self === void 0) {
  22703. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  22704. }
  22705. return self;
  22706. }
  22707. module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22708. /***/ }),
  22709. /***/ 699:
  22710. /*!*********************************************************!*\
  22711. !*** ./node_modules/@babel/runtime/helpers/inherits.js ***!
  22712. \*********************************************************/
  22713. /*! no static exports found */
  22714. /***/ (function(module, exports, __webpack_require__) {
  22715. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  22716. function _inherits(subClass, superClass) {
  22717. if (typeof superClass !== "function" && superClass !== null) {
  22718. throw new TypeError("Super expression must either be null or a function");
  22719. }
  22720. subClass.prototype = Object.create(superClass && superClass.prototype, {
  22721. constructor: {
  22722. value: subClass,
  22723. writable: true,
  22724. configurable: true
  22725. }
  22726. });
  22727. Object.defineProperty(subClass, "prototype", {
  22728. writable: false
  22729. });
  22730. if (superClass) setPrototypeOf(subClass, superClass);
  22731. }
  22732. module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22733. /***/ }),
  22734. /***/ 7:
  22735. /*!*********************************************************************!*\
  22736. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  22737. \*********************************************************************/
  22738. /*! no static exports found */
  22739. /***/ (function(module, exports) {
  22740. function _iterableToArrayLimit(arr, i) {
  22741. var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
  22742. if (null != _i) {
  22743. var _s,
  22744. _e,
  22745. _x,
  22746. _r,
  22747. _arr = [],
  22748. _n = !0,
  22749. _d = !1;
  22750. try {
  22751. if (_x = (_i = _i.call(arr)).next, 0 === i) {
  22752. if (Object(_i) !== _i) return;
  22753. _n = !1;
  22754. } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {
  22755. ;
  22756. }
  22757. } catch (err) {
  22758. _d = !0, _e = err;
  22759. } finally {
  22760. try {
  22761. if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
  22762. } finally {
  22763. if (_d) throw _e;
  22764. }
  22765. }
  22766. return _arr;
  22767. }
  22768. }
  22769. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22770. /***/ }),
  22771. /***/ 700:
  22772. /*!**************************************************************************!*\
  22773. !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
  22774. \**************************************************************************/
  22775. /*! no static exports found */
  22776. /***/ (function(module, exports, __webpack_require__) {
  22777. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  22778. var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ 698);
  22779. function _possibleConstructorReturn(self, call) {
  22780. if (call && (_typeof(call) === "object" || typeof call === "function")) {
  22781. return call;
  22782. } else if (call !== void 0) {
  22783. throw new TypeError("Derived constructors may only return object or undefined");
  22784. }
  22785. return assertThisInitialized(self);
  22786. }
  22787. module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22788. /***/ }),
  22789. /***/ 701:
  22790. /*!***************************************************************!*\
  22791. !*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
  22792. \***************************************************************/
  22793. /*! no static exports found */
  22794. /***/ (function(module, exports) {
  22795. function _getPrototypeOf(o) {
  22796. module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
  22797. return o.__proto__ || Object.getPrototypeOf(o);
  22798. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22799. return _getPrototypeOf(o);
  22800. }
  22801. module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22802. /***/ }),
  22803. /***/ 702:
  22804. /*!****************************************************************!*\
  22805. !*** ./node_modules/@babel/runtime/helpers/wrapNativeSuper.js ***!
  22806. \****************************************************************/
  22807. /*! no static exports found */
  22808. /***/ (function(module, exports, __webpack_require__) {
  22809. var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf.js */ 701);
  22810. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  22811. var isNativeFunction = __webpack_require__(/*! ./isNativeFunction.js */ 703);
  22812. var construct = __webpack_require__(/*! ./construct.js */ 15);
  22813. function _wrapNativeSuper(Class) {
  22814. var _cache = typeof Map === "function" ? new Map() : undefined;
  22815. module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
  22816. if (Class === null || !isNativeFunction(Class)) return Class;
  22817. if (typeof Class !== "function") {
  22818. throw new TypeError("Super expression must either be null or a function");
  22819. }
  22820. if (typeof _cache !== "undefined") {
  22821. if (_cache.has(Class)) return _cache.get(Class);
  22822. _cache.set(Class, Wrapper);
  22823. }
  22824. function Wrapper() {
  22825. return construct(Class, arguments, getPrototypeOf(this).constructor);
  22826. }
  22827. Wrapper.prototype = Object.create(Class.prototype, {
  22828. constructor: {
  22829. value: Wrapper,
  22830. enumerable: false,
  22831. writable: true,
  22832. configurable: true
  22833. }
  22834. });
  22835. return setPrototypeOf(Wrapper, Class);
  22836. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22837. return _wrapNativeSuper(Class);
  22838. }
  22839. module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22840. /***/ }),
  22841. /***/ 703:
  22842. /*!*****************************************************************!*\
  22843. !*** ./node_modules/@babel/runtime/helpers/isNativeFunction.js ***!
  22844. \*****************************************************************/
  22845. /*! no static exports found */
  22846. /***/ (function(module, exports) {
  22847. function _isNativeFunction(fn) {
  22848. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  22849. }
  22850. module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22851. /***/ }),
  22852. /***/ 704:
  22853. /*!*************************************************************!*\
  22854. !*** E:/work/mdapp/pages.json?{"type":"origin-pages-json"} ***!
  22855. \*************************************************************/
  22856. /*! no static exports found */
  22857. /***/ (function(module, exports, __webpack_require__) {
  22858. "use strict";
  22859. Object.defineProperty(exports, "__esModule", {
  22860. value: true
  22861. });
  22862. exports.default = void 0;
  22863. var _default = {
  22864. "pages": [{
  22865. "path": "pages/index/index",
  22866. "style": {
  22867. "navigationBarTitleText": "首页"
  22868. }
  22869. }, {
  22870. "path": "pages/index/web",
  22871. "style": {
  22872. "navigationBarTitleText": "小程序使用说明",
  22873. "enablePullDownRefresh": false
  22874. }
  22875. }, {
  22876. "path": "pages/user/login/login",
  22877. "style": {
  22878. "navigationBarTitleText": "登录",
  22879. "enablePullDownRefresh": false
  22880. }
  22881. }, {
  22882. "path": "pages/user/login/register",
  22883. "style": {
  22884. "navigationBarTitleText": "注册",
  22885. "enablePullDownRefresh": false
  22886. }
  22887. }, {
  22888. "path": "pages/agent/recommend/create",
  22889. "style": {
  22890. "navigationBarTitleText": "客户推荐",
  22891. "enablePullDownRefresh": false
  22892. }
  22893. }, {
  22894. "path": "pages/agent/activity/list",
  22895. "style": {
  22896. "navigationBarTitleText": "活动列表",
  22897. "enablePullDownRefresh": false
  22898. }
  22899. }, {
  22900. "path": "pages/agent/activity/join",
  22901. "style": {
  22902. "navigationBarTitleText": "活动报名",
  22903. "enablePullDownRefresh": false
  22904. }
  22905. }, {
  22906. "path": "pages/agent/activity/join2",
  22907. "style": {
  22908. "navigationBarTitleText": "踩盘报名",
  22909. "enablePullDownRefresh": false
  22910. }
  22911. }, {
  22912. "path": "pages/agent/recommend/createin",
  22913. "style": {
  22914. "navigationBarTitleText": "内部报备",
  22915. "enablePullDownRefresh": false
  22916. }
  22917. }, {
  22918. "path": "pages/agent/recommend/list",
  22919. "style": {
  22920. "navigationStyle": "custom",
  22921. "enablePullDownRefresh": true
  22922. }
  22923. }, {
  22924. "path": "pages/agent/recommend/estate",
  22925. "style": {
  22926. "navigationStyle": "custom",
  22927. "enablePullDownRefresh": true
  22928. }
  22929. }, {
  22930. "path": "pages/agent/recommend/check",
  22931. "style": {
  22932. "navigationBarTitleText": "报备审核",
  22933. "enablePullDownRefresh": false
  22934. }
  22935. }, {
  22936. "path": "pages/agent/recommend/detail",
  22937. "style": {
  22938. "navigationBarTitleText": "报备详情",
  22939. "enablePullDownRefresh": false
  22940. }
  22941. }, {
  22942. "path": "pages/agent/recommend/detailGovern",
  22943. "style": {
  22944. "navigationBarTitleText": "报备详情",
  22945. "enablePullDownRefresh": false
  22946. }
  22947. }, {
  22948. "path": "pages/agent/recommend/visitimg",
  22949. "style": {
  22950. "navigationBarTitleText": "到访凭证和认购资料",
  22951. "enablePullDownRefresh": false
  22952. }
  22953. }, {
  22954. "path": "pages/agent/recommend/detail2",
  22955. "style": {
  22956. "navigationBarTitleText": "客户详情-案场",
  22957. "enablePullDownRefresh": false
  22958. }
  22959. }, {
  22960. "path": "pages/cust/create",
  22961. "style": {
  22962. "navigationBarTitleText": "添加客户",
  22963. "enablePullDownRefresh": false
  22964. }
  22965. }, {
  22966. "path": "pages/cust/list",
  22967. "style": {
  22968. "navigationBarTitleText": "客户列表",
  22969. "enablePullDownRefresh": true
  22970. }
  22971. }, {
  22972. "path": "pages/cust/mycreate",
  22973. "style": {
  22974. "navigationBarTitleText": "添加我的客户",
  22975. "enablePullDownRefresh": false
  22976. }
  22977. }, {
  22978. "path": "pages/cust/myrecord",
  22979. "style": {
  22980. "navigationBarTitleText": "客户跟进记录",
  22981. "enablePullDownRefresh": false
  22982. }
  22983. }, {
  22984. "path": "pages/cust/myrecordedit",
  22985. "style": {
  22986. "navigationBarTitleText": "客户跟进记录添加",
  22987. "enablePullDownRefresh": false
  22988. }
  22989. }, {
  22990. "path": "pages/cust/my",
  22991. "style": {
  22992. "navigationBarTitleText": "我的客户列表",
  22993. "enablePullDownRefresh": true
  22994. }
  22995. }, {
  22996. "path": "pages/user/contract/list",
  22997. "style": {
  22998. "navigationBarTitleText": "合同列表",
  22999. "enablePullDownRefresh": false
  23000. }
  23001. }, {
  23002. "path": "pages/user/contract/edit",
  23003. "style": {
  23004. "navigationBarTitleText": "合同编辑",
  23005. "enablePullDownRefresh": false
  23006. }
  23007. }, {
  23008. "path": "pages/user/contract/dtl",
  23009. "style": {
  23010. "navigationBarTitleText": "合同详情",
  23011. "enablePullDownRefresh": false
  23012. }
  23013. }, {
  23014. "path": "pages/user/setting/setting",
  23015. "style": {
  23016. "navigationBarTitleText": "设置",
  23017. "enablePullDownRefresh": false
  23018. }
  23019. }, {
  23020. "path": "pages/user/setting/profile",
  23021. "style": {
  23022. "navigationBarTitleText": "个人信息",
  23023. "enablePullDownRefresh": false
  23024. }
  23025. }, {
  23026. "path": "pages/user/setting/bank",
  23027. "style": {
  23028. "navigationBarTitleText": "认证身份信息",
  23029. "enablePullDownRefresh": false
  23030. }
  23031. }, {
  23032. "path": "pages/saler/list",
  23033. "style": {
  23034. "navigationBarTitleText": "我的门店",
  23035. "enablePullDownRefresh": false
  23036. }
  23037. }, {
  23038. "path": "pages/saler/check",
  23039. "style": {
  23040. "navigationBarTitleText": "认证审核列表",
  23041. "enablePullDownRefresh": false
  23042. }
  23043. }, {
  23044. "path": "pages/saler/deal",
  23045. "style": {
  23046. "navigationBarTitleText": "认证审核",
  23047. "enablePullDownRefresh": false
  23048. }
  23049. }, {
  23050. "path": "pages/agreement/agreement",
  23051. "style": {
  23052. "navigationBarTitleText": "用户协议",
  23053. "enablePullDownRefresh": false
  23054. }
  23055. }, {
  23056. "path": "pages/agreement/agreement2",
  23057. "style": {
  23058. "navigationBarTitleText": "隐私协议",
  23059. "enablePullDownRefresh": false
  23060. }
  23061. }, {
  23062. "path": "pages/estate/list",
  23063. "style": {
  23064. "navigationBarTitleText": "楼盘列表",
  23065. "enablePullDownRefresh": false
  23066. }
  23067. }, {
  23068. "path": "pages/estate/dtl",
  23069. "style": {
  23070. "navigationBarTitleText": "楼盘详情",
  23071. "enablePullDownRefresh": false
  23072. }
  23073. }, {
  23074. "path": "pages/estate/libPre",
  23075. "style": {
  23076. "navigationBarTitleText": "选择区域",
  23077. "enablePullDownRefresh": false
  23078. }
  23079. }, {
  23080. "path": "pages/estate/lib",
  23081. "style": {
  23082. "navigationBarTitleText": "内部各楼盘各平台佣金汇集(请勿外传)",
  23083. "enablePullDownRefresh": false
  23084. }
  23085. }, {
  23086. "path": "pages/agent/report/buycheck",
  23087. "style": {
  23088. "navigationBarTitleText": "认购审核列表",
  23089. "enablePullDownRefresh": false
  23090. }
  23091. }, {
  23092. "path": "pages/agent/report/deal",
  23093. "style": {
  23094. "navigationBarTitleText": "认购审核操作",
  23095. "enablePullDownRefresh": false
  23096. }
  23097. }, {
  23098. "path": "pages/user/setting/avatar",
  23099. "style": {
  23100. "navigationBarTitleText": "头像",
  23101. "enablePullDownRefresh": false
  23102. }
  23103. }, {
  23104. "path": "pages/trade/list",
  23105. "style": {
  23106. "navigationBarTitleText": "成交单列表",
  23107. "enablePullDownRefresh": false
  23108. }
  23109. }, {
  23110. "path": "pages/trade/create",
  23111. "style": {
  23112. "navigationBarTitleText": "添加成交单",
  23113. "enablePullDownRefresh": false
  23114. }
  23115. }, {
  23116. "path": "pages/trade/record",
  23117. "style": {
  23118. "navigationBarTitleText": "成交单详情",
  23119. "enablePullDownRefresh": false
  23120. }
  23121. }, {
  23122. "path": "pages/trade/check",
  23123. "style": {
  23124. "navigationBarTitleText": "成交单审核",
  23125. "enablePullDownRefresh": false
  23126. }
  23127. }, {
  23128. "path": "pages/trade/recordedit",
  23129. "style": {
  23130. "navigationBarTitleText": "成交单详情编辑",
  23131. "enablePullDownRefresh": false
  23132. }
  23133. }, {
  23134. "path": "pages/trade/recordTrade1",
  23135. "style": {
  23136. "navigationBarTitleText": "签订合同",
  23137. "enablePullDownRefresh": false
  23138. }
  23139. }, {
  23140. "path": "pages/trade/recordTrade2",
  23141. "style": {
  23142. "navigationBarTitleText": "合同流程",
  23143. "enablePullDownRefresh": false
  23144. }
  23145. }, {
  23146. "path": "pages/shop/chart",
  23147. "style": {
  23148. "navigationBarTitleText": "门店统计",
  23149. "enablePullDownRefresh": false
  23150. }
  23151. }, {
  23152. "path": "pages/shop/map",
  23153. "style": {
  23154. "navigationBarTitleText": "门店地图",
  23155. "enablePullDownRefresh": false
  23156. }
  23157. }],
  23158. "globalStyle": {
  23159. "navigationBarTextStyle": "white",
  23160. "navigationBarBackgroundColor": "#2080f0",
  23161. "navigationBarTitleText": "",
  23162. "backgroundColor": "#F8F8F8"
  23163. }
  23164. };
  23165. exports.default = _default;
  23166. /***/ }),
  23167. /***/ 705:
  23168. /*!************************************************!*\
  23169. !*** E:/work/mdapp/pages.json?{"type":"stat"} ***!
  23170. \************************************************/
  23171. /*! no static exports found */
  23172. /***/ (function(module, exports, __webpack_require__) {
  23173. "use strict";
  23174. Object.defineProperty(exports, "__esModule", {
  23175. value: true
  23176. });
  23177. exports.default = void 0;
  23178. var _default = {
  23179. "appid": "__UNI__1C40FB4"
  23180. };
  23181. exports.default = _default;
  23182. /***/ }),
  23183. /***/ 706:
  23184. /*!******************************************************************************!*\
  23185. !*** E:/work/mdapp/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js ***!
  23186. \******************************************************************************/
  23187. /*! no static exports found */
  23188. /***/ (function(module, exports, __webpack_require__) {
  23189. "use strict";
  23190. /*
  23191. * uCharts (R)
  23192. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360/快手)、Vue、Taro等支持canvas的框架平台
  23193. * Copyright (C) 2018-2022 QIUN (R) 秋云 https://www.ucharts.cn All rights reserved.
  23194. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  23195. * 复制使用请保留本段注释,感谢支持开源!
  23196. *
  23197. * uCharts (R) 官方网站
  23198. * https://www.uCharts.cn
  23199. *
  23200. * 开源地址:
  23201. * https://gitee.com/uCharts/uCharts
  23202. *
  23203. * uni-app插件市场地址:
  23204. * http://ext.dcloud.net.cn/plugin?id=271
  23205. *
  23206. */
  23207. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  23208. Object.defineProperty(exports, "__esModule", {
  23209. value: true
  23210. });
  23211. exports.default = void 0;
  23212. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  23213. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  23214. var config = {
  23215. version: 'v2.5.0-20230101',
  23216. yAxisWidth: 15,
  23217. xAxisHeight: 22,
  23218. padding: [10, 10, 10, 10],
  23219. rotate: false,
  23220. fontSize: 13,
  23221. fontColor: '#666666',
  23222. dataPointShape: ['circle', 'circle', 'circle', 'circle'],
  23223. color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'],
  23224. linearColor: ['#0EE2F8', '#2BDCA8', '#FA7D8D', '#EB88E2', '#2AE3A0', '#0EE2F8', '#EB88E2', '#6773E3', '#F78A85'],
  23225. pieChartLinePadding: 15,
  23226. pieChartTextPadding: 5,
  23227. titleFontSize: 20,
  23228. subtitleFontSize: 15,
  23229. radarLabelTextMargin: 13
  23230. };
  23231. var assign = function assign(target) {
  23232. for (var _len2 = arguments.length, varArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  23233. varArgs[_key2 - 1] = arguments[_key2];
  23234. }
  23235. if (target == null) {
  23236. throw new TypeError('[uCharts] Cannot convert undefined or null to object');
  23237. }
  23238. if (!varArgs || varArgs.length <= 0) {
  23239. return target;
  23240. }
  23241. // 深度合并对象
  23242. function deepAssign(obj1, obj2) {
  23243. for (var key in obj2) {
  23244. obj1[key] = obj1[key] && obj1[key].toString() === "[object Object]" ? deepAssign(obj1[key], obj2[key]) : obj1[key] = obj2[key];
  23245. }
  23246. return obj1;
  23247. }
  23248. varArgs.forEach(function (val) {
  23249. target = deepAssign(target, val);
  23250. });
  23251. return target;
  23252. };
  23253. var util = {
  23254. toFixed: function toFixed(num, limit) {
  23255. limit = limit || 2;
  23256. if (this.isFloat(num)) {
  23257. num = num.toFixed(limit);
  23258. }
  23259. return num;
  23260. },
  23261. isFloat: function isFloat(num) {
  23262. return num % 1 !== 0;
  23263. },
  23264. approximatelyEqual: function approximatelyEqual(num1, num2) {
  23265. return Math.abs(num1 - num2) < 1e-10;
  23266. },
  23267. isSameSign: function isSameSign(num1, num2) {
  23268. return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
  23269. },
  23270. isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
  23271. return this.isSameSign(p1.x, p2.x);
  23272. },
  23273. isCollision: function isCollision(obj1, obj2) {
  23274. obj1.end = {};
  23275. obj1.end.x = obj1.start.x + obj1.width;
  23276. obj1.end.y = obj1.start.y - obj1.height;
  23277. obj2.end = {};
  23278. obj2.end.x = obj2.start.x + obj2.width;
  23279. obj2.end.y = obj2.start.y - obj2.height;
  23280. 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;
  23281. return !flag;
  23282. }
  23283. };
  23284. //兼容H5点击事件
  23285. function getH5Offset(e) {
  23286. e.mp = {
  23287. changedTouches: []
  23288. };
  23289. e.mp.changedTouches.push({
  23290. x: e.offsetX,
  23291. y: e.offsetY
  23292. });
  23293. return e;
  23294. }
  23295. // hex 转 rgba
  23296. function hexToRgb(hexValue, opc) {
  23297. var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  23298. var hex = hexValue.replace(rgx, function (m, r, g, b) {
  23299. return r + r + g + g + b + b;
  23300. });
  23301. var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  23302. var r = parseInt(rgb[1], 16);
  23303. var g = parseInt(rgb[2], 16);
  23304. var b = parseInt(rgb[3], 16);
  23305. return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')';
  23306. }
  23307. function findRange(num, type, limit) {
  23308. if (isNaN(num)) {
  23309. throw new Error('[uCharts] series数据需为Number格式');
  23310. }
  23311. limit = limit || 10;
  23312. type = type ? type : 'upper';
  23313. var multiple = 1;
  23314. while (limit < 1) {
  23315. limit *= 10;
  23316. multiple *= 10;
  23317. }
  23318. if (type === 'upper') {
  23319. num = Math.ceil(num * multiple);
  23320. } else {
  23321. num = Math.floor(num * multiple);
  23322. }
  23323. while (num % limit !== 0) {
  23324. if (type === 'upper') {
  23325. if (num == num + 1) {
  23326. //修复数据值过大num++无效的bug by 向日葵 @xrk_jy
  23327. break;
  23328. }
  23329. num++;
  23330. } else {
  23331. num--;
  23332. }
  23333. }
  23334. return num / multiple;
  23335. }
  23336. function calCandleMA(dayArr, nameArr, colorArr, kdata) {
  23337. var seriesTemp = [];
  23338. for (var k = 0; k < dayArr.length; k++) {
  23339. var seriesItem = {
  23340. data: [],
  23341. name: nameArr[k],
  23342. color: colorArr[k]
  23343. };
  23344. for (var i = 0, len = kdata.length; i < len; i++) {
  23345. if (i < dayArr[k]) {
  23346. seriesItem.data.push(null);
  23347. continue;
  23348. }
  23349. var sum = 0;
  23350. for (var j = 0; j < dayArr[k]; j++) {
  23351. sum += kdata[i - j][1];
  23352. }
  23353. seriesItem.data.push(+(sum / dayArr[k]).toFixed(3));
  23354. }
  23355. seriesTemp.push(seriesItem);
  23356. }
  23357. return seriesTemp;
  23358. }
  23359. function calValidDistance(self, distance, chartData, config, opts) {
  23360. var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
  23361. var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length - 1);
  23362. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  23363. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  23364. dataChartWidth += (opts.extra.mount.widthRatio - 1) * chartData.eachSpacing;
  23365. }
  23366. var validDistance = distance;
  23367. if (distance >= 0) {
  23368. validDistance = 0;
  23369. self.uevent.trigger('scrollLeft');
  23370. self.scrollOption.position = 'left';
  23371. opts.xAxis.scrollPosition = 'left';
  23372. } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) {
  23373. validDistance = dataChartAreaWidth - dataChartWidth;
  23374. self.uevent.trigger('scrollRight');
  23375. self.scrollOption.position = 'right';
  23376. opts.xAxis.scrollPosition = 'right';
  23377. } else {
  23378. self.scrollOption.position = distance;
  23379. opts.xAxis.scrollPosition = distance;
  23380. }
  23381. return validDistance;
  23382. }
  23383. function isInAngleRange(angle, startAngle, endAngle) {
  23384. function adjust(angle) {
  23385. while (angle < 0) {
  23386. angle += 2 * Math.PI;
  23387. }
  23388. while (angle > 2 * Math.PI) {
  23389. angle -= 2 * Math.PI;
  23390. }
  23391. return angle;
  23392. }
  23393. angle = adjust(angle);
  23394. startAngle = adjust(startAngle);
  23395. endAngle = adjust(endAngle);
  23396. if (startAngle > endAngle) {
  23397. endAngle += 2 * Math.PI;
  23398. if (angle < startAngle) {
  23399. angle += 2 * Math.PI;
  23400. }
  23401. }
  23402. return angle >= startAngle && angle <= endAngle;
  23403. }
  23404. function createCurveControlPoints(points, i) {
  23405. function isNotMiddlePoint(points, i) {
  23406. if (points[i - 1] && points[i + 1]) {
  23407. return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y, points[i + 1].y);
  23408. } else {
  23409. return false;
  23410. }
  23411. }
  23412. function isNotMiddlePointX(points, i) {
  23413. if (points[i - 1] && points[i + 1]) {
  23414. return points[i].x >= Math.max(points[i - 1].x, points[i + 1].x) || points[i].x <= Math.min(points[i - 1].x, points[i + 1].x);
  23415. } else {
  23416. return false;
  23417. }
  23418. }
  23419. var a = 0.2;
  23420. var b = 0.2;
  23421. var pAx = null;
  23422. var pAy = null;
  23423. var pBx = null;
  23424. var pBy = null;
  23425. if (i < 1) {
  23426. pAx = points[0].x + (points[1].x - points[0].x) * a;
  23427. pAy = points[0].y + (points[1].y - points[0].y) * a;
  23428. } else {
  23429. pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
  23430. pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
  23431. }
  23432. if (i > points.length - 3) {
  23433. var last = points.length - 1;
  23434. pBx = points[last].x - (points[last].x - points[last - 1].x) * b;
  23435. pBy = points[last].y - (points[last].y - points[last - 1].y) * b;
  23436. } else {
  23437. pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
  23438. pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
  23439. }
  23440. if (isNotMiddlePoint(points, i + 1)) {
  23441. pBy = points[i + 1].y;
  23442. }
  23443. if (isNotMiddlePoint(points, i)) {
  23444. pAy = points[i].y;
  23445. }
  23446. if (isNotMiddlePointX(points, i + 1)) {
  23447. pBx = points[i + 1].x;
  23448. }
  23449. if (isNotMiddlePointX(points, i)) {
  23450. pAx = points[i].x;
  23451. }
  23452. if (pAy >= Math.max(points[i].y, points[i + 1].y) || pAy <= Math.min(points[i].y, points[i + 1].y)) {
  23453. pAy = points[i].y;
  23454. }
  23455. if (pBy >= Math.max(points[i].y, points[i + 1].y) || pBy <= Math.min(points[i].y, points[i + 1].y)) {
  23456. pBy = points[i + 1].y;
  23457. }
  23458. if (pAx >= Math.max(points[i].x, points[i + 1].x) || pAx <= Math.min(points[i].x, points[i + 1].x)) {
  23459. pAx = points[i].x;
  23460. }
  23461. if (pBx >= Math.max(points[i].x, points[i + 1].x) || pBx <= Math.min(points[i].x, points[i + 1].x)) {
  23462. pBx = points[i + 1].x;
  23463. }
  23464. return {
  23465. ctrA: {
  23466. x: pAx,
  23467. y: pAy
  23468. },
  23469. ctrB: {
  23470. x: pBx,
  23471. y: pBy
  23472. }
  23473. };
  23474. }
  23475. function convertCoordinateOrigin(x, y, center) {
  23476. return {
  23477. x: center.x + x,
  23478. y: center.y - y
  23479. };
  23480. }
  23481. function avoidCollision(obj, target) {
  23482. if (target) {
  23483. // is collision test
  23484. while (util.isCollision(obj, target)) {
  23485. if (obj.start.x > 0) {
  23486. obj.start.y--;
  23487. } else if (obj.start.x < 0) {
  23488. obj.start.y++;
  23489. } else {
  23490. if (obj.start.y > 0) {
  23491. obj.start.y++;
  23492. } else {
  23493. obj.start.y--;
  23494. }
  23495. }
  23496. }
  23497. }
  23498. return obj;
  23499. }
  23500. function fixPieSeries(series, opts, config) {
  23501. var pieSeriesArr = [];
  23502. if (series.length > 0 && series[0].data.constructor.toString().indexOf('Array') > -1) {
  23503. opts._pieSeries_ = series;
  23504. var oldseries = series[0].data;
  23505. for (var i = 0; i < oldseries.length; i++) {
  23506. oldseries[i].formatter = series[0].formatter;
  23507. oldseries[i].data = oldseries[i].value;
  23508. pieSeriesArr.push(oldseries[i]);
  23509. }
  23510. opts.series = pieSeriesArr;
  23511. } else {
  23512. pieSeriesArr = series;
  23513. }
  23514. return pieSeriesArr;
  23515. }
  23516. function fillSeries(series, opts, config) {
  23517. var index = 0;
  23518. for (var i = 0; i < series.length; i++) {
  23519. var item = series[i];
  23520. if (!item.color) {
  23521. item.color = config.color[index];
  23522. index = (index + 1) % config.color.length;
  23523. }
  23524. if (!item.linearIndex) {
  23525. item.linearIndex = i;
  23526. }
  23527. if (!item.index) {
  23528. item.index = 0;
  23529. }
  23530. if (!item.type) {
  23531. item.type = opts.type;
  23532. }
  23533. if (typeof item.show == "undefined") {
  23534. item.show = true;
  23535. }
  23536. if (!item.type) {
  23537. item.type = opts.type;
  23538. }
  23539. if (!item.pointShape) {
  23540. item.pointShape = "circle";
  23541. }
  23542. if (!item.legendShape) {
  23543. switch (item.type) {
  23544. case 'line':
  23545. item.legendShape = "line";
  23546. break;
  23547. case 'column':
  23548. case 'bar':
  23549. item.legendShape = "rect";
  23550. break;
  23551. case 'area':
  23552. case 'mount':
  23553. item.legendShape = "triangle";
  23554. break;
  23555. default:
  23556. item.legendShape = "circle";
  23557. }
  23558. }
  23559. }
  23560. return series;
  23561. }
  23562. function fillCustomColor(linearType, customColor, series, config) {
  23563. var newcolor = customColor || [];
  23564. if (linearType == 'custom' && newcolor.length == 0) {
  23565. newcolor = config.linearColor;
  23566. }
  23567. if (linearType == 'custom' && newcolor.length < series.length) {
  23568. var chazhi = series.length - newcolor.length;
  23569. for (var i = 0; i < chazhi; i++) {
  23570. newcolor.push(config.linearColor[(i + 1) % config.linearColor.length]);
  23571. }
  23572. }
  23573. return newcolor;
  23574. }
  23575. function getDataRange(minData, maxData) {
  23576. var limit = 0;
  23577. var range = maxData - minData;
  23578. if (range >= 10000) {
  23579. limit = 1000;
  23580. } else if (range >= 1000) {
  23581. limit = 100;
  23582. } else if (range >= 100) {
  23583. limit = 10;
  23584. } else if (range >= 10) {
  23585. limit = 5;
  23586. } else if (range >= 1) {
  23587. limit = 1;
  23588. } else if (range >= 0.1) {
  23589. limit = 0.1;
  23590. } else if (range >= 0.01) {
  23591. limit = 0.01;
  23592. } else if (range >= 0.001) {
  23593. limit = 0.001;
  23594. } else if (range >= 0.0001) {
  23595. limit = 0.0001;
  23596. } else if (range >= 0.00001) {
  23597. limit = 0.00001;
  23598. } else {
  23599. limit = 0.000001;
  23600. }
  23601. return {
  23602. minRange: findRange(minData, 'lower', limit),
  23603. maxRange: findRange(maxData, 'upper', limit)
  23604. };
  23605. }
  23606. function measureText(text, fontSize, context) {
  23607. var width = 0;
  23608. text = String(text);
  23609. if (context !== false && context !== undefined && context.setFontSize && context.measureText) {
  23610. context.setFontSize(fontSize);
  23611. return context.measureText(text).width;
  23612. } else {
  23613. var text = text.split('');
  23614. for (var i = 0; i < text.length; i++) {
  23615. var item = text[i];
  23616. if (/[a-zA-Z]/.test(item)) {
  23617. width += 7;
  23618. } else if (/[0-9]/.test(item)) {
  23619. width += 5.5;
  23620. } else if (/\./.test(item)) {
  23621. width += 2.7;
  23622. } else if (/-/.test(item)) {
  23623. width += 3.25;
  23624. } else if (/:/.test(item)) {
  23625. width += 2.5;
  23626. } else if (/[\u4e00-\u9fa5]/.test(item)) {
  23627. width += 10;
  23628. } else if (/\(|\)/.test(item)) {
  23629. width += 3.73;
  23630. } else if (/\s/.test(item)) {
  23631. width += 2.5;
  23632. } else if (/%/.test(item)) {
  23633. width += 8;
  23634. } else {
  23635. width += 10;
  23636. }
  23637. }
  23638. return width * fontSize / 10;
  23639. }
  23640. }
  23641. function dataCombine(series) {
  23642. return series.reduce(function (a, b) {
  23643. return (a.data ? a.data : a).concat(b.data);
  23644. }, []);
  23645. }
  23646. function dataCombineStack(series, len) {
  23647. var sum = new Array(len);
  23648. for (var j = 0; j < sum.length; j++) {
  23649. sum[j] = 0;
  23650. }
  23651. for (var i = 0; i < series.length; i++) {
  23652. for (var j = 0; j < sum.length; j++) {
  23653. sum[j] += series[i].data[j];
  23654. }
  23655. }
  23656. return series.reduce(function (a, b) {
  23657. return (a.data ? a.data : a).concat(b.data).concat(sum);
  23658. }, []);
  23659. }
  23660. function getTouches(touches, opts, e) {
  23661. var x, y;
  23662. if (touches.clientX) {
  23663. if (opts.rotate) {
  23664. y = opts.height - touches.clientX * opts.pix;
  23665. x = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  23666. } else {
  23667. x = touches.clientX * opts.pix;
  23668. y = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  23669. }
  23670. } else {
  23671. if (opts.rotate) {
  23672. y = opts.height - touches.x * opts.pix;
  23673. x = touches.y * opts.pix;
  23674. } else {
  23675. x = touches.x * opts.pix;
  23676. y = touches.y * opts.pix;
  23677. }
  23678. }
  23679. return {
  23680. x: x,
  23681. y: y
  23682. };
  23683. }
  23684. function getSeriesDataItem(series, index, group) {
  23685. var data = [];
  23686. var newSeries = [];
  23687. var indexIsArr = index.constructor.toString().indexOf('Array') > -1;
  23688. if (indexIsArr) {
  23689. var tempSeries = filterSeries(series);
  23690. for (var i = 0; i < group.length; i++) {
  23691. newSeries.push(tempSeries[group[i]]);
  23692. }
  23693. } else {
  23694. newSeries = series;
  23695. }
  23696. ;
  23697. for (var _i = 0; _i < newSeries.length; _i++) {
  23698. var item = newSeries[_i];
  23699. var tmpindex = -1;
  23700. if (indexIsArr) {
  23701. tmpindex = index[_i];
  23702. } else {
  23703. tmpindex = index;
  23704. }
  23705. if (item.data[tmpindex] !== null && typeof item.data[tmpindex] !== 'undefined' && item.show) {
  23706. var seriesItem = {};
  23707. seriesItem.color = item.color;
  23708. seriesItem.type = item.type;
  23709. seriesItem.style = item.style;
  23710. seriesItem.pointShape = item.pointShape;
  23711. seriesItem.disableLegend = item.disableLegend;
  23712. seriesItem.legendShape = item.legendShape;
  23713. seriesItem.name = item.name;
  23714. seriesItem.show = item.show;
  23715. seriesItem.data = item.formatter ? item.formatter(item.data[tmpindex]) : item.data[tmpindex];
  23716. data.push(seriesItem);
  23717. }
  23718. }
  23719. return data;
  23720. }
  23721. function getMaxTextListLength(list, fontSize, context) {
  23722. var lengthList = list.map(function (item) {
  23723. return measureText(item, fontSize, context);
  23724. });
  23725. return Math.max.apply(null, lengthList);
  23726. }
  23727. function getRadarCoordinateSeries(length) {
  23728. var eachAngle = 2 * Math.PI / length;
  23729. var CoordinateSeries = [];
  23730. for (var i = 0; i < length; i++) {
  23731. CoordinateSeries.push(eachAngle * i);
  23732. }
  23733. return CoordinateSeries.map(function (item) {
  23734. return -1 * item + Math.PI / 2;
  23735. });
  23736. }
  23737. function getToolTipData(seriesData, opts, index, group, categories) {
  23738. var option = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
  23739. var calPoints = opts.chartData.calPoints ? opts.chartData.calPoints : [];
  23740. var points = {};
  23741. if (group.length > 0) {
  23742. var filterPoints = [];
  23743. for (var i = 0; i < group.length; i++) {
  23744. filterPoints.push(calPoints[group[i]]);
  23745. }
  23746. points = filterPoints[0][index[0]];
  23747. } else {
  23748. for (var _i2 = 0; _i2 < calPoints.length; _i2++) {
  23749. if (calPoints[_i2][index]) {
  23750. points = calPoints[_i2][index];
  23751. break;
  23752. }
  23753. }
  23754. }
  23755. ;
  23756. var textList = seriesData.map(function (item) {
  23757. var titleText = null;
  23758. if (opts.categories && opts.categories.length > 0) {
  23759. titleText = categories[index];
  23760. }
  23761. ;
  23762. return {
  23763. text: option.formatter ? option.formatter(item, titleText, index, opts) : item.name + ': ' + item.data,
  23764. color: item.color,
  23765. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23766. };
  23767. });
  23768. var offset = {
  23769. x: Math.round(points.x),
  23770. y: Math.round(points.y)
  23771. };
  23772. return {
  23773. textList: textList,
  23774. offset: offset
  23775. };
  23776. }
  23777. function getMixToolTipData(seriesData, opts, index, categories) {
  23778. var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  23779. var points = opts.chartData.xAxisPoints[index] + opts.chartData.eachSpacing / 2;
  23780. var textList = seriesData.map(function (item) {
  23781. return {
  23782. text: option.formatter ? option.formatter(item, categories[index], index, opts) : item.name + ': ' + item.data,
  23783. color: item.color,
  23784. disableLegend: item.disableLegend ? true : false,
  23785. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23786. };
  23787. });
  23788. textList = textList.filter(function (item) {
  23789. if (item.disableLegend !== true) {
  23790. return item;
  23791. }
  23792. });
  23793. var offset = {
  23794. x: Math.round(points),
  23795. y: 0
  23796. };
  23797. return {
  23798. textList: textList,
  23799. offset: offset
  23800. };
  23801. }
  23802. function getCandleToolTipData(series, seriesData, opts, index, categories, extra) {
  23803. var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
  23804. var calPoints = opts.chartData.calPoints;
  23805. var upColor = extra.color.upFill;
  23806. var downColor = extra.color.downFill;
  23807. //颜色顺序为开盘,收盘,最低,最高
  23808. var color = [upColor, upColor, downColor, upColor];
  23809. var textList = [];
  23810. seriesData.map(function (item) {
  23811. if (index == 0) {
  23812. if (item.data[1] - item.data[0] < 0) {
  23813. color[1] = downColor;
  23814. } else {
  23815. color[1] = upColor;
  23816. }
  23817. } else {
  23818. if (item.data[0] < series[index - 1][1]) {
  23819. color[0] = downColor;
  23820. }
  23821. if (item.data[1] < item.data[0]) {
  23822. color[1] = downColor;
  23823. }
  23824. if (item.data[2] > series[index - 1][1]) {
  23825. color[2] = upColor;
  23826. }
  23827. if (item.data[3] < series[index - 1][1]) {
  23828. color[3] = downColor;
  23829. }
  23830. }
  23831. var text1 = {
  23832. text: '开盘:' + item.data[0],
  23833. color: color[0],
  23834. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23835. };
  23836. var text2 = {
  23837. text: '收盘:' + item.data[1],
  23838. color: color[1],
  23839. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23840. };
  23841. var text3 = {
  23842. text: '最低:' + item.data[2],
  23843. color: color[2],
  23844. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23845. };
  23846. var text4 = {
  23847. text: '最高:' + item.data[3],
  23848. color: color[3],
  23849. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23850. };
  23851. textList.push(text1, text2, text3, text4);
  23852. });
  23853. var validCalPoints = [];
  23854. var offset = {
  23855. x: 0,
  23856. y: 0
  23857. };
  23858. for (var i = 0; i < calPoints.length; i++) {
  23859. var points = calPoints[i];
  23860. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  23861. validCalPoints.push(points[index]);
  23862. }
  23863. }
  23864. offset.x = Math.round(validCalPoints[0][0].x);
  23865. return {
  23866. textList: textList,
  23867. offset: offset
  23868. };
  23869. }
  23870. function filterSeries(series) {
  23871. var tempSeries = [];
  23872. for (var i = 0; i < series.length; i++) {
  23873. if (series[i].show == true) {
  23874. tempSeries.push(series[i]);
  23875. }
  23876. }
  23877. return tempSeries;
  23878. }
  23879. function findCurrentIndex(currentPoints, calPoints, opts, config) {
  23880. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  23881. var current = {
  23882. index: -1,
  23883. group: []
  23884. };
  23885. var spacing = opts.chartData.eachSpacing / 2;
  23886. var xAxisPoints = [];
  23887. if (calPoints && calPoints.length > 0) {
  23888. if (!opts.categories) {
  23889. spacing = 0;
  23890. } else {
  23891. for (var i = 1; i < opts.chartData.xAxisPoints.length; i++) {
  23892. xAxisPoints.push(opts.chartData.xAxisPoints[i] - spacing);
  23893. }
  23894. if ((opts.type == 'line' || opts.type == 'area') && opts.xAxis.boundaryGap == 'justify') {
  23895. xAxisPoints = opts.chartData.xAxisPoints;
  23896. }
  23897. }
  23898. if (isInExactChartArea(currentPoints, opts, config)) {
  23899. if (!opts.categories) {
  23900. var timePoints = Array(calPoints.length);
  23901. for (var _i3 = 0; _i3 < calPoints.length; _i3++) {
  23902. timePoints[_i3] = Array(calPoints[_i3].length);
  23903. for (var j = 0; j < calPoints[_i3].length; j++) {
  23904. timePoints[_i3][j] = Math.abs(calPoints[_i3][j].x - currentPoints.x);
  23905. }
  23906. }
  23907. ;
  23908. var pointValue = Array(timePoints.length);
  23909. var pointIndex = Array(timePoints.length);
  23910. for (var _i4 = 0; _i4 < timePoints.length; _i4++) {
  23911. pointValue[_i4] = Math.min.apply(null, timePoints[_i4]);
  23912. pointIndex[_i4] = timePoints[_i4].indexOf(pointValue[_i4]);
  23913. }
  23914. var minValue = Math.min.apply(null, pointValue);
  23915. current.index = [];
  23916. for (var _i5 = 0; _i5 < pointValue.length; _i5++) {
  23917. if (pointValue[_i5] == minValue) {
  23918. current.group.push(_i5);
  23919. current.index.push(pointIndex[_i5]);
  23920. }
  23921. }
  23922. ;
  23923. } else {
  23924. xAxisPoints.forEach(function (item, index) {
  23925. if (currentPoints.x + offset + spacing > item) {
  23926. current.index = index;
  23927. }
  23928. });
  23929. }
  23930. }
  23931. }
  23932. return current;
  23933. }
  23934. function findBarChartCurrentIndex(currentPoints, calPoints, opts, config) {
  23935. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  23936. var current = {
  23937. index: -1,
  23938. group: []
  23939. };
  23940. var spacing = opts.chartData.eachSpacing / 2;
  23941. var yAxisPoints = opts.chartData.yAxisPoints;
  23942. if (calPoints && calPoints.length > 0) {
  23943. if (isInExactChartArea(currentPoints, opts, config)) {
  23944. yAxisPoints.forEach(function (item, index) {
  23945. if (currentPoints.y + offset + spacing > item) {
  23946. current.index = index;
  23947. }
  23948. });
  23949. }
  23950. }
  23951. return current;
  23952. }
  23953. function findLegendIndex(currentPoints, legendData, opts) {
  23954. var currentIndex = -1;
  23955. var gap = 0;
  23956. if (isInExactLegendArea(currentPoints, legendData.area)) {
  23957. var points = legendData.points;
  23958. var index = -1;
  23959. for (var i = 0, len = points.length; i < len; i++) {
  23960. var item = points[i];
  23961. for (var j = 0; j < item.length; j++) {
  23962. index += 1;
  23963. var area = item[j]['area'];
  23964. if (area && currentPoints.x > area[0] - gap && currentPoints.x < area[2] + gap && currentPoints.y > area[1] - gap && currentPoints.y < area[3] + gap) {
  23965. currentIndex = index;
  23966. break;
  23967. }
  23968. }
  23969. }
  23970. return currentIndex;
  23971. }
  23972. return currentIndex;
  23973. }
  23974. function isInExactLegendArea(currentPoints, area) {
  23975. return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y && currentPoints.y < area.end.y;
  23976. }
  23977. function isInExactChartArea(currentPoints, opts, config) {
  23978. 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];
  23979. }
  23980. function findRadarChartCurrentIndex(currentPoints, radarData, count) {
  23981. var eachAngleArea = 2 * Math.PI / count;
  23982. var currentIndex = -1;
  23983. if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
  23984. var fixAngle = function fixAngle(angle) {
  23985. if (angle < 0) {
  23986. angle += 2 * Math.PI;
  23987. }
  23988. if (angle > 2 * Math.PI) {
  23989. angle -= 2 * Math.PI;
  23990. }
  23991. return angle;
  23992. };
  23993. var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x);
  23994. angle = -1 * angle;
  23995. if (angle < 0) {
  23996. angle += 2 * Math.PI;
  23997. }
  23998. var angleList = radarData.angleList.map(function (item) {
  23999. item = fixAngle(-1 * item);
  24000. return item;
  24001. });
  24002. angleList.forEach(function (item, index) {
  24003. var rangeStart = fixAngle(item - eachAngleArea / 2);
  24004. var rangeEnd = fixAngle(item + eachAngleArea / 2);
  24005. if (rangeEnd < rangeStart) {
  24006. rangeEnd += 2 * Math.PI;
  24007. }
  24008. if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <= rangeEnd) {
  24009. currentIndex = index;
  24010. }
  24011. });
  24012. }
  24013. return currentIndex;
  24014. }
  24015. function findFunnelChartCurrentIndex(currentPoints, funnelData) {
  24016. var currentIndex = -1;
  24017. for (var i = 0, len = funnelData.series.length; i < len; i++) {
  24018. var item = funnelData.series[i];
  24019. if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
  24020. currentIndex = i;
  24021. break;
  24022. }
  24023. }
  24024. return currentIndex;
  24025. }
  24026. function findWordChartCurrentIndex(currentPoints, wordData) {
  24027. var currentIndex = -1;
  24028. for (var i = 0, len = wordData.length; i < len; i++) {
  24029. var item = wordData[i];
  24030. if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
  24031. currentIndex = i;
  24032. break;
  24033. }
  24034. }
  24035. return currentIndex;
  24036. }
  24037. function findMapChartCurrentIndex(currentPoints, opts) {
  24038. var currentIndex = -1;
  24039. var cData = opts.chartData.mapData;
  24040. var data = opts.series;
  24041. var tmp = pointToCoordinate(currentPoints.y, currentPoints.x, cData.bounds, cData.scale, cData.xoffset, cData.yoffset);
  24042. var poi = [tmp.x, tmp.y];
  24043. for (var i = 0, len = data.length; i < len; i++) {
  24044. var item = data[i].geometry.coordinates;
  24045. if (isPoiWithinPoly(poi, item, opts.chartData.mapData.mercator)) {
  24046. currentIndex = i;
  24047. break;
  24048. }
  24049. }
  24050. return currentIndex;
  24051. }
  24052. function findRoseChartCurrentIndex(currentPoints, pieData, opts) {
  24053. var currentIndex = -1;
  24054. var series = getRoseDataPoints(opts._series_, opts.extra.rose.type, pieData.radius, pieData.radius);
  24055. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  24056. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  24057. angle = -angle;
  24058. if (opts.extra.rose && opts.extra.rose.offsetAngle) {
  24059. angle = angle - opts.extra.rose.offsetAngle * Math.PI / 180;
  24060. }
  24061. for (var i = 0, len = series.length; i < len; i++) {
  24062. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._rose_proportion_ * 2 * Math.PI)) {
  24063. currentIndex = i;
  24064. break;
  24065. }
  24066. }
  24067. }
  24068. return currentIndex;
  24069. }
  24070. function findPieChartCurrentIndex(currentPoints, pieData, opts) {
  24071. var currentIndex = -1;
  24072. var series = getPieDataPoints(pieData.series);
  24073. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  24074. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  24075. angle = -angle;
  24076. if (opts.extra.pie && opts.extra.pie.offsetAngle) {
  24077. angle = angle - opts.extra.pie.offsetAngle * Math.PI / 180;
  24078. }
  24079. if (opts.extra.ring && opts.extra.ring.offsetAngle) {
  24080. angle = angle - opts.extra.ring.offsetAngle * Math.PI / 180;
  24081. }
  24082. for (var i = 0, len = series.length; i < len; i++) {
  24083. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._proportion_ * 2 * Math.PI)) {
  24084. currentIndex = i;
  24085. break;
  24086. }
  24087. }
  24088. }
  24089. return currentIndex;
  24090. }
  24091. function isInExactPieChartArea(currentPoints, center, radius) {
  24092. return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2);
  24093. }
  24094. function splitPoints(points, eachSeries) {
  24095. var newPoints = [];
  24096. var items = [];
  24097. points.forEach(function (item, index) {
  24098. if (eachSeries.connectNulls) {
  24099. if (item !== null) {
  24100. items.push(item);
  24101. }
  24102. } else {
  24103. if (item !== null) {
  24104. items.push(item);
  24105. } else {
  24106. if (items.length) {
  24107. newPoints.push(items);
  24108. }
  24109. items = [];
  24110. }
  24111. }
  24112. });
  24113. if (items.length) {
  24114. newPoints.push(items);
  24115. }
  24116. return newPoints;
  24117. }
  24118. function calLegendData(series, opts, config, chartData, context) {
  24119. var legendData = {
  24120. area: {
  24121. start: {
  24122. x: 0,
  24123. y: 0
  24124. },
  24125. end: {
  24126. x: 0,
  24127. y: 0
  24128. },
  24129. width: 0,
  24130. height: 0,
  24131. wholeWidth: 0,
  24132. wholeHeight: 0
  24133. },
  24134. points: [],
  24135. widthArr: [],
  24136. heightArr: []
  24137. };
  24138. if (opts.legend.show === false) {
  24139. chartData.legendData = legendData;
  24140. return legendData;
  24141. }
  24142. var padding = opts.legend.padding * opts.pix;
  24143. var margin = opts.legend.margin * opts.pix;
  24144. var fontSize = opts.legend.fontSize ? opts.legend.fontSize * opts.pix : config.fontSize;
  24145. var shapeWidth = 15 * opts.pix;
  24146. var shapeRight = 5 * opts.pix;
  24147. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  24148. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  24149. var legendList = [];
  24150. var widthCount = 0;
  24151. var widthCountArr = [];
  24152. var currentRow = [];
  24153. for (var i = 0; i < series.length; i++) {
  24154. var item = series[i];
  24155. var legendText = item.legendText ? item.legendText : item.name;
  24156. var itemWidth = shapeWidth + shapeRight + measureText(legendText || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  24157. if (widthCount + itemWidth > opts.width - opts.area[1] - opts.area[3]) {
  24158. legendList.push(currentRow);
  24159. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  24160. widthCount = itemWidth;
  24161. currentRow = [item];
  24162. } else {
  24163. widthCount += itemWidth;
  24164. currentRow.push(item);
  24165. }
  24166. }
  24167. if (currentRow.length) {
  24168. legendList.push(currentRow);
  24169. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  24170. legendData.widthArr = widthCountArr;
  24171. var legendWidth = Math.max.apply(null, widthCountArr);
  24172. switch (opts.legend.float) {
  24173. case 'left':
  24174. legendData.area.start.x = opts.area[3];
  24175. legendData.area.end.x = opts.area[3] + legendWidth + 2 * padding;
  24176. break;
  24177. case 'right':
  24178. legendData.area.start.x = opts.width - opts.area[1] - legendWidth - 2 * padding;
  24179. legendData.area.end.x = opts.width - opts.area[1];
  24180. break;
  24181. default:
  24182. legendData.area.start.x = (opts.width - legendWidth) / 2 - padding;
  24183. legendData.area.end.x = (opts.width + legendWidth) / 2 + padding;
  24184. }
  24185. legendData.area.width = legendWidth + 2 * padding;
  24186. legendData.area.wholeWidth = legendWidth + 2 * padding;
  24187. legendData.area.height = legendList.length * lineHeight + 2 * padding;
  24188. legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin;
  24189. legendData.points = legendList;
  24190. }
  24191. } else {
  24192. var len = series.length;
  24193. var maxHeight = opts.height - opts.area[0] - opts.area[2] - 2 * margin - 2 * padding;
  24194. var maxLength = Math.min(Math.floor(maxHeight / lineHeight), len);
  24195. legendData.area.height = maxLength * lineHeight + padding * 2;
  24196. legendData.area.wholeHeight = maxLength * lineHeight + padding * 2;
  24197. switch (opts.legend.float) {
  24198. case 'top':
  24199. legendData.area.start.y = opts.area[0] + margin;
  24200. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  24201. break;
  24202. case 'bottom':
  24203. legendData.area.start.y = opts.height - opts.area[2] - margin - legendData.area.height;
  24204. legendData.area.end.y = opts.height - opts.area[2] - margin;
  24205. break;
  24206. default:
  24207. legendData.area.start.y = (opts.height - legendData.area.height) / 2;
  24208. legendData.area.end.y = (opts.height + legendData.area.height) / 2;
  24209. }
  24210. var lineNum = len % maxLength === 0 ? len / maxLength : Math.floor(len / maxLength + 1);
  24211. var _currentRow = [];
  24212. for (var _i6 = 0; _i6 < lineNum; _i6++) {
  24213. var temp = series.slice(_i6 * maxLength, _i6 * maxLength + maxLength);
  24214. _currentRow.push(temp);
  24215. }
  24216. legendData.points = _currentRow;
  24217. if (_currentRow.length) {
  24218. for (var _i7 = 0; _i7 < _currentRow.length; _i7++) {
  24219. var _item = _currentRow[_i7];
  24220. var maxWidth = 0;
  24221. for (var j = 0; j < _item.length; j++) {
  24222. var _itemWidth = shapeWidth + shapeRight + measureText(_item[j].name || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  24223. if (_itemWidth > maxWidth) {
  24224. maxWidth = _itemWidth;
  24225. }
  24226. }
  24227. legendData.widthArr.push(maxWidth);
  24228. legendData.heightArr.push(_item.length * lineHeight + padding * 2);
  24229. }
  24230. var _legendWidth = 0;
  24231. for (var _i8 = 0; _i8 < legendData.widthArr.length; _i8++) {
  24232. _legendWidth += legendData.widthArr[_i8];
  24233. }
  24234. legendData.area.width = _legendWidth - opts.legend.itemGap * opts.pix + 2 * padding;
  24235. legendData.area.wholeWidth = legendData.area.width + padding;
  24236. }
  24237. }
  24238. switch (opts.legend.position) {
  24239. case 'top':
  24240. legendData.area.start.y = opts.area[0] + margin;
  24241. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  24242. break;
  24243. case 'bottom':
  24244. legendData.area.start.y = opts.height - opts.area[2] - legendData.area.height - margin;
  24245. legendData.area.end.y = opts.height - opts.area[2] - margin;
  24246. break;
  24247. case 'left':
  24248. legendData.area.start.x = opts.area[3];
  24249. legendData.area.end.x = opts.area[3] + legendData.area.width;
  24250. break;
  24251. case 'right':
  24252. legendData.area.start.x = opts.width - opts.area[1] - legendData.area.width;
  24253. legendData.area.end.x = opts.width - opts.area[1];
  24254. break;
  24255. }
  24256. chartData.legendData = legendData;
  24257. return legendData;
  24258. }
  24259. function calCategoriesData(categories, opts, config, eachSpacing, context) {
  24260. var result = {
  24261. angle: 0,
  24262. xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
  24263. };
  24264. var fontSize = opts.xAxis.fontSize * opts.pix;
  24265. var categoriesTextLenth = categories.map(function (item, index) {
  24266. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  24267. return measureText(String(xitem), fontSize, context);
  24268. });
  24269. var maxTextLength = Math.max.apply(this, categoriesTextLenth);
  24270. if (opts.xAxis.rotateLabel == true) {
  24271. result.angle = opts.xAxis.rotateAngle * Math.PI / 180;
  24272. var tempHeight = opts.xAxis.marginTop * opts.pix * 2 + Math.abs(maxTextLength * Math.sin(result.angle));
  24273. tempHeight = tempHeight < fontSize + opts.xAxis.marginTop * opts.pix * 2 ? tempHeight + opts.xAxis.marginTop * opts.pix * 2 : tempHeight;
  24274. result.xAxisHeight = tempHeight;
  24275. }
  24276. if (opts.enableScroll && opts.xAxis.scrollShow) {
  24277. result.xAxisHeight += 6 * opts.pix;
  24278. }
  24279. if (opts.xAxis.disabled) {
  24280. result.xAxisHeight = 0;
  24281. }
  24282. return result;
  24283. }
  24284. function getXAxisTextList(series, opts, config, stack) {
  24285. var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
  24286. var data;
  24287. if (stack == 'stack') {
  24288. data = dataCombineStack(series, opts.categories.length);
  24289. } else {
  24290. data = dataCombine(series);
  24291. }
  24292. var sorted = [];
  24293. // remove null from data
  24294. data = data.filter(function (item) {
  24295. //return item !== null;
  24296. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24297. if (item.constructor.toString().indexOf('Array') > -1) {
  24298. return item !== null;
  24299. } else {
  24300. return item.value !== null;
  24301. }
  24302. } else {
  24303. return item !== null;
  24304. }
  24305. });
  24306. data.map(function (item) {
  24307. if ((0, _typeof2.default)(item) === 'object') {
  24308. if (item.constructor.toString().indexOf('Array') > -1) {
  24309. if (opts.type == 'candle') {
  24310. item.map(function (subitem) {
  24311. sorted.push(subitem);
  24312. });
  24313. } else {
  24314. sorted.push(item[0]);
  24315. }
  24316. } else {
  24317. sorted.push(item.value);
  24318. }
  24319. } else {
  24320. sorted.push(item);
  24321. }
  24322. });
  24323. var minData = 0;
  24324. var maxData = 0;
  24325. if (sorted.length > 0) {
  24326. minData = Math.min.apply(this, sorted);
  24327. maxData = Math.max.apply(this, sorted);
  24328. }
  24329. //为了兼容v1.9.0之前的项目
  24330. if (index > -1) {
  24331. if (typeof opts.xAxis.data[index].min === 'number') {
  24332. minData = Math.min(opts.xAxis.data[index].min, minData);
  24333. }
  24334. if (typeof opts.xAxis.data[index].max === 'number') {
  24335. maxData = Math.max(opts.xAxis.data[index].max, maxData);
  24336. }
  24337. } else {
  24338. if (typeof opts.xAxis.min === 'number') {
  24339. minData = Math.min(opts.xAxis.min, minData);
  24340. }
  24341. if (typeof opts.xAxis.max === 'number') {
  24342. maxData = Math.max(opts.xAxis.max, maxData);
  24343. }
  24344. }
  24345. if (minData === maxData) {
  24346. var rangeSpan = maxData || 10;
  24347. maxData += rangeSpan;
  24348. }
  24349. //var dataRange = getDataRange(minData, maxData);
  24350. var minRange = minData;
  24351. var maxRange = maxData;
  24352. var range = [];
  24353. var eachRange = (maxRange - minRange) / opts.xAxis.splitNumber;
  24354. for (var i = 0; i <= opts.xAxis.splitNumber; i++) {
  24355. range.push(minRange + eachRange * i);
  24356. }
  24357. return range;
  24358. }
  24359. function calXAxisData(series, opts, config, context) {
  24360. //堆叠图重算Y轴
  24361. var columnstyle = assign({}, {
  24362. type: ""
  24363. }, opts.extra.bar);
  24364. var result = {
  24365. angle: 0,
  24366. xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
  24367. };
  24368. result.ranges = getXAxisTextList(series, opts, config, columnstyle.type);
  24369. result.rangesFormat = result.ranges.map(function (item) {
  24370. //item = opts.xAxis.formatter ? opts.xAxis.formatter(item) : util.toFixed(item, 2);
  24371. item = util.toFixed(item, 2);
  24372. return item;
  24373. });
  24374. var xAxisScaleValues = result.ranges.map(function (item) {
  24375. // 如果刻度值是浮点数,则保留两位小数
  24376. item = util.toFixed(item, 2);
  24377. // 若有自定义格式则调用自定义的格式化函数
  24378. //item = opts.xAxis.formatter ? opts.xAxis.formatter(Number(item)) : item;
  24379. return item;
  24380. });
  24381. result = Object.assign(result, getXAxisPoints(xAxisScaleValues, opts, config));
  24382. // 计算X轴刻度的属性譬如每个刻度的间隔,刻度的起始点\结束点以及总长
  24383. var eachSpacing = result.eachSpacing;
  24384. var textLength = xAxisScaleValues.map(function (item) {
  24385. return measureText(item, opts.xAxis.fontSize * opts.pix, context);
  24386. });
  24387. if (opts.xAxis.disabled === true) {
  24388. result.xAxisHeight = 0;
  24389. }
  24390. return result;
  24391. }
  24392. function getRadarDataPoints(angleList, center, radius, series, opts) {
  24393. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  24394. var radarOption = opts.extra.radar || {};
  24395. radarOption.max = radarOption.max || 0;
  24396. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  24397. var data = [];
  24398. var _loop2 = function _loop2(i) {
  24399. var each = series[i];
  24400. var listItem = {};
  24401. listItem.color = each.color;
  24402. listItem.legendShape = each.legendShape;
  24403. listItem.pointShape = each.pointShape;
  24404. listItem.data = [];
  24405. each.data.forEach(function (item, index) {
  24406. var tmp = {};
  24407. tmp.angle = angleList[index];
  24408. tmp.proportion = item / maxData;
  24409. tmp.value = item;
  24410. tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion * process * Math.sin(tmp.angle), center);
  24411. listItem.data.push(tmp);
  24412. });
  24413. data.push(listItem);
  24414. };
  24415. for (var i = 0; i < series.length; i++) {
  24416. _loop2(i);
  24417. }
  24418. return data;
  24419. }
  24420. function getPieDataPoints(series, radius) {
  24421. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  24422. var count = 0;
  24423. var _start_ = 0;
  24424. for (var i = 0; i < series.length; i++) {
  24425. var item = series[i];
  24426. item.data = item.data === null ? 0 : item.data;
  24427. count += item.data;
  24428. }
  24429. for (var _i9 = 0; _i9 < series.length; _i9++) {
  24430. var _item2 = series[_i9];
  24431. _item2.data = _item2.data === null ? 0 : _item2.data;
  24432. if (count === 0) {
  24433. _item2._proportion_ = 1 / series.length * process;
  24434. } else {
  24435. _item2._proportion_ = _item2.data / count * process;
  24436. }
  24437. _item2._radius_ = radius;
  24438. }
  24439. for (var _i10 = 0; _i10 < series.length; _i10++) {
  24440. var _item3 = series[_i10];
  24441. _item3._start_ = _start_;
  24442. _start_ += 2 * _item3._proportion_ * Math.PI;
  24443. }
  24444. return series;
  24445. }
  24446. function getFunnelDataPoints(series, radius, option, eachSpacing) {
  24447. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  24448. for (var i = 0; i < series.length; i++) {
  24449. if (option.type == 'funnel') {
  24450. series[i].radius = series[i].data / series[0].data * radius * process;
  24451. } else {
  24452. series[i].radius = eachSpacing * (series.length - i) / (eachSpacing * series.length) * radius * process;
  24453. }
  24454. series[i]._proportion_ = series[i].data / series[0].data;
  24455. }
  24456. // if(option.type !== 'pyramid'){
  24457. // series.reverse();
  24458. // }
  24459. return series;
  24460. }
  24461. function getRoseDataPoints(series, type, minRadius, radius) {
  24462. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  24463. var count = 0;
  24464. var _start_ = 0;
  24465. var dataArr = [];
  24466. for (var i = 0; i < series.length; i++) {
  24467. var item = series[i];
  24468. item.data = item.data === null ? 0 : item.data;
  24469. count += item.data;
  24470. dataArr.push(item.data);
  24471. }
  24472. var minData = Math.min.apply(null, dataArr);
  24473. var maxData = Math.max.apply(null, dataArr);
  24474. var radiusLength = radius - minRadius;
  24475. for (var _i11 = 0; _i11 < series.length; _i11++) {
  24476. var _item4 = series[_i11];
  24477. _item4.data = _item4.data === null ? 0 : _item4.data;
  24478. if (count === 0) {
  24479. _item4._proportion_ = 1 / series.length * process;
  24480. _item4._rose_proportion_ = 1 / series.length * process;
  24481. } else {
  24482. _item4._proportion_ = _item4.data / count * process;
  24483. if (type == 'area') {
  24484. _item4._rose_proportion_ = 1 / series.length * process;
  24485. } else {
  24486. _item4._rose_proportion_ = _item4.data / count * process;
  24487. }
  24488. }
  24489. _item4._radius_ = minRadius + radiusLength * ((_item4.data - minData) / (maxData - minData)) || radius;
  24490. }
  24491. for (var _i12 = 0; _i12 < series.length; _i12++) {
  24492. var _item5 = series[_i12];
  24493. _item5._start_ = _start_;
  24494. _start_ += 2 * _item5._rose_proportion_ * Math.PI;
  24495. }
  24496. return series;
  24497. }
  24498. function getArcbarDataPoints(series, arcbarOption) {
  24499. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  24500. if (process == 1) {
  24501. process = 0.999999;
  24502. }
  24503. for (var i = 0; i < series.length; i++) {
  24504. var item = series[i];
  24505. item.data = item.data === null ? 0 : item.data;
  24506. var totalAngle = void 0;
  24507. if (arcbarOption.type == 'circle') {
  24508. totalAngle = 2;
  24509. } else {
  24510. if (arcbarOption.direction == 'ccw') {
  24511. if (arcbarOption.startAngle < arcbarOption.endAngle) {
  24512. totalAngle = 2 + arcbarOption.startAngle - arcbarOption.endAngle;
  24513. } else {
  24514. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  24515. }
  24516. } else {
  24517. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  24518. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  24519. } else {
  24520. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  24521. }
  24522. }
  24523. }
  24524. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  24525. if (arcbarOption.direction == 'ccw') {
  24526. item._proportion_ = arcbarOption.startAngle - totalAngle * item.data * process;
  24527. }
  24528. if (item._proportion_ >= 2) {
  24529. item._proportion_ = item._proportion_ % 2;
  24530. }
  24531. }
  24532. return series;
  24533. }
  24534. function getGaugeArcbarDataPoints(series, arcbarOption) {
  24535. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  24536. if (process == 1) {
  24537. process = 0.999999;
  24538. }
  24539. for (var i = 0; i < series.length; i++) {
  24540. var item = series[i];
  24541. item.data = item.data === null ? 0 : item.data;
  24542. var totalAngle = void 0;
  24543. if (arcbarOption.type == 'circle') {
  24544. totalAngle = 2;
  24545. } else {
  24546. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  24547. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  24548. } else {
  24549. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  24550. }
  24551. }
  24552. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  24553. if (item._proportion_ >= 2) {
  24554. item._proportion_ = item._proportion_ % 2;
  24555. }
  24556. }
  24557. return series;
  24558. }
  24559. function getGaugeAxisPoints(categories, startAngle, endAngle) {
  24560. var totalAngle;
  24561. if (endAngle < startAngle) {
  24562. totalAngle = 2 + endAngle - startAngle;
  24563. } else {
  24564. totalAngle = startAngle - endAngle;
  24565. }
  24566. var tempStartAngle = startAngle;
  24567. for (var i = 0; i < categories.length; i++) {
  24568. categories[i].value = categories[i].value === null ? 0 : categories[i].value;
  24569. categories[i]._startAngle_ = tempStartAngle;
  24570. categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle;
  24571. if (categories[i]._endAngle_ >= 2) {
  24572. categories[i]._endAngle_ = categories[i]._endAngle_ % 2;
  24573. }
  24574. tempStartAngle = categories[i]._endAngle_;
  24575. }
  24576. return categories;
  24577. }
  24578. function getGaugeDataPoints(series, categories, gaugeOption) {
  24579. var process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
  24580. for (var i = 0; i < series.length; i++) {
  24581. var item = series[i];
  24582. item.data = item.data === null ? 0 : item.data;
  24583. if (gaugeOption.pointer.color == 'auto') {
  24584. for (var _i13 = 0; _i13 < categories.length; _i13++) {
  24585. if (item.data <= categories[_i13].value) {
  24586. item.color = categories[_i13].color;
  24587. break;
  24588. }
  24589. }
  24590. } else {
  24591. item.color = gaugeOption.pointer.color;
  24592. }
  24593. var totalAngle = void 0;
  24594. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  24595. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  24596. } else {
  24597. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  24598. }
  24599. item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle;
  24600. item._oldAngle_ = gaugeOption.oldAngle;
  24601. if (gaugeOption.oldAngle < gaugeOption.endAngle) {
  24602. item._oldAngle_ += 2;
  24603. }
  24604. if (item.data >= gaugeOption.oldData) {
  24605. item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle;
  24606. } else {
  24607. item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process;
  24608. }
  24609. if (item._proportion_ >= 2) {
  24610. item._proportion_ = item._proportion_ % 2;
  24611. }
  24612. }
  24613. return series;
  24614. }
  24615. function getPieTextMaxLength(series, config, context, opts) {
  24616. series = getPieDataPoints(series);
  24617. var maxLength = 0;
  24618. for (var i = 0; i < series.length; i++) {
  24619. var item = series[i];
  24620. var text = item.formatter ? item.formatter(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
  24621. maxLength = Math.max(maxLength, measureText(text, item.textSize * opts.pix || config.fontSize, context));
  24622. }
  24623. return maxLength;
  24624. }
  24625. function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
  24626. return points.map(function (item) {
  24627. if (item === null) {
  24628. return null;
  24629. }
  24630. var seriesGap = 0;
  24631. var categoryGap = 0;
  24632. if (opts.type == 'mix') {
  24633. seriesGap = opts.extra.mix.column.seriesGap * opts.pix || 0;
  24634. categoryGap = opts.extra.mix.column.categoryGap * opts.pix || 0;
  24635. } else {
  24636. seriesGap = opts.extra.column.seriesGap * opts.pix || 0;
  24637. categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  24638. }
  24639. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  24640. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  24641. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  24642. if (opts.extra.mix && opts.extra.mix.column.width && +opts.extra.mix.column.width > 0) {
  24643. item.width = Math.min(item.width, +opts.extra.mix.column.width * opts.pix);
  24644. }
  24645. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  24646. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  24647. }
  24648. if (item.width <= 0) {
  24649. item.width = 1;
  24650. }
  24651. item.x += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  24652. return item;
  24653. });
  24654. }
  24655. function fixBarData(points, eachSpacing, columnLen, index, config, opts) {
  24656. return points.map(function (item) {
  24657. if (item === null) {
  24658. return null;
  24659. }
  24660. var seriesGap = 0;
  24661. var categoryGap = 0;
  24662. seriesGap = opts.extra.bar.seriesGap * opts.pix || 0;
  24663. categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  24664. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  24665. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  24666. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  24667. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  24668. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  24669. }
  24670. if (item.width <= 0) {
  24671. item.width = 1;
  24672. }
  24673. item.y += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  24674. return item;
  24675. });
  24676. }
  24677. function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
  24678. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  24679. return points.map(function (item) {
  24680. if (item === null) {
  24681. return null;
  24682. }
  24683. item.width = eachSpacing - 2 * categoryGap;
  24684. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  24685. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  24686. }
  24687. if (index > 0) {
  24688. item.width -= border;
  24689. }
  24690. return item;
  24691. });
  24692. }
  24693. function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  24694. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  24695. return points.map(function (item, indexn) {
  24696. if (item === null) {
  24697. return null;
  24698. }
  24699. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  24700. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  24701. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  24702. }
  24703. if (item.width <= 0) {
  24704. item.width = 1;
  24705. }
  24706. return item;
  24707. });
  24708. }
  24709. function fixBarStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  24710. var categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  24711. return points.map(function (item, indexn) {
  24712. if (item === null) {
  24713. return null;
  24714. }
  24715. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  24716. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  24717. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  24718. }
  24719. if (item.width <= 0) {
  24720. item.width = 1;
  24721. }
  24722. return item;
  24723. });
  24724. }
  24725. function getXAxisPoints(categories, opts, config) {
  24726. var spacingValid = opts.width - opts.area[1] - opts.area[3];
  24727. var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
  24728. if ((opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble' || opts.type == 'bar') && dataCount > 1 && opts.xAxis.boundaryGap == 'justify') {
  24729. dataCount -= 1;
  24730. }
  24731. var widthRatio = 0;
  24732. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  24733. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  24734. widthRatio = opts.extra.mount.widthRatio - 1;
  24735. dataCount += widthRatio;
  24736. }
  24737. var eachSpacing = spacingValid / dataCount;
  24738. var xAxisPoints = [];
  24739. var startX = opts.area[3];
  24740. var endX = opts.width - opts.area[1];
  24741. categories.forEach(function (item, index) {
  24742. xAxisPoints.push(startX + widthRatio / 2 * eachSpacing + index * eachSpacing);
  24743. });
  24744. if (opts.xAxis.boundaryGap !== 'justify') {
  24745. if (opts.enableScroll === true) {
  24746. xAxisPoints.push(startX + widthRatio * eachSpacing + categories.length * eachSpacing);
  24747. } else {
  24748. xAxisPoints.push(endX);
  24749. }
  24750. }
  24751. return {
  24752. xAxisPoints: xAxisPoints,
  24753. startX: startX,
  24754. endX: endX,
  24755. eachSpacing: eachSpacing
  24756. };
  24757. }
  24758. function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  24759. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  24760. var points = [];
  24761. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24762. data.forEach(function (item, index) {
  24763. if (item === null) {
  24764. points.push(null);
  24765. } else {
  24766. var cPoints = [];
  24767. item.forEach(function (items, indexs) {
  24768. var point = {};
  24769. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  24770. var value = items.value || items;
  24771. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24772. height *= process;
  24773. point.y = opts.height - Math.round(height) - opts.area[2];
  24774. cPoints.push(point);
  24775. });
  24776. points.push(cPoints);
  24777. }
  24778. });
  24779. return points;
  24780. }
  24781. function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  24782. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  24783. var boundaryGap = 'center';
  24784. if (opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  24785. boundaryGap = opts.xAxis.boundaryGap;
  24786. }
  24787. var points = [];
  24788. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24789. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24790. data.forEach(function (item, index) {
  24791. if (item === null) {
  24792. points.push(null);
  24793. } else {
  24794. var point = {};
  24795. point.color = item.color;
  24796. point.x = xAxisPoints[index];
  24797. var value = item;
  24798. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24799. if (item.constructor.toString().indexOf('Array') > -1) {
  24800. var xranges, xminRange, xmaxRange;
  24801. xranges = [].concat(opts.chartData.xAxisData.ranges);
  24802. xminRange = xranges.shift();
  24803. xmaxRange = xranges.pop();
  24804. value = item[1];
  24805. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  24806. if (opts.type == 'bubble') {
  24807. point.r = item[2];
  24808. point.t = item[3];
  24809. }
  24810. } else {
  24811. value = item.value;
  24812. }
  24813. }
  24814. if (boundaryGap == 'center') {
  24815. point.x += eachSpacing / 2;
  24816. }
  24817. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24818. height *= process;
  24819. point.y = opts.height - height - opts.area[2];
  24820. points.push(point);
  24821. }
  24822. });
  24823. return points;
  24824. }
  24825. function getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process) {
  24826. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  24827. var boundaryGap = opts.xAxis.boundaryGap;
  24828. var points = [];
  24829. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24830. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24831. data.forEach(function (item, index) {
  24832. if (item === null) {
  24833. points.push(null);
  24834. } else {
  24835. var point = {};
  24836. point.color = item.color;
  24837. if (lineOption.animation == 'vertical') {
  24838. point.x = xAxisPoints[index];
  24839. var value = item;
  24840. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24841. if (item.constructor.toString().indexOf('Array') > -1) {
  24842. var xranges, xminRange, xmaxRange;
  24843. xranges = [].concat(opts.chartData.xAxisData.ranges);
  24844. xminRange = xranges.shift();
  24845. xmaxRange = xranges.pop();
  24846. value = item[1];
  24847. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  24848. } else {
  24849. value = item.value;
  24850. }
  24851. }
  24852. if (boundaryGap == 'center') {
  24853. point.x += eachSpacing / 2;
  24854. }
  24855. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24856. height *= process;
  24857. point.y = opts.height - height - opts.area[2];
  24858. points.push(point);
  24859. } else {
  24860. point.x = xAxisPoints[0] + eachSpacing * index * process;
  24861. var value = item;
  24862. if (boundaryGap == 'center') {
  24863. point.x += eachSpacing / 2;
  24864. }
  24865. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24866. point.y = opts.height - height - opts.area[2];
  24867. points.push(point);
  24868. }
  24869. }
  24870. });
  24871. return points;
  24872. }
  24873. function getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process) {
  24874. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  24875. var points = [];
  24876. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24877. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24878. data.forEach(function (item, index) {
  24879. if (item === null) {
  24880. points.push(null);
  24881. } else {
  24882. var point = {};
  24883. point.color = item.color;
  24884. point.x = xAxisPoints[index];
  24885. var value = item;
  24886. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24887. if (item.constructor.toString().indexOf('Array') > -1) {
  24888. var xranges, xminRange, xmaxRange;
  24889. xranges = [].concat(opts.chartData.xAxisData.ranges);
  24890. xminRange = xranges.shift();
  24891. xmaxRange = xranges.pop();
  24892. value = item[1];
  24893. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  24894. } else {
  24895. value = item.value;
  24896. }
  24897. }
  24898. point.x += eachSpacing / 2;
  24899. var height = validHeight * (value * process - minRange) / (maxRange - minRange);
  24900. point.y = opts.height - height - opts.area[2];
  24901. points.push(point);
  24902. }
  24903. });
  24904. return points;
  24905. }
  24906. function getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints) {
  24907. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  24908. var points = [];
  24909. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24910. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24911. var mountWidth = eachSpacing * mountOption.widthRatio;
  24912. series.forEach(function (item, index) {
  24913. if (item === null) {
  24914. points.push(null);
  24915. } else {
  24916. var point = {};
  24917. point.color = item.color;
  24918. point.x = xAxisPoints[index];
  24919. point.x += eachSpacing / 2;
  24920. var value = item.data;
  24921. var height = validHeight * (value * process - minRange) / (maxRange - minRange);
  24922. point.y = opts.height - height - opts.area[2];
  24923. point.value = value;
  24924. point.width = mountWidth;
  24925. points.push(point);
  24926. }
  24927. });
  24928. return points;
  24929. }
  24930. function getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config) {
  24931. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  24932. var points = [];
  24933. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24934. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24935. data.forEach(function (item, index) {
  24936. if (item === null) {
  24937. points.push(null);
  24938. } else {
  24939. var point = {};
  24940. point.color = item.color;
  24941. point.y = yAxisPoints[index];
  24942. var value = item;
  24943. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24944. value = item.value;
  24945. }
  24946. var height = validWidth * (value - minRange) / (maxRange - minRange);
  24947. height *= process;
  24948. point.height = height;
  24949. point.value = value;
  24950. point.x = height + opts.area[3];
  24951. points.push(point);
  24952. }
  24953. });
  24954. return points;
  24955. }
  24956. function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  24957. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  24958. var points = [];
  24959. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24960. data.forEach(function (item, index) {
  24961. if (item === null) {
  24962. points.push(null);
  24963. } else {
  24964. var point = {};
  24965. point.color = item.color;
  24966. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  24967. if (seriesIndex > 0) {
  24968. var value = 0;
  24969. for (var i = 0; i <= seriesIndex; i++) {
  24970. value += stackSeries[i].data[index];
  24971. }
  24972. var value0 = value - item;
  24973. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24974. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  24975. } else {
  24976. var value = item;
  24977. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24978. value = item.value;
  24979. }
  24980. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24981. var height0 = 0;
  24982. }
  24983. var heightc = height0;
  24984. height *= process;
  24985. heightc *= process;
  24986. point.y = opts.height - Math.round(height) - opts.area[2];
  24987. point.y0 = opts.height - Math.round(heightc) - opts.area[2];
  24988. points.push(point);
  24989. }
  24990. });
  24991. return points;
  24992. }
  24993. function getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  24994. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  24995. var points = [];
  24996. var validHeight = opts.width - opts.area[1] - opts.area[3];
  24997. data.forEach(function (item, index) {
  24998. if (item === null) {
  24999. points.push(null);
  25000. } else {
  25001. var point = {};
  25002. point.color = item.color;
  25003. point.y = yAxisPoints[index];
  25004. if (seriesIndex > 0) {
  25005. var value = 0;
  25006. for (var i = 0; i <= seriesIndex; i++) {
  25007. value += stackSeries[i].data[index];
  25008. }
  25009. var value0 = value - item;
  25010. var height = validHeight * (value - minRange) / (maxRange - minRange);
  25011. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  25012. } else {
  25013. var value = item;
  25014. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  25015. value = item.value;
  25016. }
  25017. var height = validHeight * (value - minRange) / (maxRange - minRange);
  25018. var height0 = 0;
  25019. }
  25020. var heightc = height0;
  25021. height *= process;
  25022. heightc *= process;
  25023. point.height = height - heightc;
  25024. point.x = opts.area[3] + height;
  25025. point.x0 = opts.area[3] + heightc;
  25026. points.push(point);
  25027. }
  25028. });
  25029. return points;
  25030. }
  25031. function getYAxisTextList(series, opts, config, stack, yData) {
  25032. var index = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : -1;
  25033. var data;
  25034. if (stack == 'stack') {
  25035. data = dataCombineStack(series, opts.categories.length);
  25036. } else {
  25037. data = dataCombine(series);
  25038. }
  25039. var sorted = [];
  25040. // remove null from data
  25041. data = data.filter(function (item) {
  25042. //return item !== null;
  25043. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  25044. if (item.constructor.toString().indexOf('Array') > -1) {
  25045. return item !== null;
  25046. } else {
  25047. return item.value !== null;
  25048. }
  25049. } else {
  25050. return item !== null;
  25051. }
  25052. });
  25053. data.map(function (item) {
  25054. if ((0, _typeof2.default)(item) === 'object') {
  25055. if (item.constructor.toString().indexOf('Array') > -1) {
  25056. if (opts.type == 'candle') {
  25057. item.map(function (subitem) {
  25058. sorted.push(subitem);
  25059. });
  25060. } else {
  25061. sorted.push(item[1]);
  25062. }
  25063. } else {
  25064. sorted.push(item.value);
  25065. }
  25066. } else {
  25067. sorted.push(item);
  25068. }
  25069. });
  25070. var minData = yData.min || 0;
  25071. var maxData = yData.max || 0;
  25072. if (sorted.length > 0) {
  25073. minData = Math.min.apply(this, sorted);
  25074. maxData = Math.max.apply(this, sorted);
  25075. }
  25076. if (minData === maxData) {
  25077. if (maxData == 0) {
  25078. maxData = 10;
  25079. } else {
  25080. minData = 0;
  25081. }
  25082. }
  25083. var dataRange = getDataRange(minData, maxData);
  25084. var minRange = yData.min === undefined || yData.min === null ? dataRange.minRange : yData.min;
  25085. var maxRange = yData.max === undefined || yData.max === null ? dataRange.maxRange : yData.max;
  25086. var eachRange = (maxRange - minRange) / opts.yAxis.splitNumber;
  25087. var range = [];
  25088. for (var i = 0; i <= opts.yAxis.splitNumber; i++) {
  25089. range.push(minRange + eachRange * i);
  25090. }
  25091. return range.reverse();
  25092. }
  25093. function calYAxisData(series, opts, config, context) {
  25094. //堆叠图重算Y轴
  25095. var columnstyle = assign({}, {
  25096. type: ""
  25097. }, opts.extra.column);
  25098. //如果是多Y轴,重新计算
  25099. var YLength = opts.yAxis.data.length;
  25100. var newSeries = new Array(YLength);
  25101. if (YLength > 0) {
  25102. for (var i = 0; i < YLength; i++) {
  25103. newSeries[i] = [];
  25104. for (var j = 0; j < series.length; j++) {
  25105. if (series[j].index == i) {
  25106. newSeries[i].push(series[j]);
  25107. }
  25108. }
  25109. }
  25110. var rangesArr = new Array(YLength);
  25111. var rangesFormatArr = new Array(YLength);
  25112. var yAxisWidthArr = new Array(YLength);
  25113. var _loop3 = function _loop3(_i14) {
  25114. var yData = opts.yAxis.data[_i14];
  25115. //如果总开关不显示,强制每个Y轴为不显示
  25116. if (opts.yAxis.disabled == true) {
  25117. yData.disabled = true;
  25118. }
  25119. if (yData.type === 'categories') {
  25120. if (!yData.formatter) {
  25121. yData.formatter = function (val, index, opts) {
  25122. return val + (yData.unit || '');
  25123. };
  25124. }
  25125. yData.categories = yData.categories || opts.categories;
  25126. rangesArr[_i14] = yData.categories;
  25127. } else {
  25128. if (!yData.formatter) {
  25129. yData.formatter = function (val, index, opts) {
  25130. return util.toFixed(val, yData.tofix || 0) + (yData.unit || '');
  25131. };
  25132. }
  25133. rangesArr[_i14] = getYAxisTextList(newSeries[_i14], opts, config, columnstyle.type, yData, _i14);
  25134. }
  25135. var yAxisFontSizes = yData.fontSize * opts.pix || config.fontSize;
  25136. yAxisWidthArr[_i14] = {
  25137. position: yData.position ? yData.position : 'left',
  25138. width: 0
  25139. };
  25140. rangesFormatArr[_i14] = rangesArr[_i14].map(function (items, index) {
  25141. items = yData.formatter(items, index, opts);
  25142. yAxisWidthArr[_i14].width = Math.max(yAxisWidthArr[_i14].width, measureText(items, yAxisFontSizes, context) + 5);
  25143. return items;
  25144. });
  25145. var calibration = yData.calibration ? 4 * opts.pix : 0;
  25146. yAxisWidthArr[_i14].width += calibration + 3 * opts.pix;
  25147. if (yData.disabled === true) {
  25148. yAxisWidthArr[_i14].width = 0;
  25149. }
  25150. };
  25151. for (var _i14 = 0; _i14 < YLength; _i14++) {
  25152. _loop3(_i14);
  25153. }
  25154. } else {
  25155. var rangesArr = new Array(1);
  25156. var rangesFormatArr = new Array(1);
  25157. var yAxisWidthArr = new Array(1);
  25158. if (opts.type === 'bar') {
  25159. rangesArr[0] = opts.categories;
  25160. if (!opts.yAxis.formatter) {
  25161. opts.yAxis.formatter = function (val, index, opts) {
  25162. return val + (opts.yAxis.unit || '');
  25163. };
  25164. }
  25165. } else {
  25166. if (!opts.yAxis.formatter) {
  25167. opts.yAxis.formatter = function (val, index, opts) {
  25168. return val.toFixed(opts.yAxis.tofix) + (opts.yAxis.unit || '');
  25169. };
  25170. }
  25171. rangesArr[0] = getYAxisTextList(series, opts, config, columnstyle.type, {});
  25172. }
  25173. yAxisWidthArr[0] = {
  25174. position: 'left',
  25175. width: 0
  25176. };
  25177. var yAxisFontSize = opts.yAxis.fontSize * opts.pix || config.fontSize;
  25178. rangesFormatArr[0] = rangesArr[0].map(function (item, index) {
  25179. item = opts.yAxis.formatter(item, index, opts);
  25180. yAxisWidthArr[0].width = Math.max(yAxisWidthArr[0].width, measureText(item, yAxisFontSize, context) + 5);
  25181. return item;
  25182. });
  25183. yAxisWidthArr[0].width += 3 * opts.pix;
  25184. if (opts.yAxis.disabled === true) {
  25185. yAxisWidthArr[0] = {
  25186. position: 'left',
  25187. width: 0
  25188. };
  25189. opts.yAxis.data[0] = {
  25190. disabled: true
  25191. };
  25192. } else {
  25193. opts.yAxis.data[0] = {
  25194. disabled: false,
  25195. position: 'left',
  25196. max: opts.yAxis.max,
  25197. min: opts.yAxis.min,
  25198. formatter: opts.yAxis.formatter
  25199. };
  25200. if (opts.type === 'bar') {
  25201. opts.yAxis.data[0].categories = opts.categories;
  25202. opts.yAxis.data[0].type = 'categories';
  25203. }
  25204. }
  25205. }
  25206. return {
  25207. rangesFormat: rangesFormatArr,
  25208. ranges: rangesArr,
  25209. yAxisWidth: yAxisWidthArr
  25210. };
  25211. }
  25212. function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
  25213. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  25214. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  25215. var minAxis = opts.area[0];
  25216. var items = [];
  25217. for (var i = 0; i < ranges.length; i++) {
  25218. var maxVal = Math.max.apply(this, ranges[i]);
  25219. var minVal = Math.min.apply(this, ranges[i]);
  25220. var item = maxVal - (maxVal - minVal) * (point - minAxis) / spacingValid;
  25221. item = opts.yAxis.data && opts.yAxis.data[i].formatter ? opts.yAxis.data[i].formatter(item, i, opts) : item.toFixed(0);
  25222. items.push(String(item));
  25223. }
  25224. return items;
  25225. }
  25226. function calMarkLineData(points, opts) {
  25227. var minRange, maxRange;
  25228. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  25229. for (var i = 0; i < points.length; i++) {
  25230. points[i].yAxisIndex = points[i].yAxisIndex ? points[i].yAxisIndex : 0;
  25231. var range = [].concat(opts.chartData.yAxisData.ranges[points[i].yAxisIndex]);
  25232. minRange = range.pop();
  25233. maxRange = range.shift();
  25234. var height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
  25235. points[i].y = opts.height - Math.round(height) - opts.area[2];
  25236. }
  25237. return points;
  25238. }
  25239. function contextRotate(context, opts) {
  25240. if (opts.rotateLock !== true) {
  25241. context.translate(opts.height, 0);
  25242. context.rotate(90 * Math.PI / 180);
  25243. } else if (opts._rotate_ !== true) {
  25244. context.translate(opts.height, 0);
  25245. context.rotate(90 * Math.PI / 180);
  25246. opts._rotate_ = true;
  25247. }
  25248. }
  25249. function drawPointShape(points, color, shape, context, opts) {
  25250. context.beginPath();
  25251. if (opts.dataPointShapeType == 'hollow') {
  25252. context.setStrokeStyle(color);
  25253. context.setFillStyle(opts.background);
  25254. context.setLineWidth(2 * opts.pix);
  25255. } else {
  25256. context.setStrokeStyle("#ffffff");
  25257. context.setFillStyle(color);
  25258. context.setLineWidth(1 * opts.pix);
  25259. }
  25260. if (shape === 'diamond') {
  25261. points.forEach(function (item, index) {
  25262. if (item !== null) {
  25263. context.moveTo(item.x, item.y - 4.5);
  25264. context.lineTo(item.x - 4.5, item.y);
  25265. context.lineTo(item.x, item.y + 4.5);
  25266. context.lineTo(item.x + 4.5, item.y);
  25267. context.lineTo(item.x, item.y - 4.5);
  25268. }
  25269. });
  25270. } else if (shape === 'circle') {
  25271. points.forEach(function (item, index) {
  25272. if (item !== null) {
  25273. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  25274. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  25275. }
  25276. });
  25277. } else if (shape === 'square') {
  25278. points.forEach(function (item, index) {
  25279. if (item !== null) {
  25280. context.moveTo(item.x - 3.5, item.y - 3.5);
  25281. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  25282. }
  25283. });
  25284. } else if (shape === 'triangle') {
  25285. points.forEach(function (item, index) {
  25286. if (item !== null) {
  25287. context.moveTo(item.x, item.y - 4.5);
  25288. context.lineTo(item.x - 4.5, item.y + 4.5);
  25289. context.lineTo(item.x + 4.5, item.y + 4.5);
  25290. context.lineTo(item.x, item.y - 4.5);
  25291. }
  25292. });
  25293. } else if (shape === 'none') {
  25294. return;
  25295. }
  25296. context.closePath();
  25297. context.fill();
  25298. context.stroke();
  25299. }
  25300. function drawActivePoint(points, color, shape, context, opts, option, seriesIndex) {
  25301. if (!opts.tooltip) {
  25302. return;
  25303. }
  25304. if (opts.tooltip.group.length > 0 && opts.tooltip.group.includes(seriesIndex) == false) {
  25305. return;
  25306. }
  25307. var pointIndex = typeof opts.tooltip.index === 'number' ? opts.tooltip.index : opts.tooltip.index[opts.tooltip.group.indexOf(seriesIndex)];
  25308. context.beginPath();
  25309. if (option.activeType == 'hollow') {
  25310. context.setStrokeStyle(color);
  25311. context.setFillStyle(opts.background);
  25312. context.setLineWidth(2 * opts.pix);
  25313. } else {
  25314. context.setStrokeStyle("#ffffff");
  25315. context.setFillStyle(color);
  25316. context.setLineWidth(1 * opts.pix);
  25317. }
  25318. if (shape === 'diamond') {
  25319. points.forEach(function (item, index) {
  25320. if (item !== null && pointIndex == index) {
  25321. context.moveTo(item.x, item.y - 4.5);
  25322. context.lineTo(item.x - 4.5, item.y);
  25323. context.lineTo(item.x, item.y + 4.5);
  25324. context.lineTo(item.x + 4.5, item.y);
  25325. context.lineTo(item.x, item.y - 4.5);
  25326. }
  25327. });
  25328. } else if (shape === 'circle') {
  25329. points.forEach(function (item, index) {
  25330. if (item !== null && pointIndex == index) {
  25331. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  25332. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  25333. }
  25334. });
  25335. } else if (shape === 'square') {
  25336. points.forEach(function (item, index) {
  25337. if (item !== null && pointIndex == index) {
  25338. context.moveTo(item.x - 3.5, item.y - 3.5);
  25339. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  25340. }
  25341. });
  25342. } else if (shape === 'triangle') {
  25343. points.forEach(function (item, index) {
  25344. if (item !== null && pointIndex == index) {
  25345. context.moveTo(item.x, item.y - 4.5);
  25346. context.lineTo(item.x - 4.5, item.y + 4.5);
  25347. context.lineTo(item.x + 4.5, item.y + 4.5);
  25348. context.lineTo(item.x, item.y - 4.5);
  25349. }
  25350. });
  25351. } else if (shape === 'none') {
  25352. return;
  25353. }
  25354. context.closePath();
  25355. context.fill();
  25356. context.stroke();
  25357. }
  25358. function drawRingTitle(opts, config, context, center) {
  25359. var titlefontSize = opts.title.fontSize || config.titleFontSize;
  25360. var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize;
  25361. var title = opts.title.name || '';
  25362. var subtitle = opts.subtitle.name || '';
  25363. var titleFontColor = opts.title.color || opts.fontColor;
  25364. var subtitleFontColor = opts.subtitle.color || opts.fontColor;
  25365. var titleHeight = title ? titlefontSize : 0;
  25366. var subtitleHeight = subtitle ? subtitlefontSize : 0;
  25367. var margin = 5;
  25368. if (subtitle) {
  25369. var textWidth = measureText(subtitle, subtitlefontSize * opts.pix, context);
  25370. var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0) * opts.pix;
  25371. var startY = center.y + subtitlefontSize * opts.pix / 2 + (opts.subtitle.offsetY || 0) * opts.pix;
  25372. if (title) {
  25373. startY += (titleHeight * opts.pix + margin) / 2;
  25374. }
  25375. context.beginPath();
  25376. context.setFontSize(subtitlefontSize * opts.pix);
  25377. context.setFillStyle(subtitleFontColor);
  25378. context.fillText(subtitle, startX, startY);
  25379. context.closePath();
  25380. context.stroke();
  25381. }
  25382. if (title) {
  25383. var _textWidth = measureText(title, titlefontSize * opts.pix, context);
  25384. var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0);
  25385. var _startY = center.y + titlefontSize * opts.pix / 2 + (opts.title.offsetY || 0) * opts.pix;
  25386. if (subtitle) {
  25387. _startY -= (subtitleHeight * opts.pix + margin) / 2;
  25388. }
  25389. context.beginPath();
  25390. context.setFontSize(titlefontSize * opts.pix);
  25391. context.setFillStyle(titleFontColor);
  25392. context.fillText(title, _startX, _startY);
  25393. context.closePath();
  25394. context.stroke();
  25395. }
  25396. }
  25397. function drawPointText(points, series, config, context, opts) {
  25398. // 绘制数据文案
  25399. var data = series.data;
  25400. var textOffset = series.textOffset ? series.textOffset : 0;
  25401. points.forEach(function (item, index) {
  25402. if (item !== null) {
  25403. context.beginPath();
  25404. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  25405. context.setFontSize(fontSize);
  25406. context.setFillStyle(series.textColor || opts.fontColor);
  25407. var value = data[index];
  25408. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  25409. if (data[index].constructor.toString().indexOf('Array') > -1) {
  25410. value = data[index][1];
  25411. } else {
  25412. value = data[index].value;
  25413. }
  25414. }
  25415. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  25416. context.setTextAlign('center');
  25417. context.fillText(String(formatVal), item.x, item.y - 4 + textOffset * opts.pix);
  25418. context.closePath();
  25419. context.stroke();
  25420. context.setTextAlign('left');
  25421. }
  25422. });
  25423. }
  25424. function drawColumePointText(points, series, config, context, opts) {
  25425. // 绘制数据文案
  25426. var data = series.data;
  25427. var textOffset = series.textOffset ? series.textOffset : 0;
  25428. var Position = opts.extra.column.labelPosition;
  25429. points.forEach(function (item, index) {
  25430. if (item !== null) {
  25431. context.beginPath();
  25432. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  25433. context.setFontSize(fontSize);
  25434. context.setFillStyle(series.textColor || opts.fontColor);
  25435. var value = data[index];
  25436. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  25437. if (data[index].constructor.toString().indexOf('Array') > -1) {
  25438. value = data[index][1];
  25439. } else {
  25440. value = data[index].value;
  25441. }
  25442. }
  25443. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  25444. context.setTextAlign('center');
  25445. var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
  25446. if (item.y > series.zeroPoints) {
  25447. startY = item.y + textOffset * opts.pix + fontSize;
  25448. }
  25449. if (Position == 'insideTop') {
  25450. startY = item.y + fontSize + textOffset * opts.pix;
  25451. if (item.y > series.zeroPoints) {
  25452. startY = item.y - textOffset * opts.pix - 4 * opts.pix;
  25453. }
  25454. }
  25455. if (Position == 'center') {
  25456. startY = item.y + textOffset * opts.pix + (opts.height - opts.area[2] - item.y + fontSize) / 2;
  25457. if (series.zeroPoints < opts.height - opts.area[2]) {
  25458. startY = item.y + textOffset * opts.pix + (series.zeroPoints - item.y + fontSize) / 2;
  25459. }
  25460. if (item.y > series.zeroPoints) {
  25461. startY = item.y - textOffset * opts.pix - (item.y - series.zeroPoints - fontSize) / 2;
  25462. }
  25463. if (opts.extra.column.type == 'stack') {
  25464. startY = item.y + textOffset * opts.pix + (item.y0 - item.y + fontSize) / 2;
  25465. }
  25466. }
  25467. if (Position == 'bottom') {
  25468. startY = opts.height - opts.area[2] + textOffset * opts.pix - 4 * opts.pix;
  25469. if (series.zeroPoints < opts.height - opts.area[2]) {
  25470. startY = series.zeroPoints + textOffset * opts.pix - 4 * opts.pix;
  25471. }
  25472. if (item.y > series.zeroPoints) {
  25473. startY = series.zeroPoints - textOffset * opts.pix + fontSize + 2 * opts.pix;
  25474. }
  25475. if (opts.extra.column.type == 'stack') {
  25476. startY = item.y0 + textOffset * opts.pix - 4 * opts.pix;
  25477. }
  25478. }
  25479. context.fillText(String(formatVal), item.x, startY);
  25480. context.closePath();
  25481. context.stroke();
  25482. context.setTextAlign('left');
  25483. }
  25484. });
  25485. }
  25486. function drawMountPointText(points, series, config, context, opts, zeroPoints) {
  25487. // 绘制数据文案
  25488. var data = series.data;
  25489. var textOffset = series.textOffset ? series.textOffset : 0;
  25490. var Position = opts.extra.mount.labelPosition;
  25491. points.forEach(function (item, index) {
  25492. if (item !== null) {
  25493. context.beginPath();
  25494. var fontSize = series[index].textSize ? series[index].textSize * opts.pix : config.fontSize;
  25495. context.setFontSize(fontSize);
  25496. context.setFillStyle(series[index].textColor || opts.fontColor);
  25497. var value = item.value;
  25498. var formatVal = series[index].formatter ? series[index].formatter(value, index, series, opts) : value;
  25499. context.setTextAlign('center');
  25500. var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
  25501. if (item.y > zeroPoints) {
  25502. startY = item.y + textOffset * opts.pix + fontSize;
  25503. }
  25504. context.fillText(String(formatVal), item.x, startY);
  25505. context.closePath();
  25506. context.stroke();
  25507. context.setTextAlign('left');
  25508. }
  25509. });
  25510. }
  25511. function drawBarPointText(points, series, config, context, opts) {
  25512. // 绘制数据文案
  25513. var data = series.data;
  25514. var textOffset = series.textOffset ? series.textOffset : 0;
  25515. points.forEach(function (item, index) {
  25516. if (item !== null) {
  25517. context.beginPath();
  25518. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  25519. context.setFontSize(fontSize);
  25520. context.setFillStyle(series.textColor || opts.fontColor);
  25521. var value = data[index];
  25522. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  25523. value = data[index].value;
  25524. }
  25525. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  25526. context.setTextAlign('left');
  25527. context.fillText(String(formatVal), item.x + 4 * opts.pix, item.y + fontSize / 2 - 3);
  25528. context.closePath();
  25529. context.stroke();
  25530. }
  25531. });
  25532. }
  25533. function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
  25534. radius -= gaugeOption.width / 2 + gaugeOption.labelOffset * opts.pix;
  25535. radius = radius < 10 ? 10 : radius;
  25536. var totalAngle;
  25537. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  25538. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  25539. } else {
  25540. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  25541. }
  25542. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  25543. var totalNumber = gaugeOption.endNumber - gaugeOption.startNumber;
  25544. var splitNumber = totalNumber / gaugeOption.splitLine.splitNumber;
  25545. var nowAngle = gaugeOption.startAngle;
  25546. var nowNumber = gaugeOption.startNumber;
  25547. for (var i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
  25548. var pos = {
  25549. x: radius * Math.cos(nowAngle * Math.PI),
  25550. y: radius * Math.sin(nowAngle * Math.PI)
  25551. };
  25552. var labelText = gaugeOption.formatter ? gaugeOption.formatter(nowNumber, i, opts) : nowNumber;
  25553. pos.x += centerPosition.x - measureText(labelText, config.fontSize, context) / 2;
  25554. pos.y += centerPosition.y;
  25555. var startX = pos.x;
  25556. var startY = pos.y;
  25557. context.beginPath();
  25558. context.setFontSize(config.fontSize);
  25559. context.setFillStyle(gaugeOption.labelColor || opts.fontColor);
  25560. context.fillText(labelText, startX, startY + config.fontSize / 2);
  25561. context.closePath();
  25562. context.stroke();
  25563. nowAngle += splitAngle;
  25564. if (nowAngle >= 2) {
  25565. nowAngle = nowAngle % 2;
  25566. }
  25567. nowNumber += splitNumber;
  25568. }
  25569. }
  25570. function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
  25571. var radarOption = opts.extra.radar || {};
  25572. angleList.forEach(function (angle, index) {
  25573. if (radarOption.labelPointShow === true && opts.categories[index] !== '') {
  25574. var posPoint = {
  25575. x: radius * Math.cos(angle),
  25576. y: radius * Math.sin(angle)
  25577. };
  25578. var posPointAxis = convertCoordinateOrigin(posPoint.x, posPoint.y, centerPosition);
  25579. context.setFillStyle(radarOption.labelPointColor);
  25580. context.beginPath();
  25581. context.arc(posPointAxis.x, posPointAxis.y, radarOption.labelPointRadius * opts.pix, 0, 2 * Math.PI, false);
  25582. context.closePath();
  25583. context.fill();
  25584. }
  25585. if (radarOption.labelShow === true) {
  25586. var pos = {
  25587. x: (radius + config.radarLabelTextMargin * opts.pix) * Math.cos(angle),
  25588. y: (radius + config.radarLabelTextMargin * opts.pix) * Math.sin(angle)
  25589. };
  25590. var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition);
  25591. var startX = posRelativeCanvas.x;
  25592. var startY = posRelativeCanvas.y;
  25593. if (util.approximatelyEqual(pos.x, 0)) {
  25594. startX -= measureText(opts.categories[index] || '', config.fontSize, context) / 2;
  25595. } else if (pos.x < 0) {
  25596. startX -= measureText(opts.categories[index] || '', config.fontSize, context);
  25597. }
  25598. context.beginPath();
  25599. context.setFontSize(config.fontSize);
  25600. context.setFillStyle(radarOption.labelColor || opts.fontColor);
  25601. context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2);
  25602. context.closePath();
  25603. context.stroke();
  25604. }
  25605. });
  25606. }
  25607. function drawPieText(series, opts, config, context, radius, center) {
  25608. var lineRadius = config.pieChartLinePadding;
  25609. var textObjectCollection = [];
  25610. var lastTextObject = null;
  25611. var seriesConvert = series.map(function (item, index) {
  25612. var text = item.formatter ? item.formatter(item, index, series, opts) : util.toFixed(item._proportion_.toFixed(4) * 100) + '%';
  25613. text = item.labelText ? item.labelText : text;
  25614. var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
  25615. if (item._rose_proportion_) {
  25616. arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._rose_proportion_ / 2);
  25617. }
  25618. var color = item.color;
  25619. var radius = item._radius_;
  25620. return {
  25621. arc: arc,
  25622. text: text,
  25623. color: color,
  25624. radius: radius,
  25625. textColor: item.textColor,
  25626. textSize: item.textSize,
  25627. labelShow: item.labelShow
  25628. };
  25629. });
  25630. for (var i = 0; i < seriesConvert.length; i++) {
  25631. var item = seriesConvert[i];
  25632. // line end
  25633. var orginX1 = Math.cos(item.arc) * (item.radius + lineRadius);
  25634. var orginY1 = Math.sin(item.arc) * (item.radius + lineRadius);
  25635. // line start
  25636. var orginX2 = Math.cos(item.arc) * item.radius;
  25637. var orginY2 = Math.sin(item.arc) * item.radius;
  25638. // text start
  25639. var orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding;
  25640. var orginY3 = orginY1;
  25641. var textWidth = measureText(item.text, item.textSize * opts.pix || config.fontSize, context);
  25642. var startY = orginY3;
  25643. if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
  25644. x: orginX3
  25645. })) {
  25646. if (orginX3 > 0) {
  25647. startY = Math.min(orginY3, lastTextObject.start.y);
  25648. } else if (orginX1 < 0) {
  25649. startY = Math.max(orginY3, lastTextObject.start.y);
  25650. } else {
  25651. if (orginY3 > 0) {
  25652. startY = Math.max(orginY3, lastTextObject.start.y);
  25653. } else {
  25654. startY = Math.min(orginY3, lastTextObject.start.y);
  25655. }
  25656. }
  25657. }
  25658. if (orginX3 < 0) {
  25659. orginX3 -= textWidth;
  25660. }
  25661. var textObject = {
  25662. lineStart: {
  25663. x: orginX2,
  25664. y: orginY2
  25665. },
  25666. lineEnd: {
  25667. x: orginX1,
  25668. y: orginY1
  25669. },
  25670. start: {
  25671. x: orginX3,
  25672. y: startY
  25673. },
  25674. width: textWidth,
  25675. height: config.fontSize,
  25676. text: item.text,
  25677. color: item.color,
  25678. textColor: item.textColor,
  25679. textSize: item.textSize
  25680. };
  25681. lastTextObject = avoidCollision(textObject, lastTextObject);
  25682. textObjectCollection.push(lastTextObject);
  25683. }
  25684. for (var _i15 = 0; _i15 < textObjectCollection.length; _i15++) {
  25685. if (seriesConvert[_i15].labelShow === false) {
  25686. continue;
  25687. }
  25688. var _item6 = textObjectCollection[_i15];
  25689. var lineStartPoistion = convertCoordinateOrigin(_item6.lineStart.x, _item6.lineStart.y, center);
  25690. var lineEndPoistion = convertCoordinateOrigin(_item6.lineEnd.x, _item6.lineEnd.y, center);
  25691. var textPosition = convertCoordinateOrigin(_item6.start.x, _item6.start.y, center);
  25692. context.setLineWidth(1 * opts.pix);
  25693. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  25694. context.beginPath();
  25695. context.setStrokeStyle(_item6.color);
  25696. context.setFillStyle(_item6.color);
  25697. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  25698. var curveStartX = _item6.start.x < 0 ? textPosition.x + _item6.width : textPosition.x;
  25699. var textStartX = _item6.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5;
  25700. context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y);
  25701. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  25702. context.stroke();
  25703. context.closePath();
  25704. context.beginPath();
  25705. context.moveTo(textPosition.x + _item6.width, textPosition.y);
  25706. context.arc(curveStartX, textPosition.y, 2 * opts.pix, 0, 2 * Math.PI);
  25707. context.closePath();
  25708. context.fill();
  25709. context.beginPath();
  25710. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  25711. context.setFillStyle(_item6.textColor || opts.fontColor);
  25712. context.fillText(_item6.text, textStartX, textPosition.y + 3);
  25713. context.closePath();
  25714. context.stroke();
  25715. context.closePath();
  25716. }
  25717. }
  25718. function drawToolTipSplitLine(offsetX, opts, config, context) {
  25719. var toolTipOption = opts.extra.tooltip || {};
  25720. toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType;
  25721. toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength;
  25722. var startY = opts.area[0];
  25723. var endY = opts.height - opts.area[2];
  25724. if (toolTipOption.gridType == 'dash') {
  25725. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  25726. }
  25727. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  25728. context.setLineWidth(1 * opts.pix);
  25729. context.beginPath();
  25730. context.moveTo(offsetX, startY);
  25731. context.lineTo(offsetX, endY);
  25732. context.stroke();
  25733. context.setLineDash([]);
  25734. if (toolTipOption.xAxisLabel) {
  25735. var labelText = opts.categories[opts.tooltip.index];
  25736. context.setFontSize(config.fontSize);
  25737. var textWidth = measureText(labelText, config.fontSize, context);
  25738. var textX = offsetX - 0.5 * textWidth;
  25739. var textY = endY + 2 * opts.pix;
  25740. context.beginPath();
  25741. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  25742. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  25743. context.setLineWidth(1 * opts.pix);
  25744. context.rect(textX - toolTipOption.boxPadding * opts.pix, textY, textWidth + 2 * toolTipOption.boxPadding * opts.pix, config.fontSize + 2 * toolTipOption.boxPadding * opts.pix);
  25745. context.closePath();
  25746. context.stroke();
  25747. context.fill();
  25748. context.beginPath();
  25749. context.setFontSize(config.fontSize);
  25750. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  25751. context.fillText(String(labelText), textX, textY + toolTipOption.boxPadding * opts.pix + config.fontSize);
  25752. context.closePath();
  25753. context.stroke();
  25754. }
  25755. }
  25756. function drawMarkLine(opts, config, context) {
  25757. var markLineOption = assign({}, {
  25758. type: 'solid',
  25759. dashLength: 4,
  25760. data: []
  25761. }, opts.extra.markLine);
  25762. var startX = opts.area[3];
  25763. var endX = opts.width - opts.area[1];
  25764. var points = calMarkLineData(markLineOption.data, opts);
  25765. for (var i = 0; i < points.length; i++) {
  25766. var item = assign({}, {
  25767. lineColor: '#DE4A42',
  25768. showLabel: false,
  25769. labelFontSize: 13,
  25770. labelPadding: 6,
  25771. labelFontColor: '#666666',
  25772. labelBgColor: '#DFE8FF',
  25773. labelBgOpacity: 0.8,
  25774. labelAlign: 'left',
  25775. labelOffsetX: 0,
  25776. labelOffsetY: 0
  25777. }, points[i]);
  25778. if (markLineOption.type == 'dash') {
  25779. context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
  25780. }
  25781. context.setStrokeStyle(item.lineColor);
  25782. context.setLineWidth(1 * opts.pix);
  25783. context.beginPath();
  25784. context.moveTo(startX, item.y);
  25785. context.lineTo(endX, item.y);
  25786. context.stroke();
  25787. context.setLineDash([]);
  25788. if (item.showLabel) {
  25789. var fontSize = item.labelFontSize * opts.pix;
  25790. var labelText = item.labelText ? item.labelText : item.value;
  25791. context.setFontSize(fontSize);
  25792. var textWidth = measureText(labelText, fontSize, context);
  25793. var bgWidth = textWidth + item.labelPadding * opts.pix * 2;
  25794. var bgStartX = item.labelAlign == 'left' ? opts.area[3] - bgWidth : opts.width - opts.area[1];
  25795. bgStartX += item.labelOffsetX;
  25796. var bgStartY = item.y - 0.5 * fontSize - item.labelPadding * opts.pix;
  25797. bgStartY += item.labelOffsetY;
  25798. var textX = bgStartX + item.labelPadding * opts.pix;
  25799. var textY = item.y;
  25800. context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity));
  25801. context.setStrokeStyle(item.labelBgColor);
  25802. context.setLineWidth(1 * opts.pix);
  25803. context.beginPath();
  25804. context.rect(bgStartX, bgStartY, bgWidth, fontSize + 2 * item.labelPadding * opts.pix);
  25805. context.closePath();
  25806. context.stroke();
  25807. context.fill();
  25808. context.setFontSize(fontSize);
  25809. context.setTextAlign('left');
  25810. context.setFillStyle(item.labelFontColor);
  25811. context.fillText(String(labelText), textX, bgStartY + fontSize + item.labelPadding * opts.pix / 2);
  25812. context.stroke();
  25813. context.setTextAlign('left');
  25814. }
  25815. }
  25816. }
  25817. function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
  25818. var toolTipOption = assign({}, {
  25819. gridType: 'solid',
  25820. dashLength: 4
  25821. }, opts.extra.tooltip);
  25822. var startX = opts.area[3];
  25823. var endX = opts.width - opts.area[1];
  25824. if (toolTipOption.gridType == 'dash') {
  25825. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  25826. }
  25827. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  25828. context.setLineWidth(1 * opts.pix);
  25829. context.beginPath();
  25830. context.moveTo(startX, opts.tooltip.offset.y);
  25831. context.lineTo(endX, opts.tooltip.offset.y);
  25832. context.stroke();
  25833. context.setLineDash([]);
  25834. if (toolTipOption.yAxisLabel) {
  25835. var boxPadding = toolTipOption.boxPadding * opts.pix;
  25836. var labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing);
  25837. var widthArr = opts.chartData.yAxisData.yAxisWidth;
  25838. var tStartLeft = opts.area[3];
  25839. var tStartRight = opts.width - opts.area[1];
  25840. for (var i = 0; i < labelText.length; i++) {
  25841. context.setFontSize(toolTipOption.fontSize * opts.pix);
  25842. var textWidth = measureText(labelText[i], toolTipOption.fontSize * opts.pix, context);
  25843. var bgStartX = void 0,
  25844. bgEndX = void 0,
  25845. bgWidth = void 0;
  25846. if (widthArr[i].position == 'left') {
  25847. bgStartX = tStartLeft - (textWidth + boxPadding * 2) - 2 * opts.pix;
  25848. bgEndX = Math.max(bgStartX, bgStartX + textWidth + boxPadding * 2);
  25849. } else {
  25850. bgStartX = tStartRight + 2 * opts.pix;
  25851. bgEndX = Math.max(bgStartX + widthArr[i].width, bgStartX + textWidth + boxPadding * 2);
  25852. }
  25853. bgWidth = bgEndX - bgStartX;
  25854. var textX = bgStartX + (bgWidth - textWidth) / 2;
  25855. var textY = opts.tooltip.offset.y;
  25856. context.beginPath();
  25857. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  25858. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  25859. context.setLineWidth(1 * opts.pix);
  25860. context.rect(bgStartX, textY - 0.5 * config.fontSize - boxPadding, bgWidth, config.fontSize + 2 * boxPadding);
  25861. context.closePath();
  25862. context.stroke();
  25863. context.fill();
  25864. context.beginPath();
  25865. context.setFontSize(config.fontSize);
  25866. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  25867. context.fillText(labelText[i], textX, textY + 0.5 * config.fontSize);
  25868. context.closePath();
  25869. context.stroke();
  25870. if (widthArr[i].position == 'left') {
  25871. tStartLeft -= widthArr[i].width + opts.yAxis.padding * opts.pix;
  25872. } else {
  25873. tStartRight += widthArr[i].width + opts.yAxis.padding * opts.pix;
  25874. }
  25875. }
  25876. }
  25877. }
  25878. function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  25879. var toolTipOption = assign({}, {
  25880. activeBgColor: '#000000',
  25881. activeBgOpacity: 0.08,
  25882. activeWidth: eachSpacing
  25883. }, opts.extra.column);
  25884. toolTipOption.activeWidth = toolTipOption.activeWidth > eachSpacing ? eachSpacing : toolTipOption.activeWidth;
  25885. var startY = opts.area[0];
  25886. var endY = opts.height - opts.area[2];
  25887. context.beginPath();
  25888. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  25889. context.rect(offsetX - toolTipOption.activeWidth / 2, startY, toolTipOption.activeWidth, endY - startY);
  25890. context.closePath();
  25891. context.fill();
  25892. context.setFillStyle("#FFFFFF");
  25893. }
  25894. function drawBarToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  25895. var toolTipOption = assign({}, {
  25896. activeBgColor: '#000000',
  25897. activeBgOpacity: 0.08
  25898. }, opts.extra.bar);
  25899. var startX = opts.area[3];
  25900. var endX = opts.width - opts.area[1];
  25901. context.beginPath();
  25902. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  25903. context.rect(startX, offsetX - eachSpacing / 2, endX - startX, eachSpacing);
  25904. context.closePath();
  25905. context.fill();
  25906. context.setFillStyle("#FFFFFF");
  25907. }
  25908. function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
  25909. var toolTipOption = assign({}, {
  25910. showBox: true,
  25911. showArrow: true,
  25912. showCategory: false,
  25913. bgColor: '#000000',
  25914. bgOpacity: 0.7,
  25915. borderColor: '#000000',
  25916. borderWidth: 0,
  25917. borderRadius: 0,
  25918. borderOpacity: 0.7,
  25919. boxPadding: 3,
  25920. fontColor: '#FFFFFF',
  25921. fontSize: 13,
  25922. lineHeight: 20,
  25923. legendShow: true,
  25924. legendShape: 'auto',
  25925. splitLine: true
  25926. }, opts.extra.tooltip);
  25927. if (toolTipOption.showCategory == true && opts.categories) {
  25928. textList.unshift({
  25929. text: opts.categories[opts.tooltip.index],
  25930. color: null
  25931. });
  25932. }
  25933. var fontSize = toolTipOption.fontSize * opts.pix;
  25934. var lineHeight = toolTipOption.lineHeight * opts.pix;
  25935. var boxPadding = toolTipOption.boxPadding * opts.pix;
  25936. var legendWidth = fontSize;
  25937. var legendMarginRight = 5 * opts.pix;
  25938. if (toolTipOption.legendShow == false) {
  25939. legendWidth = 0;
  25940. legendMarginRight = 0;
  25941. }
  25942. var arrowWidth = toolTipOption.showArrow ? 8 * opts.pix : 0;
  25943. var isOverRightBorder = false;
  25944. if (opts.type == 'line' || opts.type == 'mount' || opts.type == 'area' || opts.type == 'candle' || opts.type == 'mix') {
  25945. if (toolTipOption.splitLine == true) {
  25946. drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
  25947. }
  25948. }
  25949. offset = assign({
  25950. x: 0,
  25951. y: 0
  25952. }, offset);
  25953. offset.y -= 8 * opts.pix;
  25954. var textWidth = textList.map(function (item) {
  25955. return measureText(item.text, fontSize, context);
  25956. });
  25957. var toolTipWidth = legendWidth + legendMarginRight + 4 * boxPadding + Math.max.apply(null, textWidth);
  25958. var toolTipHeight = 2 * boxPadding + textList.length * lineHeight;
  25959. if (toolTipOption.showBox == false) {
  25960. return;
  25961. }
  25962. // if beyond the right border
  25963. if (offset.x - Math.abs(opts._scrollDistance_ || 0) + arrowWidth + toolTipWidth > opts.width) {
  25964. isOverRightBorder = true;
  25965. }
  25966. if (toolTipHeight + offset.y > opts.height) {
  25967. offset.y = opts.height - toolTipHeight;
  25968. }
  25969. // draw background rect
  25970. context.beginPath();
  25971. context.setFillStyle(hexToRgb(toolTipOption.bgColor, toolTipOption.bgOpacity));
  25972. context.setLineWidth(toolTipOption.borderWidth * opts.pix);
  25973. context.setStrokeStyle(hexToRgb(toolTipOption.borderColor, toolTipOption.borderOpacity));
  25974. var radius = toolTipOption.borderRadius;
  25975. if (isOverRightBorder) {
  25976. // 增加左侧仍然超出的判断
  25977. if (toolTipWidth + arrowWidth > opts.width) {
  25978. offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
  25979. }
  25980. if (toolTipWidth > offset.x) {
  25981. offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
  25982. }
  25983. if (toolTipOption.showArrow) {
  25984. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  25985. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  25986. }
  25987. context.arc(offset.x - arrowWidth - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
  25988. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
  25989. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  25990. context.arc(offset.x - arrowWidth - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
  25991. if (toolTipOption.showArrow) {
  25992. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  25993. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  25994. }
  25995. } else {
  25996. if (toolTipOption.showArrow) {
  25997. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  25998. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  25999. }
  26000. context.arc(offset.x + arrowWidth + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  26001. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
  26002. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
  26003. context.arc(offset.x + arrowWidth + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
  26004. if (toolTipOption.showArrow) {
  26005. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  26006. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  26007. }
  26008. }
  26009. context.closePath();
  26010. context.fill();
  26011. if (toolTipOption.borderWidth > 0) {
  26012. context.stroke();
  26013. }
  26014. // draw legend
  26015. if (toolTipOption.legendShow) {
  26016. textList.forEach(function (item, index) {
  26017. if (item.color !== null) {
  26018. context.beginPath();
  26019. context.setFillStyle(item.color);
  26020. var startX = offset.x + arrowWidth + 2 * boxPadding;
  26021. var startY = offset.y + (lineHeight - fontSize) / 2 + lineHeight * index + boxPadding + 1;
  26022. if (isOverRightBorder) {
  26023. startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding;
  26024. }
  26025. switch (item.legendShape) {
  26026. case 'line':
  26027. context.moveTo(startX, startY + 0.5 * legendWidth - 2 * opts.pix);
  26028. context.fillRect(startX, startY + 0.5 * legendWidth - 2 * opts.pix, legendWidth, 4 * opts.pix);
  26029. break;
  26030. case 'triangle':
  26031. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  26032. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  26033. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  26034. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  26035. break;
  26036. case 'diamond':
  26037. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  26038. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth);
  26039. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  26040. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth);
  26041. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  26042. break;
  26043. case 'circle':
  26044. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth);
  26045. context.arc(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth, 5 * opts.pix, 0, 2 * Math.PI);
  26046. break;
  26047. case 'rect':
  26048. context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
  26049. context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  26050. break;
  26051. case 'square':
  26052. context.moveTo(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  26053. context.fillRect(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
  26054. break;
  26055. default:
  26056. context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
  26057. context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  26058. }
  26059. context.closePath();
  26060. context.fill();
  26061. }
  26062. });
  26063. }
  26064. // draw text list
  26065. textList.forEach(function (item, index) {
  26066. var startX = offset.x + arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
  26067. if (isOverRightBorder) {
  26068. startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
  26069. }
  26070. var startY = offset.y + lineHeight * index + (lineHeight - fontSize) / 2 - 1 + boxPadding + fontSize;
  26071. context.beginPath();
  26072. context.setFontSize(fontSize);
  26073. context.setTextBaseline('normal');
  26074. context.setFillStyle(toolTipOption.fontColor);
  26075. context.fillText(item.text, startX, startY);
  26076. context.closePath();
  26077. context.stroke();
  26078. });
  26079. }
  26080. function drawColumnDataPoints(series, opts, config, context) {
  26081. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26082. var xAxisData = opts.chartData.xAxisData,
  26083. xAxisPoints = xAxisData.xAxisPoints,
  26084. eachSpacing = xAxisData.eachSpacing;
  26085. var columnOption = assign({}, {
  26086. type: 'group',
  26087. width: eachSpacing / 2,
  26088. meterBorder: 4,
  26089. meterFillColor: '#FFFFFF',
  26090. barBorderCircle: false,
  26091. barBorderRadius: [],
  26092. seriesGap: 2,
  26093. linearType: 'none',
  26094. linearOpacity: 1,
  26095. customColor: [],
  26096. colorStop: 0,
  26097. labelPosition: 'outside'
  26098. }, opts.extra.column);
  26099. var calPoints = [];
  26100. context.save();
  26101. var leftNum = -2;
  26102. var rightNum = xAxisPoints.length + 2;
  26103. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26104. context.translate(opts._scrollDistance_, 0);
  26105. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  26106. rightNum = leftNum + opts.xAxis.itemCount + 4;
  26107. }
  26108. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  26109. drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
  26110. }
  26111. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  26112. series.forEach(function (eachSeries, seriesIndex) {
  26113. var ranges, minRange, maxRange;
  26114. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26115. minRange = ranges.pop();
  26116. maxRange = ranges.shift();
  26117. // 计算0轴坐标
  26118. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  26119. var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
  26120. var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
  26121. eachSeries.zeroPoints = zeroPoints;
  26122. var data = eachSeries.data;
  26123. switch (columnOption.type) {
  26124. case 'group':
  26125. var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process);
  26126. var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26127. calPoints.push(tooltipPoints);
  26128. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26129. for (var i = 0; i < points.length; i++) {
  26130. var item = points[i];
  26131. //fix issues/I27B1N yyoinge & Joeshu
  26132. if (item !== null && i > leftNum && i < rightNum) {
  26133. var startX = item.x - item.width / 2;
  26134. var height = opts.height - item.y - opts.area[2];
  26135. context.beginPath();
  26136. var fillColor = item.color || eachSeries.color;
  26137. var strokeColor = item.color || eachSeries.color;
  26138. if (columnOption.linearType !== 'none') {
  26139. var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
  26140. //透明渐变
  26141. if (columnOption.linearType == 'opacity') {
  26142. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  26143. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26144. } else {
  26145. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26146. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26147. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26148. }
  26149. fillColor = grd;
  26150. }
  26151. // 圆角边框
  26152. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  26153. var left = startX;
  26154. var top = item.y > zeroPoints ? zeroPoints : item.y;
  26155. var width = item.width;
  26156. var _height = Math.abs(zeroPoints - item.y);
  26157. if (columnOption.barBorderCircle) {
  26158. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  26159. }
  26160. if (item.y > zeroPoints) {
  26161. columnOption.barBorderRadius = [0, 0, width / 2, width / 2];
  26162. }
  26163. var _columnOption$barBord = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  26164. r0 = _columnOption$barBord[0],
  26165. r1 = _columnOption$barBord[1],
  26166. r2 = _columnOption$barBord[2],
  26167. r3 = _columnOption$barBord[3];
  26168. var minRadius = Math.min(width / 2, _height / 2);
  26169. r0 = r0 > minRadius ? minRadius : r0;
  26170. r1 = r1 > minRadius ? minRadius : r1;
  26171. r2 = r2 > minRadius ? minRadius : r2;
  26172. r3 = r3 > minRadius ? minRadius : r3;
  26173. r0 = r0 < 0 ? 0 : r0;
  26174. r1 = r1 < 0 ? 0 : r1;
  26175. r2 = r2 < 0 ? 0 : r2;
  26176. r3 = r3 < 0 ? 0 : r3;
  26177. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  26178. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  26179. context.arc(left + width - r2, top + _height - r2, r2, 0, Math.PI / 2);
  26180. context.arc(left + r3, top + _height - r3, r3, Math.PI / 2, Math.PI);
  26181. } else {
  26182. context.moveTo(startX, item.y);
  26183. context.lineTo(startX + item.width, item.y);
  26184. context.lineTo(startX + item.width, zeroPoints);
  26185. context.lineTo(startX, zeroPoints);
  26186. context.lineTo(startX, item.y);
  26187. context.setLineWidth(1);
  26188. context.setStrokeStyle(strokeColor);
  26189. }
  26190. context.setFillStyle(fillColor);
  26191. context.closePath();
  26192. //context.stroke();
  26193. context.fill();
  26194. }
  26195. }
  26196. ;
  26197. break;
  26198. case 'stack':
  26199. // 绘制堆叠数据图
  26200. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26201. calPoints.push(points);
  26202. points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  26203. for (var _i16 = 0; _i16 < points.length; _i16++) {
  26204. var _item7 = points[_i16];
  26205. if (_item7 !== null && _i16 > leftNum && _i16 < rightNum) {
  26206. context.beginPath();
  26207. var fillColor = _item7.color || eachSeries.color;
  26208. var startX = _item7.x - _item7.width / 2 + 1;
  26209. var height = opts.height - _item7.y - opts.area[2];
  26210. var height0 = opts.height - _item7.y0 - opts.area[2];
  26211. if (seriesIndex > 0) {
  26212. height -= height0;
  26213. }
  26214. context.setFillStyle(fillColor);
  26215. context.moveTo(startX, _item7.y);
  26216. context.fillRect(startX, _item7.y, _item7.width, height);
  26217. context.closePath();
  26218. context.fill();
  26219. }
  26220. }
  26221. ;
  26222. break;
  26223. case 'meter':
  26224. // 绘制温度计数据图
  26225. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26226. calPoints.push(points);
  26227. points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meterBorder);
  26228. for (var _i17 = 0; _i17 < points.length; _i17++) {
  26229. var _item8 = points[_i17];
  26230. if (_item8 !== null && _i17 > leftNum && _i17 < rightNum) {
  26231. //画背景颜色
  26232. context.beginPath();
  26233. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  26234. context.setStrokeStyle(eachSeries.color);
  26235. context.setLineWidth(columnOption.meterBorder * opts.pix);
  26236. }
  26237. if (seriesIndex == 0) {
  26238. context.setFillStyle(columnOption.meterFillColor);
  26239. } else {
  26240. context.setFillStyle(_item8.color || eachSeries.color);
  26241. }
  26242. var startX = _item8.x - _item8.width / 2;
  26243. var height = opts.height - _item8.y - opts.area[2];
  26244. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  26245. var _left = startX;
  26246. var _top = _item8.y;
  26247. var _width = _item8.width;
  26248. var _height2 = zeroPoints - _item8.y;
  26249. if (columnOption.barBorderCircle) {
  26250. columnOption.barBorderRadius = [_width / 2, _width / 2, 0, 0];
  26251. }
  26252. var _columnOption$barBord2 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  26253. _r = _columnOption$barBord2[0],
  26254. _r2 = _columnOption$barBord2[1],
  26255. _r3 = _columnOption$barBord2[2],
  26256. _r4 = _columnOption$barBord2[3];
  26257. var _minRadius = Math.min(_width / 2, _height2 / 2);
  26258. _r = _r > _minRadius ? _minRadius : _r;
  26259. _r2 = _r2 > _minRadius ? _minRadius : _r2;
  26260. _r3 = _r3 > _minRadius ? _minRadius : _r3;
  26261. _r4 = _r4 > _minRadius ? _minRadius : _r4;
  26262. _r = _r < 0 ? 0 : _r;
  26263. _r2 = _r2 < 0 ? 0 : _r2;
  26264. _r3 = _r3 < 0 ? 0 : _r3;
  26265. _r4 = _r4 < 0 ? 0 : _r4;
  26266. context.arc(_left + _r, _top + _r, _r, -Math.PI, -Math.PI / 2);
  26267. context.arc(_left + _width - _r2, _top + _r2, _r2, -Math.PI / 2, 0);
  26268. context.arc(_left + _width - _r3, _top + _height2 - _r3, _r3, 0, Math.PI / 2);
  26269. context.arc(_left + _r4, _top + _height2 - _r4, _r4, Math.PI / 2, Math.PI);
  26270. context.fill();
  26271. } else {
  26272. context.moveTo(startX, _item8.y);
  26273. context.lineTo(startX + _item8.width, _item8.y);
  26274. context.lineTo(startX + _item8.width, zeroPoints);
  26275. context.lineTo(startX, zeroPoints);
  26276. context.lineTo(startX, _item8.y);
  26277. context.fill();
  26278. }
  26279. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  26280. context.closePath();
  26281. context.stroke();
  26282. }
  26283. }
  26284. }
  26285. break;
  26286. }
  26287. });
  26288. if (opts.dataLabel !== false && process === 1) {
  26289. series.forEach(function (eachSeries, seriesIndex) {
  26290. var ranges, minRange, maxRange;
  26291. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26292. minRange = ranges.pop();
  26293. maxRange = ranges.shift();
  26294. var data = eachSeries.data;
  26295. switch (columnOption.type) {
  26296. case 'group':
  26297. var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26298. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26299. drawColumePointText(points, eachSeries, config, context, opts);
  26300. break;
  26301. case 'stack':
  26302. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26303. drawColumePointText(points, eachSeries, config, context, opts);
  26304. break;
  26305. case 'meter':
  26306. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26307. drawColumePointText(points, eachSeries, config, context, opts);
  26308. break;
  26309. }
  26310. });
  26311. }
  26312. context.restore();
  26313. return {
  26314. xAxisPoints: xAxisPoints,
  26315. calPoints: calPoints,
  26316. eachSpacing: eachSpacing
  26317. };
  26318. }
  26319. function drawMountDataPoints(series, opts, config, context) {
  26320. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26321. var xAxisData = opts.chartData.xAxisData,
  26322. xAxisPoints = xAxisData.xAxisPoints,
  26323. eachSpacing = xAxisData.eachSpacing;
  26324. var mountOption = assign({}, {
  26325. type: 'mount',
  26326. widthRatio: 1,
  26327. borderWidth: 1,
  26328. barBorderCircle: false,
  26329. barBorderRadius: [],
  26330. linearType: 'none',
  26331. linearOpacity: 1,
  26332. customColor: [],
  26333. colorStop: 0
  26334. }, opts.extra.mount);
  26335. mountOption.widthRatio = mountOption.widthRatio <= 0 ? 0 : mountOption.widthRatio;
  26336. mountOption.widthRatio = mountOption.widthRatio >= 2 ? 2 : mountOption.widthRatio;
  26337. var calPoints = [];
  26338. context.save();
  26339. var leftNum = -2;
  26340. var rightNum = xAxisPoints.length + 2;
  26341. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26342. context.translate(opts._scrollDistance_, 0);
  26343. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  26344. rightNum = leftNum + opts.xAxis.itemCount + 4;
  26345. }
  26346. mountOption.customColor = fillCustomColor(mountOption.linearType, mountOption.customColor, series, config);
  26347. var ranges, minRange, maxRange;
  26348. ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  26349. minRange = ranges.pop();
  26350. maxRange = ranges.shift();
  26351. // 计算0轴坐标
  26352. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  26353. var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
  26354. var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
  26355. var points = getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
  26356. switch (mountOption.type) {
  26357. case 'bar':
  26358. for (var i = 0; i < points.length; i++) {
  26359. var item = points[i];
  26360. if (item !== null && i > leftNum && i < rightNum) {
  26361. var startX = item.x - eachSpacing * mountOption.widthRatio / 2;
  26362. var height = opts.height - item.y - opts.area[2];
  26363. context.beginPath();
  26364. var fillColor = item.color || series[i].color;
  26365. var strokeColor = item.color || series[i].color;
  26366. if (mountOption.linearType !== 'none') {
  26367. var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
  26368. //透明渐变
  26369. if (mountOption.linearType == 'opacity') {
  26370. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26371. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26372. } else {
  26373. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  26374. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  26375. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26376. }
  26377. fillColor = grd;
  26378. }
  26379. // 圆角边框
  26380. if (mountOption.barBorderRadius && mountOption.barBorderRadius.length === 4 || mountOption.barBorderCircle === true) {
  26381. var left = startX;
  26382. var top = item.y > zeroPoints ? zeroPoints : item.y;
  26383. var width = item.width;
  26384. var _height3 = Math.abs(zeroPoints - item.y);
  26385. if (mountOption.barBorderCircle) {
  26386. mountOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  26387. }
  26388. if (item.y > zeroPoints) {
  26389. mountOption.barBorderRadius = [0, 0, width / 2, width / 2];
  26390. }
  26391. var _mountOption$barBorde = (0, _slicedToArray2.default)(mountOption.barBorderRadius, 4),
  26392. r0 = _mountOption$barBorde[0],
  26393. r1 = _mountOption$barBorde[1],
  26394. r2 = _mountOption$barBorde[2],
  26395. r3 = _mountOption$barBorde[3];
  26396. var minRadius = Math.min(width / 2, _height3 / 2);
  26397. r0 = r0 > minRadius ? minRadius : r0;
  26398. r1 = r1 > minRadius ? minRadius : r1;
  26399. r2 = r2 > minRadius ? minRadius : r2;
  26400. r3 = r3 > minRadius ? minRadius : r3;
  26401. r0 = r0 < 0 ? 0 : r0;
  26402. r1 = r1 < 0 ? 0 : r1;
  26403. r2 = r2 < 0 ? 0 : r2;
  26404. r3 = r3 < 0 ? 0 : r3;
  26405. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  26406. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  26407. context.arc(left + width - r2, top + _height3 - r2, r2, 0, Math.PI / 2);
  26408. context.arc(left + r3, top + _height3 - r3, r3, Math.PI / 2, Math.PI);
  26409. } else {
  26410. context.moveTo(startX, item.y);
  26411. context.lineTo(startX + item.width, item.y);
  26412. context.lineTo(startX + item.width, zeroPoints);
  26413. context.lineTo(startX, zeroPoints);
  26414. context.lineTo(startX, item.y);
  26415. }
  26416. context.setStrokeStyle(strokeColor);
  26417. context.setFillStyle(fillColor);
  26418. if (mountOption.borderWidth > 0) {
  26419. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26420. context.closePath();
  26421. context.stroke();
  26422. }
  26423. context.fill();
  26424. }
  26425. }
  26426. ;
  26427. break;
  26428. case 'triangle':
  26429. for (var _i18 = 0; _i18 < points.length; _i18++) {
  26430. var _item9 = points[_i18];
  26431. if (_item9 !== null && _i18 > leftNum && _i18 < rightNum) {
  26432. var startX = _item9.x - eachSpacing * mountOption.widthRatio / 2;
  26433. var height = opts.height - _item9.y - opts.area[2];
  26434. context.beginPath();
  26435. var fillColor = _item9.color || series[_i18].color;
  26436. var strokeColor = _item9.color || series[_i18].color;
  26437. if (mountOption.linearType !== 'none') {
  26438. var grd = context.createLinearGradient(startX, _item9.y, startX, zeroPoints);
  26439. //透明渐变
  26440. if (mountOption.linearType == 'opacity') {
  26441. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26442. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26443. } else {
  26444. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  26445. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  26446. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26447. }
  26448. fillColor = grd;
  26449. }
  26450. context.moveTo(startX, zeroPoints);
  26451. context.lineTo(_item9.x, _item9.y);
  26452. context.lineTo(startX + _item9.width, zeroPoints);
  26453. context.setStrokeStyle(strokeColor);
  26454. context.setFillStyle(fillColor);
  26455. if (mountOption.borderWidth > 0) {
  26456. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26457. context.stroke();
  26458. }
  26459. context.fill();
  26460. }
  26461. }
  26462. ;
  26463. break;
  26464. case 'mount':
  26465. for (var _i19 = 0; _i19 < points.length; _i19++) {
  26466. var _item10 = points[_i19];
  26467. if (_item10 !== null && _i19 > leftNum && _i19 < rightNum) {
  26468. var startX = _item10.x - eachSpacing * mountOption.widthRatio / 2;
  26469. var height = opts.height - _item10.y - opts.area[2];
  26470. context.beginPath();
  26471. var fillColor = _item10.color || series[_i19].color;
  26472. var strokeColor = _item10.color || series[_i19].color;
  26473. if (mountOption.linearType !== 'none') {
  26474. var grd = context.createLinearGradient(startX, _item10.y, startX, zeroPoints);
  26475. //透明渐变
  26476. if (mountOption.linearType == 'opacity') {
  26477. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26478. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26479. } else {
  26480. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  26481. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  26482. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26483. }
  26484. fillColor = grd;
  26485. }
  26486. context.moveTo(startX, zeroPoints);
  26487. context.bezierCurveTo(_item10.x - _item10.width / 4, zeroPoints, _item10.x - _item10.width / 4, _item10.y, _item10.x, _item10.y);
  26488. context.bezierCurveTo(_item10.x + _item10.width / 4, _item10.y, _item10.x + _item10.width / 4, zeroPoints, startX + _item10.width, zeroPoints);
  26489. context.setStrokeStyle(strokeColor);
  26490. context.setFillStyle(fillColor);
  26491. if (mountOption.borderWidth > 0) {
  26492. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26493. context.stroke();
  26494. }
  26495. context.fill();
  26496. }
  26497. }
  26498. ;
  26499. break;
  26500. case 'sharp':
  26501. for (var _i20 = 0; _i20 < points.length; _i20++) {
  26502. var _item11 = points[_i20];
  26503. if (_item11 !== null && _i20 > leftNum && _i20 < rightNum) {
  26504. var startX = _item11.x - eachSpacing * mountOption.widthRatio / 2;
  26505. var height = opts.height - _item11.y - opts.area[2];
  26506. context.beginPath();
  26507. var fillColor = _item11.color || series[_i20].color;
  26508. var strokeColor = _item11.color || series[_i20].color;
  26509. if (mountOption.linearType !== 'none') {
  26510. var grd = context.createLinearGradient(startX, _item11.y, startX, zeroPoints);
  26511. //透明渐变
  26512. if (mountOption.linearType == 'opacity') {
  26513. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26514. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26515. } else {
  26516. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  26517. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  26518. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26519. }
  26520. fillColor = grd;
  26521. }
  26522. context.moveTo(startX, zeroPoints);
  26523. context.quadraticCurveTo(_item11.x - 0, zeroPoints - height / 4, _item11.x, _item11.y);
  26524. context.quadraticCurveTo(_item11.x + 0, zeroPoints - height / 4, startX + _item11.width, zeroPoints);
  26525. context.setStrokeStyle(strokeColor);
  26526. context.setFillStyle(fillColor);
  26527. if (mountOption.borderWidth > 0) {
  26528. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26529. context.stroke();
  26530. }
  26531. context.fill();
  26532. }
  26533. }
  26534. ;
  26535. break;
  26536. }
  26537. if (opts.dataLabel !== false && process === 1) {
  26538. var _ranges, _minRange, _maxRange;
  26539. _ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  26540. _minRange = _ranges.pop();
  26541. _maxRange = _ranges.shift();
  26542. var points = getMountDataPoints(series, _minRange, _maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
  26543. drawMountPointText(points, series, config, context, opts, zeroPoints);
  26544. }
  26545. context.restore();
  26546. return {
  26547. xAxisPoints: xAxisPoints,
  26548. calPoints: points,
  26549. eachSpacing: eachSpacing
  26550. };
  26551. }
  26552. function drawBarDataPoints(series, opts, config, context) {
  26553. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26554. var yAxisPoints = [];
  26555. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / opts.categories.length;
  26556. for (var i = 0; i < opts.categories.length; i++) {
  26557. yAxisPoints.push(opts.area[0] + eachSpacing / 2 + eachSpacing * i);
  26558. }
  26559. var columnOption = assign({}, {
  26560. type: 'group',
  26561. width: eachSpacing / 2,
  26562. meterBorder: 4,
  26563. meterFillColor: '#FFFFFF',
  26564. barBorderCircle: false,
  26565. barBorderRadius: [],
  26566. seriesGap: 2,
  26567. linearType: 'none',
  26568. linearOpacity: 1,
  26569. customColor: [],
  26570. colorStop: 0
  26571. }, opts.extra.bar);
  26572. var calPoints = [];
  26573. context.save();
  26574. var leftNum = -2;
  26575. var rightNum = yAxisPoints.length + 2;
  26576. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  26577. drawBarToolTipSplitArea(opts.tooltip.offset.y, opts, config, context, eachSpacing);
  26578. }
  26579. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  26580. series.forEach(function (eachSeries, seriesIndex) {
  26581. var ranges, minRange, maxRange;
  26582. ranges = [].concat(opts.chartData.xAxisData.ranges);
  26583. maxRange = ranges.pop();
  26584. minRange = ranges.shift();
  26585. var data = eachSeries.data;
  26586. switch (columnOption.type) {
  26587. case 'group':
  26588. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  26589. var tooltipPoints = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26590. calPoints.push(tooltipPoints);
  26591. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26592. for (var _i21 = 0; _i21 < points.length; _i21++) {
  26593. var item = points[_i21];
  26594. //fix issues/I27B1N yyoinge & Joeshu
  26595. if (item !== null && _i21 > leftNum && _i21 < rightNum) {
  26596. //var startX = item.x - item.width / 2;
  26597. var startX = opts.area[3];
  26598. var startY = item.y - item.width / 2;
  26599. var height = item.height;
  26600. context.beginPath();
  26601. var fillColor = item.color || eachSeries.color;
  26602. var strokeColor = item.color || eachSeries.color;
  26603. if (columnOption.linearType !== 'none') {
  26604. var grd = context.createLinearGradient(startX, item.y, item.x, item.y);
  26605. //透明渐变
  26606. if (columnOption.linearType == 'opacity') {
  26607. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  26608. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26609. } else {
  26610. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26611. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26612. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26613. }
  26614. fillColor = grd;
  26615. }
  26616. // 圆角边框
  26617. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  26618. var left = startX;
  26619. var width = item.width;
  26620. var top = item.y - item.width / 2;
  26621. var _height4 = item.height;
  26622. if (columnOption.barBorderCircle) {
  26623. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  26624. }
  26625. var _columnOption$barBord3 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  26626. r0 = _columnOption$barBord3[0],
  26627. r1 = _columnOption$barBord3[1],
  26628. r2 = _columnOption$barBord3[2],
  26629. r3 = _columnOption$barBord3[3];
  26630. var minRadius = Math.min(width / 2, _height4 / 2);
  26631. r0 = r0 > minRadius ? minRadius : r0;
  26632. r1 = r1 > minRadius ? minRadius : r1;
  26633. r2 = r2 > minRadius ? minRadius : r2;
  26634. r3 = r3 > minRadius ? minRadius : r3;
  26635. r0 = r0 < 0 ? 0 : r0;
  26636. r1 = r1 < 0 ? 0 : r1;
  26637. r2 = r2 < 0 ? 0 : r2;
  26638. r3 = r3 < 0 ? 0 : r3;
  26639. context.arc(left + r3, top + r3, r3, -Math.PI, -Math.PI / 2);
  26640. context.arc(item.x - r0, top + r0, r0, -Math.PI / 2, 0);
  26641. context.arc(item.x - r1, top + width - r1, r1, 0, Math.PI / 2);
  26642. context.arc(left + r2, top + width - r2, r2, Math.PI / 2, Math.PI);
  26643. } else {
  26644. context.moveTo(startX, startY);
  26645. context.lineTo(item.x, startY);
  26646. context.lineTo(item.x, startY + item.width);
  26647. context.lineTo(startX, startY + item.width);
  26648. context.lineTo(startX, startY);
  26649. context.setLineWidth(1);
  26650. context.setStrokeStyle(strokeColor);
  26651. }
  26652. context.setFillStyle(fillColor);
  26653. context.closePath();
  26654. //context.stroke();
  26655. context.fill();
  26656. }
  26657. }
  26658. ;
  26659. break;
  26660. case 'stack':
  26661. // 绘制堆叠数据图
  26662. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26663. calPoints.push(points);
  26664. points = fixBarStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  26665. for (var _i22 = 0; _i22 < points.length; _i22++) {
  26666. var _item12 = points[_i22];
  26667. if (_item12 !== null && _i22 > leftNum && _i22 < rightNum) {
  26668. context.beginPath();
  26669. var fillColor = _item12.color || eachSeries.color;
  26670. var startX = _item12.x0;
  26671. context.setFillStyle(fillColor);
  26672. context.moveTo(startX, _item12.y - _item12.width / 2);
  26673. context.fillRect(startX, _item12.y - _item12.width / 2, _item12.height, _item12.width);
  26674. context.closePath();
  26675. context.fill();
  26676. }
  26677. }
  26678. ;
  26679. break;
  26680. }
  26681. });
  26682. if (opts.dataLabel !== false && process === 1) {
  26683. series.forEach(function (eachSeries, seriesIndex) {
  26684. var ranges, minRange, maxRange;
  26685. ranges = [].concat(opts.chartData.xAxisData.ranges);
  26686. maxRange = ranges.pop();
  26687. minRange = ranges.shift();
  26688. var data = eachSeries.data;
  26689. switch (columnOption.type) {
  26690. case 'group':
  26691. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  26692. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26693. drawBarPointText(points, eachSeries, config, context, opts);
  26694. break;
  26695. case 'stack':
  26696. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26697. drawBarPointText(points, eachSeries, config, context, opts);
  26698. break;
  26699. }
  26700. });
  26701. }
  26702. return {
  26703. yAxisPoints: yAxisPoints,
  26704. calPoints: calPoints,
  26705. eachSpacing: eachSpacing
  26706. };
  26707. }
  26708. function drawCandleDataPoints(series, seriesMA, opts, config, context) {
  26709. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  26710. var candleOption = assign({}, {
  26711. color: {},
  26712. average: {}
  26713. }, opts.extra.candle);
  26714. candleOption.color = assign({}, {
  26715. upLine: '#f04864',
  26716. upFill: '#f04864',
  26717. downLine: '#2fc25b',
  26718. downFill: '#2fc25b'
  26719. }, candleOption.color);
  26720. candleOption.average = assign({}, {
  26721. show: false,
  26722. name: [],
  26723. day: [],
  26724. color: config.color
  26725. }, candleOption.average);
  26726. opts.extra.candle = candleOption;
  26727. var xAxisData = opts.chartData.xAxisData,
  26728. xAxisPoints = xAxisData.xAxisPoints,
  26729. eachSpacing = xAxisData.eachSpacing;
  26730. var calPoints = [];
  26731. context.save();
  26732. var leftNum = -2;
  26733. var rightNum = xAxisPoints.length + 2;
  26734. var leftSpace = 0;
  26735. var rightSpace = opts.width + eachSpacing;
  26736. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26737. context.translate(opts._scrollDistance_, 0);
  26738. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  26739. rightNum = leftNum + opts.xAxis.itemCount + 4;
  26740. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26741. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26742. }
  26743. //画均线
  26744. if (candleOption.average.show || seriesMA) {
  26745. //Merge pull request !12 from 邱贵翔
  26746. seriesMA.forEach(function (eachSeries, seriesIndex) {
  26747. var ranges, minRange, maxRange;
  26748. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26749. minRange = ranges.pop();
  26750. maxRange = ranges.shift();
  26751. var data = eachSeries.data;
  26752. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26753. var splitPointList = splitPoints(points, eachSeries);
  26754. for (var i = 0; i < splitPointList.length; i++) {
  26755. var _points = splitPointList[i];
  26756. context.beginPath();
  26757. context.setStrokeStyle(eachSeries.color);
  26758. context.setLineWidth(1);
  26759. if (_points.length === 1) {
  26760. context.moveTo(_points[0].x, _points[0].y);
  26761. context.arc(_points[0].x, _points[0].y, 1, 0, 2 * Math.PI);
  26762. } else {
  26763. context.moveTo(_points[0].x, _points[0].y);
  26764. var startPoint = 0;
  26765. for (var j = 0; j < _points.length; j++) {
  26766. var item = _points[j];
  26767. if (startPoint == 0 && item.x > leftSpace) {
  26768. context.moveTo(item.x, item.y);
  26769. startPoint = 1;
  26770. }
  26771. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  26772. var ctrlPoint = createCurveControlPoints(_points, j - 1);
  26773. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  26774. }
  26775. }
  26776. context.moveTo(_points[0].x, _points[0].y);
  26777. }
  26778. context.closePath();
  26779. context.stroke();
  26780. }
  26781. });
  26782. }
  26783. //画K线
  26784. series.forEach(function (eachSeries, seriesIndex) {
  26785. var ranges, minRange, maxRange;
  26786. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26787. minRange = ranges.pop();
  26788. maxRange = ranges.shift();
  26789. var data = eachSeries.data;
  26790. var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26791. calPoints.push(points);
  26792. var splitPointList = splitPoints(points, eachSeries);
  26793. for (var i = 0; i < splitPointList[0].length; i++) {
  26794. if (i > leftNum && i < rightNum) {
  26795. var item = splitPointList[0][i];
  26796. context.beginPath();
  26797. //如果上涨
  26798. if (data[i][1] - data[i][0] > 0) {
  26799. context.setStrokeStyle(candleOption.color.upLine);
  26800. context.setFillStyle(candleOption.color.upFill);
  26801. context.setLineWidth(1 * opts.pix);
  26802. context.moveTo(item[3].x, item[3].y); //顶点
  26803. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26804. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  26805. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  26806. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26807. context.lineTo(item[2].x, item[2].y); //底点
  26808. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26809. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  26810. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  26811. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26812. context.moveTo(item[3].x, item[3].y); //顶点
  26813. } else {
  26814. context.setStrokeStyle(candleOption.color.downLine);
  26815. context.setFillStyle(candleOption.color.downFill);
  26816. context.setLineWidth(1 * opts.pix);
  26817. context.moveTo(item[3].x, item[3].y); //顶点
  26818. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26819. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  26820. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  26821. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26822. context.lineTo(item[2].x, item[2].y); //底点
  26823. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26824. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  26825. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  26826. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26827. context.moveTo(item[3].x, item[3].y); //顶点
  26828. }
  26829. context.closePath();
  26830. context.fill();
  26831. context.stroke();
  26832. }
  26833. }
  26834. });
  26835. context.restore();
  26836. return {
  26837. xAxisPoints: xAxisPoints,
  26838. calPoints: calPoints,
  26839. eachSpacing: eachSpacing
  26840. };
  26841. }
  26842. function drawAreaDataPoints(series, opts, config, context) {
  26843. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26844. var areaOption = assign({}, {
  26845. type: 'straight',
  26846. opacity: 0.2,
  26847. addLine: false,
  26848. width: 2,
  26849. gradient: false,
  26850. activeType: 'none'
  26851. }, opts.extra.area);
  26852. var xAxisData = opts.chartData.xAxisData,
  26853. xAxisPoints = xAxisData.xAxisPoints,
  26854. eachSpacing = xAxisData.eachSpacing;
  26855. var endY = opts.height - opts.area[2];
  26856. var calPoints = [];
  26857. context.save();
  26858. var leftSpace = 0;
  26859. var rightSpace = opts.width + eachSpacing;
  26860. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26861. context.translate(opts._scrollDistance_, 0);
  26862. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26863. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26864. }
  26865. series.forEach(function (eachSeries, seriesIndex) {
  26866. var ranges, minRange, maxRange;
  26867. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26868. minRange = ranges.pop();
  26869. maxRange = ranges.shift();
  26870. var data = eachSeries.data;
  26871. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26872. calPoints.push(points);
  26873. var splitPointList = splitPoints(points, eachSeries);
  26874. for (var i = 0; i < splitPointList.length; i++) {
  26875. var _points2 = splitPointList[i];
  26876. // 绘制区域数
  26877. context.beginPath();
  26878. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  26879. if (areaOption.gradient) {
  26880. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  26881. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  26882. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  26883. context.setFillStyle(gradient);
  26884. } else {
  26885. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  26886. }
  26887. context.setLineWidth(areaOption.width * opts.pix);
  26888. if (_points2.length > 1) {
  26889. var firstPoint = _points2[0];
  26890. var lastPoint = _points2[_points2.length - 1];
  26891. context.moveTo(firstPoint.x, firstPoint.y);
  26892. var startPoint = 0;
  26893. if (areaOption.type === 'curve') {
  26894. for (var j = 0; j < _points2.length; j++) {
  26895. var item = _points2[j];
  26896. if (startPoint == 0 && item.x > leftSpace) {
  26897. context.moveTo(item.x, item.y);
  26898. startPoint = 1;
  26899. }
  26900. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  26901. var ctrlPoint = createCurveControlPoints(_points2, j - 1);
  26902. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  26903. }
  26904. }
  26905. ;
  26906. }
  26907. if (areaOption.type === 'straight') {
  26908. for (var _j = 0; _j < _points2.length; _j++) {
  26909. var _item13 = _points2[_j];
  26910. if (startPoint == 0 && _item13.x > leftSpace) {
  26911. context.moveTo(_item13.x, _item13.y);
  26912. startPoint = 1;
  26913. }
  26914. if (_j > 0 && _item13.x > leftSpace && _item13.x < rightSpace) {
  26915. context.lineTo(_item13.x, _item13.y);
  26916. }
  26917. }
  26918. ;
  26919. }
  26920. if (areaOption.type === 'step') {
  26921. for (var _j2 = 0; _j2 < _points2.length; _j2++) {
  26922. var _item14 = _points2[_j2];
  26923. if (startPoint == 0 && _item14.x > leftSpace) {
  26924. context.moveTo(_item14.x, _item14.y);
  26925. startPoint = 1;
  26926. }
  26927. if (_j2 > 0 && _item14.x > leftSpace && _item14.x < rightSpace) {
  26928. context.lineTo(_item14.x, _points2[_j2 - 1].y);
  26929. context.lineTo(_item14.x, _item14.y);
  26930. }
  26931. }
  26932. ;
  26933. }
  26934. context.lineTo(lastPoint.x, endY);
  26935. context.lineTo(firstPoint.x, endY);
  26936. context.lineTo(firstPoint.x, firstPoint.y);
  26937. } else {
  26938. var _item15 = _points2[0];
  26939. context.moveTo(_item15.x - eachSpacing / 2, _item15.y);
  26940. // context.lineTo(item.x + eachSpacing / 2, item.y);
  26941. // context.lineTo(item.x + eachSpacing / 2, endY);
  26942. // context.lineTo(item.x - eachSpacing / 2, endY);
  26943. // context.moveTo(item.x - eachSpacing / 2, item.y);
  26944. }
  26945. context.closePath();
  26946. context.fill();
  26947. //画连线
  26948. if (areaOption.addLine) {
  26949. if (eachSeries.lineType == 'dash') {
  26950. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  26951. dashLength *= opts.pix;
  26952. context.setLineDash([dashLength, dashLength]);
  26953. }
  26954. context.beginPath();
  26955. context.setStrokeStyle(eachSeries.color);
  26956. context.setLineWidth(areaOption.width * opts.pix);
  26957. if (_points2.length === 1) {
  26958. context.moveTo(_points2[0].x, _points2[0].y);
  26959. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  26960. } else {
  26961. context.moveTo(_points2[0].x, _points2[0].y);
  26962. var _startPoint = 0;
  26963. if (areaOption.type === 'curve') {
  26964. for (var _j3 = 0; _j3 < _points2.length; _j3++) {
  26965. var _item16 = _points2[_j3];
  26966. if (_startPoint == 0 && _item16.x > leftSpace) {
  26967. context.moveTo(_item16.x, _item16.y);
  26968. _startPoint = 1;
  26969. }
  26970. if (_j3 > 0 && _item16.x > leftSpace && _item16.x < rightSpace) {
  26971. var _ctrlPoint = createCurveControlPoints(_points2, _j3 - 1);
  26972. context.bezierCurveTo(_ctrlPoint.ctrA.x, _ctrlPoint.ctrA.y, _ctrlPoint.ctrB.x, _ctrlPoint.ctrB.y, _item16.x, _item16.y);
  26973. }
  26974. }
  26975. ;
  26976. }
  26977. if (areaOption.type === 'straight') {
  26978. for (var _j4 = 0; _j4 < _points2.length; _j4++) {
  26979. var _item17 = _points2[_j4];
  26980. if (_startPoint == 0 && _item17.x > leftSpace) {
  26981. context.moveTo(_item17.x, _item17.y);
  26982. _startPoint = 1;
  26983. }
  26984. if (_j4 > 0 && _item17.x > leftSpace && _item17.x < rightSpace) {
  26985. context.lineTo(_item17.x, _item17.y);
  26986. }
  26987. }
  26988. ;
  26989. }
  26990. if (areaOption.type === 'step') {
  26991. for (var _j5 = 0; _j5 < _points2.length; _j5++) {
  26992. var _item18 = _points2[_j5];
  26993. if (_startPoint == 0 && _item18.x > leftSpace) {
  26994. context.moveTo(_item18.x, _item18.y);
  26995. _startPoint = 1;
  26996. }
  26997. if (_j5 > 0 && _item18.x > leftSpace && _item18.x < rightSpace) {
  26998. context.lineTo(_item18.x, _points2[_j5 - 1].y);
  26999. context.lineTo(_item18.x, _item18.y);
  27000. }
  27001. }
  27002. ;
  27003. }
  27004. context.moveTo(_points2[0].x, _points2[0].y);
  27005. }
  27006. context.stroke();
  27007. context.setLineDash([]);
  27008. }
  27009. }
  27010. //画点
  27011. if (opts.dataPointShape !== false) {
  27012. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  27013. }
  27014. drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, areaOption, seriesIndex);
  27015. });
  27016. if (opts.dataLabel !== false && process === 1) {
  27017. series.forEach(function (eachSeries, seriesIndex) {
  27018. var ranges, minRange, maxRange;
  27019. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27020. minRange = ranges.pop();
  27021. maxRange = ranges.shift();
  27022. var data = eachSeries.data;
  27023. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27024. drawPointText(points, eachSeries, config, context, opts);
  27025. });
  27026. }
  27027. context.restore();
  27028. return {
  27029. xAxisPoints: xAxisPoints,
  27030. calPoints: calPoints,
  27031. eachSpacing: eachSpacing
  27032. };
  27033. }
  27034. function drawScatterDataPoints(series, opts, config, context) {
  27035. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27036. var scatterOption = assign({}, {
  27037. type: 'circle'
  27038. }, opts.extra.scatter);
  27039. var xAxisData = opts.chartData.xAxisData,
  27040. xAxisPoints = xAxisData.xAxisPoints,
  27041. eachSpacing = xAxisData.eachSpacing;
  27042. var calPoints = [];
  27043. context.save();
  27044. var leftSpace = 0;
  27045. var rightSpace = opts.width + eachSpacing;
  27046. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27047. context.translate(opts._scrollDistance_, 0);
  27048. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  27049. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  27050. }
  27051. series.forEach(function (eachSeries, seriesIndex) {
  27052. var ranges, minRange, maxRange;
  27053. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27054. minRange = ranges.pop();
  27055. maxRange = ranges.shift();
  27056. var data = eachSeries.data;
  27057. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27058. context.beginPath();
  27059. context.setStrokeStyle(eachSeries.color);
  27060. context.setFillStyle(eachSeries.color);
  27061. context.setLineWidth(1 * opts.pix);
  27062. var shape = eachSeries.pointShape;
  27063. if (shape === 'diamond') {
  27064. points.forEach(function (item, index) {
  27065. if (item !== null) {
  27066. context.moveTo(item.x, item.y - 4.5);
  27067. context.lineTo(item.x - 4.5, item.y);
  27068. context.lineTo(item.x, item.y + 4.5);
  27069. context.lineTo(item.x + 4.5, item.y);
  27070. context.lineTo(item.x, item.y - 4.5);
  27071. }
  27072. });
  27073. } else if (shape === 'circle') {
  27074. points.forEach(function (item, index) {
  27075. if (item !== null) {
  27076. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  27077. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  27078. }
  27079. });
  27080. } else if (shape === 'square') {
  27081. points.forEach(function (item, index) {
  27082. if (item !== null) {
  27083. context.moveTo(item.x - 3.5, item.y - 3.5);
  27084. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  27085. }
  27086. });
  27087. } else if (shape === 'triangle') {
  27088. points.forEach(function (item, index) {
  27089. if (item !== null) {
  27090. context.moveTo(item.x, item.y - 4.5);
  27091. context.lineTo(item.x - 4.5, item.y + 4.5);
  27092. context.lineTo(item.x + 4.5, item.y + 4.5);
  27093. context.lineTo(item.x, item.y - 4.5);
  27094. }
  27095. });
  27096. } else if (shape === 'triangle') {
  27097. return;
  27098. }
  27099. context.closePath();
  27100. context.fill();
  27101. context.stroke();
  27102. });
  27103. if (opts.dataLabel !== false && process === 1) {
  27104. series.forEach(function (eachSeries, seriesIndex) {
  27105. var ranges, minRange, maxRange;
  27106. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27107. minRange = ranges.pop();
  27108. maxRange = ranges.shift();
  27109. var data = eachSeries.data;
  27110. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27111. drawPointText(points, eachSeries, config, context, opts);
  27112. });
  27113. }
  27114. context.restore();
  27115. return {
  27116. xAxisPoints: xAxisPoints,
  27117. calPoints: calPoints,
  27118. eachSpacing: eachSpacing
  27119. };
  27120. }
  27121. function drawBubbleDataPoints(series, opts, config, context) {
  27122. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27123. var bubbleOption = assign({}, {
  27124. opacity: 1,
  27125. border: 2
  27126. }, opts.extra.bubble);
  27127. var xAxisData = opts.chartData.xAxisData,
  27128. xAxisPoints = xAxisData.xAxisPoints,
  27129. eachSpacing = xAxisData.eachSpacing;
  27130. var calPoints = [];
  27131. context.save();
  27132. var leftSpace = 0;
  27133. var rightSpace = opts.width + eachSpacing;
  27134. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27135. context.translate(opts._scrollDistance_, 0);
  27136. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  27137. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  27138. }
  27139. series.forEach(function (eachSeries, seriesIndex) {
  27140. var ranges, minRange, maxRange;
  27141. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27142. minRange = ranges.pop();
  27143. maxRange = ranges.shift();
  27144. var data = eachSeries.data;
  27145. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27146. context.beginPath();
  27147. context.setStrokeStyle(eachSeries.color);
  27148. context.setLineWidth(bubbleOption.border * opts.pix);
  27149. context.setFillStyle(hexToRgb(eachSeries.color, bubbleOption.opacity));
  27150. points.forEach(function (item, index) {
  27151. context.moveTo(item.x + item.r, item.y);
  27152. context.arc(item.x, item.y, item.r * opts.pix, 0, 2 * Math.PI, false);
  27153. });
  27154. context.closePath();
  27155. context.fill();
  27156. context.stroke();
  27157. if (opts.dataLabel !== false && process === 1) {
  27158. points.forEach(function (item, index) {
  27159. context.beginPath();
  27160. var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
  27161. context.setFontSize(fontSize);
  27162. context.setFillStyle(eachSeries.textColor || "#FFFFFF");
  27163. context.setTextAlign('center');
  27164. context.fillText(String(item.t), item.x, item.y + fontSize / 2);
  27165. context.closePath();
  27166. context.stroke();
  27167. context.setTextAlign('left');
  27168. });
  27169. }
  27170. });
  27171. context.restore();
  27172. return {
  27173. xAxisPoints: xAxisPoints,
  27174. calPoints: calPoints,
  27175. eachSpacing: eachSpacing
  27176. };
  27177. }
  27178. function drawLineDataPoints(series, opts, config, context) {
  27179. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27180. var lineOption = assign({}, {
  27181. type: 'straight',
  27182. width: 2,
  27183. activeType: 'none',
  27184. linearType: 'none',
  27185. onShadow: false,
  27186. animation: 'vertical'
  27187. }, opts.extra.line);
  27188. lineOption.width *= opts.pix;
  27189. var xAxisData = opts.chartData.xAxisData,
  27190. xAxisPoints = xAxisData.xAxisPoints,
  27191. eachSpacing = xAxisData.eachSpacing;
  27192. var calPoints = [];
  27193. context.save();
  27194. var leftSpace = 0;
  27195. var rightSpace = opts.width + eachSpacing;
  27196. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27197. context.translate(opts._scrollDistance_, 0);
  27198. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  27199. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  27200. }
  27201. series.forEach(function (eachSeries, seriesIndex) {
  27202. // 这段很神奇的代码用于解决ios16的setStrokeStyle失效的bug
  27203. context.beginPath();
  27204. context.setStrokeStyle(eachSeries.color);
  27205. context.moveTo(-10000, -10000);
  27206. context.lineTo(-10001, -10001);
  27207. context.stroke();
  27208. var ranges, minRange, maxRange;
  27209. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27210. minRange = ranges.pop();
  27211. maxRange = ranges.shift();
  27212. var data = eachSeries.data;
  27213. var points = getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process);
  27214. calPoints.push(points);
  27215. var splitPointList = splitPoints(points, eachSeries);
  27216. if (eachSeries.lineType == 'dash') {
  27217. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  27218. dashLength *= opts.pix;
  27219. context.setLineDash([dashLength, dashLength]);
  27220. }
  27221. context.beginPath();
  27222. var strokeColor = eachSeries.color;
  27223. if (lineOption.linearType !== 'none' && eachSeries.linearColor && eachSeries.linearColor.length > 0) {
  27224. var grd = context.createLinearGradient(opts.chartData.xAxisData.startX, opts.height / 2, opts.chartData.xAxisData.endX, opts.height / 2);
  27225. for (var i = 0; i < eachSeries.linearColor.length; i++) {
  27226. grd.addColorStop(eachSeries.linearColor[i][0], hexToRgb(eachSeries.linearColor[i][1], 1));
  27227. }
  27228. strokeColor = grd;
  27229. }
  27230. context.setStrokeStyle(strokeColor);
  27231. if (lineOption.onShadow == true && eachSeries.setShadow && eachSeries.setShadow.length > 0) {
  27232. context.setShadow(eachSeries.setShadow[0], eachSeries.setShadow[1], eachSeries.setShadow[2], eachSeries.setShadow[3]);
  27233. } else {
  27234. context.setShadow(0, 0, 0, 'rgba(0,0,0,0)');
  27235. }
  27236. context.setLineWidth(lineOption.width);
  27237. splitPointList.forEach(function (points, index) {
  27238. if (points.length === 1) {
  27239. context.moveTo(points[0].x, points[0].y);
  27240. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  27241. } else {
  27242. context.moveTo(points[0].x, points[0].y);
  27243. var startPoint = 0;
  27244. if (lineOption.type === 'curve') {
  27245. for (var j = 0; j < points.length; j++) {
  27246. var item = points[j];
  27247. if (startPoint == 0 && item.x > leftSpace) {
  27248. context.moveTo(item.x, item.y);
  27249. startPoint = 1;
  27250. }
  27251. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  27252. var ctrlPoint = createCurveControlPoints(points, j - 1);
  27253. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  27254. }
  27255. }
  27256. ;
  27257. }
  27258. if (lineOption.type === 'straight') {
  27259. for (var _j6 = 0; _j6 < points.length; _j6++) {
  27260. var _item19 = points[_j6];
  27261. if (startPoint == 0 && _item19.x > leftSpace) {
  27262. context.moveTo(_item19.x, _item19.y);
  27263. startPoint = 1;
  27264. }
  27265. if (_j6 > 0 && _item19.x > leftSpace && _item19.x < rightSpace) {
  27266. context.lineTo(_item19.x, _item19.y);
  27267. }
  27268. }
  27269. ;
  27270. }
  27271. if (lineOption.type === 'step') {
  27272. for (var _j7 = 0; _j7 < points.length; _j7++) {
  27273. var _item20 = points[_j7];
  27274. if (startPoint == 0 && _item20.x > leftSpace) {
  27275. context.moveTo(_item20.x, _item20.y);
  27276. startPoint = 1;
  27277. }
  27278. if (_j7 > 0 && _item20.x > leftSpace && _item20.x < rightSpace) {
  27279. context.lineTo(_item20.x, points[_j7 - 1].y);
  27280. context.lineTo(_item20.x, _item20.y);
  27281. }
  27282. }
  27283. ;
  27284. }
  27285. context.moveTo(points[0].x, points[0].y);
  27286. }
  27287. });
  27288. context.stroke();
  27289. context.setLineDash([]);
  27290. if (opts.dataPointShape !== false) {
  27291. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  27292. }
  27293. drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, lineOption);
  27294. });
  27295. if (opts.dataLabel !== false && process === 1) {
  27296. series.forEach(function (eachSeries, seriesIndex) {
  27297. var ranges, minRange, maxRange;
  27298. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27299. minRange = ranges.pop();
  27300. maxRange = ranges.shift();
  27301. var data = eachSeries.data;
  27302. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27303. drawPointText(points, eachSeries, config, context, opts);
  27304. });
  27305. }
  27306. context.restore();
  27307. return {
  27308. xAxisPoints: xAxisPoints,
  27309. calPoints: calPoints,
  27310. eachSpacing: eachSpacing
  27311. };
  27312. }
  27313. function drawMixDataPoints(series, opts, config, context) {
  27314. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27315. var xAxisData = opts.chartData.xAxisData,
  27316. xAxisPoints = xAxisData.xAxisPoints,
  27317. eachSpacing = xAxisData.eachSpacing;
  27318. var columnOption = assign({}, {
  27319. width: eachSpacing / 2,
  27320. barBorderCircle: false,
  27321. barBorderRadius: [],
  27322. seriesGap: 2,
  27323. linearType: 'none',
  27324. linearOpacity: 1,
  27325. customColor: [],
  27326. colorStop: 0
  27327. }, opts.extra.mix.column);
  27328. var areaOption = assign({}, {
  27329. opacity: 0.2,
  27330. gradient: false
  27331. }, opts.extra.mix.area);
  27332. var lineOption = assign({}, {
  27333. width: 2
  27334. }, opts.extra.mix.line);
  27335. var endY = opts.height - opts.area[2];
  27336. var calPoints = [];
  27337. var columnIndex = 0;
  27338. var columnLength = 0;
  27339. series.forEach(function (eachSeries, seriesIndex) {
  27340. if (eachSeries.type == 'column') {
  27341. columnLength += 1;
  27342. }
  27343. });
  27344. context.save();
  27345. var leftNum = -2;
  27346. var rightNum = xAxisPoints.length + 2;
  27347. var leftSpace = 0;
  27348. var rightSpace = opts.width + eachSpacing;
  27349. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27350. context.translate(opts._scrollDistance_, 0);
  27351. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  27352. rightNum = leftNum + opts.xAxis.itemCount + 4;
  27353. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  27354. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  27355. }
  27356. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  27357. series.forEach(function (eachSeries, seriesIndex) {
  27358. var ranges, minRange, maxRange;
  27359. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27360. minRange = ranges.pop();
  27361. maxRange = ranges.shift();
  27362. var data = eachSeries.data;
  27363. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27364. calPoints.push(points);
  27365. // 绘制柱状数据图
  27366. if (eachSeries.type == 'column') {
  27367. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  27368. for (var i = 0; i < points.length; i++) {
  27369. var item = points[i];
  27370. if (item !== null && i > leftNum && i < rightNum) {
  27371. var startX = item.x - item.width / 2;
  27372. var height = opts.height - item.y - opts.area[2];
  27373. context.beginPath();
  27374. var fillColor = item.color || eachSeries.color;
  27375. var strokeColor = item.color || eachSeries.color;
  27376. if (columnOption.linearType !== 'none') {
  27377. var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]);
  27378. //透明渐变
  27379. if (columnOption.linearType == 'opacity') {
  27380. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  27381. grd.addColorStop(1, hexToRgb(fillColor, 1));
  27382. } else {
  27383. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  27384. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  27385. grd.addColorStop(1, hexToRgb(fillColor, 1));
  27386. }
  27387. fillColor = grd;
  27388. }
  27389. // 圆角边框
  27390. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle) {
  27391. var left = startX;
  27392. var top = item.y;
  27393. var width = item.width;
  27394. var _height5 = opts.height - opts.area[2] - item.y;
  27395. if (columnOption.barBorderCircle) {
  27396. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  27397. }
  27398. var _columnOption$barBord4 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  27399. r0 = _columnOption$barBord4[0],
  27400. r1 = _columnOption$barBord4[1],
  27401. r2 = _columnOption$barBord4[2],
  27402. r3 = _columnOption$barBord4[3];
  27403. var minRadius = Math.min(width / 2, _height5 / 2);
  27404. r0 = r0 > minRadius ? minRadius : r0;
  27405. r1 = r1 > minRadius ? minRadius : r1;
  27406. r2 = r2 > minRadius ? minRadius : r2;
  27407. r3 = r3 > minRadius ? minRadius : r3;
  27408. r0 = r0 < 0 ? 0 : r0;
  27409. r1 = r1 < 0 ? 0 : r1;
  27410. r2 = r2 < 0 ? 0 : r2;
  27411. r3 = r3 < 0 ? 0 : r3;
  27412. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  27413. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  27414. context.arc(left + width - r2, top + _height5 - r2, r2, 0, Math.PI / 2);
  27415. context.arc(left + r3, top + _height5 - r3, r3, Math.PI / 2, Math.PI);
  27416. } else {
  27417. context.moveTo(startX, item.y);
  27418. context.lineTo(startX + item.width, item.y);
  27419. context.lineTo(startX + item.width, opts.height - opts.area[2]);
  27420. context.lineTo(startX, opts.height - opts.area[2]);
  27421. context.lineTo(startX, item.y);
  27422. context.setLineWidth(1);
  27423. context.setStrokeStyle(strokeColor);
  27424. }
  27425. context.setFillStyle(fillColor);
  27426. context.closePath();
  27427. context.fill();
  27428. }
  27429. }
  27430. columnIndex += 1;
  27431. }
  27432. //绘制区域图数据
  27433. if (eachSeries.type == 'area') {
  27434. var _splitPointList = splitPoints(points, eachSeries);
  27435. for (var _i23 = 0; _i23 < _splitPointList.length; _i23++) {
  27436. var _points3 = _splitPointList[_i23];
  27437. // 绘制区域数据
  27438. context.beginPath();
  27439. context.setStrokeStyle(eachSeries.color);
  27440. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  27441. if (areaOption.gradient) {
  27442. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  27443. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  27444. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  27445. context.setFillStyle(gradient);
  27446. } else {
  27447. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  27448. }
  27449. context.setLineWidth(2 * opts.pix);
  27450. if (_points3.length > 1) {
  27451. var firstPoint = _points3[0];
  27452. var lastPoint = _points3[_points3.length - 1];
  27453. context.moveTo(firstPoint.x, firstPoint.y);
  27454. var startPoint = 0;
  27455. if (eachSeries.style === 'curve') {
  27456. for (var j = 0; j < _points3.length; j++) {
  27457. var _item21 = _points3[j];
  27458. if (startPoint == 0 && _item21.x > leftSpace) {
  27459. context.moveTo(_item21.x, _item21.y);
  27460. startPoint = 1;
  27461. }
  27462. if (j > 0 && _item21.x > leftSpace && _item21.x < rightSpace) {
  27463. var ctrlPoint = createCurveControlPoints(_points3, j - 1);
  27464. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item21.x, _item21.y);
  27465. }
  27466. }
  27467. ;
  27468. } else {
  27469. for (var _j8 = 0; _j8 < _points3.length; _j8++) {
  27470. var _item22 = _points3[_j8];
  27471. if (startPoint == 0 && _item22.x > leftSpace) {
  27472. context.moveTo(_item22.x, _item22.y);
  27473. startPoint = 1;
  27474. }
  27475. if (_j8 > 0 && _item22.x > leftSpace && _item22.x < rightSpace) {
  27476. context.lineTo(_item22.x, _item22.y);
  27477. }
  27478. }
  27479. ;
  27480. }
  27481. context.lineTo(lastPoint.x, endY);
  27482. context.lineTo(firstPoint.x, endY);
  27483. context.lineTo(firstPoint.x, firstPoint.y);
  27484. } else {
  27485. var _item23 = _points3[0];
  27486. context.moveTo(_item23.x - eachSpacing / 2, _item23.y);
  27487. // context.lineTo(item.x + eachSpacing / 2, item.y);
  27488. // context.lineTo(item.x + eachSpacing / 2, endY);
  27489. // context.lineTo(item.x - eachSpacing / 2, endY);
  27490. // context.moveTo(item.x - eachSpacing / 2, item.y);
  27491. }
  27492. context.closePath();
  27493. context.fill();
  27494. }
  27495. }
  27496. // 绘制折线数据图
  27497. if (eachSeries.type == 'line') {
  27498. var splitPointList = splitPoints(points, eachSeries);
  27499. splitPointList.forEach(function (points, index) {
  27500. if (eachSeries.lineType == 'dash') {
  27501. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  27502. dashLength *= opts.pix;
  27503. context.setLineDash([dashLength, dashLength]);
  27504. }
  27505. context.beginPath();
  27506. context.setStrokeStyle(eachSeries.color);
  27507. context.setLineWidth(lineOption.width * opts.pix);
  27508. if (points.length === 1) {
  27509. context.moveTo(points[0].x, points[0].y);
  27510. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  27511. } else {
  27512. context.moveTo(points[0].x, points[0].y);
  27513. var _startPoint2 = 0;
  27514. if (eachSeries.style == 'curve') {
  27515. for (var _j9 = 0; _j9 < points.length; _j9++) {
  27516. var _item24 = points[_j9];
  27517. if (_startPoint2 == 0 && _item24.x > leftSpace) {
  27518. context.moveTo(_item24.x, _item24.y);
  27519. _startPoint2 = 1;
  27520. }
  27521. if (_j9 > 0 && _item24.x > leftSpace && _item24.x < rightSpace) {
  27522. var ctrlPoint = createCurveControlPoints(points, _j9 - 1);
  27523. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item24.x, _item24.y);
  27524. }
  27525. }
  27526. } else {
  27527. for (var _j10 = 0; _j10 < points.length; _j10++) {
  27528. var _item25 = points[_j10];
  27529. if (_startPoint2 == 0 && _item25.x > leftSpace) {
  27530. context.moveTo(_item25.x, _item25.y);
  27531. _startPoint2 = 1;
  27532. }
  27533. if (_j10 > 0 && _item25.x > leftSpace && _item25.x < rightSpace) {
  27534. context.lineTo(_item25.x, _item25.y);
  27535. }
  27536. }
  27537. }
  27538. context.moveTo(points[0].x, points[0].y);
  27539. }
  27540. context.stroke();
  27541. context.setLineDash([]);
  27542. });
  27543. }
  27544. // 绘制点数据图
  27545. if (eachSeries.type == 'point') {
  27546. eachSeries.addPoint = true;
  27547. }
  27548. if (eachSeries.addPoint == true && eachSeries.type !== 'column') {
  27549. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  27550. }
  27551. });
  27552. if (opts.dataLabel !== false && process === 1) {
  27553. var columnIndex = 0;
  27554. series.forEach(function (eachSeries, seriesIndex) {
  27555. var ranges, minRange, maxRange;
  27556. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27557. minRange = ranges.pop();
  27558. maxRange = ranges.shift();
  27559. var data = eachSeries.data;
  27560. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27561. if (eachSeries.type !== 'column') {
  27562. drawPointText(points, eachSeries, config, context, opts);
  27563. } else {
  27564. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  27565. drawPointText(points, eachSeries, config, context, opts);
  27566. columnIndex += 1;
  27567. }
  27568. });
  27569. }
  27570. context.restore();
  27571. return {
  27572. xAxisPoints: xAxisPoints,
  27573. calPoints: calPoints,
  27574. eachSpacing: eachSpacing
  27575. };
  27576. }
  27577. function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
  27578. var toolTipOption = opts.extra.tooltip || {};
  27579. if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'mount' || opts.type == 'candle' || opts.type == 'mix')) {
  27580. drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints);
  27581. }
  27582. context.save();
  27583. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27584. context.translate(opts._scrollDistance_, 0);
  27585. }
  27586. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  27587. drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
  27588. }
  27589. context.restore();
  27590. }
  27591. function drawXAxis(categories, opts, config, context) {
  27592. var xAxisData = opts.chartData.xAxisData,
  27593. xAxisPoints = xAxisData.xAxisPoints,
  27594. startX = xAxisData.startX,
  27595. endX = xAxisData.endX,
  27596. eachSpacing = xAxisData.eachSpacing;
  27597. var boundaryGap = 'center';
  27598. if (opts.type == 'bar' || opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  27599. boundaryGap = opts.xAxis.boundaryGap;
  27600. }
  27601. var startY = opts.height - opts.area[2];
  27602. var endY = opts.area[0];
  27603. //绘制滚动条
  27604. if (opts.enableScroll && opts.xAxis.scrollShow) {
  27605. var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
  27606. var scrollScreenWidth = endX - startX;
  27607. var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
  27608. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  27609. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  27610. scrollTotalWidth += (opts.extra.mount.widthRatio - 1) * eachSpacing;
  27611. }
  27612. var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
  27613. var scrollLeft = 0;
  27614. if (opts._scrollDistance_) {
  27615. scrollLeft = -opts._scrollDistance_ * scrollScreenWidth / scrollTotalWidth;
  27616. }
  27617. context.beginPath();
  27618. context.setLineCap('round');
  27619. context.setLineWidth(6 * opts.pix);
  27620. context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
  27621. context.moveTo(startX, scrollY);
  27622. context.lineTo(endX, scrollY);
  27623. context.stroke();
  27624. context.closePath();
  27625. context.beginPath();
  27626. context.setLineCap('round');
  27627. context.setLineWidth(6 * opts.pix);
  27628. context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
  27629. context.moveTo(startX + scrollLeft, scrollY);
  27630. context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
  27631. context.stroke();
  27632. context.closePath();
  27633. context.setLineCap('butt');
  27634. }
  27635. context.save();
  27636. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  27637. context.translate(opts._scrollDistance_, 0);
  27638. }
  27639. //绘制X轴刻度线
  27640. if (opts.xAxis.calibration === true) {
  27641. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  27642. context.setLineCap('butt');
  27643. context.setLineWidth(1 * opts.pix);
  27644. xAxisPoints.forEach(function (item, index) {
  27645. if (index > 0) {
  27646. context.beginPath();
  27647. context.moveTo(item - eachSpacing / 2, startY);
  27648. context.lineTo(item - eachSpacing / 2, startY + 3 * opts.pix);
  27649. context.closePath();
  27650. context.stroke();
  27651. }
  27652. });
  27653. }
  27654. //绘制X轴网格
  27655. if (opts.xAxis.disableGrid !== true) {
  27656. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  27657. context.setLineCap('butt');
  27658. context.setLineWidth(1 * opts.pix);
  27659. if (opts.xAxis.gridType == 'dash') {
  27660. context.setLineDash([opts.xAxis.dashLength * opts.pix, opts.xAxis.dashLength * opts.pix]);
  27661. }
  27662. opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
  27663. xAxisPoints.forEach(function (item, index) {
  27664. if (index % opts.xAxis.gridEval == 0) {
  27665. context.beginPath();
  27666. context.moveTo(item, startY);
  27667. context.lineTo(item, endY);
  27668. context.stroke();
  27669. }
  27670. });
  27671. context.setLineDash([]);
  27672. }
  27673. //绘制X轴文案
  27674. if (opts.xAxis.disabled !== true) {
  27675. // 对X轴列表做抽稀处理
  27676. //默认全部显示X轴标签
  27677. var maxXAxisListLength = categories.length;
  27678. //如果设置了X轴单屏数量
  27679. if (opts.xAxis.labelCount) {
  27680. //如果设置X轴密度
  27681. if (opts.xAxis.itemCount) {
  27682. maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
  27683. } else {
  27684. maxXAxisListLength = opts.xAxis.labelCount;
  27685. }
  27686. maxXAxisListLength -= 1;
  27687. }
  27688. var ratio = Math.ceil(categories.length / maxXAxisListLength);
  27689. var newCategories = [];
  27690. var cgLength = categories.length;
  27691. for (var i = 0; i < cgLength; i++) {
  27692. if (i % ratio !== 0) {
  27693. newCategories.push("");
  27694. } else {
  27695. newCategories.push(categories[i]);
  27696. }
  27697. }
  27698. newCategories[cgLength - 1] = categories[cgLength - 1];
  27699. var xAxisFontSize = opts.xAxis.fontSize * opts.pix || config.fontSize;
  27700. if (config._xAxisTextAngle_ === 0) {
  27701. newCategories.forEach(function (item, index) {
  27702. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  27703. var offset = -measureText(String(xitem), xAxisFontSize, context) / 2;
  27704. if (boundaryGap == 'center') {
  27705. offset += eachSpacing / 2;
  27706. }
  27707. var scrollHeight = 0;
  27708. if (opts.xAxis.scrollShow) {
  27709. scrollHeight = 6 * opts.pix;
  27710. }
  27711. // 如果在主视图区域内
  27712. var _scrollDistance_ = opts._scrollDistance_ || 0;
  27713. var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
  27714. if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
  27715. context.beginPath();
  27716. context.setFontSize(xAxisFontSize);
  27717. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  27718. context.fillText(String(xitem), xAxisPoints[index] + offset, startY + opts.xAxis.marginTop * opts.pix + (opts.xAxis.lineHeight - opts.xAxis.fontSize) * opts.pix / 2 + opts.xAxis.fontSize * opts.pix);
  27719. context.closePath();
  27720. context.stroke();
  27721. }
  27722. });
  27723. } else {
  27724. newCategories.forEach(function (item, index) {
  27725. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item) : item;
  27726. // 如果在主视图区域内
  27727. var _scrollDistance_ = opts._scrollDistance_ || 0;
  27728. var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
  27729. if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
  27730. context.save();
  27731. context.beginPath();
  27732. context.setFontSize(xAxisFontSize);
  27733. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  27734. var textWidth = measureText(String(xitem), xAxisFontSize, context);
  27735. var offsetX = xAxisPoints[index];
  27736. if (boundaryGap == 'center') {
  27737. offsetX = xAxisPoints[index] + eachSpacing / 2;
  27738. }
  27739. var scrollHeight = 0;
  27740. if (opts.xAxis.scrollShow) {
  27741. scrollHeight = 6 * opts.pix;
  27742. }
  27743. var offsetY = startY + opts.xAxis.marginTop * opts.pix + xAxisFontSize - xAxisFontSize * Math.abs(Math.sin(config._xAxisTextAngle_));
  27744. if (opts.xAxis.rotateAngle < 0) {
  27745. offsetX -= xAxisFontSize / 2;
  27746. textWidth = 0;
  27747. } else {
  27748. offsetX += xAxisFontSize / 2;
  27749. textWidth = -textWidth;
  27750. }
  27751. context.translate(offsetX, offsetY);
  27752. context.rotate(-1 * config._xAxisTextAngle_);
  27753. context.fillText(String(xitem), textWidth, 0);
  27754. context.closePath();
  27755. context.stroke();
  27756. context.restore();
  27757. }
  27758. });
  27759. }
  27760. }
  27761. context.restore();
  27762. //画X轴标题
  27763. if (opts.xAxis.title) {
  27764. context.beginPath();
  27765. context.setFontSize(opts.xAxis.titleFontSize * opts.pix);
  27766. context.setFillStyle(opts.xAxis.titleFontColor);
  27767. context.fillText(String(opts.xAxis.title), opts.width - opts.area[1] + opts.xAxis.titleOffsetX * opts.pix, opts.height - opts.area[2] + opts.xAxis.marginTop * opts.pix + (opts.xAxis.lineHeight - opts.xAxis.titleFontSize) * opts.pix / 2 + (opts.xAxis.titleFontSize + opts.xAxis.titleOffsetY) * opts.pix);
  27768. context.closePath();
  27769. context.stroke();
  27770. }
  27771. //绘制X轴轴线
  27772. if (opts.xAxis.axisLine) {
  27773. context.beginPath();
  27774. context.setStrokeStyle(opts.xAxis.axisLineColor);
  27775. context.setLineWidth(1 * opts.pix);
  27776. context.moveTo(startX, opts.height - opts.area[2]);
  27777. context.lineTo(endX, opts.height - opts.area[2]);
  27778. context.stroke();
  27779. }
  27780. }
  27781. function drawYAxisGrid(categories, opts, config, context) {
  27782. if (opts.yAxis.disableGrid === true) {
  27783. return;
  27784. }
  27785. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  27786. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  27787. var startX = opts.area[3];
  27788. var xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  27789. xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing;
  27790. var TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1);
  27791. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  27792. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  27793. TotalWidth += (opts.extra.mount.widthRatio - 1) * xAxiseachSpacing;
  27794. }
  27795. var endX = startX + TotalWidth;
  27796. var points = [];
  27797. var startY = 1;
  27798. if (opts.xAxis.axisLine === false) {
  27799. startY = 0;
  27800. }
  27801. for (var i = startY; i < opts.yAxis.splitNumber + 1; i++) {
  27802. points.push(opts.height - opts.area[2] - eachSpacing * i);
  27803. }
  27804. context.save();
  27805. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  27806. context.translate(opts._scrollDistance_, 0);
  27807. }
  27808. if (opts.yAxis.gridType == 'dash') {
  27809. context.setLineDash([opts.yAxis.dashLength * opts.pix, opts.yAxis.dashLength * opts.pix]);
  27810. }
  27811. context.setStrokeStyle(opts.yAxis.gridColor);
  27812. context.setLineWidth(1 * opts.pix);
  27813. points.forEach(function (item, index) {
  27814. context.beginPath();
  27815. context.moveTo(startX, item);
  27816. context.lineTo(endX, item);
  27817. context.stroke();
  27818. });
  27819. context.setLineDash([]);
  27820. context.restore();
  27821. }
  27822. function drawYAxis(series, opts, config, context) {
  27823. if (opts.yAxis.disabled === true) {
  27824. return;
  27825. }
  27826. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  27827. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  27828. var startX = opts.area[3];
  27829. var endX = opts.width - opts.area[1];
  27830. var endY = opts.height - opts.area[2];
  27831. // set YAxis background
  27832. context.beginPath();
  27833. context.setFillStyle(opts.background);
  27834. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'left') {
  27835. context.fillRect(0, 0, startX, endY + 2 * opts.pix);
  27836. }
  27837. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'right') {
  27838. context.fillRect(endX, 0, opts.width, endY + 2 * opts.pix);
  27839. }
  27840. context.closePath();
  27841. context.stroke();
  27842. var tStartLeft = opts.area[3];
  27843. var tStartRight = opts.width - opts.area[1];
  27844. var tStartCenter = opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2;
  27845. if (opts.yAxis.data) {
  27846. var _loop4 = function _loop4(i) {
  27847. var yData = opts.yAxis.data[i];
  27848. points = [];
  27849. if (yData.type === 'categories') {
  27850. for (var _i24 = 0; _i24 <= yData.categories.length; _i24++) {
  27851. points.push(opts.area[0] + spacingValid / yData.categories.length / 2 + spacingValid / yData.categories.length * _i24);
  27852. }
  27853. } else {
  27854. for (var _i25 = 0; _i25 <= opts.yAxis.splitNumber; _i25++) {
  27855. points.push(opts.area[0] + eachSpacing * _i25);
  27856. }
  27857. }
  27858. if (yData.disabled !== true) {
  27859. var rangesFormat = opts.chartData.yAxisData.rangesFormat[i];
  27860. var yAxisFontSize = yData.fontSize ? yData.fontSize * opts.pix : config.fontSize;
  27861. var yAxisWidth = opts.chartData.yAxisData.yAxisWidth[i];
  27862. var textAlign = yData.textAlign || "right";
  27863. //画Y轴刻度及文案
  27864. rangesFormat.forEach(function (item, index) {
  27865. var pos = points[index];
  27866. context.beginPath();
  27867. context.setFontSize(yAxisFontSize);
  27868. context.setLineWidth(1 * opts.pix);
  27869. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  27870. context.setFillStyle(yData.fontColor || opts.fontColor);
  27871. var tmpstrat = 0;
  27872. var gapwidth = 4 * opts.pix;
  27873. if (yAxisWidth.position == 'left') {
  27874. //画刻度线
  27875. if (yData.calibration == true) {
  27876. context.moveTo(tStartLeft, pos);
  27877. context.lineTo(tStartLeft - 3 * opts.pix, pos);
  27878. gapwidth += 3 * opts.pix;
  27879. }
  27880. //画文字
  27881. switch (textAlign) {
  27882. case "left":
  27883. context.setTextAlign('left');
  27884. tmpstrat = tStartLeft - yAxisWidth.width;
  27885. break;
  27886. case "right":
  27887. context.setTextAlign('right');
  27888. tmpstrat = tStartLeft - gapwidth;
  27889. break;
  27890. default:
  27891. context.setTextAlign('center');
  27892. tmpstrat = tStartLeft - yAxisWidth.width / 2;
  27893. }
  27894. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  27895. } else if (yAxisWidth.position == 'right') {
  27896. //画刻度线
  27897. if (yData.calibration == true) {
  27898. context.moveTo(tStartRight, pos);
  27899. context.lineTo(tStartRight + 3 * opts.pix, pos);
  27900. gapwidth += 3 * opts.pix;
  27901. }
  27902. switch (textAlign) {
  27903. case "left":
  27904. context.setTextAlign('left');
  27905. tmpstrat = tStartRight + gapwidth;
  27906. break;
  27907. case "right":
  27908. context.setTextAlign('right');
  27909. tmpstrat = tStartRight + yAxisWidth.width;
  27910. break;
  27911. default:
  27912. context.setTextAlign('center');
  27913. tmpstrat = tStartRight + yAxisWidth.width / 2;
  27914. }
  27915. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  27916. } else if (yAxisWidth.position == 'center') {
  27917. //画刻度线
  27918. if (yData.calibration == true) {
  27919. context.moveTo(tStartCenter, pos);
  27920. context.lineTo(tStartCenter - 3 * opts.pix, pos);
  27921. gapwidth += 3 * opts.pix;
  27922. }
  27923. //画文字
  27924. switch (textAlign) {
  27925. case "left":
  27926. context.setTextAlign('left');
  27927. tmpstrat = tStartCenter - yAxisWidth.width;
  27928. break;
  27929. case "right":
  27930. context.setTextAlign('right');
  27931. tmpstrat = tStartCenter - gapwidth;
  27932. break;
  27933. default:
  27934. context.setTextAlign('center');
  27935. tmpstrat = tStartCenter - yAxisWidth.width / 2;
  27936. }
  27937. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  27938. }
  27939. context.closePath();
  27940. context.stroke();
  27941. context.setTextAlign('left');
  27942. });
  27943. //画Y轴轴线
  27944. if (yData.axisLine !== false) {
  27945. context.beginPath();
  27946. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  27947. context.setLineWidth(1 * opts.pix);
  27948. if (yAxisWidth.position == 'left') {
  27949. context.moveTo(tStartLeft, opts.height - opts.area[2]);
  27950. context.lineTo(tStartLeft, opts.area[0]);
  27951. } else if (yAxisWidth.position == 'right') {
  27952. context.moveTo(tStartRight, opts.height - opts.area[2]);
  27953. context.lineTo(tStartRight, opts.area[0]);
  27954. } else if (yAxisWidth.position == 'center') {
  27955. context.moveTo(tStartCenter, opts.height - opts.area[2]);
  27956. context.lineTo(tStartCenter, opts.area[0]);
  27957. }
  27958. context.stroke();
  27959. }
  27960. //画Y轴标题
  27961. if (opts.yAxis.showTitle) {
  27962. var titleFontSize = yData.titleFontSize * opts.pix || config.fontSize;
  27963. var title = yData.title;
  27964. context.beginPath();
  27965. context.setFontSize(titleFontSize);
  27966. context.setFillStyle(yData.titleFontColor || opts.fontColor);
  27967. if (yAxisWidth.position == 'left') {
  27968. context.fillText(title, tStartLeft - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  27969. } else if (yAxisWidth.position == 'right') {
  27970. context.fillText(title, tStartRight - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  27971. } else if (yAxisWidth.position == 'center') {
  27972. context.fillText(title, tStartCenter - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  27973. }
  27974. context.closePath();
  27975. context.stroke();
  27976. }
  27977. if (yAxisWidth.position == 'left') {
  27978. tStartLeft -= yAxisWidth.width + opts.yAxis.padding * opts.pix;
  27979. } else {
  27980. tStartRight += yAxisWidth.width + opts.yAxis.padding * opts.pix;
  27981. }
  27982. }
  27983. };
  27984. for (var i = 0; i < opts.yAxis.data.length; i++) {
  27985. var points;
  27986. _loop4(i);
  27987. }
  27988. }
  27989. }
  27990. function drawLegend(series, opts, config, context, chartData) {
  27991. if (opts.legend.show === false) {
  27992. return;
  27993. }
  27994. var legendData = chartData.legendData;
  27995. var legendList = legendData.points;
  27996. var legendArea = legendData.area;
  27997. var padding = opts.legend.padding * opts.pix;
  27998. var fontSize = opts.legend.fontSize * opts.pix;
  27999. var shapeWidth = 15 * opts.pix;
  28000. var shapeRight = 5 * opts.pix;
  28001. var itemGap = opts.legend.itemGap * opts.pix;
  28002. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  28003. //画背景及边框
  28004. context.beginPath();
  28005. context.setLineWidth(opts.legend.borderWidth * opts.pix);
  28006. context.setStrokeStyle(opts.legend.borderColor);
  28007. context.setFillStyle(opts.legend.backgroundColor);
  28008. context.moveTo(legendArea.start.x, legendArea.start.y);
  28009. context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height);
  28010. context.closePath();
  28011. context.fill();
  28012. context.stroke();
  28013. legendList.forEach(function (itemList, listIndex) {
  28014. var width = 0;
  28015. var height = 0;
  28016. width = legendData.widthArr[listIndex];
  28017. height = legendData.heightArr[listIndex];
  28018. var startX = 0;
  28019. var startY = 0;
  28020. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  28021. switch (opts.legend.float) {
  28022. case 'left':
  28023. startX = legendArea.start.x + padding;
  28024. break;
  28025. case 'right':
  28026. startX = legendArea.start.x + legendArea.width - width;
  28027. break;
  28028. default:
  28029. startX = legendArea.start.x + (legendArea.width - width) / 2;
  28030. }
  28031. startY = legendArea.start.y + padding + listIndex * lineHeight;
  28032. } else {
  28033. if (listIndex == 0) {
  28034. width = 0;
  28035. } else {
  28036. width = legendData.widthArr[listIndex - 1];
  28037. }
  28038. startX = legendArea.start.x + padding + width;
  28039. startY = legendArea.start.y + padding + (legendArea.height - height) / 2;
  28040. }
  28041. context.setFontSize(config.fontSize);
  28042. for (var i = 0; i < itemList.length; i++) {
  28043. var item = itemList[i];
  28044. item.area = [0, 0, 0, 0];
  28045. item.area[0] = startX;
  28046. item.area[1] = startY;
  28047. item.area[3] = startY + lineHeight;
  28048. context.beginPath();
  28049. context.setLineWidth(1 * opts.pix);
  28050. context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor);
  28051. context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor);
  28052. switch (item.legendShape) {
  28053. case 'line':
  28054. context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pix);
  28055. context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pix, 15 * opts.pix, 4 * opts.pix);
  28056. break;
  28057. case 'triangle':
  28058. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  28059. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  28060. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  28061. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  28062. break;
  28063. case 'diamond':
  28064. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  28065. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight);
  28066. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  28067. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight);
  28068. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  28069. break;
  28070. case 'circle':
  28071. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight);
  28072. context.arc(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight, 5 * opts.pix, 0, 2 * Math.PI);
  28073. break;
  28074. case 'rect':
  28075. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  28076. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  28077. break;
  28078. case 'square':
  28079. context.moveTo(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  28080. context.fillRect(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
  28081. break;
  28082. case 'none':
  28083. break;
  28084. default:
  28085. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  28086. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  28087. }
  28088. context.closePath();
  28089. context.fill();
  28090. context.stroke();
  28091. startX += shapeWidth + shapeRight;
  28092. var fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2;
  28093. var legendText = item.legendText ? item.legendText : item.name;
  28094. context.beginPath();
  28095. context.setFontSize(fontSize);
  28096. context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor);
  28097. context.fillText(legendText, startX, startY + fontTrans);
  28098. context.closePath();
  28099. context.stroke();
  28100. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  28101. startX += measureText(legendText, fontSize, context) + itemGap;
  28102. item.area[2] = startX;
  28103. } else {
  28104. item.area[2] = startX + measureText(legendText, fontSize, context) + itemGap;
  28105. ;
  28106. startX -= shapeWidth + shapeRight;
  28107. startY += lineHeight;
  28108. }
  28109. }
  28110. });
  28111. }
  28112. function drawPieDataPoints(series, opts, config, context) {
  28113. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28114. var pieOption = assign({}, {
  28115. activeOpacity: 0.5,
  28116. activeRadius: 10,
  28117. offsetAngle: 0,
  28118. labelWidth: 15,
  28119. ringWidth: 30,
  28120. customRadius: 0,
  28121. border: false,
  28122. borderWidth: 2,
  28123. borderColor: '#FFFFFF',
  28124. centerColor: '#FFFFFF',
  28125. linearType: 'none',
  28126. customColor: []
  28127. }, opts.type == "pie" ? opts.extra.pie : opts.extra.ring);
  28128. var centerPosition = {
  28129. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  28130. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  28131. };
  28132. if (config.pieChartLinePadding == 0) {
  28133. config.pieChartLinePadding = pieOption.activeRadius * opts.pix;
  28134. }
  28135. 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);
  28136. radius = radius < 10 ? 10 : radius;
  28137. if (pieOption.customRadius > 0) {
  28138. radius = pieOption.customRadius * opts.pix;
  28139. }
  28140. series = getPieDataPoints(series, radius, process);
  28141. var activeRadius = pieOption.activeRadius * opts.pix;
  28142. pieOption.customColor = fillCustomColor(pieOption.linearType, pieOption.customColor, series, config);
  28143. series = series.map(function (eachSeries) {
  28144. eachSeries._start_ += pieOption.offsetAngle * Math.PI / 180;
  28145. return eachSeries;
  28146. });
  28147. series.forEach(function (eachSeries, seriesIndex) {
  28148. if (opts.tooltip) {
  28149. if (opts.tooltip.index == seriesIndex) {
  28150. context.beginPath();
  28151. context.setFillStyle(hexToRgb(eachSeries.color, pieOption.activeOpacity || 0.5));
  28152. context.moveTo(centerPosition.x, centerPosition.y);
  28153. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  28154. context.closePath();
  28155. context.fill();
  28156. }
  28157. }
  28158. context.beginPath();
  28159. context.setLineWidth(pieOption.borderWidth * opts.pix);
  28160. context.lineJoin = "round";
  28161. context.setStrokeStyle(pieOption.borderColor);
  28162. var fillcolor = eachSeries.color;
  28163. if (pieOption.linearType == 'custom') {
  28164. var grd;
  28165. if (context.createCircularGradient) {
  28166. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  28167. } else {
  28168. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  28169. }
  28170. grd.addColorStop(0, hexToRgb(pieOption.customColor[eachSeries.linearIndex], 1));
  28171. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  28172. fillcolor = grd;
  28173. }
  28174. context.setFillStyle(fillcolor);
  28175. context.moveTo(centerPosition.x, centerPosition.y);
  28176. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  28177. context.closePath();
  28178. context.fill();
  28179. if (pieOption.border == true) {
  28180. context.stroke();
  28181. }
  28182. });
  28183. if (opts.type === 'ring') {
  28184. var innerPieWidth = radius * 0.6;
  28185. if (typeof pieOption.ringWidth === 'number' && pieOption.ringWidth > 0) {
  28186. innerPieWidth = Math.max(0, radius - pieOption.ringWidth * opts.pix);
  28187. }
  28188. context.beginPath();
  28189. context.setFillStyle(pieOption.centerColor);
  28190. context.moveTo(centerPosition.x, centerPosition.y);
  28191. context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI);
  28192. context.closePath();
  28193. context.fill();
  28194. }
  28195. if (opts.dataLabel !== false && process === 1) {
  28196. drawPieText(series, opts, config, context, radius, centerPosition);
  28197. }
  28198. if (process === 1 && opts.type === 'ring') {
  28199. drawRingTitle(opts, config, context, centerPosition);
  28200. }
  28201. return {
  28202. center: centerPosition,
  28203. radius: radius,
  28204. series: series
  28205. };
  28206. }
  28207. function drawRoseDataPoints(series, opts, config, context) {
  28208. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28209. var roseOption = assign({}, {
  28210. type: 'area',
  28211. activeOpacity: 0.5,
  28212. activeRadius: 10,
  28213. offsetAngle: 0,
  28214. labelWidth: 15,
  28215. border: false,
  28216. borderWidth: 2,
  28217. borderColor: '#FFFFFF',
  28218. linearType: 'none',
  28219. customColor: []
  28220. }, opts.extra.rose);
  28221. if (config.pieChartLinePadding == 0) {
  28222. config.pieChartLinePadding = roseOption.activeRadius * opts.pix;
  28223. }
  28224. var centerPosition = {
  28225. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  28226. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  28227. };
  28228. 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);
  28229. radius = radius < 10 ? 10 : radius;
  28230. var minRadius = roseOption.minRadius || radius * 0.5;
  28231. if (radius < minRadius) {
  28232. radius = minRadius + 10;
  28233. }
  28234. series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
  28235. var activeRadius = roseOption.activeRadius * opts.pix;
  28236. roseOption.customColor = fillCustomColor(roseOption.linearType, roseOption.customColor, series, config);
  28237. series = series.map(function (eachSeries) {
  28238. eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
  28239. return eachSeries;
  28240. });
  28241. series.forEach(function (eachSeries, seriesIndex) {
  28242. if (opts.tooltip) {
  28243. if (opts.tooltip.index == seriesIndex) {
  28244. context.beginPath();
  28245. context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
  28246. context.moveTo(centerPosition.x, centerPosition.y);
  28247. context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  28248. context.closePath();
  28249. context.fill();
  28250. }
  28251. }
  28252. context.beginPath();
  28253. context.setLineWidth(roseOption.borderWidth * opts.pix);
  28254. context.lineJoin = "round";
  28255. context.setStrokeStyle(roseOption.borderColor);
  28256. var fillcolor = eachSeries.color;
  28257. if (roseOption.linearType == 'custom') {
  28258. var grd;
  28259. if (context.createCircularGradient) {
  28260. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  28261. } else {
  28262. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  28263. }
  28264. grd.addColorStop(0, hexToRgb(roseOption.customColor[eachSeries.linearIndex], 1));
  28265. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  28266. fillcolor = grd;
  28267. }
  28268. context.setFillStyle(fillcolor);
  28269. context.moveTo(centerPosition.x, centerPosition.y);
  28270. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  28271. context.closePath();
  28272. context.fill();
  28273. if (roseOption.border == true) {
  28274. context.stroke();
  28275. }
  28276. });
  28277. if (opts.dataLabel !== false && process === 1) {
  28278. drawPieText(series, opts, config, context, radius, centerPosition);
  28279. }
  28280. return {
  28281. center: centerPosition,
  28282. radius: radius,
  28283. series: series
  28284. };
  28285. }
  28286. function drawArcbarDataPoints(series, opts, config, context) {
  28287. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28288. var arcbarOption = assign({}, {
  28289. startAngle: 0.75,
  28290. endAngle: 0.25,
  28291. type: 'default',
  28292. direction: 'cw',
  28293. lineCap: 'round',
  28294. width: 12,
  28295. gap: 2,
  28296. linearType: 'none',
  28297. customColor: []
  28298. }, opts.extra.arcbar);
  28299. series = getArcbarDataPoints(series, arcbarOption, process);
  28300. var centerPosition;
  28301. if (arcbarOption.centerX || arcbarOption.centerY) {
  28302. centerPosition = {
  28303. x: arcbarOption.centerX ? arcbarOption.centerX : opts.width / 2,
  28304. y: arcbarOption.centerY ? arcbarOption.centerY : opts.height / 2
  28305. };
  28306. } else {
  28307. centerPosition = {
  28308. x: opts.width / 2,
  28309. y: opts.height / 2
  28310. };
  28311. }
  28312. var radius;
  28313. if (arcbarOption.radius) {
  28314. radius = arcbarOption.radius;
  28315. } else {
  28316. radius = Math.min(centerPosition.x, centerPosition.y);
  28317. radius -= 5 * opts.pix;
  28318. radius -= arcbarOption.width / 2;
  28319. }
  28320. radius = radius < 10 ? 10 : radius;
  28321. arcbarOption.customColor = fillCustomColor(arcbarOption.linearType, arcbarOption.customColor, series, config);
  28322. for (var i = 0; i < series.length; i++) {
  28323. var eachSeries = series[i];
  28324. //背景颜色
  28325. context.setLineWidth(arcbarOption.width * opts.pix);
  28326. context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9');
  28327. context.setLineCap(arcbarOption.lineCap);
  28328. context.beginPath();
  28329. if (arcbarOption.type == 'default') {
  28330. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle * Math.PI, arcbarOption.direction == 'ccw');
  28331. } else {
  28332. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, 0, 2 * Math.PI, arcbarOption.direction == 'ccw');
  28333. }
  28334. context.stroke();
  28335. //进度条
  28336. var fillColor = eachSeries.color;
  28337. if (arcbarOption.linearType == 'custom') {
  28338. var grd = context.createLinearGradient(centerPosition.x - radius, centerPosition.y, centerPosition.x + radius, centerPosition.y);
  28339. grd.addColorStop(1, hexToRgb(arcbarOption.customColor[eachSeries.linearIndex], 1));
  28340. grd.addColorStop(0, hexToRgb(eachSeries.color, 1));
  28341. fillColor = grd;
  28342. }
  28343. context.setLineWidth(arcbarOption.width * opts.pix);
  28344. context.setStrokeStyle(fillColor);
  28345. context.setLineCap(arcbarOption.lineCap);
  28346. context.beginPath();
  28347. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ * Math.PI, arcbarOption.direction == 'ccw');
  28348. context.stroke();
  28349. }
  28350. drawRingTitle(opts, config, context, centerPosition);
  28351. return {
  28352. center: centerPosition,
  28353. radius: radius,
  28354. series: series
  28355. };
  28356. }
  28357. function drawGaugeDataPoints(categories, series, opts, config, context) {
  28358. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  28359. var gaugeOption = assign({}, {
  28360. type: 'default',
  28361. startAngle: 0.75,
  28362. endAngle: 0.25,
  28363. width: 15,
  28364. labelOffset: 13,
  28365. splitLine: {
  28366. fixRadius: 0,
  28367. splitNumber: 10,
  28368. width: 15,
  28369. color: '#FFFFFF',
  28370. childNumber: 5,
  28371. childWidth: 5
  28372. },
  28373. pointer: {
  28374. width: 15,
  28375. color: 'auto'
  28376. }
  28377. }, opts.extra.gauge);
  28378. if (gaugeOption.oldAngle == undefined) {
  28379. gaugeOption.oldAngle = gaugeOption.startAngle;
  28380. }
  28381. if (gaugeOption.oldData == undefined) {
  28382. gaugeOption.oldData = 0;
  28383. }
  28384. categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle);
  28385. var centerPosition = {
  28386. x: opts.width / 2,
  28387. y: opts.height / 2
  28388. };
  28389. var radius = Math.min(centerPosition.x, centerPosition.y);
  28390. radius -= 5 * opts.pix;
  28391. radius -= gaugeOption.width / 2;
  28392. radius = radius < 10 ? 10 : radius;
  28393. var innerRadius = radius - gaugeOption.width;
  28394. var totalAngle = 0;
  28395. //判断仪表盘的样式:default百度样式,progress新样式
  28396. if (gaugeOption.type == 'progress') {
  28397. //## 第一步画中心圆形背景和进度条背景
  28398. //中心圆形背景
  28399. var pieRadius = radius - gaugeOption.width * 3;
  28400. context.beginPath();
  28401. var gradient = context.createLinearGradient(centerPosition.x, centerPosition.y - pieRadius, centerPosition.x, centerPosition.y + pieRadius);
  28402. //配置渐变填充(起点:中心点向上减半径;结束点中心点向下加半径)
  28403. gradient.addColorStop('0', hexToRgb(series[0].color, 0.3));
  28404. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  28405. context.setFillStyle(gradient);
  28406. context.arc(centerPosition.x, centerPosition.y, pieRadius, 0, 2 * Math.PI, false);
  28407. context.fill();
  28408. //画进度条背景
  28409. context.setLineWidth(gaugeOption.width);
  28410. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  28411. context.setLineCap('round');
  28412. context.beginPath();
  28413. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, gaugeOption.endAngle * Math.PI, false);
  28414. context.stroke();
  28415. //## 第二步画刻度线
  28416. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  28417. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  28418. } else {
  28419. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  28420. }
  28421. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  28422. var childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  28423. var startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  28424. var endX = -radius - gaugeOption.width - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  28425. context.save();
  28426. context.translate(centerPosition.x, centerPosition.y);
  28427. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  28428. var len = gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1;
  28429. var proc = series[0].data * process;
  28430. for (var i = 0; i < len; i++) {
  28431. context.beginPath();
  28432. //刻度线随进度变色
  28433. if (proc > i / len) {
  28434. context.setStrokeStyle(hexToRgb(series[0].color, 1));
  28435. } else {
  28436. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  28437. }
  28438. context.setLineWidth(3 * opts.pix);
  28439. context.moveTo(startX, 0);
  28440. context.lineTo(endX, 0);
  28441. context.stroke();
  28442. context.rotate(childAngle * Math.PI);
  28443. }
  28444. context.restore();
  28445. //## 第三步画进度条
  28446. series = getGaugeArcbarDataPoints(series, gaugeOption, process);
  28447. context.setLineWidth(gaugeOption.width);
  28448. context.setStrokeStyle(series[0].color);
  28449. context.setLineCap('round');
  28450. context.beginPath();
  28451. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, series[0]._proportion_ * Math.PI, false);
  28452. context.stroke();
  28453. //## 第四步画指针
  28454. var pointerRadius = radius - gaugeOption.width * 2.5;
  28455. context.save();
  28456. context.translate(centerPosition.x, centerPosition.y);
  28457. context.rotate((series[0]._proportion_ - 1) * Math.PI);
  28458. context.beginPath();
  28459. context.setLineWidth(gaugeOption.width / 3);
  28460. var gradient3 = context.createLinearGradient(0, -pointerRadius * 0.6, 0, pointerRadius * 0.6);
  28461. gradient3.addColorStop('0', hexToRgb('#FFFFFF', 0));
  28462. gradient3.addColorStop('0.5', hexToRgb(series[0].color, 1));
  28463. gradient3.addColorStop('1.0', hexToRgb('#FFFFFF', 0));
  28464. context.setStrokeStyle(gradient3);
  28465. context.arc(0, 0, pointerRadius, 0.85 * Math.PI, 1.15 * Math.PI, false);
  28466. context.stroke();
  28467. context.beginPath();
  28468. context.setLineWidth(1);
  28469. context.setStrokeStyle(series[0].color);
  28470. context.setFillStyle(series[0].color);
  28471. context.moveTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  28472. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2 - 4, 0);
  28473. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, 4);
  28474. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  28475. context.stroke();
  28476. context.fill();
  28477. context.restore();
  28478. //default百度样式
  28479. } else {
  28480. //画背景
  28481. context.setLineWidth(gaugeOption.width);
  28482. context.setLineCap('butt');
  28483. for (var _i26 = 0; _i26 < categories.length; _i26++) {
  28484. var eachCategories = categories[_i26];
  28485. context.beginPath();
  28486. context.setStrokeStyle(eachCategories.color);
  28487. context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ * Math.PI, false);
  28488. context.stroke();
  28489. }
  28490. context.save();
  28491. //画刻度线
  28492. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  28493. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  28494. } else {
  28495. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  28496. }
  28497. var _splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  28498. var _childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  28499. var _startX2 = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  28500. var _endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  28501. var childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.childWidth;
  28502. context.translate(centerPosition.x, centerPosition.y);
  28503. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  28504. for (var _i27 = 0; _i27 < gaugeOption.splitLine.splitNumber + 1; _i27++) {
  28505. context.beginPath();
  28506. context.setStrokeStyle(gaugeOption.splitLine.color);
  28507. context.setLineWidth(2 * opts.pix);
  28508. context.moveTo(_startX2, 0);
  28509. context.lineTo(_endX, 0);
  28510. context.stroke();
  28511. context.rotate(_splitAngle * Math.PI);
  28512. }
  28513. context.restore();
  28514. context.save();
  28515. context.translate(centerPosition.x, centerPosition.y);
  28516. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  28517. for (var _i28 = 0; _i28 < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; _i28++) {
  28518. context.beginPath();
  28519. context.setStrokeStyle(gaugeOption.splitLine.color);
  28520. context.setLineWidth(1 * opts.pix);
  28521. context.moveTo(_startX2, 0);
  28522. context.lineTo(childendX, 0);
  28523. context.stroke();
  28524. context.rotate(_childAngle * Math.PI);
  28525. }
  28526. context.restore();
  28527. //画指针
  28528. series = getGaugeDataPoints(series, categories, gaugeOption, process);
  28529. for (var _i29 = 0; _i29 < series.length; _i29++) {
  28530. var eachSeries = series[_i29];
  28531. context.save();
  28532. context.translate(centerPosition.x, centerPosition.y);
  28533. context.rotate((eachSeries._proportion_ - 1) * Math.PI);
  28534. context.beginPath();
  28535. context.setFillStyle(eachSeries.color);
  28536. context.moveTo(gaugeOption.pointer.width, 0);
  28537. context.lineTo(0, -gaugeOption.pointer.width / 2);
  28538. context.lineTo(-innerRadius, 0);
  28539. context.lineTo(0, gaugeOption.pointer.width / 2);
  28540. context.lineTo(gaugeOption.pointer.width, 0);
  28541. context.closePath();
  28542. context.fill();
  28543. context.beginPath();
  28544. context.setFillStyle('#FFFFFF');
  28545. context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false);
  28546. context.fill();
  28547. context.restore();
  28548. }
  28549. if (opts.dataLabel !== false) {
  28550. drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context);
  28551. }
  28552. }
  28553. //画仪表盘标题,副标题
  28554. drawRingTitle(opts, config, context, centerPosition);
  28555. if (process === 1 && opts.type === 'gauge') {
  28556. opts.extra.gauge.oldAngle = series[0]._proportion_;
  28557. opts.extra.gauge.oldData = series[0].data;
  28558. }
  28559. return {
  28560. center: centerPosition,
  28561. radius: radius,
  28562. innerRadius: innerRadius,
  28563. categories: categories,
  28564. totalAngle: totalAngle
  28565. };
  28566. }
  28567. function drawRadarDataPoints(series, opts, config, context) {
  28568. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28569. var radarOption = assign({}, {
  28570. gridColor: '#cccccc',
  28571. gridType: 'radar',
  28572. gridEval: 1,
  28573. axisLabel: false,
  28574. axisLabelTofix: 0,
  28575. labelShow: true,
  28576. labelColor: '#666666',
  28577. labelPointShow: false,
  28578. labelPointRadius: 3,
  28579. labelPointColor: '#cccccc',
  28580. opacity: 0.2,
  28581. gridCount: 3,
  28582. border: false,
  28583. borderWidth: 2,
  28584. linearType: 'none',
  28585. customColor: []
  28586. }, opts.extra.radar);
  28587. var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
  28588. var centerPosition = {
  28589. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  28590. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  28591. };
  28592. var xr = (opts.width - opts.area[1] - opts.area[3]) / 2;
  28593. var yr = (opts.height - opts.area[0] - opts.area[2]) / 2;
  28594. var radius = Math.min(xr - (getMaxTextListLength(opts.categories, config.fontSize, context) + config.radarLabelTextMargin), yr - config.radarLabelTextMargin);
  28595. radius -= config.radarLabelTextMargin * opts.pix;
  28596. radius = radius < 10 ? 10 : radius;
  28597. radius = radarOption.radius ? radarOption.radius : radius;
  28598. // 画分割线
  28599. context.beginPath();
  28600. context.setLineWidth(1 * opts.pix);
  28601. context.setStrokeStyle(radarOption.gridColor);
  28602. coordinateAngle.forEach(function (angle, index) {
  28603. var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
  28604. context.moveTo(centerPosition.x, centerPosition.y);
  28605. if (index % radarOption.gridEval == 0) {
  28606. context.lineTo(pos.x, pos.y);
  28607. }
  28608. });
  28609. context.stroke();
  28610. context.closePath();
  28611. // 画背景网格
  28612. var _loop = function _loop(i) {
  28613. var startPos = {};
  28614. context.beginPath();
  28615. context.setLineWidth(1 * opts.pix);
  28616. context.setStrokeStyle(radarOption.gridColor);
  28617. if (radarOption.gridType == 'radar') {
  28618. coordinateAngle.forEach(function (angle, index) {
  28619. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(angle), radius / radarOption.gridCount * i * Math.sin(angle), centerPosition);
  28620. if (index === 0) {
  28621. startPos = pos;
  28622. context.moveTo(pos.x, pos.y);
  28623. } else {
  28624. context.lineTo(pos.x, pos.y);
  28625. }
  28626. });
  28627. context.lineTo(startPos.x, startPos.y);
  28628. } else {
  28629. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(1.5), radius / radarOption.gridCount * i * Math.sin(1.5), centerPosition);
  28630. context.arc(centerPosition.x, centerPosition.y, centerPosition.y - pos.y, 0, 2 * Math.PI, false);
  28631. }
  28632. context.stroke();
  28633. context.closePath();
  28634. };
  28635. for (var i = 1; i <= radarOption.gridCount; i++) {
  28636. _loop(i);
  28637. }
  28638. radarOption.customColor = fillCustomColor(radarOption.linearType, radarOption.customColor, series, config);
  28639. var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
  28640. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  28641. // 绘制区域数据
  28642. context.beginPath();
  28643. context.setLineWidth(radarOption.borderWidth * opts.pix);
  28644. context.setStrokeStyle(eachSeries.color);
  28645. var fillcolor = hexToRgb(eachSeries.color, radarOption.opacity);
  28646. if (radarOption.linearType == 'custom') {
  28647. var grd;
  28648. if (context.createCircularGradient) {
  28649. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, radius);
  28650. } else {
  28651. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, radius);
  28652. }
  28653. grd.addColorStop(0, hexToRgb(radarOption.customColor[series[seriesIndex].linearIndex], radarOption.opacity));
  28654. grd.addColorStop(1, hexToRgb(eachSeries.color, radarOption.opacity));
  28655. fillcolor = grd;
  28656. }
  28657. context.setFillStyle(fillcolor);
  28658. eachSeries.data.forEach(function (item, index) {
  28659. if (index === 0) {
  28660. context.moveTo(item.position.x, item.position.y);
  28661. } else {
  28662. context.lineTo(item.position.x, item.position.y);
  28663. }
  28664. });
  28665. context.closePath();
  28666. context.fill();
  28667. if (radarOption.border === true) {
  28668. context.stroke();
  28669. }
  28670. context.closePath();
  28671. if (opts.dataPointShape !== false) {
  28672. var points = eachSeries.data.map(function (item) {
  28673. return item.position;
  28674. });
  28675. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  28676. }
  28677. });
  28678. // 画刻度值
  28679. if (radarOption.axisLabel === true) {
  28680. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  28681. var stepLength = radius / radarOption.gridCount;
  28682. var fontSize = opts.fontSize * opts.pix;
  28683. context.setFontSize(fontSize);
  28684. context.setFillStyle(opts.fontColor);
  28685. context.setTextAlign('left');
  28686. for (var i = 0; i < radarOption.gridCount + 1; i++) {
  28687. var label = i * maxData / radarOption.gridCount;
  28688. label = label.toFixed(radarOption.axisLabelTofix);
  28689. context.fillText(String(label), centerPosition.x + 3 * opts.pix, centerPosition.y - i * stepLength + fontSize / 2);
  28690. }
  28691. }
  28692. // draw label text
  28693. drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context);
  28694. // draw dataLabel
  28695. if (opts.dataLabel !== false && process === 1) {
  28696. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  28697. context.beginPath();
  28698. var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
  28699. context.setFontSize(fontSize);
  28700. context.setFillStyle(eachSeries.textColor || opts.fontColor);
  28701. eachSeries.data.forEach(function (item, index) {
  28702. //如果是中心点垂直的上下点位
  28703. if (Math.abs(item.position.x - centerPosition.x) < 2) {
  28704. //如果在上面
  28705. if (item.position.y < centerPosition.y) {
  28706. context.setTextAlign('center');
  28707. context.fillText(item.value, item.position.x, item.position.y - 4);
  28708. } else {
  28709. context.setTextAlign('center');
  28710. context.fillText(item.value, item.position.x, item.position.y + fontSize + 2);
  28711. }
  28712. } else {
  28713. //如果在左侧
  28714. if (item.position.x < centerPosition.x) {
  28715. context.setTextAlign('right');
  28716. context.fillText(item.value, item.position.x - 4, item.position.y + fontSize / 2 - 2);
  28717. } else {
  28718. context.setTextAlign('left');
  28719. context.fillText(item.value, item.position.x + 4, item.position.y + fontSize / 2 - 2);
  28720. }
  28721. }
  28722. });
  28723. context.closePath();
  28724. context.stroke();
  28725. });
  28726. context.setTextAlign('left');
  28727. }
  28728. return {
  28729. center: centerPosition,
  28730. radius: radius,
  28731. angleList: coordinateAngle
  28732. };
  28733. }
  28734. // 经纬度转墨卡托
  28735. function lonlat2mercator(longitude, latitude) {
  28736. var mercator = Array(2);
  28737. var x = longitude * 20037508.34 / 180;
  28738. var y = Math.log(Math.tan((90 + latitude) * Math.PI / 360)) / (Math.PI / 180);
  28739. y = y * 20037508.34 / 180;
  28740. mercator[0] = x;
  28741. mercator[1] = y;
  28742. return mercator;
  28743. }
  28744. // 墨卡托转经纬度
  28745. function mercator2lonlat(longitude, latitude) {
  28746. var lonlat = Array(2);
  28747. var x = longitude / 20037508.34 * 180;
  28748. var y = latitude / 20037508.34 * 180;
  28749. y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2);
  28750. lonlat[0] = x;
  28751. lonlat[1] = y;
  28752. return lonlat;
  28753. }
  28754. function getBoundingBox(data) {
  28755. var bounds = {},
  28756. coords;
  28757. bounds.xMin = 180;
  28758. bounds.xMax = 0;
  28759. bounds.yMin = 90;
  28760. bounds.yMax = 0;
  28761. for (var i = 0; i < data.length; i++) {
  28762. var coorda = data[i].geometry.coordinates;
  28763. for (var k = 0; k < coorda.length; k++) {
  28764. coords = coorda[k];
  28765. if (coords.length == 1) {
  28766. coords = coords[0];
  28767. }
  28768. for (var j = 0; j < coords.length; j++) {
  28769. var longitude = coords[j][0];
  28770. var latitude = coords[j][1];
  28771. var point = {
  28772. x: longitude,
  28773. y: latitude
  28774. };
  28775. bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
  28776. bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
  28777. bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
  28778. bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
  28779. }
  28780. }
  28781. }
  28782. return bounds;
  28783. }
  28784. function coordinateToPoint(latitude, longitude, bounds, scale, xoffset, yoffset) {
  28785. return {
  28786. x: (longitude - bounds.xMin) * scale + xoffset,
  28787. y: (bounds.yMax - latitude) * scale + yoffset
  28788. };
  28789. }
  28790. function pointToCoordinate(pointY, pointX, bounds, scale, xoffset, yoffset) {
  28791. return {
  28792. x: (pointX - xoffset) / scale + bounds.xMin,
  28793. y: bounds.yMax - (pointY - yoffset) / scale
  28794. };
  28795. }
  28796. function isRayIntersectsSegment(poi, s_poi, e_poi) {
  28797. if (s_poi[1] == e_poi[1]) {
  28798. return false;
  28799. }
  28800. if (s_poi[1] > poi[1] && e_poi[1] > poi[1]) {
  28801. return false;
  28802. }
  28803. if (s_poi[1] < poi[1] && e_poi[1] < poi[1]) {
  28804. return false;
  28805. }
  28806. if (s_poi[1] == poi[1] && e_poi[1] > poi[1]) {
  28807. return false;
  28808. }
  28809. if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) {
  28810. return false;
  28811. }
  28812. if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) {
  28813. return false;
  28814. }
  28815. var xseg = e_poi[0] - (e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1]) / (e_poi[1] - s_poi[1]);
  28816. if (xseg < poi[0]) {
  28817. return false;
  28818. } else {
  28819. return true;
  28820. }
  28821. }
  28822. function isPoiWithinPoly(poi, poly, mercator) {
  28823. var sinsc = 0;
  28824. for (var i = 0; i < poly.length; i++) {
  28825. var epoly = poly[i][0];
  28826. if (poly.length == 1) {
  28827. epoly = poly[i][0];
  28828. }
  28829. for (var j = 0; j < epoly.length - 1; j++) {
  28830. var s_poi = epoly[j];
  28831. var e_poi = epoly[j + 1];
  28832. if (mercator) {
  28833. s_poi = lonlat2mercator(epoly[j][0], epoly[j][1]);
  28834. e_poi = lonlat2mercator(epoly[j + 1][0], epoly[j + 1][1]);
  28835. }
  28836. if (isRayIntersectsSegment(poi, s_poi, e_poi)) {
  28837. sinsc += 1;
  28838. }
  28839. }
  28840. }
  28841. if (sinsc % 2 == 1) {
  28842. return true;
  28843. } else {
  28844. return false;
  28845. }
  28846. }
  28847. function drawMapDataPoints(series, opts, config, context) {
  28848. var mapOption = assign({}, {
  28849. border: true,
  28850. mercator: false,
  28851. borderWidth: 1,
  28852. active: true,
  28853. borderColor: '#666666',
  28854. fillOpacity: 0.6,
  28855. activeBorderColor: '#f04864',
  28856. activeFillColor: '#facc14',
  28857. activeFillOpacity: 1
  28858. }, opts.extra.map);
  28859. var coords, point;
  28860. var data = series;
  28861. var bounds = getBoundingBox(data);
  28862. if (mapOption.mercator) {
  28863. var max = lonlat2mercator(bounds.xMax, bounds.yMax);
  28864. var min = lonlat2mercator(bounds.xMin, bounds.yMin);
  28865. bounds.xMax = max[0];
  28866. bounds.yMax = max[1];
  28867. bounds.xMin = min[0];
  28868. bounds.yMin = min[1];
  28869. }
  28870. var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
  28871. var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
  28872. var scale = xScale < yScale ? xScale : yScale;
  28873. var xoffset = opts.width / 2 - Math.abs(bounds.xMax - bounds.xMin) / 2 * scale;
  28874. var yoffset = opts.height / 2 - Math.abs(bounds.yMax - bounds.yMin) / 2 * scale;
  28875. for (var i = 0; i < data.length; i++) {
  28876. context.beginPath();
  28877. context.setLineWidth(mapOption.borderWidth * opts.pix);
  28878. context.setStrokeStyle(mapOption.borderColor);
  28879. context.setFillStyle(hexToRgb(series[i].color, series[i].fillOpacity || mapOption.fillOpacity));
  28880. if (mapOption.active == true && opts.tooltip) {
  28881. if (opts.tooltip.index == i) {
  28882. context.setStrokeStyle(mapOption.activeBorderColor);
  28883. context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
  28884. }
  28885. }
  28886. var coorda = data[i].geometry.coordinates;
  28887. for (var k = 0; k < coorda.length; k++) {
  28888. coords = coorda[k];
  28889. if (coords.length == 1) {
  28890. coords = coords[0];
  28891. }
  28892. for (var j = 0; j < coords.length; j++) {
  28893. var gaosi = Array(2);
  28894. if (mapOption.mercator) {
  28895. gaosi = lonlat2mercator(coords[j][0], coords[j][1]);
  28896. } else {
  28897. gaosi = coords[j];
  28898. }
  28899. point = coordinateToPoint(gaosi[1], gaosi[0], bounds, scale, xoffset, yoffset);
  28900. if (j === 0) {
  28901. context.beginPath();
  28902. context.moveTo(point.x, point.y);
  28903. } else {
  28904. context.lineTo(point.x, point.y);
  28905. }
  28906. }
  28907. context.fill();
  28908. if (mapOption.border == true) {
  28909. context.stroke();
  28910. }
  28911. }
  28912. }
  28913. if (opts.dataLabel == true) {
  28914. for (var i = 0; i < data.length; i++) {
  28915. var centerPoint = data[i].properties.centroid;
  28916. if (centerPoint) {
  28917. if (mapOption.mercator) {
  28918. centerPoint = lonlat2mercator(data[i].properties.centroid[0], data[i].properties.centroid[1]);
  28919. }
  28920. point = coordinateToPoint(centerPoint[1], centerPoint[0], bounds, scale, xoffset, yoffset);
  28921. var fontSize = data[i].textSize * opts.pix || config.fontSize;
  28922. var fontColor = data[i].textColor || opts.fontColor;
  28923. if (mapOption.active && mapOption.activeTextColor && opts.tooltip && opts.tooltip.index == i) {
  28924. fontColor = mapOption.activeTextColor;
  28925. }
  28926. var text = data[i].properties.name;
  28927. context.beginPath();
  28928. context.setFontSize(fontSize);
  28929. context.setFillStyle(fontColor);
  28930. context.fillText(text, point.x - measureText(text, fontSize, context) / 2, point.y + fontSize / 2);
  28931. context.closePath();
  28932. context.stroke();
  28933. }
  28934. }
  28935. }
  28936. opts.chartData.mapData = {
  28937. bounds: bounds,
  28938. scale: scale,
  28939. xoffset: xoffset,
  28940. yoffset: yoffset,
  28941. mercator: mapOption.mercator
  28942. };
  28943. drawToolTipBridge(opts, config, context, 1);
  28944. context.draw();
  28945. }
  28946. function normalInt(min, max, iter) {
  28947. iter = iter == 0 ? 1 : iter;
  28948. var arr = [];
  28949. for (var i = 0; i < iter; i++) {
  28950. arr[i] = Math.random();
  28951. }
  28952. ;
  28953. return Math.floor(arr.reduce(function (i, j) {
  28954. return i + j;
  28955. }) / iter * (max - min)) + min;
  28956. }
  28957. ;
  28958. function collisionNew(area, points, width, height) {
  28959. var isIn = false;
  28960. for (var i = 0; i < points.length; i++) {
  28961. if (points[i].area) {
  28962. 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]) {
  28963. if (area[0] < 0 || area[1] < 0 || area[2] > width || area[3] > height) {
  28964. isIn = true;
  28965. break;
  28966. } else {
  28967. isIn = false;
  28968. }
  28969. } else {
  28970. isIn = true;
  28971. break;
  28972. }
  28973. }
  28974. }
  28975. return isIn;
  28976. }
  28977. ;
  28978. function getWordCloudPoint(opts, type, context) {
  28979. var points = opts.series;
  28980. switch (type) {
  28981. case 'normal':
  28982. for (var i = 0; i < points.length; i++) {
  28983. var text = points[i].name;
  28984. var tHeight = points[i].textSize * opts.pix;
  28985. var tWidth = measureText(text, tHeight, context);
  28986. var x = void 0,
  28987. y = void 0;
  28988. var area = void 0;
  28989. var breaknum = 0;
  28990. while (true) {
  28991. breaknum++;
  28992. x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2;
  28993. y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2;
  28994. area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / 2, y + 5 + opts.height / 2];
  28995. var isCollision = collisionNew(area, points, opts.width, opts.height);
  28996. if (!isCollision) break;
  28997. if (breaknum == 1000) {
  28998. area = [-100, -100, -100, -100];
  28999. break;
  29000. }
  29001. }
  29002. ;
  29003. points[i].area = area;
  29004. }
  29005. break;
  29006. case 'vertical':
  29007. var Spin = function Spin() {
  29008. //获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
  29009. if (Math.random() > 0.7) {
  29010. return true;
  29011. } else {
  29012. return false;
  29013. }
  29014. ;
  29015. };
  29016. ;
  29017. for (var _i30 = 0; _i30 < points.length; _i30++) {
  29018. var _text = points[_i30].name;
  29019. var _tHeight = points[_i30].textSize * opts.pix;
  29020. var _tWidth = measureText(_text, _tHeight, context);
  29021. var isSpin = Spin();
  29022. var _x = void 0,
  29023. _y = void 0,
  29024. _area = void 0,
  29025. areav = void 0;
  29026. var _breaknum = 0;
  29027. while (true) {
  29028. _breaknum++;
  29029. var _isCollision = void 0;
  29030. if (isSpin) {
  29031. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  29032. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  29033. _area = [_y - 5 - _tWidth + opts.width / 2, -_x - 5 + opts.height / 2, _y + 5 + opts.width / 2, -_x + _tHeight + 5 + opts.height / 2];
  29034. 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];
  29035. _isCollision = collisionNew(areav, points, opts.height, opts.width);
  29036. } else {
  29037. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  29038. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  29039. _area = [_x - 5 + opts.width / 2, _y - 5 - _tHeight + opts.height / 2, _x + _tWidth + 5 + opts.width / 2, _y + 5 + opts.height / 2];
  29040. _isCollision = collisionNew(_area, points, opts.width, opts.height);
  29041. }
  29042. if (!_isCollision) break;
  29043. if (_breaknum == 1000) {
  29044. _area = [-1000, -1000, -1000, -1000];
  29045. break;
  29046. }
  29047. }
  29048. ;
  29049. if (isSpin) {
  29050. points[_i30].area = areav;
  29051. points[_i30].areav = _area;
  29052. } else {
  29053. points[_i30].area = _area;
  29054. }
  29055. points[_i30].rotate = isSpin;
  29056. }
  29057. ;
  29058. break;
  29059. }
  29060. return points;
  29061. }
  29062. function drawWordCloudDataPoints(series, opts, config, context) {
  29063. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  29064. var wordOption = assign({}, {
  29065. type: 'normal',
  29066. autoColors: true
  29067. }, opts.extra.word);
  29068. if (!opts.chartData.wordCloudData) {
  29069. opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type, context);
  29070. }
  29071. context.beginPath();
  29072. context.setFillStyle(opts.background);
  29073. context.rect(0, 0, opts.width, opts.height);
  29074. context.fill();
  29075. context.save();
  29076. var points = opts.chartData.wordCloudData;
  29077. context.translate(opts.width / 2, opts.height / 2);
  29078. for (var i = 0; i < points.length; i++) {
  29079. context.save();
  29080. if (points[i].rotate) {
  29081. context.rotate(90 * Math.PI / 180);
  29082. }
  29083. var text = points[i].name;
  29084. var tHeight = points[i].textSize * opts.pix;
  29085. var tWidth = measureText(text, tHeight, context);
  29086. context.beginPath();
  29087. context.setStrokeStyle(points[i].color);
  29088. context.setFillStyle(points[i].color);
  29089. context.setFontSize(tHeight);
  29090. if (points[i].rotate) {
  29091. if (points[i].areav[0] > 0) {
  29092. if (opts.tooltip) {
  29093. if (opts.tooltip.index == i) {
  29094. 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);
  29095. } else {
  29096. 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);
  29097. }
  29098. } else {
  29099. 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);
  29100. }
  29101. }
  29102. } else {
  29103. if (points[i].area[0] > 0) {
  29104. if (opts.tooltip) {
  29105. if (opts.tooltip.index == i) {
  29106. 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);
  29107. } else {
  29108. 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);
  29109. }
  29110. } else {
  29111. 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);
  29112. }
  29113. }
  29114. }
  29115. context.stroke();
  29116. context.restore();
  29117. }
  29118. context.restore();
  29119. }
  29120. function drawFunnelDataPoints(series, opts, config, context) {
  29121. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  29122. var funnelOption = assign({}, {
  29123. type: 'funnel',
  29124. activeWidth: 10,
  29125. activeOpacity: 0.3,
  29126. border: false,
  29127. borderWidth: 2,
  29128. borderColor: '#FFFFFF',
  29129. fillOpacity: 1,
  29130. minSize: 0,
  29131. labelAlign: 'right',
  29132. linearType: 'none',
  29133. customColor: []
  29134. }, opts.extra.funnel);
  29135. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length;
  29136. var centerPosition = {
  29137. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  29138. y: opts.height - opts.area[2]
  29139. };
  29140. var activeWidth = funnelOption.activeWidth * opts.pix;
  29141. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
  29142. var seriesNew = getFunnelDataPoints(series, radius, funnelOption, eachSpacing, process);
  29143. context.save();
  29144. context.translate(centerPosition.x, centerPosition.y);
  29145. funnelOption.customColor = fillCustomColor(funnelOption.linearType, funnelOption.customColor, series, config);
  29146. if (funnelOption.type == 'pyramid') {
  29147. for (var i = 0; i < seriesNew.length; i++) {
  29148. if (i == seriesNew.length - 1) {
  29149. if (opts.tooltip) {
  29150. if (opts.tooltip.index == i) {
  29151. context.beginPath();
  29152. context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
  29153. context.moveTo(-activeWidth, -eachSpacing);
  29154. context.lineTo(-seriesNew[i].radius - activeWidth, 0);
  29155. context.lineTo(seriesNew[i].radius + activeWidth, 0);
  29156. context.lineTo(activeWidth, -eachSpacing);
  29157. context.lineTo(-activeWidth, -eachSpacing);
  29158. context.closePath();
  29159. context.fill();
  29160. }
  29161. }
  29162. seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
  29163. context.beginPath();
  29164. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29165. context.setStrokeStyle(funnelOption.borderColor);
  29166. var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
  29167. if (funnelOption.linearType == 'custom') {
  29168. var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
  29169. grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29170. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
  29171. grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29172. fillColor = grd;
  29173. }
  29174. context.setFillStyle(fillColor);
  29175. context.moveTo(0, -eachSpacing);
  29176. context.lineTo(-seriesNew[i].radius, 0);
  29177. context.lineTo(seriesNew[i].radius, 0);
  29178. context.lineTo(0, -eachSpacing);
  29179. context.closePath();
  29180. context.fill();
  29181. if (funnelOption.border == true) {
  29182. context.stroke();
  29183. }
  29184. } else {
  29185. if (opts.tooltip) {
  29186. if (opts.tooltip.index == i) {
  29187. context.beginPath();
  29188. context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
  29189. context.moveTo(0, 0);
  29190. context.lineTo(-seriesNew[i].radius - activeWidth, 0);
  29191. context.lineTo(-seriesNew[i + 1].radius - activeWidth, -eachSpacing);
  29192. context.lineTo(seriesNew[i + 1].radius + activeWidth, -eachSpacing);
  29193. context.lineTo(seriesNew[i].radius + activeWidth, 0);
  29194. context.lineTo(0, 0);
  29195. context.closePath();
  29196. context.fill();
  29197. }
  29198. }
  29199. seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
  29200. context.beginPath();
  29201. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29202. context.setStrokeStyle(funnelOption.borderColor);
  29203. var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
  29204. if (funnelOption.linearType == 'custom') {
  29205. var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
  29206. grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29207. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
  29208. grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29209. fillColor = grd;
  29210. }
  29211. context.setFillStyle(fillColor);
  29212. context.moveTo(0, 0);
  29213. context.lineTo(-seriesNew[i].radius, 0);
  29214. context.lineTo(-seriesNew[i + 1].radius, -eachSpacing);
  29215. context.lineTo(seriesNew[i + 1].radius, -eachSpacing);
  29216. context.lineTo(seriesNew[i].radius, 0);
  29217. context.lineTo(0, 0);
  29218. context.closePath();
  29219. context.fill();
  29220. if (funnelOption.border == true) {
  29221. context.stroke();
  29222. }
  29223. }
  29224. context.translate(0, -eachSpacing);
  29225. }
  29226. } else {
  29227. context.translate(0, -(seriesNew.length - 1) * eachSpacing);
  29228. for (var _i31 = 0; _i31 < seriesNew.length; _i31++) {
  29229. if (_i31 == seriesNew.length - 1) {
  29230. if (opts.tooltip) {
  29231. if (opts.tooltip.index == _i31) {
  29232. context.beginPath();
  29233. context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
  29234. context.moveTo(-activeWidth - funnelOption.minSize / 2, 0);
  29235. context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
  29236. context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
  29237. context.lineTo(activeWidth + funnelOption.minSize / 2, 0);
  29238. context.lineTo(-activeWidth - funnelOption.minSize / 2, 0);
  29239. context.closePath();
  29240. context.fill();
  29241. }
  29242. }
  29243. seriesNew[_i31].funnelArea = [centerPosition.x - seriesNew[_i31].radius, centerPosition.y - eachSpacing, centerPosition.x + seriesNew[_i31].radius, centerPosition.y];
  29244. context.beginPath();
  29245. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29246. context.setStrokeStyle(funnelOption.borderColor);
  29247. var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
  29248. if (funnelOption.linearType == 'custom') {
  29249. var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
  29250. grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29251. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
  29252. grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29253. fillColor = grd;
  29254. }
  29255. context.setFillStyle(fillColor);
  29256. context.moveTo(0, 0);
  29257. context.lineTo(-funnelOption.minSize / 2, 0);
  29258. context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
  29259. context.lineTo(seriesNew[_i31].radius, -eachSpacing);
  29260. context.lineTo(funnelOption.minSize / 2, 0);
  29261. context.lineTo(0, 0);
  29262. context.closePath();
  29263. context.fill();
  29264. if (funnelOption.border == true) {
  29265. context.stroke();
  29266. }
  29267. } else {
  29268. if (opts.tooltip) {
  29269. if (opts.tooltip.index == _i31) {
  29270. context.beginPath();
  29271. context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
  29272. context.moveTo(0, 0);
  29273. context.lineTo(-seriesNew[_i31 + 1].radius - activeWidth, 0);
  29274. context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
  29275. context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
  29276. context.lineTo(seriesNew[_i31 + 1].radius + activeWidth, 0);
  29277. context.lineTo(0, 0);
  29278. context.closePath();
  29279. context.fill();
  29280. }
  29281. }
  29282. seriesNew[_i31].funnelArea = [centerPosition.x - seriesNew[_i31].radius, centerPosition.y - eachSpacing * (seriesNew.length - _i31), centerPosition.x + seriesNew[_i31].radius, centerPosition.y - eachSpacing * (seriesNew.length - _i31 - 1)];
  29283. context.beginPath();
  29284. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29285. context.setStrokeStyle(funnelOption.borderColor);
  29286. var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
  29287. if (funnelOption.linearType == 'custom') {
  29288. var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
  29289. grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29290. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
  29291. grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29292. fillColor = grd;
  29293. }
  29294. context.setFillStyle(fillColor);
  29295. context.moveTo(0, 0);
  29296. context.lineTo(-seriesNew[_i31 + 1].radius, 0);
  29297. context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
  29298. context.lineTo(seriesNew[_i31].radius, -eachSpacing);
  29299. context.lineTo(seriesNew[_i31 + 1].radius, 0);
  29300. context.lineTo(0, 0);
  29301. context.closePath();
  29302. context.fill();
  29303. if (funnelOption.border == true) {
  29304. context.stroke();
  29305. }
  29306. }
  29307. context.translate(0, eachSpacing);
  29308. }
  29309. }
  29310. context.restore();
  29311. if (opts.dataLabel !== false && process === 1) {
  29312. drawFunnelText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  29313. }
  29314. if (process === 1) {
  29315. drawFunnelCenterText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  29316. }
  29317. return {
  29318. center: centerPosition,
  29319. radius: radius,
  29320. series: seriesNew
  29321. };
  29322. }
  29323. function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  29324. for (var i = 0; i < series.length; i++) {
  29325. var item = series[i];
  29326. if (item.labelShow === false) {
  29327. continue;
  29328. }
  29329. var startX = void 0,
  29330. endX = void 0,
  29331. startY = void 0,
  29332. fontSize = void 0;
  29333. var text = item.formatter ? item.formatter(item, i, series, opts) : util.toFixed(item._proportion_ * 100) + '%';
  29334. text = item.labelText ? item.labelText : text;
  29335. if (labelAlign == 'right') {
  29336. if (i == series.length - 1) {
  29337. startX = (item.funnelArea[2] + centerPosition.x) / 2;
  29338. } else {
  29339. startX = (item.funnelArea[2] + series[i + 1].funnelArea[2]) / 2;
  29340. }
  29341. endX = startX + activeWidth * 2;
  29342. startY = item.funnelArea[1] + eachSpacing / 2;
  29343. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  29344. context.setLineWidth(1 * opts.pix);
  29345. context.setStrokeStyle(item.color);
  29346. context.setFillStyle(item.color);
  29347. context.beginPath();
  29348. context.moveTo(startX, startY);
  29349. context.lineTo(endX, startY);
  29350. context.stroke();
  29351. context.closePath();
  29352. context.beginPath();
  29353. context.moveTo(endX, startY);
  29354. context.arc(endX, startY, 2 * opts.pix, 0, 2 * Math.PI);
  29355. context.closePath();
  29356. context.fill();
  29357. context.beginPath();
  29358. context.setFontSize(fontSize);
  29359. context.setFillStyle(item.textColor || opts.fontColor);
  29360. context.fillText(text, endX + 5, startY + fontSize / 2 - 2);
  29361. context.closePath();
  29362. context.stroke();
  29363. context.closePath();
  29364. }
  29365. if (labelAlign == 'left') {
  29366. if (i == series.length - 1) {
  29367. startX = (item.funnelArea[0] + centerPosition.x) / 2;
  29368. } else {
  29369. startX = (item.funnelArea[0] + series[i + 1].funnelArea[0]) / 2;
  29370. }
  29371. endX = startX - activeWidth * 2;
  29372. startY = item.funnelArea[1] + eachSpacing / 2;
  29373. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  29374. context.setLineWidth(1 * opts.pix);
  29375. context.setStrokeStyle(item.color);
  29376. context.setFillStyle(item.color);
  29377. context.beginPath();
  29378. context.moveTo(startX, startY);
  29379. context.lineTo(endX, startY);
  29380. context.stroke();
  29381. context.closePath();
  29382. context.beginPath();
  29383. context.moveTo(endX, startY);
  29384. context.arc(endX, startY, 2, 0, 2 * Math.PI);
  29385. context.closePath();
  29386. context.fill();
  29387. context.beginPath();
  29388. context.setFontSize(fontSize);
  29389. context.setFillStyle(item.textColor || opts.fontColor);
  29390. context.fillText(text, endX - 5 - measureText(text, fontSize, context), startY + fontSize / 2 - 2);
  29391. context.closePath();
  29392. context.stroke();
  29393. context.closePath();
  29394. }
  29395. }
  29396. }
  29397. function drawFunnelCenterText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  29398. for (var i = 0; i < series.length; i++) {
  29399. var item = series[i];
  29400. var startY = void 0,
  29401. fontSize = void 0;
  29402. if (item.centerText) {
  29403. startY = item.funnelArea[1] + eachSpacing / 2;
  29404. fontSize = item.centerTextSize * opts.pix || opts.fontSize * opts.pix;
  29405. context.beginPath();
  29406. context.setFontSize(fontSize);
  29407. context.setFillStyle(item.centerTextColor || "#FFFFFF");
  29408. context.fillText(item.centerText, centerPosition.x - measureText(item.centerText, fontSize, context) / 2, startY + fontSize / 2 - 2);
  29409. context.closePath();
  29410. context.stroke();
  29411. context.closePath();
  29412. }
  29413. }
  29414. }
  29415. function drawCanvas(opts, context) {
  29416. context.save();
  29417. context.translate(0, 0.5);
  29418. context.restore();
  29419. context.draw();
  29420. }
  29421. var Timing = {
  29422. easeIn: function easeIn(pos) {
  29423. return Math.pow(pos, 3);
  29424. },
  29425. easeOut: function easeOut(pos) {
  29426. return Math.pow(pos - 1, 3) + 1;
  29427. },
  29428. easeInOut: function easeInOut(pos) {
  29429. if ((pos /= 0.5) < 1) {
  29430. return 0.5 * Math.pow(pos, 3);
  29431. } else {
  29432. return 0.5 * (Math.pow(pos - 2, 3) + 2);
  29433. }
  29434. },
  29435. linear: function linear(pos) {
  29436. return pos;
  29437. }
  29438. };
  29439. function Animation(opts) {
  29440. this.isStop = false;
  29441. opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
  29442. opts.timing = opts.timing || 'easeInOut';
  29443. var delay = 17;
  29444. function createAnimationFrame() {
  29445. if (typeof setTimeout !== 'undefined') {
  29446. return function (step, delay) {
  29447. setTimeout(function () {
  29448. var timeStamp = +new Date();
  29449. step(timeStamp);
  29450. }, delay);
  29451. };
  29452. } else if (typeof requestAnimationFrame !== 'undefined') {
  29453. return requestAnimationFrame;
  29454. } else {
  29455. return function (step) {
  29456. step(null);
  29457. };
  29458. }
  29459. }
  29460. ;
  29461. var animationFrame = createAnimationFrame();
  29462. var startTimeStamp = null;
  29463. var _step = function step(timestamp) {
  29464. if (timestamp === null || this.isStop === true) {
  29465. opts.onProcess && opts.onProcess(1);
  29466. opts.onAnimationFinish && opts.onAnimationFinish();
  29467. return;
  29468. }
  29469. if (startTimeStamp === null) {
  29470. startTimeStamp = timestamp;
  29471. }
  29472. if (timestamp - startTimeStamp < opts.duration) {
  29473. var process = (timestamp - startTimeStamp) / opts.duration;
  29474. var timingFunction = Timing[opts.timing];
  29475. process = timingFunction(process);
  29476. opts.onProcess && opts.onProcess(process);
  29477. animationFrame(_step, delay);
  29478. } else {
  29479. opts.onProcess && opts.onProcess(1);
  29480. opts.onAnimationFinish && opts.onAnimationFinish();
  29481. }
  29482. };
  29483. _step = _step.bind(this);
  29484. animationFrame(_step, delay);
  29485. }
  29486. Animation.prototype.stop = function () {
  29487. this.isStop = true;
  29488. };
  29489. function drawCharts(type, opts, config, context) {
  29490. var _this2 = this;
  29491. var _this = this;
  29492. var series = opts.series;
  29493. //兼容ECharts饼图类数据格式
  29494. if (type === 'pie' || type === 'ring' || type === 'mount' || type === 'rose' || type === 'funnel') {
  29495. series = fixPieSeries(series, opts, config);
  29496. }
  29497. var categories = opts.categories;
  29498. if (type === 'mount') {
  29499. categories = [];
  29500. for (var j = 0; j < series.length; j++) {
  29501. if (series[j].show !== false) categories.push(series[j].name);
  29502. }
  29503. opts.categories = categories;
  29504. }
  29505. series = fillSeries(series, opts, config);
  29506. var duration = opts.animation ? opts.duration : 0;
  29507. _this.animationInstance && _this.animationInstance.stop();
  29508. var seriesMA = null;
  29509. if (type == 'candle') {
  29510. var average = assign({}, opts.extra.candle.average);
  29511. if (average.show) {
  29512. seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data);
  29513. seriesMA = fillSeries(seriesMA, opts, config);
  29514. opts.seriesMA = seriesMA;
  29515. } else if (opts.seriesMA) {
  29516. seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config);
  29517. } else {
  29518. seriesMA = series;
  29519. }
  29520. } else {
  29521. seriesMA = series;
  29522. }
  29523. /* 过滤掉show=false的series */
  29524. opts._series_ = series = filterSeries(series);
  29525. //重新计算图表区域
  29526. opts.area = new Array(4);
  29527. //复位绘图区域
  29528. for (var _j11 = 0; _j11 < 4; _j11++) {
  29529. opts.area[_j11] = opts.padding[_j11] * opts.pix;
  29530. }
  29531. //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域
  29532. var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData, context),
  29533. legendHeight = _calLegendData.area.wholeHeight,
  29534. legendWidth = _calLegendData.area.wholeWidth;
  29535. switch (opts.legend.position) {
  29536. case 'top':
  29537. opts.area[0] += legendHeight;
  29538. break;
  29539. case 'bottom':
  29540. opts.area[2] += legendHeight;
  29541. break;
  29542. case 'left':
  29543. opts.area[3] += legendWidth;
  29544. break;
  29545. case 'right':
  29546. opts.area[1] += legendWidth;
  29547. break;
  29548. }
  29549. var _calYAxisData = {},
  29550. yAxisWidth = 0;
  29551. if (opts.type === 'line' || opts.type === 'column' || opts.type === 'mount' || opts.type === 'area' || opts.type === 'mix' || opts.type === 'candle' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
  29552. _calYAxisData = calYAxisData(series, opts, config, context);
  29553. yAxisWidth = _calYAxisData.yAxisWidth;
  29554. //如果显示Y轴标题
  29555. if (opts.yAxis.showTitle) {
  29556. var maxTitleHeight = 0;
  29557. for (var i = 0; i < opts.yAxis.data.length; i++) {
  29558. maxTitleHeight = Math.max(maxTitleHeight, opts.yAxis.data[i].titleFontSize ? opts.yAxis.data[i].titleFontSize * opts.pix : config.fontSize);
  29559. }
  29560. opts.area[0] += maxTitleHeight;
  29561. }
  29562. var rightIndex = 0,
  29563. leftIndex = 0;
  29564. //计算主绘图区域左右位置
  29565. for (var _i32 = 0; _i32 < yAxisWidth.length; _i32++) {
  29566. if (yAxisWidth[_i32].position == 'left') {
  29567. if (leftIndex > 0) {
  29568. opts.area[3] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  29569. } else {
  29570. opts.area[3] += yAxisWidth[_i32].width;
  29571. }
  29572. leftIndex += 1;
  29573. } else if (yAxisWidth[_i32].position == 'right') {
  29574. if (rightIndex > 0) {
  29575. opts.area[1] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  29576. } else {
  29577. opts.area[1] += yAxisWidth[_i32].width;
  29578. }
  29579. rightIndex += 1;
  29580. }
  29581. }
  29582. } else {
  29583. config.yAxisWidth = yAxisWidth;
  29584. }
  29585. opts.chartData.yAxisData = _calYAxisData;
  29586. if (opts.categories && opts.categories.length && opts.type !== 'radar' && opts.type !== 'gauge' && opts.type !== 'bar') {
  29587. opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config);
  29588. var _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  29589. xAxisHeight = _calCategoriesData.xAxisHeight,
  29590. angle = _calCategoriesData.angle;
  29591. config.xAxisHeight = xAxisHeight;
  29592. config._xAxisTextAngle_ = angle;
  29593. opts.area[2] += xAxisHeight;
  29594. opts.chartData.categoriesData = _calCategoriesData;
  29595. } else {
  29596. if (opts.type === 'line' || opts.type === 'area' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
  29597. opts.chartData.xAxisData = calXAxisData(series, opts, config, context);
  29598. categories = opts.chartData.xAxisData.rangesFormat;
  29599. var _calCategoriesData2 = calCategoriesData(categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  29600. _xAxisHeight = _calCategoriesData2.xAxisHeight,
  29601. _angle = _calCategoriesData2.angle;
  29602. config.xAxisHeight = _xAxisHeight;
  29603. config._xAxisTextAngle_ = _angle;
  29604. opts.area[2] += _xAxisHeight;
  29605. opts.chartData.categoriesData = _calCategoriesData2;
  29606. } else {
  29607. opts.chartData.xAxisData = {
  29608. xAxisPoints: []
  29609. };
  29610. }
  29611. }
  29612. //计算右对齐偏移距离
  29613. if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) {
  29614. var offsetLeft = 0,
  29615. xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  29616. startX = opts.chartData.xAxisData.startX,
  29617. endX = opts.chartData.xAxisData.endX,
  29618. eachSpacing = opts.chartData.xAxisData.eachSpacing;
  29619. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  29620. var screenWidth = endX - startX;
  29621. offsetLeft = screenWidth - totalWidth;
  29622. _this.scrollOption.currentOffset = offsetLeft;
  29623. _this.scrollOption.startTouchX = offsetLeft;
  29624. _this.scrollOption.distance = 0;
  29625. _this.scrollOption.lastMoveTime = 0;
  29626. opts._scrollDistance_ = offsetLeft;
  29627. }
  29628. if (type === 'pie' || type === 'ring' || type === 'rose') {
  29629. config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA, config, context, opts);
  29630. }
  29631. switch (type) {
  29632. case 'word':
  29633. this.animationInstance = new Animation({
  29634. timing: opts.timing,
  29635. duration: duration,
  29636. onProcess: function onProcess(process) {
  29637. context.clearRect(0, 0, opts.width, opts.height);
  29638. if (opts.rotate) {
  29639. contextRotate(context, opts);
  29640. }
  29641. drawWordCloudDataPoints(series, opts, config, context, process);
  29642. drawCanvas(opts, context);
  29643. },
  29644. onAnimationFinish: function onAnimationFinish() {
  29645. _this.uevent.trigger('renderComplete');
  29646. }
  29647. });
  29648. break;
  29649. case 'map':
  29650. context.clearRect(0, 0, opts.width, opts.height);
  29651. drawMapDataPoints(series, opts, config, context);
  29652. setTimeout(function () {
  29653. _this2.uevent.trigger('renderComplete');
  29654. }, 50);
  29655. break;
  29656. case 'funnel':
  29657. this.animationInstance = new Animation({
  29658. timing: opts.timing,
  29659. duration: duration,
  29660. onProcess: function onProcess(process) {
  29661. context.clearRect(0, 0, opts.width, opts.height);
  29662. if (opts.rotate) {
  29663. contextRotate(context, opts);
  29664. }
  29665. opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, process);
  29666. drawLegend(opts.series, opts, config, context, opts.chartData);
  29667. drawToolTipBridge(opts, config, context, process);
  29668. drawCanvas(opts, context);
  29669. },
  29670. onAnimationFinish: function onAnimationFinish() {
  29671. _this.uevent.trigger('renderComplete');
  29672. }
  29673. });
  29674. break;
  29675. case 'line':
  29676. this.animationInstance = new Animation({
  29677. timing: opts.timing,
  29678. duration: duration,
  29679. onProcess: function onProcess(process) {
  29680. context.clearRect(0, 0, opts.width, opts.height);
  29681. if (opts.rotate) {
  29682. contextRotate(context, opts);
  29683. }
  29684. drawYAxisGrid(categories, opts, config, context);
  29685. drawXAxis(categories, opts, config, context);
  29686. var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process),
  29687. xAxisPoints = _drawLineDataPoints.xAxisPoints,
  29688. calPoints = _drawLineDataPoints.calPoints,
  29689. eachSpacing = _drawLineDataPoints.eachSpacing;
  29690. opts.chartData.xAxisPoints = xAxisPoints;
  29691. opts.chartData.calPoints = calPoints;
  29692. opts.chartData.eachSpacing = eachSpacing;
  29693. drawYAxis(series, opts, config, context);
  29694. if (opts.enableMarkLine !== false && process === 1) {
  29695. drawMarkLine(opts, config, context);
  29696. }
  29697. drawLegend(opts.series, opts, config, context, opts.chartData);
  29698. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29699. drawCanvas(opts, context);
  29700. },
  29701. onAnimationFinish: function onAnimationFinish() {
  29702. _this.uevent.trigger('renderComplete');
  29703. }
  29704. });
  29705. break;
  29706. case 'scatter':
  29707. this.animationInstance = new Animation({
  29708. timing: opts.timing,
  29709. duration: duration,
  29710. onProcess: function onProcess(process) {
  29711. context.clearRect(0, 0, opts.width, opts.height);
  29712. if (opts.rotate) {
  29713. contextRotate(context, opts);
  29714. }
  29715. drawYAxisGrid(categories, opts, config, context);
  29716. drawXAxis(categories, opts, config, context);
  29717. var _drawScatterDataPoints = drawScatterDataPoints(series, opts, config, context, process),
  29718. xAxisPoints = _drawScatterDataPoints.xAxisPoints,
  29719. calPoints = _drawScatterDataPoints.calPoints,
  29720. eachSpacing = _drawScatterDataPoints.eachSpacing;
  29721. opts.chartData.xAxisPoints = xAxisPoints;
  29722. opts.chartData.calPoints = calPoints;
  29723. opts.chartData.eachSpacing = eachSpacing;
  29724. drawYAxis(series, opts, config, context);
  29725. if (opts.enableMarkLine !== false && process === 1) {
  29726. drawMarkLine(opts, config, context);
  29727. }
  29728. drawLegend(opts.series, opts, config, context, opts.chartData);
  29729. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29730. drawCanvas(opts, context);
  29731. },
  29732. onAnimationFinish: function onAnimationFinish() {
  29733. _this.uevent.trigger('renderComplete');
  29734. }
  29735. });
  29736. break;
  29737. case 'bubble':
  29738. this.animationInstance = new Animation({
  29739. timing: opts.timing,
  29740. duration: duration,
  29741. onProcess: function onProcess(process) {
  29742. context.clearRect(0, 0, opts.width, opts.height);
  29743. if (opts.rotate) {
  29744. contextRotate(context, opts);
  29745. }
  29746. drawYAxisGrid(categories, opts, config, context);
  29747. drawXAxis(categories, opts, config, context);
  29748. var _drawBubbleDataPoints = drawBubbleDataPoints(series, opts, config, context, process),
  29749. xAxisPoints = _drawBubbleDataPoints.xAxisPoints,
  29750. calPoints = _drawBubbleDataPoints.calPoints,
  29751. eachSpacing = _drawBubbleDataPoints.eachSpacing;
  29752. opts.chartData.xAxisPoints = xAxisPoints;
  29753. opts.chartData.calPoints = calPoints;
  29754. opts.chartData.eachSpacing = eachSpacing;
  29755. drawYAxis(series, opts, config, context);
  29756. if (opts.enableMarkLine !== false && process === 1) {
  29757. drawMarkLine(opts, config, context);
  29758. }
  29759. drawLegend(opts.series, opts, config, context, opts.chartData);
  29760. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29761. drawCanvas(opts, context);
  29762. },
  29763. onAnimationFinish: function onAnimationFinish() {
  29764. _this.uevent.trigger('renderComplete');
  29765. }
  29766. });
  29767. break;
  29768. case 'mix':
  29769. this.animationInstance = new Animation({
  29770. timing: opts.timing,
  29771. duration: duration,
  29772. onProcess: function onProcess(process) {
  29773. context.clearRect(0, 0, opts.width, opts.height);
  29774. if (opts.rotate) {
  29775. contextRotate(context, opts);
  29776. }
  29777. drawYAxisGrid(categories, opts, config, context);
  29778. drawXAxis(categories, opts, config, context);
  29779. var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process),
  29780. xAxisPoints = _drawMixDataPoints.xAxisPoints,
  29781. calPoints = _drawMixDataPoints.calPoints,
  29782. eachSpacing = _drawMixDataPoints.eachSpacing;
  29783. opts.chartData.xAxisPoints = xAxisPoints;
  29784. opts.chartData.calPoints = calPoints;
  29785. opts.chartData.eachSpacing = eachSpacing;
  29786. drawYAxis(series, opts, config, context);
  29787. if (opts.enableMarkLine !== false && process === 1) {
  29788. drawMarkLine(opts, config, context);
  29789. }
  29790. drawLegend(opts.series, opts, config, context, opts.chartData);
  29791. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29792. drawCanvas(opts, context);
  29793. },
  29794. onAnimationFinish: function onAnimationFinish() {
  29795. _this.uevent.trigger('renderComplete');
  29796. }
  29797. });
  29798. break;
  29799. case 'column':
  29800. this.animationInstance = new Animation({
  29801. timing: opts.timing,
  29802. duration: duration,
  29803. onProcess: function onProcess(process) {
  29804. context.clearRect(0, 0, opts.width, opts.height);
  29805. if (opts.rotate) {
  29806. contextRotate(context, opts);
  29807. }
  29808. drawYAxisGrid(categories, opts, config, context);
  29809. drawXAxis(categories, opts, config, context);
  29810. var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process),
  29811. xAxisPoints = _drawColumnDataPoints.xAxisPoints,
  29812. calPoints = _drawColumnDataPoints.calPoints,
  29813. eachSpacing = _drawColumnDataPoints.eachSpacing;
  29814. opts.chartData.xAxisPoints = xAxisPoints;
  29815. opts.chartData.calPoints = calPoints;
  29816. opts.chartData.eachSpacing = eachSpacing;
  29817. drawYAxis(series, opts, config, context);
  29818. if (opts.enableMarkLine !== false && process === 1) {
  29819. drawMarkLine(opts, config, context);
  29820. }
  29821. drawLegend(opts.series, opts, config, context, opts.chartData);
  29822. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29823. drawCanvas(opts, context);
  29824. },
  29825. onAnimationFinish: function onAnimationFinish() {
  29826. _this.uevent.trigger('renderComplete');
  29827. }
  29828. });
  29829. break;
  29830. case 'mount':
  29831. this.animationInstance = new Animation({
  29832. timing: opts.timing,
  29833. duration: duration,
  29834. onProcess: function onProcess(process) {
  29835. context.clearRect(0, 0, opts.width, opts.height);
  29836. if (opts.rotate) {
  29837. contextRotate(context, opts);
  29838. }
  29839. drawYAxisGrid(categories, opts, config, context);
  29840. drawXAxis(categories, opts, config, context);
  29841. var _drawMountDataPoints = drawMountDataPoints(series, opts, config, context, process),
  29842. xAxisPoints = _drawMountDataPoints.xAxisPoints,
  29843. calPoints = _drawMountDataPoints.calPoints,
  29844. eachSpacing = _drawMountDataPoints.eachSpacing;
  29845. opts.chartData.xAxisPoints = xAxisPoints;
  29846. opts.chartData.calPoints = calPoints;
  29847. opts.chartData.eachSpacing = eachSpacing;
  29848. drawYAxis(series, opts, config, context);
  29849. if (opts.enableMarkLine !== false && process === 1) {
  29850. drawMarkLine(opts, config, context);
  29851. }
  29852. drawLegend(opts.series, opts, config, context, opts.chartData);
  29853. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29854. drawCanvas(opts, context);
  29855. },
  29856. onAnimationFinish: function onAnimationFinish() {
  29857. _this.uevent.trigger('renderComplete');
  29858. }
  29859. });
  29860. break;
  29861. case 'bar':
  29862. this.animationInstance = new Animation({
  29863. timing: opts.timing,
  29864. duration: duration,
  29865. onProcess: function onProcess(process) {
  29866. context.clearRect(0, 0, opts.width, opts.height);
  29867. if (opts.rotate) {
  29868. contextRotate(context, opts);
  29869. }
  29870. drawXAxis(categories, opts, config, context);
  29871. var _drawBarDataPoints = drawBarDataPoints(series, opts, config, context, process),
  29872. yAxisPoints = _drawBarDataPoints.yAxisPoints,
  29873. calPoints = _drawBarDataPoints.calPoints,
  29874. eachSpacing = _drawBarDataPoints.eachSpacing;
  29875. opts.chartData.yAxisPoints = yAxisPoints;
  29876. opts.chartData.xAxisPoints = opts.chartData.xAxisData.xAxisPoints;
  29877. opts.chartData.calPoints = calPoints;
  29878. opts.chartData.eachSpacing = eachSpacing;
  29879. drawYAxis(series, opts, config, context);
  29880. if (opts.enableMarkLine !== false && process === 1) {
  29881. drawMarkLine(opts, config, context);
  29882. }
  29883. drawLegend(opts.series, opts, config, context, opts.chartData);
  29884. drawToolTipBridge(opts, config, context, process, eachSpacing, yAxisPoints);
  29885. drawCanvas(opts, context);
  29886. },
  29887. onAnimationFinish: function onAnimationFinish() {
  29888. _this.uevent.trigger('renderComplete');
  29889. }
  29890. });
  29891. break;
  29892. case 'area':
  29893. this.animationInstance = new Animation({
  29894. timing: opts.timing,
  29895. duration: duration,
  29896. onProcess: function onProcess(process) {
  29897. context.clearRect(0, 0, opts.width, opts.height);
  29898. if (opts.rotate) {
  29899. contextRotate(context, opts);
  29900. }
  29901. drawYAxisGrid(categories, opts, config, context);
  29902. drawXAxis(categories, opts, config, context);
  29903. var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process),
  29904. xAxisPoints = _drawAreaDataPoints.xAxisPoints,
  29905. calPoints = _drawAreaDataPoints.calPoints,
  29906. eachSpacing = _drawAreaDataPoints.eachSpacing;
  29907. opts.chartData.xAxisPoints = xAxisPoints;
  29908. opts.chartData.calPoints = calPoints;
  29909. opts.chartData.eachSpacing = eachSpacing;
  29910. drawYAxis(series, opts, config, context);
  29911. if (opts.enableMarkLine !== false && process === 1) {
  29912. drawMarkLine(opts, config, context);
  29913. }
  29914. drawLegend(opts.series, opts, config, context, opts.chartData);
  29915. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29916. drawCanvas(opts, context);
  29917. },
  29918. onAnimationFinish: function onAnimationFinish() {
  29919. _this.uevent.trigger('renderComplete');
  29920. }
  29921. });
  29922. break;
  29923. case 'ring':
  29924. this.animationInstance = new Animation({
  29925. timing: opts.timing,
  29926. duration: duration,
  29927. onProcess: function onProcess(process) {
  29928. context.clearRect(0, 0, opts.width, opts.height);
  29929. if (opts.rotate) {
  29930. contextRotate(context, opts);
  29931. }
  29932. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  29933. drawLegend(opts.series, opts, config, context, opts.chartData);
  29934. drawToolTipBridge(opts, config, context, process);
  29935. drawCanvas(opts, context);
  29936. },
  29937. onAnimationFinish: function onAnimationFinish() {
  29938. _this.uevent.trigger('renderComplete');
  29939. }
  29940. });
  29941. break;
  29942. case 'pie':
  29943. this.animationInstance = new Animation({
  29944. timing: opts.timing,
  29945. duration: duration,
  29946. onProcess: function onProcess(process) {
  29947. context.clearRect(0, 0, opts.width, opts.height);
  29948. if (opts.rotate) {
  29949. contextRotate(context, opts);
  29950. }
  29951. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  29952. drawLegend(opts.series, opts, config, context, opts.chartData);
  29953. drawToolTipBridge(opts, config, context, process);
  29954. drawCanvas(opts, context);
  29955. },
  29956. onAnimationFinish: function onAnimationFinish() {
  29957. _this.uevent.trigger('renderComplete');
  29958. }
  29959. });
  29960. break;
  29961. case 'rose':
  29962. this.animationInstance = new Animation({
  29963. timing: opts.timing,
  29964. duration: duration,
  29965. onProcess: function onProcess(process) {
  29966. context.clearRect(0, 0, opts.width, opts.height);
  29967. if (opts.rotate) {
  29968. contextRotate(context, opts);
  29969. }
  29970. opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process);
  29971. drawLegend(opts.series, opts, config, context, opts.chartData);
  29972. drawToolTipBridge(opts, config, context, process);
  29973. drawCanvas(opts, context);
  29974. },
  29975. onAnimationFinish: function onAnimationFinish() {
  29976. _this.uevent.trigger('renderComplete');
  29977. }
  29978. });
  29979. break;
  29980. case 'radar':
  29981. this.animationInstance = new Animation({
  29982. timing: opts.timing,
  29983. duration: duration,
  29984. onProcess: function onProcess(process) {
  29985. context.clearRect(0, 0, opts.width, opts.height);
  29986. if (opts.rotate) {
  29987. contextRotate(context, opts);
  29988. }
  29989. opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process);
  29990. drawLegend(opts.series, opts, config, context, opts.chartData);
  29991. drawToolTipBridge(opts, config, context, process);
  29992. drawCanvas(opts, context);
  29993. },
  29994. onAnimationFinish: function onAnimationFinish() {
  29995. _this.uevent.trigger('renderComplete');
  29996. }
  29997. });
  29998. break;
  29999. case 'arcbar':
  30000. this.animationInstance = new Animation({
  30001. timing: opts.timing,
  30002. duration: duration,
  30003. onProcess: function onProcess(process) {
  30004. context.clearRect(0, 0, opts.width, opts.height);
  30005. if (opts.rotate) {
  30006. contextRotate(context, opts);
  30007. }
  30008. opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, process);
  30009. drawCanvas(opts, context);
  30010. },
  30011. onAnimationFinish: function onAnimationFinish() {
  30012. _this.uevent.trigger('renderComplete');
  30013. }
  30014. });
  30015. break;
  30016. case 'gauge':
  30017. this.animationInstance = new Animation({
  30018. timing: opts.timing,
  30019. duration: duration,
  30020. onProcess: function onProcess(process) {
  30021. context.clearRect(0, 0, opts.width, opts.height);
  30022. if (opts.rotate) {
  30023. contextRotate(context, opts);
  30024. }
  30025. opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, context, process);
  30026. drawCanvas(opts, context);
  30027. },
  30028. onAnimationFinish: function onAnimationFinish() {
  30029. _this.uevent.trigger('renderComplete');
  30030. }
  30031. });
  30032. break;
  30033. case 'candle':
  30034. this.animationInstance = new Animation({
  30035. timing: opts.timing,
  30036. duration: duration,
  30037. onProcess: function onProcess(process) {
  30038. context.clearRect(0, 0, opts.width, opts.height);
  30039. if (opts.rotate) {
  30040. contextRotate(context, opts);
  30041. }
  30042. drawYAxisGrid(categories, opts, config, context);
  30043. drawXAxis(categories, opts, config, context);
  30044. var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, context, process),
  30045. xAxisPoints = _drawCandleDataPoints.xAxisPoints,
  30046. calPoints = _drawCandleDataPoints.calPoints,
  30047. eachSpacing = _drawCandleDataPoints.eachSpacing;
  30048. opts.chartData.xAxisPoints = xAxisPoints;
  30049. opts.chartData.calPoints = calPoints;
  30050. opts.chartData.eachSpacing = eachSpacing;
  30051. drawYAxis(series, opts, config, context);
  30052. if (opts.enableMarkLine !== false && process === 1) {
  30053. drawMarkLine(opts, config, context);
  30054. }
  30055. if (seriesMA) {
  30056. drawLegend(seriesMA, opts, config, context, opts.chartData);
  30057. } else {
  30058. drawLegend(opts.series, opts, config, context, opts.chartData);
  30059. }
  30060. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  30061. drawCanvas(opts, context);
  30062. },
  30063. onAnimationFinish: function onAnimationFinish() {
  30064. _this.uevent.trigger('renderComplete');
  30065. }
  30066. });
  30067. break;
  30068. }
  30069. }
  30070. function uChartsEvent() {
  30071. this.events = {};
  30072. }
  30073. uChartsEvent.prototype.addEventListener = function (type, listener) {
  30074. this.events[type] = this.events[type] || [];
  30075. this.events[type].push(listener);
  30076. };
  30077. uChartsEvent.prototype.delEventListener = function (type) {
  30078. this.events[type] = [];
  30079. };
  30080. uChartsEvent.prototype.trigger = function () {
  30081. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  30082. args[_key] = arguments[_key];
  30083. }
  30084. var type = args[0];
  30085. var params = args.slice(1);
  30086. if (!!this.events[type]) {
  30087. this.events[type].forEach(function (listener) {
  30088. try {
  30089. listener.apply(null, params);
  30090. } catch (e) {
  30091. //console.log('[uCharts] '+e);
  30092. }
  30093. });
  30094. }
  30095. };
  30096. var uCharts = function uCharts(opts) {
  30097. opts.pix = opts.pixelRatio ? opts.pixelRatio : 1;
  30098. opts.fontSize = opts.fontSize ? opts.fontSize : 13;
  30099. opts.fontColor = opts.fontColor ? opts.fontColor : config.fontColor;
  30100. if (opts.background == "" || opts.background == "none") {
  30101. opts.background = "#FFFFFF";
  30102. }
  30103. opts.title = assign({}, opts.title);
  30104. opts.subtitle = assign({}, opts.subtitle);
  30105. opts.duration = opts.duration ? opts.duration : 1000;
  30106. opts.yAxis = assign({}, {
  30107. data: [],
  30108. showTitle: false,
  30109. disabled: false,
  30110. disableGrid: false,
  30111. gridSet: 'number',
  30112. splitNumber: 5,
  30113. gridType: 'solid',
  30114. dashLength: 4 * opts.pix,
  30115. gridColor: '#cccccc',
  30116. padding: 10,
  30117. fontColor: '#666666'
  30118. }, opts.yAxis);
  30119. opts.xAxis = assign({}, {
  30120. rotateLabel: false,
  30121. rotateAngle: 45,
  30122. disabled: false,
  30123. disableGrid: false,
  30124. splitNumber: 5,
  30125. calibration: false,
  30126. fontColor: '#666666',
  30127. fontSize: 13,
  30128. lineHeight: 20,
  30129. marginTop: 0,
  30130. gridType: 'solid',
  30131. dashLength: 4,
  30132. scrollAlign: 'left',
  30133. boundaryGap: 'center',
  30134. axisLine: true,
  30135. axisLineColor: '#cccccc',
  30136. titleFontSize: 13,
  30137. titleOffsetY: 0,
  30138. titleOffsetX: 0,
  30139. titleFontColor: '#666666'
  30140. }, opts.xAxis);
  30141. opts.xAxis.scrollPosition = opts.xAxis.scrollAlign;
  30142. opts.legend = assign({}, {
  30143. show: true,
  30144. position: 'bottom',
  30145. float: 'center',
  30146. backgroundColor: 'rgba(0,0,0,0)',
  30147. borderColor: 'rgba(0,0,0,0)',
  30148. borderWidth: 0,
  30149. padding: 5,
  30150. margin: 5,
  30151. itemGap: 10,
  30152. fontSize: opts.fontSize,
  30153. lineHeight: opts.fontSize,
  30154. fontColor: opts.fontColor,
  30155. formatter: {},
  30156. hiddenColor: '#CECECE'
  30157. }, opts.legend);
  30158. opts.extra = assign({
  30159. tooltip: {
  30160. legendShape: 'auto'
  30161. }
  30162. }, opts.extra);
  30163. opts.rotate = opts.rotate ? true : false;
  30164. opts.animation = opts.animation ? true : false;
  30165. opts.rotate = opts.rotate ? true : false;
  30166. opts.canvas2d = opts.canvas2d ? true : false;
  30167. var config$$1 = assign({}, config);
  30168. config$$1.color = opts.color ? opts.color : config$$1.color;
  30169. if (opts.type == 'pie') {
  30170. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  30171. }
  30172. if (opts.type == 'ring') {
  30173. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.ring.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  30174. }
  30175. if (opts.type == 'rose') {
  30176. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  30177. }
  30178. config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pix;
  30179. //屏幕旋转
  30180. config$$1.rotate = opts.rotate;
  30181. if (opts.rotate) {
  30182. var tempWidth = opts.width;
  30183. var tempHeight = opts.height;
  30184. opts.width = tempHeight;
  30185. opts.height = tempWidth;
  30186. }
  30187. //适配高分屏
  30188. opts.padding = opts.padding ? opts.padding : config$$1.padding;
  30189. config$$1.yAxisWidth = config.yAxisWidth * opts.pix;
  30190. config$$1.fontSize = opts.fontSize * opts.pix;
  30191. config$$1.titleFontSize = config.titleFontSize * opts.pix;
  30192. config$$1.subtitleFontSize = config.subtitleFontSize * opts.pix;
  30193. if (!opts.context) {
  30194. throw new Error('[uCharts] 未获取到context!注意:v2.0版本后,需要自行获取canvas的绘图上下文并传入opts.context!');
  30195. }
  30196. this.context = opts.context;
  30197. if (!this.context.setTextAlign) {
  30198. this.context.setStrokeStyle = function (e) {
  30199. return this.strokeStyle = e;
  30200. };
  30201. this.context.setLineWidth = function (e) {
  30202. return this.lineWidth = e;
  30203. };
  30204. this.context.setLineCap = function (e) {
  30205. return this.lineCap = e;
  30206. };
  30207. this.context.setFontSize = function (e) {
  30208. return this.font = e + "px sans-serif";
  30209. };
  30210. this.context.setFillStyle = function (e) {
  30211. return this.fillStyle = e;
  30212. };
  30213. this.context.setTextAlign = function (e) {
  30214. return this.textAlign = e;
  30215. };
  30216. this.context.setTextBaseline = function (e) {
  30217. return this.textBaseline = e;
  30218. };
  30219. this.context.setShadow = function (offsetX, offsetY, blur, color) {
  30220. this.shadowColor = color;
  30221. this.shadowOffsetX = offsetX;
  30222. this.shadowOffsetY = offsetY;
  30223. this.shadowBlur = blur;
  30224. };
  30225. this.context.draw = function () {};
  30226. }
  30227. //兼容NVUEsetLineDash
  30228. if (!this.context.setLineDash) {
  30229. this.context.setLineDash = function (e) {};
  30230. }
  30231. opts.chartData = {};
  30232. this.uevent = new uChartsEvent();
  30233. this.scrollOption = {
  30234. currentOffset: 0,
  30235. startTouchX: 0,
  30236. distance: 0,
  30237. lastMoveTime: 0
  30238. };
  30239. this.opts = opts;
  30240. this.config = config$$1;
  30241. drawCharts.call(this, opts.type, opts, config$$1, this.context);
  30242. };
  30243. uCharts.prototype.updateData = function () {
  30244. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  30245. this.opts = assign({}, this.opts, data);
  30246. this.opts.updateData = true;
  30247. var scrollPosition = data.scrollPosition || 'current';
  30248. switch (scrollPosition) {
  30249. case 'current':
  30250. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  30251. break;
  30252. case 'left':
  30253. this.opts._scrollDistance_ = 0;
  30254. this.scrollOption = {
  30255. currentOffset: 0,
  30256. startTouchX: 0,
  30257. distance: 0,
  30258. lastMoveTime: 0
  30259. };
  30260. break;
  30261. case 'right':
  30262. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
  30263. yAxisWidth = _calYAxisData.yAxisWidth;
  30264. this.config.yAxisWidth = yAxisWidth;
  30265. var offsetLeft = 0;
  30266. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  30267. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  30268. startX = _getXAxisPoints0.startX,
  30269. endX = _getXAxisPoints0.endX,
  30270. eachSpacing = _getXAxisPoints0.eachSpacing;
  30271. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  30272. var screenWidth = endX - startX;
  30273. offsetLeft = screenWidth - totalWidth;
  30274. this.scrollOption = {
  30275. currentOffset: offsetLeft,
  30276. startTouchX: offsetLeft,
  30277. distance: 0,
  30278. lastMoveTime: 0
  30279. };
  30280. this.opts._scrollDistance_ = offsetLeft;
  30281. break;
  30282. }
  30283. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30284. };
  30285. uCharts.prototype.zoom = function () {
  30286. var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
  30287. if (this.opts.enableScroll !== true) {
  30288. console.log('[uCharts] 请启用滚动条后使用');
  30289. return;
  30290. }
  30291. //当前屏幕中间点
  30292. var centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(this.opts.xAxis.itemCount / 2);
  30293. this.opts.animation = false;
  30294. this.opts.xAxis.itemCount = val.itemCount;
  30295. //重新计算x轴偏移距离
  30296. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
  30297. yAxisWidth = _calYAxisData.yAxisWidth;
  30298. this.config.yAxisWidth = yAxisWidth;
  30299. var offsetLeft = 0;
  30300. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  30301. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  30302. startX = _getXAxisPoints0.startX,
  30303. endX = _getXAxisPoints0.endX,
  30304. eachSpacing = _getXAxisPoints0.eachSpacing;
  30305. var centerLeft = eachSpacing * centerPoint;
  30306. var screenWidth = endX - startX;
  30307. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  30308. offsetLeft = screenWidth / 2 - centerLeft;
  30309. if (offsetLeft > 0) {
  30310. offsetLeft = 0;
  30311. }
  30312. if (offsetLeft < MaxLeft) {
  30313. offsetLeft = MaxLeft;
  30314. }
  30315. this.scrollOption = {
  30316. currentOffset: offsetLeft,
  30317. startTouchX: 0,
  30318. distance: 0,
  30319. lastMoveTime: 0
  30320. };
  30321. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  30322. this.opts._scrollDistance_ = offsetLeft;
  30323. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30324. };
  30325. uCharts.prototype.dobuleZoom = function (e) {
  30326. if (this.opts.enableScroll !== true) {
  30327. console.log('[uCharts] 请启用滚动条后使用');
  30328. return;
  30329. }
  30330. var tcs = e.changedTouches;
  30331. if (tcs.length < 2) {
  30332. return;
  30333. }
  30334. for (var i = 0; i < tcs.length; i++) {
  30335. tcs[i].x = tcs[i].x ? tcs[i].x : tcs[i].clientX;
  30336. tcs[i].y = tcs[i].y ? tcs[i].y : tcs[i].clientY;
  30337. }
  30338. var ntcs = [getTouches(tcs[0], this.opts, e), getTouches(tcs[1], this.opts, e)];
  30339. var xlength = Math.abs(ntcs[0].x - ntcs[1].x);
  30340. // 记录初始的两指之间的数据
  30341. if (!this.scrollOption.moveCount) {
  30342. var cts0 = {
  30343. changedTouches: [{
  30344. x: tcs[0].x,
  30345. y: this.opts.area[0] / this.opts.pix + 2
  30346. }]
  30347. };
  30348. var cts1 = {
  30349. changedTouches: [{
  30350. x: tcs[1].x,
  30351. y: this.opts.area[0] / this.opts.pix + 2
  30352. }]
  30353. };
  30354. if (this.opts.rotate) {
  30355. cts0 = {
  30356. changedTouches: [{
  30357. x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
  30358. y: tcs[0].y
  30359. }]
  30360. };
  30361. cts1 = {
  30362. changedTouches: [{
  30363. x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
  30364. y: tcs[1].y
  30365. }]
  30366. };
  30367. }
  30368. var moveCurrent1 = this.getCurrentDataIndex(cts0).index;
  30369. var moveCurrent2 = this.getCurrentDataIndex(cts1).index;
  30370. var moveCount = Math.abs(moveCurrent1 - moveCurrent2);
  30371. this.scrollOption.moveCount = moveCount;
  30372. this.scrollOption.moveCurrent1 = Math.min(moveCurrent1, moveCurrent2);
  30373. this.scrollOption.moveCurrent2 = Math.max(moveCurrent1, moveCurrent2);
  30374. return;
  30375. }
  30376. var currentEachSpacing = xlength / this.scrollOption.moveCount;
  30377. var itemCount = (this.opts.width - this.opts.area[1] - this.opts.area[3]) / currentEachSpacing;
  30378. itemCount = itemCount <= 2 ? 2 : itemCount;
  30379. itemCount = itemCount >= this.opts.categories.length ? this.opts.categories.length : itemCount;
  30380. this.opts.animation = false;
  30381. this.opts.xAxis.itemCount = itemCount;
  30382. // 重新计算滚动条偏移距离
  30383. var offsetLeft = 0;
  30384. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  30385. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  30386. startX = _getXAxisPoints0.startX,
  30387. endX = _getXAxisPoints0.endX,
  30388. eachSpacing = _getXAxisPoints0.eachSpacing;
  30389. var currentLeft = eachSpacing * this.scrollOption.moveCurrent1;
  30390. var screenWidth = endX - startX;
  30391. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  30392. offsetLeft = -currentLeft + Math.min(ntcs[0].x, ntcs[1].x) - this.opts.area[3] - eachSpacing;
  30393. if (offsetLeft > 0) {
  30394. offsetLeft = 0;
  30395. }
  30396. if (offsetLeft < MaxLeft) {
  30397. offsetLeft = MaxLeft;
  30398. }
  30399. this.scrollOption.currentOffset = offsetLeft;
  30400. this.scrollOption.startTouchX = 0;
  30401. this.scrollOption.distance = 0;
  30402. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  30403. this.opts._scrollDistance_ = offsetLeft;
  30404. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30405. };
  30406. uCharts.prototype.stopAnimation = function () {
  30407. this.animationInstance && this.animationInstance.stop();
  30408. };
  30409. uCharts.prototype.addEventListener = function (type, listener) {
  30410. this.uevent.addEventListener(type, listener);
  30411. };
  30412. uCharts.prototype.delEventListener = function (type) {
  30413. this.uevent.delEventListener(type);
  30414. };
  30415. uCharts.prototype.getCurrentDataIndex = function (e) {
  30416. var touches = null;
  30417. if (e.changedTouches) {
  30418. touches = e.changedTouches[0];
  30419. } else {
  30420. touches = e.mp.changedTouches[0];
  30421. }
  30422. if (touches) {
  30423. var _touches$ = getTouches(touches, this.opts, e);
  30424. if (this.opts.type === 'pie' || this.opts.type === 'ring') {
  30425. return findPieChartCurrentIndex({
  30426. x: _touches$.x,
  30427. y: _touches$.y
  30428. }, this.opts.chartData.pieData, this.opts);
  30429. } else if (this.opts.type === 'rose') {
  30430. return findRoseChartCurrentIndex({
  30431. x: _touches$.x,
  30432. y: _touches$.y
  30433. }, this.opts.chartData.pieData, this.opts);
  30434. } else if (this.opts.type === 'radar') {
  30435. return findRadarChartCurrentIndex({
  30436. x: _touches$.x,
  30437. y: _touches$.y
  30438. }, this.opts.chartData.radarData, this.opts.categories.length);
  30439. } else if (this.opts.type === 'funnel') {
  30440. return findFunnelChartCurrentIndex({
  30441. x: _touches$.x,
  30442. y: _touches$.y
  30443. }, this.opts.chartData.funnelData);
  30444. } else if (this.opts.type === 'map') {
  30445. return findMapChartCurrentIndex({
  30446. x: _touches$.x,
  30447. y: _touches$.y
  30448. }, this.opts);
  30449. } else if (this.opts.type === 'word') {
  30450. return findWordChartCurrentIndex({
  30451. x: _touches$.x,
  30452. y: _touches$.y
  30453. }, this.opts.chartData.wordCloudData);
  30454. } else if (this.opts.type === 'bar') {
  30455. return findBarChartCurrentIndex({
  30456. x: _touches$.x,
  30457. y: _touches$.y
  30458. }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  30459. } else {
  30460. return findCurrentIndex({
  30461. x: _touches$.x,
  30462. y: _touches$.y
  30463. }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  30464. }
  30465. }
  30466. return -1;
  30467. };
  30468. uCharts.prototype.getLegendDataIndex = function (e) {
  30469. var touches = null;
  30470. if (e.changedTouches) {
  30471. touches = e.changedTouches[0];
  30472. } else {
  30473. touches = e.mp.changedTouches[0];
  30474. }
  30475. if (touches) {
  30476. var _touches$ = getTouches(touches, this.opts, e);
  30477. return findLegendIndex({
  30478. x: _touches$.x,
  30479. y: _touches$.y
  30480. }, this.opts.chartData.legendData);
  30481. }
  30482. return -1;
  30483. };
  30484. uCharts.prototype.touchLegend = function (e) {
  30485. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  30486. var touches = null;
  30487. if (e.changedTouches) {
  30488. touches = e.changedTouches[0];
  30489. } else {
  30490. touches = e.mp.changedTouches[0];
  30491. }
  30492. if (touches) {
  30493. var _touches$ = getTouches(touches, this.opts, e);
  30494. var index = this.getLegendDataIndex(e);
  30495. if (index >= 0) {
  30496. if (this.opts.type == 'candle') {
  30497. this.opts.seriesMA[index].show = !this.opts.seriesMA[index].show;
  30498. } else {
  30499. this.opts.series[index].show = !this.opts.series[index].show;
  30500. }
  30501. this.opts.animation = option.animation ? true : false;
  30502. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  30503. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30504. }
  30505. }
  30506. };
  30507. uCharts.prototype.showToolTip = function (e) {
  30508. var _this3 = this;
  30509. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  30510. var touches = null;
  30511. if (e.changedTouches) {
  30512. touches = e.changedTouches[0];
  30513. } else {
  30514. touches = e.mp.changedTouches[0];
  30515. }
  30516. if (!touches) {
  30517. console.log("[uCharts] 未获取到event坐标信息");
  30518. }
  30519. var _touches$ = getTouches(touches, this.opts, e);
  30520. var currentOffset = this.scrollOption.currentOffset;
  30521. var opts = assign({}, this.opts, {
  30522. _scrollDistance_: currentOffset,
  30523. animation: false
  30524. });
  30525. if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column' || this.opts.type === 'scatter' || this.opts.type === 'bubble') {
  30526. var current = this.getCurrentDataIndex(e);
  30527. var index = option.index == undefined ? current.index : option.index;
  30528. if (index > -1 || index.length > 0) {
  30529. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  30530. if (seriesData.length !== 0) {
  30531. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  30532. textList = _getToolTipData.textList,
  30533. offset = _getToolTipData.offset;
  30534. offset.y = _touches$.y;
  30535. opts.tooltip = {
  30536. textList: option.textList !== undefined ? option.textList : textList,
  30537. offset: option.offset !== undefined ? option.offset : offset,
  30538. option: option,
  30539. index: index,
  30540. group: current.group
  30541. };
  30542. }
  30543. }
  30544. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30545. }
  30546. if (this.opts.type === 'mount') {
  30547. var index = option.index == undefined ? this.getCurrentDataIndex(e).index : option.index;
  30548. if (index > -1) {
  30549. var opts = assign({}, this.opts, {
  30550. animation: false
  30551. });
  30552. var seriesData = assign({}, opts._series_[index]);
  30553. var textList = [{
  30554. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  30555. color: seriesData.color,
  30556. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30557. }];
  30558. var offset = {
  30559. x: opts.chartData.calPoints[index].x,
  30560. y: _touches$.y
  30561. };
  30562. opts.tooltip = {
  30563. textList: option.textList ? option.textList : textList,
  30564. offset: option.offset !== undefined ? option.offset : offset,
  30565. option: option,
  30566. index: index
  30567. };
  30568. }
  30569. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30570. }
  30571. if (this.opts.type === 'bar') {
  30572. var current = this.getCurrentDataIndex(e);
  30573. var index = option.index == undefined ? current.index : option.index;
  30574. if (index > -1 || index.length > 0) {
  30575. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  30576. if (seriesData.length !== 0) {
  30577. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  30578. textList = _getToolTipData.textList,
  30579. offset = _getToolTipData.offset;
  30580. offset.x = _touches$.x;
  30581. opts.tooltip = {
  30582. textList: option.textList !== undefined ? option.textList : textList,
  30583. offset: option.offset !== undefined ? option.offset : offset,
  30584. option: option,
  30585. index: index
  30586. };
  30587. }
  30588. }
  30589. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30590. }
  30591. if (this.opts.type === 'mix') {
  30592. var current = this.getCurrentDataIndex(e);
  30593. var index = option.index == undefined ? current.index : option.index;
  30594. if (index > -1) {
  30595. var currentOffset = this.scrollOption.currentOffset;
  30596. var opts = assign({}, this.opts, {
  30597. _scrollDistance_: currentOffset,
  30598. animation: false
  30599. });
  30600. var seriesData = getSeriesDataItem(this.opts.series, index);
  30601. if (seriesData.length !== 0) {
  30602. var _getMixToolTipData = getMixToolTipData(seriesData, this.opts, index, this.opts.categories, option),
  30603. textList = _getMixToolTipData.textList,
  30604. offset = _getMixToolTipData.offset;
  30605. offset.y = _touches$.y;
  30606. opts.tooltip = {
  30607. textList: option.textList ? option.textList : textList,
  30608. offset: option.offset !== undefined ? option.offset : offset,
  30609. option: option,
  30610. index: index
  30611. };
  30612. }
  30613. }
  30614. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30615. }
  30616. if (this.opts.type === 'candle') {
  30617. var current = this.getCurrentDataIndex(e);
  30618. var index = option.index == undefined ? current.index : option.index;
  30619. if (index > -1) {
  30620. var currentOffset = this.scrollOption.currentOffset;
  30621. var opts = assign({}, this.opts, {
  30622. _scrollDistance_: currentOffset,
  30623. animation: false
  30624. });
  30625. var seriesData = getSeriesDataItem(this.opts.series, index);
  30626. if (seriesData.length !== 0) {
  30627. var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts, index, this.opts.categories, this.opts.extra.candle, option),
  30628. textList = _getToolTipData.textList,
  30629. offset = _getToolTipData.offset;
  30630. offset.y = _touches$.y;
  30631. opts.tooltip = {
  30632. textList: option.textList ? option.textList : textList,
  30633. offset: option.offset !== undefined ? option.offset : offset,
  30634. option: option,
  30635. index: index
  30636. };
  30637. }
  30638. }
  30639. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30640. }
  30641. if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose' || this.opts.type === 'funnel') {
  30642. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30643. if (index > -1) {
  30644. var opts = assign({}, this.opts, {
  30645. animation: false
  30646. });
  30647. var seriesData = assign({}, opts._series_[index]);
  30648. var textList = [{
  30649. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  30650. color: seriesData.color,
  30651. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30652. }];
  30653. var offset = {
  30654. x: _touches$.x,
  30655. y: _touches$.y
  30656. };
  30657. opts.tooltip = {
  30658. textList: option.textList ? option.textList : textList,
  30659. offset: option.offset !== undefined ? option.offset : offset,
  30660. option: option,
  30661. index: index
  30662. };
  30663. }
  30664. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30665. }
  30666. if (this.opts.type === 'map') {
  30667. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30668. if (index > -1) {
  30669. var opts = assign({}, this.opts, {
  30670. animation: false
  30671. });
  30672. var seriesData = assign({}, this.opts.series[index]);
  30673. seriesData.name = seriesData.properties.name;
  30674. var textList = [{
  30675. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  30676. color: seriesData.color,
  30677. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30678. }];
  30679. var offset = {
  30680. x: _touches$.x,
  30681. y: _touches$.y
  30682. };
  30683. opts.tooltip = {
  30684. textList: option.textList ? option.textList : textList,
  30685. offset: option.offset !== undefined ? option.offset : offset,
  30686. option: option,
  30687. index: index
  30688. };
  30689. }
  30690. opts.updateData = false;
  30691. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30692. }
  30693. if (this.opts.type === 'word') {
  30694. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30695. if (index > -1) {
  30696. var opts = assign({}, this.opts, {
  30697. animation: false
  30698. });
  30699. var seriesData = assign({}, this.opts.series[index]);
  30700. var textList = [{
  30701. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  30702. color: seriesData.color,
  30703. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30704. }];
  30705. var offset = {
  30706. x: _touches$.x,
  30707. y: _touches$.y
  30708. };
  30709. opts.tooltip = {
  30710. textList: option.textList ? option.textList : textList,
  30711. offset: option.offset !== undefined ? option.offset : offset,
  30712. option: option,
  30713. index: index
  30714. };
  30715. }
  30716. opts.updateData = false;
  30717. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30718. }
  30719. if (this.opts.type === 'radar') {
  30720. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30721. if (index > -1) {
  30722. var opts = assign({}, this.opts, {
  30723. animation: false
  30724. });
  30725. var seriesData = getSeriesDataItem(this.opts.series, index);
  30726. if (seriesData.length !== 0) {
  30727. var textList = seriesData.map(function (item) {
  30728. return {
  30729. text: option.formatter ? option.formatter(item, _this3.opts.categories[index], index, _this3.opts) : item.name + ': ' + item.data,
  30730. color: item.color,
  30731. legendShape: _this3.opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : _this3.opts.extra.tooltip.legendShape
  30732. };
  30733. });
  30734. var offset = {
  30735. x: _touches$.x,
  30736. y: _touches$.y
  30737. };
  30738. opts.tooltip = {
  30739. textList: option.textList ? option.textList : textList,
  30740. offset: option.offset !== undefined ? option.offset : offset,
  30741. option: option,
  30742. index: index
  30743. };
  30744. }
  30745. }
  30746. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30747. }
  30748. };
  30749. uCharts.prototype.translate = function (distance) {
  30750. this.scrollOption = {
  30751. currentOffset: distance,
  30752. startTouchX: distance,
  30753. distance: 0,
  30754. lastMoveTime: 0
  30755. };
  30756. var opts = assign({}, this.opts, {
  30757. _scrollDistance_: distance,
  30758. animation: false
  30759. });
  30760. drawCharts.call(this, this.opts.type, opts, this.config, this.context);
  30761. };
  30762. uCharts.prototype.scrollStart = function (e) {
  30763. var touches = null;
  30764. if (e.changedTouches) {
  30765. touches = e.changedTouches[0];
  30766. } else {
  30767. touches = e.mp.changedTouches[0];
  30768. }
  30769. var _touches$ = getTouches(touches, this.opts, e);
  30770. if (touches && this.opts.enableScroll === true) {
  30771. this.scrollOption.startTouchX = _touches$.x;
  30772. }
  30773. };
  30774. uCharts.prototype.scroll = function (e) {
  30775. if (this.scrollOption.lastMoveTime === 0) {
  30776. this.scrollOption.lastMoveTime = Date.now();
  30777. }
  30778. var Limit = this.opts.touchMoveLimit || 60;
  30779. var currMoveTime = Date.now();
  30780. var duration = currMoveTime - this.scrollOption.lastMoveTime;
  30781. if (duration < Math.floor(1000 / Limit)) return;
  30782. if (this.scrollOption.startTouchX == 0) return;
  30783. this.scrollOption.lastMoveTime = currMoveTime;
  30784. var touches = null;
  30785. if (e.changedTouches) {
  30786. touches = e.changedTouches[0];
  30787. } else {
  30788. touches = e.mp.changedTouches[0];
  30789. }
  30790. if (touches && this.opts.enableScroll === true) {
  30791. var _touches$ = getTouches(touches, this.opts, e);
  30792. var _distance;
  30793. _distance = _touches$.x - this.scrollOption.startTouchX;
  30794. var currentOffset = this.scrollOption.currentOffset;
  30795. var validDistance = calValidDistance(this, currentOffset + _distance, this.opts.chartData, this.config, this.opts);
  30796. this.scrollOption.distance = _distance = validDistance - currentOffset;
  30797. var opts = assign({}, this.opts, {
  30798. _scrollDistance_: currentOffset + _distance,
  30799. animation: false
  30800. });
  30801. this.opts = opts;
  30802. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30803. return currentOffset + _distance;
  30804. }
  30805. };
  30806. uCharts.prototype.scrollEnd = function (e) {
  30807. if (this.opts.enableScroll === true) {
  30808. var _scrollOption = this.scrollOption,
  30809. currentOffset = _scrollOption.currentOffset,
  30810. distance = _scrollOption.distance;
  30811. this.scrollOption.currentOffset = currentOffset + distance;
  30812. this.scrollOption.distance = 0;
  30813. this.scrollOption.moveCount = 0;
  30814. }
  30815. };
  30816. var _default = uCharts;
  30817. exports.default = _default;
  30818. /***/ }),
  30819. /***/ 707:
  30820. /*!************************************************************************************!*\
  30821. !*** E:/work/mdapp/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js ***!
  30822. \************************************************************************************/
  30823. /*! no static exports found */
  30824. /***/ (function(module, exports, __webpack_require__) {
  30825. "use strict";
  30826. Object.defineProperty(exports, "__esModule", {
  30827. value: true
  30828. });
  30829. exports.default = void 0;
  30830. /*
  30831. * uCharts®
  30832. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台
  30833. * Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
  30834. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  30835. * 复制使用请保留本段注释,感谢支持开源!
  30836. *
  30837. * uCharts®官方网站
  30838. * https://www.uCharts.cn
  30839. *
  30840. * 开源地址:
  30841. * https://gitee.com/uCharts/uCharts
  30842. *
  30843. * uni-app插件市场地址:
  30844. * http://ext.dcloud.net.cn/plugin?id=271
  30845. *
  30846. */
  30847. // 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
  30848. var color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
  30849. //事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
  30850. var formatDateTime = function formatDateTime(timeStamp, returnType) {
  30851. var date = new Date();
  30852. date.setTime(timeStamp * 1000);
  30853. var y = date.getFullYear();
  30854. var m = date.getMonth() + 1;
  30855. m = m < 10 ? '0' + m : m;
  30856. var d = date.getDate();
  30857. d = d < 10 ? '0' + d : d;
  30858. var h = date.getHours();
  30859. h = h < 10 ? '0' + h : h;
  30860. var minute = date.getMinutes();
  30861. var second = date.getSeconds();
  30862. minute = minute < 10 ? '0' + minute : minute;
  30863. second = second < 10 ? '0' + second : second;
  30864. if (returnType == 'full') {
  30865. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  30866. }
  30867. if (returnType == 'y-m-d') {
  30868. return y + '-' + m + '-' + d;
  30869. }
  30870. if (returnType == 'h:m') {
  30871. return h + ':' + minute;
  30872. }
  30873. if (returnType == 'h:m:s') {
  30874. return h + ':' + minute + ':' + second;
  30875. }
  30876. return [y, m, d, h, minute, second];
  30877. };
  30878. var cfu = {
  30879. //demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
  30880. "type": ["pie", "ring", "rose", "word", "funnel", "map", "arcbar", "line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "tline", "tarea", "scatter", "bubble", "demotype"],
  30881. "range": ["饼状图", "圆环图", "玫瑰图", "词云图", "漏斗图", "地图", "圆弧进度条", "折线图", "柱状图", "山峰图", "条状图", "区域图", "雷达图", "仪表盘", "K线图", "混合图", "时间轴折线", "时间轴区域", "散点图", "气泡图", "自定义类型"],
  30882. //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
  30883. //自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
  30884. "categories": ["line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "demotype"],
  30885. //instance为实例变量承载属性,不要删除
  30886. "instance": {},
  30887. //option为opts及eopts承载属性,不要删除
  30888. "option": {},
  30889. //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
  30890. "formatter": {
  30891. "yAxisDemo1": function yAxisDemo1(val, index, opts) {
  30892. return val + '元';
  30893. },
  30894. "yAxisDemo2": function yAxisDemo2(val, index, opts) {
  30895. return val.toFixed(2);
  30896. },
  30897. "xAxisDemo1": function xAxisDemo1(val, index, opts) {
  30898. return val + '年';
  30899. },
  30900. "xAxisDemo2": function xAxisDemo2(val, index, opts) {
  30901. return formatDateTime(val, 'h:m');
  30902. },
  30903. "seriesDemo1": function seriesDemo1(val, index, series, opts) {
  30904. return val + '元';
  30905. },
  30906. "tooltipDemo1": function tooltipDemo1(item, category, index, opts) {
  30907. if (index == 0) {
  30908. return '随便用' + item.data + '年';
  30909. } else {
  30910. return '其他我没改' + item.data + '天';
  30911. }
  30912. },
  30913. "pieDemo": function pieDemo(val, index, series, opts) {
  30914. if (index !== undefined) {
  30915. return series[index].name + ':' + series[index].data + '元';
  30916. }
  30917. }
  30918. },
  30919. //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
  30920. "demotype": {
  30921. //我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
  30922. "type": "line",
  30923. "color": color,
  30924. "padding": [15, 10, 0, 15],
  30925. "xAxis": {
  30926. "disableGrid": true
  30927. },
  30928. "yAxis": {
  30929. "gridType": "dash",
  30930. "dashLength": 2
  30931. },
  30932. "legend": {},
  30933. "extra": {
  30934. "line": {
  30935. "type": "curve",
  30936. "width": 2
  30937. }
  30938. }
  30939. },
  30940. //下面是自定义配置,请添加项目所需的通用配置
  30941. "pie": {
  30942. "type": "pie",
  30943. "color": color,
  30944. "padding": [5, 5, 5, 5],
  30945. "extra": {
  30946. "pie": {
  30947. "activeOpacity": 0.5,
  30948. "activeRadius": 10,
  30949. "offsetAngle": 0,
  30950. "labelWidth": 15,
  30951. "border": true,
  30952. "borderWidth": 3,
  30953. "borderColor": "#FFFFFF"
  30954. }
  30955. }
  30956. },
  30957. "ring": {
  30958. "type": "ring",
  30959. "color": color,
  30960. "padding": [5, 5, 5, 5],
  30961. "rotate": false,
  30962. "dataLabel": true,
  30963. "legend": {
  30964. "show": true,
  30965. "position": "right",
  30966. "lineHeight": 25
  30967. },
  30968. "title": {
  30969. "name": "收益率",
  30970. "fontSize": 15,
  30971. "color": "#666666"
  30972. },
  30973. "subtitle": {
  30974. "name": "70%",
  30975. "fontSize": 25,
  30976. "color": "#7cb5ec"
  30977. },
  30978. "extra": {
  30979. "ring": {
  30980. "ringWidth": 30,
  30981. "activeOpacity": 0.5,
  30982. "activeRadius": 10,
  30983. "offsetAngle": 0,
  30984. "labelWidth": 15,
  30985. "border": true,
  30986. "borderWidth": 3,
  30987. "borderColor": "#FFFFFF"
  30988. }
  30989. }
  30990. },
  30991. "rose": {
  30992. "type": "rose",
  30993. "color": color,
  30994. "padding": [5, 5, 5, 5],
  30995. "legend": {
  30996. "show": true,
  30997. "position": "left",
  30998. "lineHeight": 25
  30999. },
  31000. "extra": {
  31001. "rose": {
  31002. "type": "area",
  31003. "minRadius": 50,
  31004. "activeOpacity": 0.5,
  31005. "activeRadius": 10,
  31006. "offsetAngle": 0,
  31007. "labelWidth": 15,
  31008. "border": false,
  31009. "borderWidth": 2,
  31010. "borderColor": "#FFFFFF"
  31011. }
  31012. }
  31013. },
  31014. "word": {
  31015. "type": "word",
  31016. "color": color,
  31017. "extra": {
  31018. "word": {
  31019. "type": "normal",
  31020. "autoColors": false
  31021. }
  31022. }
  31023. },
  31024. "funnel": {
  31025. "type": "funnel",
  31026. "color": color,
  31027. "padding": [15, 15, 0, 15],
  31028. "extra": {
  31029. "funnel": {
  31030. "activeOpacity": 0.3,
  31031. "activeWidth": 10,
  31032. "border": true,
  31033. "borderWidth": 2,
  31034. "borderColor": "#FFFFFF",
  31035. "fillOpacity": 1,
  31036. "labelAlign": "right"
  31037. }
  31038. }
  31039. },
  31040. "map": {
  31041. "type": "map",
  31042. "color": color,
  31043. "padding": [0, 0, 0, 0],
  31044. "dataLabel": true,
  31045. "extra": {
  31046. "map": {
  31047. "border": true,
  31048. "borderWidth": 1,
  31049. "borderColor": "#666666",
  31050. "fillOpacity": 0.6,
  31051. "activeBorderColor": "#F04864",
  31052. "activeFillColor": "#FACC14",
  31053. "activeFillOpacity": 1
  31054. }
  31055. }
  31056. },
  31057. "arcbar": {
  31058. "type": "arcbar",
  31059. "color": color,
  31060. "title": {
  31061. "name": "百分比",
  31062. "fontSize": 25,
  31063. "color": "#00FF00"
  31064. },
  31065. "subtitle": {
  31066. "name": "默认标题",
  31067. "fontSize": 15,
  31068. "color": "#666666"
  31069. },
  31070. "extra": {
  31071. "arcbar": {
  31072. "type": "default",
  31073. "width": 12,
  31074. "backgroundColor": "#E9E9E9",
  31075. "startAngle": 0.75,
  31076. "endAngle": 0.25,
  31077. "gap": 2
  31078. }
  31079. }
  31080. },
  31081. "line": {
  31082. "type": "line",
  31083. "color": color,
  31084. "padding": [15, 10, 0, 15],
  31085. "xAxis": {
  31086. "disableGrid": true
  31087. },
  31088. "yAxis": {
  31089. "gridType": "dash",
  31090. "dashLength": 2
  31091. },
  31092. "legend": {},
  31093. "extra": {
  31094. "line": {
  31095. "type": "straight",
  31096. "width": 2,
  31097. "activeType": "hollow"
  31098. }
  31099. }
  31100. },
  31101. "tline": {
  31102. "type": "line",
  31103. "color": color,
  31104. "padding": [15, 10, 0, 15],
  31105. "xAxis": {
  31106. "disableGrid": false,
  31107. "boundaryGap": "justify"
  31108. },
  31109. "yAxis": {
  31110. "gridType": "dash",
  31111. "dashLength": 2,
  31112. "data": [{
  31113. "min": 0,
  31114. "max": 80
  31115. }]
  31116. },
  31117. "legend": {},
  31118. "extra": {
  31119. "line": {
  31120. "type": "curve",
  31121. "width": 2,
  31122. "activeType": "hollow"
  31123. }
  31124. }
  31125. },
  31126. "tarea": {
  31127. "type": "area",
  31128. "color": color,
  31129. "padding": [15, 10, 0, 15],
  31130. "xAxis": {
  31131. "disableGrid": true,
  31132. "boundaryGap": "justify"
  31133. },
  31134. "yAxis": {
  31135. "gridType": "dash",
  31136. "dashLength": 2,
  31137. "data": [{
  31138. "min": 0,
  31139. "max": 80
  31140. }]
  31141. },
  31142. "legend": {},
  31143. "extra": {
  31144. "area": {
  31145. "type": "curve",
  31146. "opacity": 0.2,
  31147. "addLine": true,
  31148. "width": 2,
  31149. "gradient": true,
  31150. "activeType": "hollow"
  31151. }
  31152. }
  31153. },
  31154. "column": {
  31155. "type": "column",
  31156. "color": color,
  31157. "padding": [15, 15, 0, 5],
  31158. "xAxis": {
  31159. "disableGrid": true
  31160. },
  31161. "yAxis": {
  31162. "data": [{
  31163. "min": 0
  31164. }]
  31165. },
  31166. "legend": {},
  31167. "extra": {
  31168. "column": {
  31169. "type": "group",
  31170. "width": 30,
  31171. "activeBgColor": "#000000",
  31172. "activeBgOpacity": 0.08
  31173. }
  31174. }
  31175. },
  31176. "mount": {
  31177. "type": "mount",
  31178. "color": color,
  31179. "padding": [15, 15, 0, 5],
  31180. "xAxis": {
  31181. "disableGrid": true
  31182. },
  31183. "yAxis": {
  31184. "data": [{
  31185. "min": 0
  31186. }]
  31187. },
  31188. "legend": {},
  31189. "extra": {
  31190. "mount": {
  31191. "type": "mount",
  31192. "widthRatio": 1.5
  31193. }
  31194. }
  31195. },
  31196. "bar": {
  31197. "type": "bar",
  31198. "color": color,
  31199. "padding": [15, 30, 0, 5],
  31200. "xAxis": {
  31201. "boundaryGap": "justify",
  31202. "disableGrid": false,
  31203. "min": 0,
  31204. "axisLine": false
  31205. },
  31206. "yAxis": {},
  31207. "legend": {},
  31208. "extra": {
  31209. "bar": {
  31210. "type": "group",
  31211. "width": 30,
  31212. "meterBorde": 1,
  31213. "meterFillColor": "#FFFFFF",
  31214. "activeBgColor": "#000000",
  31215. "activeBgOpacity": 0.08
  31216. }
  31217. }
  31218. },
  31219. "area": {
  31220. "type": "area",
  31221. "color": color,
  31222. "padding": [15, 15, 0, 15],
  31223. "xAxis": {
  31224. "disableGrid": true
  31225. },
  31226. "yAxis": {
  31227. "gridType": "dash",
  31228. "dashLength": 2
  31229. },
  31230. "legend": {},
  31231. "extra": {
  31232. "area": {
  31233. "type": "straight",
  31234. "opacity": 0.2,
  31235. "addLine": true,
  31236. "width": 2,
  31237. "gradient": false,
  31238. "activeType": "hollow"
  31239. }
  31240. }
  31241. },
  31242. "radar": {
  31243. "type": "radar",
  31244. "color": color,
  31245. "padding": [5, 5, 5, 5],
  31246. "dataLabel": false,
  31247. "legend": {
  31248. "show": true,
  31249. "position": "right",
  31250. "lineHeight": 25
  31251. },
  31252. "extra": {
  31253. "radar": {
  31254. "gridType": "radar",
  31255. "gridColor": "#CCCCCC",
  31256. "gridCount": 3,
  31257. "opacity": 0.2,
  31258. "max": 200,
  31259. "labelShow": true
  31260. }
  31261. }
  31262. },
  31263. "gauge": {
  31264. "type": "gauge",
  31265. "color": color,
  31266. "title": {
  31267. "name": "66Km/H",
  31268. "fontSize": 25,
  31269. "color": "#2fc25b",
  31270. "offsetY": 50
  31271. },
  31272. "subtitle": {
  31273. "name": "实时速度",
  31274. "fontSize": 15,
  31275. "color": "#1890ff",
  31276. "offsetY": -50
  31277. },
  31278. "extra": {
  31279. "gauge": {
  31280. "type": "default",
  31281. "width": 30,
  31282. "labelColor": "#666666",
  31283. "startAngle": 0.75,
  31284. "endAngle": 0.25,
  31285. "startNumber": 0,
  31286. "endNumber": 100,
  31287. "labelFormat": "",
  31288. "splitLine": {
  31289. "fixRadius": 0,
  31290. "splitNumber": 10,
  31291. "width": 30,
  31292. "color": "#FFFFFF",
  31293. "childNumber": 5,
  31294. "childWidth": 12
  31295. },
  31296. "pointer": {
  31297. "width": 24,
  31298. "color": "auto"
  31299. }
  31300. }
  31301. }
  31302. },
  31303. "candle": {
  31304. "type": "candle",
  31305. "color": color,
  31306. "padding": [15, 15, 0, 15],
  31307. "enableScroll": true,
  31308. "enableMarkLine": true,
  31309. "dataLabel": false,
  31310. "xAxis": {
  31311. "labelCount": 4,
  31312. "itemCount": 40,
  31313. "disableGrid": true,
  31314. "gridColor": "#CCCCCC",
  31315. "gridType": "solid",
  31316. "dashLength": 4,
  31317. "scrollShow": true,
  31318. "scrollAlign": "left",
  31319. "scrollColor": "#A6A6A6",
  31320. "scrollBackgroundColor": "#EFEBEF"
  31321. },
  31322. "yAxis": {},
  31323. "legend": {},
  31324. "extra": {
  31325. "candle": {
  31326. "color": {
  31327. "upLine": "#f04864",
  31328. "upFill": "#f04864",
  31329. "downLine": "#2fc25b",
  31330. "downFill": "#2fc25b"
  31331. },
  31332. "average": {
  31333. "show": true,
  31334. "name": ["MA5", "MA10", "MA30"],
  31335. "day": [5, 10, 20],
  31336. "color": ["#1890ff", "#2fc25b", "#facc14"]
  31337. }
  31338. },
  31339. "markLine": {
  31340. "type": "dash",
  31341. "dashLength": 5,
  31342. "data": [{
  31343. "value": 2150,
  31344. "lineColor": "#f04864",
  31345. "showLabel": true
  31346. }, {
  31347. "value": 2350,
  31348. "lineColor": "#f04864",
  31349. "showLabel": true
  31350. }]
  31351. }
  31352. }
  31353. },
  31354. "mix": {
  31355. "type": "mix",
  31356. "color": color,
  31357. "padding": [15, 15, 0, 15],
  31358. "xAxis": {
  31359. "disableGrid": true
  31360. },
  31361. "yAxis": {
  31362. "disabled": false,
  31363. "disableGrid": false,
  31364. "splitNumber": 5,
  31365. "gridType": "dash",
  31366. "dashLength": 4,
  31367. "gridColor": "#CCCCCC",
  31368. "padding": 10,
  31369. "showTitle": true,
  31370. "data": []
  31371. },
  31372. "legend": {},
  31373. "extra": {
  31374. "mix": {
  31375. "column": {
  31376. "width": 20
  31377. }
  31378. }
  31379. }
  31380. },
  31381. "scatter": {
  31382. "type": "scatter",
  31383. "color": color,
  31384. "padding": [15, 15, 0, 15],
  31385. "dataLabel": false,
  31386. "xAxis": {
  31387. "disableGrid": false,
  31388. "gridType": "dash",
  31389. "splitNumber": 5,
  31390. "boundaryGap": "justify",
  31391. "min": 0
  31392. },
  31393. "yAxis": {
  31394. "disableGrid": false,
  31395. "gridType": "dash"
  31396. },
  31397. "legend": {},
  31398. "extra": {
  31399. "scatter": {}
  31400. }
  31401. },
  31402. "bubble": {
  31403. "type": "bubble",
  31404. "color": color,
  31405. "padding": [15, 15, 0, 15],
  31406. "xAxis": {
  31407. "disableGrid": false,
  31408. "gridType": "dash",
  31409. "splitNumber": 5,
  31410. "boundaryGap": "justify",
  31411. "min": 0,
  31412. "max": 250
  31413. },
  31414. "yAxis": {
  31415. "disableGrid": false,
  31416. "gridType": "dash",
  31417. "data": [{
  31418. "min": 0,
  31419. "max": 150
  31420. }]
  31421. },
  31422. "legend": {},
  31423. "extra": {
  31424. "bubble": {
  31425. "border": 2,
  31426. "opacity": 0.5
  31427. }
  31428. }
  31429. }
  31430. };
  31431. var _default = cfu;
  31432. exports.default = _default;
  31433. /***/ }),
  31434. /***/ 8:
  31435. /*!***************************************************************************!*\
  31436. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  31437. \***************************************************************************/
  31438. /*! no static exports found */
  31439. /***/ (function(module, exports, __webpack_require__) {
  31440. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  31441. function _unsupportedIterableToArray(o, minLen) {
  31442. if (!o) return;
  31443. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  31444. var n = Object.prototype.toString.call(o).slice(8, -1);
  31445. if (n === "Object" && o.constructor) n = o.constructor.name;
  31446. if (n === "Map" || n === "Set") return Array.from(o);
  31447. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  31448. }
  31449. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  31450. /***/ }),
  31451. /***/ 9:
  31452. /*!*****************************************************************!*\
  31453. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  31454. \*****************************************************************/
  31455. /*! no static exports found */
  31456. /***/ (function(module, exports) {
  31457. function _arrayLikeToArray(arr, len) {
  31458. if (len == null || len > arr.length) len = arr.length;
  31459. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  31460. arr2[i] = arr[i];
  31461. }
  31462. return arr2;
  31463. }
  31464. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  31465. /***/ })
  31466. }]);
  31467. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map