uni-h5.cjs.js 391 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769
  1. "use strict";
  2. Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
  3. const vue = require("vue");
  4. const shared = require("@vue/shared");
  5. const uniShared = require("@dcloudio/uni-shared");
  6. const vueRouter = require("vue-router");
  7. const uniI18n = require("@dcloudio/uni-i18n");
  8. function arrayPop(array) {
  9. if (array.length === 0) {
  10. return null;
  11. }
  12. return array.pop();
  13. }
  14. function arrayShift(array) {
  15. if (array.length === 0) {
  16. return null;
  17. }
  18. return array.shift();
  19. }
  20. function arrayFind(array, predicate) {
  21. const index2 = array.findIndex(predicate);
  22. if (index2 < 0) {
  23. return null;
  24. }
  25. return array[index2];
  26. }
  27. function arrayFindLast(array, predicate) {
  28. const index2 = array.findLastIndex(predicate);
  29. if (index2 < 0) {
  30. return null;
  31. }
  32. return array[index2];
  33. }
  34. function arrayAt(array, index2) {
  35. if (index2 < -array.length || index2 >= array.length) {
  36. return null;
  37. }
  38. return array.at(index2);
  39. }
  40. var IDENTIFIER;
  41. (function(IDENTIFIER2) {
  42. IDENTIFIER2["UTSJSONObject"] = "UTSJSONObject";
  43. IDENTIFIER2["JSON"] = "JSON";
  44. IDENTIFIER2["UTS"] = "UTS";
  45. IDENTIFIER2["DEFINE_COMPONENT"] = "defineComponent";
  46. IDENTIFIER2["VUE"] = "vue";
  47. IDENTIFIER2["GLOBAL_THIS"] = "globalThis";
  48. IDENTIFIER2["UTS_TYPE"] = "UTSType";
  49. IDENTIFIER2["UTS_METADATA"] = "$UTSMetadata$";
  50. IDENTIFIER2["TEMP_UTS_METADATA"] = "$TempUTSMetadata$";
  51. IDENTIFIER2["JSON_FIELD"] = "JSON_FIELD";
  52. })(IDENTIFIER || (IDENTIFIER = {}));
  53. var UTS_CLASS_METADATA_KIND;
  54. (function(UTS_CLASS_METADATA_KIND2) {
  55. UTS_CLASS_METADATA_KIND2[UTS_CLASS_METADATA_KIND2["CLASS"] = 0] = "CLASS";
  56. UTS_CLASS_METADATA_KIND2[UTS_CLASS_METADATA_KIND2["INTERFACE"] = 1] = "INTERFACE";
  57. UTS_CLASS_METADATA_KIND2[UTS_CLASS_METADATA_KIND2["TYPE"] = 2] = "TYPE";
  58. })(UTS_CLASS_METADATA_KIND || (UTS_CLASS_METADATA_KIND = {}));
  59. function getType$1(val) {
  60. return Object.prototype.toString.call(val).slice(8, -1).toLowerCase();
  61. }
  62. function isPlainObject(val) {
  63. if (val == null || typeof val !== "object") {
  64. return false;
  65. }
  66. const proto = Object.getPrototypeOf(val);
  67. return proto === Object.prototype || proto === null;
  68. }
  69. class UTSError extends Error {
  70. constructor(message) {
  71. super(message);
  72. }
  73. }
  74. function isUTSMetadata(metadata) {
  75. return !!(metadata && metadata.kind in UTS_CLASS_METADATA_KIND && metadata.interfaces);
  76. }
  77. function isNativeType(proto) {
  78. return !proto || proto === Object.prototype;
  79. }
  80. const utsMetadataKey = IDENTIFIER.UTS_METADATA;
  81. function getParentTypeList(type) {
  82. const metadata = utsMetadataKey in type ? type[utsMetadataKey] : {};
  83. let interfaces = [];
  84. if (!isUTSMetadata(metadata)) {
  85. interfaces = [];
  86. } else {
  87. interfaces = metadata.interfaces || [];
  88. }
  89. const proto = Object.getPrototypeOf(type);
  90. if (!isNativeType(proto)) {
  91. interfaces.push(proto.constructor);
  92. }
  93. return interfaces;
  94. }
  95. function isImplementationOf(leftType, rightType, visited = []) {
  96. if (isNativeType(leftType)) {
  97. return false;
  98. }
  99. if (leftType === rightType) {
  100. return true;
  101. }
  102. visited.push(leftType);
  103. const parentTypeList = getParentTypeList(leftType);
  104. return parentTypeList.some((parentType) => {
  105. if (visited.includes(parentType)) {
  106. return false;
  107. }
  108. return isImplementationOf(parentType, rightType, visited);
  109. });
  110. }
  111. function isInstanceOf(value, type) {
  112. const isNativeInstanceofType = value instanceof type;
  113. if (isNativeInstanceofType || typeof value !== "object") {
  114. return isNativeInstanceofType;
  115. }
  116. const proto = Object.getPrototypeOf(value).constructor;
  117. return isImplementationOf(proto, type);
  118. }
  119. function isBaseType(type) {
  120. return type === Number || type === String || type === Boolean;
  121. }
  122. function isUnknownType(type) {
  123. return type === "Unknown";
  124. }
  125. function isAnyType(type) {
  126. return type === "Any";
  127. }
  128. function isUTSType(type) {
  129. return type && type.prototype && type.prototype instanceof UTSType;
  130. }
  131. function normalizeGenericValue(value, genericType, isJSONParse = false) {
  132. return value == null ? null : isBaseType(genericType) || isUnknownType(genericType) || isAnyType(genericType) ? value : genericType === Array ? new Array(...value) : new genericType(value, void 0, isJSONParse);
  133. }
  134. class UTSType {
  135. static get$UTSMetadata$(...args) {
  136. return {
  137. kind: UTS_CLASS_METADATA_KIND.TYPE,
  138. interfaces: [],
  139. fields: {}
  140. };
  141. }
  142. get $UTSMetadata$() {
  143. return UTSType.get$UTSMetadata$();
  144. }
  145. // TODO 缓存withGenerics结果
  146. static withGenerics(parent, generics, isJSONParse = false) {
  147. if (isJSONParse) {
  148. const illegalGeneric = generics.find((item) => !(item === Array || isBaseType(item) || isUnknownType(item) || isAnyType(item) || item === UTSJSONObject || item.prototype && item.prototype instanceof UTSType));
  149. if (illegalGeneric) {
  150. throw new Error("Generic is not UTSType or Array or UTSJSONObject or base type, generic: " + illegalGeneric);
  151. }
  152. }
  153. if (parent === Array) {
  154. return class UTSArray extends UTSType {
  155. constructor(options, isJSONParse2 = false) {
  156. if (!Array.isArray(options)) {
  157. throw new UTSError(`Failed to contruct type, ${options} is not an array`);
  158. }
  159. super();
  160. return options.map((item) => {
  161. return normalizeGenericValue(item, generics[0], isJSONParse2);
  162. });
  163. }
  164. };
  165. } else if (parent === Map || parent === WeakMap) {
  166. return class UTSMap extends UTSType {
  167. constructor(options, isJSONParse2 = false) {
  168. if (options == null || typeof options !== "object") {
  169. throw new UTSError(`Failed to contruct type, ${options} is not an object`);
  170. }
  171. super();
  172. const obj = new parent();
  173. for (const key in options) {
  174. obj.set(normalizeGenericValue(key, generics[0], isJSONParse2), normalizeGenericValue(options[key], generics[1], isJSONParse2));
  175. }
  176. return obj;
  177. }
  178. };
  179. } else if (isUTSType(parent)) {
  180. return class VirtualClassWithGenerics extends parent {
  181. static get$UTSMetadata$() {
  182. return parent.get$UTSMetadata$(...generics);
  183. }
  184. constructor(options, metadata = VirtualClassWithGenerics.get$UTSMetadata$(), isJSONParse2 = false) {
  185. super(options, metadata, isJSONParse2);
  186. }
  187. };
  188. } else {
  189. return parent;
  190. }
  191. }
  192. constructor() {
  193. }
  194. static initProps(options, metadata, isJSONParse = false) {
  195. const obj = {};
  196. if (!metadata.fields) {
  197. return obj;
  198. }
  199. for (const key in metadata.fields) {
  200. const { type, optional, jsonField } = metadata.fields[key];
  201. const realKey = isJSONParse ? jsonField || key : key;
  202. if (options[realKey] == null) {
  203. if (optional) {
  204. obj[key] = null;
  205. continue;
  206. } else {
  207. throw new UTSError(`Failed to contruct type, missing required property: ${key}`);
  208. }
  209. }
  210. if (isUTSType(type)) {
  211. obj[key] = new type(options[realKey], void 0, isJSONParse);
  212. } else if (type === Array) {
  213. if (!Array.isArray(options[realKey])) {
  214. throw new UTSError(`Failed to contruct type, property ${key} is not an array`);
  215. }
  216. obj[key] = options[realKey].map((item) => {
  217. return item == null ? null : item;
  218. });
  219. } else {
  220. obj[key] = options[realKey];
  221. }
  222. }
  223. return obj;
  224. }
  225. }
  226. const OriginalJSON = JSON;
  227. function parseObjectOrArray(object, utsType) {
  228. const objectType = getType$1(object);
  229. if (object === null || objectType !== "object" && objectType !== "array") {
  230. return object;
  231. }
  232. if (utsType || utsType === UTSJSONObject) {
  233. try {
  234. return new utsType(object, void 0, true);
  235. } catch (error) {
  236. console.error(error);
  237. return null;
  238. }
  239. }
  240. if (objectType === "array") {
  241. return object.map((value) => {
  242. return parseObjectOrArray(value);
  243. });
  244. } else if (objectType === "object") {
  245. return new UTSJSONObject(object);
  246. }
  247. return object;
  248. }
  249. const UTSJSON = {
  250. parse: (text, reviver, utsType) => {
  251. if (reviver && (isUTSType(reviver) || reviver === UTSJSONObject)) {
  252. utsType = reviver;
  253. reviver = void 0;
  254. }
  255. try {
  256. const parseResult = OriginalJSON.parse(text, reviver);
  257. return parseObjectOrArray(parseResult, utsType);
  258. } catch (error) {
  259. console.error(error);
  260. return null;
  261. }
  262. },
  263. parseArray(text, utsType) {
  264. try {
  265. const parseResult = OriginalJSON.parse(text);
  266. if (Array.isArray(parseResult)) {
  267. return parseObjectOrArray(parseResult, utsType ? UTSType.withGenerics(Array, [utsType], true) : void 0);
  268. }
  269. return null;
  270. } catch (error) {
  271. console.error(error);
  272. return null;
  273. }
  274. },
  275. parseObject(text, utsType) {
  276. try {
  277. const parseResult = OriginalJSON.parse(text);
  278. if (Array.isArray(parseResult)) {
  279. return null;
  280. }
  281. return parseObjectOrArray(parseResult, utsType);
  282. } catch (error) {
  283. console.error(error);
  284. return null;
  285. }
  286. },
  287. stringify: (value) => {
  288. return OriginalJSON.stringify(value);
  289. }
  290. };
  291. function mapGet(map, key) {
  292. if (!map.has(key)) {
  293. return null;
  294. }
  295. return map.get(key);
  296. }
  297. function stringCodePointAt(str, pos) {
  298. if (pos < 0 || pos >= str.length) {
  299. return null;
  300. }
  301. return str.codePointAt(pos);
  302. }
  303. function stringAt(str, pos) {
  304. if (pos < -str.length || pos >= str.length) {
  305. return null;
  306. }
  307. return str.at(pos);
  308. }
  309. function weakMapGet(map, key) {
  310. if (!map.has(key)) {
  311. return null;
  312. }
  313. return map.get(key);
  314. }
  315. const UTS$1 = {
  316. arrayAt,
  317. arrayFind,
  318. arrayFindLast,
  319. arrayPop,
  320. arrayShift,
  321. isInstanceOf,
  322. UTSType,
  323. mapGet,
  324. stringAt,
  325. stringCodePointAt,
  326. weakMapGet,
  327. JSON: UTSJSON
  328. };
  329. let UniError$1 = class UniError2 extends Error {
  330. constructor(errSubject, errCode, errMsg) {
  331. let options = {};
  332. const argsLength = Array.from(arguments).length;
  333. switch (argsLength) {
  334. case 0:
  335. errSubject = "";
  336. errMsg = "";
  337. errCode = 0;
  338. break;
  339. case 1:
  340. errMsg = errSubject;
  341. errSubject = "";
  342. errCode = 0;
  343. break;
  344. case 2:
  345. errMsg = errSubject;
  346. options = errCode;
  347. errCode = options.errCode || 0;
  348. errSubject = options.errSubject || "";
  349. break;
  350. }
  351. super(errMsg);
  352. this.name = "UniError";
  353. this.errSubject = errSubject;
  354. this.errCode = errCode;
  355. this.errMsg = errMsg;
  356. if (options.data) {
  357. this.data = options.data;
  358. }
  359. if (options.cause) {
  360. this.cause = options.cause;
  361. }
  362. }
  363. set errMsg(msg) {
  364. this.message = msg;
  365. }
  366. get errMsg() {
  367. return this.message;
  368. }
  369. toString() {
  370. return this.errMsg;
  371. }
  372. toJSON() {
  373. return {
  374. errSubject: this.errSubject,
  375. errCode: this.errCode,
  376. errMsg: this.errMsg,
  377. data: this.data,
  378. cause: this.cause && typeof this.cause.toJSON === "function" ? this.cause.toJSON() : this.cause
  379. };
  380. }
  381. };
  382. function initUTSJSONObjectProperties(obj) {
  383. const propertyList = [
  384. "_resolveKeyPath",
  385. "_getValue",
  386. "toJSON",
  387. "get",
  388. "set",
  389. "getAny",
  390. "getString",
  391. "getNumber",
  392. "getBoolean",
  393. "getJSON",
  394. "getArray",
  395. "toMap",
  396. "forEach"
  397. ];
  398. const propertyDescriptorMap = {};
  399. for (let i = 0; i < propertyList.length; i++) {
  400. const property = propertyList[i];
  401. propertyDescriptorMap[property] = {
  402. enumerable: false,
  403. value: obj[property]
  404. };
  405. }
  406. Object.defineProperties(obj, propertyDescriptorMap);
  407. }
  408. function setUTSJSONObjectValue(obj, key, value) {
  409. if (isPlainObject(value)) {
  410. obj[key] = new UTSJSONObject$1(value);
  411. } else if (getType$1(value) === "array") {
  412. obj[key] = value.map((item) => {
  413. if (isPlainObject(item)) {
  414. return new UTSJSONObject$1(item);
  415. } else {
  416. return item;
  417. }
  418. });
  419. } else {
  420. obj[key] = value;
  421. }
  422. }
  423. let UTSJSONObject$1 = class UTSJSONObject2 {
  424. static keys(obj) {
  425. return Object.keys(obj);
  426. }
  427. static assign(target, ...sources) {
  428. for (let i = 0; i < sources.length; i++) {
  429. const source = sources[i];
  430. for (let key in source) {
  431. target[key] = source[key];
  432. }
  433. }
  434. return target;
  435. }
  436. constructor(content = {}) {
  437. if (content instanceof Map) {
  438. content.forEach((value, key) => {
  439. setUTSJSONObjectValue(this, key, value);
  440. });
  441. } else {
  442. for (const key in content) {
  443. if (Object.prototype.hasOwnProperty.call(content, key)) {
  444. const value = content[key];
  445. setUTSJSONObjectValue(this, key, value);
  446. }
  447. }
  448. }
  449. initUTSJSONObjectProperties(this);
  450. }
  451. _resolveKeyPath(keyPath) {
  452. let token = "";
  453. const keyPathArr = [];
  454. let inOpenParentheses = false;
  455. for (let i = 0; i < keyPath.length; i++) {
  456. const word = keyPath[i];
  457. switch (word) {
  458. case ".":
  459. if (token.length > 0) {
  460. keyPathArr.push(token);
  461. token = "";
  462. }
  463. break;
  464. case "[": {
  465. inOpenParentheses = true;
  466. if (token.length > 0) {
  467. keyPathArr.push(token);
  468. token = "";
  469. }
  470. break;
  471. }
  472. case "]":
  473. if (inOpenParentheses) {
  474. if (token.length > 0) {
  475. const tokenFirstChar = token[0];
  476. const tokenLastChar = token[token.length - 1];
  477. if (tokenFirstChar === '"' && tokenLastChar === '"' || tokenFirstChar === "'" && tokenLastChar === "'" || tokenFirstChar === "`" && tokenLastChar === "`") {
  478. if (token.length > 2) {
  479. token = token.slice(1, -1);
  480. } else {
  481. return [];
  482. }
  483. } else if (!/^\d+$/.test(token)) {
  484. return [];
  485. }
  486. keyPathArr.push(token);
  487. token = "";
  488. } else {
  489. return [];
  490. }
  491. inOpenParentheses = false;
  492. } else {
  493. return [];
  494. }
  495. break;
  496. default:
  497. token += word;
  498. break;
  499. }
  500. if (i === keyPath.length - 1) {
  501. if (token.length > 0) {
  502. keyPathArr.push(token);
  503. token = "";
  504. }
  505. }
  506. }
  507. return keyPathArr;
  508. }
  509. _getValue(keyPath) {
  510. const keyPathArr = this._resolveKeyPath(keyPath);
  511. if (keyPathArr.length === 0) {
  512. return null;
  513. }
  514. let value = this;
  515. for (let i = 0; i < keyPathArr.length; i++) {
  516. const key = keyPathArr[i];
  517. if (value instanceof Object) {
  518. value = value[key];
  519. } else {
  520. return null;
  521. }
  522. }
  523. return value;
  524. }
  525. get(key) {
  526. return this._getValue(key);
  527. }
  528. set(key, value) {
  529. this[key] = value;
  530. }
  531. getAny(key) {
  532. return this._getValue(key);
  533. }
  534. getString(key) {
  535. const value = this._getValue(key);
  536. if (typeof value === "string") {
  537. return value;
  538. } else {
  539. return null;
  540. }
  541. }
  542. getNumber(key) {
  543. const value = this._getValue(key);
  544. if (typeof value === "number") {
  545. return value;
  546. } else {
  547. return null;
  548. }
  549. }
  550. getBoolean(key) {
  551. const boolean = this._getValue(key);
  552. if (typeof boolean === "boolean") {
  553. return boolean;
  554. } else {
  555. return null;
  556. }
  557. }
  558. getJSON(key) {
  559. let value = this._getValue(key);
  560. if (value instanceof Object) {
  561. return new UTSJSONObject2(value);
  562. } else {
  563. return null;
  564. }
  565. }
  566. getArray(key) {
  567. let value = this._getValue(key);
  568. if (value instanceof Array) {
  569. return value;
  570. } else {
  571. return null;
  572. }
  573. }
  574. toMap() {
  575. let map = /* @__PURE__ */ new Map();
  576. for (let key in this) {
  577. map.set(key, this[key]);
  578. }
  579. return map;
  580. }
  581. forEach(callback) {
  582. for (let key in this) {
  583. callback(this[key], key);
  584. }
  585. }
  586. };
  587. function getGlobal() {
  588. if (typeof globalThis !== "undefined") {
  589. return globalThis;
  590. }
  591. if (typeof self !== "undefined") {
  592. return self;
  593. }
  594. if (typeof window !== "undefined") {
  595. return window;
  596. }
  597. if (typeof global !== "undefined") {
  598. return global;
  599. }
  600. function g2() {
  601. return this;
  602. }
  603. if (typeof g2() !== "undefined") {
  604. return g2();
  605. }
  606. return function() {
  607. return new Function("return this")();
  608. }();
  609. }
  610. const realGlobal = getGlobal();
  611. realGlobal.UTSJSONObject = UTSJSONObject$1;
  612. realGlobal.UniError = UniError$1;
  613. realGlobal.UTS = UTS$1;
  614. const isEnableLocale = /* @__PURE__ */ uniShared.once(
  615. () => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length
  616. );
  617. let i18n;
  618. function getLocaleMessage() {
  619. const locale = uni.getLocale();
  620. const locales = __uniConfig.locales;
  621. return locales[locale] || locales[__uniConfig.fallbackLocale] || locales.en || {};
  622. }
  623. function formatI18n(message) {
  624. if (uniI18n.isI18nStr(message, uniShared.I18N_JSON_DELIMITERS)) {
  625. return useI18n().f(message, getLocaleMessage(), uniShared.I18N_JSON_DELIMITERS);
  626. }
  627. return message;
  628. }
  629. function resolveJsonObj(jsonObj, names) {
  630. if (names.length === 1) {
  631. if (jsonObj) {
  632. const _isI18nStr = (value2) => shared.isString(value2) && uniI18n.isI18nStr(value2, uniShared.I18N_JSON_DELIMITERS);
  633. const _name = names[0];
  634. let filterJsonObj = [];
  635. if (shared.isArray(jsonObj) && (filterJsonObj = jsonObj.filter((item) => _isI18nStr(item[_name]))).length) {
  636. return filterJsonObj;
  637. }
  638. const value = jsonObj[names[0]];
  639. if (_isI18nStr(value)) {
  640. return jsonObj;
  641. }
  642. }
  643. return;
  644. }
  645. const name = names.shift();
  646. return resolveJsonObj(jsonObj && jsonObj[name], names);
  647. }
  648. function defineI18nProperties(obj, names) {
  649. return names.map((name) => defineI18nProperty(obj, name));
  650. }
  651. function defineI18nProperty(obj, names) {
  652. const jsonObj = resolveJsonObj(obj, names);
  653. if (!jsonObj) {
  654. return false;
  655. }
  656. const prop = names[names.length - 1];
  657. if (shared.isArray(jsonObj)) {
  658. jsonObj.forEach((item) => defineI18nProperty(item, [prop]));
  659. } else {
  660. let value = jsonObj[prop];
  661. Object.defineProperty(jsonObj, prop, {
  662. get() {
  663. return formatI18n(value);
  664. },
  665. set(v2) {
  666. value = v2;
  667. }
  668. });
  669. }
  670. return true;
  671. }
  672. function useI18n() {
  673. if (!i18n) {
  674. let locale;
  675. {
  676. {
  677. locale = uniShared.getEnvLocale();
  678. }
  679. }
  680. i18n = uniI18n.initVueI18n(locale);
  681. if (isEnableLocale()) {
  682. const localeKeys = Object.keys(__uniConfig.locales || {});
  683. if (localeKeys.length) {
  684. localeKeys.forEach(
  685. (locale2) => i18n.add(locale2, __uniConfig.locales[locale2])
  686. );
  687. }
  688. i18n.setLocale(locale);
  689. }
  690. }
  691. return i18n;
  692. }
  693. function normalizeMessages(module2, keys, values) {
  694. return keys.reduce((res, name, index2) => {
  695. res[module2 + name] = values[index2];
  696. return res;
  697. }, {});
  698. }
  699. const initI18nAsyncMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
  700. const name = "uni.async.";
  701. const keys = ["error"];
  702. if (__UNI_FEATURE_I18N_EN__) {
  703. useI18n().add(
  704. uniI18n.LOCALE_EN,
  705. normalizeMessages(name, keys, [
  706. "The connection timed out, click the screen to try again."
  707. ]),
  708. false
  709. );
  710. }
  711. if (__UNI_FEATURE_I18N_ES__) {
  712. useI18n().add(
  713. uniI18n.LOCALE_ES,
  714. normalizeMessages(name, keys, [
  715. "Se agotó el tiempo de conexión, haga clic en la pantalla para volver a intentarlo."
  716. ]),
  717. false
  718. );
  719. }
  720. if (__UNI_FEATURE_I18N_FR__) {
  721. useI18n().add(
  722. uniI18n.LOCALE_FR,
  723. normalizeMessages(name, keys, [
  724. "La connexion a expiré, cliquez sur l'écran pour réessayer."
  725. ]),
  726. false
  727. );
  728. }
  729. if (__UNI_FEATURE_I18N_ZH_HANS__) {
  730. useI18n().add(
  731. uniI18n.LOCALE_ZH_HANS,
  732. normalizeMessages(name, keys, ["连接服务器超时,点击屏幕重试"]),
  733. false
  734. );
  735. }
  736. if (__UNI_FEATURE_I18N_ZH_HANT__) {
  737. useI18n().add(
  738. uniI18n.LOCALE_ZH_HANT,
  739. normalizeMessages(name, keys, ["連接服務器超時,點擊屏幕重試"]),
  740. false
  741. );
  742. }
  743. });
  744. const initI18nPickerMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
  745. const name = "uni.picker.";
  746. const keys = ["done", "cancel"];
  747. if (__UNI_FEATURE_I18N_EN__) {
  748. useI18n().add(
  749. uniI18n.LOCALE_EN,
  750. normalizeMessages(name, keys, ["Done", "Cancel"]),
  751. false
  752. );
  753. }
  754. if (__UNI_FEATURE_I18N_ES__) {
  755. useI18n().add(
  756. uniI18n.LOCALE_ES,
  757. normalizeMessages(name, keys, ["OK", "Cancelar"]),
  758. false
  759. );
  760. }
  761. if (__UNI_FEATURE_I18N_FR__) {
  762. useI18n().add(
  763. uniI18n.LOCALE_FR,
  764. normalizeMessages(name, keys, ["OK", "Annuler"]),
  765. false
  766. );
  767. }
  768. if (__UNI_FEATURE_I18N_ZH_HANS__) {
  769. useI18n().add(
  770. uniI18n.LOCALE_ZH_HANS,
  771. normalizeMessages(name, keys, ["完成", "取消"]),
  772. false
  773. );
  774. }
  775. if (__UNI_FEATURE_I18N_ZH_HANT__) {
  776. useI18n().add(
  777. uniI18n.LOCALE_ZH_HANT,
  778. normalizeMessages(name, keys, ["完成", "取消"]),
  779. false
  780. );
  781. }
  782. });
  783. const initI18nVideoMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
  784. const name = "uni.video.";
  785. const keys = ["danmu", "volume"];
  786. if (__UNI_FEATURE_I18N_EN__) {
  787. useI18n().add(
  788. uniI18n.LOCALE_EN,
  789. normalizeMessages(name, keys, ["Danmu", "Volume"]),
  790. false
  791. );
  792. }
  793. if (__UNI_FEATURE_I18N_ES__) {
  794. useI18n().add(
  795. uniI18n.LOCALE_ES,
  796. normalizeMessages(name, keys, ["Danmu", "Volumen"]),
  797. false
  798. );
  799. }
  800. if (__UNI_FEATURE_I18N_FR__) {
  801. useI18n().add(
  802. uniI18n.LOCALE_FR,
  803. normalizeMessages(name, keys, ["Danmu", "Le Volume"]),
  804. false
  805. );
  806. }
  807. if (__UNI_FEATURE_I18N_ZH_HANS__) {
  808. useI18n().add(
  809. uniI18n.LOCALE_ZH_HANS,
  810. normalizeMessages(name, keys, ["弹幕", "音量"]),
  811. false
  812. );
  813. }
  814. if (__UNI_FEATURE_I18N_ZH_HANT__) {
  815. useI18n().add(
  816. uniI18n.LOCALE_ZH_HANT,
  817. normalizeMessages(name, keys, ["彈幕", "音量"]),
  818. false
  819. );
  820. }
  821. });
  822. function initNavigationBarI18n(navigationBar) {
  823. if (isEnableLocale()) {
  824. return defineI18nProperties(navigationBar, [
  825. ["titleText"],
  826. ["searchInput", "placeholder"],
  827. ["buttons", "text"]
  828. ]);
  829. }
  830. }
  831. function initTabBarI18n(tabBar2) {
  832. if (isEnableLocale() && tabBar2.list) {
  833. tabBar2.list.forEach((item) => {
  834. defineI18nProperty(item, ["text"]);
  835. });
  836. }
  837. return tabBar2;
  838. }
  839. function initBridge(subscribeNamespace) {
  840. const emitter = new uniShared.Emitter();
  841. return {
  842. on(event, callback) {
  843. return emitter.on(event, callback);
  844. },
  845. once(event, callback) {
  846. return emitter.once(event, callback);
  847. },
  848. off(event, callback) {
  849. return emitter.off(event, callback);
  850. },
  851. emit(event, ...args) {
  852. return emitter.emit(event, ...args);
  853. },
  854. subscribe(event, callback, once = false) {
  855. emitter[once ? "once" : "on"](`${subscribeNamespace}.${event}`, callback);
  856. },
  857. unsubscribe(event, callback) {
  858. emitter.off(`${subscribeNamespace}.${event}`, callback);
  859. },
  860. subscribeHandler(event, args, pageId) {
  861. emitter.emit(`${subscribeNamespace}.${event}`, args, pageId);
  862. }
  863. };
  864. }
  865. const INVOKE_VIEW_API = "invokeViewApi";
  866. const INVOKE_SERVICE_API = "invokeServiceApi";
  867. let invokeServiceMethodId = 1;
  868. const invokeServiceMethod = (name, args, callback) => {
  869. const { subscribe, publishHandler } = UniViewJSBridge;
  870. const id2 = callback ? invokeServiceMethodId++ : 0;
  871. callback && subscribe(INVOKE_SERVICE_API + "." + id2, callback, true);
  872. publishHandler(INVOKE_SERVICE_API, { id: id2, name, args });
  873. };
  874. const viewMethods = /* @__PURE__ */ Object.create(null);
  875. function normalizeViewMethodName(pageId, name) {
  876. return pageId + "." + name;
  877. }
  878. function registerViewMethod(pageId, name, fn) {
  879. name = normalizeViewMethodName(pageId, name);
  880. if (!viewMethods[name]) {
  881. viewMethods[name] = fn;
  882. }
  883. }
  884. const ViewJSBridge = /* @__PURE__ */ shared.extend(
  885. /* @__PURE__ */ initBridge("service"),
  886. {
  887. invokeServiceMethod
  888. }
  889. );
  890. const onEventPrevent = /* @__PURE__ */ vue.withModifiers(() => {
  891. }, ["prevent"]);
  892. const onEventStop = /* @__PURE__ */ vue.withModifiers(
  893. (_event) => {
  894. },
  895. ["stop"]
  896. );
  897. function updateCssVar(cssVars) {
  898. const style = document.documentElement.style;
  899. Object.keys(cssVars).forEach((name) => {
  900. style.setProperty(name, cssVars[name]);
  901. });
  902. }
  903. function updatePageCssVar(cssVars) {
  904. return updateCssVar(cssVars);
  905. }
  906. function PolySymbol(name) {
  907. return Symbol(process.env.NODE_ENV !== "production" ? "[uni-app]: " + name : name);
  908. }
  909. function rpx2px(str, replace = false) {
  910. if (replace) {
  911. return rpx2pxWithReplace(str);
  912. }
  913. {
  914. return parseInt(str + "");
  915. }
  916. }
  917. function rpx2pxWithReplace(str) {
  918. {
  919. return str;
  920. }
  921. }
  922. const ICON_PATH_CANCEL = "M20.928 10.176l-4.928 4.928-4.928-4.928-0.896 0.896 4.928 4.928-4.928 4.928 0.896 0.896 4.928-4.928 4.928 4.928 0.896-0.896-4.928-4.928 4.928-4.928-0.896-0.896zM16 2.080q-3.776 0-7.040 1.888-3.136 1.856-4.992 4.992-1.888 3.264-1.888 7.040t1.888 7.040q1.856 3.136 4.992 4.992 3.264 1.888 7.040 1.888t7.040-1.888q3.136-1.856 4.992-4.992 1.888-3.264 1.888-7.040t-1.888-7.040q-1.856-3.136-4.992-4.992-3.264-1.888-7.040-1.888zM16 28.64q-3.424 0-6.4-1.728-2.848-1.664-4.512-4.512-1.728-2.976-1.728-6.4t1.728-6.4q1.664-2.848 4.512-4.512 2.976-1.728 6.4-1.728t6.4 1.728q2.848 1.664 4.512 4.512 1.728 2.976 1.728 6.4t-1.728 6.4q-1.664 2.848-4.512 4.512-2.976 1.728-6.4 1.728z";
  923. const ICON_PATH_CLEAR = "M16 0q-4.352 0-8.064 2.176-3.616 2.144-5.76 5.76-2.176 3.712-2.176 8.064t2.176 8.064q2.144 3.616 5.76 5.76 3.712 2.176 8.064 2.176t8.064-2.176q3.616-2.144 5.76-5.76 2.176-3.712 2.176-8.064t-2.176-8.064q-2.144-3.616-5.76-5.76-3.712-2.176-8.064-2.176zM22.688 21.408q0.32 0.32 0.304 0.752t-0.336 0.736-0.752 0.304-0.752-0.32l-5.184-5.376-5.376 5.184q-0.32 0.32-0.752 0.304t-0.736-0.336-0.304-0.752 0.32-0.752l5.376-5.184-5.184-5.376q-0.32-0.32-0.304-0.752t0.336-0.752 0.752-0.304 0.752 0.336l5.184 5.376 5.376-5.184q0.32-0.32 0.752-0.304t0.752 0.336 0.304 0.752-0.336 0.752l-5.376 5.184 5.184 5.376z";
  924. const ICON_PATH_DOWNLOAD = "M15.808 1.696q-3.776 0-7.072 1.984-3.2 1.888-5.088 5.152-1.952 3.392-1.952 7.36 0 3.776 1.952 7.072 1.888 3.2 5.088 5.088 3.296 1.952 7.072 1.952 3.968 0 7.36-1.952 3.264-1.888 5.152-5.088 1.984-3.296 1.984-7.072 0-4-1.984-7.36-1.888-3.264-5.152-5.152-3.36-1.984-7.36-1.984zM20.864 18.592l-3.776 4.928q-0.448 0.576-1.088 0.576t-1.088-0.576l-3.776-4.928q-0.448-0.576-0.24-0.992t0.944-0.416h2.976v-8.928q0-0.256 0.176-0.432t0.4-0.176h1.216q0.224 0 0.4 0.176t0.176 0.432v8.928h2.976q0.736 0 0.944 0.416t-0.24 0.992z";
  925. const ICON_PATH_INFO = "M15.808 0.128q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.176 3.776-2.176 8.16 0 4.224 2.176 7.872 2.080 3.552 5.632 5.632 3.648 2.176 7.872 2.176 4.384 0 8.16-2.176 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.416-2.176-8.16-2.112-3.616-5.728-5.728-3.744-2.176-8.16-2.176zM16.864 23.776q0 0.064-0.064 0.064h-1.568q-0.096 0-0.096-0.064l-0.256-11.328q0-0.064 0.064-0.064h2.112q0.096 0 0.064 0.064l-0.256 11.328zM16 10.88q-0.576 0-0.976-0.4t-0.4-0.96 0.4-0.96 0.976-0.4 0.976 0.4 0.4 0.96-0.4 0.96-0.976 0.4z";
  926. const ICON_PATH_SEARCH = "M20.928 22.688q-1.696 1.376-3.744 2.112-2.112 0.768-4.384 0.768-3.488 0-6.464-1.728-2.88-1.696-4.576-4.608-1.76-2.976-1.76-6.464t1.76-6.464q1.696-2.88 4.576-4.576 2.976-1.76 6.464-1.76t6.464 1.76q2.912 1.696 4.608 4.576 1.728 2.976 1.728 6.464 0 2.272-0.768 4.384-0.736 2.048-2.112 3.744l9.312 9.28-1.824 1.824-9.28-9.312zM12.8 23.008q2.784 0 5.184-1.376 2.304-1.376 3.68-3.68 1.376-2.4 1.376-5.184t-1.376-5.152q-1.376-2.336-3.68-3.68-2.4-1.408-5.184-1.408t-5.152 1.408q-2.336 1.344-3.68 3.68-1.408 2.368-1.408 5.152t1.408 5.184q1.344 2.304 3.68 3.68 2.368 1.376 5.152 1.376zM12.8 23.008v0z";
  927. const ICON_PATH_SUCCESS_NO_CIRCLE = "M1.952 18.080q-0.32-0.352-0.416-0.88t0.128-0.976l0.16-0.352q0.224-0.416 0.64-0.528t0.8 0.176l6.496 4.704q0.384 0.288 0.912 0.272t0.88-0.336l17.312-14.272q0.352-0.288 0.848-0.256t0.848 0.352l-0.416-0.416q0.32 0.352 0.32 0.816t-0.32 0.816l-18.656 18.912q-0.32 0.352-0.8 0.352t-0.8-0.32l-7.936-8.064z";
  928. const ICON_PATH_SUCCESS = "M15.808 0.16q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM24.832 11.328l-11.264 11.104q-0.032 0.032-0.112 0.032t-0.112-0.032l-5.216-5.376q-0.096-0.128 0-0.288l0.704-0.96q0.032-0.064 0.112-0.064t0.112 0.032l4.256 3.264q0.064 0.032 0.144 0.032t0.112-0.032l10.336-8.608q0.064-0.064 0.144-0.064t0.112 0.064l0.672 0.672q0.128 0.128 0 0.224z";
  929. const ICON_PATH_WAITING = "M15.84 0.096q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM23.008 21.92l-0.512 0.896q-0.096 0.128-0.224 0.064l-8-3.808q-0.096-0.064-0.16-0.128-0.128-0.096-0.128-0.288l0.512-12.096q0-0.064 0.048-0.112t0.112-0.048h1.376q0.064 0 0.112 0.048t0.048 0.112l0.448 10.848 6.304 4.256q0.064 0.064 0.080 0.128t-0.016 0.128z";
  930. const ICON_PATH_WARN = "M15.808 0.16q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM15.136 8.672h1.728q0.128 0 0.224 0.096t0.096 0.256l-0.384 10.24q0 0.064-0.048 0.112t-0.112 0.048h-1.248q-0.096 0-0.144-0.048t-0.048-0.112l-0.384-10.24q0-0.16 0.096-0.256t0.224-0.096zM16 23.328q-0.48 0-0.832-0.352t-0.352-0.848 0.352-0.848 0.832-0.352 0.832 0.352 0.352 0.848-0.352 0.848-0.832 0.352z";
  931. const ICON_PATH_BACK = "M21.781 7.844l-9.063 8.594 9.063 8.594q0.25 0.25 0.25 0.609t-0.25 0.578q-0.25 0.25-0.578 0.25t-0.578-0.25l-9.625-9.125q-0.156-0.125-0.203-0.297t-0.047-0.359q0-0.156 0.047-0.328t0.203-0.297l9.625-9.125q0.25-0.25 0.578-0.25t0.578 0.25q0.25 0.219 0.25 0.578t-0.25 0.578z";
  932. const ICON_PATH_CLOSE = "M17.25 16.156l7.375-7.313q0.281-0.281 0.281-0.641t-0.281-0.641q-0.25-0.25-0.625-0.25t-0.625 0.25l-7.375 7.344-7.313-7.344q-0.25-0.25-0.625-0.25t-0.625 0.25q-0.281 0.25-0.281 0.625t0.281 0.625l7.313 7.344-7.375 7.344q-0.281 0.25-0.281 0.625t0.281 0.625q0.125 0.125 0.281 0.188t0.344 0.063q0.156 0 0.328-0.063t0.297-0.188l7.375-7.344 7.375 7.406q0.125 0.156 0.297 0.219t0.328 0.063q0.188 0 0.344-0.078t0.281-0.203q0.281-0.25 0.281-0.609t-0.281-0.641l-7.375-7.406z";
  933. function createSvgIconVNode(path, color = "#000", size = 27) {
  934. return vue.createVNode(
  935. "svg",
  936. {
  937. width: size,
  938. height: size,
  939. viewBox: "0 0 32 32"
  940. },
  941. [
  942. vue.createVNode(
  943. "path",
  944. {
  945. d: path,
  946. fill: color
  947. },
  948. null,
  949. 8,
  950. ["d", "fill"]
  951. )
  952. ],
  953. 8,
  954. ["width", "height"]
  955. );
  956. }
  957. function useCurrentPageId() {
  958. {
  959. const { $pageInstance } = vue.getCurrentInstance();
  960. return $pageInstance && $pageInstance.proxy.$page.id;
  961. }
  962. }
  963. function getCurrentPage() {
  964. const pages = getCurrentPages();
  965. const len = pages.length;
  966. if (len) {
  967. return pages[len - 1];
  968. }
  969. }
  970. function getCurrentPageMeta() {
  971. const page = getCurrentPage();
  972. if (page) {
  973. return page.$page.meta;
  974. }
  975. }
  976. function getCurrentPageId() {
  977. const meta = getCurrentPageMeta();
  978. if (meta) {
  979. return meta.id;
  980. }
  981. return -1;
  982. }
  983. function getCurrentPageVm() {
  984. const page = getCurrentPage();
  985. if (page) {
  986. return page.$vm;
  987. }
  988. }
  989. const PAGE_META_KEYS = ["navigationBar", "pullToRefresh"];
  990. function initGlobalStyle() {
  991. return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {}));
  992. }
  993. function initRouteMeta(pageMeta, id2) {
  994. const globalStyle = initGlobalStyle();
  995. const res = shared.extend({ id: id2 }, globalStyle, pageMeta);
  996. PAGE_META_KEYS.forEach((name) => {
  997. res[name] = shared.extend({}, globalStyle[name], pageMeta[name]);
  998. });
  999. const { navigationBar } = res;
  1000. navigationBar.titleText && navigationBar.titleImage && (navigationBar.titleText = "");
  1001. return res;
  1002. }
  1003. function normalizePullToRefreshRpx(pullToRefresh) {
  1004. if (pullToRefresh.offset) {
  1005. pullToRefresh.offset = rpx2px(pullToRefresh.offset);
  1006. }
  1007. if (pullToRefresh.height) {
  1008. pullToRefresh.height = rpx2px(pullToRefresh.height);
  1009. }
  1010. if (pullToRefresh.range) {
  1011. pullToRefresh.range = rpx2px(pullToRefresh.range);
  1012. }
  1013. return pullToRefresh;
  1014. }
  1015. function initPageInternalInstance(openType, url, pageQuery, meta, eventChannel, themeMode) {
  1016. const { id: id2, route } = meta;
  1017. const titleColor = uniShared.normalizeStyles(
  1018. meta.navigationBar,
  1019. __uniConfig.themeConfig,
  1020. themeMode
  1021. ).titleColor;
  1022. return {
  1023. id: id2,
  1024. path: uniShared.addLeadingSlash(route),
  1025. route,
  1026. fullPath: url,
  1027. options: pageQuery,
  1028. meta,
  1029. openType,
  1030. eventChannel,
  1031. statusBarStyle: titleColor === "#ffffff" ? "light" : "dark"
  1032. };
  1033. }
  1034. function invokeHook(vm, name, args) {
  1035. if (shared.isString(vm)) {
  1036. args = name;
  1037. name = vm;
  1038. vm = getCurrentPageVm();
  1039. } else if (typeof vm === "number") {
  1040. const page = getCurrentPages().find((page2) => page2.$page.id === vm);
  1041. if (page) {
  1042. vm = page.$vm;
  1043. } else {
  1044. vm = getCurrentPageVm();
  1045. }
  1046. }
  1047. if (!vm) {
  1048. return;
  1049. }
  1050. const hooks = vm.$[name];
  1051. return hooks && uniShared.invokeArrayFns(hooks, args);
  1052. }
  1053. function getRealRoute(fromRoute, toRoute) {
  1054. if (toRoute.indexOf("/") === 0) {
  1055. return toRoute;
  1056. }
  1057. if (toRoute.indexOf("./") === 0) {
  1058. return getRealRoute(fromRoute, toRoute.slice(2));
  1059. }
  1060. const toRouteArray = toRoute.split("/");
  1061. const toRouteLength = toRouteArray.length;
  1062. let i = 0;
  1063. for (; i < toRouteLength && toRouteArray[i] === ".."; i++) {
  1064. }
  1065. toRouteArray.splice(0, i);
  1066. toRoute = toRouteArray.join("/");
  1067. const fromRouteArray = fromRoute.length > 0 ? fromRoute.split("/") : [];
  1068. fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1);
  1069. return uniShared.addLeadingSlash(fromRouteArray.concat(toRouteArray).join("/"));
  1070. }
  1071. function getRouteOptions(path, alias = false) {
  1072. if (alias) {
  1073. return __uniRoutes.find(
  1074. (route) => route.path === path || route.alias === path
  1075. );
  1076. }
  1077. return __uniRoutes.find((route) => route.path === path);
  1078. }
  1079. const invokeOnCallback = (name, res) => UniServiceJSBridge.emit("api." + name, res);
  1080. let invokeViewMethodId = 1;
  1081. function publishViewMethodName(pageId) {
  1082. return (pageId || getCurrentPageId()) + "." + INVOKE_VIEW_API;
  1083. }
  1084. const invokeViewMethod = (name, args, pageId, callback) => {
  1085. const { subscribe, publishHandler } = UniServiceJSBridge;
  1086. const id2 = callback ? invokeViewMethodId++ : 0;
  1087. callback && subscribe(INVOKE_VIEW_API + "." + id2, callback, true);
  1088. publishHandler(publishViewMethodName(pageId), { id: id2, name, args }, pageId);
  1089. };
  1090. const invokeViewMethodKeepAlive = (name, args, callback, pageId) => {
  1091. const { subscribe, unsubscribe, publishHandler } = UniServiceJSBridge;
  1092. const id2 = invokeViewMethodId++;
  1093. const subscribeName = INVOKE_VIEW_API + "." + id2;
  1094. subscribe(subscribeName, callback);
  1095. publishHandler(publishViewMethodName(pageId), { id: id2, name, args }, pageId);
  1096. return () => {
  1097. unsubscribe(subscribeName);
  1098. };
  1099. };
  1100. const ServiceJSBridge = /* @__PURE__ */ shared.extend(
  1101. /* @__PURE__ */ initBridge(
  1102. "view"
  1103. /* view 指的是 service 层订阅的是 view 层事件 */
  1104. ),
  1105. {
  1106. invokeOnCallback,
  1107. invokeViewMethod,
  1108. invokeViewMethodKeepAlive
  1109. }
  1110. );
  1111. function initAppVm(appVm2) {
  1112. appVm2.$vm = appVm2;
  1113. appVm2.$mpType = "app";
  1114. const locale = vue.ref(useI18n().getLocale());
  1115. Object.defineProperty(appVm2, "$locale", {
  1116. get() {
  1117. return locale.value;
  1118. },
  1119. set(v2) {
  1120. locale.value = v2;
  1121. }
  1122. });
  1123. }
  1124. function initPageVm(pageVm, page) {
  1125. pageVm.route = page.route;
  1126. pageVm.$vm = pageVm;
  1127. pageVm.$page = page;
  1128. pageVm.$mpType = "page";
  1129. pageVm.$fontFamilySet = /* @__PURE__ */ new Set();
  1130. if (page.meta.isTabBar) {
  1131. pageVm.$.__isTabBar = true;
  1132. pageVm.$.__isActive = true;
  1133. }
  1134. }
  1135. function defineGlobalData(app, defaultGlobalData) {
  1136. const options = app.$options || {};
  1137. options.globalData = shared.extend(options.globalData || {}, defaultGlobalData);
  1138. Object.defineProperty(app, "globalData", {
  1139. get() {
  1140. return options.globalData;
  1141. },
  1142. set(newGlobalData) {
  1143. options.globalData = newGlobalData;
  1144. }
  1145. });
  1146. }
  1147. function converPx(value) {
  1148. if (/^-?\d+[ur]px$/i.test(value)) {
  1149. return value.replace(/(^-?\d+)[ur]px$/i, (text, num) => {
  1150. return `${uni.upx2px(parseFloat(num))}px`;
  1151. });
  1152. } else if (/^-?[\d\.]+$/.test(value)) {
  1153. return `${value}px`;
  1154. }
  1155. return value || "";
  1156. }
  1157. function converType(type) {
  1158. return type.replace(/[A-Z]/g, (text) => {
  1159. return `-${text.toLowerCase()}`;
  1160. }).replace("webkit", "-webkit");
  1161. }
  1162. function getStyle(action) {
  1163. const animateTypes1 = [
  1164. "matrix",
  1165. "matrix3d",
  1166. "scale",
  1167. "scale3d",
  1168. "rotate3d",
  1169. "skew",
  1170. "translate",
  1171. "translate3d"
  1172. ];
  1173. const animateTypes2 = [
  1174. "scaleX",
  1175. "scaleY",
  1176. "scaleZ",
  1177. "rotate",
  1178. "rotateX",
  1179. "rotateY",
  1180. "rotateZ",
  1181. "skewX",
  1182. "skewY",
  1183. "translateX",
  1184. "translateY",
  1185. "translateZ"
  1186. ];
  1187. const animateTypes3 = ["opacity", "background-color"];
  1188. const animateTypes4 = ["width", "height", "left", "right", "top", "bottom"];
  1189. const animates = action.animates;
  1190. const option = action.option;
  1191. const transition = option.transition;
  1192. const style = {};
  1193. const transform = [];
  1194. animates.forEach((animate) => {
  1195. let type = animate.type;
  1196. let args = [...animate.args];
  1197. if (animateTypes1.concat(animateTypes2).includes(type)) {
  1198. if (type.startsWith("rotate") || type.startsWith("skew")) {
  1199. args = args.map((value) => parseFloat(value) + "deg");
  1200. } else if (type.startsWith("translate")) {
  1201. args = args.map(converPx);
  1202. }
  1203. if (animateTypes2.indexOf(type) >= 0) {
  1204. args.length = 1;
  1205. }
  1206. transform.push(`${type}(${args.join(",")})`);
  1207. } else if (animateTypes3.concat(animateTypes4).includes(args[0])) {
  1208. type = args[0];
  1209. const value = args[1];
  1210. style[type] = animateTypes4.includes(type) ? converPx(value) : value;
  1211. }
  1212. });
  1213. style.transform = style.webkitTransform = transform.join(" ");
  1214. style.transition = style.webkitTransition = Object.keys(style).map(
  1215. (type) => `${converType(type)} ${transition.duration}ms ${transition.timingFunction} ${transition.delay}ms`
  1216. ).join(",");
  1217. style.transformOrigin = style.webkitTransformOrigin = option.transformOrigin;
  1218. return style;
  1219. }
  1220. function startAnimation(context) {
  1221. const animation2 = context.animation;
  1222. if (!animation2 || !animation2.actions || !animation2.actions.length) {
  1223. return;
  1224. }
  1225. let index2 = 0;
  1226. const actions = animation2.actions;
  1227. const length = animation2.actions.length;
  1228. function animate() {
  1229. const action = actions[index2];
  1230. const transition = action.option.transition;
  1231. const style = getStyle(action);
  1232. Object.keys(style).forEach((key) => {
  1233. context.$el.style[key] = style[key];
  1234. });
  1235. index2 += 1;
  1236. if (index2 < length) {
  1237. setTimeout(animate, transition.duration + transition.delay);
  1238. }
  1239. }
  1240. setTimeout(() => {
  1241. animate();
  1242. }, 0);
  1243. }
  1244. const animation = {
  1245. props: ["animation"],
  1246. watch: {
  1247. animation: {
  1248. deep: true,
  1249. handler() {
  1250. startAnimation(this);
  1251. }
  1252. }
  1253. },
  1254. mounted() {
  1255. startAnimation(this);
  1256. }
  1257. };
  1258. const defineBuiltInComponent = (options) => {
  1259. options.__reserved = true;
  1260. const { props: props2, mixins } = options;
  1261. if (!props2 || !props2.animation) {
  1262. (mixins || (options.mixins = [])).push(animation);
  1263. }
  1264. return defineSystemComponent(options);
  1265. };
  1266. const defineSystemComponent = (options) => {
  1267. options.__reserved = true;
  1268. options.compatConfig = {
  1269. MODE: 3
  1270. // 标记为vue3
  1271. };
  1272. return vue.defineComponent(options);
  1273. };
  1274. const defineUnsupportedComponent = (name) => {
  1275. return defineBuiltInComponent({
  1276. name: shared.capitalize(shared.camelize(name)),
  1277. setup() {
  1278. return () => (vue.openBlock(), vue.createElementBlock("uni-" + name, null, name + " is unsupported"));
  1279. }
  1280. });
  1281. };
  1282. function withWebEvent(fn) {
  1283. return fn.__wwe = true, fn;
  1284. }
  1285. function useCustomEvent(ref, emit2) {
  1286. return (name, evt, detail) => {
  1287. if (ref.value) {
  1288. emit2(name, normalizeCustomEvent(name, evt, ref.value, detail || {}));
  1289. }
  1290. };
  1291. }
  1292. function normalizeCustomEvent(name, domEvt, el, detail) {
  1293. let target;
  1294. target = uniShared.normalizeTarget(el);
  1295. return {
  1296. type: detail.type || name,
  1297. timeStamp: domEvt.timeStamp || 0,
  1298. target,
  1299. currentTarget: target,
  1300. detail
  1301. };
  1302. }
  1303. const hoverProps = {
  1304. hoverClass: {
  1305. type: String,
  1306. default: "none"
  1307. },
  1308. hoverStopPropagation: {
  1309. type: Boolean,
  1310. default: false
  1311. },
  1312. hoverStartTime: {
  1313. type: [Number, String],
  1314. default: 50
  1315. },
  1316. hoverStayTime: {
  1317. type: [Number, String],
  1318. default: 400
  1319. }
  1320. };
  1321. function useHover(props2) {
  1322. const hovering = vue.ref(false);
  1323. let hoverTouch = false;
  1324. let hoverStartTimer;
  1325. let hoverStayTimer;
  1326. function hoverReset() {
  1327. requestAnimationFrame(() => {
  1328. clearTimeout(hoverStayTimer);
  1329. hoverStayTimer = setTimeout(() => {
  1330. hovering.value = false;
  1331. }, parseInt(props2.hoverStayTime));
  1332. });
  1333. }
  1334. function onTouchstartPassive(evt) {
  1335. if (evt.touches.length > 1) {
  1336. return;
  1337. }
  1338. handleHoverStart(evt);
  1339. }
  1340. function onMousedown(evt) {
  1341. if (hoverTouch) {
  1342. return;
  1343. }
  1344. handleHoverStart(evt);
  1345. window.addEventListener("mouseup", handlePCHoverEnd);
  1346. }
  1347. function handleHoverStart(evt) {
  1348. if (evt._hoverPropagationStopped) {
  1349. return;
  1350. }
  1351. if (!props2.hoverClass || props2.hoverClass === "none" || props2.disabled) {
  1352. return;
  1353. }
  1354. if (props2.hoverStopPropagation) {
  1355. evt._hoverPropagationStopped = true;
  1356. }
  1357. hoverTouch = true;
  1358. hoverStartTimer = setTimeout(() => {
  1359. hovering.value = true;
  1360. if (!hoverTouch) {
  1361. hoverReset();
  1362. }
  1363. }, parseInt(props2.hoverStartTime));
  1364. }
  1365. function onTouchend() {
  1366. handleHoverEnd();
  1367. }
  1368. function onMouseup() {
  1369. if (!hoverTouch) {
  1370. return;
  1371. }
  1372. handlePCHoverEnd();
  1373. }
  1374. function handleHoverEnd() {
  1375. hoverTouch = false;
  1376. if (hovering.value) {
  1377. hoverReset();
  1378. }
  1379. }
  1380. function handlePCHoverEnd() {
  1381. handleHoverEnd();
  1382. window.removeEventListener("mouseup", handlePCHoverEnd);
  1383. }
  1384. function onTouchcancel() {
  1385. hoverTouch = false;
  1386. hovering.value = false;
  1387. clearTimeout(hoverStartTimer);
  1388. }
  1389. return {
  1390. hovering,
  1391. binding: {
  1392. onTouchstartPassive: withWebEvent(onTouchstartPassive),
  1393. onMousedown: withWebEvent(onMousedown),
  1394. onTouchend: withWebEvent(onTouchend),
  1395. onMouseup: withWebEvent(onMouseup),
  1396. onTouchcancel: withWebEvent(onTouchcancel)
  1397. }
  1398. };
  1399. }
  1400. function useBooleanAttr(props2, keys) {
  1401. if (shared.isString(keys)) {
  1402. keys = [keys];
  1403. }
  1404. return keys.reduce((res, key) => {
  1405. if (props2[key]) {
  1406. res[key] = true;
  1407. }
  1408. return res;
  1409. }, /* @__PURE__ */ Object.create(null));
  1410. }
  1411. function transformRpx(value) {
  1412. if (/(-?(?:\d+\.)?\d+)[ur]px/gi.test(value)) {
  1413. return value.replace(/(-?(?:\d+\.)?\d+)[ur]px/gi, (text, num) => {
  1414. return `${uni.upx2px(parseFloat(num))}px`;
  1415. });
  1416. }
  1417. return value;
  1418. }
  1419. class UniElement extends HTMLElement {
  1420. constructor() {
  1421. super();
  1422. this._props = {};
  1423. this.__isUniElement = true;
  1424. }
  1425. attachVmProps(props2) {
  1426. this._props = props2;
  1427. }
  1428. getAttribute(qualifiedName) {
  1429. const name = shared.camelize(qualifiedName);
  1430. return name in this._props ? this._props[name] + "" : super.getAttribute(qualifiedName) || null;
  1431. }
  1432. get style() {
  1433. const originalStyle = super.style;
  1434. if (originalStyle.__patchRpx__) {
  1435. return originalStyle;
  1436. }
  1437. originalStyle.__patchRpx__ = true;
  1438. const originalSetProperty = originalStyle.setProperty.bind(originalStyle);
  1439. super.style.setProperty = function(property, value, priority) {
  1440. return originalSetProperty(
  1441. property,
  1442. value ? transformRpx(value + "") : value,
  1443. priority || void 0
  1444. );
  1445. };
  1446. return super.style;
  1447. }
  1448. get tagName() {
  1449. return super.tagName.replace(/^UNI-/, "");
  1450. }
  1451. get nodeName() {
  1452. return super.nodeName.replace(/^UNI-/, "");
  1453. }
  1454. }
  1455. const uniFormKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniForm" : "uf");
  1456. const index$B = /* @__PURE__ */ defineBuiltInComponent({
  1457. name: "Form",
  1458. emits: ["submit", "reset"],
  1459. setup(_props, {
  1460. slots,
  1461. emit: emit2
  1462. }) {
  1463. const rootRef = vue.ref(null);
  1464. provideForm(useCustomEvent(rootRef, emit2));
  1465. return () => vue.createVNode("uni-form", {
  1466. "ref": rootRef
  1467. }, [vue.createVNode("span", null, [slots.default && slots.default()])], 512);
  1468. }
  1469. });
  1470. function provideForm(trigger) {
  1471. const fields2 = [];
  1472. vue.provide(uniFormKey, {
  1473. addField(field) {
  1474. fields2.push(field);
  1475. },
  1476. removeField(field) {
  1477. fields2.splice(fields2.indexOf(field), 1);
  1478. },
  1479. submit(evt) {
  1480. trigger("submit", evt, {
  1481. value: fields2.reduce((res, field) => {
  1482. if (field.submit) {
  1483. const [name, value] = field.submit();
  1484. name && (res[name] = value);
  1485. }
  1486. return res;
  1487. }, /* @__PURE__ */ Object.create(null))
  1488. });
  1489. },
  1490. reset(evt) {
  1491. fields2.forEach((field) => field.reset && field.reset());
  1492. trigger("reset", evt);
  1493. }
  1494. });
  1495. return fields2;
  1496. }
  1497. const labelProps = {
  1498. for: {
  1499. type: String,
  1500. default: ""
  1501. }
  1502. };
  1503. const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul");
  1504. function useProvideLabel() {
  1505. const handlers = [];
  1506. vue.provide(uniLabelKey, {
  1507. addHandler(handler) {
  1508. handlers.push(handler);
  1509. },
  1510. removeHandler(handler) {
  1511. handlers.splice(handlers.indexOf(handler), 1);
  1512. }
  1513. });
  1514. return handlers;
  1515. }
  1516. const index$A = /* @__PURE__ */ defineBuiltInComponent({
  1517. name: "Label",
  1518. props: labelProps,
  1519. setup(props2, {
  1520. slots
  1521. }) {
  1522. const rootRef = vue.ref(null);
  1523. const pageId = useCurrentPageId();
  1524. const handlers = useProvideLabel();
  1525. const pointer = vue.computed(() => props2.for || slots.default && slots.default.length);
  1526. const _onClick = withWebEvent(($event) => {
  1527. const EventTarget = $event.target;
  1528. let stopPropagation = /^uni-(checkbox|radio|switch)-/.test(EventTarget.className);
  1529. if (!stopPropagation) {
  1530. stopPropagation = /^uni-(checkbox|radio|switch|button)$|^(svg|path)$/i.test(EventTarget.tagName);
  1531. }
  1532. if (stopPropagation) {
  1533. return;
  1534. }
  1535. if (props2.for) {
  1536. UniViewJSBridge.emit("uni-label-click-" + pageId + "-" + props2.for, $event, true);
  1537. } else {
  1538. handlers.length && handlers[0]($event, true);
  1539. }
  1540. });
  1541. return () => vue.createVNode("uni-label", {
  1542. "ref": rootRef,
  1543. "class": {
  1544. "uni-label-pointer": pointer
  1545. },
  1546. "onClick": _onClick
  1547. }, [slots.default && slots.default()], 10, ["onClick"]);
  1548. }
  1549. });
  1550. const buttonProps = {
  1551. id: {
  1552. type: String,
  1553. default: ""
  1554. },
  1555. hoverClass: {
  1556. type: String,
  1557. default: "button-hover"
  1558. },
  1559. hoverStartTime: {
  1560. type: [Number, String],
  1561. default: 20
  1562. },
  1563. hoverStayTime: {
  1564. type: [Number, String],
  1565. default: 70
  1566. },
  1567. hoverStopPropagation: {
  1568. type: Boolean,
  1569. default: false
  1570. },
  1571. disabled: {
  1572. type: [Boolean, String],
  1573. default: false
  1574. },
  1575. formType: {
  1576. type: String,
  1577. default: ""
  1578. },
  1579. openType: {
  1580. type: String,
  1581. default: ""
  1582. },
  1583. loading: {
  1584. type: [Boolean, String],
  1585. default: false
  1586. },
  1587. plain: {
  1588. type: [Boolean, String],
  1589. default: false
  1590. }
  1591. };
  1592. const index$z = /* @__PURE__ */ defineBuiltInComponent({
  1593. name: "Button",
  1594. props: buttonProps,
  1595. setup(props2, {
  1596. slots
  1597. }) {
  1598. const rootRef = vue.ref(null);
  1599. const uniForm = vue.inject(uniFormKey, false);
  1600. const {
  1601. hovering,
  1602. binding
  1603. } = useHover(props2);
  1604. const onClick = withWebEvent((e2, isLabelClick) => {
  1605. if (props2.disabled) {
  1606. return e2.stopImmediatePropagation();
  1607. }
  1608. if (isLabelClick) {
  1609. rootRef.value.click();
  1610. }
  1611. const formType = props2.formType;
  1612. if (formType) {
  1613. if (!uniForm) {
  1614. return;
  1615. }
  1616. if (formType === "submit") {
  1617. uniForm.submit(e2);
  1618. } else if (formType === "reset") {
  1619. uniForm.reset(e2);
  1620. }
  1621. return;
  1622. }
  1623. });
  1624. const uniLabel = vue.inject(uniLabelKey, false);
  1625. if (uniLabel) {
  1626. uniLabel.addHandler(onClick);
  1627. }
  1628. return () => {
  1629. const hoverClass = props2.hoverClass;
  1630. const booleanAttrs = useBooleanAttr(props2, "disabled");
  1631. const loadingAttrs = useBooleanAttr(props2, "loading");
  1632. const plainAttrs = useBooleanAttr(props2, "plain");
  1633. const hasHoverClass = hoverClass && hoverClass !== "none";
  1634. return vue.createVNode("uni-button", vue.mergeProps({
  1635. "ref": rootRef,
  1636. "onClick": onClick,
  1637. "id": props2.id,
  1638. "class": hasHoverClass && hovering.value ? hoverClass : ""
  1639. }, hasHoverClass && binding, booleanAttrs, loadingAttrs, plainAttrs), [slots.default && slots.default()], 16, ["onClick", "id"]);
  1640. };
  1641. }
  1642. });
  1643. const props$r = {
  1644. disableScroll: {
  1645. type: [Boolean, String],
  1646. default: false
  1647. }
  1648. };
  1649. class UniCanvasElement extends UniElement {
  1650. get width() {
  1651. return this.querySelector("canvas").width;
  1652. }
  1653. set width(value) {
  1654. this.querySelector("canvas").width = value;
  1655. }
  1656. get height() {
  1657. return this.querySelector("canvas").height;
  1658. }
  1659. set height(value) {
  1660. this.querySelector("canvas").height = value;
  1661. }
  1662. getContext(contextId, options) {
  1663. return this.querySelector("canvas").getContext(contextId, options);
  1664. }
  1665. toBlob(...args) {
  1666. const c = this.querySelector("canvas");
  1667. return c.toBlob.apply(c, args);
  1668. }
  1669. toDataURL(type, encoderOptions) {
  1670. return this.querySelector("canvas").toDataURL(type, encoderOptions);
  1671. }
  1672. }
  1673. const indexX$4 = /* @__PURE__ */ defineBuiltInComponent({
  1674. inheritAttrs: true,
  1675. name: "Canvas",
  1676. compatConfig: {
  1677. MODE: 3
  1678. },
  1679. props: props$r,
  1680. rootElement: {
  1681. name: "uni-canvas",
  1682. class: UniCanvasElement
  1683. },
  1684. setup(props2, {}) {
  1685. const rootRef = vue.ref(null);
  1686. const canvas = vue.ref(null);
  1687. return () => {
  1688. return vue.createVNode("uni-canvas", {
  1689. "ref": rootRef
  1690. }, [vue.createVNode("canvas", {
  1691. "ref": canvas,
  1692. "class": "uni-canvas-canvas"
  1693. }, null, 512)], 512);
  1694. };
  1695. }
  1696. });
  1697. const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
  1698. const props$q = {
  1699. name: {
  1700. type: String,
  1701. default: ""
  1702. }
  1703. };
  1704. const index$y = /* @__PURE__ */ defineBuiltInComponent({
  1705. name: "CheckboxGroup",
  1706. props: props$q,
  1707. emits: ["change"],
  1708. setup(props2, {
  1709. emit: emit2,
  1710. slots
  1711. }) {
  1712. const rootRef = vue.ref(null);
  1713. const trigger = useCustomEvent(rootRef, emit2);
  1714. useProvideCheckGroup(props2, trigger);
  1715. return () => {
  1716. return vue.createVNode("uni-checkbox-group", {
  1717. "ref": rootRef
  1718. }, [slots.default && slots.default()], 512);
  1719. };
  1720. }
  1721. });
  1722. function useProvideCheckGroup(props2, trigger) {
  1723. const fields2 = [];
  1724. const getFieldsValue = () => fields2.reduce((res, field) => {
  1725. if (field.value.checkboxChecked) {
  1726. res.push(field.value.value);
  1727. }
  1728. return res;
  1729. }, new Array());
  1730. vue.provide(uniCheckGroupKey, {
  1731. addField(field) {
  1732. fields2.push(field);
  1733. },
  1734. removeField(field) {
  1735. fields2.splice(fields2.indexOf(field), 1);
  1736. },
  1737. checkboxChange($event) {
  1738. trigger("change", $event, {
  1739. value: getFieldsValue()
  1740. });
  1741. }
  1742. });
  1743. const uniForm = vue.inject(uniFormKey, false);
  1744. if (uniForm) {
  1745. uniForm.addField({
  1746. submit: () => {
  1747. let data = ["", null];
  1748. if (props2.name !== "") {
  1749. data[0] = props2.name;
  1750. data[1] = getFieldsValue();
  1751. }
  1752. return data;
  1753. }
  1754. });
  1755. }
  1756. return getFieldsValue;
  1757. }
  1758. const props$p = {
  1759. checked: {
  1760. type: [Boolean, String],
  1761. default: false
  1762. },
  1763. id: {
  1764. type: String,
  1765. default: ""
  1766. },
  1767. disabled: {
  1768. type: [Boolean, String],
  1769. default: false
  1770. },
  1771. value: {
  1772. type: String,
  1773. default: ""
  1774. },
  1775. color: {
  1776. type: String,
  1777. default: "#007aff"
  1778. },
  1779. backgroundColor: {
  1780. type: String,
  1781. default: ""
  1782. },
  1783. borderColor: {
  1784. type: String,
  1785. default: ""
  1786. },
  1787. activeBackgroundColor: {
  1788. type: String,
  1789. default: ""
  1790. },
  1791. activeBorderColor: {
  1792. type: String,
  1793. default: ""
  1794. },
  1795. iconColor: {
  1796. type: String,
  1797. default: ""
  1798. },
  1799. // 图标颜色,同color,优先级大于iconColor
  1800. foreColor: {
  1801. type: String,
  1802. default: ""
  1803. }
  1804. };
  1805. const index$x = /* @__PURE__ */ defineBuiltInComponent({
  1806. name: "Checkbox",
  1807. props: props$p,
  1808. setup(props2, {
  1809. slots
  1810. }) {
  1811. const rootRef = vue.ref(null);
  1812. const checkboxChecked = vue.ref(props2.checked);
  1813. const checkboxCheckedBool = vue.computed(() => {
  1814. return checkboxChecked.value === "true" || checkboxChecked.value === true;
  1815. });
  1816. const checkboxValue = vue.ref(props2.value);
  1817. function getCheckBoxStyle(checked) {
  1818. if (props2.disabled) {
  1819. return {
  1820. backgroundColor: "#E1E1E1",
  1821. borderColor: "#D1D1D1"
  1822. };
  1823. }
  1824. const style = {};
  1825. if (checked) {
  1826. if (props2.activeBorderColor)
  1827. style.borderColor = props2.activeBorderColor;
  1828. if (props2.activeBackgroundColor)
  1829. style.backgroundColor = props2.activeBackgroundColor;
  1830. } else {
  1831. if (props2.borderColor)
  1832. style.borderColor = props2.borderColor;
  1833. if (props2.backgroundColor)
  1834. style.backgroundColor = props2.backgroundColor;
  1835. }
  1836. return style;
  1837. }
  1838. const checkboxStyle = vue.computed(() => {
  1839. return getCheckBoxStyle(checkboxCheckedBool.value);
  1840. });
  1841. vue.watch([() => props2.checked, () => props2.value], ([newChecked, newModelValue]) => {
  1842. checkboxChecked.value = newChecked;
  1843. checkboxValue.value = newModelValue;
  1844. });
  1845. const reset = () => {
  1846. checkboxChecked.value = false;
  1847. };
  1848. const {
  1849. uniCheckGroup,
  1850. uniLabel
  1851. } = useCheckboxInject(checkboxChecked, checkboxValue, reset);
  1852. const _onClick = ($event) => {
  1853. if (props2.disabled) {
  1854. return;
  1855. }
  1856. checkboxChecked.value = !checkboxChecked.value;
  1857. uniCheckGroup && uniCheckGroup.checkboxChange($event);
  1858. $event.stopPropagation();
  1859. };
  1860. if (!!uniLabel) {
  1861. uniLabel.addHandler(_onClick);
  1862. }
  1863. return () => {
  1864. const booleanAttrs = useBooleanAttr(props2, "disabled");
  1865. let realCheckValue;
  1866. realCheckValue = checkboxChecked.value;
  1867. return vue.createVNode("uni-checkbox", vue.mergeProps(booleanAttrs, {
  1868. "id": props2.id,
  1869. "onClick": _onClick,
  1870. "ref": rootRef
  1871. }), [vue.createVNode("div", {
  1872. "class": "uni-checkbox-wrapper",
  1873. "style": {
  1874. "--HOVER-BD-COLOR": props2.activeBorderColor
  1875. }
  1876. }, [vue.createVNode("div", {
  1877. "class": ["uni-checkbox-input", {
  1878. "uni-checkbox-input-disabled": props2.disabled
  1879. }],
  1880. "style": checkboxStyle.value
  1881. }, [realCheckValue ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.disabled ? "#ADADAD" : props2.foreColor || props2.iconColor || props2.color, 22) : ""], 6), slots.default && slots.default()], 4)], 16, ["id", "onClick"]);
  1882. };
  1883. }
  1884. });
  1885. function useCheckboxInject(checkboxChecked, checkboxValue, reset) {
  1886. const field = vue.computed(() => ({
  1887. checkboxChecked: Boolean(checkboxChecked.value),
  1888. value: checkboxValue.value
  1889. }));
  1890. const formField = {
  1891. reset
  1892. };
  1893. const uniCheckGroup = vue.inject(uniCheckGroupKey, false);
  1894. if (!!uniCheckGroup) {
  1895. uniCheckGroup.addField(field);
  1896. }
  1897. const uniForm = vue.inject(uniFormKey, false);
  1898. if (!!uniForm) {
  1899. uniForm.addField(formField);
  1900. }
  1901. const uniLabel = vue.inject(uniLabelKey, false);
  1902. return {
  1903. uniCheckGroup,
  1904. uniForm,
  1905. uniLabel
  1906. };
  1907. }
  1908. let resetTimer;
  1909. function iosHideKeyboard() {
  1910. }
  1911. const props$o = {
  1912. cursorSpacing: {
  1913. type: [Number, String],
  1914. default: 0
  1915. },
  1916. showConfirmBar: {
  1917. type: [Boolean, String],
  1918. default: "auto"
  1919. },
  1920. adjustPosition: {
  1921. type: [Boolean, String],
  1922. default: true
  1923. },
  1924. autoBlur: {
  1925. type: [Boolean, String],
  1926. default: false
  1927. }
  1928. };
  1929. const emit$1 = ["keyboardheightchange"];
  1930. function useKeyboard$1(props2, elRef, trigger) {
  1931. function initKeyboard(el) {
  1932. const isApple = vue.computed(
  1933. () => String(navigator.vendor).indexOf("Apple") === 0
  1934. );
  1935. el.addEventListener("focus", () => {
  1936. clearTimeout(resetTimer);
  1937. document.addEventListener("click", iosHideKeyboard, false);
  1938. });
  1939. const onKeyboardHide = () => {
  1940. document.removeEventListener("click", iosHideKeyboard, false);
  1941. if (isApple.value) {
  1942. document.documentElement.scrollTo(
  1943. document.documentElement.scrollLeft,
  1944. document.documentElement.scrollTop
  1945. );
  1946. }
  1947. };
  1948. el.addEventListener("blur", () => {
  1949. if (isApple.value) {
  1950. el.blur();
  1951. }
  1952. onKeyboardHide();
  1953. });
  1954. }
  1955. vue.watch(
  1956. () => elRef.value,
  1957. (el) => el && initKeyboard(el)
  1958. );
  1959. }
  1960. function addBase(filePath) {
  1961. const { base: baseUrl } = __uniConfig.router;
  1962. if (uniShared.addLeadingSlash(filePath).indexOf(baseUrl) === 0) {
  1963. return uniShared.addLeadingSlash(filePath);
  1964. }
  1965. return baseUrl + filePath;
  1966. }
  1967. function getRealPath(filePath) {
  1968. const { base, assets } = __uniConfig.router;
  1969. if (base === "./") {
  1970. if (filePath.indexOf("./") === 0 && (filePath.includes("/static/") || filePath.indexOf("./" + (assets || "assets") + "/") === 0)) {
  1971. filePath = filePath.slice(1);
  1972. }
  1973. }
  1974. if (filePath.indexOf("/") === 0) {
  1975. if (filePath.indexOf("//") === 0) {
  1976. filePath = "https:" + filePath;
  1977. } else {
  1978. return addBase(filePath.slice(1));
  1979. }
  1980. }
  1981. if (uniShared.SCHEME_RE.test(filePath) || uniShared.DATA_RE.test(filePath) || filePath.indexOf("blob:") === 0) {
  1982. return filePath;
  1983. }
  1984. {
  1985. if (process.env.NODE_ENV !== "production") {
  1986. if (!filePath.includes("/static/")) {
  1987. return filePath;
  1988. }
  1989. }
  1990. }
  1991. const pages = getCurrentPages();
  1992. if (pages.length) {
  1993. return addBase(
  1994. getRealRoute(pages[pages.length - 1].$page.route, filePath).slice(1)
  1995. );
  1996. }
  1997. return filePath;
  1998. }
  1999. const HTTP_METHODS = [
  2000. "GET",
  2001. "OPTIONS",
  2002. "HEAD",
  2003. "POST",
  2004. "PUT",
  2005. "DELETE",
  2006. "TRACE",
  2007. "CONNECT",
  2008. "PATCH"
  2009. ];
  2010. function elemInArray(str, arr) {
  2011. if (!str || arr.indexOf(str) === -1) {
  2012. return arr[0];
  2013. }
  2014. return str;
  2015. }
  2016. function validateProtocolFail(name, msg) {
  2017. console.warn(`${name}: ${msg}`);
  2018. }
  2019. function validateProtocol(name, data, protocol, onFail) {
  2020. if (!onFail) {
  2021. onFail = validateProtocolFail;
  2022. }
  2023. for (const key in protocol) {
  2024. const errMsg = validateProp(
  2025. key,
  2026. data[key],
  2027. protocol[key],
  2028. !shared.hasOwn(data, key)
  2029. );
  2030. if (shared.isString(errMsg)) {
  2031. onFail(name, errMsg);
  2032. }
  2033. }
  2034. }
  2035. function validateProtocols(name, args, protocol, onFail) {
  2036. if (!protocol) {
  2037. return;
  2038. }
  2039. if (!shared.isArray(protocol)) {
  2040. return validateProtocol(
  2041. name,
  2042. args[0] || /* @__PURE__ */ Object.create(null),
  2043. protocol,
  2044. onFail
  2045. );
  2046. }
  2047. const len = protocol.length;
  2048. const argsLen = args.length;
  2049. for (let i = 0; i < len; i++) {
  2050. const opts = protocol[i];
  2051. const data = /* @__PURE__ */ Object.create(null);
  2052. if (argsLen > i) {
  2053. data[opts.name] = args[i];
  2054. }
  2055. validateProtocol(name, data, { [opts.name]: opts }, onFail);
  2056. }
  2057. }
  2058. function validateProp(name, value, prop, isAbsent) {
  2059. if (!shared.isPlainObject(prop)) {
  2060. prop = { type: prop };
  2061. }
  2062. const { type, required, validator } = prop;
  2063. if (required && isAbsent) {
  2064. return 'Missing required args: "' + name + '"';
  2065. }
  2066. if (value == null && !required) {
  2067. return;
  2068. }
  2069. if (type != null) {
  2070. let isValid = false;
  2071. const types = shared.isArray(type) ? type : [type];
  2072. const expectedTypes = [];
  2073. for (let i = 0; i < types.length && !isValid; i++) {
  2074. const { valid, expectedType } = assertType(value, types[i]);
  2075. expectedTypes.push(expectedType || "");
  2076. isValid = valid;
  2077. }
  2078. if (!isValid) {
  2079. return getInvalidTypeMessage(name, value, expectedTypes);
  2080. }
  2081. }
  2082. if (validator) {
  2083. return validator(value);
  2084. }
  2085. }
  2086. const isSimpleType = /* @__PURE__ */ shared.makeMap(
  2087. "String,Number,Boolean,Function,Symbol"
  2088. );
  2089. function assertType(value, type) {
  2090. let valid;
  2091. const expectedType = getType(type);
  2092. if (isSimpleType(expectedType)) {
  2093. const t2 = typeof value;
  2094. valid = t2 === expectedType.toLowerCase();
  2095. if (!valid && t2 === "object") {
  2096. valid = value instanceof type;
  2097. }
  2098. } else if (expectedType === "Object") {
  2099. valid = shared.isObject(value);
  2100. } else if (expectedType === "Array") {
  2101. valid = shared.isArray(value);
  2102. } else {
  2103. {
  2104. valid = value instanceof type;
  2105. }
  2106. }
  2107. return {
  2108. valid,
  2109. expectedType
  2110. };
  2111. }
  2112. function getInvalidTypeMessage(name, value, expectedTypes) {
  2113. let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(shared.capitalize).join(", ")}`;
  2114. const expectedType = expectedTypes[0];
  2115. const receivedType = shared.toRawType(value);
  2116. const expectedValue = styleValue(value, expectedType);
  2117. const receivedValue = styleValue(value, receivedType);
  2118. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  2119. message += ` with value ${expectedValue}`;
  2120. }
  2121. message += `, got ${receivedType} `;
  2122. if (isExplicable(receivedType)) {
  2123. message += `with value ${receivedValue}.`;
  2124. }
  2125. return message;
  2126. }
  2127. function getType(ctor) {
  2128. const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
  2129. return match ? match[1] : "";
  2130. }
  2131. function styleValue(value, type) {
  2132. if (type === "String") {
  2133. return `"${value}"`;
  2134. } else if (type === "Number") {
  2135. return `${Number(value)}`;
  2136. } else {
  2137. return `${value}`;
  2138. }
  2139. }
  2140. function isExplicable(type) {
  2141. const explicitTypes = ["string", "number", "boolean"];
  2142. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  2143. }
  2144. function isBoolean(...args) {
  2145. return args.some((elem) => elem.toLowerCase() === "boolean");
  2146. }
  2147. function tryCatch(fn) {
  2148. return function() {
  2149. try {
  2150. return fn.apply(fn, arguments);
  2151. } catch (e2) {
  2152. console.error(e2);
  2153. }
  2154. };
  2155. }
  2156. let invokeCallbackId = 1;
  2157. const invokeCallbacks = {};
  2158. function addInvokeCallback(id2, name, callback, keepAlive = false) {
  2159. invokeCallbacks[id2] = {
  2160. name,
  2161. keepAlive,
  2162. callback
  2163. };
  2164. return id2;
  2165. }
  2166. function invokeCallback(id2, res, extras) {
  2167. if (typeof id2 === "number") {
  2168. const opts = invokeCallbacks[id2];
  2169. if (opts) {
  2170. if (!opts.keepAlive) {
  2171. delete invokeCallbacks[id2];
  2172. }
  2173. return opts.callback(res, extras);
  2174. }
  2175. }
  2176. return res;
  2177. }
  2178. const API_SUCCESS = "success";
  2179. const API_FAIL = "fail";
  2180. const API_COMPLETE = "complete";
  2181. function getApiCallbacks(args) {
  2182. const apiCallbacks = {};
  2183. for (const name in args) {
  2184. const fn = args[name];
  2185. if (shared.isFunction(fn)) {
  2186. apiCallbacks[name] = tryCatch(fn);
  2187. delete args[name];
  2188. }
  2189. }
  2190. return apiCallbacks;
  2191. }
  2192. function normalizeErrMsg(errMsg, name) {
  2193. if (!errMsg || errMsg.indexOf(":fail") === -1) {
  2194. return name + ":ok";
  2195. }
  2196. return name + errMsg.substring(errMsg.indexOf(":fail"));
  2197. }
  2198. function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
  2199. if (!shared.isPlainObject(args)) {
  2200. args = {};
  2201. }
  2202. const { success, fail, complete } = getApiCallbacks(args);
  2203. const hasSuccess = shared.isFunction(success);
  2204. const hasFail = shared.isFunction(fail);
  2205. const hasComplete = shared.isFunction(complete);
  2206. const callbackId = invokeCallbackId++;
  2207. addInvokeCallback(callbackId, name, (res) => {
  2208. res = res || {};
  2209. res.errMsg = normalizeErrMsg(res.errMsg, name);
  2210. shared.isFunction(beforeAll) && beforeAll(res);
  2211. if (res.errMsg === name + ":ok") {
  2212. shared.isFunction(beforeSuccess) && beforeSuccess(res, args);
  2213. hasSuccess && success(res);
  2214. } else {
  2215. hasFail && fail(res);
  2216. }
  2217. hasComplete && complete(res);
  2218. });
  2219. return callbackId;
  2220. }
  2221. const HOOK_SUCCESS = "success";
  2222. const HOOK_FAIL = "fail";
  2223. const HOOK_COMPLETE = "complete";
  2224. const globalInterceptors = {};
  2225. const scopedInterceptors = {};
  2226. function wrapperHook(hook, params) {
  2227. return function(data) {
  2228. return hook(data, params) || data;
  2229. };
  2230. }
  2231. function queue(hooks, data, params) {
  2232. let promise = false;
  2233. for (let i = 0; i < hooks.length; i++) {
  2234. const hook = hooks[i];
  2235. if (promise) {
  2236. promise = Promise.resolve(wrapperHook(hook, params));
  2237. } else {
  2238. const res = hook(data, params);
  2239. if (shared.isPromise(res)) {
  2240. promise = Promise.resolve(res);
  2241. }
  2242. if (res === false) {
  2243. return {
  2244. then() {
  2245. },
  2246. catch() {
  2247. }
  2248. };
  2249. }
  2250. }
  2251. }
  2252. return promise || {
  2253. then(callback) {
  2254. return callback(data);
  2255. },
  2256. catch() {
  2257. }
  2258. };
  2259. }
  2260. function wrapperOptions(interceptors, options = {}) {
  2261. [HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name) => {
  2262. const hooks = interceptors[name];
  2263. if (!shared.isArray(hooks)) {
  2264. return;
  2265. }
  2266. const oldCallback = options[name];
  2267. options[name] = function callbackInterceptor(res) {
  2268. queue(hooks, res, options).then((res2) => {
  2269. return shared.isFunction(oldCallback) && oldCallback(res2) || res2;
  2270. });
  2271. };
  2272. });
  2273. return options;
  2274. }
  2275. function wrapperReturnValue(method, returnValue) {
  2276. const returnValueHooks = [];
  2277. if (shared.isArray(globalInterceptors.returnValue)) {
  2278. returnValueHooks.push(...globalInterceptors.returnValue);
  2279. }
  2280. const interceptor = scopedInterceptors[method];
  2281. if (interceptor && shared.isArray(interceptor.returnValue)) {
  2282. returnValueHooks.push(...interceptor.returnValue);
  2283. }
  2284. returnValueHooks.forEach((hook) => {
  2285. returnValue = hook(returnValue) || returnValue;
  2286. });
  2287. return returnValue;
  2288. }
  2289. function getApiInterceptorHooks(method) {
  2290. const interceptor = /* @__PURE__ */ Object.create(null);
  2291. Object.keys(globalInterceptors).forEach((hook) => {
  2292. if (hook !== "returnValue") {
  2293. interceptor[hook] = globalInterceptors[hook].slice();
  2294. }
  2295. });
  2296. const scopedInterceptor = scopedInterceptors[method];
  2297. if (scopedInterceptor) {
  2298. Object.keys(scopedInterceptor).forEach((hook) => {
  2299. if (hook !== "returnValue") {
  2300. interceptor[hook] = (interceptor[hook] || []).concat(
  2301. scopedInterceptor[hook]
  2302. );
  2303. }
  2304. });
  2305. }
  2306. return interceptor;
  2307. }
  2308. function invokeApi(method, api2, options, params) {
  2309. const interceptor = getApiInterceptorHooks(method);
  2310. if (interceptor && Object.keys(interceptor).length) {
  2311. if (shared.isArray(interceptor.invoke)) {
  2312. const res = queue(interceptor.invoke, options);
  2313. return res.then((options2) => {
  2314. return api2(
  2315. wrapperOptions(getApiInterceptorHooks(method), options2),
  2316. ...params
  2317. );
  2318. });
  2319. } else {
  2320. return api2(wrapperOptions(interceptor, options), ...params);
  2321. }
  2322. }
  2323. return api2(options, ...params);
  2324. }
  2325. function hasCallback(args) {
  2326. if (shared.isPlainObject(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find(
  2327. (cb) => shared.isFunction(args[cb])
  2328. )) {
  2329. return true;
  2330. }
  2331. return false;
  2332. }
  2333. function handlePromise(promise) {
  2334. return promise;
  2335. }
  2336. function promisify(name, fn) {
  2337. return (args = {}, ...rest) => {
  2338. if (hasCallback(args)) {
  2339. return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
  2340. }
  2341. return wrapperReturnValue(
  2342. name,
  2343. handlePromise(
  2344. new Promise((resolve, reject) => {
  2345. invokeApi(
  2346. name,
  2347. fn,
  2348. shared.extend(args, { success: resolve, fail: reject }),
  2349. rest
  2350. );
  2351. })
  2352. )
  2353. );
  2354. };
  2355. }
  2356. function formatApiArgs(args, options) {
  2357. const params = args[0];
  2358. if (!options || !options.formatArgs || !shared.isPlainObject(options.formatArgs) && shared.isPlainObject(params)) {
  2359. return;
  2360. }
  2361. const formatArgs = options.formatArgs;
  2362. const keys = Object.keys(formatArgs);
  2363. for (let i = 0; i < keys.length; i++) {
  2364. const name = keys[i];
  2365. const formatterOrDefaultValue = formatArgs[name];
  2366. if (shared.isFunction(formatterOrDefaultValue)) {
  2367. const errMsg = formatterOrDefaultValue(args[0][name], params);
  2368. if (shared.isString(errMsg)) {
  2369. return errMsg;
  2370. }
  2371. } else {
  2372. if (!shared.hasOwn(params, name)) {
  2373. params[name] = formatterOrDefaultValue;
  2374. }
  2375. }
  2376. }
  2377. }
  2378. function invokeSuccess(id2, name, res) {
  2379. const result = {
  2380. errMsg: name + ":ok"
  2381. };
  2382. result.errSubject = name;
  2383. return invokeCallback(id2, shared.extend(res || {}, result));
  2384. }
  2385. function invokeFail(id2, name, errMsg, errRes = {}) {
  2386. const apiErrMsg = name + ":fail" + (errMsg ? " " + errMsg : "");
  2387. let res = shared.extend({ errMsg: apiErrMsg }, errRes);
  2388. if (typeof UniError !== "undefined") {
  2389. res = typeof errRes.errCode !== "undefined" ? new UniError(name, errRes.errCode, apiErrMsg) : new UniError(apiErrMsg, errRes);
  2390. }
  2391. return invokeCallback(id2, res);
  2392. }
  2393. function beforeInvokeApi(name, args, protocol, options) {
  2394. if (process.env.NODE_ENV !== "production") {
  2395. validateProtocols(name, args, protocol);
  2396. }
  2397. if (options && options.beforeInvoke) {
  2398. const errMsg2 = options.beforeInvoke(args);
  2399. if (shared.isString(errMsg2)) {
  2400. return errMsg2;
  2401. }
  2402. }
  2403. const errMsg = formatApiArgs(args, options);
  2404. if (errMsg) {
  2405. return errMsg;
  2406. }
  2407. }
  2408. function parseErrMsg(errMsg) {
  2409. if (!errMsg || shared.isString(errMsg)) {
  2410. return errMsg;
  2411. }
  2412. if (errMsg.stack) {
  2413. console.error(errMsg.message + "\n" + errMsg.stack);
  2414. return errMsg.message;
  2415. }
  2416. return errMsg;
  2417. }
  2418. function wrapperTaskApi(name, fn, protocol, options) {
  2419. return (args) => {
  2420. const id2 = createAsyncApiCallback(name, args, options);
  2421. const errMsg = beforeInvokeApi(name, [args], protocol, options);
  2422. if (errMsg) {
  2423. return invokeFail(id2, name, errMsg);
  2424. }
  2425. return fn(args, {
  2426. resolve: (res) => invokeSuccess(id2, name, res),
  2427. reject: (errMsg2, errRes) => invokeFail(id2, name, parseErrMsg(errMsg2), errRes)
  2428. });
  2429. };
  2430. }
  2431. function wrapperSyncApi(name, fn, protocol, options) {
  2432. return (...args) => {
  2433. const errMsg = beforeInvokeApi(name, args, protocol, options);
  2434. if (errMsg) {
  2435. throw new Error(errMsg);
  2436. }
  2437. return fn.apply(null, args);
  2438. };
  2439. }
  2440. function wrapperAsyncApi(name, fn, protocol, options) {
  2441. return wrapperTaskApi(name, fn, protocol, options);
  2442. }
  2443. function defineTaskApi(name, fn, protocol, options) {
  2444. return promisify(
  2445. name,
  2446. wrapperTaskApi(name, fn, process.env.NODE_ENV !== "production" ? protocol : void 0, options)
  2447. );
  2448. }
  2449. function defineSyncApi(name, fn, protocol, options) {
  2450. return wrapperSyncApi(
  2451. name,
  2452. fn,
  2453. process.env.NODE_ENV !== "production" ? protocol : void 0,
  2454. options
  2455. );
  2456. }
  2457. function defineAsyncApi(name, fn, protocol, options) {
  2458. return promisify(
  2459. name,
  2460. wrapperAsyncApi(name, fn, process.env.NODE_ENV !== "production" ? protocol : void 0, options)
  2461. );
  2462. }
  2463. const API_ON_TAB_BAR_MID_BUTTON_TAP = "onTabBarMidButtonTap";
  2464. const API_GET_LOCALE = "getLocale";
  2465. const getLocale = /* @__PURE__ */ defineSyncApi(
  2466. API_GET_LOCALE,
  2467. () => {
  2468. const app = getApp({ allowDefault: true });
  2469. if (app && app.$vm) {
  2470. return app.$vm.$locale;
  2471. }
  2472. return useI18n().getLocale();
  2473. }
  2474. );
  2475. const API_GET_STORAGE = "getStorage";
  2476. const GetStorageProtocol = {
  2477. key: {
  2478. type: String,
  2479. required: true
  2480. }
  2481. };
  2482. const API_GET_STORAGE_SYNC = "getStorageSync";
  2483. const GetStorageSyncProtocol = [
  2484. {
  2485. name: "key",
  2486. type: String,
  2487. required: true
  2488. }
  2489. ];
  2490. const API_SET_STORAGE = "setStorage";
  2491. const SetStorageProtocol = {
  2492. key: {
  2493. type: String,
  2494. required: true
  2495. },
  2496. data: {
  2497. required: true
  2498. }
  2499. };
  2500. const API_SET_STORAGE_SYNC = "setStorageSync";
  2501. const SetStorageSyncProtocol = [
  2502. {
  2503. name: "key",
  2504. type: String,
  2505. required: true
  2506. },
  2507. {
  2508. name: "data",
  2509. required: true
  2510. }
  2511. ];
  2512. const API_REMOVE_STORAGE = "removeStorage";
  2513. const RemoveStorageProtocol = GetStorageProtocol;
  2514. const RemoveStorageSyncProtocol = GetStorageSyncProtocol;
  2515. const API_REQUEST = "request";
  2516. const dataType = {
  2517. JSON: "json"
  2518. };
  2519. const RESPONSE_TYPE = ["text", "arraybuffer"];
  2520. const DEFAULT_RESPONSE_TYPE = "text";
  2521. const encode = encodeURIComponent;
  2522. function stringifyQuery(url, data) {
  2523. let str = url.split("#");
  2524. const hash = str[1] || "";
  2525. str = str[0].split("?");
  2526. let query = str[1] || "";
  2527. url = str[0];
  2528. const search = query.split("&").filter((item) => item);
  2529. const params = {};
  2530. search.forEach((item) => {
  2531. const part = item.split("=");
  2532. params[part[0]] = part[1];
  2533. });
  2534. for (const key in data) {
  2535. if (shared.hasOwn(data, key)) {
  2536. let v2 = data[key];
  2537. if (typeof v2 === "undefined" || v2 === null) {
  2538. v2 = "";
  2539. } else if (shared.isPlainObject(v2)) {
  2540. v2 = JSON.stringify(v2);
  2541. }
  2542. params[encode(key)] = encode(v2);
  2543. }
  2544. }
  2545. query = Object.keys(params).map((item) => `${item}=${params[item]}`).join("&");
  2546. return url + (query ? "?" + query : "") + (hash ? "#" + hash : "");
  2547. }
  2548. const RequestProtocol = {
  2549. method: String,
  2550. data: [Object, String, Array, ArrayBuffer],
  2551. url: {
  2552. type: String,
  2553. required: true
  2554. },
  2555. header: Object,
  2556. dataType: String,
  2557. responseType: String,
  2558. withCredentials: Boolean
  2559. };
  2560. const RequestOptions = {
  2561. formatArgs: {
  2562. method(value, params) {
  2563. params.method = elemInArray(
  2564. (value || "").toUpperCase(),
  2565. HTTP_METHODS
  2566. );
  2567. },
  2568. data(value, params) {
  2569. params.data = value || "";
  2570. },
  2571. url(value, params) {
  2572. if (params.method === HTTP_METHODS[0] && shared.isPlainObject(params.data) && Object.keys(params.data).length) {
  2573. params.url = stringifyQuery(value, params.data);
  2574. }
  2575. },
  2576. header(value, params) {
  2577. const header = params.header = value || {};
  2578. if (params.method !== HTTP_METHODS[0]) {
  2579. if (!Object.keys(header).find(
  2580. (key) => key.toLowerCase() === "content-type"
  2581. )) {
  2582. header["Content-Type"] = "application/json";
  2583. }
  2584. }
  2585. },
  2586. dataType(value, params) {
  2587. params.dataType = (value || dataType.JSON).toLowerCase();
  2588. },
  2589. responseType(value, params) {
  2590. params.responseType = (value || "").toLowerCase();
  2591. if (RESPONSE_TYPE.indexOf(params.responseType) === -1) {
  2592. params.responseType = DEFAULT_RESPONSE_TYPE;
  2593. }
  2594. }
  2595. }
  2596. };
  2597. const API_SET_NAVIGATION_BAR_COLOR = "setNavigationBarColor";
  2598. const API_SET_NAVIGATION_BAR_TITLE = "setNavigationBarTitle";
  2599. const SetNavigationBarTitleProtocol = {
  2600. title: {
  2601. type: String,
  2602. required: true
  2603. }
  2604. };
  2605. const API_SHOW_NAVIGATION_BAR_LOADING = "showNavigationBarLoading";
  2606. const API_HIDE_NAVIGATION_BAR_LOADING = "hideNavigationBarLoading";
  2607. var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
  2608. var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
  2609. var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
  2610. var empty = /* @__PURE__ */ makeMap(
  2611. "area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"
  2612. );
  2613. var block = /* @__PURE__ */ makeMap(
  2614. "a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"
  2615. );
  2616. var inline = /* @__PURE__ */ makeMap(
  2617. "abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"
  2618. );
  2619. var closeSelf = /* @__PURE__ */ makeMap(
  2620. "colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"
  2621. );
  2622. var fillAttrs = /* @__PURE__ */ makeMap(
  2623. "checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"
  2624. );
  2625. var special = /* @__PURE__ */ makeMap("script,style");
  2626. function HTMLParser(html, handler) {
  2627. var index2;
  2628. var chars;
  2629. var match;
  2630. var stack = [];
  2631. var last = html;
  2632. stack.last = function() {
  2633. return this[this.length - 1];
  2634. };
  2635. while (html) {
  2636. chars = true;
  2637. if (!stack.last() || !special[stack.last()]) {
  2638. if (html.indexOf("<!--") == 0) {
  2639. index2 = html.indexOf("-->");
  2640. if (index2 >= 0) {
  2641. if (handler.comment) {
  2642. handler.comment(html.substring(4, index2));
  2643. }
  2644. html = html.substring(index2 + 3);
  2645. chars = false;
  2646. }
  2647. } else if (html.indexOf("</") == 0) {
  2648. match = html.match(endTag);
  2649. if (match) {
  2650. html = html.substring(match[0].length);
  2651. match[0].replace(endTag, parseEndTag);
  2652. chars = false;
  2653. }
  2654. } else if (html.indexOf("<") == 0) {
  2655. match = html.match(startTag);
  2656. if (match) {
  2657. html = html.substring(match[0].length);
  2658. match[0].replace(startTag, parseStartTag);
  2659. chars = false;
  2660. }
  2661. }
  2662. if (chars) {
  2663. index2 = html.indexOf("<");
  2664. var text = index2 < 0 ? html : html.substring(0, index2);
  2665. html = index2 < 0 ? "" : html.substring(index2);
  2666. if (handler.chars) {
  2667. handler.chars(text);
  2668. }
  2669. }
  2670. } else {
  2671. html = html.replace(
  2672. new RegExp("([\\s\\S]*?)</" + stack.last() + "[^>]*>"),
  2673. function(all, text2) {
  2674. text2 = text2.replace(
  2675. /<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g,
  2676. "$1$2"
  2677. );
  2678. if (handler.chars) {
  2679. handler.chars(text2);
  2680. }
  2681. return "";
  2682. }
  2683. );
  2684. parseEndTag("", stack.last());
  2685. }
  2686. if (html == last) {
  2687. throw "Parse Error: " + html;
  2688. }
  2689. last = html;
  2690. }
  2691. parseEndTag();
  2692. function parseStartTag(tag, tagName, rest, unary) {
  2693. tagName = tagName.toLowerCase();
  2694. if (block[tagName]) {
  2695. while (stack.last() && inline[stack.last()]) {
  2696. parseEndTag("", stack.last());
  2697. }
  2698. }
  2699. if (closeSelf[tagName] && stack.last() == tagName) {
  2700. parseEndTag("", tagName);
  2701. }
  2702. unary = empty[tagName] || !!unary;
  2703. if (!unary) {
  2704. stack.push(tagName);
  2705. }
  2706. if (handler.start) {
  2707. var attrs = [];
  2708. rest.replace(attr, function(match2, name) {
  2709. var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : "";
  2710. attrs.push({
  2711. name,
  2712. value,
  2713. escaped: value.replace(/(^|[^\\])"/g, '$1\\"')
  2714. // "
  2715. });
  2716. });
  2717. if (handler.start) {
  2718. handler.start(tagName, attrs, unary);
  2719. }
  2720. }
  2721. }
  2722. function parseEndTag(tag, tagName) {
  2723. if (!tagName) {
  2724. var pos = 0;
  2725. } else {
  2726. for (var pos = stack.length - 1; pos >= 0; pos--) {
  2727. if (stack[pos] == tagName) {
  2728. break;
  2729. }
  2730. }
  2731. }
  2732. if (pos >= 0) {
  2733. for (var i = stack.length - 1; i >= pos; i--) {
  2734. if (handler.end) {
  2735. handler.end(stack[i]);
  2736. }
  2737. }
  2738. stack.length = pos;
  2739. }
  2740. }
  2741. }
  2742. function makeMap(str) {
  2743. var obj = {};
  2744. var items = str.split(",");
  2745. for (var i = 0; i < items.length; i++) {
  2746. obj[items[i]] = true;
  2747. }
  2748. return obj;
  2749. }
  2750. function useQuill(props2, rootRef, trigger) {
  2751. vue.watch(
  2752. () => props2.readOnly,
  2753. (value) => {
  2754. }
  2755. );
  2756. vue.watch(
  2757. () => props2.placeholder,
  2758. (value) => {
  2759. }
  2760. );
  2761. useContextInfo();
  2762. useSubscribe();
  2763. }
  2764. const props$n = /* @__PURE__ */ shared.extend({}, props$o, {
  2765. id: {
  2766. type: String,
  2767. default: ""
  2768. },
  2769. readOnly: {
  2770. type: [Boolean, String],
  2771. default: false
  2772. },
  2773. placeholder: {
  2774. type: String,
  2775. default: ""
  2776. },
  2777. showImgSize: {
  2778. type: [Boolean, String],
  2779. default: false
  2780. },
  2781. showImgToolbar: {
  2782. type: [Boolean, String],
  2783. default: false
  2784. },
  2785. showImgResize: {
  2786. type: [Boolean, String],
  2787. default: false
  2788. }
  2789. });
  2790. const index$w = /* @__PURE__ */ defineBuiltInComponent({
  2791. name: "Editor",
  2792. props: props$n,
  2793. emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
  2794. setup(props2, {
  2795. emit: emit2
  2796. }) {
  2797. const rootRef = vue.ref(null);
  2798. useQuill(props2);
  2799. useKeyboard$1(props2, rootRef);
  2800. return () => {
  2801. return vue.createVNode("uni-editor", {
  2802. "ref": rootRef,
  2803. "id": props2.id,
  2804. "class": "ql-container"
  2805. }, null, 8, ["id"]);
  2806. };
  2807. }
  2808. });
  2809. const INFO_COLOR = "#10aeff";
  2810. const WARN_COLOR = "#f76260";
  2811. const GREY_COLOR = "#b2b2b2";
  2812. const CANCEL_COLOR = "#f43530";
  2813. const ICONS = {
  2814. success: {
  2815. d: ICON_PATH_SUCCESS,
  2816. c: uniShared.PRIMARY_COLOR
  2817. },
  2818. success_no_circle: {
  2819. d: ICON_PATH_SUCCESS_NO_CIRCLE,
  2820. c: uniShared.PRIMARY_COLOR
  2821. },
  2822. info: {
  2823. d: ICON_PATH_INFO,
  2824. c: INFO_COLOR
  2825. },
  2826. warn: {
  2827. d: ICON_PATH_WARN,
  2828. c: WARN_COLOR
  2829. },
  2830. waiting: {
  2831. d: ICON_PATH_WAITING,
  2832. c: INFO_COLOR
  2833. },
  2834. cancel: {
  2835. d: ICON_PATH_CANCEL,
  2836. c: CANCEL_COLOR
  2837. },
  2838. download: {
  2839. d: ICON_PATH_DOWNLOAD,
  2840. c: uniShared.PRIMARY_COLOR
  2841. },
  2842. search: {
  2843. d: ICON_PATH_SEARCH,
  2844. c: GREY_COLOR
  2845. },
  2846. clear: {
  2847. d: ICON_PATH_CLEAR,
  2848. c: GREY_COLOR
  2849. }
  2850. };
  2851. const index$v = /* @__PURE__ */ defineBuiltInComponent({
  2852. name: "Icon",
  2853. props: {
  2854. type: {
  2855. type: String,
  2856. required: true,
  2857. default: ""
  2858. },
  2859. size: {
  2860. type: [String, Number],
  2861. default: 23
  2862. },
  2863. color: {
  2864. type: String,
  2865. default: ""
  2866. }
  2867. },
  2868. setup(props2) {
  2869. const rootRef = vue.ref(null);
  2870. const path = vue.computed(() => ICONS[props2.type]);
  2871. return () => {
  2872. const {
  2873. value
  2874. } = path;
  2875. return vue.createVNode("uni-icon", {
  2876. "ref": rootRef
  2877. }, [value && value.d && createSvgIconVNode(value.d, props2.color || value.c, rpx2px(props2.size))], 512);
  2878. };
  2879. }
  2880. });
  2881. const ResizeSensor = /* @__PURE__ */ defineBuiltInComponent({
  2882. name: "ResizeSensor",
  2883. props: {
  2884. initial: {
  2885. type: Boolean,
  2886. default: false
  2887. }
  2888. },
  2889. emits: ["resize"],
  2890. setup(props2, {
  2891. emit: emit2
  2892. }) {
  2893. const rootRef = vue.ref(null);
  2894. const reset = useResizeSensorReset(rootRef);
  2895. const update = useResizeSensorUpdate(rootRef, emit2, reset);
  2896. return () => vue.createVNode("uni-resize-sensor", {
  2897. "ref": rootRef,
  2898. "onAnimationstartOnce": update
  2899. }, [vue.createVNode("div", {
  2900. "onScroll": update
  2901. }, [vue.createVNode("div", null, null)], 40, ["onScroll"]), vue.createVNode("div", {
  2902. "onScroll": update
  2903. }, [vue.createVNode("div", null, null)], 40, ["onScroll"])], 40, ["onAnimationstartOnce"]);
  2904. }
  2905. });
  2906. function useResizeSensorUpdate(rootRef, emit2, reset) {
  2907. const size = vue.reactive({
  2908. width: -1,
  2909. height: -1
  2910. });
  2911. vue.watch(() => shared.extend({}, size), (value) => emit2("resize", value));
  2912. return () => {
  2913. const rootEl = rootRef.value;
  2914. if (!rootEl)
  2915. return;
  2916. size.width = rootEl.offsetWidth;
  2917. size.height = rootEl.offsetHeight;
  2918. reset();
  2919. };
  2920. }
  2921. function useResizeSensorReset(rootRef) {
  2922. return () => {
  2923. const {
  2924. firstElementChild,
  2925. lastElementChild
  2926. } = rootRef.value;
  2927. firstElementChild.scrollLeft = 1e5;
  2928. firstElementChild.scrollTop = 1e5;
  2929. lastElementChild.scrollLeft = 1e5;
  2930. lastElementChild.scrollTop = 1e5;
  2931. };
  2932. }
  2933. const props$m = {
  2934. src: {
  2935. type: String,
  2936. default: ""
  2937. },
  2938. mode: {
  2939. type: String,
  2940. default: "scaleToFill"
  2941. },
  2942. lazyLoad: {
  2943. type: [Boolean, String],
  2944. default: false
  2945. },
  2946. draggable: {
  2947. type: Boolean,
  2948. default: false
  2949. }
  2950. };
  2951. const FIX_MODES = {
  2952. widthFix: ["offsetWidth", "height", (value, ratio) => value / ratio],
  2953. heightFix: ["offsetHeight", "width", (value, ratio) => value * ratio]
  2954. };
  2955. const IMAGE_MODES = {
  2956. aspectFit: ["center center", "contain"],
  2957. aspectFill: ["center center", "cover"],
  2958. widthFix: [, "100% 100%"],
  2959. heightFix: [, "100% 100%"],
  2960. top: ["center top"],
  2961. bottom: ["center bottom"],
  2962. center: ["center center"],
  2963. left: ["left center"],
  2964. right: ["right center"],
  2965. "top left": ["left top"],
  2966. "top right": ["right top"],
  2967. "bottom left": ["left bottom"],
  2968. "bottom right": ["right bottom"]
  2969. };
  2970. const index$u = /* @__PURE__ */ defineBuiltInComponent({
  2971. name: "Image",
  2972. props: props$m,
  2973. setup(props2, {
  2974. emit: emit2
  2975. }) {
  2976. const rootRef = vue.ref(null);
  2977. const state = useImageState(rootRef, props2);
  2978. const trigger = useCustomEvent(rootRef, emit2);
  2979. const {
  2980. fixSize
  2981. } = useImageSize(rootRef, props2, state);
  2982. useImageLoader(state, props2, rootRef, fixSize, trigger);
  2983. return () => {
  2984. return vue.createVNode("uni-image", {
  2985. "ref": rootRef
  2986. }, [vue.createVNode("div", {
  2987. "style": state.modeStyle
  2988. }, null, 4), FIX_MODES[props2.mode] ? vue.createVNode(ResizeSensor, {
  2989. "onResize": fixSize
  2990. }, null, 8, ["onResize"]) : vue.createVNode("span", null, null)], 512);
  2991. };
  2992. }
  2993. });
  2994. function useImageState(rootRef, props2) {
  2995. const imgSrc = vue.ref("");
  2996. const modeStyleRef = vue.computed(() => {
  2997. let size = "auto";
  2998. let position = "";
  2999. const opts = IMAGE_MODES[props2.mode];
  3000. if (!opts) {
  3001. position = "0% 0%";
  3002. size = "100% 100%";
  3003. } else {
  3004. opts[0] && (position = opts[0]);
  3005. opts[1] && (size = opts[1]);
  3006. }
  3007. return `background-image:${imgSrc.value ? 'url("' + imgSrc.value + '")' : "none"};background-position:${position};background-size:${size};`;
  3008. });
  3009. const state = vue.reactive({
  3010. rootEl: rootRef,
  3011. src: vue.computed(() => props2.src ? getRealPath(props2.src) : ""),
  3012. origWidth: 0,
  3013. origHeight: 0,
  3014. origStyle: {
  3015. width: "",
  3016. height: ""
  3017. },
  3018. modeStyle: modeStyleRef,
  3019. imgSrc
  3020. });
  3021. return state;
  3022. }
  3023. function useImageLoader(state, props2, rootRef, fixSize, trigger) {
  3024. let img;
  3025. let draggableImg;
  3026. const setState = (width = 0, height = 0, imgSrc = "") => {
  3027. state.origWidth = width;
  3028. state.origHeight = height;
  3029. state.imgSrc = imgSrc;
  3030. };
  3031. const loadImage = (src) => {
  3032. if (!src) {
  3033. resetImage();
  3034. setState();
  3035. return;
  3036. }
  3037. img = img || new Image();
  3038. img.onload = (evt) => {
  3039. const {
  3040. width,
  3041. height
  3042. } = img;
  3043. setState(width, height, src);
  3044. vue.nextTick(() => {
  3045. fixSize();
  3046. });
  3047. img.draggable = props2.draggable;
  3048. if (draggableImg) {
  3049. draggableImg.remove();
  3050. }
  3051. draggableImg = img;
  3052. rootRef.value.appendChild(img);
  3053. resetImage();
  3054. trigger("load", evt, {
  3055. width,
  3056. height
  3057. });
  3058. };
  3059. img.onerror = (evt) => {
  3060. setState();
  3061. resetImage();
  3062. trigger("error", evt, {
  3063. errMsg: `GET ${state.src} 404 (Not Found)`
  3064. });
  3065. };
  3066. img.src = src;
  3067. };
  3068. const resetImage = () => {
  3069. if (img) {
  3070. img.onload = null;
  3071. img.onerror = null;
  3072. img = null;
  3073. }
  3074. };
  3075. vue.watch(() => state.src, (value) => loadImage(value));
  3076. vue.watch(() => state.imgSrc, (value) => {
  3077. if (!value && draggableImg) {
  3078. draggableImg.remove();
  3079. draggableImg = null;
  3080. }
  3081. });
  3082. }
  3083. function fixNumber(num) {
  3084. return num;
  3085. }
  3086. function useImageSize(rootRef, props2, state) {
  3087. const fixSize = () => {
  3088. const {
  3089. mode: mode2
  3090. } = props2;
  3091. const names = FIX_MODES[mode2];
  3092. if (!names) {
  3093. return;
  3094. }
  3095. const {
  3096. origWidth,
  3097. origHeight
  3098. } = state;
  3099. const ratio = origWidth && origHeight ? origWidth / origHeight : 0;
  3100. if (!ratio) {
  3101. return;
  3102. }
  3103. const rootEl = rootRef.value;
  3104. const value = rootEl[names[0]];
  3105. if (value) {
  3106. rootEl.style[names[1]] = fixNumber(names[2](value, ratio)) + "px";
  3107. }
  3108. };
  3109. const resetSize = () => {
  3110. const {
  3111. style
  3112. } = rootRef.value;
  3113. const {
  3114. origStyle: {
  3115. width,
  3116. height
  3117. }
  3118. } = state;
  3119. style.width = width;
  3120. style.height = height;
  3121. };
  3122. vue.watch(() => props2.mode, (value, oldValue) => {
  3123. if (FIX_MODES[oldValue]) {
  3124. resetSize();
  3125. }
  3126. if (FIX_MODES[value]) {
  3127. fixSize();
  3128. }
  3129. });
  3130. return {
  3131. fixSize,
  3132. resetSize
  3133. };
  3134. }
  3135. function throttle(fn, wait) {
  3136. let last = 0;
  3137. let timeout;
  3138. let waitCallback;
  3139. const newFn = function(...arg) {
  3140. const now = Date.now();
  3141. clearTimeout(timeout);
  3142. waitCallback = () => {
  3143. waitCallback = null;
  3144. last = now;
  3145. fn.apply(this, arg);
  3146. };
  3147. if (now - last < wait) {
  3148. timeout = setTimeout(waitCallback, wait - (now - last));
  3149. return;
  3150. }
  3151. waitCallback();
  3152. };
  3153. newFn.cancel = function() {
  3154. clearTimeout(timeout);
  3155. waitCallback = null;
  3156. };
  3157. newFn.flush = function() {
  3158. clearTimeout(timeout);
  3159. waitCallback && waitCallback();
  3160. };
  3161. return newFn;
  3162. }
  3163. function useUserAction() {
  3164. const state = vue.reactive({
  3165. /**
  3166. * 是否用户激活
  3167. */
  3168. userAction: false
  3169. });
  3170. return {
  3171. state
  3172. };
  3173. }
  3174. function useScopedAttrs() {
  3175. const state = vue.reactive({
  3176. attrs: {}
  3177. });
  3178. return {
  3179. state
  3180. };
  3181. }
  3182. function useFormField(nameKey, value) {
  3183. const uniForm = vue.inject(
  3184. uniFormKey,
  3185. false
  3186. // remove warning
  3187. );
  3188. if (!uniForm) {
  3189. return;
  3190. }
  3191. const instance = vue.getCurrentInstance();
  3192. const ctx = {
  3193. submit() {
  3194. const proxy = instance.proxy;
  3195. return [
  3196. proxy[nameKey],
  3197. shared.isString(value) ? proxy[value] : value.value
  3198. ];
  3199. },
  3200. reset() {
  3201. if (shared.isString(value)) {
  3202. instance.proxy[value] = "";
  3203. } else {
  3204. value.value = "";
  3205. }
  3206. }
  3207. };
  3208. uniForm.addField(ctx);
  3209. }
  3210. function getSelectedTextRange(_, resolve) {
  3211. const activeElement = document.activeElement;
  3212. if (!activeElement) {
  3213. return resolve({});
  3214. }
  3215. const data = {};
  3216. if (["input", "textarea"].includes(activeElement.tagName.toLowerCase())) {
  3217. data.start = activeElement.selectionStart;
  3218. data.end = activeElement.selectionEnd;
  3219. }
  3220. resolve(data);
  3221. }
  3222. const UniViewJSBridgeSubscribe = function() {
  3223. registerViewMethod(
  3224. getCurrentPageId(),
  3225. "getSelectedTextRange",
  3226. getSelectedTextRange
  3227. );
  3228. };
  3229. function getValueString(value, type, maxlength) {
  3230. if (type === "number" && isNaN(Number(value))) {
  3231. value = "";
  3232. }
  3233. const valueStr = value === null || value === void 0 ? "" : String(value);
  3234. if (maxlength == void 0) {
  3235. return valueStr;
  3236. }
  3237. return valueStr.slice(0, maxlength);
  3238. }
  3239. const INPUT_MODES = [
  3240. "none",
  3241. "text",
  3242. "decimal",
  3243. "numeric",
  3244. "tel",
  3245. "search",
  3246. "email",
  3247. "url"
  3248. ];
  3249. const props$l = /* @__PURE__ */ shared.extend(
  3250. {},
  3251. {
  3252. name: {
  3253. type: String,
  3254. default: ""
  3255. },
  3256. modelValue: {
  3257. type: [String, Number]
  3258. },
  3259. value: {
  3260. type: [String, Number]
  3261. },
  3262. disabled: {
  3263. type: [Boolean, String],
  3264. default: false
  3265. },
  3266. /**
  3267. * 已废弃属性,用于历史兼容
  3268. */
  3269. autoFocus: {
  3270. type: [Boolean, String],
  3271. default: false
  3272. },
  3273. focus: {
  3274. type: [Boolean, String],
  3275. default: false
  3276. },
  3277. cursor: {
  3278. type: [Number, String],
  3279. default: -1
  3280. },
  3281. selectionStart: {
  3282. type: [Number, String],
  3283. default: -1
  3284. },
  3285. selectionEnd: {
  3286. type: [Number, String],
  3287. default: -1
  3288. },
  3289. type: {
  3290. type: String,
  3291. default: "text"
  3292. },
  3293. password: {
  3294. type: [Boolean, String],
  3295. default: false
  3296. },
  3297. placeholder: {
  3298. type: String,
  3299. default: ""
  3300. },
  3301. placeholderStyle: {
  3302. type: String,
  3303. default: ""
  3304. },
  3305. placeholderClass: {
  3306. type: String,
  3307. default: ""
  3308. },
  3309. maxlength: {
  3310. type: [Number, String],
  3311. default: Infinity
  3312. },
  3313. confirmType: {
  3314. type: String,
  3315. default: "done"
  3316. },
  3317. confirmHold: {
  3318. type: Boolean,
  3319. default: false
  3320. },
  3321. ignoreCompositionEvent: {
  3322. type: Boolean,
  3323. default: true
  3324. },
  3325. step: {
  3326. type: String,
  3327. default: "0.000000000000000001"
  3328. },
  3329. inputmode: {
  3330. type: String,
  3331. default: void 0,
  3332. validator: (value) => !!~INPUT_MODES.indexOf(value)
  3333. },
  3334. cursorColor: {
  3335. type: String,
  3336. default: ""
  3337. }
  3338. },
  3339. props$o
  3340. );
  3341. const emit = [
  3342. "input",
  3343. "focus",
  3344. "blur",
  3345. "update:value",
  3346. "update:modelValue",
  3347. "update:focus",
  3348. "compositionstart",
  3349. "compositionupdate",
  3350. "compositionend",
  3351. ...emit$1
  3352. ];
  3353. function useBase(props2, rootRef, emit2) {
  3354. const fieldRef = vue.ref(null);
  3355. const trigger = useCustomEvent(rootRef, emit2);
  3356. const selectionStart = vue.computed(() => {
  3357. const selectionStart2 = Number(props2.selectionStart);
  3358. return isNaN(selectionStart2) ? -1 : selectionStart2;
  3359. });
  3360. const selectionEnd = vue.computed(() => {
  3361. const selectionEnd2 = Number(props2.selectionEnd);
  3362. return isNaN(selectionEnd2) ? -1 : selectionEnd2;
  3363. });
  3364. const cursor = vue.computed(() => {
  3365. const cursor2 = Number(props2.cursor);
  3366. return isNaN(cursor2) ? -1 : cursor2;
  3367. });
  3368. const maxlength = vue.computed(() => {
  3369. var maxlength2 = Number(props2.maxlength);
  3370. {
  3371. return isNaN(maxlength2) || maxlength2 < 0 ? Infinity : Math.floor(maxlength2);
  3372. }
  3373. });
  3374. let value = "";
  3375. {
  3376. const modelValueString = getValueString(
  3377. props2.modelValue,
  3378. props2.type,
  3379. maxlength.value
  3380. );
  3381. const valueString = getValueString(props2.value, props2.type, maxlength.value);
  3382. value = props2.modelValue !== void 0 ? modelValueString !== null && modelValueString !== void 0 ? modelValueString : valueString : valueString;
  3383. }
  3384. const state = vue.reactive({
  3385. value,
  3386. valueOrigin: value,
  3387. maxlength,
  3388. focus: props2.focus,
  3389. composing: false,
  3390. selectionStart,
  3391. selectionEnd,
  3392. cursor
  3393. });
  3394. vue.watch(
  3395. () => state.focus,
  3396. (val) => emit2("update:focus", val)
  3397. );
  3398. vue.watch(
  3399. () => state.maxlength,
  3400. (val) => state.value = state.value.slice(0, val),
  3401. {
  3402. immediate: true
  3403. }
  3404. );
  3405. return {
  3406. fieldRef,
  3407. state,
  3408. trigger
  3409. };
  3410. }
  3411. function useValueSync(props2, state, emit2, trigger) {
  3412. let valueChangeFn = null;
  3413. {
  3414. valueChangeFn = throttle((val) => {
  3415. state.value = getValueString(val, props2.type, state.maxlength);
  3416. }, 100);
  3417. }
  3418. vue.watch(() => props2.modelValue, valueChangeFn);
  3419. vue.watch(() => props2.value, valueChangeFn);
  3420. const triggerInputFn = throttle((event, detail) => {
  3421. valueChangeFn.cancel();
  3422. emit2("update:modelValue", detail.value);
  3423. emit2("update:value", detail.value);
  3424. trigger("input", event, detail);
  3425. }, 100);
  3426. const triggerInput = (event, detail, force) => {
  3427. valueChangeFn.cancel();
  3428. triggerInputFn(event, detail);
  3429. if (force) {
  3430. triggerInputFn.flush();
  3431. }
  3432. };
  3433. return {
  3434. trigger,
  3435. triggerInput
  3436. };
  3437. }
  3438. function useAutoFocus(props2, fieldRef) {
  3439. useUserAction();
  3440. const needFocus = vue.computed(() => props2.autoFocus || props2.focus);
  3441. function focus() {
  3442. if (!needFocus.value) {
  3443. return;
  3444. }
  3445. const field = fieldRef.value;
  3446. if (!field || false) {
  3447. setTimeout(focus, 100);
  3448. return;
  3449. }
  3450. {
  3451. field.focus();
  3452. }
  3453. }
  3454. function blur() {
  3455. const field = fieldRef.value;
  3456. if (field) {
  3457. field.blur();
  3458. }
  3459. }
  3460. vue.watch(
  3461. () => props2.focus,
  3462. (value) => {
  3463. if (value) {
  3464. focus();
  3465. } else {
  3466. blur();
  3467. }
  3468. }
  3469. );
  3470. }
  3471. function useEvent(fieldRef, state, props2, trigger, triggerInput, beforeInput) {
  3472. function checkSelection() {
  3473. const field = fieldRef.value;
  3474. if (field && state.focus && state.selectionStart > -1 && state.selectionEnd > -1 && field.type !== "number") {
  3475. field.selectionStart = state.selectionStart;
  3476. field.selectionEnd = state.selectionEnd;
  3477. }
  3478. }
  3479. function checkCursor() {
  3480. const field = fieldRef.value;
  3481. if (field && state.focus && state.selectionStart < 0 && state.selectionEnd < 0 && state.cursor > -1 && field.type !== "number") {
  3482. field.selectionEnd = field.selectionStart = state.cursor;
  3483. }
  3484. }
  3485. function getFieldSelectionEnd(field) {
  3486. if (field.type === "number") {
  3487. return null;
  3488. } else {
  3489. return field.selectionEnd;
  3490. }
  3491. }
  3492. function initField() {
  3493. const field = fieldRef.value;
  3494. if (!field)
  3495. return;
  3496. const onFocus = function(event) {
  3497. state.focus = true;
  3498. trigger("focus", event, {
  3499. value: state.value
  3500. });
  3501. checkSelection();
  3502. checkCursor();
  3503. };
  3504. const onInput = function(event, force) {
  3505. event.stopPropagation();
  3506. if (shared.isFunction(beforeInput) && beforeInput(event, state) === false) {
  3507. return;
  3508. }
  3509. state.value = field.value;
  3510. if (!state.composing || !props2.ignoreCompositionEvent) {
  3511. triggerInput(
  3512. event,
  3513. {
  3514. value: field.value,
  3515. cursor: getFieldSelectionEnd(field)
  3516. },
  3517. force
  3518. );
  3519. }
  3520. };
  3521. const onBlur = function(event) {
  3522. if (state.composing) {
  3523. state.composing = false;
  3524. onInput(event, true);
  3525. }
  3526. state.focus = false;
  3527. trigger("blur", event, {
  3528. value: state.value,
  3529. cursor: getFieldSelectionEnd(event.target)
  3530. });
  3531. };
  3532. field.addEventListener("change", (event) => event.stopPropagation());
  3533. field.addEventListener("focus", onFocus);
  3534. field.addEventListener("blur", onBlur);
  3535. field.addEventListener("input", onInput);
  3536. field.addEventListener("compositionstart", (event) => {
  3537. event.stopPropagation();
  3538. state.composing = true;
  3539. _onComposition(event);
  3540. });
  3541. field.addEventListener("compositionend", (event) => {
  3542. event.stopPropagation();
  3543. if (state.composing) {
  3544. state.composing = false;
  3545. onInput(event);
  3546. }
  3547. _onComposition(event);
  3548. });
  3549. field.addEventListener("compositionupdate", _onComposition);
  3550. function _onComposition(event) {
  3551. if (!props2.ignoreCompositionEvent) {
  3552. trigger(event.type, event, {
  3553. value: event.data
  3554. });
  3555. }
  3556. }
  3557. }
  3558. vue.watch([() => state.selectionStart, () => state.selectionEnd], checkSelection);
  3559. vue.watch(() => state.cursor, checkCursor);
  3560. vue.watch(() => fieldRef.value, initField);
  3561. }
  3562. function useField(props2, rootRef, emit2, beforeInput) {
  3563. UniViewJSBridgeSubscribe();
  3564. const { fieldRef, state, trigger } = useBase(props2, rootRef, emit2);
  3565. const { triggerInput } = useValueSync(props2, state, emit2, trigger);
  3566. useAutoFocus(props2, fieldRef);
  3567. useKeyboard$1(props2, fieldRef);
  3568. const { state: scopedAttrsState } = useScopedAttrs();
  3569. useFormField("name", state);
  3570. useEvent(fieldRef, state, props2, trigger, triggerInput, beforeInput);
  3571. const fixDisabledColor = false;
  3572. return {
  3573. fieldRef,
  3574. state,
  3575. scopedAttrsState,
  3576. fixDisabledColor,
  3577. trigger
  3578. };
  3579. }
  3580. const props$k = /* @__PURE__ */ shared.extend({}, props$l, {
  3581. placeholderClass: {
  3582. type: String,
  3583. default: "input-placeholder"
  3584. },
  3585. textContentType: {
  3586. type: String,
  3587. default: ""
  3588. }
  3589. });
  3590. function resolveDigitDecimalPoint(event, cache, state, input, resetCache) {
  3591. if (cache.value) {
  3592. if (event.data === ".") {
  3593. if (cache.value.slice(-1) === ".") {
  3594. state.value = input.value = cache.value = cache.value.slice(0, -1);
  3595. return false;
  3596. }
  3597. if (cache.value && !cache.value.includes(".")) {
  3598. cache.value += ".";
  3599. if (resetCache) {
  3600. resetCache.fn = () => {
  3601. state.value = input.value = cache.value = cache.value.slice(0, -1);
  3602. input.removeEventListener("blur", resetCache.fn);
  3603. };
  3604. input.addEventListener("blur", resetCache.fn);
  3605. }
  3606. return false;
  3607. }
  3608. } else if (event.inputType === "deleteContentBackward") {
  3609. if (navigator.userAgent.includes("iPhone OS 16")) {
  3610. if (cache.value.slice(-2, -1) === ".") {
  3611. cache.value = state.value = input.value = cache.value.slice(0, -2);
  3612. return true;
  3613. }
  3614. }
  3615. }
  3616. }
  3617. }
  3618. function useCache(props2, type) {
  3619. if (type.value === "number") {
  3620. const value = typeof props2.modelValue === "undefined" ? props2.value : props2.modelValue;
  3621. const cache = vue.ref(typeof value !== "undefined" && value !== null ? value.toLocaleString() : "");
  3622. vue.watch(() => props2.modelValue, (value2) => {
  3623. cache.value = typeof value2 !== "undefined" && value2 !== null ? value2.toLocaleString() : "";
  3624. });
  3625. vue.watch(() => props2.value, (value2) => {
  3626. cache.value = typeof value2 !== "undefined" && value2 !== null ? value2.toLocaleString() : "";
  3627. });
  3628. return cache;
  3629. } else {
  3630. return vue.ref("");
  3631. }
  3632. }
  3633. const Input = /* @__PURE__ */ defineBuiltInComponent({
  3634. name: "Input",
  3635. props: props$k,
  3636. emits: ["confirm", ...emit],
  3637. setup(props2, {
  3638. emit: emit2,
  3639. expose
  3640. }) {
  3641. const INPUT_TYPES = ["text", "number", "idcard", "digit", "password", "tel"];
  3642. const AUTOCOMPLETES = ["off", "one-time-code"];
  3643. const type = vue.computed(() => {
  3644. let type2 = "";
  3645. switch (props2.type) {
  3646. case "text":
  3647. type2 = "text";
  3648. if (props2.confirmType === "search") {
  3649. type2 = "search";
  3650. }
  3651. break;
  3652. case "idcard":
  3653. type2 = "text";
  3654. break;
  3655. case "digit":
  3656. type2 = "number";
  3657. break;
  3658. default:
  3659. type2 = ~INPUT_TYPES.includes(props2.type) ? props2.type : "text";
  3660. break;
  3661. }
  3662. return props2.password ? "password" : type2;
  3663. });
  3664. const autocomplete = vue.computed(() => {
  3665. const camelizeIndex = AUTOCOMPLETES.indexOf(props2.textContentType);
  3666. const kebabCaseIndex = AUTOCOMPLETES.indexOf(shared.hyphenate(props2.textContentType));
  3667. const index2 = camelizeIndex !== -1 ? camelizeIndex : kebabCaseIndex !== -1 ? kebabCaseIndex : 0;
  3668. return AUTOCOMPLETES[index2];
  3669. });
  3670. let cache = useCache(props2, type);
  3671. let resetCache = {
  3672. fn: null
  3673. };
  3674. const rootRef = vue.ref(null);
  3675. const {
  3676. fieldRef,
  3677. state,
  3678. scopedAttrsState,
  3679. fixDisabledColor,
  3680. trigger
  3681. } = useField(props2, rootRef, emit2, (event, state2) => {
  3682. const input = event.target;
  3683. if (type.value === "number") {
  3684. if (resetCache.fn) {
  3685. input.removeEventListener("blur", resetCache.fn);
  3686. resetCache.fn = null;
  3687. }
  3688. if (input.validity && !input.validity.valid) {
  3689. if ((!cache.value || !input.value) && event.data === "-" || cache.value[0] === "-" && event.inputType === "deleteContentBackward") {
  3690. cache.value = "-";
  3691. state2.value = "";
  3692. resetCache.fn = () => {
  3693. cache.value = input.value = "";
  3694. };
  3695. input.addEventListener("blur", resetCache.fn);
  3696. return false;
  3697. }
  3698. const res = resolveDigitDecimalPoint(event, cache, state2, input, resetCache);
  3699. if (typeof res === "boolean")
  3700. return res;
  3701. cache.value = state2.value = input.value = cache.value === "-" ? "" : cache.value;
  3702. return false;
  3703. } else {
  3704. const res = resolveDigitDecimalPoint(event, cache, state2, input, resetCache);
  3705. if (typeof res === "boolean")
  3706. return res;
  3707. cache.value = input.value;
  3708. }
  3709. const maxlength = state2.maxlength;
  3710. if (maxlength > 0 && input.value.length > maxlength) {
  3711. input.value = input.value.slice(0, maxlength);
  3712. state2.value = input.value;
  3713. return false;
  3714. }
  3715. }
  3716. });
  3717. vue.watch(() => state.value, (value) => {
  3718. if (props2.type === "number" && !(cache.value === "-" && value === "")) {
  3719. cache.value = value.toString();
  3720. }
  3721. });
  3722. const NUMBER_TYPES = ["number", "digit"];
  3723. const step = vue.computed(() => NUMBER_TYPES.includes(props2.type) ? props2.step : "");
  3724. function onKeyUpEnter(event) {
  3725. if (event.key !== "Enter") {
  3726. return;
  3727. }
  3728. const input = event.target;
  3729. event.stopPropagation();
  3730. trigger("confirm", event, {
  3731. value: input.value
  3732. });
  3733. !props2.confirmHold && input.blur();
  3734. }
  3735. expose({
  3736. $triggerInput: (detail) => {
  3737. emit2("update:modelValue", detail.value);
  3738. emit2("update:value", detail.value);
  3739. state.value = detail.value;
  3740. }
  3741. });
  3742. return () => {
  3743. let inputNode = props2.disabled && fixDisabledColor ? vue.createVNode("input", {
  3744. "key": "disabled-input",
  3745. "ref": fieldRef,
  3746. "value": state.value,
  3747. "tabindex": "-1",
  3748. "readonly": !!props2.disabled,
  3749. "type": type.value,
  3750. "maxlength": state.maxlength,
  3751. "step": step.value,
  3752. "class": "uni-input-input",
  3753. "style": props2.cursorColor ? {
  3754. caretColor: props2.cursorColor
  3755. } : {},
  3756. "onFocus": (event) => event.target.blur()
  3757. }, null, 44, ["value", "readonly", "type", "maxlength", "step", "onFocus"]) : vue.createVNode("input", {
  3758. "key": "input",
  3759. "ref": fieldRef,
  3760. "value": state.value,
  3761. "onInput": (event) => {
  3762. state.value = event.target.value.toString();
  3763. },
  3764. "disabled": !!props2.disabled,
  3765. "type": type.value,
  3766. "maxlength": state.maxlength,
  3767. "step": step.value,
  3768. "enterkeyhint": props2.confirmType,
  3769. "pattern": props2.type === "number" ? "[0-9]*" : void 0,
  3770. "class": "uni-input-input",
  3771. "style": props2.cursorColor ? {
  3772. caretColor: props2.cursorColor
  3773. } : {},
  3774. "autocomplete": autocomplete.value,
  3775. "onKeyup": onKeyUpEnter,
  3776. "inputmode": props2.inputmode
  3777. }, null, 44, ["value", "onInput", "disabled", "type", "maxlength", "step", "enterkeyhint", "pattern", "autocomplete", "onKeyup", "inputmode"]);
  3778. return vue.createVNode("uni-input", {
  3779. "ref": rootRef
  3780. }, [vue.createVNode("div", {
  3781. "class": "uni-input-wrapper"
  3782. }, [vue.withDirectives(vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  3783. "style": props2.placeholderStyle,
  3784. "class": ["uni-input-placeholder", props2.placeholderClass]
  3785. }), [props2.placeholder], 16), [[vue.vShow, !(state.value.length || cache.value === "-" || cache.value.includes("."))]]), props2.confirmType === "search" ? vue.createVNode("form", {
  3786. "action": "",
  3787. "onSubmit": (event) => event.preventDefault(),
  3788. "class": "uni-input-form"
  3789. }, [inputNode], 40, ["onSubmit"]) : inputNode])], 512);
  3790. };
  3791. }
  3792. });
  3793. function entries(obj) {
  3794. return Object.keys(obj).map((key) => [key, obj[key]]);
  3795. }
  3796. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  3797. const LISTENER_PREFIX = /^on[A-Z]+/;
  3798. const useAttrs = (params = {}) => {
  3799. const { excludeListeners = false, excludeKeys = [] } = params;
  3800. const instance = vue.getCurrentInstance();
  3801. const attrs = vue.shallowRef({});
  3802. const listeners = vue.shallowRef({});
  3803. const excludeAttrs = vue.shallowRef({});
  3804. const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
  3805. instance.attrs = vue.reactive(instance.attrs);
  3806. vue.watchEffect(() => {
  3807. const res = entries(instance.attrs).reduce(
  3808. (acc, [key, val]) => {
  3809. if (allExcludeKeys.includes(key)) {
  3810. acc.exclude[key] = val;
  3811. } else if (LISTENER_PREFIX.test(key)) {
  3812. if (!excludeListeners) {
  3813. acc.attrs[key] = val;
  3814. }
  3815. acc.listeners[key] = val;
  3816. } else {
  3817. acc.attrs[key] = val;
  3818. }
  3819. return acc;
  3820. },
  3821. {
  3822. exclude: {},
  3823. attrs: {},
  3824. listeners: {}
  3825. }
  3826. );
  3827. attrs.value = res.attrs;
  3828. listeners.value = res.listeners;
  3829. excludeAttrs.value = res.exclude;
  3830. });
  3831. return { $attrs: attrs, $listeners: listeners, $excludeAttrs: excludeAttrs };
  3832. };
  3833. function flatVNode(nodes) {
  3834. const array = [];
  3835. if (shared.isArray(nodes)) {
  3836. nodes.forEach((vnode) => {
  3837. if (vue.isVNode(vnode)) {
  3838. if (vnode.type === vue.Fragment) {
  3839. array.push(...flatVNode(vnode.children));
  3840. } else {
  3841. array.push(vnode);
  3842. }
  3843. } else if (shared.isArray(vnode)) {
  3844. array.push(...flatVNode(vnode));
  3845. }
  3846. });
  3847. }
  3848. return array;
  3849. }
  3850. const movableAreaProps = {
  3851. scaleArea: {
  3852. type: Boolean,
  3853. default: false
  3854. }
  3855. };
  3856. const index$t = /* @__PURE__ */ defineBuiltInComponent({
  3857. inheritAttrs: false,
  3858. name: "MovableArea",
  3859. props: movableAreaProps,
  3860. setup(props2, {
  3861. slots
  3862. }) {
  3863. const rootRef = vue.ref(null);
  3864. const _isMounted = vue.ref(false);
  3865. let {
  3866. setContexts,
  3867. events: movableAreaEvents
  3868. } = useMovableAreaState(props2, rootRef);
  3869. const {
  3870. $listeners,
  3871. $attrs,
  3872. $excludeAttrs
  3873. } = useAttrs();
  3874. const _listeners = $listeners.value;
  3875. let events = ["onTouchstart", "onTouchmove", "onTouchend"];
  3876. events.forEach((event) => {
  3877. let existing = _listeners[event];
  3878. let ours = movableAreaEvents[`_${event}`];
  3879. _listeners[event] = existing ? [].concat(existing, ours) : ours;
  3880. });
  3881. let movableViewItems = [];
  3882. const originMovableViewContexts = [];
  3883. function updateMovableViewContexts() {
  3884. const contexts = [];
  3885. for (let index2 = 0; index2 < movableViewItems.length; index2++) {
  3886. let movableViewItem = movableViewItems[index2];
  3887. {
  3888. movableViewItem = movableViewItem.el;
  3889. }
  3890. const movableViewContext = originMovableViewContexts.find((context) => movableViewItem === context.rootRef.value);
  3891. if (movableViewContext) {
  3892. contexts.push(vue.markRaw(movableViewContext));
  3893. }
  3894. }
  3895. setContexts(contexts);
  3896. }
  3897. const addMovableViewContext = (movableViewContext) => {
  3898. originMovableViewContexts.push(movableViewContext);
  3899. updateMovableViewContexts();
  3900. };
  3901. const removeMovableViewContext = (movableViewContext) => {
  3902. const index2 = originMovableViewContexts.indexOf(movableViewContext);
  3903. if (index2 >= 0) {
  3904. originMovableViewContexts.splice(index2, 1);
  3905. updateMovableViewContexts();
  3906. }
  3907. };
  3908. vue.provide("_isMounted", _isMounted);
  3909. vue.provide("movableAreaRootRef", rootRef);
  3910. vue.provide("addMovableViewContext", addMovableViewContext);
  3911. vue.provide("removeMovableViewContext", removeMovableViewContext);
  3912. return () => {
  3913. const defaultSlots = slots.default && slots.default();
  3914. {
  3915. movableViewItems = flatVNode(defaultSlots);
  3916. }
  3917. return vue.createVNode("uni-movable-area", vue.mergeProps({
  3918. "ref": rootRef
  3919. }, $attrs.value, $excludeAttrs.value, _listeners), [vue.createVNode(ResizeSensor, {
  3920. "onResize": movableAreaEvents._resize
  3921. }, null, 8, ["onResize"]), movableViewItems], 16);
  3922. };
  3923. }
  3924. });
  3925. function calc(e2) {
  3926. return Math.sqrt(e2.x * e2.x + e2.y * e2.y);
  3927. }
  3928. function useMovableAreaState(props2, rootRef) {
  3929. const width = vue.ref(0);
  3930. const height = vue.ref(0);
  3931. const gapV = vue.reactive({
  3932. x: null,
  3933. y: null
  3934. });
  3935. const pinchStartLen = vue.ref(null);
  3936. let _scaleMovableView = null;
  3937. let movableViewContexts = [];
  3938. function _updateScale(e2) {
  3939. if (e2 && e2 !== 1) {
  3940. if (props2.scaleArea) {
  3941. movableViewContexts.forEach(function(item) {
  3942. item._setScale(e2);
  3943. });
  3944. } else {
  3945. if (_scaleMovableView) {
  3946. _scaleMovableView._setScale(e2);
  3947. }
  3948. }
  3949. }
  3950. }
  3951. function _find(target, items = movableViewContexts) {
  3952. let root = rootRef.value;
  3953. function get(node) {
  3954. for (let i = 0; i < items.length; i++) {
  3955. const item = items[i];
  3956. if (node === item.rootRef.value) {
  3957. return item;
  3958. }
  3959. }
  3960. if (node === root || node === document.body || node === document) {
  3961. return null;
  3962. }
  3963. return get(node.parentNode);
  3964. }
  3965. return get(target);
  3966. }
  3967. const _onTouchstart = withWebEvent((t2) => {
  3968. let i = t2.touches;
  3969. if (i) {
  3970. if (i.length > 1) {
  3971. let r = {
  3972. x: i[1].pageX - i[0].pageX,
  3973. y: i[1].pageY - i[0].pageY
  3974. };
  3975. pinchStartLen.value = calc(r);
  3976. gapV.x = r.x;
  3977. gapV.y = r.y;
  3978. if (!props2.scaleArea) {
  3979. let touch0 = _find(i[0].target);
  3980. let touch1 = _find(i[1].target);
  3981. _scaleMovableView = touch0 && touch0 === touch1 ? touch0 : null;
  3982. }
  3983. }
  3984. }
  3985. });
  3986. const _onTouchmove = withWebEvent((t2) => {
  3987. let n = t2.touches;
  3988. if (n) {
  3989. if (n.length > 1) {
  3990. t2.preventDefault();
  3991. let i = {
  3992. x: n[1].pageX - n[0].pageX,
  3993. y: n[1].pageY - n[0].pageY
  3994. };
  3995. if (gapV.x !== null && pinchStartLen.value && pinchStartLen.value > 0) {
  3996. let r = calc(i) / pinchStartLen.value;
  3997. _updateScale(r);
  3998. }
  3999. gapV.x = i.x;
  4000. gapV.y = i.y;
  4001. }
  4002. }
  4003. });
  4004. const _onTouchend = withWebEvent((e2) => {
  4005. let t2 = e2.touches;
  4006. if (!(t2 && t2.length)) {
  4007. if (e2.changedTouches) {
  4008. gapV.x = 0;
  4009. gapV.y = 0;
  4010. pinchStartLen.value = null;
  4011. if (props2.scaleArea) {
  4012. movableViewContexts.forEach(function(item) {
  4013. item._endScale();
  4014. });
  4015. } else {
  4016. if (_scaleMovableView) {
  4017. _scaleMovableView._endScale();
  4018. }
  4019. }
  4020. }
  4021. }
  4022. });
  4023. function _resize() {
  4024. _getWH();
  4025. movableViewContexts.forEach(function(item, index2) {
  4026. item.setParent();
  4027. });
  4028. }
  4029. function _getWH() {
  4030. let style = window.getComputedStyle(rootRef.value);
  4031. let rect = rootRef.value.getBoundingClientRect();
  4032. width.value = rect.width - ["Left", "Right"].reduce(function(all, item) {
  4033. const LEFT = "border" + item + "Width";
  4034. const RIGHT = "padding" + item;
  4035. return all + parseFloat(style[LEFT]) + parseFloat(style[RIGHT]);
  4036. }, 0);
  4037. height.value = rect.height - ["Top", "Bottom"].reduce(function(all, item) {
  4038. const TOP = "border" + item + "Width";
  4039. const BOTTOM = "padding" + item;
  4040. return all + parseFloat(style[TOP]) + parseFloat(style[BOTTOM]);
  4041. }, 0);
  4042. }
  4043. vue.provide("movableAreaWidth", width);
  4044. vue.provide("movableAreaHeight", height);
  4045. return {
  4046. setContexts(contexts) {
  4047. movableViewContexts = contexts;
  4048. },
  4049. events: {
  4050. _onTouchstart,
  4051. _onTouchmove,
  4052. _onTouchend,
  4053. _resize
  4054. }
  4055. };
  4056. }
  4057. function e(e2, t2, n) {
  4058. return e2 > t2 - n && e2 < t2 + n;
  4059. }
  4060. function t(t2, n) {
  4061. return e(t2, 0, n);
  4062. }
  4063. function Friction(e2, t2) {
  4064. this._m = e2;
  4065. this._f = 1e3 * t2;
  4066. this._startTime = 0;
  4067. this._v = 0;
  4068. }
  4069. Friction.prototype.setV = function(x, y) {
  4070. const n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5);
  4071. this._x_v = x;
  4072. this._y_v = y;
  4073. this._x_a = -this._f * this._x_v / n;
  4074. this._y_a = -this._f * this._y_v / n;
  4075. this._t = Math.abs(x / this._x_a) || Math.abs(y / this._y_a);
  4076. this._lastDt = null;
  4077. this._startTime = (/* @__PURE__ */ new Date()).getTime();
  4078. };
  4079. Friction.prototype.setS = function(x, y) {
  4080. this._x_s = x;
  4081. this._y_s = y;
  4082. };
  4083. Friction.prototype.s = function(t2) {
  4084. if (void 0 === t2) {
  4085. t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4086. }
  4087. if (t2 > this._t) {
  4088. t2 = this._t;
  4089. this._lastDt = t2;
  4090. }
  4091. let x = this._x_v * t2 + 0.5 * this._x_a * Math.pow(t2, 2) + this._x_s;
  4092. let y = this._y_v * t2 + 0.5 * this._y_a * Math.pow(t2, 2) + this._y_s;
  4093. if (this._x_a > 0 && x < this._endPositionX || this._x_a < 0 && x > this._endPositionX) {
  4094. x = this._endPositionX;
  4095. }
  4096. if (this._y_a > 0 && y < this._endPositionY || this._y_a < 0 && y > this._endPositionY) {
  4097. y = this._endPositionY;
  4098. }
  4099. return {
  4100. x,
  4101. y
  4102. };
  4103. };
  4104. Friction.prototype.ds = function(t2) {
  4105. if (void 0 === t2) {
  4106. t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4107. }
  4108. if (t2 > this._t) {
  4109. t2 = this._t;
  4110. }
  4111. return {
  4112. dx: this._x_v + this._x_a * t2,
  4113. dy: this._y_v + this._y_a * t2
  4114. };
  4115. };
  4116. Friction.prototype.delta = function() {
  4117. return {
  4118. x: -1.5 * Math.pow(this._x_v, 2) / this._x_a || 0,
  4119. y: -1.5 * Math.pow(this._y_v, 2) / this._y_a || 0
  4120. };
  4121. };
  4122. Friction.prototype.dt = function() {
  4123. return -this._x_v / this._x_a;
  4124. };
  4125. Friction.prototype.done = function() {
  4126. const t2 = e(this.s().x, this._endPositionX) || e(this.s().y, this._endPositionY) || this._lastDt === this._t;
  4127. this._lastDt = null;
  4128. return t2;
  4129. };
  4130. Friction.prototype.setEnd = function(x, y) {
  4131. this._endPositionX = x;
  4132. this._endPositionY = y;
  4133. };
  4134. Friction.prototype.reconfigure = function(m, f2) {
  4135. this._m = m;
  4136. this._f = 1e3 * f2;
  4137. };
  4138. function Spring(m, k, c) {
  4139. this._m = m;
  4140. this._k = k;
  4141. this._c = c;
  4142. this._solution = null;
  4143. this._endPosition = 0;
  4144. this._startTime = 0;
  4145. }
  4146. Spring.prototype._solve = function(e2, t2) {
  4147. const n = this._c;
  4148. const i = this._m;
  4149. const r = this._k;
  4150. const o = n * n - 4 * i * r;
  4151. if (o === 0) {
  4152. const a = -n / (2 * i);
  4153. const s = e2;
  4154. const l = t2 / (a * e2);
  4155. return {
  4156. x: function(e3) {
  4157. return (s + l * e3) * Math.pow(Math.E, a * e3);
  4158. },
  4159. dx: function(e3) {
  4160. const t3 = Math.pow(Math.E, a * e3);
  4161. return a * (s + l * e3) * t3 + l * t3;
  4162. }
  4163. };
  4164. }
  4165. if (o > 0) {
  4166. const c = (-n - Math.sqrt(o)) / (2 * i);
  4167. const u = (-n + Math.sqrt(o)) / (2 * i);
  4168. const d = (t2 - c * e2) / (u - c);
  4169. const h = e2 - d;
  4170. return {
  4171. x: function(e3) {
  4172. let t3;
  4173. let n2;
  4174. if (e3 === this._t) {
  4175. t3 = this._powER1T;
  4176. n2 = this._powER2T;
  4177. }
  4178. this._t = e3;
  4179. if (!t3) {
  4180. t3 = this._powER1T = Math.pow(Math.E, c * e3);
  4181. }
  4182. if (!n2) {
  4183. n2 = this._powER2T = Math.pow(Math.E, u * e3);
  4184. }
  4185. return h * t3 + d * n2;
  4186. },
  4187. dx: function(e3) {
  4188. let t3;
  4189. let n2;
  4190. if (e3 === this._t) {
  4191. t3 = this._powER1T;
  4192. n2 = this._powER2T;
  4193. }
  4194. this._t = e3;
  4195. if (!t3) {
  4196. t3 = this._powER1T = Math.pow(Math.E, c * e3);
  4197. }
  4198. if (!n2) {
  4199. n2 = this._powER2T = Math.pow(Math.E, u * e3);
  4200. }
  4201. return h * c * t3 + d * u * n2;
  4202. }
  4203. };
  4204. }
  4205. const p2 = Math.sqrt(4 * i * r - n * n) / (2 * i);
  4206. const f2 = -n / 2 * i;
  4207. const v2 = e2;
  4208. const g2 = (t2 - f2 * e2) / p2;
  4209. return {
  4210. x: function(e3) {
  4211. return Math.pow(Math.E, f2 * e3) * (v2 * Math.cos(p2 * e3) + g2 * Math.sin(p2 * e3));
  4212. },
  4213. dx: function(e3) {
  4214. const t3 = Math.pow(Math.E, f2 * e3);
  4215. const n2 = Math.cos(p2 * e3);
  4216. const i2 = Math.sin(p2 * e3);
  4217. return t3 * (g2 * p2 * n2 - v2 * p2 * i2) + f2 * t3 * (g2 * i2 + v2 * n2);
  4218. }
  4219. };
  4220. };
  4221. Spring.prototype.x = function(e2) {
  4222. if (void 0 === e2) {
  4223. e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4224. }
  4225. return this._solution ? this._endPosition + this._solution.x(e2) : 0;
  4226. };
  4227. Spring.prototype.dx = function(e2) {
  4228. if (void 0 === e2) {
  4229. e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4230. }
  4231. return this._solution ? this._solution.dx(e2) : 0;
  4232. };
  4233. Spring.prototype.setEnd = function(e2, n, i) {
  4234. if (!i) {
  4235. i = (/* @__PURE__ */ new Date()).getTime();
  4236. }
  4237. if (e2 !== this._endPosition || !t(n, 0.1)) {
  4238. n = n || 0;
  4239. let r = this._endPosition;
  4240. if (this._solution) {
  4241. if (t(n, 0.1)) {
  4242. n = this._solution.dx((i - this._startTime) / 1e3);
  4243. }
  4244. r = this._solution.x((i - this._startTime) / 1e3);
  4245. if (t(n, 0.1)) {
  4246. n = 0;
  4247. }
  4248. if (t(r, 0.1)) {
  4249. r = 0;
  4250. }
  4251. r += this._endPosition;
  4252. }
  4253. if (!(this._solution && t(r - e2, 0.1) && t(n, 0.1))) {
  4254. this._endPosition = e2;
  4255. this._solution = this._solve(r - this._endPosition, n);
  4256. this._startTime = i;
  4257. }
  4258. }
  4259. };
  4260. Spring.prototype.snap = function(e2) {
  4261. this._startTime = (/* @__PURE__ */ new Date()).getTime();
  4262. this._endPosition = e2;
  4263. this._solution = {
  4264. x: function() {
  4265. return 0;
  4266. },
  4267. dx: function() {
  4268. return 0;
  4269. }
  4270. };
  4271. };
  4272. Spring.prototype.done = function(n) {
  4273. if (!n) {
  4274. n = (/* @__PURE__ */ new Date()).getTime();
  4275. }
  4276. return e(this.x(), this._endPosition, 0.1) && t(this.dx(), 0.1);
  4277. };
  4278. Spring.prototype.reconfigure = function(m, t2, c) {
  4279. this._m = m;
  4280. this._k = t2;
  4281. this._c = c;
  4282. if (!this.done()) {
  4283. this._solution = this._solve(this.x() - this._endPosition, this.dx());
  4284. this._startTime = (/* @__PURE__ */ new Date()).getTime();
  4285. }
  4286. };
  4287. Spring.prototype.springConstant = function() {
  4288. return this._k;
  4289. };
  4290. Spring.prototype.damping = function() {
  4291. return this._c;
  4292. };
  4293. Spring.prototype.configuration = function() {
  4294. function e2(e3, t3) {
  4295. e3.reconfigure(1, t3, e3.damping());
  4296. }
  4297. function t2(e3, t3) {
  4298. e3.reconfigure(1, e3.springConstant(), t3);
  4299. }
  4300. return [
  4301. {
  4302. label: "Spring Constant",
  4303. read: this.springConstant.bind(this),
  4304. write: e2.bind(this, this),
  4305. min: 100,
  4306. max: 1e3
  4307. },
  4308. {
  4309. label: "Damping",
  4310. read: this.damping.bind(this),
  4311. write: t2.bind(this, this),
  4312. min: 1,
  4313. max: 500
  4314. }
  4315. ];
  4316. };
  4317. function STD(e2, t2, n) {
  4318. this._springX = new Spring(e2, t2, n);
  4319. this._springY = new Spring(e2, t2, n);
  4320. this._springScale = new Spring(e2, t2, n);
  4321. this._startTime = 0;
  4322. }
  4323. STD.prototype.setEnd = function(e2, t2, n, i) {
  4324. const r = (/* @__PURE__ */ new Date()).getTime();
  4325. this._springX.setEnd(e2, i, r);
  4326. this._springY.setEnd(t2, i, r);
  4327. this._springScale.setEnd(n, i, r);
  4328. this._startTime = r;
  4329. };
  4330. STD.prototype.x = function() {
  4331. const e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4332. return {
  4333. x: this._springX.x(e2),
  4334. y: this._springY.x(e2),
  4335. scale: this._springScale.x(e2)
  4336. };
  4337. };
  4338. STD.prototype.done = function() {
  4339. const e2 = (/* @__PURE__ */ new Date()).getTime();
  4340. return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
  4341. };
  4342. STD.prototype.reconfigure = function(e2, t2, n) {
  4343. this._springX.reconfigure(e2, t2, n);
  4344. this._springY.reconfigure(e2, t2, n);
  4345. this._springScale.reconfigure(e2, t2, n);
  4346. };
  4347. const movableViewProps = {
  4348. direction: {
  4349. type: String,
  4350. default: "none"
  4351. },
  4352. inertia: {
  4353. type: [Boolean, String],
  4354. default: false
  4355. },
  4356. outOfBounds: {
  4357. type: [Boolean, String],
  4358. default: false
  4359. },
  4360. x: {
  4361. type: [Number, String],
  4362. default: 0
  4363. },
  4364. y: {
  4365. type: [Number, String],
  4366. default: 0
  4367. },
  4368. damping: {
  4369. type: [Number, String],
  4370. default: 20
  4371. },
  4372. friction: {
  4373. type: [Number, String],
  4374. default: 2
  4375. },
  4376. disabled: {
  4377. type: [Boolean, String],
  4378. default: false
  4379. },
  4380. scale: {
  4381. type: [Boolean, String],
  4382. default: false
  4383. },
  4384. scaleMin: {
  4385. type: [Number, String],
  4386. default: 0.5
  4387. },
  4388. scaleMax: {
  4389. type: [Number, String],
  4390. default: 10
  4391. },
  4392. scaleValue: {
  4393. type: [Number, String],
  4394. default: 1
  4395. },
  4396. animation: {
  4397. type: [Boolean, String],
  4398. default: true
  4399. }
  4400. };
  4401. function v(a, b) {
  4402. return +((1e3 * a - 1e3 * b) / 1e3).toFixed(1);
  4403. }
  4404. const index$s = /* @__PURE__ */ defineBuiltInComponent({
  4405. name: "MovableView",
  4406. props: movableViewProps,
  4407. emits: ["change", "scale"],
  4408. setup(props2, {
  4409. slots,
  4410. emit: emit2
  4411. }) {
  4412. const rootRef = vue.ref(null);
  4413. const trigger = useCustomEvent(rootRef, emit2);
  4414. const {
  4415. setParent
  4416. } = useMovableViewState(props2, trigger, rootRef);
  4417. return () => {
  4418. return vue.createVNode("uni-movable-view", {
  4419. "ref": rootRef
  4420. }, [vue.createVNode(ResizeSensor, {
  4421. "onResize": setParent
  4422. }, null, 8, ["onResize"]), slots.default && slots.default()], 512);
  4423. };
  4424. }
  4425. });
  4426. let requesting = false;
  4427. function _requestAnimationFrame(e2) {
  4428. if (!requesting) {
  4429. requesting = true;
  4430. requestAnimationFrame(function() {
  4431. e2();
  4432. requesting = false;
  4433. });
  4434. }
  4435. }
  4436. function p(t2, n) {
  4437. if (t2 === n) {
  4438. return 0;
  4439. }
  4440. let i = t2.offsetLeft;
  4441. return t2.offsetParent ? i += p(t2.offsetParent, n) : 0;
  4442. }
  4443. function f(t2, n) {
  4444. if (t2 === n) {
  4445. return 0;
  4446. }
  4447. let i = t2.offsetTop;
  4448. return t2.offsetParent ? i += f(t2.offsetParent, n) : 0;
  4449. }
  4450. function g(friction, execute, endCallback) {
  4451. let record = {
  4452. id: 0,
  4453. cancelled: false
  4454. };
  4455. let cancel = function(record2) {
  4456. if (record2 && record2.id) {
  4457. cancelAnimationFrame(record2.id);
  4458. }
  4459. if (record2) {
  4460. record2.cancelled = true;
  4461. }
  4462. };
  4463. function fn(record2, friction2, execute2, endCallback2) {
  4464. if (!record2 || !record2.cancelled) {
  4465. execute2(friction2);
  4466. let isDone = friction2.done();
  4467. if (!isDone) {
  4468. if (!record2.cancelled) {
  4469. record2.id = requestAnimationFrame(fn.bind(null, record2, friction2, execute2, endCallback2));
  4470. }
  4471. }
  4472. if (isDone && endCallback2) {
  4473. endCallback2(friction2);
  4474. }
  4475. }
  4476. }
  4477. fn(record, friction, execute, endCallback);
  4478. return {
  4479. cancel: cancel.bind(null, record),
  4480. model: friction
  4481. };
  4482. }
  4483. function _getPx(val) {
  4484. if (/\d+[ur]px$/i.test(val)) {
  4485. return uni.upx2px(parseFloat(val));
  4486. }
  4487. return Number(val) || 0;
  4488. }
  4489. function useMovableViewLayout(rootRef, _scale, _adjustScale) {
  4490. const movableAreaWidth = vue.inject("movableAreaWidth", vue.ref(0));
  4491. const movableAreaHeight = vue.inject("movableAreaHeight", vue.ref(0));
  4492. const movableAreaRootRef = vue.inject("movableAreaRootRef");
  4493. const _offset = {
  4494. x: 0,
  4495. y: 0
  4496. };
  4497. const _scaleOffset = {
  4498. x: 0,
  4499. y: 0
  4500. };
  4501. const width = vue.ref(0);
  4502. const height = vue.ref(0);
  4503. const minX = vue.ref(0);
  4504. const minY = vue.ref(0);
  4505. const maxX = vue.ref(0);
  4506. const maxY = vue.ref(0);
  4507. function _updateBoundary() {
  4508. let x = 0 - _offset.x + _scaleOffset.x;
  4509. let _width = movableAreaWidth.value - width.value - _offset.x - _scaleOffset.x;
  4510. minX.value = Math.min(x, _width);
  4511. maxX.value = Math.max(x, _width);
  4512. let y = 0 - _offset.y + _scaleOffset.y;
  4513. let _height = movableAreaHeight.value - height.value - _offset.y - _scaleOffset.y;
  4514. minY.value = Math.min(y, _height);
  4515. maxY.value = Math.max(y, _height);
  4516. }
  4517. function _updateOffset() {
  4518. _offset.x = p(rootRef.value, movableAreaRootRef.value);
  4519. _offset.y = f(rootRef.value, movableAreaRootRef.value);
  4520. }
  4521. function _updateWH(scale) {
  4522. scale = scale || _scale.value;
  4523. scale = _adjustScale(scale);
  4524. let rect = rootRef.value.getBoundingClientRect();
  4525. height.value = rect.height / _scale.value;
  4526. width.value = rect.width / _scale.value;
  4527. let _height = height.value * scale;
  4528. let _width = width.value * scale;
  4529. _scaleOffset.x = (_width - width.value) / 2;
  4530. _scaleOffset.y = (_height - height.value) / 2;
  4531. }
  4532. return {
  4533. _updateBoundary,
  4534. _updateOffset,
  4535. _updateWH,
  4536. _scaleOffset,
  4537. minX,
  4538. minY,
  4539. maxX,
  4540. maxY
  4541. };
  4542. }
  4543. function useMovableViewTransform(rootRef, props2, _scaleOffset, _scale, maxX, maxY, minX, minY, _translateX, _translateY, _SFA, _FA, _adjustScale, trigger) {
  4544. const dampingNumber = vue.computed(() => {
  4545. let val = Number(props2.damping);
  4546. return isNaN(val) ? 20 : val;
  4547. });
  4548. const xMove = vue.computed(() => props2.direction === "all" || props2.direction === "horizontal");
  4549. const yMove = vue.computed(() => props2.direction === "all" || props2.direction === "vertical");
  4550. const xSync = vue.ref(_getPx(props2.x));
  4551. const ySync = vue.ref(_getPx(props2.y));
  4552. vue.watch(() => props2.x, (val) => {
  4553. xSync.value = _getPx(val);
  4554. });
  4555. vue.watch(() => props2.y, (val) => {
  4556. ySync.value = _getPx(val);
  4557. });
  4558. vue.watch(xSync, (val) => {
  4559. _setX(val);
  4560. });
  4561. vue.watch(ySync, (val) => {
  4562. _setY(val);
  4563. });
  4564. const _STD = new STD(1, 9 * Math.pow(dampingNumber.value, 2) / 40, dampingNumber.value);
  4565. function _getLimitXY(x, y) {
  4566. let outOfBounds = false;
  4567. if (x > maxX.value) {
  4568. x = maxX.value;
  4569. outOfBounds = true;
  4570. } else {
  4571. if (x < minX.value) {
  4572. x = minX.value;
  4573. outOfBounds = true;
  4574. }
  4575. }
  4576. if (y > maxY.value) {
  4577. y = maxY.value;
  4578. outOfBounds = true;
  4579. } else {
  4580. if (y < minY.value) {
  4581. y = minY.value;
  4582. outOfBounds = true;
  4583. }
  4584. }
  4585. return {
  4586. x,
  4587. y,
  4588. outOfBounds
  4589. };
  4590. }
  4591. function FAandSFACancel() {
  4592. if (_FA) {
  4593. _FA.cancel();
  4594. }
  4595. if (_SFA) {
  4596. _SFA.cancel();
  4597. }
  4598. }
  4599. function _animationTo(x, y, scale, source, r, o) {
  4600. FAandSFACancel();
  4601. if (!xMove.value) {
  4602. x = _translateX.value;
  4603. }
  4604. if (!yMove.value) {
  4605. y = _translateY.value;
  4606. }
  4607. if (!props2.scale) {
  4608. scale = _scale.value;
  4609. }
  4610. let limitXY = _getLimitXY(x, y);
  4611. x = limitXY.x;
  4612. y = limitXY.y;
  4613. if (!props2.animation) {
  4614. _setTransform(x, y, scale, source, r, o);
  4615. return;
  4616. }
  4617. _STD._springX._solution = null;
  4618. _STD._springY._solution = null;
  4619. _STD._springScale._solution = null;
  4620. _STD._springX._endPosition = _translateX.value;
  4621. _STD._springY._endPosition = _translateY.value;
  4622. _STD._springScale._endPosition = _scale.value;
  4623. _STD.setEnd(x, y, scale, 1);
  4624. _SFA = g(_STD, function() {
  4625. let data = _STD.x();
  4626. let x2 = data.x;
  4627. let y2 = data.y;
  4628. let scale2 = data.scale;
  4629. _setTransform(x2, y2, scale2, source, r, o);
  4630. }, function() {
  4631. _SFA.cancel();
  4632. });
  4633. }
  4634. function _setTransform(x, y, scale, source = "", r, o) {
  4635. if (!(x !== null && x.toString() !== "NaN" && typeof x === "number")) {
  4636. x = _translateX.value || 0;
  4637. }
  4638. if (!(y !== null && y.toString() !== "NaN" && typeof y === "number")) {
  4639. y = _translateY.value || 0;
  4640. }
  4641. x = Number(x.toFixed(1));
  4642. y = Number(y.toFixed(1));
  4643. scale = Number(scale.toFixed(1));
  4644. if (!(_translateX.value === x && _translateY.value === y)) {
  4645. if (!r) {
  4646. trigger("change", {}, {
  4647. x: v(x, _scaleOffset.x),
  4648. y: v(y, _scaleOffset.y),
  4649. source
  4650. });
  4651. }
  4652. }
  4653. if (!props2.scale) {
  4654. scale = _scale.value;
  4655. }
  4656. scale = _adjustScale(scale);
  4657. scale = +scale.toFixed(3);
  4658. if (o && scale !== _scale.value) {
  4659. trigger("scale", {}, {
  4660. x,
  4661. y,
  4662. scale
  4663. });
  4664. }
  4665. let transform = "translateX(" + x + "px) translateY(" + y + "px) translateZ(0px) scale(" + scale + ")";
  4666. if (rootRef.value) {
  4667. rootRef.value.style.transform = transform;
  4668. rootRef.value.style.webkitTransform = transform;
  4669. _translateX.value = x;
  4670. _translateY.value = y;
  4671. _scale.value = scale;
  4672. }
  4673. }
  4674. function _revise(source) {
  4675. let limitXY = _getLimitXY(_translateX.value, _translateY.value);
  4676. let x = limitXY.x;
  4677. let y = limitXY.y;
  4678. let outOfBounds = limitXY.outOfBounds;
  4679. if (outOfBounds) {
  4680. _animationTo(x, y, _scale.value, source);
  4681. }
  4682. return outOfBounds;
  4683. }
  4684. function _setX(val) {
  4685. if (xMove.value) {
  4686. if (val + _scaleOffset.x === _translateX.value) {
  4687. return _translateX;
  4688. } else {
  4689. if (_SFA) {
  4690. _SFA.cancel();
  4691. }
  4692. _animationTo(val + _scaleOffset.x, ySync.value + _scaleOffset.y, _scale.value);
  4693. }
  4694. }
  4695. return val;
  4696. }
  4697. function _setY(val) {
  4698. if (yMove.value) {
  4699. if (val + _scaleOffset.y === _translateY.value) {
  4700. return _translateY;
  4701. } else {
  4702. if (_SFA) {
  4703. _SFA.cancel();
  4704. }
  4705. _animationTo(xSync.value + _scaleOffset.x, val + _scaleOffset.y, _scale.value);
  4706. }
  4707. }
  4708. return val;
  4709. }
  4710. return {
  4711. FAandSFACancel,
  4712. _getLimitXY,
  4713. _animationTo,
  4714. _setTransform,
  4715. _revise,
  4716. dampingNumber,
  4717. xMove,
  4718. yMove,
  4719. xSync,
  4720. ySync,
  4721. _STD
  4722. };
  4723. }
  4724. function useMovableViewInit(props2, rootRef, trigger, _scale, _oldScale, _isScaling, _translateX, _translateY, _SFA, _FA) {
  4725. const scaleMinNumber = vue.computed(() => {
  4726. let val = Number(props2.scaleMin);
  4727. return isNaN(val) ? 0.5 : val;
  4728. });
  4729. const scaleMaxNumber = vue.computed(() => {
  4730. let val = Number(props2.scaleMax);
  4731. return isNaN(val) ? 10 : val;
  4732. });
  4733. const scaleValueSync = vue.ref(Number(props2.scaleValue) || 1);
  4734. vue.watch(scaleValueSync, (val) => {
  4735. _setScaleValue(val);
  4736. });
  4737. vue.watch(scaleMinNumber, () => {
  4738. _setScaleMinOrMax();
  4739. });
  4740. vue.watch(scaleMaxNumber, () => {
  4741. _setScaleMinOrMax();
  4742. });
  4743. vue.watch(() => props2.scaleValue, (val) => {
  4744. scaleValueSync.value = Number(val) || 0;
  4745. });
  4746. const {
  4747. _updateBoundary,
  4748. _updateOffset,
  4749. _updateWH,
  4750. _scaleOffset,
  4751. minX,
  4752. minY,
  4753. maxX,
  4754. maxY
  4755. } = useMovableViewLayout(rootRef, _scale, _adjustScale);
  4756. const {
  4757. FAandSFACancel,
  4758. _getLimitXY,
  4759. _animationTo,
  4760. _setTransform,
  4761. _revise,
  4762. dampingNumber,
  4763. xMove,
  4764. yMove,
  4765. xSync,
  4766. ySync,
  4767. _STD
  4768. } = useMovableViewTransform(rootRef, props2, _scaleOffset, _scale, maxX, maxY, minX, minY, _translateX, _translateY, _SFA, _FA, _adjustScale, trigger);
  4769. function _updateScale(scale, animat) {
  4770. if (props2.scale) {
  4771. scale = _adjustScale(scale);
  4772. _updateWH(scale);
  4773. _updateBoundary();
  4774. const limitXY = _getLimitXY(_translateX.value, _translateY.value);
  4775. const x = limitXY.x;
  4776. const y = limitXY.y;
  4777. if (animat) {
  4778. _animationTo(x, y, scale, "", true, true);
  4779. } else {
  4780. _requestAnimationFrame(function() {
  4781. _setTransform(x, y, scale, "", true, true);
  4782. });
  4783. }
  4784. }
  4785. }
  4786. function _beginScale() {
  4787. _isScaling.value = true;
  4788. }
  4789. function _updateOldScale(scale) {
  4790. _oldScale.value = scale;
  4791. }
  4792. function _adjustScale(scale) {
  4793. scale = Math.max(0.5, scaleMinNumber.value, scale);
  4794. scale = Math.min(10, scaleMaxNumber.value, scale);
  4795. return scale;
  4796. }
  4797. function _setScaleMinOrMax() {
  4798. if (!props2.scale) {
  4799. return false;
  4800. }
  4801. _updateScale(_scale.value, true);
  4802. _updateOldScale(_scale.value);
  4803. }
  4804. function _setScaleValue(scale) {
  4805. if (!props2.scale) {
  4806. return false;
  4807. }
  4808. scale = _adjustScale(scale);
  4809. _updateScale(scale, true);
  4810. _updateOldScale(scale);
  4811. return scale;
  4812. }
  4813. function _endScale() {
  4814. _isScaling.value = false;
  4815. _updateOldScale(_scale.value);
  4816. }
  4817. function _setScale(scale) {
  4818. if (scale) {
  4819. scale = _oldScale.value * scale;
  4820. _beginScale();
  4821. _updateScale(scale);
  4822. }
  4823. }
  4824. return {
  4825. // scale
  4826. _updateOldScale,
  4827. _endScale,
  4828. _setScale,
  4829. scaleValueSync,
  4830. // layout
  4831. _updateBoundary,
  4832. _updateOffset,
  4833. _updateWH,
  4834. _scaleOffset,
  4835. minX,
  4836. minY,
  4837. maxX,
  4838. maxY,
  4839. // transform
  4840. FAandSFACancel,
  4841. _getLimitXY,
  4842. _animationTo,
  4843. _setTransform,
  4844. _revise,
  4845. dampingNumber,
  4846. xMove,
  4847. yMove,
  4848. xSync,
  4849. ySync,
  4850. _STD
  4851. };
  4852. }
  4853. function useMovableViewState(props2, trigger, rootRef) {
  4854. const _isMounted = vue.inject("_isMounted", vue.ref(false));
  4855. vue.inject("addMovableViewContext", () => {
  4856. });
  4857. vue.inject("removeMovableViewContext", () => {
  4858. });
  4859. let _scale = vue.ref(1);
  4860. let _oldScale = vue.ref(1);
  4861. let _isScaling = vue.ref(false);
  4862. let _translateX = vue.ref(0);
  4863. let _translateY = vue.ref(0);
  4864. let _SFA = null;
  4865. let _FA = null;
  4866. const frictionNumber = vue.computed(() => {
  4867. let val = Number(props2.friction);
  4868. return isNaN(val) || val <= 0 ? 2 : val;
  4869. });
  4870. new Friction(1, frictionNumber.value);
  4871. vue.watch(() => props2.disabled, () => {
  4872. __handleTouchStart();
  4873. });
  4874. const {
  4875. // scale
  4876. _updateOldScale,
  4877. _endScale,
  4878. _setScale,
  4879. scaleValueSync,
  4880. // layout
  4881. _updateBoundary,
  4882. _updateOffset,
  4883. _updateWH,
  4884. _scaleOffset,
  4885. minX,
  4886. minY,
  4887. maxX,
  4888. maxY,
  4889. // transform
  4890. FAandSFACancel,
  4891. _getLimitXY,
  4892. _setTransform,
  4893. _revise,
  4894. dampingNumber,
  4895. xMove,
  4896. yMove,
  4897. xSync,
  4898. ySync,
  4899. _STD
  4900. } = useMovableViewInit(props2, rootRef, trigger, _scale, _oldScale, _isScaling, _translateX, _translateY, _SFA, _FA);
  4901. function __handleTouchStart() {
  4902. if (!_isScaling.value) {
  4903. if (!props2.disabled) {
  4904. FAandSFACancel();
  4905. if (xMove.value) {
  4906. _translateX.value;
  4907. }
  4908. if (yMove.value) {
  4909. _translateY.value;
  4910. }
  4911. rootRef.value.style.willChange = "transform";
  4912. }
  4913. }
  4914. }
  4915. function setParent() {
  4916. if (!_isMounted.value) {
  4917. return;
  4918. }
  4919. FAandSFACancel();
  4920. let scale = props2.scale ? scaleValueSync.value : 1;
  4921. _updateOffset();
  4922. _updateWH(scale);
  4923. _updateBoundary();
  4924. let limitXY = _getLimitXY(xSync.value + _scaleOffset.x, ySync.value + _scaleOffset.y);
  4925. let x = limitXY.x;
  4926. let y = limitXY.y;
  4927. _setTransform(x, y, scale, "", true);
  4928. _updateOldScale(scale);
  4929. }
  4930. return {
  4931. setParent
  4932. };
  4933. }
  4934. const OPEN_TYPES = [
  4935. "navigate",
  4936. "redirect",
  4937. "switchTab",
  4938. "reLaunch",
  4939. "navigateBack"
  4940. ];
  4941. const ANIMATION_IN = [
  4942. "slide-in-right",
  4943. "slide-in-left",
  4944. "slide-in-top",
  4945. "slide-in-bottom",
  4946. "fade-in",
  4947. "zoom-out",
  4948. "zoom-fade-out",
  4949. "pop-in",
  4950. "none"
  4951. ];
  4952. const ANIMATION_OUT = [
  4953. "slide-out-right",
  4954. "slide-out-left",
  4955. "slide-out-top",
  4956. "slide-out-bottom",
  4957. "fade-out",
  4958. "zoom-in",
  4959. "zoom-fade-in",
  4960. "pop-out",
  4961. "none"
  4962. ];
  4963. const navigatorProps = {
  4964. hoverClass: {
  4965. type: String,
  4966. default: "navigator-hover"
  4967. },
  4968. url: {
  4969. type: String,
  4970. default: ""
  4971. },
  4972. openType: {
  4973. type: String,
  4974. default: "navigate",
  4975. validator(value) {
  4976. return Boolean(~OPEN_TYPES.indexOf(value));
  4977. }
  4978. },
  4979. delta: {
  4980. type: Number,
  4981. default: 1
  4982. },
  4983. hoverStartTime: {
  4984. type: [Number, String],
  4985. default: 50
  4986. },
  4987. hoverStayTime: {
  4988. type: [Number, String],
  4989. default: 600
  4990. },
  4991. exists: {
  4992. type: String,
  4993. default: ""
  4994. },
  4995. hoverStopPropagation: {
  4996. type: Boolean,
  4997. default: false
  4998. },
  4999. animationType: {
  5000. type: String,
  5001. default: "",
  5002. validator(value) {
  5003. return !value || ANIMATION_IN.concat(ANIMATION_OUT).includes(value);
  5004. }
  5005. },
  5006. animationDuration: {
  5007. type: [String, Number],
  5008. default: 300
  5009. }
  5010. };
  5011. function createNavigatorOnClick(props2) {
  5012. return () => {
  5013. if (props2.openType !== "navigateBack" && !props2.url) {
  5014. console.error(
  5015. "<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab"
  5016. );
  5017. return;
  5018. }
  5019. const animationDuration = parseInt(props2.animationDuration);
  5020. switch (props2.openType) {
  5021. case "navigate":
  5022. uni.navigateTo({
  5023. url: props2.url,
  5024. animationType: props2.animationType || "pop-in",
  5025. animationDuration
  5026. });
  5027. break;
  5028. case "redirect":
  5029. uni.redirectTo({
  5030. url: props2.url,
  5031. exists: props2.exists
  5032. });
  5033. break;
  5034. case "switchTab":
  5035. uni.switchTab({
  5036. url: props2.url
  5037. });
  5038. break;
  5039. case "reLaunch":
  5040. uni.reLaunch({
  5041. url: props2.url
  5042. });
  5043. break;
  5044. case "navigateBack":
  5045. uni.navigateBack({
  5046. delta: props2.delta,
  5047. animationType: props2.animationType || "pop-out",
  5048. animationDuration
  5049. });
  5050. break;
  5051. }
  5052. };
  5053. }
  5054. const index$r = /* @__PURE__ */ defineBuiltInComponent({
  5055. name: "Navigator",
  5056. inheritAttrs: false,
  5057. compatConfig: {
  5058. MODE: 3
  5059. },
  5060. props: /* @__PURE__ */ shared.extend({}, navigatorProps, {
  5061. renderLink: {
  5062. type: Boolean,
  5063. default: true
  5064. }
  5065. }),
  5066. setup(props2, {
  5067. slots
  5068. }) {
  5069. const rootRef = vue.ref(null);
  5070. const vm = vue.getCurrentInstance();
  5071. const __scopeId = vm && vm.vnode.scopeId || "";
  5072. const {
  5073. hovering,
  5074. binding
  5075. } = useHover(props2);
  5076. const onClick = createNavigatorOnClick(props2);
  5077. return () => {
  5078. const {
  5079. hoverClass,
  5080. url
  5081. } = props2;
  5082. const hasHoverClass = props2.hoverClass && props2.hoverClass !== "none";
  5083. const innerNode = props2.renderLink ? vue.createVNode("a", {
  5084. "class": "navigator-wrap",
  5085. "href": url,
  5086. "onClick": onEventPrevent,
  5087. "onMousedown": onEventPrevent
  5088. }, [slots.default && slots.default()], 40, ["href", "onClick", "onMousedown"]) : slots.default && slots.default();
  5089. return vue.createVNode("uni-navigator", vue.mergeProps({
  5090. "class": hasHoverClass && hovering.value ? hoverClass : "",
  5091. "ref": rootRef
  5092. }, hasHoverClass && binding, vm ? vm.attrs : {}, {
  5093. [__scopeId]: ""
  5094. }, {
  5095. "onClick": onClick
  5096. }), [innerNode], 16, ["onClick"]);
  5097. };
  5098. }
  5099. });
  5100. const pickerViewProps = {
  5101. value: {
  5102. type: Array,
  5103. default() {
  5104. return [];
  5105. },
  5106. validator: function(val) {
  5107. return shared.isArray(val) && val.filter((val2) => typeof val2 === "number").length === val.length;
  5108. }
  5109. },
  5110. indicatorStyle: {
  5111. type: String,
  5112. default: ""
  5113. },
  5114. indicatorClass: {
  5115. type: String,
  5116. default: ""
  5117. },
  5118. maskStyle: {
  5119. type: String,
  5120. default: ""
  5121. },
  5122. maskClass: {
  5123. type: String,
  5124. default: ""
  5125. }
  5126. };
  5127. function useState$2(props2) {
  5128. const value = vue.reactive([...props2.value]);
  5129. const state = vue.reactive({
  5130. value,
  5131. height: 34
  5132. });
  5133. vue.watch(() => props2.value, (val, oldVal) => {
  5134. {
  5135. state.value.length = val.length;
  5136. val.forEach((val2, index2) => {
  5137. if (val2 !== state.value[index2]) {
  5138. state.value.splice(index2, 1, val2);
  5139. }
  5140. });
  5141. }
  5142. });
  5143. return state;
  5144. }
  5145. const PickerView = /* @__PURE__ */ defineBuiltInComponent({
  5146. name: "PickerView",
  5147. props: pickerViewProps,
  5148. emits: ["change", "pickstart", "pickend", "update:value"],
  5149. setup(props2, {
  5150. slots,
  5151. emit: emit2
  5152. }) {
  5153. const rootRef = vue.ref(null);
  5154. const wrapperRef = vue.ref(null);
  5155. const trigger = useCustomEvent(rootRef, emit2);
  5156. const state = useState$2(props2);
  5157. const resizeSensorRef = vue.ref(null);
  5158. let ColumnsPreRef = vue.ref([]);
  5159. let columnsRef = vue.ref([]);
  5160. function getItemIndex(vnode) {
  5161. let columnVNodes = columnsRef.value;
  5162. {
  5163. columnVNodes = columnVNodes.filter((vnode2) => vnode2.type !== vue.Comment);
  5164. }
  5165. let index2 = columnVNodes.indexOf(vnode);
  5166. return index2 !== -1 ? index2 : ColumnsPreRef.value.indexOf(vnode);
  5167. }
  5168. const getPickerViewColumn = function(columnInstance) {
  5169. const ref2 = vue.computed({
  5170. get() {
  5171. const index2 = getItemIndex(columnInstance.vnode);
  5172. return state.value[index2] || 0;
  5173. },
  5174. set(current) {
  5175. const index2 = getItemIndex(columnInstance.vnode);
  5176. if (index2 < 0) {
  5177. return;
  5178. }
  5179. const oldCurrent = state.value[index2];
  5180. if (oldCurrent !== current) {
  5181. state.value[index2] = current;
  5182. const value = state.value.map((val) => val);
  5183. emit2("update:value", value);
  5184. trigger("change", {}, {
  5185. value
  5186. });
  5187. }
  5188. }
  5189. });
  5190. return ref2;
  5191. };
  5192. vue.provide("getPickerViewColumn", getPickerViewColumn);
  5193. vue.provide("pickerViewProps", props2);
  5194. vue.provide("pickerViewState", state);
  5195. return () => {
  5196. const defaultSlots = slots.default && slots.default();
  5197. {
  5198. const vnode = flatVNode(defaultSlots);
  5199. ColumnsPreRef.value = vnode;
  5200. vue.nextTick(() => {
  5201. columnsRef.value = vnode;
  5202. });
  5203. }
  5204. return vue.createVNode("uni-picker-view", {
  5205. "ref": rootRef
  5206. }, [vue.createVNode(ResizeSensor, {
  5207. "ref": resizeSensorRef,
  5208. "onResize": ({
  5209. height
  5210. }) => state.height = height
  5211. }, null, 8, ["onResize"]), vue.createVNode("div", {
  5212. "ref": wrapperRef,
  5213. "class": "uni-picker-view-wrapper"
  5214. }, [defaultSlots], 512)], 512);
  5215. };
  5216. }
  5217. });
  5218. const PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
  5219. name: "PickerViewColumn",
  5220. setup(props2, {
  5221. slots,
  5222. emit: emit2
  5223. }) {
  5224. const rootRef = vue.ref(null);
  5225. const contentRef = vue.ref(null);
  5226. const getPickerViewColumn = vue.inject("getPickerViewColumn");
  5227. const instance = vue.getCurrentInstance();
  5228. const currentRef = getPickerViewColumn ? getPickerViewColumn(instance) : vue.ref(0);
  5229. const pickerViewProps2 = vue.inject("pickerViewProps");
  5230. const pickerViewState = vue.inject("pickerViewState");
  5231. const indicatorHeight = vue.ref(34);
  5232. const resizeSensorRef = vue.ref(null);
  5233. const maskSize = vue.computed(() => (pickerViewState.height - indicatorHeight.value) / 2);
  5234. const {
  5235. state: scopedAttrsState
  5236. } = useScopedAttrs();
  5237. let scroller;
  5238. const state = vue.reactive({
  5239. current: currentRef.value,
  5240. length: 0
  5241. });
  5242. function updatesScroller() {
  5243. }
  5244. vue.watch(() => currentRef.value, (current) => {
  5245. if (current !== state.current) {
  5246. state.current = current;
  5247. }
  5248. });
  5249. vue.watch(() => state.current, (current) => currentRef.value = current);
  5250. vue.watch([() => indicatorHeight.value, () => state.length, () => pickerViewState.height], updatesScroller);
  5251. let oldDeltaY = 0;
  5252. function handleWheel(event) {
  5253. const deltaY = oldDeltaY + event.deltaY;
  5254. if (Math.abs(deltaY) > 10) {
  5255. oldDeltaY = 0;
  5256. let current = Math.min(state.current + (deltaY < 0 ? -1 : 1), state.length - 1);
  5257. state.current = current = Math.max(current, 0);
  5258. scroller.scrollTo(current * indicatorHeight.value);
  5259. } else {
  5260. oldDeltaY = deltaY;
  5261. }
  5262. event.preventDefault();
  5263. }
  5264. function handleTap({
  5265. clientY
  5266. }) {
  5267. const el = rootRef.value;
  5268. if (!scroller.isScrolling()) {
  5269. const rect = el.getBoundingClientRect();
  5270. const r = clientY - rect.top - pickerViewState.height / 2;
  5271. const o = indicatorHeight.value / 2;
  5272. if (!(Math.abs(r) <= o)) {
  5273. const a = Math.ceil((Math.abs(r) - o) / indicatorHeight.value);
  5274. const s = r < 0 ? -a : a;
  5275. let current = Math.min(state.current + s, state.length - 1);
  5276. state.current = current = Math.max(current, 0);
  5277. scroller.scrollTo(current * indicatorHeight.value);
  5278. }
  5279. }
  5280. }
  5281. return () => {
  5282. const defaultSlots = slots.default && slots.default();
  5283. {
  5284. state.length = flatVNode(defaultSlots).length;
  5285. }
  5286. const padding = `${maskSize.value}px 0`;
  5287. return vue.createVNode("uni-picker-view-column", {
  5288. "ref": rootRef
  5289. }, [vue.createVNode("div", {
  5290. "onWheel": handleWheel,
  5291. "onClick": handleTap,
  5292. "class": "uni-picker-view-group"
  5293. }, [vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  5294. "class": ["uni-picker-view-mask", pickerViewProps2.maskClass],
  5295. "style": `background-size: 100% ${maskSize.value}px;${pickerViewProps2.maskStyle}`
  5296. }), null, 16), vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  5297. "class": ["uni-picker-view-indicator", pickerViewProps2.indicatorClass],
  5298. "style": pickerViewProps2.indicatorStyle
  5299. }), [vue.createVNode(ResizeSensor, {
  5300. "ref": resizeSensorRef,
  5301. "onResize": ({
  5302. height
  5303. }) => indicatorHeight.value = height
  5304. }, null, 8, ["onResize"])], 16), vue.createVNode("div", {
  5305. "ref": contentRef,
  5306. "class": ["uni-picker-view-content"],
  5307. "style": {
  5308. padding,
  5309. "--picker-view-column-indicator-height": `${indicatorHeight.value}px`
  5310. }
  5311. }, [defaultSlots], 4)], 40, ["onWheel", "onClick"])], 512);
  5312. };
  5313. }
  5314. });
  5315. const FONT_SIZE = 16;
  5316. const PROGRESS_VALUES = {
  5317. activeColor: uniShared.PRIMARY_COLOR,
  5318. backgroundColor: "#EBEBEB",
  5319. activeMode: "backwards"
  5320. };
  5321. const progressProps = {
  5322. percent: {
  5323. type: [Number, String],
  5324. default: 0,
  5325. validator(value) {
  5326. return !isNaN(parseFloat(value));
  5327. }
  5328. },
  5329. fontSize: {
  5330. type: [String, Number],
  5331. default: FONT_SIZE
  5332. },
  5333. showInfo: {
  5334. type: [Boolean, String],
  5335. default: false
  5336. },
  5337. strokeWidth: {
  5338. type: [Number, String],
  5339. default: 6,
  5340. validator(value) {
  5341. return !isNaN(parseFloat(value));
  5342. }
  5343. },
  5344. color: {
  5345. type: String,
  5346. default: PROGRESS_VALUES.activeColor
  5347. },
  5348. activeColor: {
  5349. type: String,
  5350. default: PROGRESS_VALUES.activeColor
  5351. },
  5352. backgroundColor: {
  5353. type: String,
  5354. default: PROGRESS_VALUES.backgroundColor
  5355. },
  5356. active: {
  5357. type: [Boolean, String],
  5358. default: false
  5359. },
  5360. activeMode: {
  5361. type: String,
  5362. default: PROGRESS_VALUES.activeMode
  5363. },
  5364. duration: {
  5365. type: [Number, String],
  5366. default: 30,
  5367. validator(value) {
  5368. return !isNaN(parseFloat(value));
  5369. }
  5370. },
  5371. borderRadius: {
  5372. type: [Number, String],
  5373. default: 0
  5374. }
  5375. };
  5376. const index$q = /* @__PURE__ */ defineBuiltInComponent({
  5377. name: "Progress",
  5378. props: progressProps,
  5379. setup(props2) {
  5380. const rootRef = vue.ref(null);
  5381. const state = useProgressState(props2);
  5382. _activeAnimation(state, props2);
  5383. vue.watch(() => state.realPercent, (newValue, oldValue) => {
  5384. state.strokeTimer && clearInterval(state.strokeTimer);
  5385. state.lastPercent = oldValue || 0;
  5386. _activeAnimation(state, props2);
  5387. });
  5388. return () => {
  5389. const {
  5390. showInfo
  5391. } = props2;
  5392. const {
  5393. outerBarStyle,
  5394. innerBarStyle,
  5395. currentPercent
  5396. } = state;
  5397. return vue.createVNode("uni-progress", {
  5398. "class": "uni-progress",
  5399. "ref": rootRef
  5400. }, [vue.createVNode("div", {
  5401. "style": outerBarStyle,
  5402. "class": "uni-progress-bar"
  5403. }, [vue.createVNode("div", {
  5404. "style": innerBarStyle,
  5405. "class": "uni-progress-inner-bar"
  5406. }, null, 4)], 4), showInfo ? (
  5407. // {currentPercent}% 的写法会影响 SSR Hydration (tsx插件的问题)
  5408. vue.createVNode("p", {
  5409. "class": "uni-progress-info"
  5410. }, [currentPercent + "%"])
  5411. ) : ""], 512);
  5412. };
  5413. }
  5414. });
  5415. function useProgressState(props2) {
  5416. const currentPercent = vue.ref(0);
  5417. const outerBarStyle = vue.computed(() => `background-color: ${props2.backgroundColor}; height: ${props2.strokeWidth}px;`);
  5418. const innerBarStyle = vue.computed(() => {
  5419. const backgroundColor = props2.color !== PROGRESS_VALUES.activeColor && props2.activeColor === PROGRESS_VALUES.activeColor ? props2.color : props2.activeColor;
  5420. return `width: ${currentPercent.value}%;background-color: ${backgroundColor}`;
  5421. });
  5422. const realPercent = vue.computed(() => {
  5423. if (typeof props2.percent === "string" && !/^-?\d*\.?\d*$/.test(props2.percent)) {
  5424. return 0;
  5425. }
  5426. let realValue = parseFloat(props2.percent);
  5427. if (Number.isNaN(realValue) || realValue < 0) {
  5428. realValue = 0;
  5429. } else if (realValue > 100) {
  5430. realValue = 100;
  5431. }
  5432. return realValue;
  5433. });
  5434. const state = vue.reactive({
  5435. outerBarStyle,
  5436. innerBarStyle,
  5437. realPercent,
  5438. currentPercent,
  5439. strokeTimer: 0,
  5440. lastPercent: 0
  5441. });
  5442. return state;
  5443. }
  5444. function _activeAnimation(state, props2) {
  5445. if (props2.active) {
  5446. state.currentPercent = props2.activeMode === PROGRESS_VALUES.activeMode ? 0 : state.lastPercent;
  5447. state.strokeTimer = setInterval(() => {
  5448. if (state.currentPercent + 1 > state.realPercent) {
  5449. state.currentPercent = state.realPercent;
  5450. state.strokeTimer && clearInterval(state.strokeTimer);
  5451. } else {
  5452. state.currentPercent += 1;
  5453. }
  5454. }, parseFloat(props2.duration));
  5455. } else {
  5456. state.currentPercent = state.realPercent;
  5457. }
  5458. }
  5459. const uniRadioGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
  5460. const props$j = {
  5461. name: {
  5462. type: String,
  5463. default: ""
  5464. }
  5465. };
  5466. const index$p = /* @__PURE__ */ defineBuiltInComponent({
  5467. name: "RadioGroup",
  5468. props: props$j,
  5469. // emits: ['change'],
  5470. setup(props2, {
  5471. emit: emit2,
  5472. slots
  5473. }) {
  5474. const rootRef = vue.ref(null);
  5475. const trigger = useCustomEvent(rootRef, emit2);
  5476. useProvideRadioGroup(props2, trigger);
  5477. return () => {
  5478. return vue.createVNode("uni-radio-group", {
  5479. "ref": rootRef
  5480. }, [slots.default && slots.default()], 512);
  5481. };
  5482. }
  5483. });
  5484. function useProvideRadioGroup(props2, trigger) {
  5485. const fields2 = [];
  5486. const getFieldsValue = () => {
  5487. var _a;
  5488. return (_a = fields2.find((field) => field.value.radioChecked)) == null ? void 0 : _a.value.value;
  5489. };
  5490. vue.provide(uniRadioGroupKey, {
  5491. addField(field) {
  5492. fields2.push(field);
  5493. },
  5494. removeField(field) {
  5495. fields2.splice(fields2.indexOf(field), 1);
  5496. },
  5497. radioChange($event, field) {
  5498. const index2 = fields2.indexOf(field);
  5499. _resetRadioGroupValue(index2, true);
  5500. trigger("change", $event, {
  5501. value: getFieldsValue()
  5502. });
  5503. }
  5504. });
  5505. const uniForm = vue.inject(uniFormKey, false);
  5506. const formField = {
  5507. submit: () => {
  5508. let data = ["", null];
  5509. if (props2.name !== "") {
  5510. data[0] = props2.name;
  5511. data[1] = getFieldsValue();
  5512. }
  5513. return data;
  5514. }
  5515. };
  5516. if (uniForm) {
  5517. uniForm.addField(formField);
  5518. }
  5519. function setFieldChecked(field, radioChecked) {
  5520. field.value = {
  5521. radioChecked,
  5522. value: field.value.value
  5523. };
  5524. }
  5525. function _resetRadioGroupValue(key, change) {
  5526. fields2.forEach((value, index2) => {
  5527. if (index2 === key) {
  5528. return;
  5529. }
  5530. if (change) {
  5531. setFieldChecked(fields2[index2], false);
  5532. } else {
  5533. fields2.forEach((v2, i) => {
  5534. if (index2 >= i) {
  5535. return;
  5536. }
  5537. if (fields2[i].value.radioChecked) {
  5538. setFieldChecked(fields2[index2], false);
  5539. }
  5540. });
  5541. }
  5542. });
  5543. }
  5544. return fields2;
  5545. }
  5546. const props$i = {
  5547. checked: {
  5548. type: [Boolean, String],
  5549. default: false
  5550. },
  5551. id: {
  5552. type: String,
  5553. default: ""
  5554. },
  5555. disabled: {
  5556. type: [Boolean, String],
  5557. default: false
  5558. },
  5559. value: {
  5560. type: String,
  5561. default: ""
  5562. },
  5563. color: {
  5564. type: String,
  5565. default: "#007aff"
  5566. },
  5567. backgroundColor: {
  5568. type: String,
  5569. default: ""
  5570. },
  5571. borderColor: {
  5572. type: String,
  5573. default: ""
  5574. },
  5575. activeBackgroundColor: {
  5576. type: String,
  5577. default: ""
  5578. },
  5579. activeBorderColor: {
  5580. type: String,
  5581. default: ""
  5582. },
  5583. iconColor: {
  5584. type: String,
  5585. default: "#ffffff"
  5586. },
  5587. // 图标颜色,同color,优先级大于iconColor
  5588. foreColor: {
  5589. type: String,
  5590. default: ""
  5591. }
  5592. };
  5593. const indexX$3 = /* @__PURE__ */ defineBuiltInComponent({
  5594. name: "Radio",
  5595. props: props$i,
  5596. setup(props2, {
  5597. slots
  5598. }) {
  5599. const rootRef = vue.ref(null);
  5600. const radioChecked = vue.ref(props2.checked);
  5601. const radioValue = vue.ref(props2.value);
  5602. function getRadioStyle(checked) {
  5603. if (props2.disabled) {
  5604. return {
  5605. backgroundColor: "#E1E1E1",
  5606. borderColor: "#D1D1D1"
  5607. };
  5608. }
  5609. const style = {};
  5610. if (radioChecked.value) {
  5611. style.backgroundColor = props2.activeBackgroundColor || props2.color;
  5612. style.borderColor = props2.activeBorderColor || style.backgroundColor;
  5613. } else {
  5614. if (props2.borderColor)
  5615. style.borderColor = props2.borderColor;
  5616. if (props2.backgroundColor)
  5617. style.backgroundColor = props2.backgroundColor;
  5618. }
  5619. return style;
  5620. }
  5621. const radioStyle = vue.computed(() => {
  5622. return getRadioStyle(radioChecked.value);
  5623. });
  5624. vue.watch([() => props2.checked, () => props2.value], ([newChecked, newModelValue]) => {
  5625. radioChecked.value = newChecked;
  5626. radioValue.value = newModelValue;
  5627. });
  5628. const reset = () => {
  5629. radioChecked.value = false;
  5630. };
  5631. const {
  5632. uniCheckGroup,
  5633. uniLabel,
  5634. field
  5635. } = useRadioInject(radioChecked, radioValue, reset);
  5636. const _onClick = ($event) => {
  5637. if (props2.disabled || radioChecked.value) {
  5638. return;
  5639. }
  5640. radioChecked.value = true;
  5641. uniCheckGroup && uniCheckGroup.radioChange($event, field);
  5642. $event.stopPropagation();
  5643. };
  5644. if (!!uniLabel) {
  5645. uniLabel.addHandler(_onClick);
  5646. }
  5647. return () => {
  5648. const booleanAttrs = useBooleanAttr(props2, "disabled");
  5649. let realCheckValue;
  5650. realCheckValue = radioChecked.value;
  5651. return vue.createVNode("uni-radio", vue.mergeProps(booleanAttrs, {
  5652. "onClick": _onClick,
  5653. "ref": rootRef,
  5654. "id": props2.id,
  5655. "class": "uni-radio-wrapper",
  5656. "style": {
  5657. "--HOVER-BD-COLOR": !radioChecked.value ? props2.activeBorderColor : radioStyle.value.borderColor
  5658. }
  5659. }), [vue.createVNode("div", {
  5660. "class": ["uni-radio-input", {
  5661. "uni-radio-input-disabled": props2.disabled
  5662. }],
  5663. "style": radioStyle.value
  5664. }, [realCheckValue ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.disabled ? "#ADADAD" : props2.foreColor || props2.iconColor, 18) : ""], 6), slots.default && slots.default()], 16, ["onClick", "id"]);
  5665. };
  5666. }
  5667. });
  5668. function useRadioInject(radioChecked, radioValue, reset) {
  5669. const field = vue.computed({
  5670. get: () => ({
  5671. radioChecked: Boolean(radioChecked.value),
  5672. value: radioValue.value
  5673. }),
  5674. set: ({
  5675. radioChecked: checked
  5676. }) => {
  5677. radioChecked.value = checked;
  5678. }
  5679. });
  5680. const formField = {
  5681. reset
  5682. };
  5683. const uniCheckGroup = vue.inject(uniRadioGroupKey, false);
  5684. if (!!uniCheckGroup) {
  5685. uniCheckGroup.addField(field);
  5686. }
  5687. const uniForm = vue.inject(uniFormKey, false);
  5688. if (!!uniForm) {
  5689. uniForm.addField(formField);
  5690. }
  5691. const uniLabel = vue.inject(uniLabelKey, false);
  5692. return {
  5693. uniCheckGroup,
  5694. uniForm,
  5695. uniLabel,
  5696. field
  5697. };
  5698. }
  5699. const TAGS = {
  5700. a: "",
  5701. abbr: "",
  5702. address: "",
  5703. article: "",
  5704. aside: "",
  5705. b: "",
  5706. bdi: "",
  5707. bdo: ["dir"],
  5708. big: "",
  5709. blockquote: "",
  5710. br: "",
  5711. caption: "",
  5712. center: "",
  5713. cite: "",
  5714. code: "",
  5715. col: ["span", "width"],
  5716. colgroup: ["span", "width"],
  5717. dd: "",
  5718. del: "",
  5719. div: "",
  5720. dl: "",
  5721. dt: "",
  5722. em: "",
  5723. fieldset: "",
  5724. font: "",
  5725. footer: "",
  5726. h1: "",
  5727. h2: "",
  5728. h3: "",
  5729. h4: "",
  5730. h5: "",
  5731. h6: "",
  5732. header: "",
  5733. hr: "",
  5734. i: "",
  5735. img: ["alt", "src", "height", "width"],
  5736. ins: "",
  5737. label: "",
  5738. legend: "",
  5739. li: "",
  5740. mark: "",
  5741. nav: "",
  5742. ol: ["start", "type"],
  5743. p: "",
  5744. pre: "",
  5745. q: "",
  5746. rt: "",
  5747. ruby: "",
  5748. s: "",
  5749. section: "",
  5750. small: "",
  5751. span: "",
  5752. strong: "",
  5753. sub: "",
  5754. sup: "",
  5755. table: ["width"],
  5756. tbody: "",
  5757. td: ["colspan", "height", "rowspan", "width"],
  5758. tfoot: "",
  5759. th: ["colspan", "height", "rowspan", "width"],
  5760. thead: "",
  5761. tr: ["colspan", "height", "rowspan", "width"],
  5762. tt: "",
  5763. u: "",
  5764. ul: ""
  5765. };
  5766. const CHARS = {
  5767. amp: "&",
  5768. gt: ">",
  5769. lt: "<",
  5770. nbsp: " ",
  5771. quot: '"',
  5772. apos: "'",
  5773. ldquo: "“",
  5774. rdquo: "”",
  5775. yen: "¥",
  5776. radic: "√",
  5777. lceil: "⌈",
  5778. rceil: "⌉",
  5779. lfloor: "⌊",
  5780. rfloor: "⌋",
  5781. hellip: "…"
  5782. };
  5783. function decodeEntities(htmlString) {
  5784. return htmlString.replace(
  5785. /&(([a-zA-Z]+)|(#x{0,1}[\da-zA-Z]+));/gi,
  5786. function(match, stage) {
  5787. if (shared.hasOwn(CHARS, stage) && CHARS[stage]) {
  5788. return CHARS[stage];
  5789. }
  5790. if (/^#[0-9]{1,4}$/.test(stage)) {
  5791. return String.fromCharCode(stage.slice(1));
  5792. }
  5793. if (/^#x[0-9a-f]{1,4}$/i.test(stage)) {
  5794. return String.fromCharCode(0 + stage.slice(1));
  5795. }
  5796. return match;
  5797. }
  5798. );
  5799. }
  5800. function processClickEvent(node, triggerItemClick) {
  5801. if (["a", "img"].includes(node.name) && triggerItemClick) {
  5802. return {
  5803. onClick: (e2) => {
  5804. triggerItemClick(e2, { node });
  5805. e2.stopPropagation();
  5806. e2.preventDefault();
  5807. e2.returnValue = false;
  5808. }
  5809. };
  5810. }
  5811. }
  5812. function normalizeAttrs(tagName, attrs) {
  5813. if (!shared.isPlainObject(attrs))
  5814. return;
  5815. for (const key in attrs) {
  5816. if (shared.hasOwn(attrs, key)) {
  5817. const value = attrs[key];
  5818. if (tagName === "img" && key === "src")
  5819. attrs[key] = getRealPath(value);
  5820. }
  5821. }
  5822. }
  5823. const nodeList2VNode = (scopeId, triggerItemClick, nodeList) => {
  5824. if (!nodeList || shared.isArray(nodeList) && !nodeList.length)
  5825. return [];
  5826. return nodeList.map((node) => {
  5827. var _a;
  5828. if (!shared.isPlainObject(node)) {
  5829. return;
  5830. }
  5831. if (!shared.hasOwn(node, "type") || node.type === "node") {
  5832. let nodeProps = { [scopeId]: "" };
  5833. const tagName = (_a = node.name) == null ? void 0 : _a.toLowerCase();
  5834. if (!shared.hasOwn(TAGS, tagName)) {
  5835. return;
  5836. }
  5837. normalizeAttrs(tagName, node.attrs);
  5838. nodeProps = shared.extend(
  5839. nodeProps,
  5840. processClickEvent(node, triggerItemClick),
  5841. node.attrs
  5842. );
  5843. return vue.h(
  5844. node.name,
  5845. nodeProps,
  5846. nodeList2VNode(scopeId, triggerItemClick, node.children)
  5847. );
  5848. }
  5849. if (node.type === "text" && shared.isString(node.text) && node.text !== "")
  5850. return vue.createTextVNode(decodeEntities(node.text || ""));
  5851. });
  5852. };
  5853. function removeDOCTYPE(html) {
  5854. return html.replace(/<\?xml.*\?>\n/, "").replace(/<!doctype.*>\n/, "").replace(/<!DOCTYPE.*>\n/, "");
  5855. }
  5856. function parseAttrs(attrs) {
  5857. return attrs.reduce(function(pre, attr2) {
  5858. let value = attr2.value;
  5859. const name = attr2.name;
  5860. if (value.match(/ /) && ["style", "src"].indexOf(name) === -1) {
  5861. value = value.split(" ");
  5862. }
  5863. if (pre[name]) {
  5864. if (Array.isArray(pre[name])) {
  5865. pre[name].push(value);
  5866. } else {
  5867. pre[name] = [pre[name], value];
  5868. }
  5869. } else {
  5870. pre[name] = value;
  5871. }
  5872. return pre;
  5873. }, {});
  5874. }
  5875. function parseHtml(html) {
  5876. html = removeDOCTYPE(html);
  5877. const stacks = [];
  5878. const results = {
  5879. node: "root",
  5880. children: []
  5881. };
  5882. HTMLParser(html, {
  5883. start: function(tag, attrs, unary) {
  5884. const node = {
  5885. name: tag
  5886. };
  5887. if (attrs.length !== 0) {
  5888. node.attrs = parseAttrs(attrs);
  5889. }
  5890. if (unary) {
  5891. const parent = stacks[0] || results;
  5892. if (!parent.children) {
  5893. parent.children = [];
  5894. }
  5895. parent.children.push(node);
  5896. } else {
  5897. stacks.unshift(node);
  5898. }
  5899. },
  5900. end: function(tag) {
  5901. const node = stacks.shift();
  5902. if (node.name !== tag)
  5903. console.error("invalid state: mismatch end tag");
  5904. if (stacks.length === 0) {
  5905. results.children.push(node);
  5906. } else {
  5907. const parent = stacks[0];
  5908. if (!parent.children) {
  5909. parent.children = [];
  5910. }
  5911. parent.children.push(node);
  5912. }
  5913. },
  5914. chars: function(text) {
  5915. const node = {
  5916. type: "text",
  5917. text
  5918. };
  5919. if (stacks.length === 0) {
  5920. results.children.push(node);
  5921. } else {
  5922. const parent = stacks[0];
  5923. if (!parent.children) {
  5924. parent.children = [];
  5925. }
  5926. parent.children.push(node);
  5927. }
  5928. },
  5929. comment: function(text) {
  5930. const node = {
  5931. node: "comment",
  5932. text
  5933. };
  5934. const parent = stacks[0];
  5935. if (parent) {
  5936. if (!parent.children) {
  5937. parent.children = [];
  5938. }
  5939. parent.children.push(node);
  5940. }
  5941. }
  5942. });
  5943. return results.children;
  5944. }
  5945. const props$h = {
  5946. nodes: {
  5947. type: [Array, String],
  5948. default: function() {
  5949. return [];
  5950. }
  5951. }
  5952. };
  5953. const index$o = /* @__PURE__ */ defineBuiltInComponent({
  5954. name: "RichText",
  5955. compatConfig: {
  5956. MODE: 3
  5957. },
  5958. props: props$h,
  5959. emits: ["click", "touchstart", "touchmove", "touchcancel", "touchend", "longpress", "itemclick"],
  5960. setup(props2, {
  5961. emit: emit2
  5962. }) {
  5963. const vm = vue.getCurrentInstance();
  5964. const scopeId = vm && vm.vnode.scopeId || "";
  5965. const rootRef = vue.ref(null);
  5966. const _vnode = vue.ref([]);
  5967. const trigger = useCustomEvent(rootRef, emit2);
  5968. function triggerItemClick(e2, detail = {}) {
  5969. trigger("itemclick", e2, detail);
  5970. }
  5971. function renderVNode() {
  5972. let nodeList = props2.nodes;
  5973. if (shared.isString(nodeList)) {
  5974. nodeList = parseHtml(props2.nodes);
  5975. }
  5976. _vnode.value = nodeList2VNode(scopeId, triggerItemClick, nodeList);
  5977. }
  5978. vue.watch(() => props2.nodes, renderVNode, {
  5979. immediate: true
  5980. });
  5981. return () => vue.h("uni-rich-text", {
  5982. ref: rootRef
  5983. }, vue.h("div", {}, _vnode.value));
  5984. }
  5985. });
  5986. const Refresher = /* @__PURE__ */ defineBuiltInComponent({
  5987. name: "Refresher",
  5988. props: {
  5989. refreshState: {
  5990. type: String,
  5991. default: ""
  5992. },
  5993. refresherHeight: {
  5994. type: Number,
  5995. default: 0
  5996. },
  5997. refresherThreshold: {
  5998. type: Number,
  5999. default: 45
  6000. },
  6001. refresherDefaultStyle: {
  6002. type: String,
  6003. default: "black"
  6004. },
  6005. refresherBackground: {
  6006. type: String,
  6007. default: "transparent"
  6008. }
  6009. },
  6010. setup(props2, {
  6011. slots
  6012. }) {
  6013. const rootRef = vue.ref(null);
  6014. const rootStyle = vue.computed(() => {
  6015. const style = {
  6016. backgroundColor: props2.refresherBackground
  6017. };
  6018. switch (props2.refreshState) {
  6019. case "pulling":
  6020. style.height = props2.refresherHeight + "px";
  6021. break;
  6022. case "refreshing":
  6023. style.height = props2.refresherThreshold + "px";
  6024. style.transition = "height 0.3s";
  6025. break;
  6026. case "":
  6027. case "refresherabort":
  6028. case "restore":
  6029. style.height = "0px";
  6030. style.transition = "height 0.3s";
  6031. break;
  6032. }
  6033. return style;
  6034. });
  6035. const refreshRotate = vue.computed(() => {
  6036. const route = props2.refresherHeight / props2.refresherThreshold;
  6037. return (route > 1 ? 1 : route) * 360;
  6038. });
  6039. return () => {
  6040. const {
  6041. refreshState,
  6042. refresherDefaultStyle,
  6043. refresherThreshold
  6044. } = props2;
  6045. return vue.createVNode("div", {
  6046. "ref": rootRef,
  6047. "style": rootStyle.value,
  6048. "class": "uni-scroll-view-refresher"
  6049. }, [refresherDefaultStyle !== "none" ? vue.createVNode("div", {
  6050. "class": "uni-scroll-view-refresh"
  6051. }, [vue.createVNode("div", {
  6052. "class": "uni-scroll-view-refresh-inner"
  6053. }, [refreshState == "pulling" ? vue.createVNode("svg", {
  6054. "key": "refresh__icon",
  6055. "style": {
  6056. transform: "rotate(" + refreshRotate.value + "deg)"
  6057. },
  6058. "fill": "#2BD009",
  6059. "class": "uni-scroll-view-refresh__icon",
  6060. "width": "24",
  6061. "height": "24",
  6062. "viewBox": "0 0 24 24"
  6063. }, [vue.createVNode("path", {
  6064. "d": "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
  6065. }, null), vue.createVNode("path", {
  6066. "d": "M0 0h24v24H0z",
  6067. "fill": "none"
  6068. }, null)], 4) : null, refreshState == "refreshing" ? vue.createVNode("svg", {
  6069. "key": "refresh__spinner",
  6070. "class": "uni-scroll-view-refresh__spinner",
  6071. "width": "24",
  6072. "height": "24",
  6073. "viewBox": "25 25 50 50"
  6074. }, [vue.createVNode("circle", {
  6075. "cx": "50",
  6076. "cy": "50",
  6077. "r": "20",
  6078. "fill": "none",
  6079. "style": "color: #2bd009",
  6080. "stroke-width": "3"
  6081. }, null)]) : null])]) : null, refresherDefaultStyle === "none" ? vue.createVNode("div", {
  6082. "class": "uni-scroll-view-refresher-container",
  6083. "style": {
  6084. height: `${refresherThreshold}px`
  6085. }
  6086. }, [slots.default && slots.default()]) : null], 4);
  6087. };
  6088. }
  6089. });
  6090. const props$g = {
  6091. direction: {
  6092. type: [String],
  6093. default: "vertical"
  6094. },
  6095. scrollX: {
  6096. type: [Boolean, String],
  6097. default: false
  6098. },
  6099. scrollY: {
  6100. type: [Boolean, String],
  6101. default: false
  6102. },
  6103. showScrollbar: {
  6104. type: [Boolean, String],
  6105. default: true
  6106. },
  6107. upperThreshold: {
  6108. type: [Number, String],
  6109. default: 50
  6110. },
  6111. lowerThreshold: {
  6112. type: [Number, String],
  6113. default: 50
  6114. },
  6115. scrollTop: {
  6116. type: [Number, String],
  6117. default: 0
  6118. },
  6119. scrollLeft: {
  6120. type: [Number, String],
  6121. default: 0
  6122. },
  6123. scrollIntoView: {
  6124. type: String,
  6125. default: ""
  6126. },
  6127. scrollWithAnimation: {
  6128. type: [Boolean, String],
  6129. default: false
  6130. },
  6131. enableBackToTop: {
  6132. type: [Boolean, String],
  6133. default: false
  6134. },
  6135. refresherEnabled: {
  6136. type: [Boolean, String],
  6137. default: false
  6138. },
  6139. refresherThreshold: {
  6140. type: Number,
  6141. default: 45
  6142. },
  6143. refresherDefaultStyle: {
  6144. type: String,
  6145. default: "black"
  6146. },
  6147. refresherBackground: {
  6148. type: String,
  6149. default: "transparent"
  6150. },
  6151. refresherTriggered: {
  6152. type: [Boolean, String],
  6153. default: false
  6154. }
  6155. };
  6156. const index$n = /* @__PURE__ */ defineBuiltInComponent({
  6157. name: "ScrollView",
  6158. compatConfig: {
  6159. MODE: 3
  6160. },
  6161. props: props$g,
  6162. emits: ["scroll", "scrolltoupper", "scrolltolower", "refresherrefresh", "refresherrestore", "refresherpulling", "refresherabort", "update:refresherTriggered"],
  6163. setup(props2, {
  6164. emit: emit2,
  6165. slots,
  6166. expose
  6167. }) {
  6168. const rootRef = vue.ref(null);
  6169. const main = vue.ref(null);
  6170. const wrap = vue.ref(null);
  6171. const content = vue.ref(null);
  6172. const trigger = useCustomEvent(rootRef, emit2);
  6173. const {
  6174. state,
  6175. scrollTopNumber,
  6176. scrollLeftNumber
  6177. } = useScrollViewState(props2);
  6178. const {
  6179. realScrollX,
  6180. realScrollY,
  6181. _scrollLeftChanged,
  6182. _scrollTopChanged
  6183. } = useScrollViewLoader(props2, state, scrollTopNumber, scrollLeftNumber, trigger, rootRef, main, content, emit2);
  6184. const mainStyle = vue.computed(() => {
  6185. let style = "";
  6186. realScrollX.value ? style += "overflow-x:auto;" : style += "overflow-x:hidden;";
  6187. realScrollY.value ? style += "overflow-y:auto;" : style += "overflow-y:hidden;";
  6188. return style;
  6189. });
  6190. const scrollBarClassName = vue.computed(() => {
  6191. let className = "uni-scroll-view";
  6192. if (props2.showScrollbar === false) {
  6193. className += " uni-scroll-view-scrollbar-hidden";
  6194. }
  6195. return className;
  6196. });
  6197. expose({
  6198. // 自动化测试需要暴露main从而获取scrollLeft
  6199. $getMain() {
  6200. return main.value;
  6201. }
  6202. });
  6203. return () => {
  6204. const {
  6205. refresherEnabled,
  6206. refresherBackground,
  6207. refresherDefaultStyle,
  6208. refresherThreshold
  6209. } = props2;
  6210. const {
  6211. refresherHeight,
  6212. refreshState
  6213. } = state;
  6214. return vue.createVNode("uni-scroll-view", {
  6215. "ref": rootRef
  6216. }, [vue.createVNode("div", {
  6217. "ref": wrap,
  6218. "class": "uni-scroll-view"
  6219. }, [vue.createVNode("div", {
  6220. "ref": main,
  6221. "style": mainStyle.value,
  6222. "class": scrollBarClassName.value
  6223. }, [refresherEnabled ? vue.createVNode(Refresher, {
  6224. "refreshState": refreshState,
  6225. "refresherHeight": refresherHeight,
  6226. "refresherThreshold": refresherThreshold,
  6227. "refresherDefaultStyle": refresherDefaultStyle,
  6228. "refresherBackground": refresherBackground
  6229. }, {
  6230. default: () => [refresherDefaultStyle == "none" ? slots.refresher && slots.refresher() : null]
  6231. }, 8, ["refreshState", "refresherHeight", "refresherThreshold", "refresherDefaultStyle", "refresherBackground"]) : null, vue.createVNode("div", {
  6232. "ref": content,
  6233. "class": "uni-scroll-view-content"
  6234. }, [slots.default && slots.default()], 512)], 6)], 512)], 512);
  6235. };
  6236. }
  6237. });
  6238. function useScrollViewState(props2) {
  6239. const scrollTopNumber = vue.computed(() => {
  6240. return Number(props2.scrollTop) || 0;
  6241. });
  6242. const scrollLeftNumber = vue.computed(() => {
  6243. return Number(props2.scrollLeft) || 0;
  6244. });
  6245. const state = vue.reactive({
  6246. lastScrollTop: scrollTopNumber.value,
  6247. lastScrollLeft: scrollLeftNumber.value,
  6248. lastScrollToUpperTime: 0,
  6249. lastScrollToLowerTime: 0,
  6250. refresherHeight: 0,
  6251. refreshState: ""
  6252. });
  6253. return {
  6254. state,
  6255. scrollTopNumber,
  6256. scrollLeftNumber
  6257. };
  6258. }
  6259. function useScrollViewLoader(props2, state, scrollTopNumber, scrollLeftNumber, trigger, rootRef, main, content, emit2) {
  6260. let beforeRefreshing = false;
  6261. let triggerAbort = false;
  6262. let __transitionEnd = () => {
  6263. };
  6264. const realScrollX = vue.computed(() => {
  6265. if (props2.direction === "horizontal" || props2.direction === "all") {
  6266. return true;
  6267. }
  6268. return false;
  6269. });
  6270. const realScrollY = vue.computed(() => {
  6271. if (props2.direction === "vertical" || props2.direction === "all") {
  6272. return true;
  6273. }
  6274. return false;
  6275. });
  6276. vue.computed(() => {
  6277. let val = Number(props2.upperThreshold);
  6278. return isNaN(val) ? 50 : val;
  6279. });
  6280. vue.computed(() => {
  6281. let val = Number(props2.lowerThreshold);
  6282. return isNaN(val) ? 50 : val;
  6283. });
  6284. function scrollTo(scrollToValue, direction) {
  6285. const container = main.value;
  6286. let transformValue = 0;
  6287. let transform = "";
  6288. scrollToValue < 0 ? scrollToValue = 0 : direction === "x" && scrollToValue > container.scrollWidth - container.offsetWidth ? scrollToValue = container.scrollWidth - container.offsetWidth : direction === "y" && scrollToValue > container.scrollHeight - container.offsetHeight && (scrollToValue = container.scrollHeight - container.offsetHeight);
  6289. direction === "x" ? transformValue = container.scrollLeft - scrollToValue : direction === "y" && (transformValue = container.scrollTop - scrollToValue);
  6290. if (transformValue === 0)
  6291. return;
  6292. let _content = content.value;
  6293. _content.style.transition = "transform .3s ease-out";
  6294. _content.style.webkitTransition = "-webkit-transform .3s ease-out";
  6295. if (direction === "x") {
  6296. transform = "translateX(" + transformValue + "px) translateZ(0)";
  6297. } else {
  6298. direction === "y" && (transform = "translateY(" + transformValue + "px) translateZ(0)");
  6299. }
  6300. _content.removeEventListener("transitionend", __transitionEnd);
  6301. _content.removeEventListener("webkitTransitionEnd", __transitionEnd);
  6302. __transitionEnd = () => _transitionEnd(scrollToValue, direction);
  6303. _content.addEventListener("transitionend", __transitionEnd);
  6304. _content.addEventListener("webkitTransitionEnd", __transitionEnd);
  6305. if (direction === "x") {
  6306. container.style.overflowX = "hidden";
  6307. } else if (direction === "y") {
  6308. container.style.overflowY = "hidden";
  6309. }
  6310. _content.style.transform = transform;
  6311. _content.style.webkitTransform = transform;
  6312. }
  6313. function _scrollTopChanged(val) {
  6314. if (realScrollY.value) {
  6315. {
  6316. if (props2.scrollWithAnimation) {
  6317. scrollTo(val, "y");
  6318. } else {
  6319. main.value.scrollTop = val;
  6320. }
  6321. }
  6322. }
  6323. }
  6324. function _scrollLeftChanged(val) {
  6325. if (realScrollX.value) {
  6326. {
  6327. if (props2.scrollWithAnimation) {
  6328. scrollTo(val, "x");
  6329. } else {
  6330. main.value.scrollLeft = val;
  6331. }
  6332. }
  6333. }
  6334. }
  6335. function _scrollIntoViewChanged(val) {
  6336. if (val) {
  6337. if (!/^[_a-zA-Z][-_a-zA-Z0-9:]*$/.test(val)) {
  6338. console.error(`id error: scroll-into-view=${val}`);
  6339. return;
  6340. }
  6341. let element = rootRef.value.querySelector("#" + val);
  6342. if (element) {
  6343. let mainRect = main.value.getBoundingClientRect();
  6344. let elRect = element.getBoundingClientRect();
  6345. if (realScrollX.value) {
  6346. let left = elRect.left - mainRect.left;
  6347. let scrollLeft = main.value.scrollLeft;
  6348. let x = scrollLeft + left;
  6349. if (props2.scrollWithAnimation) {
  6350. scrollTo(x, "x");
  6351. } else {
  6352. main.value.scrollLeft = x;
  6353. }
  6354. }
  6355. if (realScrollY.value) {
  6356. let top = elRect.top - mainRect.top;
  6357. let scrollTop = main.value.scrollTop;
  6358. let y = scrollTop + top;
  6359. if (props2.scrollWithAnimation) {
  6360. scrollTo(y, "y");
  6361. } else {
  6362. main.value.scrollTop = y;
  6363. }
  6364. }
  6365. }
  6366. }
  6367. }
  6368. function _transitionEnd(val, direction) {
  6369. content.value.style.transition = "";
  6370. content.value.style.webkitTransition = "";
  6371. content.value.style.transform = "";
  6372. content.value.style.webkitTransform = "";
  6373. let _main = main.value;
  6374. if (direction === "x") {
  6375. _main.style.overflowX = realScrollX.value ? "auto" : "hidden";
  6376. _main.scrollLeft = val;
  6377. } else if (direction === "y") {
  6378. _main.style.overflowY = realScrollY.value ? "auto" : "hidden";
  6379. _main.scrollTop = val;
  6380. }
  6381. content.value.removeEventListener("transitionend", __transitionEnd);
  6382. content.value.removeEventListener("webkitTransitionEnd", __transitionEnd);
  6383. }
  6384. function _setRefreshState(_state) {
  6385. if (!props2.refresherEnabled)
  6386. return;
  6387. switch (_state) {
  6388. case "refreshing":
  6389. state.refresherHeight = props2.refresherThreshold;
  6390. if (!beforeRefreshing) {
  6391. beforeRefreshing = true;
  6392. trigger("refresherpulling", {}, {
  6393. deltaY: state.refresherHeight,
  6394. dy: state.refresherHeight
  6395. });
  6396. trigger("refresherrefresh", {}, {
  6397. dy: touchEnd.y - touchStart.y
  6398. });
  6399. emit2("update:refresherTriggered", true);
  6400. }
  6401. break;
  6402. case "restore":
  6403. case "refresherabort":
  6404. beforeRefreshing = false;
  6405. state.refresherHeight = 0;
  6406. if (_state === "restore") {
  6407. triggerAbort = false;
  6408. trigger("refresherrestore", {}, {
  6409. dy: touchEnd.y - touchStart.y
  6410. });
  6411. }
  6412. if (_state === "refresherabort" && triggerAbort) {
  6413. triggerAbort = false;
  6414. trigger("refresherabort", {}, {
  6415. dy: touchEnd.y - touchStart.y
  6416. });
  6417. }
  6418. break;
  6419. }
  6420. state.refreshState = _state;
  6421. }
  6422. let touchStart = {
  6423. x: 0,
  6424. y: 0
  6425. };
  6426. let touchEnd = {
  6427. x: 0,
  6428. y: props2.refresherThreshold
  6429. };
  6430. vue.watch(scrollTopNumber, (val) => {
  6431. _scrollTopChanged(val);
  6432. });
  6433. vue.watch(scrollLeftNumber, (val) => {
  6434. _scrollLeftChanged(val);
  6435. });
  6436. vue.watch(() => props2.scrollIntoView, (val) => {
  6437. _scrollIntoViewChanged(val);
  6438. });
  6439. vue.watch(() => props2.refresherTriggered, (val) => {
  6440. if (val === true) {
  6441. _setRefreshState("refreshing");
  6442. } else if (val === false) {
  6443. _setRefreshState("restore");
  6444. }
  6445. });
  6446. return {
  6447. realScrollX,
  6448. realScrollY,
  6449. _scrollTopChanged,
  6450. _scrollLeftChanged
  6451. };
  6452. }
  6453. const SLIDER_BLOCK_SIZE_MIN_VALUE = 12;
  6454. const SLIDER_BLOCK_SIZE_MAX_VALUE = 28;
  6455. const props$f = {
  6456. name: {
  6457. type: String,
  6458. default: ""
  6459. },
  6460. min: {
  6461. type: [Number, String],
  6462. default: 0
  6463. },
  6464. max: {
  6465. type: [Number, String],
  6466. default: 100
  6467. },
  6468. value: {
  6469. type: [Number, String],
  6470. default: 0
  6471. },
  6472. step: {
  6473. type: [Number, String],
  6474. default: 1
  6475. },
  6476. disabled: {
  6477. type: [Boolean, String],
  6478. default: false
  6479. },
  6480. color: {
  6481. type: String,
  6482. default: "#e9e9e9"
  6483. },
  6484. backgroundColor: {
  6485. type: String,
  6486. default: "#e9e9e9"
  6487. },
  6488. // 优先级高于 activeColor
  6489. activeBackgroundColor: {
  6490. type: String,
  6491. default: ""
  6492. },
  6493. activeColor: {
  6494. type: String,
  6495. default: "#007aff"
  6496. },
  6497. selectedColor: {
  6498. type: String,
  6499. default: "#007aff"
  6500. },
  6501. blockColor: {
  6502. type: String,
  6503. default: "#ffffff"
  6504. },
  6505. // 优先级高于blockColor
  6506. foreColor: {
  6507. type: String,
  6508. default: ""
  6509. },
  6510. valueColor: {
  6511. type: String,
  6512. default: "#888888"
  6513. },
  6514. blockSize: {
  6515. type: [Number, String],
  6516. default: 28
  6517. },
  6518. showValue: {
  6519. type: [Boolean, String],
  6520. default: false
  6521. }
  6522. };
  6523. const indexX$2 = /* @__PURE__ */ defineBuiltInComponent({
  6524. name: "Slider",
  6525. props: props$f,
  6526. emits: ["changing", "change"],
  6527. setup(props2, {
  6528. emit: emit2
  6529. }) {
  6530. const sliderRef = vue.ref(null);
  6531. const sliderValueRef = vue.ref(null);
  6532. let uniSliderElement;
  6533. vue.watch(() => props2.value, (val) => {
  6534. uniSliderElement.value = Number(val);
  6535. });
  6536. const trigger = useCustomEvent(sliderRef, emit2);
  6537. const state = useSliderState(props2);
  6538. const {
  6539. _onInput,
  6540. _onChange
  6541. } = useSliderLoader(props2, sliderRef, trigger);
  6542. return () => {
  6543. const {
  6544. setTrackBgColor,
  6545. setActiveColor,
  6546. setThumbStyle,
  6547. thumbTrackStyle,
  6548. setValueStyle
  6549. } = state;
  6550. return vue.createVNode("uni-slider", {
  6551. "ref": sliderRef
  6552. }, [vue.createVNode("div", {
  6553. "class": "uni-slider-wrapper"
  6554. }, [vue.createVNode("div", {
  6555. "class": "uni-slider-input"
  6556. }, [vue.createVNode("div", {
  6557. "style": setTrackBgColor.value,
  6558. "class": "uni-slider-track"
  6559. }, [vue.createVNode("div", {
  6560. "style": setActiveColor.value,
  6561. "class": "uni-slider-track-value"
  6562. }, null, 4)], 4), vue.createVNode("div", {
  6563. "style": thumbTrackStyle.value,
  6564. "class": "uni-slider-thumb-track"
  6565. }, [vue.createVNode("div", {
  6566. "style": setThumbStyle.value,
  6567. "class": "uni-slider-thumb-value"
  6568. }, null, 4)], 4), vue.createVNode("input", {
  6569. "class": "uni-slider-browser-input-range",
  6570. "type": "range",
  6571. "min": props2.min,
  6572. "max": props2.max,
  6573. "step": props2.step,
  6574. "value": props2.value,
  6575. "onInput": withWebEvent(_onInput),
  6576. "onChange": withWebEvent(_onChange)
  6577. }, null, 40, ["min", "max", "step", "value", "onInput", "onChange"])]), vue.withDirectives(vue.createVNode("span", {
  6578. "ref": sliderValueRef,
  6579. "style": setValueStyle.value,
  6580. "class": "uni-slider-value"
  6581. }, null, 4), [[vue.vShow, props2.showValue]])]), vue.createVNode("slot", null, null)], 512);
  6582. };
  6583. }
  6584. });
  6585. function useSliderState(props2) {
  6586. const _getBgColor = () => {
  6587. return props2.backgroundColor !== "#e9e9e9" ? props2.backgroundColor : props2.color !== "#007aff" ? props2.color : "#007aff";
  6588. };
  6589. const _getActiveColor = () => {
  6590. const activeColor = props2.activeBackgroundColor || props2.activeColor;
  6591. return activeColor !== "#007aff" ? activeColor : props2.selectedColor !== "#e9e9e9" ? props2.selectedColor : "#e9e9e9";
  6592. };
  6593. const _getBlockSizeString = () => {
  6594. const blockSize = Math.min(Math.max(Number(props2.blockSize), SLIDER_BLOCK_SIZE_MIN_VALUE), SLIDER_BLOCK_SIZE_MAX_VALUE);
  6595. return blockSize + "px";
  6596. };
  6597. const state = {
  6598. setTrackBgColor: vue.computed(() => ({
  6599. backgroundColor: _getBgColor()
  6600. })),
  6601. setActiveColor: vue.computed(() => ({
  6602. backgroundColor: _getActiveColor()
  6603. })),
  6604. thumbTrackStyle: vue.computed(() => ({
  6605. marginRight: _getBlockSizeString()
  6606. })),
  6607. setThumbStyle: vue.computed(() => ({
  6608. width: _getBlockSizeString(),
  6609. height: _getBlockSizeString(),
  6610. backgroundColor: props2.foreColor || props2.blockColor
  6611. })),
  6612. setValueStyle: vue.computed(() => ({
  6613. color: props2.valueColor
  6614. }))
  6615. };
  6616. return state;
  6617. }
  6618. function useSliderLoader(props2, sliderRef, trigger) {
  6619. const _onInput = (event) => {
  6620. if (props2.disabled) {
  6621. return;
  6622. }
  6623. const valueNumber = Number(event.target.value);
  6624. sliderRef.value.updateValue(valueNumber);
  6625. trigger("changing", event, {
  6626. value: valueNumber
  6627. });
  6628. };
  6629. const _onChange = (event) => {
  6630. if (props2.disabled) {
  6631. return;
  6632. }
  6633. const valueNumber = Number(event.target.value);
  6634. sliderRef.value.updateValue(valueNumber);
  6635. trigger("change", event, {
  6636. value: valueNumber
  6637. });
  6638. };
  6639. const uniForm = vue.inject(uniFormKey, false);
  6640. if (!!uniForm) {
  6641. const field = {
  6642. reset: () => {
  6643. sliderRef.value.reset();
  6644. },
  6645. submit: () => {
  6646. const data = ["", null];
  6647. const value = sliderRef.value.value;
  6648. if (props2.name !== "") {
  6649. data[0] = props2.name;
  6650. data[1] = value;
  6651. }
  6652. return data;
  6653. }
  6654. };
  6655. uniForm.addField(field);
  6656. }
  6657. return {
  6658. _onInput,
  6659. _onChange
  6660. };
  6661. }
  6662. const props$e = {
  6663. indicatorDots: {
  6664. type: [Boolean, String],
  6665. default: false
  6666. },
  6667. vertical: {
  6668. type: [Boolean, String],
  6669. default: false
  6670. },
  6671. autoplay: {
  6672. type: [Boolean, String],
  6673. default: false
  6674. },
  6675. circular: {
  6676. type: [Boolean, String],
  6677. default: false
  6678. },
  6679. interval: {
  6680. type: [Number, String],
  6681. default: 5e3
  6682. },
  6683. duration: {
  6684. type: [Number, String],
  6685. default: 500
  6686. },
  6687. current: {
  6688. type: [Number, String],
  6689. default: 0
  6690. },
  6691. indicatorColor: {
  6692. type: String,
  6693. default: ""
  6694. },
  6695. indicatorActiveColor: {
  6696. type: String,
  6697. default: ""
  6698. },
  6699. previousMargin: {
  6700. type: String,
  6701. default: ""
  6702. },
  6703. nextMargin: {
  6704. type: String,
  6705. default: ""
  6706. },
  6707. currentItemId: {
  6708. type: String,
  6709. default: ""
  6710. },
  6711. skipHiddenItemLayout: {
  6712. type: [Boolean, String],
  6713. default: false
  6714. },
  6715. displayMultipleItems: {
  6716. type: [Number, String],
  6717. default: 1
  6718. },
  6719. disableTouch: {
  6720. type: [Boolean, String],
  6721. default: false
  6722. },
  6723. navigation: {
  6724. type: [Boolean, String],
  6725. default: false
  6726. },
  6727. navigationColor: {
  6728. type: String,
  6729. default: "#fff"
  6730. },
  6731. navigationActiveColor: {
  6732. type: String,
  6733. default: "rgba(53, 53, 53, 0.6)"
  6734. }
  6735. };
  6736. function useState$1(props2) {
  6737. const interval = vue.computed(() => {
  6738. const interval2 = Number(props2.interval);
  6739. return isNaN(interval2) ? 5e3 : interval2;
  6740. });
  6741. const duration = vue.computed(() => {
  6742. const duration2 = Number(props2.duration);
  6743. return isNaN(duration2) ? 500 : duration2;
  6744. });
  6745. const displayMultipleItems = vue.computed(() => {
  6746. const displayMultipleItems2 = Math.round(props2.displayMultipleItems);
  6747. return isNaN(displayMultipleItems2) ? 1 : displayMultipleItems2;
  6748. });
  6749. const state = vue.reactive({
  6750. interval,
  6751. duration,
  6752. displayMultipleItems,
  6753. current: Math.round(props2.current) || 0,
  6754. currentItemId: props2.currentItemId,
  6755. userTracking: false
  6756. });
  6757. return state;
  6758. }
  6759. function useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger) {
  6760. function cancelSchedule() {
  6761. if (timer) {
  6762. clearTimeout(timer);
  6763. timer = null;
  6764. }
  6765. }
  6766. let timer = null;
  6767. let invalid = true;
  6768. let viewportPosition = 0;
  6769. let viewportMoveRatio = 1;
  6770. let animating = null;
  6771. let requestedAnimation = false;
  6772. let contentTrackViewport = 0;
  6773. let transitionStart;
  6774. let currentChangeSource = "";
  6775. const swiperEnabled = vue.computed(() => swiperContexts.value.length > state.displayMultipleItems);
  6776. const circularEnabled = vue.computed(() => props2.circular && swiperEnabled.value);
  6777. function checkCircularLayout(index2) {
  6778. if (!invalid) {
  6779. for (let items = swiperContexts.value, n = items.length, i = index2 + state.displayMultipleItems, r = 0; r < n; r++) {
  6780. const item = items[r];
  6781. const s = Math.floor(index2 / n) * n + r;
  6782. const l = s + n;
  6783. const c = s - n;
  6784. const u = Math.max(index2 - (s + 1), s - i, 0);
  6785. const d = Math.max(index2 - (l + 1), l - i, 0);
  6786. const h = Math.max(index2 - (c + 1), c - i, 0);
  6787. const p2 = Math.min(u, d, h);
  6788. const position = [s, l, c][[u, d, h].indexOf(p2)];
  6789. item.updatePosition(position, props2.vertical);
  6790. }
  6791. }
  6792. }
  6793. function updateViewport(index2) {
  6794. if (!(Math.floor(2 * viewportPosition) === Math.floor(2 * index2) && Math.ceil(2 * viewportPosition) === Math.ceil(2 * index2))) {
  6795. if (circularEnabled.value) {
  6796. checkCircularLayout(index2);
  6797. }
  6798. }
  6799. const x = props2.vertical ? "0" : 100 * -index2 * viewportMoveRatio + "%";
  6800. const y = props2.vertical ? 100 * -index2 * viewportMoveRatio + "%" : "0";
  6801. const transform = "translate(" + x + ", " + y + ") translateZ(0)";
  6802. const slideFrame = slideFrameRef.value;
  6803. if (slideFrame) {
  6804. slideFrame.style.webkitTransform = transform;
  6805. slideFrame.style.transform = transform;
  6806. }
  6807. viewportPosition = index2;
  6808. if (!transitionStart) {
  6809. if (index2 % 1 === 0) {
  6810. return;
  6811. }
  6812. transitionStart = index2;
  6813. }
  6814. index2 -= Math.floor(transitionStart);
  6815. const items = swiperContexts.value;
  6816. if (index2 <= -(items.length - 1)) {
  6817. index2 += items.length;
  6818. } else if (index2 >= items.length) {
  6819. index2 -= items.length;
  6820. }
  6821. index2 = transitionStart % 1 > 0.5 || transitionStart < 0 ? index2 - 1 : index2;
  6822. trigger("transition", {}, {
  6823. dx: props2.vertical ? 0 : index2 * slideFrame.offsetWidth,
  6824. dy: props2.vertical ? index2 * slideFrame.offsetHeight : 0
  6825. });
  6826. }
  6827. function endViewportAnimation() {
  6828. if (animating) {
  6829. updateViewport(animating.toPos);
  6830. animating = null;
  6831. }
  6832. }
  6833. function normalizeCurrentValue(current) {
  6834. const length = swiperContexts.value.length;
  6835. if (!length) {
  6836. return -1;
  6837. }
  6838. const index2 = (Math.round(current) % length + length) % length;
  6839. if (circularEnabled.value) {
  6840. if (length <= state.displayMultipleItems) {
  6841. return 0;
  6842. }
  6843. } else if (index2 > length - state.displayMultipleItems) {
  6844. return length - state.displayMultipleItems;
  6845. }
  6846. return index2;
  6847. }
  6848. function cancelViewportAnimation() {
  6849. animating = null;
  6850. }
  6851. function animateFrameFuncProto() {
  6852. if (!animating) {
  6853. requestedAnimation = false;
  6854. return;
  6855. }
  6856. const _animating = animating;
  6857. const toPos = _animating.toPos;
  6858. const acc = _animating.acc;
  6859. const endTime = _animating.endTime;
  6860. const source = _animating.source;
  6861. const time = endTime - Date.now();
  6862. if (time <= 0) {
  6863. updateViewport(toPos);
  6864. animating = null;
  6865. requestedAnimation = false;
  6866. transitionStart = null;
  6867. const item = swiperContexts.value[state.current];
  6868. if (item) {
  6869. const currentItemId = item.getItemId();
  6870. trigger("animationfinish", {}, {
  6871. current: state.current,
  6872. currentItemId,
  6873. source
  6874. });
  6875. }
  6876. return;
  6877. }
  6878. const s = acc * time * time / 2;
  6879. const l = toPos + s;
  6880. updateViewport(l);
  6881. requestAnimationFrame(animateFrameFuncProto);
  6882. }
  6883. function animateViewport(current, source, n) {
  6884. cancelViewportAnimation();
  6885. const duration = state.duration;
  6886. const length = swiperContexts.value.length;
  6887. let position = viewportPosition;
  6888. if (circularEnabled.value) {
  6889. if (n < 0) {
  6890. for (; position < current; ) {
  6891. position += length;
  6892. }
  6893. for (; position - length > current; ) {
  6894. position -= length;
  6895. }
  6896. } else if (n > 0) {
  6897. for (; position > current; ) {
  6898. position -= length;
  6899. }
  6900. for (; position + length < current; ) {
  6901. position += length;
  6902. }
  6903. if (position + length - current < current - position) {
  6904. position += length;
  6905. }
  6906. } else {
  6907. for (; position + length < current; ) {
  6908. position += length;
  6909. }
  6910. for (; position - length > current; ) {
  6911. position -= length;
  6912. }
  6913. if (position + length - current < current - position) {
  6914. position += length;
  6915. }
  6916. }
  6917. } else if (source === "click") {
  6918. current = current + state.displayMultipleItems - 1 < length ? current : 0;
  6919. }
  6920. animating = {
  6921. toPos: current,
  6922. acc: 2 * (position - current) / (duration * duration),
  6923. endTime: Date.now() + duration,
  6924. source
  6925. };
  6926. if (!requestedAnimation) {
  6927. requestedAnimation = true;
  6928. requestAnimationFrame(animateFrameFuncProto);
  6929. }
  6930. }
  6931. function scheduleAutoplay() {
  6932. cancelSchedule();
  6933. const items = swiperContexts.value;
  6934. const callback = function() {
  6935. timer = null;
  6936. currentChangeSource = "autoplay";
  6937. if (circularEnabled.value) {
  6938. state.current = normalizeCurrentValue(state.current + 1);
  6939. } else {
  6940. state.current = state.current + state.displayMultipleItems < items.length ? state.current + 1 : 0;
  6941. }
  6942. animateViewport(state.current, "autoplay", circularEnabled.value ? 1 : 0);
  6943. timer = setTimeout(callback, state.interval);
  6944. };
  6945. if (!(invalid || items.length <= state.displayMultipleItems)) {
  6946. timer = setTimeout(callback, state.interval);
  6947. }
  6948. }
  6949. function resetLayout() {
  6950. cancelSchedule();
  6951. endViewportAnimation();
  6952. const items = swiperContexts.value;
  6953. for (let i = 0; i < items.length; i++) {
  6954. items[i].updatePosition(i, props2.vertical);
  6955. }
  6956. viewportMoveRatio = 1;
  6957. const slideFrameEl = slideFrameRef.value;
  6958. if (state.displayMultipleItems === 1 && items.length) {
  6959. const itemRect = items[0].getBoundingClientRect();
  6960. const slideFrameRect = slideFrameEl.getBoundingClientRect();
  6961. viewportMoveRatio = itemRect.width / slideFrameRect.width;
  6962. if (!(viewportMoveRatio > 0 && viewportMoveRatio < 1)) {
  6963. viewportMoveRatio = 1;
  6964. }
  6965. }
  6966. const position = viewportPosition;
  6967. viewportPosition = -2;
  6968. const current = state.current;
  6969. if (current >= 0) {
  6970. invalid = false;
  6971. if (state.userTracking) {
  6972. updateViewport(position + current - contentTrackViewport);
  6973. contentTrackViewport = current;
  6974. } else {
  6975. updateViewport(current);
  6976. if (props2.autoplay) {
  6977. scheduleAutoplay();
  6978. }
  6979. }
  6980. } else {
  6981. invalid = true;
  6982. updateViewport(-state.displayMultipleItems - 1);
  6983. }
  6984. }
  6985. vue.watch([() => props2.current, () => props2.currentItemId, () => [...swiperContexts.value]], () => {
  6986. let current = -1;
  6987. if (props2.currentItemId) {
  6988. for (let i = 0, items = swiperContexts.value; i < items.length; i++) {
  6989. const itemId = items[i].getItemId();
  6990. if (itemId === props2.currentItemId) {
  6991. current = i;
  6992. break;
  6993. }
  6994. }
  6995. }
  6996. if (current < 0) {
  6997. current = Math.round(props2.current) || 0;
  6998. }
  6999. current = current < 0 ? 0 : current;
  7000. if (state.current !== current) {
  7001. currentChangeSource = "";
  7002. state.current = current;
  7003. }
  7004. });
  7005. vue.watch([() => props2.vertical, () => circularEnabled.value, () => state.displayMultipleItems, () => [...swiperContexts.value]], resetLayout);
  7006. vue.watch(() => state.interval, () => {
  7007. if (timer) {
  7008. cancelSchedule();
  7009. scheduleAutoplay();
  7010. }
  7011. });
  7012. function currentChanged(current, history) {
  7013. const source = currentChangeSource;
  7014. currentChangeSource = "";
  7015. const items = swiperContexts.value;
  7016. if (!source) {
  7017. const length = items.length;
  7018. animateViewport(current, "", circularEnabled.value && history + (length - current) % length > length / 2 ? 1 : 0);
  7019. }
  7020. const item = items[current];
  7021. if (item) {
  7022. const currentItemId = state.currentItemId = item.getItemId();
  7023. trigger("change", {}, {
  7024. current: state.current,
  7025. currentItemId,
  7026. source
  7027. });
  7028. }
  7029. }
  7030. vue.watch(() => state.current, (val, oldVal) => {
  7031. currentChanged(val, oldVal);
  7032. emit2("update:current", val);
  7033. });
  7034. vue.watch(() => state.currentItemId, (val) => {
  7035. emit2("update:currentItemId", val);
  7036. });
  7037. function inintAutoplay(enable) {
  7038. if (enable) {
  7039. scheduleAutoplay();
  7040. } else {
  7041. cancelSchedule();
  7042. }
  7043. }
  7044. vue.watch(() => props2.autoplay && !state.userTracking, inintAutoplay);
  7045. inintAutoplay(props2.autoplay && !state.userTracking);
  7046. function onSwiperDotClick(index2) {
  7047. animateViewport(state.current = index2, currentChangeSource = "click", circularEnabled.value ? 1 : 0);
  7048. }
  7049. return {
  7050. onSwiperDotClick,
  7051. circularEnabled,
  7052. swiperEnabled
  7053. };
  7054. }
  7055. const index$m = /* @__PURE__ */ defineBuiltInComponent({
  7056. name: "Swiper",
  7057. props: props$e,
  7058. emits: ["change", "transition", "animationfinish", "update:current", "update:currentItemId"],
  7059. setup(props2, {
  7060. slots,
  7061. emit: emit2
  7062. }) {
  7063. const rootRef = vue.ref(null);
  7064. const trigger = useCustomEvent(rootRef, emit2);
  7065. const slidesWrapperRef = vue.ref(null);
  7066. const slideFrameRef = vue.ref(null);
  7067. const state = useState$1(props2);
  7068. const slidesStyle = vue.computed(() => {
  7069. let style = {};
  7070. if (props2.nextMargin || props2.previousMargin) {
  7071. style = props2.vertical ? {
  7072. left: 0,
  7073. right: 0,
  7074. top: rpx2px(props2.previousMargin, true),
  7075. bottom: rpx2px(props2.nextMargin, true)
  7076. } : {
  7077. top: 0,
  7078. bottom: 0,
  7079. left: rpx2px(props2.previousMargin, true),
  7080. right: rpx2px(props2.nextMargin, true)
  7081. };
  7082. }
  7083. return style;
  7084. });
  7085. const slideFrameStyle = vue.computed(() => {
  7086. const value = Math.abs(100 / state.displayMultipleItems) + "%";
  7087. return {
  7088. width: props2.vertical ? "100%" : value,
  7089. height: !props2.vertical ? "100%" : value
  7090. };
  7091. });
  7092. let swiperItems = [];
  7093. const originSwiperContexts = [];
  7094. const swiperContexts = vue.ref([]);
  7095. function updateSwiperContexts() {
  7096. const contexts = [];
  7097. for (let index2 = 0; index2 < swiperItems.length; index2++) {
  7098. let swiperItem = swiperItems[index2];
  7099. if (!(swiperItem instanceof Element)) {
  7100. swiperItem = swiperItem.el;
  7101. }
  7102. const swiperContext = originSwiperContexts.find((context) => swiperItem === context.rootRef.value);
  7103. if (swiperContext) {
  7104. contexts.push(vue.markRaw(swiperContext));
  7105. }
  7106. }
  7107. swiperContexts.value = contexts;
  7108. }
  7109. const addSwiperContext = function(swiperContext) {
  7110. originSwiperContexts.push(swiperContext);
  7111. updateSwiperContexts();
  7112. };
  7113. vue.provide("addSwiperContext", addSwiperContext);
  7114. const removeSwiperContext = function(swiperContext) {
  7115. const index2 = originSwiperContexts.indexOf(swiperContext);
  7116. if (index2 >= 0) {
  7117. originSwiperContexts.splice(index2, 1);
  7118. updateSwiperContexts();
  7119. }
  7120. };
  7121. vue.provide("removeSwiperContext", removeSwiperContext);
  7122. const {
  7123. onSwiperDotClick,
  7124. circularEnabled,
  7125. swiperEnabled
  7126. } = useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger);
  7127. let createNavigationTsx = () => null;
  7128. {
  7129. createNavigationTsx = useSwiperNavigation(rootRef, props2, state, onSwiperDotClick, swiperContexts, circularEnabled, swiperEnabled);
  7130. }
  7131. return () => {
  7132. const defaultSlots = slots.default && slots.default();
  7133. swiperItems = flatVNode(defaultSlots);
  7134. return vue.createVNode("uni-swiper", {
  7135. "ref": rootRef
  7136. }, [vue.createVNode("div", {
  7137. "ref": slidesWrapperRef,
  7138. "class": "uni-swiper-wrapper"
  7139. }, [vue.createVNode("div", {
  7140. "class": "uni-swiper-slides",
  7141. "style": slidesStyle.value
  7142. }, [vue.createVNode("div", {
  7143. "ref": slideFrameRef,
  7144. "class": "uni-swiper-slide-frame",
  7145. "style": slideFrameStyle.value
  7146. }, [defaultSlots], 4)], 4), props2.indicatorDots && vue.createVNode("div", {
  7147. "class": ["uni-swiper-dots", props2.vertical ? "uni-swiper-dots-vertical" : "uni-swiper-dots-horizontal"]
  7148. }, [swiperContexts.value.map((_, index2, array) => vue.createVNode("div", {
  7149. "onClick": () => onSwiperDotClick(index2),
  7150. "class": {
  7151. "uni-swiper-dot": true,
  7152. "uni-swiper-dot-active": index2 < state.current + state.displayMultipleItems && index2 >= state.current || index2 < state.current + state.displayMultipleItems - array.length
  7153. },
  7154. "style": {
  7155. background: index2 === state.current ? props2.indicatorActiveColor : props2.indicatorColor
  7156. }
  7157. }, null, 14, ["onClick"]))], 2), createNavigationTsx()], 512)], 512);
  7158. };
  7159. }
  7160. });
  7161. const useSwiperNavigation = (rootRef, props2, state, onSwiperDotClick, swiperContext, circularEnabled, swiperEnabled) => {
  7162. let isNavigationAuto = false;
  7163. let prevDisabled = false;
  7164. let nextDisabled = false;
  7165. let hideNavigation = vue.ref(false);
  7166. vue.watchEffect(() => {
  7167. isNavigationAuto = props2.navigation === "auto";
  7168. hideNavigation.value = props2.navigation !== true || isNavigationAuto;
  7169. swiperAddMouseEvent();
  7170. });
  7171. vue.watchEffect(() => {
  7172. const swiperItemLength = swiperContext.value.length;
  7173. const notCircular = !circularEnabled.value;
  7174. prevDisabled = state.current === 0 && notCircular;
  7175. nextDisabled = state.current === swiperItemLength - 1 && notCircular || notCircular && state.current + state.displayMultipleItems >= swiperItemLength;
  7176. if (!swiperEnabled.value) {
  7177. prevDisabled = true;
  7178. nextDisabled = true;
  7179. isNavigationAuto && (hideNavigation.value = true);
  7180. }
  7181. });
  7182. function navigationHover(event, type) {
  7183. const target = event.currentTarget;
  7184. if (!target)
  7185. return;
  7186. target.style.backgroundColor = type === "over" ? props2.navigationActiveColor : "";
  7187. }
  7188. const navigationAttr = {
  7189. onMouseover: (event) => navigationHover(event, "over"),
  7190. onMouseout: (event) => navigationHover(event, "out")
  7191. };
  7192. function navigationClick($event, type, disabled) {
  7193. $event.stopPropagation();
  7194. if (disabled)
  7195. return;
  7196. const swiperItemLength = swiperContext.value.length;
  7197. let _current = state.current;
  7198. switch (type) {
  7199. case "prev":
  7200. _current--;
  7201. if (_current < 0 && circularEnabled.value) {
  7202. _current = swiperItemLength - 1;
  7203. }
  7204. break;
  7205. case "next":
  7206. _current++;
  7207. if (_current >= swiperItemLength && circularEnabled.value) {
  7208. _current = 0;
  7209. }
  7210. break;
  7211. }
  7212. onSwiperDotClick(_current);
  7213. }
  7214. const createNavigationSVG = () => createSvgIconVNode(ICON_PATH_BACK, props2.navigationColor, 26);
  7215. let setHideNavigationTimer;
  7216. const _mousemove = (e2) => {
  7217. clearTimeout(setHideNavigationTimer);
  7218. const {
  7219. clientX,
  7220. clientY
  7221. } = e2;
  7222. const {
  7223. left,
  7224. right,
  7225. top,
  7226. bottom,
  7227. width,
  7228. height
  7229. } = rootRef.value.getBoundingClientRect();
  7230. let hide = false;
  7231. if (props2.vertical) {
  7232. hide = !(clientY - top < height / 3 || bottom - clientY < height / 3);
  7233. } else {
  7234. hide = !(clientX - left < width / 3 || right - clientX < width / 3);
  7235. }
  7236. if (hide) {
  7237. return setHideNavigationTimer = setTimeout(() => {
  7238. hideNavigation.value = hide;
  7239. }, 300);
  7240. }
  7241. hideNavigation.value = hide;
  7242. };
  7243. const _mouseleave = () => {
  7244. hideNavigation.value = true;
  7245. };
  7246. function swiperAddMouseEvent() {
  7247. if (rootRef.value) {
  7248. rootRef.value.removeEventListener("mousemove", _mousemove);
  7249. rootRef.value.removeEventListener("mouseleave", _mouseleave);
  7250. if (isNavigationAuto) {
  7251. rootRef.value.addEventListener("mousemove", _mousemove);
  7252. rootRef.value.addEventListener("mouseleave", _mouseleave);
  7253. }
  7254. }
  7255. }
  7256. function createNavigationTsx() {
  7257. const navigationClass = {
  7258. "uni-swiper-navigation-hide": hideNavigation.value,
  7259. "uni-swiper-navigation-vertical": props2.vertical
  7260. };
  7261. if (props2.navigation) {
  7262. return vue.createVNode(vue.Fragment, null, [vue.createVNode("div", vue.mergeProps({
  7263. "class": ["uni-swiper-navigation uni-swiper-navigation-prev", shared.extend({
  7264. "uni-swiper-navigation-disabled": prevDisabled
  7265. }, navigationClass)],
  7266. "onClick": (e2) => navigationClick(e2, "prev", prevDisabled)
  7267. }, navigationAttr), [createNavigationSVG()], 16, ["onClick"]), vue.createVNode("div", vue.mergeProps({
  7268. "class": ["uni-swiper-navigation uni-swiper-navigation-next", shared.extend({
  7269. "uni-swiper-navigation-disabled": nextDisabled
  7270. }, navigationClass)],
  7271. "onClick": (e2) => navigationClick(e2, "next", nextDisabled)
  7272. }, navigationAttr), [createNavigationSVG()], 16, ["onClick"])]);
  7273. }
  7274. return null;
  7275. }
  7276. return createNavigationTsx;
  7277. };
  7278. const props$d = {
  7279. itemId: {
  7280. type: String,
  7281. default: ""
  7282. }
  7283. };
  7284. const index$l = /* @__PURE__ */ defineBuiltInComponent({
  7285. name: "SwiperItem",
  7286. props: props$d,
  7287. setup(props2, {
  7288. slots
  7289. }) {
  7290. const rootRef = vue.ref(null);
  7291. return () => {
  7292. return vue.createVNode("uni-swiper-item", {
  7293. "ref": rootRef,
  7294. "style": {
  7295. position: "absolute",
  7296. width: "100%",
  7297. height: "100%"
  7298. }
  7299. }, [slots.default && slots.default()], 512);
  7300. };
  7301. }
  7302. });
  7303. const props$c = {
  7304. name: {
  7305. type: String,
  7306. default: ""
  7307. },
  7308. checked: {
  7309. type: [Boolean, String],
  7310. default: false
  7311. },
  7312. type: {
  7313. type: String,
  7314. default: "switch"
  7315. },
  7316. id: {
  7317. type: String,
  7318. default: ""
  7319. },
  7320. disabled: {
  7321. type: [Boolean, String],
  7322. default: false
  7323. },
  7324. color: {
  7325. type: String,
  7326. default: ""
  7327. },
  7328. backgroundColor: {
  7329. type: String,
  7330. default: "#e9e9ea"
  7331. },
  7332. activeBackgroundColor: {
  7333. type: String,
  7334. default: ""
  7335. },
  7336. foreColor: {
  7337. type: String,
  7338. default: ""
  7339. },
  7340. activeForeColor: {
  7341. type: String,
  7342. default: ""
  7343. }
  7344. };
  7345. const indexX$1 = /* @__PURE__ */ defineBuiltInComponent({
  7346. name: "Switch",
  7347. props: props$c,
  7348. emits: ["change"],
  7349. setup(props2, {
  7350. emit: emit2
  7351. }) {
  7352. const rootRef = vue.ref(null);
  7353. const switchChecked = vue.ref(props2.checked);
  7354. const uniLabel = useSwitchInject(rootRef, props2, switchChecked);
  7355. const trigger = useCustomEvent(rootRef, emit2);
  7356. vue.watch(() => props2.checked, (val) => {
  7357. switchChecked.value = val;
  7358. });
  7359. const _onClick = ($event) => {
  7360. if (props2.disabled) {
  7361. return;
  7362. }
  7363. switchChecked.value = !switchChecked.value;
  7364. trigger("change", $event, {
  7365. value: switchChecked.value
  7366. });
  7367. };
  7368. if (!!uniLabel) {
  7369. uniLabel.addHandler(_onClick);
  7370. }
  7371. let checkedCache = vue.ref(switchChecked.value);
  7372. vue.watch(() => switchChecked.value, (val) => {
  7373. checkedCache.value = val;
  7374. });
  7375. return () => {
  7376. const {
  7377. activeBackgroundColor,
  7378. activeForeColor,
  7379. backgroundColor,
  7380. color,
  7381. foreColor,
  7382. type
  7383. } = props2;
  7384. const booleanAttrs = useBooleanAttr(props2, "disabled");
  7385. const switchInputStyle = {};
  7386. const fixColor = activeBackgroundColor || color;
  7387. const bgColor = switchChecked.value ? fixColor : backgroundColor;
  7388. if (bgColor) {
  7389. switchInputStyle["backgroundColor"] = bgColor;
  7390. switchInputStyle["borderColor"] = bgColor;
  7391. }
  7392. const thumbStyle = {};
  7393. const fgColor = switchChecked.value ? activeForeColor : foreColor;
  7394. if (fgColor) {
  7395. thumbStyle["backgroundColor"] = fgColor;
  7396. }
  7397. let realCheckValue;
  7398. realCheckValue = checkedCache.value;
  7399. return vue.createVNode("uni-switch", vue.mergeProps({
  7400. "id": props2.id,
  7401. "ref": rootRef
  7402. }, booleanAttrs, {
  7403. "onClick": _onClick
  7404. }), [vue.createVNode("div", {
  7405. "class": "uni-switch-wrapper"
  7406. }, [vue.withDirectives(vue.createVNode("div", {
  7407. "class": ["uni-switch-input", [switchChecked.value ? "uni-switch-input-checked" : ""]],
  7408. "style": switchInputStyle
  7409. }, [vue.createVNode("div", {
  7410. "class": ["uni-switch-thumb", [switchChecked.value ? "uni-switch-thumb-checked" : ""]],
  7411. "style": thumbStyle
  7412. }, null, 6)], 6), [[vue.vShow, type === "switch"]]), vue.withDirectives(vue.createVNode("div", {
  7413. "class": "uni-checkbox-input"
  7414. }, [realCheckValue ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.color, 22) : ""], 512), [[vue.vShow, type === "checkbox"]])])], 16, ["id", "onClick"]);
  7415. };
  7416. }
  7417. });
  7418. function useSwitchInject(rootRef, props2, switchChecked) {
  7419. const initialCheckedValue = props2.checked;
  7420. const uniForm = vue.inject(uniFormKey, false);
  7421. const uniLabel = vue.inject(uniLabelKey, false);
  7422. const formField = {
  7423. submit: () => {
  7424. const data = ["", null];
  7425. if (props2.name) {
  7426. data[0] = props2.name;
  7427. data[1] = rootRef.value.checked;
  7428. }
  7429. return data;
  7430. },
  7431. reset: () => {
  7432. switchChecked.value = initialCheckedValue;
  7433. }
  7434. };
  7435. if (!!uniForm) {
  7436. uniForm.addField(formField);
  7437. }
  7438. return uniLabel;
  7439. }
  7440. const SPACE_UNICODE = {
  7441. ensp: " ",
  7442. emsp: " ",
  7443. nbsp: " "
  7444. };
  7445. function normalizeText(text, { space, decode }) {
  7446. let result = "";
  7447. let isEscape = false;
  7448. for (let char of text) {
  7449. if (space && SPACE_UNICODE[space] && char === " ") {
  7450. char = SPACE_UNICODE[space];
  7451. }
  7452. if (isEscape) {
  7453. if (char === "n") {
  7454. result += uniShared.LINEFEED;
  7455. } else if (char === "\\") {
  7456. result += "\\";
  7457. } else {
  7458. result += "\\" + char;
  7459. }
  7460. isEscape = false;
  7461. } else {
  7462. if (char === "\\") {
  7463. isEscape = true;
  7464. } else {
  7465. result += char;
  7466. }
  7467. }
  7468. }
  7469. if (!decode) {
  7470. return result;
  7471. }
  7472. return result.replace(/&nbsp;/g, SPACE_UNICODE.nbsp).replace(/&ensp;/g, SPACE_UNICODE.ensp).replace(/&emsp;/g, SPACE_UNICODE.emsp).replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&apos;/g, "'");
  7473. }
  7474. function parseText(text, options) {
  7475. return normalizeText(text, options).split(uniShared.LINEFEED);
  7476. }
  7477. const index$k = /* @__PURE__ */ defineBuiltInComponent({
  7478. name: "Text",
  7479. props: {
  7480. selectable: {
  7481. type: [Boolean, String],
  7482. default: false
  7483. },
  7484. space: {
  7485. type: String,
  7486. default: ""
  7487. },
  7488. decode: {
  7489. type: [Boolean, String],
  7490. default: false
  7491. }
  7492. },
  7493. setup(props2, {
  7494. slots
  7495. }) {
  7496. const rootRef = vue.ref(null);
  7497. return () => {
  7498. const children = [];
  7499. if (slots.default) {
  7500. slots.default().forEach((vnode) => {
  7501. if (vnode.shapeFlag & 8 && vnode.type !== vue.Comment) {
  7502. const lines = parseText(vnode.children, {
  7503. space: props2.space,
  7504. decode: props2.decode
  7505. });
  7506. const len = lines.length - 1;
  7507. lines.forEach((line, index2) => {
  7508. if (index2 === 0 && !line)
  7509. ;
  7510. else {
  7511. children.push(vue.createTextVNode(line));
  7512. }
  7513. if (index2 !== len) {
  7514. children.push(vue.createVNode("br"));
  7515. }
  7516. });
  7517. } else {
  7518. if (process.env.NODE_ENV !== "production" && vnode.shapeFlag & 6 && vnode.type.name !== "Text") {
  7519. console.warn("Do not nest other components in the text component, as there may be display differences on different platforms.");
  7520. }
  7521. children.push(vnode);
  7522. }
  7523. });
  7524. }
  7525. return vue.createVNode("uni-text", {
  7526. "ref": rootRef,
  7527. "selectable": props2.selectable ? true : null
  7528. }, [vue.createVNode("span", null, children)], 8, ["selectable"]);
  7529. };
  7530. }
  7531. });
  7532. const props$b = /* @__PURE__ */ shared.extend({}, props$l, {
  7533. placeholderClass: {
  7534. type: String,
  7535. default: "input-placeholder"
  7536. },
  7537. autoHeight: {
  7538. type: [Boolean, String],
  7539. default: false
  7540. },
  7541. confirmType: {
  7542. type: String,
  7543. default: "return",
  7544. validator(val) {
  7545. return ConfirmTypes.concat("return").includes(val);
  7546. }
  7547. }
  7548. });
  7549. let fixMargin = false;
  7550. const ConfirmTypes = ["done", "go", "next", "search", "send"];
  7551. const index$j = /* @__PURE__ */ defineBuiltInComponent({
  7552. name: "Textarea",
  7553. props: props$b,
  7554. emits: ["confirm", "linechange", ...emit],
  7555. setup(props2, {
  7556. emit: emit2,
  7557. expose
  7558. }) {
  7559. const rootRef = vue.ref(null);
  7560. const wrapperRef = vue.ref(null);
  7561. const {
  7562. fieldRef,
  7563. state,
  7564. scopedAttrsState,
  7565. fixDisabledColor,
  7566. trigger
  7567. } = useField(props2, rootRef, emit2);
  7568. const valueCompute = vue.computed(() => state.value.split(uniShared.LINEFEED));
  7569. const isDone = vue.computed(() => ConfirmTypes.includes(props2.confirmType));
  7570. const heightRef = vue.ref(0);
  7571. const lineRef = vue.ref(null);
  7572. vue.watch(() => heightRef.value, (height) => {
  7573. const el = rootRef.value;
  7574. const lineEl = lineRef.value;
  7575. const wrapper = wrapperRef.value;
  7576. let lineHeight = parseFloat(getComputedStyle(el).lineHeight);
  7577. if (isNaN(lineHeight)) {
  7578. lineHeight = lineEl.offsetHeight;
  7579. }
  7580. var lineCount = Math.round(height / lineHeight);
  7581. trigger("linechange", {}, {
  7582. height,
  7583. heightRpx: 750 / window.innerWidth * height,
  7584. lineCount
  7585. });
  7586. if (props2.autoHeight) {
  7587. el.style.height = "auto";
  7588. wrapper.style.height = height + "px";
  7589. }
  7590. });
  7591. vue.watch(() => props2.autoHeight, (autoHeight) => {
  7592. const el = rootRef.value;
  7593. const wrapper = wrapperRef.value;
  7594. if (autoHeight) {
  7595. el.style.height = "auto";
  7596. wrapper.style.height = heightRef.value + "px";
  7597. } else {
  7598. el.style.height = "";
  7599. wrapper.style.height = "";
  7600. }
  7601. });
  7602. function onResize({
  7603. height
  7604. }) {
  7605. heightRef.value = height;
  7606. }
  7607. function confirm(event) {
  7608. trigger("confirm", event, {
  7609. value: state.value
  7610. });
  7611. }
  7612. function onKeyDownEnter(event) {
  7613. if (event.key !== "Enter") {
  7614. return;
  7615. }
  7616. if (isDone.value) {
  7617. event.preventDefault();
  7618. }
  7619. }
  7620. function onKeyUpEnter(event) {
  7621. if (event.key !== "Enter") {
  7622. return;
  7623. }
  7624. if (isDone.value) {
  7625. confirm(event);
  7626. const textarea = event.target;
  7627. !props2.confirmHold && textarea.blur();
  7628. }
  7629. }
  7630. expose({
  7631. $triggerInput: (detail) => {
  7632. emit2("update:modelValue", detail.value);
  7633. emit2("update:value", detail.value);
  7634. state.value = detail.value;
  7635. }
  7636. });
  7637. return () => {
  7638. let textareaNode = props2.disabled && fixDisabledColor ? vue.createVNode("textarea", {
  7639. "key": "disabled-textarea",
  7640. "ref": fieldRef,
  7641. "value": state.value,
  7642. "tabindex": "-1",
  7643. "readonly": !!props2.disabled,
  7644. "maxlength": state.maxlength,
  7645. "class": {
  7646. "uni-textarea-textarea": true,
  7647. "uni-textarea-textarea-fix-margin": fixMargin
  7648. },
  7649. "style": {
  7650. overflowY: props2.autoHeight ? "hidden" : "auto",
  7651. /* eslint-disable no-restricted-syntax */
  7652. ...props2.cursorColor && {
  7653. caretColor: props2.cursorColor
  7654. }
  7655. },
  7656. "onFocus": (event) => event.target.blur()
  7657. }, null, 46, ["value", "readonly", "maxlength", "onFocus"]) : vue.createVNode("textarea", {
  7658. "key": "textarea",
  7659. "ref": fieldRef,
  7660. "value": state.value,
  7661. "disabled": !!props2.disabled,
  7662. "maxlength": state.maxlength,
  7663. "enterkeyhint": props2.confirmType,
  7664. "inputmode": props2.inputmode,
  7665. "class": {
  7666. "uni-textarea-textarea": true,
  7667. "uni-textarea-textarea-fix-margin": fixMargin
  7668. },
  7669. "style": {
  7670. overflowY: props2.autoHeight ? "hidden" : "auto",
  7671. /* eslint-disable no-restricted-syntax */
  7672. ...props2.cursorColor && {
  7673. caretColor: props2.cursorColor
  7674. }
  7675. },
  7676. "onKeydown": onKeyDownEnter,
  7677. "onKeyup": onKeyUpEnter
  7678. }, null, 46, ["value", "disabled", "maxlength", "enterkeyhint", "inputmode", "onKeydown", "onKeyup"]);
  7679. return vue.createVNode("uni-textarea", {
  7680. "ref": rootRef
  7681. }, [vue.createVNode("div", {
  7682. "ref": wrapperRef,
  7683. "class": "uni-textarea-wrapper"
  7684. }, [vue.withDirectives(vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  7685. "style": props2.placeholderStyle,
  7686. "class": ["uni-textarea-placeholder", props2.placeholderClass]
  7687. }), [props2.placeholder], 16), [[vue.vShow, !state.value.length]]), vue.createVNode("div", {
  7688. "ref": lineRef,
  7689. "class": "uni-textarea-line"
  7690. }, [" "], 512), vue.createVNode("div", {
  7691. "class": "uni-textarea-compute"
  7692. }, [valueCompute.value.map((item) => vue.createVNode("div", null, [item.trim() ? item : "."])), vue.createVNode(ResizeSensor, {
  7693. "initial": true,
  7694. "onResize": onResize
  7695. }, null, 8, ["initial", "onResize"])]), props2.confirmType === "search" ? vue.createVNode("form", {
  7696. "action": "",
  7697. "onSubmit": () => false,
  7698. "class": "uni-input-form"
  7699. }, [textareaNode], 40, ["onSubmit"]) : textareaNode], 512)], 512);
  7700. };
  7701. }
  7702. });
  7703. const index$i = /* @__PURE__ */ defineBuiltInComponent({
  7704. name: "View",
  7705. props: /* @__PURE__ */ shared.extend({}, hoverProps),
  7706. setup(props2, {
  7707. slots
  7708. }) {
  7709. const rootRef = vue.ref(null);
  7710. const {
  7711. hovering,
  7712. binding
  7713. } = useHover(props2);
  7714. return () => {
  7715. const hoverClass = props2.hoverClass;
  7716. if (hoverClass && hoverClass !== "none") {
  7717. return vue.createVNode("uni-view", vue.mergeProps({
  7718. "class": hovering.value ? hoverClass : "",
  7719. "ref": rootRef
  7720. }, binding), [slots.default && slots.default()], 16);
  7721. }
  7722. return vue.createVNode("uni-view", {
  7723. "ref": rootRef
  7724. }, [slots.default && slots.default()], 512);
  7725. };
  7726. }
  7727. });
  7728. function isHTMlElement(node) {
  7729. return !!(node && node.nodeType === 1);
  7730. }
  7731. function getChildren(root) {
  7732. const children = [];
  7733. if (root) {
  7734. walk(root, children);
  7735. }
  7736. return children;
  7737. }
  7738. const ChildType = ["ListItem", "StickySection", "StickyHeader"];
  7739. function walk(vnode, children) {
  7740. if (vnode.component && vnode.component.type && vnode.component.type.name && ChildType.includes(vnode.component.type.name)) {
  7741. children.push(vnode);
  7742. } else if (vnode.component) {
  7743. walk(vnode.component.subTree, children);
  7744. } else if (vnode.shapeFlag & 16) {
  7745. const vnodes = vnode.children;
  7746. for (let i = 0; i < vnodes.length; i++) {
  7747. walk(vnodes[i], children);
  7748. }
  7749. }
  7750. }
  7751. function traverseListView(visibleVNode, callback) {
  7752. const children = getChildren(visibleVNode);
  7753. for (let i = 0; i < children.length; i++) {
  7754. const child = children[i];
  7755. callback(child);
  7756. }
  7757. }
  7758. function traverseStickySection(stickySectionVNode, callback) {
  7759. const children = getChildren(stickySectionVNode.component.subTree);
  7760. for (let i = 0; i < children.length; i++) {
  7761. const child = children[i];
  7762. callback(child);
  7763. }
  7764. }
  7765. const props$a = {
  7766. direction: {
  7767. type: String,
  7768. default: "vertical",
  7769. validator: (val) => {
  7770. return ["none", "vertical", "horizontal"].includes(val);
  7771. }
  7772. },
  7773. showScrollbar: {
  7774. type: [Boolean, String],
  7775. default: true
  7776. },
  7777. upperThreshold: {
  7778. type: [Number, String],
  7779. default: 50
  7780. },
  7781. lowerThreshold: {
  7782. type: [Number, String],
  7783. default: 50
  7784. },
  7785. scrollTop: {
  7786. type: [Number, String],
  7787. default: 0
  7788. },
  7789. scrollLeft: {
  7790. type: [Number, String],
  7791. default: 0
  7792. },
  7793. // 暂不支持
  7794. // scrollIntoView: {
  7795. // type: String,
  7796. // default: '',
  7797. // },
  7798. scrollWithAnimation: {
  7799. type: [Boolean, String],
  7800. default: false
  7801. },
  7802. refresherEnabled: {
  7803. type: [Boolean, String],
  7804. default: false
  7805. },
  7806. refresherThreshold: {
  7807. type: Number,
  7808. default: 45
  7809. },
  7810. refresherDefaultStyle: {
  7811. type: String,
  7812. default: "black"
  7813. },
  7814. refresherBackground: {
  7815. type: String,
  7816. default: "transparent"
  7817. },
  7818. refresherTriggered: {
  7819. type: [Boolean, String],
  7820. default: false
  7821. }
  7822. };
  7823. const index$h = /* @__PURE__ */ defineBuiltInComponent({
  7824. name: "ListView",
  7825. props: props$a,
  7826. emits: [
  7827. "scroll",
  7828. "scrolltoupper",
  7829. "scrolltolower",
  7830. // 有触发时机,但是由于没有原生事件暂不支持
  7831. // 'scrollend',
  7832. "refresherrefresh",
  7833. "refresherrestore",
  7834. "refresherpulling",
  7835. "refresherabort",
  7836. "update:refresherTriggered"
  7837. ],
  7838. setup(props2, {
  7839. slots,
  7840. emit: emit2
  7841. }) {
  7842. const rootRef = vue.ref(null);
  7843. const containerRef = vue.ref(null);
  7844. const visibleRef = vue.ref(null);
  7845. const {
  7846. isVertical,
  7847. state
  7848. } = useListViewState(props2);
  7849. vue.provide("__listViewIsVertical", isVertical);
  7850. vue.provide("__listViewDefaultItemSize", state.defaultItemSize);
  7851. const onItemChange = uniShared.debounce(() => {
  7852. vue.nextTick(() => {
  7853. _rearrange();
  7854. });
  7855. }, 10, {
  7856. clearTimeout,
  7857. setTimeout
  7858. });
  7859. vue.provide("__listViewRegisterItem", (status) => {
  7860. onItemChange();
  7861. });
  7862. vue.provide("__listViewUnregisterItem", (status) => {
  7863. onItemChange();
  7864. });
  7865. const trigger = useCustomEvent(rootRef, emit2);
  7866. handleTouchEvent(isVertical, containerRef, props2, state, trigger, emit2);
  7867. function resetContainerSize() {
  7868. const containerEl = containerRef.value;
  7869. state.containerSize = isVertical.value ? containerEl.clientHeight : containerEl.clientWidth;
  7870. }
  7871. vue.watch(isVertical, () => {
  7872. resetContainerSize();
  7873. });
  7874. vue.computed(() => {
  7875. const val = Number(props2.upperThreshold);
  7876. return isNaN(val) ? 50 : val;
  7877. });
  7878. vue.computed(() => {
  7879. const val = Number(props2.lowerThreshold);
  7880. return isNaN(val) ? 50 : val;
  7881. });
  7882. const scrollTopNumber = vue.computed(() => {
  7883. return Number(props2.scrollTop) || 0;
  7884. });
  7885. const scrollLeftNumber = vue.computed(() => {
  7886. return Number(props2.scrollLeft) || 0;
  7887. });
  7888. vue.watch(scrollTopNumber, (val) => {
  7889. if (containerRef.value) {
  7890. containerRef.value.scrollTop = val;
  7891. }
  7892. });
  7893. vue.watch(scrollLeftNumber, (val) => {
  7894. if (containerRef.value) {
  7895. containerRef.value.scrollLeft = val;
  7896. }
  7897. });
  7898. function forceRearrange() {
  7899. traverseAllItems(visibleVNode, (child) => {
  7900. const exposed = child.component.exposed;
  7901. if (exposed == null ? void 0 : exposed.__listViewChildStatus.seen.value) {
  7902. exposed.__listViewChildStatus.seen.value = false;
  7903. }
  7904. });
  7905. vue.nextTick(() => {
  7906. vue.nextTick(() => {
  7907. _rearrange();
  7908. });
  7909. });
  7910. }
  7911. function onResize() {
  7912. resetContainerSize();
  7913. forceRearrange();
  7914. }
  7915. function traverseAllItems(visibleVNode2, callback) {
  7916. traverseListView(visibleVNode2, (child) => {
  7917. var _a;
  7918. const childType = (_a = child.component) == null ? void 0 : _a.type.name;
  7919. if (childType === "StickySection") {
  7920. traverseStickySection(child, function() {
  7921. var _a2;
  7922. const childType2 = (_a2 = child.component) == null ? void 0 : _a2.type.name;
  7923. if (childType2 === "ListItem") {
  7924. callback(child);
  7925. }
  7926. });
  7927. } else if (childType === "ListItem") {
  7928. callback(child);
  7929. } else if (childType === "StickyHeader")
  7930. ;
  7931. else if (child.component && child.component.subTree) {
  7932. traverseAllItems(child.component.subTree, callback);
  7933. }
  7934. });
  7935. }
  7936. function _rearrange() {
  7937. rearrange(visibleVNode, containerRef, isVertical, state);
  7938. }
  7939. const containerStyle = vue.computed(() => {
  7940. return `${props2.direction === "none" ? "overflow: hidden;" : isVertical.value ? "overflow-y: auto;" : "overflow-x: auto;"}scroll-behavior: ${props2.scrollWithAnimation ? "smooth" : "auto"};`;
  7941. });
  7942. const contentStyle = vue.computed(() => {
  7943. return `position: relative; ${isVertical.value ? "height" : "width"}: ${state.totalSize}px;`;
  7944. });
  7945. const visibleStyle = vue.computed(() => {
  7946. return `position: absolute; ${isVertical.value ? "width" : "height"}: 100%; ${isVertical.value ? "top" : "left"}: ${state.placehoderSize}px;`;
  7947. });
  7948. let visibleVNode = null;
  7949. return () => {
  7950. const {
  7951. refresherEnabled,
  7952. refresherBackground,
  7953. refresherDefaultStyle,
  7954. refresherThreshold
  7955. } = props2;
  7956. const {
  7957. refresherHeight,
  7958. refreshState
  7959. } = state;
  7960. const defaultSlot = slots.default && slots.default();
  7961. visibleVNode = vue.createVNode("div", {
  7962. "ref": visibleRef,
  7963. "class": "uni-list-view-visible",
  7964. "style": visibleStyle.value
  7965. }, [defaultSlot], 4);
  7966. return vue.createVNode("uni-list-view", {
  7967. "ref": rootRef,
  7968. "class": "uni-list-view"
  7969. }, [vue.createVNode("div", {
  7970. "ref": containerRef,
  7971. "class": `uni-list-view-container ${props2.showScrollbar === false ? "uni-list-view-scrollbar-hidden" : ""}`,
  7972. "style": containerStyle.value
  7973. }, [refresherEnabled ? vue.createVNode(Refresher, {
  7974. "refreshState": refreshState,
  7975. "refresherHeight": refresherHeight,
  7976. "refresherThreshold": refresherThreshold,
  7977. "refresherDefaultStyle": refresherDefaultStyle,
  7978. "refresherBackground": refresherBackground
  7979. }, {
  7980. default: () => [refresherDefaultStyle == "none" ? slots.refresher && slots.refresher() : null]
  7981. }, 8, ["refreshState", "refresherHeight", "refresherThreshold", "refresherDefaultStyle", "refresherBackground"]) : null, vue.createVNode("div", {
  7982. "class": "uni-list-view-content",
  7983. "style": contentStyle.value
  7984. }, [visibleVNode], 4)], 4), vue.createVNode(ResizeSensor, {
  7985. "onResize": onResize
  7986. }, null, 8, ["onResize"])], 512);
  7987. };
  7988. }
  7989. });
  7990. function useListViewState(props2) {
  7991. const isVertical = vue.computed(() => {
  7992. return props2.direction !== "horizontal";
  7993. });
  7994. const state = vue.reactive({
  7995. defaultItemSize: 40,
  7996. totalSize: 0,
  7997. placehoderSize: 0,
  7998. visibleSize: 0,
  7999. containerSize: 0,
  8000. cacheScreenCount: 5,
  8001. loadScreenThreshold: 3,
  8002. refresherHeight: 0,
  8003. refreshState: ""
  8004. });
  8005. return {
  8006. state,
  8007. isVertical
  8008. };
  8009. }
  8010. function rearrange(visibleVNode, containerRef, isVertical, state) {
  8011. if (!visibleVNode) {
  8012. return;
  8013. }
  8014. const containerEl = containerRef.value;
  8015. if (!containerEl) {
  8016. return;
  8017. }
  8018. const offset = isVertical.value ? containerEl.scrollTop : containerEl.scrollLeft;
  8019. const offsetMin = Math.max(offset - state.containerSize * state.cacheScreenCount, 0);
  8020. const offsetMax = Math.max(offset + state.containerSize * (state.cacheScreenCount + 1), offsetMin + 1);
  8021. let tempTotalSize = 0;
  8022. let tempVisibleSize = 0;
  8023. let tempPlaceholderSize = 0;
  8024. let start = false, end = false;
  8025. function callback(child) {
  8026. var _a, _b, _c;
  8027. const childType = (_a = child.component) == null ? void 0 : _a.type.name;
  8028. const status = (_c = (_b = child.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.__listViewChildStatus;
  8029. if (childType === "StickySection") {
  8030. const {
  8031. headSize,
  8032. tailSize
  8033. } = status;
  8034. tempTotalSize += headSize.value;
  8035. traverseStickySection(child, callback);
  8036. tempTotalSize += tailSize.value;
  8037. } else if (childType === "ListItem") {
  8038. const {
  8039. cachedSize
  8040. } = status;
  8041. const itemSize = cachedSize;
  8042. tempTotalSize += itemSize;
  8043. if (!start && tempTotalSize > offsetMin) {
  8044. start = true;
  8045. }
  8046. if (!start) {
  8047. tempPlaceholderSize += itemSize;
  8048. }
  8049. if (start && !end) {
  8050. tempVisibleSize += itemSize;
  8051. status.visible.value = true;
  8052. } else {
  8053. status.visible.value = false;
  8054. }
  8055. if (!end && tempTotalSize >= offsetMax) {
  8056. end = true;
  8057. }
  8058. } else if (childType === "StickyHeader") {
  8059. const {
  8060. cachedSize
  8061. } = status;
  8062. tempTotalSize += cachedSize;
  8063. tempVisibleSize += cachedSize;
  8064. }
  8065. }
  8066. traverseListView(visibleVNode, callback);
  8067. state.totalSize = tempTotalSize;
  8068. state.visibleSize = tempVisibleSize;
  8069. state.placehoderSize = tempPlaceholderSize;
  8070. }
  8071. function handleTouchEvent(isVertical, containerRef, props2, state, trigger, emit2) {
  8072. let beforeRefreshing = false;
  8073. let triggerAbort = false;
  8074. let touchStart = {
  8075. x: 0,
  8076. y: 0
  8077. };
  8078. let touchEnd = {
  8079. x: 0,
  8080. y: props2.refresherThreshold
  8081. };
  8082. function _setRefreshState(_state) {
  8083. if (!props2.refresherEnabled)
  8084. return;
  8085. switch (_state) {
  8086. case "refreshing":
  8087. state.refresherHeight = props2.refresherThreshold;
  8088. if (!beforeRefreshing) {
  8089. beforeRefreshing = true;
  8090. trigger("refresherpulling", {}, {
  8091. deltaY: state.refresherHeight,
  8092. dy: state.refresherHeight
  8093. });
  8094. trigger("refresherrefresh", {}, {
  8095. dy: touchEnd.y - touchStart.y
  8096. });
  8097. emit2("update:refresherTriggered", true);
  8098. }
  8099. break;
  8100. case "restore":
  8101. case "refresherabort":
  8102. beforeRefreshing = false;
  8103. state.refresherHeight = 0;
  8104. if (_state === "restore") {
  8105. triggerAbort = false;
  8106. trigger("refresherrestore", {}, {
  8107. dy: touchEnd.y - touchStart.y
  8108. });
  8109. }
  8110. if (_state === "refresherabort" && triggerAbort) {
  8111. triggerAbort = false;
  8112. trigger("refresherabort", {}, {
  8113. dy: touchEnd.y - touchStart.y
  8114. });
  8115. }
  8116. break;
  8117. }
  8118. state.refreshState = _state;
  8119. }
  8120. vue.watch(() => props2.refresherTriggered, (val) => {
  8121. if (val === true) {
  8122. _setRefreshState("refreshing");
  8123. } else if (val === false) {
  8124. _setRefreshState("restore");
  8125. }
  8126. });
  8127. }
  8128. function getSize(isVertical, el) {
  8129. var style = window.getComputedStyle(el);
  8130. if (isVertical) {
  8131. return parseFloat(style.marginTop) + el.getBoundingClientRect().height + parseFloat(style.marginBottom);
  8132. } else {
  8133. return parseFloat(style.marginLeft) + el.getBoundingClientRect().width + parseFloat(style.marginRight);
  8134. }
  8135. }
  8136. const index$g = /* @__PURE__ */ defineBuiltInComponent({
  8137. name: "ListItem",
  8138. props: {},
  8139. setup(props2, {
  8140. slots,
  8141. expose
  8142. }) {
  8143. const rootRef = vue.ref(null);
  8144. const isVertical = vue.inject("__listViewIsVertical");
  8145. const visible = vue.ref(false);
  8146. const seen = vue.ref(false);
  8147. const status = {
  8148. type: "ListItem",
  8149. visible,
  8150. cachedSize: 0,
  8151. seen
  8152. };
  8153. expose({
  8154. __listViewChildStatus: status
  8155. });
  8156. vue.inject("__listViewRegisterItem");
  8157. vue.inject("__listViewUnregisterItem");
  8158. const realVisible = vue.computed(() => {
  8159. return visible.value || !status.seen.value;
  8160. });
  8161. return () => {
  8162. vue.nextTick(() => {
  8163. const rootNode = rootRef.value;
  8164. if (realVisible.value && isHTMlElement(rootNode)) {
  8165. status.cachedSize = getSize(isVertical.value, rootNode);
  8166. seen.value = true;
  8167. }
  8168. });
  8169. if (!realVisible.value) {
  8170. return null;
  8171. }
  8172. return vue.createVNode("uni-list-item", {
  8173. "ref": rootRef
  8174. }, [slots.default && slots.default()], 512);
  8175. };
  8176. }
  8177. });
  8178. const index$f = /* @__PURE__ */ defineBuiltInComponent({
  8179. name: "StickySection",
  8180. props: {
  8181. padding: {
  8182. type: Array,
  8183. default: [0, 0, 0, 0]
  8184. }
  8185. },
  8186. setup(props2, {
  8187. slots,
  8188. expose
  8189. }) {
  8190. const rootRef = vue.ref(null);
  8191. const isVertical = vue.inject("__listViewIsVertical");
  8192. const style = vue.computed(() => {
  8193. return {
  8194. paddingTop: props2.padding[0] + "px",
  8195. paddingRight: props2.padding[1] + "px",
  8196. paddingBottom: props2.padding[2] + "px",
  8197. paddingLeft: props2.padding[3] + "px"
  8198. };
  8199. });
  8200. const headSize = vue.computed(() => {
  8201. return isVertical ? props2.padding[0] : props2.padding[3];
  8202. });
  8203. const tailSize = vue.computed(() => {
  8204. return isVertical ? props2.padding[2] : props2.padding[1];
  8205. });
  8206. const status = {
  8207. type: "StickySection",
  8208. headSize,
  8209. tailSize
  8210. };
  8211. expose({
  8212. __listViewChildStatus: status
  8213. });
  8214. return () => {
  8215. var _a;
  8216. return vue.createVNode("uni-sticky-section", {
  8217. "ref": rootRef,
  8218. "style": style.value
  8219. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)], 4);
  8220. };
  8221. }
  8222. });
  8223. const index$e = /* @__PURE__ */ defineBuiltInComponent({
  8224. name: "StickyHeader",
  8225. props: {
  8226. padding: {
  8227. type: Array,
  8228. default: [0, 0, 0, 0]
  8229. }
  8230. },
  8231. setup(props2, {
  8232. slots,
  8233. expose
  8234. }) {
  8235. const rootRef = vue.ref(null);
  8236. const isVertical = vue.inject("__listViewIsVertical");
  8237. const style = vue.computed(() => {
  8238. return {
  8239. paddingTop: props2.padding[0] + "px",
  8240. paddingRight: props2.padding[1] + "px",
  8241. paddingBottom: props2.padding[2] + "px",
  8242. paddingLeft: props2.padding[3] + "px",
  8243. top: 0 - props2.padding[0] + "px"
  8244. };
  8245. });
  8246. const status = {
  8247. type: "StickyHeader",
  8248. cachedSize: 0
  8249. };
  8250. expose({
  8251. __listViewChildStatus: status
  8252. });
  8253. return () => {
  8254. var _a;
  8255. vue.nextTick(() => {
  8256. const rootEl = rootRef.value;
  8257. const rect = rootEl.getBoundingClientRect();
  8258. status.cachedSize = isVertical ? rect.height : rect.width;
  8259. });
  8260. return vue.createVNode("uni-sticky-header", {
  8261. "ref": rootRef,
  8262. "style": style.value
  8263. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)], 4);
  8264. };
  8265. }
  8266. });
  8267. function useSubscribe(callback, name, multiple, pageId) {
  8268. const instance = vue.getCurrentInstance();
  8269. instance.proxy;
  8270. }
  8271. let index$d = 0;
  8272. function useContextInfo(_id) {
  8273. useCurrentPageId();
  8274. const instance = vue.getCurrentInstance();
  8275. const vm = instance.proxy;
  8276. const type = vm.$options.name.toLowerCase();
  8277. const id2 = _id || vm.id || `context${index$d++}`;
  8278. return `${type}.${id2}`;
  8279. }
  8280. function injectLifecycleHook(name, hook, publicThis, instance) {
  8281. if (shared.isFunction(hook)) {
  8282. vue.injectHook(name, hook.bind(publicThis), instance);
  8283. }
  8284. }
  8285. function initHooks(options, instance, publicThis) {
  8286. var _b;
  8287. const mpType = options.mpType || publicThis.$mpType;
  8288. if (!mpType || mpType === "component") {
  8289. return;
  8290. }
  8291. Object.keys(options).forEach((name) => {
  8292. if (uniShared.isUniLifecycleHook(name, options[name], false)) {
  8293. const hooks = options[name];
  8294. if (shared.isArray(hooks)) {
  8295. hooks.forEach(
  8296. (hook) => injectLifecycleHook(name, hook, publicThis, instance)
  8297. );
  8298. } else {
  8299. injectLifecycleHook(name, hooks, publicThis, instance);
  8300. }
  8301. }
  8302. });
  8303. if (mpType === "page") {
  8304. instance.__isVisible = true;
  8305. try {
  8306. let query = instance.attrs.__pageQuery;
  8307. if (true) {
  8308. query = uniShared.decodedQuery(query);
  8309. }
  8310. if (false)
  8311. ;
  8312. invokeHook(publicThis, uniShared.ON_LOAD, query);
  8313. delete instance.attrs.__pageQuery;
  8314. if (true) {
  8315. if (((_b = publicThis.$page) == null ? void 0 : _b.openType) !== "preloadPage") {
  8316. invokeHook(publicThis, uniShared.ON_SHOW);
  8317. }
  8318. }
  8319. } catch (e2) {
  8320. console.error(e2.message + uniShared.LINEFEED + e2.stack);
  8321. }
  8322. }
  8323. }
  8324. function applyOptions(options, instance, publicThis) {
  8325. initHooks(options, instance, publicThis);
  8326. }
  8327. function set(target, key, val) {
  8328. return target[key] = val;
  8329. }
  8330. function $callMethod(method, ...args) {
  8331. const fn = this[method];
  8332. if (fn) {
  8333. return fn(...args);
  8334. }
  8335. console.error(`method ${method} not found`);
  8336. return null;
  8337. }
  8338. function createErrorHandler(app) {
  8339. return function errorHandler(err, instance, _info) {
  8340. if (!instance) {
  8341. throw err;
  8342. }
  8343. const appInstance = app._instance;
  8344. if (!appInstance || !appInstance.proxy) {
  8345. throw err;
  8346. }
  8347. {
  8348. invokeHook(appInstance.proxy, uniShared.ON_ERROR, err);
  8349. }
  8350. };
  8351. }
  8352. function mergeAsArray(to, from) {
  8353. return to ? [...new Set([].concat(to, from))] : from;
  8354. }
  8355. function initOptionMergeStrategies(optionMergeStrategies) {
  8356. uniShared.UniLifecycleHooks.forEach((name) => {
  8357. optionMergeStrategies[name] = mergeAsArray;
  8358. });
  8359. }
  8360. let realAtob;
  8361. const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  8362. const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  8363. if (typeof atob !== "function") {
  8364. realAtob = function(str) {
  8365. str = String(str).replace(/[\t\n\f\r ]+/g, "");
  8366. if (!b64re.test(str)) {
  8367. throw new Error(
  8368. "Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."
  8369. );
  8370. }
  8371. str += "==".slice(2 - (str.length & 3));
  8372. var bitmap;
  8373. var result = "";
  8374. var r1;
  8375. var r2;
  8376. var i = 0;
  8377. for (; i < str.length; ) {
  8378. 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++)));
  8379. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(
  8380. bitmap >> 16 & 255,
  8381. bitmap >> 8 & 255,
  8382. bitmap & 255
  8383. );
  8384. }
  8385. return result;
  8386. };
  8387. } else {
  8388. realAtob = atob;
  8389. }
  8390. function b64DecodeUnicode(str) {
  8391. return decodeURIComponent(
  8392. realAtob(str).split("").map(function(c) {
  8393. return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
  8394. }).join("")
  8395. );
  8396. }
  8397. function getCurrentUserInfo() {
  8398. const token = uni.getStorageSync("uni_id_token") || "";
  8399. const tokenArr = token.split(".");
  8400. if (!token || tokenArr.length !== 3) {
  8401. return {
  8402. uid: null,
  8403. role: [],
  8404. permission: [],
  8405. tokenExpired: 0
  8406. };
  8407. }
  8408. let userInfo;
  8409. try {
  8410. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  8411. } catch (error) {
  8412. throw new Error("获取当前用户信息出错,详细错误信息为:" + error.message);
  8413. }
  8414. userInfo.tokenExpired = userInfo.exp * 1e3;
  8415. delete userInfo.exp;
  8416. delete userInfo.iat;
  8417. return userInfo;
  8418. }
  8419. function uniIdMixin(globalProperties) {
  8420. globalProperties.uniIDHasRole = function(roleId) {
  8421. const { role } = getCurrentUserInfo();
  8422. return role.indexOf(roleId) > -1;
  8423. };
  8424. globalProperties.uniIDHasPermission = function(permissionId) {
  8425. const { permission } = getCurrentUserInfo();
  8426. return this.uniIDHasRole("admin") || permission.indexOf(permissionId) > -1;
  8427. };
  8428. globalProperties.uniIDTokenValid = function() {
  8429. const { tokenExpired } = getCurrentUserInfo();
  8430. return tokenExpired > Date.now();
  8431. };
  8432. }
  8433. function initApp$1(app) {
  8434. const appConfig = app._context.config;
  8435. appConfig.errorHandler = uniShared.invokeCreateErrorHandler(app, createErrorHandler);
  8436. initOptionMergeStrategies(appConfig.optionMergeStrategies);
  8437. const globalProperties = appConfig.globalProperties;
  8438. {
  8439. if (__UNI_FEATURE_UNI_CLOUD__) {
  8440. uniIdMixin(globalProperties);
  8441. }
  8442. }
  8443. {
  8444. globalProperties.$set = set;
  8445. globalProperties.$applyOptions = applyOptions;
  8446. globalProperties.$callMethod = $callMethod;
  8447. }
  8448. {
  8449. uniShared.invokeCreateVueAppHook(app);
  8450. }
  8451. }
  8452. const pageMetaKey = PolySymbol(process.env.NODE_ENV !== "production" ? "UniPageMeta" : "upm");
  8453. function usePageMeta() {
  8454. return vue.inject(pageMetaKey);
  8455. }
  8456. function providePageMeta(id2) {
  8457. const pageMeta = initPageMeta(id2);
  8458. vue.provide(pageMetaKey, pageMeta);
  8459. return pageMeta;
  8460. }
  8461. function usePageRoute() {
  8462. if (__UNI_FEATURE_PAGES__) {
  8463. return vueRouter.useRoute();
  8464. }
  8465. const url = location.href;
  8466. const searchPos = url.indexOf("?");
  8467. const hashPos = url.indexOf("#", searchPos > -1 ? searchPos : 0);
  8468. let query = {};
  8469. if (searchPos > -1) {
  8470. query = uniShared.parseQuery(
  8471. url.slice(searchPos + 1, hashPos > -1 ? hashPos : url.length)
  8472. );
  8473. }
  8474. const { meta } = __uniRoutes[0];
  8475. const path = uniShared.addLeadingSlash(meta.route);
  8476. return {
  8477. meta,
  8478. query,
  8479. path,
  8480. matched: [{ path }]
  8481. };
  8482. }
  8483. function initPageMeta(id2) {
  8484. if (__UNI_FEATURE_PAGES__) {
  8485. return vue.reactive(
  8486. normalizePageMeta(
  8487. JSON.parse(
  8488. JSON.stringify(
  8489. initRouteMeta(
  8490. vueRouter.useRoute().meta,
  8491. id2
  8492. )
  8493. )
  8494. )
  8495. )
  8496. );
  8497. }
  8498. return vue.reactive(
  8499. normalizePageMeta(
  8500. JSON.parse(JSON.stringify(initRouteMeta(__uniRoutes[0].meta, id2)))
  8501. )
  8502. );
  8503. }
  8504. function normalizePageMeta(pageMeta) {
  8505. if (__UNI_FEATURE_PULL_DOWN_REFRESH__) {
  8506. const { enablePullDownRefresh, navigationBar } = pageMeta;
  8507. {
  8508. const pullToRefresh = normalizePullToRefreshRpx(
  8509. shared.extend(
  8510. {
  8511. support: true,
  8512. color: "#2BD009",
  8513. style: "circle",
  8514. height: 70,
  8515. range: 150,
  8516. offset: 0
  8517. },
  8518. pageMeta.pullToRefresh
  8519. )
  8520. );
  8521. const { type, style } = navigationBar;
  8522. if (style !== "custom" && type !== "transparent") {
  8523. pullToRefresh.offset += uniShared.NAVBAR_HEIGHT + 0;
  8524. }
  8525. pageMeta.pullToRefresh = pullToRefresh;
  8526. }
  8527. }
  8528. if (__UNI_FEATURE_NAVIGATIONBAR__) {
  8529. const { navigationBar } = pageMeta;
  8530. const { titleSize, titleColor, backgroundColor } = navigationBar;
  8531. navigationBar.titleText = navigationBar.titleText || "";
  8532. navigationBar.type = navigationBar.type || "default";
  8533. navigationBar.titleSize = titleSize || "16px";
  8534. navigationBar.titleColor = titleColor || "#000000";
  8535. navigationBar.backgroundColor = backgroundColor || "#F8F8F8";
  8536. __UNI_FEATURE_I18N_LOCALE__ && initNavigationBarI18n(navigationBar);
  8537. }
  8538. return pageMeta;
  8539. }
  8540. function getStateId() {
  8541. {
  8542. return 1;
  8543. }
  8544. }
  8545. function removeNonTabBarPages() {
  8546. const curTabBarPageVm = getCurrentPageVm();
  8547. if (!curTabBarPageVm) {
  8548. return;
  8549. }
  8550. const pagesMap = getCurrentPagesMap();
  8551. const keys = pagesMap.keys();
  8552. for (const routeKey of keys) {
  8553. const page = pagesMap.get(routeKey);
  8554. if (!page.$.__isTabBar) {
  8555. removePage(routeKey);
  8556. } else {
  8557. page.$.__isActive = false;
  8558. }
  8559. }
  8560. if (curTabBarPageVm.$.__isTabBar) {
  8561. curTabBarPageVm.$.__isVisible = false;
  8562. invokeHook(curTabBarPageVm, uniShared.ON_HIDE);
  8563. }
  8564. }
  8565. function isSamePage(url, $page) {
  8566. return url === $page.fullPath || url === "/" && $page.meta.isEntry;
  8567. }
  8568. function getTabBarPageId(url) {
  8569. const pages = getCurrentPagesMap().values();
  8570. for (const page of pages) {
  8571. const $page = page.$page;
  8572. if (isSamePage(url, $page)) {
  8573. page.$.__isActive = true;
  8574. return $page.id;
  8575. }
  8576. }
  8577. }
  8578. function removeLastPage() {
  8579. const page = getCurrentPage();
  8580. if (!page) {
  8581. return;
  8582. }
  8583. const $page = page.$page;
  8584. removePage(normalizeRouteKey($page.path, $page.id));
  8585. }
  8586. function removeAllPages() {
  8587. const keys = getCurrentPagesMap().keys();
  8588. for (const routeKey of keys) {
  8589. removePage(routeKey);
  8590. }
  8591. }
  8592. function navigate({ type, url, tabBarText, events, isAutomatedTesting }, __id__) {
  8593. const router = getApp().$router;
  8594. const { path, query } = uniShared.parseUrl(url);
  8595. return new Promise((resolve, reject) => {
  8596. const state = createPageState(type, __id__);
  8597. router[type === "navigateTo" ? "push" : "replace"]({
  8598. path,
  8599. query,
  8600. state,
  8601. force: true
  8602. }).then((failure) => {
  8603. if (vueRouter.isNavigationFailure(failure)) {
  8604. return reject(failure.message);
  8605. }
  8606. if (type === "switchTab") {
  8607. router.currentRoute.value.meta.tabBarText = tabBarText;
  8608. }
  8609. if (type === "navigateTo") {
  8610. const meta = router.currentRoute.value.meta;
  8611. if (!meta.eventChannel) {
  8612. meta.eventChannel = new uniShared.EventChannel(state.__id__, events);
  8613. } else if (events) {
  8614. Object.keys(events).forEach((eventName) => {
  8615. meta.eventChannel._addListener(
  8616. eventName,
  8617. "on",
  8618. events[eventName]
  8619. );
  8620. });
  8621. meta.eventChannel._clearCache();
  8622. }
  8623. return isAutomatedTesting ? resolve({
  8624. __id__: state.__id__
  8625. }) : resolve({
  8626. eventChannel: meta.eventChannel
  8627. });
  8628. }
  8629. return isAutomatedTesting ? resolve({ __id__: state.__id__ }) : resolve();
  8630. });
  8631. });
  8632. }
  8633. function handleBeforeEntryPageRoutes() {
  8634. if (entryPageState.handledBeforeEntryPageRoutes) {
  8635. return;
  8636. }
  8637. entryPageState.handledBeforeEntryPageRoutes = true;
  8638. const navigateToPages = [...navigateToPagesBeforeEntryPages];
  8639. navigateToPagesBeforeEntryPages.length = 0;
  8640. navigateToPages.forEach(
  8641. ({ args, resolve, reject }) => (
  8642. // @ts-expect-error
  8643. navigate(args).then(resolve).catch(reject)
  8644. )
  8645. );
  8646. const switchTabPages = [...switchTabPagesBeforeEntryPages];
  8647. switchTabPagesBeforeEntryPages.length = 0;
  8648. switchTabPages.forEach(
  8649. ({ args, resolve, reject }) => (removeNonTabBarPages(), navigate(args, getTabBarPageId(args.url)).then(resolve).catch(reject))
  8650. );
  8651. const redirectToPages = [...redirectToPagesBeforeEntryPages];
  8652. redirectToPagesBeforeEntryPages.length = 0;
  8653. redirectToPages.forEach(
  8654. ({ args, resolve, reject }) => (removeLastPage(), navigate(args).then(resolve).catch(reject))
  8655. );
  8656. const reLaunchPages = [...reLaunchPagesBeforeEntryPages];
  8657. reLaunchPagesBeforeEntryPages.length = 0;
  8658. reLaunchPages.forEach(
  8659. ({ args, resolve, reject }) => (removeAllPages(), navigate(args).then(resolve).catch(reject))
  8660. );
  8661. }
  8662. let tabBar;
  8663. function useTabBar() {
  8664. if (!tabBar) {
  8665. tabBar = __uniConfig.tabBar && vue.reactive(initTabBarI18n(__uniConfig.tabBar));
  8666. }
  8667. return tabBar;
  8668. }
  8669. const envMethod = /* @__PURE__ */ (() => "env")();
  8670. function normalizeWindowBottom(windowBottom) {
  8671. return envMethod ? `calc(${windowBottom}px + ${envMethod}(safe-area-inset-bottom))` : `${windowBottom}px`;
  8672. }
  8673. const SEP = "$$";
  8674. const currentPagesMap = /* @__PURE__ */ new Map();
  8675. const entryPageState = {
  8676. handledBeforeEntryPageRoutes: false
  8677. };
  8678. const navigateToPagesBeforeEntryPages = [];
  8679. const switchTabPagesBeforeEntryPages = [];
  8680. const redirectToPagesBeforeEntryPages = [];
  8681. const reLaunchPagesBeforeEntryPages = [];
  8682. function pruneCurrentPages() {
  8683. currentPagesMap.forEach((page, id2) => {
  8684. if (page.$.isUnmounted) {
  8685. currentPagesMap.delete(id2);
  8686. }
  8687. });
  8688. }
  8689. function getCurrentPagesMap() {
  8690. return currentPagesMap;
  8691. }
  8692. function getCurrentPages$1() {
  8693. const curPages = [];
  8694. const pages = currentPagesMap.values();
  8695. for (const page of pages) {
  8696. if (page.$.__isTabBar) {
  8697. if (page.$.__isActive) {
  8698. curPages.push(page);
  8699. }
  8700. } else {
  8701. curPages.push(page);
  8702. }
  8703. }
  8704. return curPages;
  8705. }
  8706. function removeRouteCache(routeKey) {
  8707. const vnode = pageCacheMap.get(routeKey);
  8708. if (vnode) {
  8709. pageCacheMap.delete(routeKey);
  8710. routeCache.pruneCacheEntry(vnode);
  8711. }
  8712. }
  8713. function removePage(routeKey, removeRouteCaches = true) {
  8714. const pageVm = currentPagesMap.get(routeKey);
  8715. pageVm.$.__isUnload = true;
  8716. invokeHook(pageVm, uniShared.ON_UNLOAD);
  8717. currentPagesMap.delete(routeKey);
  8718. removeRouteCaches && removeRouteCache(routeKey);
  8719. }
  8720. let id = /* @__PURE__ */ getStateId();
  8721. function createPageState(type, __id__) {
  8722. return {
  8723. __id__: __id__ || ++id,
  8724. __type__: type
  8725. };
  8726. }
  8727. function initPublicPage(route) {
  8728. const meta = usePageMeta();
  8729. if (!__UNI_FEATURE_PAGES__) {
  8730. return initPageInternalInstance("navigateTo", __uniRoutes[0].path, {}, meta);
  8731. }
  8732. let fullPath = route.fullPath;
  8733. if (route.meta.isEntry && fullPath.indexOf(route.meta.route) === -1) {
  8734. fullPath = "/" + route.meta.route + fullPath.replace("/", "");
  8735. }
  8736. return initPageInternalInstance("navigateTo", fullPath, {}, meta);
  8737. }
  8738. function initPage(vm) {
  8739. const route = vm.$route;
  8740. const page = initPublicPage(route);
  8741. initPageVm(vm, page);
  8742. {
  8743. const pageMeta = page.meta;
  8744. vm.$setPageStyle = (style) => {
  8745. for (const key in style) {
  8746. switch (key) {
  8747. case "navigationBarBackgroundColor":
  8748. pageMeta.navigationBar.backgroundColor = style[key];
  8749. break;
  8750. case "navigationBarTextStyle":
  8751. const textStyle = style[key];
  8752. if (textStyle == null) {
  8753. continue;
  8754. }
  8755. pageMeta.navigationBar.titleColor = ["black", "white"].includes(
  8756. textStyle
  8757. ) ? uniShared.normalizeTitleColor(textStyle || "") : textStyle;
  8758. break;
  8759. case "navigationBarTitleText":
  8760. pageMeta.navigationBar.titleText = style[key];
  8761. break;
  8762. case "titleImage":
  8763. pageMeta.navigationBar.titleImage = style[key];
  8764. break;
  8765. case "navigationStyle":
  8766. pageMeta.navigationBar.style = style[key];
  8767. break;
  8768. default:
  8769. pageMeta[key] = style[key];
  8770. break;
  8771. }
  8772. }
  8773. };
  8774. vm.$getPageStyle = () => new UTSJSONObject({
  8775. navigationBarBackgroundColor: pageMeta.navigationBar.backgroundColor,
  8776. navigationBarTextStyle: pageMeta.navigationBar.titleColor,
  8777. navigationBarTitleText: pageMeta.navigationBar.titleText,
  8778. titleImage: pageMeta.navigationBar.titleImage || "",
  8779. navigationStyle: pageMeta.navigationBar.style || "default",
  8780. disableScroll: pageMeta.disableScroll || false,
  8781. enablePullDownRefresh: pageMeta.enablePullDownRefresh || false,
  8782. onReachBottomDistance: pageMeta.onReachBottomDistance || uniShared.ON_REACH_BOTTOM_DISTANCE,
  8783. backgroundColorContent: pageMeta.backgroundColorContent
  8784. });
  8785. }
  8786. currentPagesMap.set(normalizeRouteKey(page.path, page.id), vm);
  8787. if (currentPagesMap.size === 1) {
  8788. setTimeout(() => {
  8789. handleBeforeEntryPageRoutes();
  8790. }, 0);
  8791. }
  8792. }
  8793. function normalizeRouteKey(path, id2) {
  8794. return path + SEP + id2;
  8795. }
  8796. function useKeepAliveRoute() {
  8797. const route = vueRouter.useRoute();
  8798. const routeKey = vue.computed(
  8799. () => normalizeRouteKey("/" + route.meta.route, getStateId())
  8800. );
  8801. const isTabBar = vue.computed(() => route.meta.isTabBar);
  8802. return {
  8803. routeKey,
  8804. isTabBar,
  8805. routeCache
  8806. };
  8807. }
  8808. const pageCacheMap = /* @__PURE__ */ new Map();
  8809. const routeCache = {
  8810. get(key) {
  8811. return pageCacheMap.get(key);
  8812. },
  8813. set(key, value) {
  8814. pruneRouteCache(key);
  8815. pageCacheMap.set(key, value);
  8816. },
  8817. delete(key) {
  8818. const vnode = pageCacheMap.get(key);
  8819. if (!vnode) {
  8820. return;
  8821. }
  8822. pageCacheMap.delete(key);
  8823. },
  8824. forEach(fn) {
  8825. pageCacheMap.forEach(fn);
  8826. }
  8827. };
  8828. function isTabBarVNode(vnode) {
  8829. return vnode.props.type === "tabBar";
  8830. }
  8831. function pruneRouteCache(key) {
  8832. const pageId = parseInt(key.split(SEP)[1]);
  8833. if (!pageId) {
  8834. return;
  8835. }
  8836. routeCache.forEach((vnode, key2) => {
  8837. const cPageId = parseInt(key2.split(SEP)[1]);
  8838. if (cPageId && cPageId > pageId) {
  8839. if (__UNI_FEATURE_TABBAR__ && isTabBarVNode(vnode)) {
  8840. return;
  8841. }
  8842. routeCache.delete(key2);
  8843. routeCache.pruneCacheEntry(vnode);
  8844. vue.nextTick(() => pruneCurrentPages());
  8845. }
  8846. });
  8847. }
  8848. function initRouter(app) {
  8849. const router = vueRouter.createRouter(createRouterOptions());
  8850. router.beforeEach((to, from) => {
  8851. if (to && from && to.meta.isTabBar && from.meta.isTabBar) {
  8852. saveTabBarScrollPosition(from.meta.tabBarIndex);
  8853. }
  8854. });
  8855. app.router = router;
  8856. app.use(router);
  8857. }
  8858. let positionStore = /* @__PURE__ */ Object.create(null);
  8859. function getTabBarScrollPosition(id2) {
  8860. return positionStore[id2];
  8861. }
  8862. function saveTabBarScrollPosition(id2) {
  8863. if (typeof window !== "undefined") {
  8864. positionStore[id2] = {
  8865. left: window.pageXOffset,
  8866. top: window.pageYOffset
  8867. };
  8868. }
  8869. }
  8870. const scrollBehavior = (to, from, savedPosition) => {
  8871. if (savedPosition) {
  8872. return savedPosition;
  8873. } else {
  8874. if (to && from && to.meta.isTabBar && from.meta.isTabBar) {
  8875. const position = getTabBarScrollPosition(to.meta.tabBarIndex);
  8876. if (position) {
  8877. return position;
  8878. }
  8879. }
  8880. return {
  8881. left: 0,
  8882. top: 0
  8883. };
  8884. }
  8885. };
  8886. function createRouterOptions() {
  8887. return {
  8888. history: initHistory(),
  8889. strict: !!__uniConfig.router.strict,
  8890. routes: __uniRoutes,
  8891. scrollBehavior
  8892. };
  8893. }
  8894. function initHistory() {
  8895. let { routerBase } = __uniConfig.router;
  8896. if (routerBase === "/") {
  8897. routerBase = "";
  8898. }
  8899. {
  8900. return vueRouter.createMemoryHistory(routerBase);
  8901. }
  8902. }
  8903. const index$c = {
  8904. install(app) {
  8905. initApp$1(app);
  8906. if (!app.config.warnHandler) {
  8907. app.config.warnHandler = warnHandler;
  8908. }
  8909. if (__UNI_FEATURE_PAGES__) {
  8910. initRouter(app);
  8911. }
  8912. }
  8913. };
  8914. function warnHandler(msg, instance, trace) {
  8915. if (instance) {
  8916. const name = instance.$.type.name;
  8917. if ("PageMetaHead" === name) {
  8918. return;
  8919. }
  8920. const parent = instance.$.parent;
  8921. if (parent && parent.type.name === "PageMeta") {
  8922. return;
  8923. }
  8924. }
  8925. const warnArgs = [`[Vue warn]: ${msg}`];
  8926. if (trace.length) {
  8927. warnArgs.push(`
  8928. `, trace);
  8929. }
  8930. console.warn(...warnArgs);
  8931. }
  8932. const clazz = { class: "uni-async-loading" };
  8933. const loadingVNode = /* @__PURE__ */ vue.createVNode(
  8934. "i",
  8935. { class: "uni-loading" },
  8936. null,
  8937. -1
  8938. /* HOISTED */
  8939. );
  8940. const AsyncLoadingComponent = /* @__PURE__ */ defineSystemComponent({
  8941. name: "AsyncLoading",
  8942. render() {
  8943. return vue.openBlock(), vue.createBlock("div", clazz, [loadingVNode]);
  8944. }
  8945. });
  8946. function reload() {
  8947. window.location.reload();
  8948. }
  8949. const AsyncErrorComponent = /* @__PURE__ */ defineSystemComponent({
  8950. name: "AsyncError",
  8951. setup() {
  8952. initI18nAsyncMsgsOnce();
  8953. const {
  8954. t: t2
  8955. } = useI18n();
  8956. return () => vue.createVNode("div", {
  8957. "class": "uni-async-error",
  8958. "onClick": reload
  8959. }, [t2("uni.async.error")], 8, ["onClick"]);
  8960. }
  8961. });
  8962. let appVm;
  8963. function getApp$1() {
  8964. return appVm;
  8965. }
  8966. function initApp(vm) {
  8967. appVm = vm;
  8968. Object.defineProperty(appVm.$.ctx, "$children", {
  8969. get() {
  8970. return getCurrentPages().map((page) => page.$vm);
  8971. }
  8972. });
  8973. const app = appVm.$.appContext.app;
  8974. if (!app.component(AsyncLoadingComponent.name)) {
  8975. app.component(AsyncLoadingComponent.name, AsyncLoadingComponent);
  8976. }
  8977. if (!app.component(AsyncErrorComponent.name)) {
  8978. app.component(AsyncErrorComponent.name, AsyncErrorComponent);
  8979. }
  8980. initAppVm(appVm);
  8981. defineGlobalData(appVm);
  8982. }
  8983. function wrapperComponentSetup(comp, { clone, init, setup, before }) {
  8984. if (clone) {
  8985. comp = shared.extend({}, comp);
  8986. }
  8987. before && before(comp);
  8988. const oldSetup = comp.setup;
  8989. comp.setup = (props2, ctx) => {
  8990. const instance = vue.getCurrentInstance();
  8991. init(instance.proxy);
  8992. const query = setup(instance);
  8993. if (oldSetup) {
  8994. return oldSetup(query || props2, ctx);
  8995. }
  8996. };
  8997. return comp;
  8998. }
  8999. function setupComponent(comp, options) {
  9000. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  9001. return wrapperComponentSetup(comp.default, options);
  9002. }
  9003. return wrapperComponentSetup(comp, options);
  9004. }
  9005. function setupWindow(comp, id2) {
  9006. return setupComponent(comp, {
  9007. init: (vm) => {
  9008. vm.$page = {
  9009. id: id2
  9010. };
  9011. },
  9012. setup(instance) {
  9013. instance.$pageInstance = instance;
  9014. }
  9015. });
  9016. }
  9017. function setupPage(comp) {
  9018. if (process.env.NODE_ENV !== "production") {
  9019. comp.__mpType = "page";
  9020. }
  9021. return setupComponent(comp, {
  9022. clone: true,
  9023. // 页面组件可能会被其他地方手动引用,比如 windows 等,需要 clone 一份新的作为页面组件
  9024. init: initPage,
  9025. setup(instance) {
  9026. instance.$pageInstance = instance;
  9027. const route = usePageRoute();
  9028. const query = uniShared.decodedQuery(route.query);
  9029. instance.attrs.__pageQuery = query;
  9030. instance.proxy.$page.options = query;
  9031. instance.proxy.options = query;
  9032. {
  9033. return query;
  9034. }
  9035. }
  9036. });
  9037. }
  9038. function setupApp(comp) {
  9039. if (process.env.NODE_ENV !== "production") {
  9040. comp.__mpType = "app";
  9041. }
  9042. return setupComponent(comp, {
  9043. init: initApp,
  9044. setup(instance) {
  9045. const route = usePageRoute();
  9046. {
  9047. return route.query;
  9048. }
  9049. },
  9050. before(comp2) {
  9051. comp2.mpType = "app";
  9052. const { setup } = comp2;
  9053. const render = () => {
  9054. return vue.openBlock(), vue.createBlock(LayoutComponent);
  9055. };
  9056. comp2.setup = (props2, ctx) => {
  9057. const res = setup && setup(props2, ctx);
  9058. return shared.isFunction(res) ? render : res;
  9059. };
  9060. comp2.render = render;
  9061. }
  9062. });
  9063. }
  9064. function formatTime(val) {
  9065. val = val > 0 && val < Infinity ? val : 0;
  9066. const h = Math.floor(val / 3600);
  9067. const m = Math.floor(val % 3600 / 60);
  9068. const s = Math.floor(val % 3600 % 60);
  9069. const hStr = (h < 10 ? "0" : "") + h;
  9070. const mStr = (m < 10 ? "0" : "") + m;
  9071. const sStr = (s < 10 ? "0" : "") + s;
  9072. let str = mStr + ":" + sStr;
  9073. if (hStr !== "00") {
  9074. str = hStr + ":" + str;
  9075. }
  9076. return str;
  9077. }
  9078. function useGesture(props2, videoRef, fullscreenState) {
  9079. const state = vue.reactive({
  9080. gestureType: "none",
  9081. volumeOld: 0,
  9082. volumeNew: 0,
  9083. currentTimeOld: 0,
  9084. currentTimeNew: 0
  9085. });
  9086. const touchStartOrigin = {
  9087. x: 0,
  9088. y: 0
  9089. };
  9090. function onTouchstart(event) {
  9091. const toucher = event.targetTouches[0];
  9092. touchStartOrigin.x = toucher.pageX;
  9093. touchStartOrigin.y = toucher.pageY;
  9094. state.gestureType = "none";
  9095. state.volumeOld = 0;
  9096. state.currentTimeOld = state.currentTimeNew = 0;
  9097. }
  9098. function onTouchmove(event) {
  9099. function stop() {
  9100. event.stopPropagation();
  9101. event.preventDefault();
  9102. }
  9103. if (fullscreenState.fullscreen) {
  9104. stop();
  9105. }
  9106. const gestureType = state.gestureType;
  9107. if (gestureType === "stop") {
  9108. return;
  9109. }
  9110. const toucher = event.targetTouches[0];
  9111. const pageX = toucher.pageX;
  9112. const pageY = toucher.pageY;
  9113. const origin = touchStartOrigin;
  9114. const video = videoRef.value;
  9115. if (gestureType === "progress") {
  9116. changeProgress(pageX - origin.x);
  9117. } else if (gestureType === "volume") {
  9118. changeVolume(pageY - origin.y);
  9119. }
  9120. if (gestureType !== "none") {
  9121. return;
  9122. }
  9123. if (Math.abs(pageX - origin.x) > Math.abs(pageY - origin.y)) {
  9124. if (!props2.enableProgressGesture) {
  9125. state.gestureType = "stop";
  9126. return;
  9127. }
  9128. state.gestureType = "progress";
  9129. state.currentTimeOld = state.currentTimeNew = video.currentTime;
  9130. if (!fullscreenState.fullscreen) {
  9131. stop();
  9132. }
  9133. } else {
  9134. if (!props2.pageGesture) {
  9135. state.gestureType = "stop";
  9136. return;
  9137. }
  9138. state.gestureType = "volume";
  9139. state.volumeOld = video.volume;
  9140. if (!fullscreenState.fullscreen) {
  9141. stop();
  9142. }
  9143. }
  9144. }
  9145. function onTouchend(event) {
  9146. const video = videoRef.value;
  9147. if (state.gestureType !== "none" && state.gestureType !== "stop") {
  9148. event.stopPropagation();
  9149. event.preventDefault();
  9150. }
  9151. if (state.gestureType === "progress" && state.currentTimeOld !== state.currentTimeNew) {
  9152. video.currentTime = state.currentTimeNew;
  9153. }
  9154. state.gestureType = "none";
  9155. }
  9156. function changeProgress(x) {
  9157. const video = videoRef.value;
  9158. const duration = video.duration;
  9159. let currentTimeNew = x / 600 * duration + state.currentTimeOld;
  9160. if (currentTimeNew < 0) {
  9161. currentTimeNew = 0;
  9162. } else if (currentTimeNew > duration) {
  9163. currentTimeNew = duration;
  9164. }
  9165. state.currentTimeNew = currentTimeNew;
  9166. }
  9167. function changeVolume(y) {
  9168. const video = videoRef.value;
  9169. const valueOld = state.volumeOld;
  9170. let value;
  9171. if (typeof valueOld === "number") {
  9172. value = valueOld - y / 200;
  9173. if (value < 0) {
  9174. value = 0;
  9175. } else if (value > 1) {
  9176. value = 1;
  9177. }
  9178. video.volume = value;
  9179. state.volumeNew = value;
  9180. }
  9181. }
  9182. return {
  9183. state,
  9184. onTouchstart,
  9185. onTouchmove,
  9186. onTouchend
  9187. };
  9188. }
  9189. function useFullscreen(trigger, containerRef, videoRef, userActionState, rootRef) {
  9190. const state = vue.reactive({
  9191. fullscreen: false
  9192. });
  9193. const isSafari = /^Apple/.test(navigator.vendor);
  9194. function onFullscreenChange($event, webkit) {
  9195. if (webkit && document.fullscreenEnabled) {
  9196. return;
  9197. }
  9198. emitFullscreenChange(!!(document.fullscreenElement || document.webkitFullscreenElement));
  9199. }
  9200. function emitFullscreenChange(val) {
  9201. state.fullscreen = val;
  9202. trigger("fullscreenchange", {}, {
  9203. fullScreen: val,
  9204. direction: "vertical"
  9205. });
  9206. }
  9207. function toggleFullscreen(val) {
  9208. const root = rootRef.value;
  9209. const container = containerRef.value;
  9210. const video = videoRef.value;
  9211. let mockFullScreen;
  9212. if (val) {
  9213. if ((document.fullscreenEnabled || document.webkitFullscreenEnabled) && (!isSafari || userActionState.userAction)) {
  9214. container[document.fullscreenEnabled ? "requestFullscreen" : "webkitRequestFullscreen"]();
  9215. } else if (video.webkitEnterFullScreen) {
  9216. video.webkitEnterFullScreen();
  9217. } else {
  9218. mockFullScreen = true;
  9219. container.remove();
  9220. container.classList.add("uni-video-type-fullscreen");
  9221. document.body.appendChild(container);
  9222. }
  9223. } else {
  9224. if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
  9225. if (document.fullscreenElement) {
  9226. document.exitFullscreen();
  9227. } else if (document.webkitFullscreenElement) {
  9228. document.webkitExitFullscreen();
  9229. }
  9230. } else if (video.webkitExitFullScreen) {
  9231. video.webkitExitFullScreen();
  9232. } else {
  9233. mockFullScreen = true;
  9234. container.remove();
  9235. container.classList.remove("uni-video-type-fullscreen");
  9236. root.appendChild(container);
  9237. }
  9238. }
  9239. if (mockFullScreen) {
  9240. emitFullscreenChange(val);
  9241. }
  9242. }
  9243. function requestFullScreen() {
  9244. toggleFullscreen(true);
  9245. }
  9246. function exitFullScreen() {
  9247. toggleFullscreen(false);
  9248. }
  9249. return {
  9250. state,
  9251. onFullscreenChange,
  9252. emitFullscreenChange,
  9253. toggleFullscreen,
  9254. requestFullScreen,
  9255. exitFullScreen
  9256. };
  9257. }
  9258. function useVideo(props2, attrs, trigger) {
  9259. const videoRef = vue.ref(null);
  9260. const src = vue.computed(() => getRealPath(props2.src));
  9261. const muted = vue.computed(() => props2.muted === "true" || props2.muted === true);
  9262. const state = vue.reactive({
  9263. start: false,
  9264. src,
  9265. playing: false,
  9266. currentTime: 0,
  9267. duration: 0,
  9268. progress: 0,
  9269. buffered: 0,
  9270. muted
  9271. });
  9272. vue.watch(() => src.value, () => {
  9273. state.playing = false;
  9274. state.currentTime = 0;
  9275. });
  9276. vue.watch(() => state.buffered, (buffered) => {
  9277. trigger("progress", {}, {
  9278. buffered
  9279. });
  9280. });
  9281. vue.watch(() => muted.value, (muted2) => {
  9282. const video = videoRef.value;
  9283. video.muted = muted2;
  9284. });
  9285. function onDurationChange({
  9286. target
  9287. }) {
  9288. state.duration = target.duration;
  9289. }
  9290. function onLoadedMetadata($event) {
  9291. const initialTime = Number(props2.initialTime) || 0;
  9292. const video = $event.target;
  9293. if (initialTime > 0) {
  9294. video.currentTime = initialTime;
  9295. }
  9296. trigger("loadedmetadata", $event, {
  9297. width: video.videoWidth,
  9298. height: video.videoHeight,
  9299. duration: video.duration
  9300. });
  9301. onProgress($event);
  9302. }
  9303. function onProgress($event) {
  9304. const video = $event.target;
  9305. const buffered = video.buffered;
  9306. if (buffered.length) {
  9307. state.buffered = buffered.end(buffered.length - 1) / video.duration * 100;
  9308. }
  9309. }
  9310. function onWaiting($event) {
  9311. trigger("waiting", $event, {});
  9312. }
  9313. function onVideoError($event) {
  9314. state.playing = false;
  9315. trigger("error", $event, {});
  9316. }
  9317. function onPlay($event) {
  9318. state.start = true;
  9319. state.playing = true;
  9320. trigger("play", $event, {});
  9321. }
  9322. function onPause($event) {
  9323. state.playing = false;
  9324. trigger("pause", $event, {});
  9325. }
  9326. function onEnded($event) {
  9327. state.playing = false;
  9328. trigger("ended", $event, {});
  9329. }
  9330. function onTimeUpdate($event) {
  9331. const video = $event.target;
  9332. const currentTime = state.currentTime = video.currentTime;
  9333. trigger("timeupdate", $event, {
  9334. currentTime,
  9335. duration: video.duration
  9336. });
  9337. }
  9338. function toggle() {
  9339. const video = videoRef.value;
  9340. if (state.playing) {
  9341. video.pause();
  9342. } else {
  9343. video.play();
  9344. }
  9345. }
  9346. function play() {
  9347. const video = videoRef.value;
  9348. state.start = true;
  9349. video.play();
  9350. }
  9351. function pause() {
  9352. const video = videoRef.value;
  9353. video.pause();
  9354. }
  9355. function seek(position) {
  9356. const video = videoRef.value;
  9357. position = Number(position);
  9358. if (typeof position === "number" && !isNaN(position)) {
  9359. video.currentTime = position;
  9360. }
  9361. }
  9362. function stop() {
  9363. seek(0);
  9364. pause();
  9365. }
  9366. function playbackRate(rate) {
  9367. const video = videoRef.value;
  9368. video.playbackRate = rate;
  9369. }
  9370. return {
  9371. videoRef,
  9372. state,
  9373. play,
  9374. pause,
  9375. stop,
  9376. seek,
  9377. playbackRate,
  9378. toggle,
  9379. onDurationChange,
  9380. onLoadedMetadata,
  9381. onProgress,
  9382. onWaiting,
  9383. onVideoError,
  9384. onPlay,
  9385. onPause,
  9386. onEnded,
  9387. onTimeUpdate
  9388. };
  9389. }
  9390. function useControls(props2, videoState, seek) {
  9391. const progressRef = vue.ref(null);
  9392. const ballRef = vue.ref(null);
  9393. const centerPlayBtnShow = vue.computed(() => props2.showCenterPlayBtn && !videoState.start);
  9394. const controlsVisible = vue.ref(true);
  9395. const controlsShow = vue.computed(() => !centerPlayBtnShow.value && props2.controls && controlsVisible.value);
  9396. const state = vue.reactive({
  9397. touching: false,
  9398. controlsTouching: false,
  9399. centerPlayBtnShow,
  9400. controlsShow,
  9401. controlsVisible
  9402. });
  9403. function clickProgress(event) {
  9404. const $progress = progressRef.value;
  9405. let element = event.target;
  9406. let x = event.offsetX;
  9407. while (element && element !== $progress) {
  9408. x += element.offsetLeft;
  9409. element = element.parentNode;
  9410. }
  9411. const w = $progress.offsetWidth;
  9412. let progress = 0;
  9413. if (x >= 0 && x <= w) {
  9414. progress = x / w;
  9415. seek(videoState.duration * progress);
  9416. }
  9417. }
  9418. function toggleControls() {
  9419. state.controlsVisible = !state.controlsVisible;
  9420. }
  9421. let hideTiming;
  9422. function autoHideStart() {
  9423. hideTiming = setTimeout(() => {
  9424. state.controlsVisible = false;
  9425. }, 3e3);
  9426. }
  9427. function autoHideEnd() {
  9428. if (hideTiming) {
  9429. clearTimeout(hideTiming);
  9430. hideTiming = null;
  9431. }
  9432. }
  9433. vue.watch(() => state.controlsShow && videoState.playing && !state.controlsTouching, (val) => {
  9434. if (val) {
  9435. autoHideStart();
  9436. } else {
  9437. autoHideEnd();
  9438. }
  9439. });
  9440. vue.watch([() => videoState.currentTime, () => {
  9441. props2.duration;
  9442. }], function updateProgress() {
  9443. if (!state.touching) {
  9444. videoState.progress = videoState.currentTime / videoState.duration * 100;
  9445. }
  9446. });
  9447. return {
  9448. state,
  9449. progressRef,
  9450. ballRef,
  9451. clickProgress,
  9452. toggleControls,
  9453. autoHideStart,
  9454. autoHideEnd
  9455. };
  9456. }
  9457. function useDanmu(props2, videoState) {
  9458. const danmuRef = vue.ref(null);
  9459. const state = vue.reactive({
  9460. enable: Boolean(props2.enableDanmu)
  9461. });
  9462. let danmuIndex = {
  9463. time: 0,
  9464. index: -1
  9465. };
  9466. const danmuList = shared.isArray(props2.danmuList) ? JSON.parse(JSON.stringify(props2.danmuList)) : [];
  9467. danmuList.sort(function(a, b) {
  9468. return (a.time || 0) - (b.time || 0);
  9469. });
  9470. function toggleDanmu() {
  9471. state.enable = !state.enable;
  9472. }
  9473. function updateDanmu(event) {
  9474. const video = event.target;
  9475. const currentTime = video.currentTime;
  9476. const oldDanmuIndex = danmuIndex;
  9477. const newDanmuIndex = {
  9478. time: currentTime,
  9479. index: oldDanmuIndex.index
  9480. };
  9481. if (currentTime > oldDanmuIndex.time) {
  9482. for (let index2 = oldDanmuIndex.index + 1; index2 < danmuList.length; index2++) {
  9483. const element = danmuList[index2];
  9484. if (currentTime >= (element.time || 0)) {
  9485. newDanmuIndex.index = index2;
  9486. if (videoState.playing && state.enable) {
  9487. playDanmu(element);
  9488. }
  9489. } else {
  9490. break;
  9491. }
  9492. }
  9493. } else if (currentTime < oldDanmuIndex.time) {
  9494. for (let index2 = oldDanmuIndex.index - 1; index2 > -1; index2--) {
  9495. const element = danmuList[index2];
  9496. if (currentTime <= (element.time || 0)) {
  9497. newDanmuIndex.index = index2 - 1;
  9498. } else {
  9499. break;
  9500. }
  9501. }
  9502. }
  9503. danmuIndex = newDanmuIndex;
  9504. }
  9505. function playDanmu(danmu) {
  9506. const p2 = document.createElement("p");
  9507. p2.className = "uni-video-danmu-item";
  9508. p2.innerText = danmu.text;
  9509. let style = `bottom: ${Math.random() * 100}%;color: ${danmu.color};`;
  9510. p2.setAttribute("style", style);
  9511. const danmuEl = danmuRef.value;
  9512. danmuEl.appendChild(p2);
  9513. setTimeout(function() {
  9514. style += "left: 0;-webkit-transform: translateX(-100%);transform: translateX(-100%);";
  9515. p2.setAttribute("style", style);
  9516. setTimeout(function() {
  9517. p2.remove();
  9518. }, 4e3);
  9519. }, 17);
  9520. }
  9521. function sendDanmu(danmu) {
  9522. danmuList.splice(danmuIndex.index + 1, 0, {
  9523. text: String(danmu.text),
  9524. color: danmu.color,
  9525. time: videoState.currentTime || 0
  9526. });
  9527. }
  9528. return {
  9529. state,
  9530. danmuRef,
  9531. updateDanmu,
  9532. toggleDanmu,
  9533. sendDanmu
  9534. };
  9535. }
  9536. function useContext(play, pause, stop, seek, sendDanmu, playbackRate, requestFullScreen, exitFullScreen) {
  9537. useContextInfo();
  9538. useSubscribe();
  9539. }
  9540. const props$9 = {
  9541. id: {
  9542. type: String,
  9543. default: ""
  9544. },
  9545. src: {
  9546. type: String,
  9547. default: ""
  9548. },
  9549. duration: {
  9550. type: [Number, String],
  9551. default: ""
  9552. },
  9553. controls: {
  9554. type: [Boolean, String],
  9555. default: true
  9556. },
  9557. danmuList: {
  9558. type: Array,
  9559. default() {
  9560. return [];
  9561. }
  9562. },
  9563. danmuBtn: {
  9564. type: [Boolean, String],
  9565. default: false
  9566. },
  9567. enableDanmu: {
  9568. type: [Boolean, String],
  9569. default: false
  9570. },
  9571. autoplay: {
  9572. type: [Boolean, String],
  9573. default: false
  9574. },
  9575. loop: {
  9576. type: [Boolean, String],
  9577. default: false
  9578. },
  9579. muted: {
  9580. type: [Boolean, String],
  9581. default: false
  9582. },
  9583. objectFit: {
  9584. type: String,
  9585. default: "contain"
  9586. },
  9587. poster: {
  9588. type: String,
  9589. default: ""
  9590. },
  9591. direction: {
  9592. type: [String, Number],
  9593. default: ""
  9594. },
  9595. showProgress: {
  9596. type: Boolean,
  9597. default: true
  9598. },
  9599. initialTime: {
  9600. type: [String, Number],
  9601. default: 0
  9602. },
  9603. showFullscreenBtn: {
  9604. type: [Boolean, String],
  9605. default: true
  9606. },
  9607. pageGesture: {
  9608. type: [Boolean, String],
  9609. default: false
  9610. },
  9611. enableProgressGesture: {
  9612. type: [Boolean, String],
  9613. default: true
  9614. },
  9615. showPlayBtn: {
  9616. type: [Boolean, String],
  9617. default: true
  9618. },
  9619. showCenterPlayBtn: {
  9620. type: [Boolean, String],
  9621. default: true
  9622. }
  9623. };
  9624. const index$b = /* @__PURE__ */ defineBuiltInComponent({
  9625. name: "Video",
  9626. props: props$9,
  9627. emits: ["fullscreenchange", "progress", "loadedmetadata", "waiting", "error", "play", "pause", "ended", "timeupdate"],
  9628. setup(props2, {
  9629. emit: emit2,
  9630. attrs,
  9631. slots
  9632. }) {
  9633. const rootRef = vue.ref(null);
  9634. const containerRef = vue.ref(null);
  9635. const trigger = useCustomEvent(rootRef, emit2);
  9636. const {
  9637. state: userActionState
  9638. } = useUserAction();
  9639. const {
  9640. $attrs: videoAttrs
  9641. } = useAttrs({
  9642. excludeListeners: true
  9643. });
  9644. const {
  9645. t: t2
  9646. } = useI18n();
  9647. initI18nVideoMsgsOnce();
  9648. const {
  9649. videoRef,
  9650. state: videoState,
  9651. play,
  9652. pause,
  9653. stop,
  9654. seek,
  9655. playbackRate,
  9656. toggle,
  9657. onDurationChange,
  9658. onLoadedMetadata,
  9659. onProgress,
  9660. onWaiting,
  9661. onVideoError,
  9662. onPlay,
  9663. onPause,
  9664. onEnded,
  9665. onTimeUpdate
  9666. } = useVideo(props2, attrs, trigger);
  9667. const {
  9668. state: danmuState,
  9669. danmuRef,
  9670. updateDanmu,
  9671. toggleDanmu,
  9672. sendDanmu
  9673. } = useDanmu(props2, videoState);
  9674. const {
  9675. state: fullscreenState,
  9676. onFullscreenChange,
  9677. emitFullscreenChange,
  9678. toggleFullscreen,
  9679. requestFullScreen,
  9680. exitFullScreen
  9681. } = useFullscreen(trigger, containerRef, videoRef, userActionState, rootRef);
  9682. const {
  9683. state: gestureState,
  9684. onTouchstart,
  9685. onTouchend,
  9686. onTouchmove
  9687. } = useGesture(props2, videoRef, fullscreenState);
  9688. const {
  9689. state: controlsState,
  9690. progressRef,
  9691. ballRef,
  9692. clickProgress,
  9693. toggleControls
  9694. } = useControls(props2, videoState, seek);
  9695. useContext();
  9696. return () => {
  9697. return vue.createVNode("uni-video", {
  9698. "ref": rootRef,
  9699. "id": props2.id,
  9700. "onClick": toggleControls
  9701. }, [vue.createVNode("div", {
  9702. "ref": containerRef,
  9703. "class": "uni-video-container",
  9704. "onTouchstart": onTouchstart,
  9705. "onTouchend": onTouchend,
  9706. "onTouchmove": onTouchmove,
  9707. "onFullscreenchange": vue.withModifiers(onFullscreenChange, ["stop"]),
  9708. "onWebkitfullscreenchange": vue.withModifiers(($event) => onFullscreenChange($event, true), ["stop"])
  9709. }, [vue.createVNode("video", vue.mergeProps({
  9710. "ref": videoRef,
  9711. "style": {
  9712. "object-fit": props2.objectFit
  9713. },
  9714. "muted": !!props2.muted,
  9715. "loop": !!props2.loop,
  9716. "src": videoState.src,
  9717. "poster": props2.poster,
  9718. "autoplay": !!props2.autoplay
  9719. }, videoAttrs.value, {
  9720. "class": "uni-video-video",
  9721. "webkit-playsinline": true,
  9722. "playsinline": true,
  9723. "onDurationchange": onDurationChange,
  9724. "onLoadedmetadata": onLoadedMetadata,
  9725. "onProgress": onProgress,
  9726. "onWaiting": onWaiting,
  9727. "onError": onVideoError,
  9728. "onPlay": onPlay,
  9729. "onPause": onPause,
  9730. "onEnded": onEnded,
  9731. "onTimeupdate": (event) => {
  9732. onTimeUpdate(event);
  9733. updateDanmu(event);
  9734. },
  9735. "onWebkitbeginfullscreen": () => emitFullscreenChange(true),
  9736. "onX5videoenterfullscreen": () => emitFullscreenChange(true),
  9737. "onWebkitendfullscreen": () => emitFullscreenChange(false),
  9738. "onX5videoexitfullscreen": () => emitFullscreenChange(false)
  9739. }), null, 16, ["muted", "loop", "src", "poster", "autoplay", "webkit-playsinline", "playsinline", "onDurationchange", "onLoadedmetadata", "onProgress", "onWaiting", "onError", "onPlay", "onPause", "onEnded", "onTimeupdate", "onWebkitbeginfullscreen", "onX5videoenterfullscreen", "onWebkitendfullscreen", "onX5videoexitfullscreen"]), vue.withDirectives(vue.createVNode("div", {
  9740. "class": "uni-video-bar uni-video-bar-full",
  9741. "onClick": vue.withModifiers(() => {
  9742. }, ["stop"])
  9743. }, [vue.createVNode("div", {
  9744. "class": "uni-video-controls"
  9745. }, [vue.withDirectives(vue.createVNode("div", {
  9746. "class": {
  9747. "uni-video-control-button": true,
  9748. "uni-video-control-button-play": !videoState.playing,
  9749. "uni-video-control-button-pause": videoState.playing
  9750. },
  9751. "onClick": vue.withModifiers(toggle, ["stop"])
  9752. }, null, 10, ["onClick"]), [[vue.vShow, props2.showPlayBtn]]), vue.withDirectives(vue.createVNode("div", {
  9753. "class": "uni-video-current-time"
  9754. }, [formatTime(videoState.currentTime)], 512), [[vue.vShow, props2.showProgress]]), vue.withDirectives(vue.createVNode("div", {
  9755. "ref": progressRef,
  9756. "class": "uni-video-progress-container",
  9757. "onClick": vue.withModifiers(clickProgress, ["stop"])
  9758. }, [vue.createVNode("div", {
  9759. "class": "uni-video-progress"
  9760. }, [vue.createVNode("div", {
  9761. "style": {
  9762. width: videoState.buffered + "%"
  9763. },
  9764. "class": "uni-video-progress-buffered"
  9765. }, null, 4), vue.createVNode("div", {
  9766. "ref": ballRef,
  9767. "style": {
  9768. left: videoState.progress + "%"
  9769. },
  9770. "class": "uni-video-ball"
  9771. }, [vue.createVNode("div", {
  9772. "class": "uni-video-inner"
  9773. }, null)], 4)])], 8, ["onClick"]), [[vue.vShow, props2.showProgress]]), vue.withDirectives(vue.createVNode("div", {
  9774. "class": "uni-video-duration"
  9775. }, [formatTime(Number(props2.duration) || videoState.duration)], 512), [[vue.vShow, props2.showProgress]])]), vue.withDirectives(vue.createVNode("div", {
  9776. "class": {
  9777. "uni-video-danmu-button": true,
  9778. "uni-video-danmu-button-active": danmuState.enable
  9779. },
  9780. "onClick": vue.withModifiers(toggleDanmu, ["stop"])
  9781. }, [t2("uni.video.danmu")], 10, ["onClick"]), [[vue.vShow, props2.danmuBtn]]), vue.withDirectives(vue.createVNode("div", {
  9782. "class": {
  9783. "uni-video-fullscreen": true,
  9784. "uni-video-type-fullscreen": fullscreenState.fullscreen
  9785. },
  9786. "onClick": vue.withModifiers(() => toggleFullscreen(!fullscreenState.fullscreen), ["stop"])
  9787. }, null, 10, ["onClick"]), [[vue.vShow, props2.showFullscreenBtn]])], 8, ["onClick"]), [[vue.vShow, controlsState.controlsShow]]), vue.withDirectives(vue.createVNode("div", {
  9788. "ref": danmuRef,
  9789. "style": "z-index: 0;",
  9790. "class": "uni-video-danmu"
  9791. }, null, 512), [[vue.vShow, videoState.start && danmuState.enable]]), controlsState.centerPlayBtnShow && vue.createVNode("div", {
  9792. "class": "uni-video-cover",
  9793. "onClick": vue.withModifiers(() => {
  9794. }, ["stop"])
  9795. }, [vue.createVNode("div", {
  9796. "class": "uni-video-cover-play-button",
  9797. "onClick": vue.withModifiers(play, ["stop"])
  9798. }, null, 8, ["onClick"]), vue.createVNode("p", {
  9799. "class": "uni-video-cover-duration"
  9800. }, [formatTime(Number(props2.duration) || videoState.duration)])], 8, ["onClick"]), vue.createVNode("div", {
  9801. "class": {
  9802. "uni-video-toast": true,
  9803. "uni-video-toast-volume": gestureState.gestureType === "volume"
  9804. }
  9805. }, [vue.createVNode("div", {
  9806. "class": "uni-video-toast-title"
  9807. }, [t2("uni.video.volume")]), vue.createVNode("svg", {
  9808. "class": "uni-video-toast-icon",
  9809. "width": "200px",
  9810. "height": "200px",
  9811. "viewBox": "0 0 1024 1024",
  9812. "version": "1.1",
  9813. "xmlns": "http://www.w3.org/2000/svg"
  9814. }, [vue.createVNode("path", {
  9815. "d": "M475.400704 201.19552l0 621.674496q0 14.856192-10.856448 25.71264t-25.71264 10.856448-25.71264-10.856448l-190.273536-190.273536-149.704704 0q-14.856192 0-25.71264-10.856448t-10.856448-25.71264l0-219.414528q0-14.856192 10.856448-25.71264t25.71264-10.856448l149.704704 0 190.273536-190.273536q10.856448-10.856448 25.71264-10.856448t25.71264 10.856448 10.856448 25.71264zm219.414528 310.837248q0 43.425792-24.28416 80.851968t-64.2816 53.425152q-5.71392 2.85696-14.2848 2.85696-14.856192 0-25.71264-10.570752t-10.856448-25.998336q0-11.999232 6.856704-20.284416t16.570368-14.2848 19.427328-13.142016 16.570368-20.284416 6.856704-32.569344-6.856704-32.569344-16.570368-20.284416-19.427328-13.142016-16.570368-14.2848-6.856704-20.284416q0-15.427584 10.856448-25.998336t25.71264-10.570752q8.57088 0 14.2848 2.85696 39.99744 15.427584 64.2816 53.139456t24.28416 81.137664zm146.276352 0q0 87.422976-48.56832 161.41824t-128.5632 107.707392q-7.428096 2.85696-14.2848 2.85696-15.427584 0-26.284032-10.856448t-10.856448-25.71264q0-22.284288 22.284288-33.712128 31.997952-16.570368 43.425792-25.141248 42.283008-30.855168 65.995776-77.423616t23.712768-99.136512-23.712768-99.136512-65.995776-77.423616q-11.42784-8.57088-43.425792-25.141248-22.284288-11.42784-22.284288-33.712128 0-14.856192 10.856448-25.71264t25.71264-10.856448q7.428096 0 14.856192 2.85696 79.99488 33.712128 128.5632 107.707392t48.56832 161.41824zm146.276352 0q0 131.42016-72.566784 241.41312t-193.130496 161.989632q-7.428096 2.85696-14.856192 2.85696-14.856192 0-25.71264-10.856448t-10.856448-25.71264q0-20.570112 22.284288-33.712128 3.999744-2.285568 12.85632-5.999616t12.85632-5.999616q26.284032-14.2848 46.854144-29.140992 70.281216-51.996672 109.707264-129.705984t39.426048-165.132288-39.426048-165.132288-109.707264-129.705984q-20.570112-14.856192-46.854144-29.140992-3.999744-2.285568-12.85632-5.999616t-12.85632-5.999616q-22.284288-13.142016-22.284288-33.712128 0-14.856192 10.856448-25.71264t25.71264-10.856448q7.428096 0 14.856192 2.85696 120.563712 51.996672 193.130496 161.989632t72.566784 241.41312z"
  9816. }, null)]), vue.createVNode("div", {
  9817. "class": "uni-video-toast-value"
  9818. }, [vue.createVNode("div", {
  9819. "style": {
  9820. width: gestureState.volumeNew * 100 + "%"
  9821. },
  9822. "class": "uni-video-toast-value-content"
  9823. }, [vue.createVNode("div", {
  9824. "class": "uni-video-toast-volume-grids"
  9825. }, [vue.renderList(10, () => vue.createVNode("div", {
  9826. "class": "uni-video-toast-volume-grids-item"
  9827. }, null))])], 4)])], 2), vue.createVNode("div", {
  9828. "class": {
  9829. "uni-video-toast": true,
  9830. "uni-video-toast-progress": gestureState.gestureType === "progress"
  9831. }
  9832. }, [vue.createVNode("div", {
  9833. "class": "uni-video-toast-title"
  9834. }, [formatTime(gestureState.currentTimeNew), " / ", formatTime(videoState.duration)])], 2), vue.createVNode("div", {
  9835. "class": "uni-video-slots"
  9836. }, [slots.default && slots.default()])], 40, ["onTouchstart", "onTouchend", "onTouchmove", "onFullscreenchange", "onWebkitfullscreenchange"])], 8, ["id", "onClick"]);
  9837. };
  9838. }
  9839. });
  9840. const onWebInvokeAppService = ({ name, arg }) => {
  9841. if (name === "postMessage")
  9842. ;
  9843. else {
  9844. uni[name](arg);
  9845. }
  9846. };
  9847. const Invoke = /* @__PURE__ */ uniShared.once(() => UniServiceJSBridge.on(uniShared.ON_WEB_INVOKE_APP_SERVICE, onWebInvokeAppService));
  9848. const props$8 = {
  9849. src: {
  9850. type: String,
  9851. default: ""
  9852. }
  9853. };
  9854. const indexX = /* @__PURE__ */ defineBuiltInComponent({
  9855. inheritAttrs: false,
  9856. name: "WebView",
  9857. props: props$8,
  9858. setup(props2) {
  9859. Invoke();
  9860. const rootRef = vue.ref(null);
  9861. vue.ref(null);
  9862. const {
  9863. $attrs,
  9864. $excludeAttrs,
  9865. $listeners
  9866. } = useAttrs({
  9867. excludeListeners: true
  9868. });
  9869. return () => {
  9870. return vue.createVNode("uni-web-view", vue.mergeProps({
  9871. "class": "uni-webview"
  9872. }, $listeners.value, $excludeAttrs.value, {
  9873. "ref": rootRef
  9874. }), null, 16);
  9875. };
  9876. }
  9877. });
  9878. const ICON_PATH_ORIGIN = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACECAMAAABmmnOVAAAC01BMVEUAAAAAef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef96quGStdqStdpbnujMzMzCyM7Gyc7Ky83MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMwAef8GfP0yjfNWnOp0qOKKsdyYt9mju9aZt9mMstx1qeJYnekyjvIIfP0qivVmouaWttnMzMyat9lppOUujPQKffxhoOfNzc3Y2Njh4eHp6enu7u7y8vL19fXv7+/i4uLZ2dnOzs6auNgOf/sKff15quHR0dHx8fH9/f3////j4+N6quFdn+iywdPb29vw8PD+/v7c3NyywtLa2tr29vbS0tLd3d38/Pzf39/o6Ojc7f+q0v+HwP9rsf9dqv9Hnv9Vpv/q6urj8P+Vx/9Am/8Pgf8Iff/z8/OAvP95uf/n5+c5l//V6f+52v+y1//7+/vt7e0rkP/09PTQ0NDq9P8Whf+cy//W1tbe3t7A3v/m5ubs7OxOov/r6+vk5OQiaPjKAAAAknRSTlMACBZ9oB71/jiqywJBZATT6hBukRXv+zDCAVrkDIf4JbQsTb7eVeJLbwfa8Rh4G/OlPS/6/kxQ9/xdmZudoJxNVhng7B6wtWdzAtQOipcF1329wS44doK/BAkyP1pvgZOsrbnGXArAg34G2IsD1eMRe7bi7k5YnqFT9V0csyPedQyYD3p/Fje+hDpskq/MwpRBC6yKp2MAAAQdSURBVHja7Zn1exMxGIAPHbrhDsPdneHuNtzd3d3dIbjLh93o2o4i7TpgG1Jk0g0mMNwd/gTa5rq129reHnK5e/bk/TFNk/dJ7r5894XjGAwGg8GgTZasCpDIll1+hxw5vXLJLpEboTx5ZXbIhyzkl9fB28cqUaCgrBKFkI3CcjoUKYolihWXUSI7EihRUjaHXF52CVRKLoe8eZIdUOkyMknkRw6UlcehYAFHiXK+skgURk6Ul8OhQjFnCVRRBolKqRxQ5SzUHaqgNGSj7VCmalqJnDkoS5RF6ZCbroNvufQkUD6qEuXTdUA+3hQdqiEXVKfnUKOmK4latalJ1EEuoZZ6162HJ9x/4OChw0eOHj12/MTJU6dxG7XUu751tjNnz4ET5y9ctLZTSr0beKFLl89bpuUDrqgC1RqNWqsKuqqzNFw7e51S6u3tc+OmZUJ9kCHY6ECwOkRvab51iUrqXej2HYDQsHBjWgx3Ae7dppB6N2wEcF9jdMGDUIDGTaR2aNoM9FqjG7QmaN5CWgc/gIePjG559BigpZQOrYB/4jBfRGRUtDkmJjY6KjLCofkpD62lc2gDfMpWPIuLdwyV8XEpHgaddBZ+wBuSFcwJqSN2ovmZ/dfnOvCTxqGtwzq8SEjv4EhISn48eWgnhUP7DvDSvgzxrs6vV6+FLiro2EkCic4QKkzwJsH1KYreCp0eQhfyDl1B/w4P/xa5JVJ4U03QjbRD9x7wXlgH5IE3wmMBHXoSlugFAcI6f/AkkSi8q6HQm6xDn77wEQ8djTwSj3tqAMguRTe4ikeOQyJ4YV+KfkQl+oNW5GbY4gWOWgbwJ+kwAD6Fi90MK2ZsrIeBBCUGwRXbqJ+/iJMQliIEBhOU6AJhtlG/IpHE2bqrYQg5h6HA4yQiRqwEfkGCdTCMmMRw+IbPDCQaHCsCYAQxiZHw3TbmD/ESOHgHwShiEqPhp/gggYkSztIxxCRawy/bmEniJaJtfwiEscQkxkFgRqJESqQwwHhiEuMBp3Vm8RK/cZoHEzKXhCK2QxEPpiJe0YlKCFaKCNv/cYBNUsBRPlkJSc0U+dM7E9H0ThGJbgZT/iR7yj+VqMS06Qr4+OFm2JdCxIa8lugzkJs5K6MfxAaYPUcBpYG5khZJEkUUSb7DPCnKRfPBXj6M8FwuegoLpCgXcQszVjhbJFUJUee2hBhLoYTIcYtB57KY+opSMdVqwatSlZVj05aV//CwJLMX2DluaUcwhXm4ali2XOoLjxUrPV26zFtF4f5p0Gp310+z13BUWNvbehEXona6iAtX/zVZmtfN4WixfsNky4S6gCCVVq3RPLdfSfpv3MRRZfPoLc6Xs/5bt3EyMGzE9h07/Xft2t15z6i9+zgGg8FgMBgMBoPBYDAYDAYj8/APG67Rie8pUDsAAAAASUVORK5CYII=";
  9879. var MapType = /* @__PURE__ */ ((MapType2) => {
  9880. MapType2["QQ"] = "qq";
  9881. MapType2["GOOGLE"] = "google";
  9882. MapType2["AMAP"] = "AMap";
  9883. MapType2["BMAP"] = "BMapGL";
  9884. MapType2["UNKNOWN"] = "";
  9885. return MapType2;
  9886. })(MapType || {});
  9887. function getMapInfo() {
  9888. if (__uniConfig.bMapKey) {
  9889. return {
  9890. type: "BMapGL",
  9891. key: __uniConfig.bMapKey
  9892. };
  9893. }
  9894. if (__uniConfig.qqMapKey) {
  9895. return {
  9896. type: "qq",
  9897. key: __uniConfig.qqMapKey
  9898. };
  9899. }
  9900. if (__uniConfig.googleMapKey) {
  9901. return {
  9902. type: "google",
  9903. key: __uniConfig.googleMapKey
  9904. };
  9905. }
  9906. if (__uniConfig.aMapKey) {
  9907. return {
  9908. type: "AMap",
  9909. key: __uniConfig.aMapKey,
  9910. securityJsCode: __uniConfig.aMapSecurityJsCode,
  9911. serviceHost: __uniConfig.aMapServiceHost
  9912. };
  9913. }
  9914. return {
  9915. type: "",
  9916. key: ""
  9917. };
  9918. }
  9919. let IS_AMAP = false;
  9920. let hasGetIsAMap = false;
  9921. const getIsAMap = () => {
  9922. if (hasGetIsAMap) {
  9923. return IS_AMAP;
  9924. } else {
  9925. hasGetIsAMap = true;
  9926. return IS_AMAP = getMapInfo().type === "AMap";
  9927. }
  9928. };
  9929. const getIsBMap = () => {
  9930. return getMapInfo().type === "BMapGL";
  9931. };
  9932. const props$7 = {
  9933. id: {
  9934. type: [Number, String],
  9935. default: ""
  9936. },
  9937. latitude: {
  9938. type: [Number, String],
  9939. require: true
  9940. },
  9941. longitude: {
  9942. type: [Number, String],
  9943. require: true
  9944. },
  9945. title: {
  9946. type: String,
  9947. default: ""
  9948. },
  9949. iconPath: {
  9950. type: String,
  9951. require: true
  9952. },
  9953. rotate: {
  9954. type: [Number, String],
  9955. default: 0
  9956. },
  9957. alpha: {
  9958. type: [Number, String],
  9959. default: 1
  9960. },
  9961. width: {
  9962. type: [Number, String],
  9963. default: ""
  9964. },
  9965. height: {
  9966. type: [Number, String],
  9967. default: ""
  9968. },
  9969. callout: {
  9970. type: Object,
  9971. default: null
  9972. },
  9973. label: {
  9974. type: Object,
  9975. default: null
  9976. },
  9977. anchor: {
  9978. type: Object,
  9979. default: null
  9980. },
  9981. clusterId: {
  9982. type: [Number, String],
  9983. default: ""
  9984. },
  9985. customCallout: {
  9986. type: Object,
  9987. default: null
  9988. },
  9989. ariaLabel: {
  9990. type: String,
  9991. default: ""
  9992. }
  9993. };
  9994. function useMarkerLabelStyle(id2) {
  9995. const className = "uni-map-marker-label-" + id2;
  9996. const styleEl = document.createElement("style");
  9997. styleEl.id = className;
  9998. document.head.appendChild(styleEl);
  9999. return function updateMarkerLabelStyle(style) {
  10000. const newStyle = Object.assign({}, style, {
  10001. position: "absolute",
  10002. top: "70px",
  10003. borderStyle: "solid"
  10004. });
  10005. const div = document.createElement("div");
  10006. Object.keys(newStyle).forEach((key) => {
  10007. div.style[key] = newStyle[key] || "";
  10008. });
  10009. styleEl.innerText = `.${className}{${div.getAttribute("style")}}`;
  10010. return className;
  10011. };
  10012. }
  10013. const MapMarker = /* @__PURE__ */ defineSystemComponent({
  10014. name: "MapMarker",
  10015. props: props$7,
  10016. setup(props2) {
  10017. const id2 = String(!isNaN(Number(props2.id)) ? props2.id : "");
  10018. const onMapReady = vue.inject("onMapReady");
  10019. const updateMarkerLabelStyle = useMarkerLabelStyle(id2);
  10020. let marker;
  10021. function removeMarkerCallout(callout) {
  10022. if (getIsAMap()) {
  10023. callout.removeAMapText();
  10024. } else {
  10025. callout.setMap(null);
  10026. }
  10027. }
  10028. onMapReady((map, maps, trigger) => {
  10029. function updateMarker(option) {
  10030. const title = option.title;
  10031. let position;
  10032. if (getIsAMap()) {
  10033. position = new maps.LngLat(option.longitude, option.latitude);
  10034. } else if (getIsBMap()) {
  10035. position = new maps.Point(option.longitude, option.latitude);
  10036. } else {
  10037. position = new maps.LatLng(option.latitude, option.longitude);
  10038. }
  10039. const img = new Image();
  10040. let imgHeight = 0;
  10041. img.onload = () => {
  10042. const anchor = option.anchor || {};
  10043. let icon;
  10044. let w;
  10045. let h;
  10046. let top;
  10047. let x = typeof anchor.x === "number" ? anchor.x : 0.5;
  10048. let y = typeof anchor.y === "number" ? anchor.y : 1;
  10049. if (option.iconPath && (option.width || option.height)) {
  10050. w = option.width || img.width / img.height * option.height;
  10051. h = option.height || img.height / img.width * option.width;
  10052. } else {
  10053. w = img.width / 2;
  10054. h = img.height / 2;
  10055. }
  10056. imgHeight = h;
  10057. top = h - (h - y * h);
  10058. if ("MarkerImage" in maps) {
  10059. icon = new maps.MarkerImage(img.src, null, null, new maps.Point(x * w, y * h), new maps.Size(w, h));
  10060. } else if ("Icon" in maps) {
  10061. icon = new maps.Icon({
  10062. image: img.src,
  10063. size: new maps.Size(w, h),
  10064. imageSize: new maps.Size(w, h),
  10065. imageOffset: new maps.Pixel(x * w, y * h)
  10066. });
  10067. } else {
  10068. icon = {
  10069. url: img.src,
  10070. anchor: new maps.Point(x, y),
  10071. size: new maps.Size(w, h)
  10072. };
  10073. }
  10074. if (getIsBMap()) {
  10075. marker = new maps.Marker(new maps.Point(position.lng, position.lat));
  10076. map.addOverlay(marker);
  10077. } else {
  10078. marker.setPosition(position);
  10079. marker.setIcon(icon);
  10080. }
  10081. if ("setRotation" in marker) {
  10082. marker.setRotation(option.rotate || 0);
  10083. }
  10084. const labelOpt = option.label || {};
  10085. if ("label" in marker) {
  10086. marker.label.setMap(null);
  10087. delete marker.label;
  10088. }
  10089. let label;
  10090. if (labelOpt.content) {
  10091. const labelStyle = {
  10092. borderColor: labelOpt.borderColor,
  10093. borderWidth: (Number(labelOpt.borderWidth) || 0) + "px",
  10094. padding: (Number(labelOpt.padding) || 0) + "px",
  10095. borderRadius: (Number(labelOpt.borderRadius) || 0) + "px",
  10096. backgroundColor: labelOpt.bgColor,
  10097. color: labelOpt.color,
  10098. fontSize: (labelOpt.fontSize || 14) + "px",
  10099. lineHeight: (labelOpt.fontSize || 14) + "px",
  10100. marginLeft: (Number(labelOpt.anchorX || labelOpt.x) || 0) + "px",
  10101. marginTop: (Number(labelOpt.anchorY || labelOpt.y) || 0) + "px"
  10102. };
  10103. if ("Label" in maps) {
  10104. label = new maps.Label({
  10105. position,
  10106. map,
  10107. clickable: false,
  10108. content: labelOpt.content,
  10109. style: labelStyle
  10110. });
  10111. marker.label = label;
  10112. } else if ("setLabel" in marker) {
  10113. if (getIsAMap()) {
  10114. const content = `<div style="
  10115. margin-left:${labelStyle.marginLeft};
  10116. margin-top:${labelStyle.marginTop};
  10117. padding:${labelStyle.padding};
  10118. background-color:${labelStyle.backgroundColor};
  10119. border-radius:${labelStyle.borderRadius};
  10120. line-height:${labelStyle.lineHeight};
  10121. color:${labelStyle.color};
  10122. font-size:${labelStyle.fontSize};
  10123. ">
  10124. ${labelOpt.content}
  10125. <div>`;
  10126. marker.setLabel({
  10127. content,
  10128. direction: "bottom-right"
  10129. });
  10130. } else {
  10131. const className = updateMarkerLabelStyle(labelStyle);
  10132. marker.setLabel({
  10133. text: labelOpt.content,
  10134. color: labelStyle.color,
  10135. fontSize: labelStyle.fontSize,
  10136. className
  10137. });
  10138. }
  10139. }
  10140. }
  10141. const calloutOpt = option.callout || {};
  10142. let callout = marker.callout;
  10143. let calloutStyle;
  10144. if (calloutOpt.content || title) {
  10145. if (getIsAMap() && calloutOpt.content) {
  10146. calloutOpt.content = calloutOpt.content.replaceAll("\n", "<br/>");
  10147. }
  10148. const boxShadow = "0px 0px 3px 1px rgba(0,0,0,0.5)";
  10149. let offsetY = -imgHeight / 2;
  10150. if (option.width || option.height) {
  10151. offsetY += 14 - imgHeight / 2;
  10152. }
  10153. calloutStyle = calloutOpt.content ? {
  10154. position,
  10155. map,
  10156. top,
  10157. // handle AMap callout offset
  10158. offsetY,
  10159. content: calloutOpt.content,
  10160. color: calloutOpt.color,
  10161. fontSize: calloutOpt.fontSize,
  10162. borderRadius: calloutOpt.borderRadius,
  10163. bgColor: calloutOpt.bgColor,
  10164. padding: calloutOpt.padding,
  10165. boxShadow: calloutOpt.boxShadow || boxShadow,
  10166. display: calloutOpt.display
  10167. } : {
  10168. position,
  10169. map,
  10170. top,
  10171. // handle AMap callout offset
  10172. offsetY,
  10173. content: title,
  10174. boxShadow
  10175. };
  10176. if (callout) {
  10177. callout.setOption(calloutStyle);
  10178. } else {
  10179. if (getIsAMap()) {
  10180. const callback = () => {
  10181. if (id2 !== "") {
  10182. trigger("callouttap", {}, {
  10183. markerId: Number(id2)
  10184. });
  10185. }
  10186. };
  10187. callout = marker.callout = new maps.Callout(calloutStyle, callback);
  10188. } else {
  10189. callout = marker.callout = new maps.Callout(calloutStyle);
  10190. callout.div.onclick = function($event) {
  10191. if (id2 !== "") {
  10192. trigger("callouttap", $event, {
  10193. markerId: Number(id2)
  10194. });
  10195. }
  10196. $event.stopPropagation();
  10197. $event.preventDefault();
  10198. };
  10199. if (getMapInfo().type === MapType.GOOGLE) {
  10200. callout.div.ontouchstart = function($event) {
  10201. $event.stopPropagation();
  10202. };
  10203. callout.div.onpointerdown = function($event) {
  10204. $event.stopPropagation();
  10205. };
  10206. }
  10207. }
  10208. }
  10209. } else {
  10210. if (callout) {
  10211. removeMarkerCallout(callout);
  10212. delete marker.callout;
  10213. }
  10214. }
  10215. };
  10216. if (option.iconPath) {
  10217. img.src = getRealPath(option.iconPath);
  10218. } else {
  10219. console.error("Marker.iconPath is required.");
  10220. }
  10221. }
  10222. function addMarker(props3) {
  10223. if (!getIsBMap()) {
  10224. marker = new maps.Marker({
  10225. map,
  10226. flat: true,
  10227. autoRotation: false
  10228. });
  10229. }
  10230. updateMarker(props3);
  10231. const MapsEvent = maps.event || maps.Event;
  10232. if (getIsBMap())
  10233. ;
  10234. else {
  10235. MapsEvent.addListener(marker, "click", () => {
  10236. const callout = marker.callout;
  10237. if (callout && !callout.alwaysVisible) {
  10238. if (getIsAMap()) {
  10239. callout.visible = !callout.visible;
  10240. if (callout.visible) {
  10241. marker.callout.createAMapText();
  10242. } else {
  10243. marker.callout.removeAMapText();
  10244. }
  10245. } else {
  10246. callout.set("visible", !callout.visible);
  10247. if (callout.visible) {
  10248. const div = callout.div;
  10249. const parent = div.parentNode;
  10250. parent.removeChild(div);
  10251. parent.appendChild(div);
  10252. }
  10253. }
  10254. }
  10255. if (id2) {
  10256. trigger("markertap", {}, {
  10257. markerId: Number(id2),
  10258. latitude: props3.latitude,
  10259. longitude: props3.longitude
  10260. });
  10261. }
  10262. });
  10263. }
  10264. }
  10265. addMarker(props2);
  10266. vue.watch(props2, updateMarker);
  10267. });
  10268. if (id2) {
  10269. const addMapChidlContext = vue.inject("addMapChidlContext");
  10270. vue.inject("removeMapChidlContext");
  10271. const context = {
  10272. id: id2,
  10273. translate(data) {
  10274. onMapReady((map, maps, trigger) => {
  10275. const destination = data.destination;
  10276. const duration = data.duration;
  10277. const autoRotate = !!data.autoRotate;
  10278. let rotate = Number(data.rotate) || 0;
  10279. let rotation = 0;
  10280. if ("getRotation" in marker) {
  10281. rotation = marker.getRotation();
  10282. }
  10283. const a = marker.getPosition();
  10284. const b = new maps.LatLng(destination.latitude, destination.longitude);
  10285. const distance = maps.geometry.spherical.computeDistanceBetween(a, b) / 1e3;
  10286. const time = (typeof duration === "number" ? duration : 1e3) / (1e3 * 60 * 60);
  10287. const speed = distance / time;
  10288. const MapsEvent = maps.event || maps.Event;
  10289. const movingEvent = MapsEvent.addListener(marker, "moving", (e2) => {
  10290. const latLng = e2.latLng;
  10291. const label = marker.label;
  10292. if (label) {
  10293. label.setPosition(latLng);
  10294. }
  10295. const callout = marker.callout;
  10296. if (callout) {
  10297. callout.setPosition(latLng);
  10298. }
  10299. });
  10300. const event = MapsEvent.addListener(marker, "moveend", () => {
  10301. event.remove();
  10302. movingEvent.remove();
  10303. marker.lastPosition = a;
  10304. marker.setPosition(b);
  10305. const label = marker.label;
  10306. if (label) {
  10307. label.setPosition(b);
  10308. }
  10309. const callout = marker.callout;
  10310. if (callout) {
  10311. callout.setPosition(b);
  10312. }
  10313. const cb = data.animationEnd;
  10314. if (shared.isFunction(cb)) {
  10315. cb();
  10316. }
  10317. });
  10318. let lastRtate = 0;
  10319. if (autoRotate) {
  10320. if (marker.lastPosition) {
  10321. lastRtate = maps.geometry.spherical.computeHeading(marker.lastPosition, a);
  10322. }
  10323. rotate = maps.geometry.spherical.computeHeading(a, b) - lastRtate;
  10324. }
  10325. if ("setRotation" in marker) {
  10326. marker.setRotation(rotation + rotate);
  10327. }
  10328. if ("moveTo" in marker) {
  10329. marker.moveTo(b, speed);
  10330. } else {
  10331. marker.setPosition(b);
  10332. MapsEvent.trigger(marker, "moveend", {});
  10333. }
  10334. });
  10335. }
  10336. };
  10337. addMapChidlContext(context);
  10338. }
  10339. return () => {
  10340. return null;
  10341. };
  10342. }
  10343. });
  10344. function hexToRgba(hex) {
  10345. if (!hex) {
  10346. return {
  10347. r: 0,
  10348. g: 0,
  10349. b: 0,
  10350. a: 0
  10351. };
  10352. }
  10353. let tmpHex = hex.slice(1);
  10354. const tmpHexLen = tmpHex.length;
  10355. if (![3, 4, 6, 8].includes(tmpHexLen)) {
  10356. return {
  10357. r: 0,
  10358. g: 0,
  10359. b: 0,
  10360. a: 0
  10361. };
  10362. }
  10363. if (tmpHexLen === 3 || tmpHexLen === 4) {
  10364. tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1");
  10365. }
  10366. let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g);
  10367. const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16);
  10368. if (!sa) {
  10369. return { r, g: g2, b, a: 1 };
  10370. }
  10371. return {
  10372. r,
  10373. g: g2,
  10374. b,
  10375. a: (`0x100${sa}` - 65536) / 255
  10376. };
  10377. }
  10378. const props$6 = {
  10379. points: {
  10380. type: Array,
  10381. require: true
  10382. },
  10383. color: {
  10384. type: String,
  10385. default: "#000000"
  10386. },
  10387. width: {
  10388. type: [Number, String],
  10389. default: ""
  10390. },
  10391. dottedLine: {
  10392. type: [Boolean, String],
  10393. default: false
  10394. },
  10395. arrowLine: {
  10396. type: [Boolean, String],
  10397. default: false
  10398. },
  10399. arrowIconPath: {
  10400. type: String,
  10401. default: ""
  10402. },
  10403. borderColor: {
  10404. type: String,
  10405. default: "#000000"
  10406. },
  10407. borderWidth: {
  10408. type: [Number, String],
  10409. default: ""
  10410. },
  10411. colorList: {
  10412. type: Array,
  10413. default() {
  10414. return [];
  10415. }
  10416. },
  10417. level: {
  10418. type: String,
  10419. default: ""
  10420. }
  10421. };
  10422. const MapPolyline = /* @__PURE__ */ defineSystemComponent({
  10423. name: "MapPolyline",
  10424. props: props$6,
  10425. setup(props2) {
  10426. const onMapReady = vue.inject("onMapReady");
  10427. let polyline;
  10428. let polylineBorder;
  10429. function removePolyline() {
  10430. if (polyline) {
  10431. polyline.setMap(null);
  10432. }
  10433. if (polylineBorder) {
  10434. polylineBorder.setMap(null);
  10435. }
  10436. }
  10437. onMapReady((map, maps) => {
  10438. function updatePolyline(option) {
  10439. removePolyline();
  10440. addPolyline(option);
  10441. }
  10442. function addPolyline(option) {
  10443. const path = [];
  10444. option.points.forEach((point) => {
  10445. let pointPosition;
  10446. if (getIsAMap()) {
  10447. pointPosition = [point.longitude, point.latitude];
  10448. } else if (getIsBMap()) {
  10449. pointPosition = new maps.Point(point.longitude, point.latitude);
  10450. } else {
  10451. pointPosition = new maps.LatLng(point.latitude, point.longitude);
  10452. }
  10453. path.push(pointPosition);
  10454. });
  10455. const strokeWeight = Number(option.width) || 1;
  10456. const {
  10457. r: sr,
  10458. g: sg,
  10459. b: sb,
  10460. a: sa
  10461. } = hexToRgba(option.color);
  10462. const {
  10463. r: br,
  10464. g: bg,
  10465. b: bb,
  10466. a: ba
  10467. } = hexToRgba(option.borderColor);
  10468. const polylineOptions = {
  10469. map,
  10470. clickable: false,
  10471. path,
  10472. strokeWeight,
  10473. strokeColor: option.color || void 0,
  10474. strokeDashStyle: option.dottedLine ? "dash" : "solid"
  10475. };
  10476. const borderWidth = Number(option.borderWidth) || 0;
  10477. const polylineBorderOptions = {
  10478. map,
  10479. clickable: false,
  10480. path,
  10481. strokeWeight: strokeWeight + borderWidth * 2,
  10482. strokeColor: option.borderColor || void 0,
  10483. strokeDashStyle: option.dottedLine ? "dash" : "solid"
  10484. };
  10485. if ("Color" in maps) {
  10486. polylineOptions.strokeColor = new maps.Color(sr, sg, sb, sa);
  10487. polylineBorderOptions.strokeColor = new maps.Color(br, bg, bb, ba);
  10488. } else {
  10489. polylineOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`;
  10490. polylineOptions.strokeOpacity = sa;
  10491. polylineBorderOptions.strokeColor = `rgb(${br}, ${bg}, ${bb})`;
  10492. polylineBorderOptions.strokeOpacity = ba;
  10493. }
  10494. if (borderWidth) {
  10495. polylineBorder = new maps.Polyline(polylineBorderOptions);
  10496. }
  10497. if (getIsBMap()) {
  10498. polyline = new maps.Polyline(polylineOptions.path, polylineOptions);
  10499. map.addOverlay(polyline);
  10500. } else {
  10501. polyline = new maps.Polyline(polylineOptions);
  10502. }
  10503. }
  10504. addPolyline(props2);
  10505. vue.watch(props2, updatePolyline);
  10506. });
  10507. return () => {
  10508. return null;
  10509. };
  10510. }
  10511. });
  10512. const props$5 = {
  10513. latitude: {
  10514. type: [Number, String],
  10515. require: true
  10516. },
  10517. longitude: {
  10518. type: [Number, String],
  10519. require: true
  10520. },
  10521. color: {
  10522. type: String,
  10523. default: "#000000"
  10524. },
  10525. fillColor: {
  10526. type: String,
  10527. default: "#00000000"
  10528. },
  10529. radius: {
  10530. type: [Number, String],
  10531. require: true
  10532. },
  10533. strokeWidth: {
  10534. type: [Number, String],
  10535. default: ""
  10536. },
  10537. level: {
  10538. type: String,
  10539. default: ""
  10540. }
  10541. };
  10542. const MapCircle = /* @__PURE__ */ defineSystemComponent({
  10543. name: "MapCircle",
  10544. props: props$5,
  10545. setup(props2) {
  10546. const onMapReady = vue.inject("onMapReady");
  10547. let circle;
  10548. function removeCircle() {
  10549. if (circle) {
  10550. circle.setMap(null);
  10551. }
  10552. }
  10553. onMapReady((map, maps) => {
  10554. function updateCircle(option) {
  10555. removeCircle();
  10556. addCircle(option);
  10557. }
  10558. function addCircle(option) {
  10559. const center = getIsAMap() || getIsBMap() ? [option.longitude, option.latitude] : new maps.LatLng(option.latitude, option.longitude);
  10560. const circleOptions = {
  10561. map,
  10562. center,
  10563. clickable: false,
  10564. radius: option.radius,
  10565. strokeWeight: Number(option.strokeWidth) || 1,
  10566. strokeDashStyle: "solid"
  10567. };
  10568. if (getIsBMap()) {
  10569. circleOptions.strokeColor = option.color;
  10570. circleOptions.fillColor = option.fillColor || "#000";
  10571. circleOptions.fillOpacity = 1;
  10572. } else {
  10573. const {
  10574. r: fr,
  10575. g: fg,
  10576. b: fb,
  10577. a: fa
  10578. } = hexToRgba(option.fillColor);
  10579. const {
  10580. r: sr,
  10581. g: sg,
  10582. b: sb,
  10583. a: sa
  10584. } = hexToRgba(option.color);
  10585. if ("Color" in maps) {
  10586. circleOptions.fillColor = new maps.Color(fr, fg, fb, fa);
  10587. circleOptions.strokeColor = new maps.Color(sr, sg, sb, sa);
  10588. } else {
  10589. circleOptions.fillColor = `rgb(${fr}, ${fg}, ${fb})`;
  10590. circleOptions.fillOpacity = fa;
  10591. circleOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`;
  10592. circleOptions.strokeOpacity = sa;
  10593. }
  10594. }
  10595. if (getIsBMap()) {
  10596. let pt = new maps.Point(
  10597. // @ts-ignore
  10598. circleOptions.center[0],
  10599. // @ts-ignore
  10600. circleOptions.center[1]
  10601. );
  10602. circle = new maps.Circle(pt, circleOptions.radius, circleOptions);
  10603. map.addOverlay(circle);
  10604. } else {
  10605. circle = new maps.Circle(circleOptions);
  10606. if (getIsAMap()) {
  10607. map.add(circle);
  10608. }
  10609. }
  10610. }
  10611. addCircle(props2);
  10612. vue.watch(props2, updateCircle);
  10613. });
  10614. return () => {
  10615. return null;
  10616. };
  10617. }
  10618. });
  10619. const props$4 = {
  10620. id: {
  10621. type: [Number, String],
  10622. default: ""
  10623. },
  10624. position: {
  10625. type: Object,
  10626. required: true
  10627. },
  10628. iconPath: {
  10629. type: String,
  10630. required: true
  10631. },
  10632. clickable: {
  10633. type: [Boolean, String],
  10634. default: ""
  10635. },
  10636. trigger: {
  10637. type: Function,
  10638. required: true
  10639. }
  10640. };
  10641. const MapControl = /* @__PURE__ */ defineSystemComponent({
  10642. name: "MapControl",
  10643. props: props$4,
  10644. setup(props2) {
  10645. const imgPath = vue.computed(() => getRealPath(props2.iconPath));
  10646. const positionStyle = vue.computed(() => {
  10647. let positionStyle2 = `top:${props2.position.top || 0}px;left:${props2.position.left || 0}px;`;
  10648. if (props2.position.width) {
  10649. positionStyle2 += `width:${props2.position.width}px;`;
  10650. }
  10651. if (props2.position.height) {
  10652. positionStyle2 += `height:${props2.position.height}px;`;
  10653. }
  10654. return positionStyle2;
  10655. });
  10656. const handleClick = ($event) => {
  10657. if (props2.clickable) {
  10658. props2.trigger("controltap", $event, {
  10659. controlId: props2.id
  10660. });
  10661. }
  10662. };
  10663. return () => {
  10664. return vue.createVNode("div", {
  10665. "class": "uni-map-control"
  10666. }, [vue.createVNode("img", {
  10667. "src": imgPath.value,
  10668. "style": positionStyle.value,
  10669. "class": "uni-map-control-icon",
  10670. "onClick": handleClick
  10671. }, null, 12, ["src", "onClick"])]);
  10672. };
  10673. }
  10674. });
  10675. const CONTEXT_ID = "MAP_LOCATION";
  10676. const MapLocation = /* @__PURE__ */ defineSystemComponent({
  10677. name: "MapLocation",
  10678. setup() {
  10679. const state = vue.reactive({
  10680. latitude: 0,
  10681. longitude: 0,
  10682. rotate: 0
  10683. });
  10684. return () => {
  10685. return state.latitude ? vue.createVNode(MapMarker, vue.mergeProps({
  10686. "anchor": {
  10687. x: 0.5,
  10688. y: 0.5
  10689. },
  10690. "width": "44",
  10691. "height": "44",
  10692. "iconPath": ICON_PATH_ORIGIN
  10693. }, state), null, 16, ["iconPath"]) : null;
  10694. };
  10695. }
  10696. });
  10697. const props$3 = {
  10698. // 边框虚线,腾讯地图支持,google 高德 地图不支持,默认值为[0, 0] 为实线,非 [0, 0] 为虚线,H5 端无法像微信小程序一样控制虚线的间隔像素大小
  10699. dashArray: {
  10700. type: Array,
  10701. default: () => [0, 0]
  10702. },
  10703. // 经纬度数组,[{latitude: 0, longitude: 0}]
  10704. points: {
  10705. type: Array,
  10706. required: true
  10707. },
  10708. // 描边的宽度
  10709. strokeWidth: {
  10710. type: Number,
  10711. default: 1
  10712. },
  10713. // 描边的颜色,十六进制
  10714. strokeColor: {
  10715. type: String,
  10716. default: "#000000"
  10717. },
  10718. // 填充颜色,十六进制
  10719. fillColor: {
  10720. type: String,
  10721. default: "#00000000"
  10722. },
  10723. // 设置多边形 Z 轴数值
  10724. zIndex: {
  10725. type: Number,
  10726. default: 0
  10727. }
  10728. };
  10729. const MapPolygon = /* @__PURE__ */ defineSystemComponent({
  10730. name: "MapPolygon",
  10731. props: props$3,
  10732. setup(props2) {
  10733. let polygonIns;
  10734. const onMapReady = vue.inject("onMapReady");
  10735. onMapReady((map, maps, trigger) => {
  10736. function drawPolygon() {
  10737. const {
  10738. points,
  10739. strokeWidth,
  10740. strokeColor,
  10741. dashArray,
  10742. fillColor,
  10743. zIndex
  10744. } = props2;
  10745. const path = points.map((item) => {
  10746. const {
  10747. latitude,
  10748. longitude
  10749. } = item;
  10750. if (getIsAMap()) {
  10751. return [longitude, latitude];
  10752. } else if (getIsBMap()) {
  10753. return new maps.Point(longitude, latitude);
  10754. } else {
  10755. return new maps.LatLng(latitude, longitude);
  10756. }
  10757. });
  10758. const {
  10759. r: fcR,
  10760. g: fcG,
  10761. b: fcB,
  10762. a: fcA
  10763. } = hexToRgba(fillColor);
  10764. const {
  10765. r: scR,
  10766. g: scG,
  10767. b: scB,
  10768. a: scA
  10769. } = hexToRgba(strokeColor);
  10770. const polygonOptions = {
  10771. //多边形是否可点击。
  10772. clickable: true,
  10773. //鼠标在多边形内的光标样式。
  10774. cursor: "crosshair",
  10775. //多边形是否可编辑。
  10776. editable: false,
  10777. // 地图实例,即要显示多边形的地图
  10778. // @ts-ignore
  10779. map,
  10780. // 区域填充色
  10781. fillColor: "",
  10782. //多边形的路径,以经纬度坐标数组构成。
  10783. path,
  10784. // 区域边框
  10785. strokeColor: "",
  10786. //多边形的边框样式。实线是solid,虚线是dash。
  10787. strokeDashStyle: dashArray.some((item) => item > 0) ? "dash" : "solid",
  10788. //多边形的边框线宽。
  10789. strokeWeight: strokeWidth,
  10790. //多边形是否可见。
  10791. visible: true,
  10792. //多边形的zIndex值。
  10793. zIndex
  10794. };
  10795. if (maps.Color) {
  10796. polygonOptions.fillColor = new maps.Color(fcR, fcG, fcB, fcA);
  10797. polygonOptions.strokeColor = new maps.Color(scR, scG, scB, scA);
  10798. } else {
  10799. polygonOptions.fillColor = `rgb(${fcR}, ${fcG}, ${fcB})`;
  10800. polygonOptions.fillOpacity = fcA;
  10801. polygonOptions.strokeColor = `rgb(${scR}, ${scG}, ${scB})`;
  10802. polygonOptions.strokeOpacity = scA;
  10803. }
  10804. if (polygonIns) {
  10805. polygonIns.setOptions(polygonOptions);
  10806. return;
  10807. }
  10808. if (getIsBMap()) {
  10809. polygonIns = new maps.Polygon(polygonOptions.path, polygonOptions);
  10810. map.addOverlay(polygonIns);
  10811. } else {
  10812. polygonIns = new maps.Polygon(polygonOptions);
  10813. }
  10814. }
  10815. drawPolygon();
  10816. vue.watch(props2, drawPolygon);
  10817. });
  10818. return () => null;
  10819. }
  10820. });
  10821. const props$2 = {
  10822. id: {
  10823. type: String,
  10824. default: ""
  10825. },
  10826. latitude: {
  10827. type: [String, Number],
  10828. default: 0
  10829. },
  10830. longitude: {
  10831. type: [String, Number],
  10832. default: 0
  10833. },
  10834. scale: {
  10835. type: [String, Number],
  10836. default: 16
  10837. },
  10838. markers: {
  10839. type: Array,
  10840. default() {
  10841. return [];
  10842. }
  10843. },
  10844. includePoints: {
  10845. type: Array,
  10846. default() {
  10847. return [];
  10848. }
  10849. },
  10850. polyline: {
  10851. type: Array,
  10852. default() {
  10853. return [];
  10854. }
  10855. },
  10856. circles: {
  10857. type: Array,
  10858. default() {
  10859. return [];
  10860. }
  10861. },
  10862. controls: {
  10863. type: Array,
  10864. default() {
  10865. return [];
  10866. }
  10867. },
  10868. showLocation: {
  10869. type: [Boolean, String],
  10870. default: false
  10871. },
  10872. libraries: {
  10873. type: Array,
  10874. default() {
  10875. return [];
  10876. }
  10877. },
  10878. polygons: {
  10879. type: Array,
  10880. default: () => []
  10881. }
  10882. };
  10883. function getPoints(points) {
  10884. const newPoints = [];
  10885. if (shared.isArray(points)) {
  10886. points.forEach((point) => {
  10887. if (point && point.latitude && point.longitude) {
  10888. newPoints.push({
  10889. latitude: point.latitude,
  10890. longitude: point.longitude
  10891. });
  10892. }
  10893. });
  10894. }
  10895. return newPoints;
  10896. }
  10897. function getAMapPosition(maps, latitude, longitude) {
  10898. return new maps.LngLat(longitude, latitude);
  10899. }
  10900. function getBMapPosition(maps, latitude, longitude) {
  10901. return new maps.Point(longitude, latitude);
  10902. }
  10903. function getGoogleOrQQMapPosition(maps, latitude, longitude) {
  10904. return new maps.LatLng(latitude, longitude);
  10905. }
  10906. function getMapPosition(maps, latitude, longitude) {
  10907. if (getIsBMap()) {
  10908. return getBMapPosition(maps, latitude, longitude);
  10909. } else if (getIsAMap()) {
  10910. return getAMapPosition(maps, latitude, longitude);
  10911. } else {
  10912. return getGoogleOrQQMapPosition(maps, latitude, longitude);
  10913. }
  10914. }
  10915. function getLat(latLng) {
  10916. if ("getLat" in latLng) {
  10917. return latLng.getLat();
  10918. } else {
  10919. if (getIsBMap()) {
  10920. return latLng.lat;
  10921. }
  10922. return latLng.lat();
  10923. }
  10924. }
  10925. function getLng(latLng) {
  10926. if ("getLng" in latLng) {
  10927. return latLng.getLng();
  10928. } else {
  10929. if (getIsBMap()) {
  10930. return latLng.lng;
  10931. }
  10932. return latLng.lng();
  10933. }
  10934. }
  10935. function useMap(props2, rootRef, emit2) {
  10936. const trigger = useCustomEvent(rootRef, emit2);
  10937. const mapRef = vue.ref(null);
  10938. let maps;
  10939. let map;
  10940. const state = vue.reactive({
  10941. latitude: Number(props2.latitude),
  10942. longitude: Number(props2.longitude),
  10943. includePoints: getPoints(props2.includePoints)
  10944. });
  10945. function onMapReady(callback) {
  10946. }
  10947. let isBoundsReady;
  10948. function onBoundsReady(callback) {
  10949. }
  10950. const contexts = {};
  10951. function addMapChidlContext(context) {
  10952. contexts[context.id] = context;
  10953. }
  10954. function removeMapChidlContext(context) {
  10955. delete contexts[context.id];
  10956. }
  10957. vue.watch([() => props2.latitude, () => props2.longitude], ([latitudeVlaue, longitudeVlaue]) => {
  10958. const latitude = Number(latitudeVlaue);
  10959. const longitude = Number(longitudeVlaue);
  10960. if (latitude !== state.latitude || longitude !== state.longitude) {
  10961. state.latitude = latitude;
  10962. state.longitude = longitude;
  10963. }
  10964. });
  10965. vue.watch(() => props2.includePoints, (points) => {
  10966. state.includePoints = getPoints(points);
  10967. }, {
  10968. deep: true
  10969. });
  10970. function updateBounds() {
  10971. if (getIsAMap()) {
  10972. const points = [];
  10973. state.includePoints.forEach((point) => {
  10974. points.push([point.longitude, point.latitude]);
  10975. });
  10976. const bounds = new maps.Bounds(...points);
  10977. map.setBounds(bounds);
  10978. } else if (getIsBMap())
  10979. ;
  10980. else {
  10981. const bounds = new maps.LatLngBounds();
  10982. state.includePoints.forEach(({
  10983. latitude,
  10984. longitude
  10985. }) => {
  10986. const latLng = new maps.LatLng(latitude, longitude);
  10987. bounds.extend(latLng);
  10988. });
  10989. map.fitBounds(bounds);
  10990. }
  10991. }
  10992. try {
  10993. const id2 = useContextInfo();
  10994. useSubscribe((type, data = {}) => {
  10995. switch (type) {
  10996. case "getCenterLocation":
  10997. onMapReady(() => {
  10998. const center = map.getCenter();
  10999. uniShared.callOptions(data, {
  11000. latitude: getLat(center),
  11001. longitude: getLng(center),
  11002. errMsg: `${type}:ok`
  11003. });
  11004. });
  11005. break;
  11006. case "moveToLocation":
  11007. {
  11008. let latitude = Number(data.latitude);
  11009. let longitude = Number(data.longitude);
  11010. if (!latitude || !longitude) {
  11011. const context = contexts[CONTEXT_ID];
  11012. if (context) {
  11013. latitude = context.state.latitude;
  11014. longitude = context.state.longitude;
  11015. }
  11016. }
  11017. if (latitude && longitude) {
  11018. state.latitude = latitude;
  11019. state.longitude = longitude;
  11020. if (map)
  11021. ;
  11022. onMapReady(() => {
  11023. uniShared.callOptions(data, `${type}:ok`);
  11024. });
  11025. } else {
  11026. uniShared.callOptions(data, `${type}:fail`);
  11027. }
  11028. }
  11029. break;
  11030. case "translateMarker":
  11031. onMapReady(() => {
  11032. const context = contexts[data.markerId];
  11033. if (context) {
  11034. try {
  11035. context.translate(data);
  11036. } catch (error) {
  11037. uniShared.callOptions(data, `${type}:fail ${error.message}`);
  11038. }
  11039. uniShared.callOptions(data, `${type}:ok`);
  11040. } else {
  11041. uniShared.callOptions(data, `${type}:fail not found`);
  11042. }
  11043. });
  11044. break;
  11045. case "includePoints":
  11046. state.includePoints = getPoints(data.includePoints);
  11047. if (isBoundsReady || getIsAMap()) {
  11048. updateBounds();
  11049. }
  11050. onBoundsReady(() => {
  11051. uniShared.callOptions(data, `${type}:ok`);
  11052. });
  11053. break;
  11054. case "getRegion":
  11055. onBoundsReady(() => {
  11056. const latLngBounds = map.getBounds();
  11057. const southwest = latLngBounds.getSouthWest();
  11058. const northeast = latLngBounds.getNorthEast();
  11059. uniShared.callOptions(data, {
  11060. southwest: {
  11061. latitude: getLat(southwest),
  11062. longitude: getLng(southwest)
  11063. },
  11064. northeast: {
  11065. latitude: getLat(northeast),
  11066. longitude: getLng(northeast)
  11067. },
  11068. errMsg: `${type}:ok`
  11069. });
  11070. });
  11071. break;
  11072. case "getScale":
  11073. onMapReady(() => {
  11074. uniShared.callOptions(data, {
  11075. scale: map.getZoom(),
  11076. errMsg: `${type}:ok`
  11077. });
  11078. });
  11079. break;
  11080. }
  11081. }, id2, true);
  11082. } catch (error) {
  11083. }
  11084. vue.provide("onMapReady", onMapReady);
  11085. vue.provide("addMapChidlContext", addMapChidlContext);
  11086. vue.provide("removeMapChidlContext", removeMapChidlContext);
  11087. return {
  11088. state,
  11089. mapRef,
  11090. trigger
  11091. };
  11092. }
  11093. const index$a = /* @__PURE__ */ defineBuiltInComponent({
  11094. name: "Map",
  11095. props: props$2,
  11096. emits: ["markertap", "labeltap", "callouttap", "controltap", "regionchange", "tap", "click", "updated", "update:scale", "update:latitude", "update:longitude"],
  11097. setup(props2, {
  11098. emit: emit2,
  11099. slots
  11100. }) {
  11101. const rootRef = vue.ref(null);
  11102. const {
  11103. mapRef,
  11104. trigger
  11105. } = useMap(props2, rootRef, emit2);
  11106. return () => {
  11107. return vue.createVNode("uni-map", {
  11108. "ref": rootRef,
  11109. "id": props2.id
  11110. }, [vue.createVNode("div", {
  11111. "ref": mapRef,
  11112. "style": "width: 100%; height: 100%; position: relative; overflow: hidden"
  11113. }, null, 512), props2.markers.map((item) => vue.createVNode(MapMarker, vue.mergeProps({
  11114. "key": item.id
  11115. }, item), null, 16)), props2.polyline.map((item) => vue.createVNode(MapPolyline, item, null, 16)), props2.circles.map((item) => vue.createVNode(MapCircle, item, null, 16)), props2.controls.map((item) => vue.createVNode(MapControl, vue.mergeProps(item, {
  11116. "trigger": trigger
  11117. }), null, 16, ["trigger"])), props2.showLocation && vue.createVNode(MapLocation, null, null), props2.polygons.map((item) => vue.createVNode(MapPolygon, item, null, 16)), vue.createVNode("div", {
  11118. "style": "position: absolute;top: 0;width: 100%;height: 100%;overflow: hidden;pointer-events: none;"
  11119. }, [slots.default && slots.default()])], 8, ["id"]);
  11120. };
  11121. }
  11122. });
  11123. const props$1 = {
  11124. scrollTop: {
  11125. type: [String, Number],
  11126. default: 0
  11127. }
  11128. };
  11129. const index$9 = /* @__PURE__ */ defineBuiltInComponent({
  11130. name: "CoverView",
  11131. compatConfig: {
  11132. MODE: 3
  11133. },
  11134. props: props$1,
  11135. setup(props2, {
  11136. slots
  11137. }) {
  11138. const root = vue.ref(null);
  11139. const content = vue.ref(null);
  11140. vue.watch(() => props2.scrollTop, (val) => {
  11141. setScrollTop(val);
  11142. });
  11143. function setScrollTop(val) {
  11144. let _content = content.value;
  11145. if (getComputedStyle(_content).overflowY === "scroll") {
  11146. _content.scrollTop = _upx2pxNum(val);
  11147. }
  11148. }
  11149. function _upx2pxNum(val) {
  11150. let _val = String(val);
  11151. if (/\d+[ur]px$/i.test(_val)) {
  11152. _val.replace(/\d+[ur]px$/i, (text) => {
  11153. return String(uni.upx2px(parseFloat(text)));
  11154. });
  11155. }
  11156. return parseFloat(_val) || 0;
  11157. }
  11158. return () => {
  11159. return vue.createVNode("uni-cover-view", {
  11160. "scroll-top": props2.scrollTop,
  11161. "ref": root
  11162. }, [vue.createVNode("div", {
  11163. "ref": content,
  11164. "class": "uni-cover-view"
  11165. }, [slots.default && slots.default()], 512)], 8, ["scroll-top"]);
  11166. };
  11167. }
  11168. });
  11169. const index$8 = /* @__PURE__ */ defineBuiltInComponent({
  11170. name: "CoverImage",
  11171. compatConfig: {
  11172. MODE: 3
  11173. },
  11174. props: {
  11175. src: {
  11176. type: String,
  11177. default: ""
  11178. }
  11179. },
  11180. emits: ["load", "error"],
  11181. setup(props2, {
  11182. emit: emit2
  11183. }) {
  11184. const root = vue.ref(null);
  11185. const trigger = useCustomEvent(root, emit2);
  11186. function load($event) {
  11187. trigger("load", $event);
  11188. }
  11189. function error($event) {
  11190. trigger("error", $event);
  11191. }
  11192. return () => {
  11193. const {
  11194. src
  11195. } = props2;
  11196. return vue.createVNode("uni-cover-image", {
  11197. "ref": root,
  11198. "src": src
  11199. }, [vue.createVNode("div", {
  11200. "class": "uni-cover-image"
  11201. }, [src ? vue.createVNode("img", {
  11202. "src": getRealPath(src),
  11203. "onLoad": load,
  11204. "onError": error
  11205. }, null, 40, ["src", "onLoad", "onError"]) : null])], 8, ["src"]);
  11206. };
  11207. }
  11208. });
  11209. function usePopupStyle(props2) {
  11210. const popupWidth = vue.ref(0);
  11211. const popupHeight = vue.ref(0);
  11212. const isDesktop = vue.computed(
  11213. () => popupWidth.value >= 500 && popupHeight.value >= 500
  11214. );
  11215. const popupStyle = vue.computed(() => {
  11216. const style = {
  11217. content: {
  11218. transform: "",
  11219. left: "",
  11220. top: "",
  11221. bottom: ""
  11222. },
  11223. triangle: {
  11224. left: "",
  11225. top: "",
  11226. bottom: "",
  11227. "border-width": "",
  11228. "border-color": ""
  11229. }
  11230. };
  11231. const contentStyle = style.content;
  11232. const triangleStyle = style.triangle;
  11233. const popover = props2.popover;
  11234. function getNumber(value) {
  11235. return Number(value) || 0;
  11236. }
  11237. if (isDesktop.value && popover) {
  11238. shared.extend(triangleStyle, {
  11239. position: "absolute",
  11240. width: "0",
  11241. height: "0",
  11242. "margin-left": "-6px",
  11243. "border-style": "solid"
  11244. });
  11245. const popoverLeft = getNumber(popover.left);
  11246. const popoverWidth = getNumber(popover.width);
  11247. const popoverTop = getNumber(popover.top);
  11248. const popoverHeight = getNumber(popover.height);
  11249. const center = popoverLeft + popoverWidth / 2;
  11250. contentStyle.transform = "none !important";
  11251. const contentLeft = Math.max(0, center - 300 / 2);
  11252. contentStyle.left = `${contentLeft}px`;
  11253. let triangleLeft = Math.max(12, center - contentLeft);
  11254. triangleLeft = Math.min(300 - 12, triangleLeft);
  11255. triangleStyle.left = `${triangleLeft}px`;
  11256. const vcl = popupHeight.value / 2;
  11257. if (popoverTop + popoverHeight - vcl > vcl - popoverTop) {
  11258. contentStyle.top = "auto";
  11259. contentStyle.bottom = `${popupHeight.value - popoverTop + 6}px`;
  11260. triangleStyle.bottom = "-6px";
  11261. triangleStyle["border-width"] = "6px 6px 0 6px";
  11262. triangleStyle["border-color"] = "#fcfcfd transparent transparent transparent";
  11263. } else {
  11264. contentStyle.top = `${popoverTop + popoverHeight + 6}px`;
  11265. triangleStyle.top = "-6px";
  11266. triangleStyle["border-width"] = "0 6px 6px 6px";
  11267. triangleStyle["border-color"] = "transparent transparent #fcfcfd transparent";
  11268. }
  11269. }
  11270. return style;
  11271. });
  11272. return {
  11273. isDesktop,
  11274. popupStyle
  11275. };
  11276. }
  11277. function useKeyboard() {
  11278. const key = vue.ref("");
  11279. const disable = vue.ref(false);
  11280. return {
  11281. key,
  11282. disable
  11283. };
  11284. }
  11285. function _isSlot(s) {
  11286. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  11287. }
  11288. function getDefaultStartValue(props2) {
  11289. if (props2.mode === mode.TIME) {
  11290. return "00:00";
  11291. }
  11292. if (props2.mode === mode.DATE) {
  11293. const year = (/* @__PURE__ */ new Date()).getFullYear() - 150;
  11294. switch (props2.fields) {
  11295. case fields.YEAR:
  11296. return year.toString();
  11297. case fields.MONTH:
  11298. return year + "-01";
  11299. default:
  11300. return year + "-01-01";
  11301. }
  11302. }
  11303. return "";
  11304. }
  11305. function getDefaultEndValue(props2) {
  11306. if (props2.mode === mode.TIME) {
  11307. return "23:59";
  11308. }
  11309. if (props2.mode === mode.DATE) {
  11310. const year = (/* @__PURE__ */ new Date()).getFullYear() + 150;
  11311. switch (props2.fields) {
  11312. case fields.YEAR:
  11313. return year.toString();
  11314. case fields.MONTH:
  11315. return year + "-12";
  11316. default:
  11317. return year + "-12-31";
  11318. }
  11319. }
  11320. return "";
  11321. }
  11322. function getDateValueArray(props2, state, valueStr, defaultValue) {
  11323. const splitStr = props2.mode === mode.DATE ? "-" : ":";
  11324. const array = props2.mode === mode.DATE ? state.dateArray : state.timeArray;
  11325. let max;
  11326. if (props2.mode === mode.TIME) {
  11327. max = 2;
  11328. } else {
  11329. switch (props2.fields) {
  11330. case fields.YEAR:
  11331. max = 1;
  11332. break;
  11333. case fields.MONTH:
  11334. max = 2;
  11335. break;
  11336. default:
  11337. max = 3;
  11338. break;
  11339. }
  11340. }
  11341. const inputArray = String(valueStr).split(splitStr);
  11342. let value = [];
  11343. for (let i = 0; i < max; i++) {
  11344. const val = inputArray[i];
  11345. value.push(array[i].indexOf(val));
  11346. }
  11347. if (value.indexOf(-1) >= 0) {
  11348. value = defaultValue ? getDateValueArray(props2, state, defaultValue) : value.map(() => 0);
  11349. }
  11350. return value;
  11351. }
  11352. const mode = {
  11353. SELECTOR: "selector",
  11354. MULTISELECTOR: "multiSelector",
  11355. TIME: "time",
  11356. DATE: "date"
  11357. // 暂不支持城市选择
  11358. // REGION: 'region'
  11359. };
  11360. const fields = {
  11361. YEAR: "year",
  11362. MONTH: "month",
  11363. DAY: "day"
  11364. };
  11365. const selectorType = {
  11366. PICKER: "picker",
  11367. SELECT: "select"
  11368. };
  11369. const props = {
  11370. name: {
  11371. type: String,
  11372. default: ""
  11373. },
  11374. range: {
  11375. type: Array,
  11376. default() {
  11377. return [];
  11378. }
  11379. },
  11380. rangeKey: {
  11381. type: String,
  11382. default: ""
  11383. },
  11384. value: {
  11385. type: [Number, String, Array],
  11386. default: 0
  11387. },
  11388. mode: {
  11389. type: String,
  11390. default: mode.SELECTOR,
  11391. validator(val) {
  11392. return Object.values(mode).includes(val);
  11393. }
  11394. },
  11395. fields: {
  11396. type: String,
  11397. default: ""
  11398. },
  11399. start: {
  11400. type: String,
  11401. default: (props2) => {
  11402. return getDefaultStartValue(props2);
  11403. }
  11404. },
  11405. end: {
  11406. type: String,
  11407. default: (props2) => {
  11408. return getDefaultEndValue(props2);
  11409. }
  11410. },
  11411. disabled: {
  11412. type: [Boolean, String],
  11413. default: false
  11414. },
  11415. selectorType: {
  11416. type: String,
  11417. default: ""
  11418. }
  11419. };
  11420. const index$7 = /* @__PURE__ */ defineBuiltInComponent({
  11421. name: "Picker",
  11422. compatConfig: {
  11423. MODE: 3
  11424. },
  11425. props,
  11426. emits: ["change", "cancel", "columnchange"],
  11427. setup(props2, {
  11428. emit: emit2,
  11429. slots
  11430. }) {
  11431. initI18nPickerMsgsOnce();
  11432. const {
  11433. t: t2
  11434. } = useI18n();
  11435. const rootRef = vue.ref(null);
  11436. const pickerRef = vue.ref(null);
  11437. const selectRef = vue.ref(null);
  11438. const inputRef = vue.ref(null);
  11439. const pickerRender = vue.ref(false);
  11440. const {
  11441. state,
  11442. rangeArray
  11443. } = usePickerState(props2);
  11444. const trigger = useCustomEvent(rootRef, emit2);
  11445. const {
  11446. system,
  11447. selectorTypeComputed,
  11448. _show,
  11449. _l10nColumn,
  11450. _l10nItem,
  11451. _input,
  11452. _fixInputPosition,
  11453. _pickerViewChange,
  11454. _cancel,
  11455. _change,
  11456. _resetFormData,
  11457. _getFormData,
  11458. _createTime,
  11459. _createDate,
  11460. _setValueSync
  11461. } = usePickerMethods(props2, state, trigger, rootRef, pickerRef, selectRef, inputRef);
  11462. usePickerWatch(state, _cancel, _change);
  11463. usePickerForm(_resetFormData, _getFormData);
  11464. _createTime();
  11465. _createDate();
  11466. _setValueSync();
  11467. const popup = usePopupStyle(state);
  11468. vue.watchEffect(() => {
  11469. state.isDesktop = popup.isDesktop.value;
  11470. state.popupStyle = popup.popupStyle.value;
  11471. });
  11472. return () => {
  11473. let _slot2;
  11474. const {
  11475. visible,
  11476. contentVisible,
  11477. valueArray,
  11478. popupStyle,
  11479. valueSync
  11480. } = state;
  11481. const {
  11482. rangeKey,
  11483. mode: mode2,
  11484. start,
  11485. end
  11486. } = props2;
  11487. const booleanAttrs = useBooleanAttr(props2, "disabled");
  11488. return vue.createVNode("uni-picker", vue.mergeProps({
  11489. "ref": rootRef
  11490. }, booleanAttrs, {
  11491. "onClick": withWebEvent(_show)
  11492. }), [pickerRender.value ? vue.createVNode("div", {
  11493. "ref": pickerRef,
  11494. "class": ["uni-picker-container", `uni-${mode2}-${selectorTypeComputed.value}`],
  11495. "onWheel": onEventPrevent,
  11496. "onTouchmove": onEventPrevent
  11497. }, [vue.createVNode(vue.Transition, {
  11498. "name": "uni-fade"
  11499. }, {
  11500. default: () => [vue.withDirectives(vue.createVNode("div", {
  11501. "class": "uni-mask uni-picker-mask",
  11502. "onClick": withWebEvent(_cancel),
  11503. "onMousemove": _fixInputPosition
  11504. }, null, 40, ["onClick", "onMousemove"]), [[vue.vShow, visible]])]
  11505. }), !system.value ? vue.createVNode("div", {
  11506. "class": [{
  11507. "uni-picker-toggle": visible
  11508. }, "uni-picker-custom"],
  11509. "style": popupStyle.content
  11510. }, [vue.createVNode("div", {
  11511. "class": "uni-picker-header",
  11512. "onClick": onEventStop
  11513. }, [vue.createVNode("div", {
  11514. "class": "uni-picker-action uni-picker-action-cancel",
  11515. "onClick": withWebEvent(_cancel)
  11516. }, [t2("uni.picker.cancel")], 8, ["onClick"]), vue.createVNode("div", {
  11517. "class": "uni-picker-action uni-picker-action-confirm",
  11518. "onClick": _change
  11519. }, [t2("uni.picker.done")], 8, ["onClick"])], 8, ["onClick"]), contentVisible ? vue.createVNode(PickerView, {
  11520. "value": _l10nColumn(valueArray),
  11521. "class": "uni-picker-content",
  11522. "onChange": _pickerViewChange
  11523. }, _isSlot(_slot2 = vue.renderList(_l10nColumn(rangeArray.value), (rangeItem, index0) => {
  11524. let _slot;
  11525. return vue.createVNode(PickerViewColumn, {
  11526. "key": index0
  11527. }, _isSlot(_slot = vue.renderList(rangeItem, (item, index2) => vue.createVNode("div", {
  11528. "key": index2,
  11529. "class": "uni-picker-item"
  11530. }, [typeof item === "object" ? item[rangeKey] || "" : _l10nItem(item, index0)]))) ? _slot : {
  11531. default: () => [_slot],
  11532. _: 1
  11533. });
  11534. })) ? _slot2 : {
  11535. default: () => [_slot2],
  11536. _: 1
  11537. }, 8, ["value", "onChange"]) : null, vue.createVNode("div", {
  11538. "ref": selectRef,
  11539. "class": "uni-picker-select",
  11540. "onWheel": onEventStop,
  11541. "onTouchmove": onEventStop
  11542. }, [vue.renderList(rangeArray.value[0], (item, index2) => vue.createVNode("div", {
  11543. "key": index2,
  11544. "class": ["uni-picker-item", {
  11545. selected: valueArray[0] === index2
  11546. }],
  11547. "onClick": () => {
  11548. valueArray[0] = index2;
  11549. _change();
  11550. }
  11551. }, [typeof item === "object" ? item[rangeKey] || "" : item], 10, ["onClick"]))], 40, ["onWheel", "onTouchmove"]), vue.createVNode("div", {
  11552. "style": popupStyle.triangle
  11553. }, null, 4)], 6) : null], 40, ["onWheel", "onTouchmove"]) : null, vue.createVNode("div", null, [slots.default && slots.default()]), system.value ? vue.createVNode("div", {
  11554. "class": "uni-picker-system",
  11555. "onMousemove": withWebEvent(_fixInputPosition)
  11556. }, [vue.createVNode("input", {
  11557. "class": ["uni-picker-system_input", system.value],
  11558. "ref": inputRef,
  11559. "value": valueSync,
  11560. "type": mode2,
  11561. "tabindex": "-1",
  11562. "min": start,
  11563. "max": end,
  11564. "onChange": ($event) => {
  11565. _input($event);
  11566. onEventStop($event);
  11567. }
  11568. }, null, 42, ["value", "type", "min", "max", "onChange"])], 40, ["onMousemove"]) : null], 16, ["onClick"]);
  11569. };
  11570. }
  11571. });
  11572. function usePickerState(props2) {
  11573. const state = vue.reactive({
  11574. valueSync: void 0,
  11575. visible: false,
  11576. contentVisible: false,
  11577. popover: null,
  11578. valueChangeSource: "",
  11579. timeArray: [],
  11580. dateArray: [],
  11581. valueArray: [],
  11582. oldValueArray: [],
  11583. isDesktop: false,
  11584. popupStyle: {
  11585. content: {},
  11586. triangle: {}
  11587. }
  11588. });
  11589. const rangeArray = vue.computed(() => {
  11590. let val = props2.range;
  11591. switch (props2.mode) {
  11592. case mode.SELECTOR:
  11593. return [val];
  11594. case mode.MULTISELECTOR:
  11595. return val;
  11596. case mode.TIME:
  11597. return state.timeArray;
  11598. case mode.DATE: {
  11599. const dateArray = state.dateArray;
  11600. switch (props2.fields) {
  11601. case fields.YEAR:
  11602. return [dateArray[0]];
  11603. case fields.MONTH:
  11604. return [dateArray[0], dateArray[1]];
  11605. default:
  11606. return [dateArray[0], dateArray[1], dateArray[2]];
  11607. }
  11608. }
  11609. }
  11610. return [];
  11611. });
  11612. return {
  11613. state,
  11614. rangeArray
  11615. };
  11616. }
  11617. function useIsiPad() {
  11618. const isiPad = vue.ref(false);
  11619. return isiPad;
  11620. }
  11621. function useSystem() {
  11622. const _system = vue.ref("");
  11623. return _system;
  11624. }
  11625. let __contentVisibleDelay;
  11626. function usePickerMethods(props2, state, trigger, rootRef, pickerRef, selectRef, inputRef) {
  11627. const isiPad = useIsiPad();
  11628. const _system = useSystem();
  11629. const selectorTypeComputed = vue.computed(() => {
  11630. const type = props2.selectorType;
  11631. if (Object.values(selectorType).includes(type)) {
  11632. return type;
  11633. }
  11634. return isiPad.value ? selectorType.PICKER : selectorType.SELECT;
  11635. });
  11636. const system = vue.computed(() => {
  11637. if (props2.mode === mode.DATE && !Object.values(fields).includes(props2.fields) && state.isDesktop) {
  11638. return _system.value;
  11639. }
  11640. return "";
  11641. });
  11642. const startArray = vue.computed(() => {
  11643. return getDateValueArray(props2, state, props2.start, getDefaultStartValue(props2));
  11644. });
  11645. const endArray = vue.computed(() => {
  11646. return getDateValueArray(props2, state, props2.end, getDefaultEndValue(props2));
  11647. });
  11648. function _show(event) {
  11649. if (props2.disabled) {
  11650. return;
  11651. }
  11652. state.valueChangeSource = "";
  11653. let $picker = pickerRef.value;
  11654. let _currentTarget = event.currentTarget;
  11655. $picker.remove();
  11656. (document.querySelector("uni-app") || document.body).appendChild($picker);
  11657. $picker.style.display = "block";
  11658. const rect = _currentTarget.getBoundingClientRect();
  11659. state.popover = {
  11660. top: rect.top,
  11661. left: rect.left,
  11662. width: rect.width,
  11663. height: rect.height
  11664. };
  11665. setTimeout(() => {
  11666. state.visible = true;
  11667. }, 20);
  11668. }
  11669. function _getFormData() {
  11670. return {
  11671. value: state.valueSync,
  11672. key: props2.name
  11673. };
  11674. }
  11675. function _resetFormData() {
  11676. switch (props2.mode) {
  11677. case mode.SELECTOR:
  11678. state.valueSync = 0;
  11679. break;
  11680. case mode.MULTISELECTOR:
  11681. state.valueSync = props2.value.map((val) => 0);
  11682. break;
  11683. case mode.DATE:
  11684. case mode.TIME:
  11685. state.valueSync = "";
  11686. break;
  11687. }
  11688. }
  11689. function _createTime() {
  11690. let hours = [];
  11691. let minutes = [];
  11692. for (let i = 0; i < 24; i++) {
  11693. hours.push((i < 10 ? "0" : "") + i);
  11694. }
  11695. for (let i = 0; i < 60; i++) {
  11696. minutes.push((i < 10 ? "0" : "") + i);
  11697. }
  11698. state.timeArray.push(hours, minutes);
  11699. }
  11700. function getYearStartEnd() {
  11701. let year = (/* @__PURE__ */ new Date()).getFullYear();
  11702. let start = year - 150;
  11703. let end = year + 150;
  11704. if (props2.start) {
  11705. const _year = new Date(props2.start).getFullYear();
  11706. if (!isNaN(_year) && _year < start) {
  11707. start = _year;
  11708. }
  11709. }
  11710. if (props2.end) {
  11711. const _year = new Date(props2.end).getFullYear();
  11712. if (!isNaN(_year) && _year > end) {
  11713. end = _year;
  11714. }
  11715. }
  11716. return {
  11717. start,
  11718. end
  11719. };
  11720. }
  11721. function _createDate() {
  11722. let years = [];
  11723. const year = getYearStartEnd();
  11724. for (let i = year.start, end = year.end; i <= end; i++) {
  11725. years.push(String(i));
  11726. }
  11727. let months = [];
  11728. for (let i = 1; i <= 12; i++) {
  11729. months.push((i < 10 ? "0" : "") + i);
  11730. }
  11731. let days = [];
  11732. for (let i = 1; i <= 31; i++) {
  11733. days.push((i < 10 ? "0" : "") + i);
  11734. }
  11735. state.dateArray.push(years, months, days);
  11736. }
  11737. function _getTimeValue(val) {
  11738. return val[0] * 60 + val[1];
  11739. }
  11740. function _getDateValue(val) {
  11741. const DAY = 31;
  11742. return val[0] * DAY * 12 + (val[1] || 0) * DAY + (val[2] || 0);
  11743. }
  11744. function _cloneArray(val1, val2) {
  11745. for (let i = 0; i < val1.length && i < val2.length; i++) {
  11746. val1[i] = val2[i];
  11747. }
  11748. }
  11749. function _setValueSync() {
  11750. let val = props2.value;
  11751. switch (props2.mode) {
  11752. case mode.MULTISELECTOR:
  11753. {
  11754. if (!shared.isArray(val)) {
  11755. val = state.valueArray;
  11756. }
  11757. if (!shared.isArray(state.valueSync)) {
  11758. state.valueSync = [];
  11759. }
  11760. const length = state.valueSync.length = Math.max(val.length, props2.range.length);
  11761. for (let index2 = 0; index2 < length; index2++) {
  11762. const val0 = Number(val[index2]);
  11763. const val1 = Number(state.valueSync[index2]);
  11764. const val2 = isNaN(val0) ? isNaN(val1) ? 0 : val1 : val0;
  11765. const maxVal = props2.range[index2] ? props2.range[index2].length - 1 : 0;
  11766. state.valueSync.splice(index2, 1, val2 < 0 || val2 > maxVal ? 0 : val2);
  11767. }
  11768. }
  11769. break;
  11770. case mode.TIME:
  11771. case mode.DATE:
  11772. state.valueSync = String(val);
  11773. break;
  11774. default: {
  11775. const valueSync = Number(val);
  11776. state.valueSync = valueSync < 0 ? 0 : valueSync;
  11777. break;
  11778. }
  11779. }
  11780. }
  11781. function _setValueArray() {
  11782. let val = state.valueSync;
  11783. let valueArray;
  11784. switch (props2.mode) {
  11785. case mode.MULTISELECTOR:
  11786. valueArray = [...val];
  11787. break;
  11788. case mode.TIME:
  11789. valueArray = getDateValueArray(props2, state, val, uniShared.formatDateTime({
  11790. mode: mode.TIME
  11791. }));
  11792. break;
  11793. case mode.DATE:
  11794. valueArray = getDateValueArray(props2, state, val, uniShared.formatDateTime({
  11795. mode: mode.DATE
  11796. }));
  11797. break;
  11798. default:
  11799. valueArray = [val];
  11800. break;
  11801. }
  11802. state.oldValueArray = [...valueArray];
  11803. state.valueArray = [...valueArray];
  11804. }
  11805. function _getValue() {
  11806. let val = state.valueArray;
  11807. switch (props2.mode) {
  11808. case mode.SELECTOR:
  11809. return val[0];
  11810. case mode.MULTISELECTOR:
  11811. return val.map((val2) => val2);
  11812. case mode.TIME:
  11813. return state.valueArray.map((val2, i) => state.timeArray[i][val2]).join(":");
  11814. case mode.DATE:
  11815. return state.valueArray.map((val2, i) => state.dateArray[i][val2]).join("-");
  11816. }
  11817. }
  11818. function _change() {
  11819. _close();
  11820. state.valueChangeSource = "click";
  11821. const value = _getValue();
  11822. state.valueSync = shared.isArray(value) ? value.map((val) => val) : value;
  11823. trigger("change", {}, {
  11824. value
  11825. });
  11826. }
  11827. function _cancel($event) {
  11828. if (system.value === "firefox" && $event) {
  11829. const {
  11830. top,
  11831. left,
  11832. width,
  11833. height
  11834. } = state.popover;
  11835. const {
  11836. pageX,
  11837. pageY
  11838. } = $event;
  11839. if (pageX > left && pageX < left + width && pageY > top && pageY < top + height) {
  11840. return;
  11841. }
  11842. }
  11843. _close();
  11844. trigger("cancel", {}, {});
  11845. }
  11846. function _close() {
  11847. state.visible = false;
  11848. setTimeout(() => {
  11849. let $picker = pickerRef.value;
  11850. $picker.remove();
  11851. rootRef.value.prepend($picker);
  11852. $picker.style.display = "none";
  11853. }, 260);
  11854. }
  11855. function _select() {
  11856. if (props2.mode === mode.SELECTOR && selectorTypeComputed.value === selectorType.SELECT) {
  11857. selectRef.value.scrollTop = state.valueArray[0] * 34;
  11858. }
  11859. }
  11860. function _input($event) {
  11861. const EventTarget = $event.target;
  11862. state.valueSync = EventTarget.value;
  11863. vue.nextTick(() => {
  11864. _change();
  11865. });
  11866. }
  11867. function _fixInputPosition($event) {
  11868. if (system.value === "chrome") {
  11869. const rect = rootRef.value.getBoundingClientRect();
  11870. const fontSize = 32;
  11871. inputRef.value.style.left = `${$event.clientX - rect.left - fontSize * 1.5}px`;
  11872. inputRef.value.style.top = `${$event.clientY - rect.top - fontSize * 0.5}px`;
  11873. }
  11874. }
  11875. function _pickerViewChange(event) {
  11876. state.valueArray = _l10nColumn(event.detail.value, true);
  11877. }
  11878. function _l10nColumn(array, normalize) {
  11879. const {
  11880. getLocale: getLocale2
  11881. } = useI18n();
  11882. if (props2.mode === mode.DATE) {
  11883. const locale = getLocale2();
  11884. if (!locale.startsWith("zh")) {
  11885. switch (props2.fields) {
  11886. case fields.YEAR:
  11887. return array;
  11888. case fields.MONTH:
  11889. return [array[1], array[0]];
  11890. default:
  11891. switch (locale) {
  11892. case "es":
  11893. case "fr":
  11894. return [array[2], array[1], array[0]];
  11895. default:
  11896. return normalize ? [array[2], array[0], array[1]] : [array[1], array[2], array[0]];
  11897. }
  11898. }
  11899. }
  11900. }
  11901. return array;
  11902. }
  11903. function _l10nItem(item, index2) {
  11904. const {
  11905. getLocale: getLocale2
  11906. } = useI18n();
  11907. if (props2.mode === mode.DATE) {
  11908. const locale = getLocale2();
  11909. if (locale.startsWith("zh")) {
  11910. const array = ["年", "月", "日"];
  11911. return item + array[index2];
  11912. } else if (props2.fields !== fields.YEAR && index2 === (props2.fields !== fields.MONTH && (locale === "es" || locale === "fr") ? 1 : 0)) {
  11913. let array;
  11914. switch (locale) {
  11915. case "es":
  11916. array = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "​​julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
  11917. break;
  11918. case "fr":
  11919. array = ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"];
  11920. break;
  11921. default:
  11922. array = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  11923. break;
  11924. }
  11925. return array[Number(item) - 1];
  11926. }
  11927. }
  11928. return item;
  11929. }
  11930. vue.watch(() => state.visible, (val) => {
  11931. if (val) {
  11932. clearTimeout(__contentVisibleDelay);
  11933. state.contentVisible = val;
  11934. _select();
  11935. } else {
  11936. __contentVisibleDelay = setTimeout(() => {
  11937. state.contentVisible = val;
  11938. }, 300);
  11939. }
  11940. });
  11941. vue.watch([() => props2.mode, () => props2.value, () => props2.range], _setValueSync, {
  11942. deep: true
  11943. });
  11944. vue.watch(() => state.valueSync, _setValueArray, {
  11945. deep: true
  11946. });
  11947. vue.watch(() => state.valueArray, (val) => {
  11948. if (props2.mode === mode.TIME || props2.mode === mode.DATE) {
  11949. const getValue = props2.mode === mode.TIME ? _getTimeValue : _getDateValue;
  11950. const valueArray = state.valueArray;
  11951. const _startArray = startArray.value;
  11952. const _endArray = endArray.value;
  11953. if (props2.mode === mode.DATE) {
  11954. const dateArray = state.dateArray;
  11955. const max = dateArray[2].length;
  11956. const day = Number(dateArray[2][valueArray[2]]) || 1;
  11957. const realDay = (/* @__PURE__ */ new Date(`${dateArray[0][valueArray[0]]}/${dateArray[1][valueArray[1]]}/${day}`)).getDate();
  11958. if (realDay < day) {
  11959. valueArray[2] -= realDay + max - day;
  11960. }
  11961. }
  11962. if (getValue(valueArray) < getValue(_startArray)) {
  11963. _cloneArray(valueArray, _startArray);
  11964. } else if (getValue(valueArray) > getValue(_endArray)) {
  11965. _cloneArray(valueArray, _endArray);
  11966. }
  11967. }
  11968. val.forEach((value, column) => {
  11969. if (value !== state.oldValueArray[column]) {
  11970. state.oldValueArray[column] = value;
  11971. if (props2.mode === mode.MULTISELECTOR) {
  11972. trigger("columnchange", {}, {
  11973. column,
  11974. value
  11975. });
  11976. }
  11977. }
  11978. });
  11979. });
  11980. return {
  11981. selectorTypeComputed,
  11982. system,
  11983. _show,
  11984. _cancel,
  11985. _change,
  11986. _l10nColumn,
  11987. _l10nItem,
  11988. _input,
  11989. _resetFormData,
  11990. _getFormData,
  11991. _createTime,
  11992. _createDate,
  11993. _setValueSync,
  11994. _fixInputPosition,
  11995. _pickerViewChange
  11996. };
  11997. }
  11998. function usePickerWatch(state, _cancel, _change) {
  11999. const {
  12000. key,
  12001. disable
  12002. } = useKeyboard();
  12003. vue.watchEffect(() => {
  12004. disable.value = !state.visible;
  12005. });
  12006. vue.watch(key, (value) => {
  12007. if (value === "esc") {
  12008. _cancel();
  12009. } else if (value === "enter") {
  12010. _change();
  12011. }
  12012. });
  12013. }
  12014. function usePickerForm(_resetFormData, _getFormData) {
  12015. const uniForm = vue.inject(uniFormKey, false);
  12016. if (uniForm) {
  12017. const field = {
  12018. reset: _resetFormData,
  12019. submit: () => {
  12020. const data = ["", null];
  12021. const {
  12022. key,
  12023. value
  12024. } = _getFormData();
  12025. if (key !== "") {
  12026. data[0] = key;
  12027. data[1] = value;
  12028. }
  12029. return data;
  12030. }
  12031. };
  12032. uniForm.addField(field);
  12033. }
  12034. }
  12035. const index$6 = /* @__PURE__ */ defineUnsupportedComponent("ad");
  12036. const index$5 = /* @__PURE__ */ defineUnsupportedComponent("ad-content-page");
  12037. const index$4 = /* @__PURE__ */ defineUnsupportedComponent("ad-draw");
  12038. const index$3 = /* @__PURE__ */ defineUnsupportedComponent("camera");
  12039. const index$2 = /* @__PURE__ */ defineUnsupportedComponent("live-player");
  12040. const index$1 = /* @__PURE__ */ defineUnsupportedComponent("live-pusher");
  12041. const UniViewJSBridge$1 = /* @__PURE__ */ shared.extend(ViewJSBridge, {
  12042. publishHandler(event, args, pageId) {
  12043. UniServiceJSBridge.subscribeHandler(event, args, pageId);
  12044. }
  12045. });
  12046. const request = /* @__PURE__ */ defineTaskApi(
  12047. API_REQUEST,
  12048. ({
  12049. url,
  12050. data,
  12051. header = {},
  12052. method,
  12053. dataType: dataType2,
  12054. responseType,
  12055. withCredentials,
  12056. timeout = __uniConfig.networkTimeout.request
  12057. }, { resolve, reject }) => {
  12058. {
  12059. timeout = timeout == null ? __uniConfig.networkTimeout.request : timeout;
  12060. }
  12061. let body = null;
  12062. const contentType = normalizeContentType(header);
  12063. if (method !== "GET") {
  12064. if (shared.isString(data) || data instanceof ArrayBuffer) {
  12065. body = data;
  12066. } else {
  12067. if (contentType === "json") {
  12068. try {
  12069. body = JSON.stringify(data);
  12070. } catch (error) {
  12071. body = data.toString();
  12072. }
  12073. } else if (contentType === "urlencoded") {
  12074. const bodyArray = [];
  12075. for (const key in data) {
  12076. if (shared.hasOwn(data, key)) {
  12077. bodyArray.push(
  12078. encodeURIComponent(key) + "=" + encodeURIComponent(data[key])
  12079. );
  12080. }
  12081. }
  12082. body = bodyArray.join("&");
  12083. } else {
  12084. body = data.toString();
  12085. }
  12086. }
  12087. }
  12088. const xhr = new XMLHttpRequest();
  12089. const requestTask = new RequestTask(xhr);
  12090. xhr.open(method, url);
  12091. for (const key in header) {
  12092. if (shared.hasOwn(header, key)) {
  12093. xhr.setRequestHeader(key, header[key]);
  12094. }
  12095. }
  12096. const timer = setTimeout(function() {
  12097. xhr.onload = xhr.onabort = xhr.onerror = null;
  12098. requestTask.abort();
  12099. reject("timeout", { errCode: 5 });
  12100. }, timeout);
  12101. xhr.responseType = responseType;
  12102. xhr.onload = function() {
  12103. clearTimeout(timer);
  12104. const statusCode = xhr.status;
  12105. let res = responseType === "text" ? xhr.responseText : xhr.response;
  12106. if (responseType === "text" && dataType2 === "json") {
  12107. try {
  12108. res = UTS.JSON.parse(res);
  12109. } catch (error) {
  12110. }
  12111. }
  12112. resolve({
  12113. data: res,
  12114. statusCode,
  12115. header: parseHeaders(xhr.getAllResponseHeaders()),
  12116. cookies: []
  12117. });
  12118. };
  12119. xhr.onabort = function() {
  12120. clearTimeout(timer);
  12121. reject("abort", { errCode: 600003 });
  12122. };
  12123. xhr.onerror = function() {
  12124. clearTimeout(timer);
  12125. reject(void 0, { errCode: 5 });
  12126. };
  12127. xhr.withCredentials = withCredentials;
  12128. xhr.send(body);
  12129. return requestTask;
  12130. },
  12131. RequestProtocol,
  12132. RequestOptions
  12133. );
  12134. function normalizeContentType(header) {
  12135. const name = Object.keys(header).find(
  12136. (name2) => name2.toLowerCase() === "content-type"
  12137. );
  12138. if (!name) {
  12139. return;
  12140. }
  12141. const contentType = header[name];
  12142. if (name !== "Content-Type") {
  12143. header["Content-Type"] = header[name];
  12144. delete header[name];
  12145. }
  12146. if (contentType.indexOf("application/json") === 0) {
  12147. return "json";
  12148. } else if (contentType.indexOf("application/x-www-form-urlencoded") === 0) {
  12149. return "urlencoded";
  12150. }
  12151. return "string";
  12152. }
  12153. class RequestTask {
  12154. constructor(xhr) {
  12155. this._xhr = xhr;
  12156. }
  12157. abort() {
  12158. if (this._xhr) {
  12159. this._xhr.abort();
  12160. delete this._xhr;
  12161. }
  12162. }
  12163. onHeadersReceived(callback) {
  12164. throw new Error("Method not implemented.");
  12165. }
  12166. offHeadersReceived(callback) {
  12167. throw new Error("Method not implemented.");
  12168. }
  12169. }
  12170. function parseHeaders(headers) {
  12171. const headersObject = {};
  12172. headers.split(uniShared.LINEFEED).forEach((header) => {
  12173. const find = header.match(/(\S+\s*):\s*(.*)/);
  12174. if (!find || find.length !== 3) {
  12175. return;
  12176. }
  12177. headersObject[find[1]] = find[2];
  12178. });
  12179. return headersObject;
  12180. }
  12181. const STORAGE_KEYS = "uni-storage-keys";
  12182. function parseValue(value) {
  12183. const types = ["object", "string", "number", "boolean", "undefined"];
  12184. try {
  12185. const object = shared.isString(value) ? JSON.parse(value) : value;
  12186. const type = object.type;
  12187. if (types.indexOf(type) >= 0) {
  12188. const keys = Object.keys(object);
  12189. if (keys.length === 2 && "data" in object) {
  12190. if (typeof object.data === type) {
  12191. if (type === "object" && !Array.isArray(object.data)) {
  12192. return new UTSJSONObject(object.data);
  12193. }
  12194. return object.data;
  12195. }
  12196. if (type === "object" && /^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.\d{3}Z$/.test(object.data)) {
  12197. return new Date(object.data);
  12198. }
  12199. } else if (keys.length === 1) {
  12200. return "";
  12201. }
  12202. }
  12203. } catch (error) {
  12204. }
  12205. }
  12206. const setStorageSync = /* @__PURE__ */ defineSyncApi(
  12207. API_SET_STORAGE_SYNC,
  12208. (key, data) => {
  12209. const type = typeof data;
  12210. const value = type === "string" ? data : JSON.stringify({
  12211. type,
  12212. data
  12213. });
  12214. localStorage.setItem(key, value);
  12215. },
  12216. SetStorageSyncProtocol
  12217. );
  12218. const setStorage = /* @__PURE__ */ defineAsyncApi(
  12219. API_SET_STORAGE,
  12220. ({ key, data }, { resolve, reject }) => {
  12221. try {
  12222. setStorageSync(key, data);
  12223. resolve();
  12224. } catch (error) {
  12225. reject(error.message);
  12226. }
  12227. },
  12228. SetStorageProtocol
  12229. );
  12230. function getStorageOrigin(key) {
  12231. const value = localStorage && localStorage.getItem(key);
  12232. if (!shared.isString(value)) {
  12233. throw new Error("data not found");
  12234. }
  12235. let data = value;
  12236. try {
  12237. const object = JSON.parse(value);
  12238. const result = parseValue(object);
  12239. if (result !== void 0) {
  12240. data = result;
  12241. }
  12242. } catch (error) {
  12243. }
  12244. return data;
  12245. }
  12246. const getStorageSync = /* @__PURE__ */ defineSyncApi(
  12247. API_GET_STORAGE_SYNC,
  12248. (key) => {
  12249. try {
  12250. return getStorageOrigin(key);
  12251. } catch (error) {
  12252. return "";
  12253. }
  12254. },
  12255. GetStorageSyncProtocol
  12256. );
  12257. const getStorage = /* @__PURE__ */ defineAsyncApi(
  12258. API_GET_STORAGE,
  12259. ({ key }, { resolve, reject }) => {
  12260. try {
  12261. const data = getStorageOrigin(key);
  12262. resolve({
  12263. data
  12264. });
  12265. } catch (error) {
  12266. reject(error.message);
  12267. }
  12268. },
  12269. GetStorageProtocol
  12270. );
  12271. const removeStorageSync = /* @__PURE__ */ defineSyncApi(
  12272. API_REMOVE_STORAGE,
  12273. (key) => {
  12274. if (localStorage) {
  12275. localStorage.removeItem(key);
  12276. }
  12277. },
  12278. RemoveStorageSyncProtocol
  12279. );
  12280. const removeStorage = /* @__PURE__ */ defineAsyncApi(
  12281. API_REMOVE_STORAGE,
  12282. ({ key }, { resolve }) => {
  12283. removeStorageSync(key);
  12284. resolve();
  12285. },
  12286. RemoveStorageProtocol
  12287. );
  12288. const clearStorageSync = /* @__PURE__ */ defineSyncApi(
  12289. "clearStorageSync",
  12290. () => {
  12291. if (localStorage) {
  12292. localStorage.clear();
  12293. }
  12294. }
  12295. );
  12296. const clearStorage = /* @__PURE__ */ defineAsyncApi(
  12297. "clearStorage",
  12298. (_, { resolve }) => {
  12299. clearStorageSync();
  12300. resolve();
  12301. }
  12302. );
  12303. const getStorageInfoSync = /* @__PURE__ */ defineSyncApi(
  12304. "getStorageInfoSync",
  12305. () => {
  12306. const length = localStorage && localStorage.length || 0;
  12307. const keys = [];
  12308. let currentSize = 0;
  12309. for (let index2 = 0; index2 < length; index2++) {
  12310. const key = localStorage.key(index2);
  12311. const value = localStorage.getItem(key) || "";
  12312. currentSize += key.length + value.length;
  12313. if (key !== STORAGE_KEYS) {
  12314. keys.push(key);
  12315. }
  12316. }
  12317. return {
  12318. keys,
  12319. currentSize: Math.ceil(currentSize * 2 / 1024),
  12320. limitSize: Number.MAX_VALUE
  12321. };
  12322. }
  12323. );
  12324. const getStorageInfo = /* @__PURE__ */ defineAsyncApi(
  12325. "getStorageInfo",
  12326. (_, { resolve }) => {
  12327. resolve(getStorageInfoSync());
  12328. }
  12329. );
  12330. function getTheme() {
  12331. if (__uniConfig.darkmode !== true)
  12332. return shared.isString(__uniConfig.darkmode) ? __uniConfig.darkmode : "light";
  12333. try {
  12334. return window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
  12335. } catch (error) {
  12336. return "light";
  12337. }
  12338. }
  12339. let browserInfo;
  12340. function initBrowserInfo() {
  12341. {
  12342. return browserInfo = {};
  12343. }
  12344. }
  12345. const getDeviceInfo = /* @__PURE__ */ defineSyncApi(
  12346. "getDeviceInfo",
  12347. () => {
  12348. initBrowserInfo();
  12349. const {
  12350. deviceBrand,
  12351. deviceModel,
  12352. brand,
  12353. model,
  12354. platform,
  12355. system,
  12356. deviceOrientation,
  12357. deviceType,
  12358. osname,
  12359. osversion
  12360. } = browserInfo;
  12361. return shared.extend(
  12362. {
  12363. brand,
  12364. deviceBrand,
  12365. deviceModel,
  12366. devicePixelRatio: 1,
  12367. deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
  12368. deviceOrientation,
  12369. deviceType,
  12370. model,
  12371. platform,
  12372. system
  12373. },
  12374. {
  12375. osName: osname ? osname.toLocaleLowerCase() : void 0,
  12376. osVersion: osversion
  12377. }
  12378. );
  12379. }
  12380. );
  12381. const getAppBaseInfo = /* @__PURE__ */ defineSyncApi(
  12382. "getAppBaseInfo",
  12383. () => {
  12384. initBrowserInfo();
  12385. const { theme, language, browserName, browserVersion } = browserInfo;
  12386. return shared.extend(
  12387. {
  12388. appId: __uniConfig.appId,
  12389. appName: __uniConfig.appName,
  12390. appVersion: __uniConfig.appVersion,
  12391. appVersionCode: __uniConfig.appVersionCode,
  12392. appLanguage: getLocale ? getLocale() : language,
  12393. enableDebug: false,
  12394. hostSDKVersion: void 0,
  12395. hostPackageName: void 0,
  12396. hostFontSizeSetting: void 0,
  12397. hostName: browserName,
  12398. hostVersion: browserVersion,
  12399. hostTheme: theme,
  12400. hostLanguage: language,
  12401. language,
  12402. SDKVersion: "",
  12403. theme,
  12404. version: ""
  12405. },
  12406. {
  12407. uniCompilerVersion: __uniConfig.compilerVersion,
  12408. uniRuntimeVersion: __uniConfig.compilerVersion,
  12409. uniCompilerVersionCode: parseFloat(__uniConfig.compilerVersion),
  12410. uniRuntimeVersionCode: parseFloat(__uniConfig.compilerVersion),
  12411. isUniAppX: true
  12412. }
  12413. );
  12414. }
  12415. );
  12416. const getSystemInfoSync = /* @__PURE__ */ defineSyncApi(
  12417. "getSystemInfoSync",
  12418. () => {
  12419. {
  12420. return {
  12421. deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
  12422. platform: "nodejs"
  12423. };
  12424. }
  12425. }
  12426. );
  12427. function updateDocumentTitle(title) {
  12428. {
  12429. const ssrContext = getApp$1().$.appContext.provides[vue.ssrContextKey];
  12430. if (ssrContext) {
  12431. ssrContext[uniShared.UNI_SSR_TITLE] = title;
  12432. }
  12433. }
  12434. UniServiceJSBridge.emit(uniShared.ON_NAVIGATION_BAR_CHANGE, { titleText: title });
  12435. }
  12436. function useDocumentTitle(pageMeta) {
  12437. function update() {
  12438. updateDocumentTitle(pageMeta.navigationBar.titleText);
  12439. }
  12440. vue.watchEffect(update);
  12441. }
  12442. function setNavigationBar(pageMeta, type, args, resolve, reject) {
  12443. if (!pageMeta) {
  12444. return reject("page not found");
  12445. }
  12446. const { navigationBar } = pageMeta;
  12447. switch (type) {
  12448. case API_SET_NAVIGATION_BAR_COLOR:
  12449. const { frontColor, backgroundColor, animation: animation2 } = args;
  12450. const { duration, timingFunc } = animation2;
  12451. if (frontColor) {
  12452. navigationBar.titleColor = frontColor === "#000000" ? "#000000" : "#ffffff";
  12453. }
  12454. if (backgroundColor) {
  12455. navigationBar.backgroundColor = backgroundColor;
  12456. }
  12457. navigationBar.duration = duration + "ms";
  12458. navigationBar.timingFunc = timingFunc;
  12459. break;
  12460. case API_SHOW_NAVIGATION_BAR_LOADING:
  12461. navigationBar.loading = true;
  12462. break;
  12463. case API_HIDE_NAVIGATION_BAR_LOADING:
  12464. navigationBar.loading = false;
  12465. break;
  12466. case API_SET_NAVIGATION_BAR_TITLE:
  12467. const { title } = args;
  12468. navigationBar.titleText = title;
  12469. {
  12470. updateDocumentTitle(args.title);
  12471. }
  12472. break;
  12473. }
  12474. resolve();
  12475. }
  12476. const setNavigationBarTitle = /* @__PURE__ */ defineAsyncApi(
  12477. API_SET_NAVIGATION_BAR_TITLE,
  12478. (args, { resolve, reject }) => {
  12479. setNavigationBar(
  12480. getCurrentPageMeta(),
  12481. API_SET_NAVIGATION_BAR_TITLE,
  12482. args,
  12483. resolve,
  12484. reject
  12485. );
  12486. },
  12487. SetNavigationBarTitleProtocol
  12488. );
  12489. require("localstorage-polyfill");
  12490. global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
  12491. const api = /* @__PURE__ */ Object.defineProperty({
  12492. __proto__: null,
  12493. clearStorage,
  12494. clearStorageSync,
  12495. getAppBaseInfo,
  12496. getDeviceInfo,
  12497. getStorage,
  12498. getStorageInfo,
  12499. getStorageInfoSync,
  12500. getStorageSync,
  12501. getSystemInfoSync,
  12502. removeStorage,
  12503. removeStorageSync,
  12504. request,
  12505. setNavigationBarTitle,
  12506. setStorage,
  12507. setStorageSync
  12508. }, Symbol.toStringTag, { value: "Module" });
  12509. const uni$1 = api;
  12510. const UniServiceJSBridge$1 = /* @__PURE__ */ shared.extend(ServiceJSBridge, {
  12511. publishHandler(event, args, pageId) {
  12512. UniViewJSBridge.subscribeHandler(event, args, pageId);
  12513. }
  12514. });
  12515. function onThemeChange(callback) {
  12516. if (__uniConfig.darkmode) {
  12517. UniServiceJSBridge.on(uniShared.ON_THEME_CHANGE, callback);
  12518. }
  12519. }
  12520. function parseTheme(pageStyle) {
  12521. let parsedStyle = {};
  12522. if (__uniConfig.darkmode) {
  12523. parsedStyle = uniShared.normalizeStyles(
  12524. pageStyle,
  12525. __uniConfig.themeConfig,
  12526. getTheme()
  12527. );
  12528. }
  12529. return __uniConfig.darkmode ? parsedStyle : pageStyle;
  12530. }
  12531. function useTheme(pageStyle, onThemeChangeCallback) {
  12532. const isReactivity = vue.isReactive(pageStyle);
  12533. const reactivePageStyle = isReactivity ? vue.reactive(parseTheme(pageStyle)) : parseTheme(pageStyle);
  12534. if (__uniConfig.darkmode && isReactivity) {
  12535. vue.watch(pageStyle, (value) => {
  12536. const _pageStyle = parseTheme(value);
  12537. for (const key in _pageStyle) {
  12538. reactivePageStyle[key] = _pageStyle[key];
  12539. }
  12540. });
  12541. }
  12542. onThemeChangeCallback && onThemeChange(onThemeChangeCallback);
  12543. return reactivePageStyle;
  12544. }
  12545. const _middleButton = {
  12546. width: "50px",
  12547. height: "50px",
  12548. iconWidth: "24px"
  12549. };
  12550. const TabBar = /* @__PURE__ */ defineSystemComponent({
  12551. name: "TabBar",
  12552. setup() {
  12553. const visibleList = vue.ref([]);
  12554. const _tabBar = useTabBar();
  12555. const tabBar2 = useTheme(_tabBar, () => {
  12556. const tabBarStyle = parseTheme(_tabBar);
  12557. tabBar2.backgroundColor = tabBarStyle.backgroundColor;
  12558. tabBar2.borderStyle = tabBarStyle.borderStyle;
  12559. tabBar2.color = tabBarStyle.color;
  12560. tabBar2.selectedColor = tabBarStyle.selectedColor;
  12561. tabBar2.blurEffect = tabBarStyle.blurEffect;
  12562. tabBar2.midButton = tabBarStyle.midButton;
  12563. if (tabBarStyle.list && tabBarStyle.list.length) {
  12564. tabBarStyle.list.forEach((item, index2) => {
  12565. tabBar2.list[index2].iconPath = item.iconPath;
  12566. tabBar2.list[index2].selectedIconPath = item.selectedIconPath;
  12567. });
  12568. }
  12569. });
  12570. useVisibleList(tabBar2, visibleList);
  12571. useTabBarCssVar(tabBar2);
  12572. const onSwitchTab = useSwitchTab(vueRouter.useRoute(), tabBar2, visibleList);
  12573. const {
  12574. style,
  12575. borderStyle,
  12576. placeholderStyle
  12577. } = useTabBarStyle(tabBar2);
  12578. return () => {
  12579. const tabBarItemsTsx = createTabBarItemsTsx(tabBar2, onSwitchTab, visibleList);
  12580. return vue.createVNode("uni-tabbar", {
  12581. "class": "uni-tabbar-" + tabBar2.position
  12582. }, [vue.createVNode("div", {
  12583. "class": "uni-tabbar",
  12584. "style": style.value
  12585. }, [vue.createVNode("div", {
  12586. "class": "uni-tabbar-border",
  12587. "style": borderStyle.value
  12588. }, null, 4), tabBarItemsTsx], 4), vue.createVNode("div", {
  12589. "class": "uni-placeholder",
  12590. "style": placeholderStyle.value
  12591. }, null, 4)], 2);
  12592. };
  12593. }
  12594. });
  12595. function useTabBarCssVar(tabBar2) {
  12596. vue.watch(() => tabBar2.shown, (value) => {
  12597. updatePageCssVar({
  12598. "--window-bottom": normalizeWindowBottom(value ? parseInt(tabBar2.height) : 0)
  12599. });
  12600. });
  12601. }
  12602. function useVisibleList(tabBar2, visibleList) {
  12603. const internalMidButton = vue.ref(shared.extend({
  12604. type: "midButton"
  12605. }, tabBar2.midButton));
  12606. function setVisibleList() {
  12607. let tempList = [];
  12608. tempList = tabBar2.list.filter((item) => item.visible !== false);
  12609. if (__UNI_FEATURE_TABBAR_MIDBUTTON__ && tabBar2.midButton) {
  12610. internalMidButton.value = shared.extend({}, _middleButton, internalMidButton.value, tabBar2.midButton);
  12611. tempList = tempList.filter((item) => !isMidButton(item));
  12612. if (tempList.length % 2 === 0) {
  12613. tempList.splice(Math.floor(tempList.length / 2), 0, internalMidButton.value);
  12614. }
  12615. }
  12616. visibleList.value = tempList;
  12617. }
  12618. vue.watchEffect(setVisibleList);
  12619. }
  12620. function useSwitchTab(route, tabBar2, visibleList) {
  12621. vue.watchEffect(() => {
  12622. const meta = route.meta;
  12623. if (meta.isTabBar) {
  12624. const pagePath = meta.route;
  12625. const index2 = visibleList.value.findIndex((item) => item.pagePath === pagePath);
  12626. tabBar2.selectedIndex = index2;
  12627. }
  12628. });
  12629. return (tabBarItem, index2) => {
  12630. const {
  12631. type
  12632. } = tabBarItem;
  12633. return () => {
  12634. if (__UNI_FEATURE_TABBAR_MIDBUTTON__ && type === "midButton") {
  12635. return UniServiceJSBridge.invokeOnCallback(API_ON_TAB_BAR_MID_BUTTON_TAP);
  12636. }
  12637. const {
  12638. pagePath,
  12639. text
  12640. } = tabBarItem;
  12641. let url = uniShared.addLeadingSlash(pagePath);
  12642. if (url === __uniRoutes[0].alias) {
  12643. url = "/";
  12644. }
  12645. if (route.path !== url) {
  12646. uni.switchTab({
  12647. from: "tabBar",
  12648. url,
  12649. tabBarText: text
  12650. });
  12651. } else {
  12652. invokeHook("onTabItemTap", {
  12653. index: index2,
  12654. text,
  12655. pagePath
  12656. });
  12657. }
  12658. };
  12659. };
  12660. }
  12661. const DEFAULT_BG_COLOR = "#f7f7fa";
  12662. const BLUR_EFFECT_COLOR_DARK = "rgb(0, 0, 0, 0.8)";
  12663. const BLUR_EFFECT_COLOR_LIGHT = "rgb(250, 250, 250, 0.8)";
  12664. const BLUR_EFFECT_COLORS = {
  12665. dark: BLUR_EFFECT_COLOR_DARK,
  12666. light: BLUR_EFFECT_COLOR_LIGHT,
  12667. extralight: BLUR_EFFECT_COLOR_LIGHT
  12668. };
  12669. const BORDER_COLORS = {
  12670. white: "rgba(255, 255, 255, 0.33)",
  12671. black: "rgba(0, 0, 0, 0.33)"
  12672. };
  12673. function useTabBarStyle(tabBar2) {
  12674. const style = vue.computed(() => {
  12675. let backgroundColor = tabBar2.backgroundColor;
  12676. const blurEffect = tabBar2.blurEffect;
  12677. if (!backgroundColor) {
  12678. if (blurEffect && blurEffect !== "none") {
  12679. backgroundColor = BLUR_EFFECT_COLORS[blurEffect];
  12680. }
  12681. }
  12682. return {
  12683. backgroundColor: backgroundColor || DEFAULT_BG_COLOR,
  12684. backdropFilter: blurEffect !== "none" ? "blur(10px)" : blurEffect
  12685. };
  12686. });
  12687. const borderStyle = vue.computed(() => {
  12688. const {
  12689. borderStyle: borderStyle2,
  12690. borderColor
  12691. } = tabBar2;
  12692. if (borderColor && shared.isString(borderColor)) {
  12693. return {
  12694. backgroundColor: borderColor
  12695. };
  12696. }
  12697. return {
  12698. backgroundColor: BORDER_COLORS[borderStyle2] || BORDER_COLORS["black"]
  12699. };
  12700. });
  12701. const placeholderStyle = vue.computed(() => {
  12702. return {
  12703. height: tabBar2.height
  12704. };
  12705. });
  12706. return {
  12707. style,
  12708. borderStyle,
  12709. placeholderStyle
  12710. };
  12711. }
  12712. function isMidButton(item) {
  12713. return item.type === "midButton";
  12714. }
  12715. function createTabBarItemsTsx(tabBar2, onSwitchTab, visibleList) {
  12716. const {
  12717. selectedIndex,
  12718. selectedColor,
  12719. color
  12720. } = tabBar2;
  12721. return visibleList.value.map((item, index2) => {
  12722. const selected = selectedIndex === index2;
  12723. const textColor = selected ? selectedColor : color;
  12724. const iconPath = (selected ? item.selectedIconPath || item.iconPath : item.iconPath) || "";
  12725. const iconfontText = item.iconfont ? selected ? item.iconfont.selectedText || item.iconfont.text : item.iconfont.text : void 0;
  12726. const iconfontColor = item.iconfont ? selected ? item.iconfont.selectedColor || item.iconfont.color : item.iconfont.color : void 0;
  12727. if (!__UNI_FEATURE_TABBAR_MIDBUTTON__) {
  12728. return createTabBarItemTsx(textColor, iconPath, iconfontText, iconfontColor, item, tabBar2, index2, onSwitchTab);
  12729. }
  12730. return isMidButton(item) ? createTabBarMidButtonTsx(textColor, iconPath, iconfontText, iconfontColor, item, tabBar2, index2, onSwitchTab) : createTabBarItemTsx(textColor, iconPath, iconfontText, iconfontColor, item, tabBar2, index2, onSwitchTab);
  12731. });
  12732. }
  12733. function createTabBarItemTsx(color, iconPath, iconfontText, iconfontColor, tabBarItem, tabBar2, index2, onSwitchTab) {
  12734. return vue.createVNode("div", {
  12735. "key": index2,
  12736. "class": "uni-tabbar__item",
  12737. "onClick": onSwitchTab(tabBarItem, index2)
  12738. }, [createTabBarItemBdTsx(color, iconPath || "", iconfontText, iconfontColor, tabBarItem, tabBar2)], 8, ["onClick"]);
  12739. }
  12740. function createTabBarItemBdTsx(color, iconPath, iconfontText, iconfontColor, tabBarItem, tabBar2) {
  12741. const {
  12742. height
  12743. } = tabBar2;
  12744. return vue.createVNode("div", {
  12745. "class": "uni-tabbar__bd",
  12746. "style": {
  12747. height
  12748. }
  12749. }, [iconfontText ? createTabBarItemIconfontTsx(iconfontText, iconfontColor || BLUR_EFFECT_COLOR_DARK, tabBarItem, tabBar2) : iconPath && createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2), tabBarItem.text && createTabBarItemTextTsx(color, tabBarItem, tabBar2), tabBarItem.redDot && createTabBarItemRedDotTsx(tabBarItem.badge)], 4);
  12750. }
  12751. function createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2) {
  12752. const {
  12753. type,
  12754. text
  12755. } = tabBarItem;
  12756. const {
  12757. iconWidth
  12758. } = tabBar2;
  12759. const clazz2 = "uni-tabbar__icon" + (text ? " uni-tabbar__icon__diff" : "");
  12760. const style = {
  12761. width: iconWidth,
  12762. height: iconWidth
  12763. };
  12764. return vue.createVNode("div", {
  12765. "class": clazz2,
  12766. "style": style
  12767. }, [type !== "midButton" && vue.createVNode("img", {
  12768. "src": getRealPath(iconPath)
  12769. }, null, 8, ["src"])], 6);
  12770. }
  12771. function createTabBarItemIconfontTsx(iconfontText, iconfontColor, tabBarItem, tabBar2) {
  12772. var _a;
  12773. const {
  12774. type,
  12775. text
  12776. } = tabBarItem;
  12777. const {
  12778. iconWidth
  12779. } = tabBar2;
  12780. const clazz2 = "uni-tabbar__icon" + (text ? " uni-tabbar__icon__diff" : "");
  12781. const style = {
  12782. width: iconWidth,
  12783. height: iconWidth
  12784. };
  12785. const iconfontStyle = {
  12786. fontSize: ((_a = tabBarItem.iconfont) == null ? void 0 : _a.fontSize) || iconWidth,
  12787. color: iconfontColor
  12788. };
  12789. return vue.createVNode("div", {
  12790. "class": clazz2,
  12791. "style": style
  12792. }, [type !== "midButton" && vue.createVNode("div", {
  12793. "class": "uni-tabbar__iconfont",
  12794. "style": iconfontStyle
  12795. }, [iconfontText], 4)], 6);
  12796. }
  12797. function createTabBarItemTextTsx(color, tabBarItem, tabBar2) {
  12798. const {
  12799. iconPath,
  12800. text
  12801. } = tabBarItem;
  12802. const {
  12803. fontSize,
  12804. spacing
  12805. } = tabBar2;
  12806. const style = {
  12807. color,
  12808. fontSize,
  12809. lineHeight: !iconPath ? 1.8 : "normal",
  12810. marginTop: !iconPath ? "inherit" : spacing
  12811. };
  12812. return vue.createVNode("div", {
  12813. "class": "uni-tabbar__label",
  12814. "style": style
  12815. }, [text], 4);
  12816. }
  12817. function createTabBarItemRedDotTsx(badge) {
  12818. const clazz2 = "uni-tabbar__reddot" + (badge ? " uni-tabbar__badge" : "");
  12819. return vue.createVNode("div", {
  12820. "class": clazz2
  12821. }, [badge], 2);
  12822. }
  12823. function createTabBarMidButtonTsx(color, iconPath, iconfontText, iconfontColor, midButton, tabBar2, index2, onSwitchTab) {
  12824. const {
  12825. width,
  12826. height,
  12827. backgroundImage,
  12828. iconWidth
  12829. } = midButton;
  12830. return vue.createVNode("div", {
  12831. "key": "midButton",
  12832. "class": "uni-tabbar__item",
  12833. "style": {
  12834. flex: "0 0 " + width,
  12835. position: "relative"
  12836. },
  12837. "onClick": onSwitchTab(midButton, index2)
  12838. }, [vue.createVNode("div", {
  12839. "class": "uni-tabbar__mid",
  12840. "style": {
  12841. width,
  12842. height,
  12843. backgroundImage: backgroundImage ? "url('" + getRealPath(backgroundImage) + "')" : "none"
  12844. }
  12845. }, [iconPath && vue.createVNode("img", {
  12846. "style": {
  12847. width: iconWidth,
  12848. height: iconWidth
  12849. },
  12850. "src": getRealPath(iconPath)
  12851. }, null, 12, ["src"])], 4), createTabBarItemBdTsx(color, iconPath, iconfontText, iconfontColor, midButton, tabBar2)], 12, ["onClick"]);
  12852. }
  12853. const LayoutComponent = /* @__PURE__ */ defineSystemComponent({
  12854. name: "Layout",
  12855. setup(_props, {
  12856. emit: emit2
  12857. }) {
  12858. const rootRef = vue.ref(null);
  12859. const keepAliveRoute = __UNI_FEATURE_PAGES__ && useKeepAliveRoute();
  12860. const {
  12861. layoutState,
  12862. windowState
  12863. } = useState();
  12864. useMaxWidth(layoutState, rootRef);
  12865. const topWindow = __UNI_FEATURE_TOPWINDOW__ && useTopWindow(layoutState);
  12866. const leftWindow = __UNI_FEATURE_LEFTWINDOW__ && useLeftWindow(layoutState);
  12867. const rightWindow = __UNI_FEATURE_RIGHTWINDOW__ && useRightWindow(layoutState);
  12868. const showTabBar = __UNI_FEATURE_TABBAR__ && useShowTabBar();
  12869. const clazz2 = useAppClass(showTabBar);
  12870. return () => {
  12871. const layoutTsx = createLayoutTsx(keepAliveRoute, layoutState, windowState, topWindow, leftWindow, rightWindow);
  12872. const tabBarTsx = __UNI_FEATURE_TABBAR__ && createTabBarTsx(showTabBar);
  12873. return vue.createVNode("uni-app", {
  12874. "ref": rootRef,
  12875. "class": clazz2.value
  12876. }, [layoutTsx, tabBarTsx], 2);
  12877. };
  12878. }
  12879. });
  12880. function useAppClass(showTabBar) {
  12881. const showMaxWidth = vue.ref(false);
  12882. return vue.computed(() => {
  12883. return {
  12884. "uni-app--showtabbar": showTabBar && showTabBar.value,
  12885. "uni-app--maxwidth": showMaxWidth.value
  12886. };
  12887. });
  12888. }
  12889. function initMediaQuery(minWidth, callback) {
  12890. {
  12891. return false;
  12892. }
  12893. }
  12894. function useMaxWidth(layoutState, rootRef) {
  12895. const route = usePageRoute();
  12896. function checkMaxWidth() {
  12897. const windowWidth = document.body.clientWidth;
  12898. const pages = getCurrentPages();
  12899. let meta = {};
  12900. if (pages.length > 0) {
  12901. const curPage = pages[pages.length - 1];
  12902. meta = curPage.$page.meta;
  12903. } else {
  12904. const routeOptions = getRouteOptions(route.path, true);
  12905. if (routeOptions) {
  12906. meta = routeOptions.meta;
  12907. }
  12908. }
  12909. const maxWidth = parseInt(String((shared.hasOwn(meta, "maxWidth") ? meta.maxWidth : __uniConfig.globalStyle.maxWidth) || Number.MAX_SAFE_INTEGER));
  12910. let showMaxWidth = false;
  12911. if (windowWidth > maxWidth) {
  12912. showMaxWidth = true;
  12913. } else {
  12914. showMaxWidth = false;
  12915. }
  12916. if (showMaxWidth && maxWidth) {
  12917. layoutState.marginWidth = (windowWidth - maxWidth) / 2;
  12918. vue.nextTick(() => {
  12919. const rootEl = rootRef.value;
  12920. if (rootEl) {
  12921. rootEl.setAttribute("style", "max-width:" + maxWidth + "px;margin:0 auto;");
  12922. }
  12923. });
  12924. } else {
  12925. layoutState.marginWidth = 0;
  12926. vue.nextTick(() => {
  12927. const rootEl = rootRef.value;
  12928. if (rootEl) {
  12929. rootEl.removeAttribute("style");
  12930. }
  12931. });
  12932. }
  12933. }
  12934. vue.watch([() => route.path], checkMaxWidth);
  12935. }
  12936. function useState() {
  12937. const route = usePageRoute();
  12938. if (!__UNI_FEATURE_RESPONSIVE__) {
  12939. const layoutState2 = vue.reactive({
  12940. marginWidth: 0,
  12941. leftWindowWidth: 0,
  12942. rightWindowWidth: 0
  12943. });
  12944. vue.watch(() => layoutState2.marginWidth, (value) => updateCssVar({
  12945. "--window-margin": value + "px"
  12946. }));
  12947. vue.watch(() => layoutState2.leftWindowWidth + layoutState2.marginWidth, (value) => {
  12948. updateCssVar({
  12949. "--window-left": value + "px"
  12950. });
  12951. });
  12952. vue.watch(() => layoutState2.rightWindowWidth + layoutState2.marginWidth, (value) => {
  12953. updateCssVar({
  12954. "--window-right": value + "px"
  12955. });
  12956. });
  12957. return {
  12958. layoutState: layoutState2,
  12959. windowState: vue.computed(() => ({}))
  12960. };
  12961. }
  12962. const topWindowMediaQuery = vue.ref(false);
  12963. const leftWindowMediaQuery = vue.ref(false);
  12964. const rightWindowMediaQuery = vue.ref(false);
  12965. const showTopWindow = vue.computed(() => __UNI_FEATURE_TOPWINDOW__ && route.meta.topWindow !== false && topWindowMediaQuery.value);
  12966. const showLeftWindow = vue.computed(() => __UNI_FEATURE_LEFTWINDOW__ && route.meta.leftWindow !== false && leftWindowMediaQuery.value);
  12967. const showRightWindow = vue.computed(() => __UNI_FEATURE_RIGHTWINDOW__ && route.meta.rightWindow !== false && rightWindowMediaQuery.value);
  12968. const layoutState = vue.reactive({
  12969. topWindowMediaQuery,
  12970. showTopWindow,
  12971. apiShowTopWindow: false,
  12972. leftWindowMediaQuery,
  12973. showLeftWindow,
  12974. apiShowLeftWindow: false,
  12975. rightWindowMediaQuery,
  12976. showRightWindow,
  12977. apiShowRightWindow: false,
  12978. topWindowHeight: 0,
  12979. marginWidth: 0,
  12980. leftWindowWidth: 0,
  12981. rightWindowWidth: 0,
  12982. navigationBarTitleText: "",
  12983. topWindowStyle: {},
  12984. leftWindowStyle: {},
  12985. rightWindowStyle: {}
  12986. });
  12987. const props2 = ["topWindow", "leftWindow", "rightWindow"];
  12988. props2.forEach((prop) => {
  12989. var _a;
  12990. const matchMedia = (_a = __uniConfig[prop]) == null ? void 0 : _a.matchMedia;
  12991. if (matchMedia && shared.hasOwn(matchMedia, "minWidth")) {
  12992. matchMedia.minWidth;
  12993. }
  12994. const matches = initMediaQuery();
  12995. layoutState[`${prop}MediaQuery`] = matches;
  12996. });
  12997. vue.watch(() => layoutState.topWindowHeight, (value) => updateCssVar({
  12998. "--top-window-height": value + "px"
  12999. }));
  13000. vue.watch(() => layoutState.marginWidth, (value) => updateCssVar({
  13001. "--window-margin": value + "px"
  13002. }));
  13003. vue.watch(() => layoutState.leftWindowWidth + layoutState.marginWidth, (value) => {
  13004. updateCssVar({
  13005. "--window-left": value + "px"
  13006. });
  13007. });
  13008. vue.watch(() => layoutState.rightWindowWidth + layoutState.marginWidth, (value) => {
  13009. updateCssVar({
  13010. "--window-right": value + "px"
  13011. });
  13012. });
  13013. UniServiceJSBridge.on(uniShared.ON_NAVIGATION_BAR_CHANGE, (navigationBar) => {
  13014. layoutState.navigationBarTitleText = navigationBar.titleText;
  13015. });
  13016. const windowState = vue.computed(() => ({
  13017. matchTopWindow: layoutState.topWindowMediaQuery,
  13018. showTopWindow: layoutState.showTopWindow || layoutState.apiShowTopWindow,
  13019. matchLeftWindow: layoutState.leftWindowMediaQuery,
  13020. showLeftWindow: layoutState.showLeftWindow || layoutState.apiShowLeftWindow,
  13021. matchRightWindow: layoutState.rightWindowMediaQuery,
  13022. showRightWindow: layoutState.showRightWindow || layoutState.apiShowRightWindow
  13023. }));
  13024. return {
  13025. layoutState,
  13026. windowState
  13027. };
  13028. }
  13029. function createLayoutTsx(keepAliveRoute, layoutState, windowState, topWindow, leftWindow, rightWindow) {
  13030. const routerVNode = __UNI_FEATURE_PAGES__ ? createRouterViewVNode(keepAliveRoute) : createPageVNode();
  13031. if (!__UNI_FEATURE_RESPONSIVE__) {
  13032. return routerVNode;
  13033. }
  13034. const topWindowTsx = __UNI_FEATURE_TOPWINDOW__ ? createTopWindowTsx(topWindow, layoutState, windowState.value) : null;
  13035. const leftWindowTsx = __UNI_FEATURE_LEFTWINDOW__ ? createLeftWindowTsx(leftWindow, layoutState, windowState.value) : null;
  13036. const rightWindowTsx = __UNI_FEATURE_RIGHTWINDOW__ ? createRightWindowTsx(rightWindow, layoutState, windowState.value) : null;
  13037. return vue.createVNode("uni-layout", {
  13038. "class": {
  13039. "uni-app--showtopwindow": __UNI_FEATURE_TOPWINDOW__ && layoutState.showTopWindow,
  13040. "uni-app--showleftwindow": __UNI_FEATURE_LEFTWINDOW__ && layoutState.showLeftWindow,
  13041. "uni-app--showrightwindow": __UNI_FEATURE_RIGHTWINDOW__ && layoutState.showRightWindow
  13042. }
  13043. }, [topWindowTsx, vue.createVNode("uni-content", null, [vue.createVNode("uni-main", null, [routerVNode]), leftWindowTsx, rightWindowTsx])], 2);
  13044. }
  13045. function useShowTabBar(emit2) {
  13046. const route = usePageRoute();
  13047. const tabBar2 = useTabBar();
  13048. const showTabBar = vue.computed(() => route.meta.isTabBar && tabBar2.shown);
  13049. return showTabBar;
  13050. }
  13051. function createTabBarTsx(showTabBar) {
  13052. return vue.withDirectives(vue.createVNode(TabBar, null, null, 512), [[vue.vShow, showTabBar.value]]);
  13053. }
  13054. function createPageVNode() {
  13055. return vue.createVNode(__uniRoutes[0].component);
  13056. }
  13057. function createRouterViewVNode({
  13058. routeKey,
  13059. isTabBar,
  13060. routeCache: routeCache2
  13061. }) {
  13062. return vue.createVNode(vueRouter.RouterView, null, {
  13063. default: vue.withCtx(({
  13064. Component
  13065. }) => [(vue.openBlock(), vue.createBlock(vue.KeepAlive, {
  13066. matchBy: "key",
  13067. cache: routeCache2
  13068. }, [(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(Component), {
  13069. type: isTabBar.value ? "tabBar" : "",
  13070. key: routeKey.value
  13071. }))], 1032, ["cache"]))]),
  13072. _: 1
  13073. /* STABLE */
  13074. });
  13075. }
  13076. function useTopWindow(layoutState) {
  13077. const {
  13078. component,
  13079. style
  13080. } = __uniConfig.topWindow;
  13081. const windowRef = vue.ref(null);
  13082. function updateWindow() {
  13083. const instance = windowRef.value;
  13084. const el = uniShared.resolveOwnerEl(instance.$);
  13085. const height = el.getBoundingClientRect().height;
  13086. layoutState.topWindowHeight = height;
  13087. }
  13088. vue.watch(() => layoutState.showTopWindow || layoutState.apiShowTopWindow, () => vue.nextTick(updateWindow));
  13089. layoutState.topWindowStyle = style;
  13090. return {
  13091. component,
  13092. windowRef
  13093. };
  13094. }
  13095. function useLeftWindow(layoutState) {
  13096. const {
  13097. component,
  13098. style
  13099. } = __uniConfig.leftWindow;
  13100. const windowRef = vue.ref(null);
  13101. function updateWindow() {
  13102. const instance = windowRef.value;
  13103. const el = uniShared.resolveOwnerEl(instance.$);
  13104. const width = el.getBoundingClientRect().width;
  13105. layoutState.leftWindowWidth = width;
  13106. }
  13107. vue.watch(() => layoutState.showLeftWindow || layoutState.apiShowLeftWindow, () => vue.nextTick(updateWindow));
  13108. layoutState.leftWindowStyle = style;
  13109. return {
  13110. component,
  13111. windowRef
  13112. };
  13113. }
  13114. function useRightWindow(layoutState) {
  13115. const {
  13116. component,
  13117. style
  13118. } = __uniConfig.rightWindow;
  13119. const windowRef = vue.ref(null);
  13120. function updateWindow() {
  13121. const instance = windowRef.value;
  13122. const el = uniShared.resolveOwnerEl(instance.$);
  13123. const width = el.getBoundingClientRect().width;
  13124. layoutState.rightWindowWidth = width;
  13125. }
  13126. vue.watch(() => layoutState.showRightWindow || layoutState.apiShowRightWindow, () => vue.nextTick(updateWindow));
  13127. layoutState.rightWindowStyle = style;
  13128. return {
  13129. component,
  13130. windowRef
  13131. };
  13132. }
  13133. function createTopWindowTsx(topWindow, layoutState, windowState) {
  13134. if (topWindow) {
  13135. const {
  13136. component: TopWindow,
  13137. windowRef
  13138. } = topWindow;
  13139. return vue.withDirectives(vue.createVNode("uni-top-window", null, [vue.createVNode("div", {
  13140. "class": "uni-top-window",
  13141. "style": layoutState.topWindowStyle
  13142. }, [vue.createVNode(TopWindow, vue.mergeProps({
  13143. "ref": windowRef,
  13144. "navigation-bar-title-text": layoutState.navigationBarTitleText
  13145. }, windowState), null, 16, ["navigation-bar-title-text"])], 4), vue.createVNode("div", {
  13146. "class": "uni-top-window--placeholder",
  13147. "style": {
  13148. height: layoutState.topWindowHeight + "px"
  13149. }
  13150. }, null, 4)], 512), [[vue.vShow, layoutState.showTopWindow || layoutState.apiShowTopWindow]]);
  13151. }
  13152. }
  13153. function createLeftWindowTsx(leftWindow, layoutState, windowState) {
  13154. if (leftWindow) {
  13155. const {
  13156. component: LeftWindow,
  13157. windowRef
  13158. } = leftWindow;
  13159. return vue.withDirectives(vue.createVNode("uni-left-window", {
  13160. "data-show": layoutState.apiShowLeftWindow || void 0,
  13161. "style": layoutState.leftWindowStyle
  13162. }, [layoutState.apiShowLeftWindow ? vue.createVNode("div", {
  13163. "class": "uni-mask",
  13164. "onClick": () => layoutState.apiShowLeftWindow = false
  13165. }, null, 8, ["onClick"]) : null, vue.createVNode("div", {
  13166. "class": "uni-left-window"
  13167. }, [vue.createVNode(LeftWindow, vue.mergeProps({
  13168. "ref": windowRef
  13169. }, windowState), null, 16)])], 12, ["data-show"]), [[vue.vShow, layoutState.showLeftWindow || layoutState.apiShowLeftWindow]]);
  13170. }
  13171. }
  13172. function createRightWindowTsx(rightWindow, layoutState, windowState) {
  13173. if (rightWindow) {
  13174. const {
  13175. component: RightWindow,
  13176. windowRef
  13177. } = rightWindow;
  13178. return vue.withDirectives(vue.createVNode("uni-right-window", {
  13179. "data-show": layoutState.apiShowRightWindow || void 0,
  13180. "style": layoutState.rightWindowStyle
  13181. }, [layoutState.apiShowRightWindow ? vue.createVNode("div", {
  13182. "class": "uni-mask",
  13183. "onClick": () => layoutState.apiShowRightWindow = false
  13184. }, null, 8, ["onClick"]) : null, vue.createVNode("div", {
  13185. "class": "uni-right-window"
  13186. }, [vue.createVNode(RightWindow, vue.mergeProps({
  13187. "ref": windowRef
  13188. }, windowState), null, 16)])], 12, ["data-show"]), [[vue.vShow, layoutState.showRightWindow || layoutState.apiShowRightWindow]]);
  13189. }
  13190. }
  13191. function updateBackgroundColorContent(backgroundColorContent) {
  13192. {
  13193. return;
  13194. }
  13195. }
  13196. function useBackgroundColorContent(pageMeta) {
  13197. function update() {
  13198. if (pageMeta.backgroundColorContent) {
  13199. updateBackgroundColorContent(
  13200. parseTheme({ backgroundColorContent: pageMeta.backgroundColorContent }).backgroundColorContent
  13201. );
  13202. }
  13203. }
  13204. onThemeChange(update);
  13205. vue.watchEffect(update);
  13206. }
  13207. function usePageHeadTransparentBackgroundColor(backgroundColor) {
  13208. const { r, g: g2, b } = hexToRgba(backgroundColor);
  13209. return `rgba(${r},${g2},${b},0)`;
  13210. }
  13211. function usePageHeadTransparent(headRef, {
  13212. id: id2,
  13213. navigationBar: { titleColor, coverage, backgroundColor }
  13214. }) {
  13215. vue.computed(() => hexToRgba(backgroundColor));
  13216. }
  13217. const ICON_PATHS = {
  13218. none: "",
  13219. forward: "M11 7.844q-0.25-0.219-0.25-0.578t0.25-0.578q0.219-0.25 0.563-0.25t0.563 0.25l9.656 9.125q0.125 0.125 0.188 0.297t0.063 0.328q0 0.188-0.063 0.359t-0.188 0.297l-9.656 9.125q-0.219 0.25-0.563 0.25t-0.563-0.25q-0.25-0.219-0.25-0.578t0.25-0.609l9.063-8.594-9.063-8.594z",
  13220. back: ICON_PATH_BACK,
  13221. select: ICON_PATH_BACK,
  13222. share: "M26.563 24.844q0 0.125-0.109 0.234t-0.234 0.109h-17.938q-0.125 0-0.219-0.109t-0.094-0.234v-13.25q0-0.156 0.094-0.25t0.219-0.094h5.5v-1.531h-6q-0.531 0-0.906 0.391t-0.375 0.922v14.375q0 0.531 0.375 0.922t0.906 0.391h18.969q0.531 0 0.891-0.391t0.359-0.953v-5.156h-1.438v4.625zM29.813 10.969l-5.125-5.375-1.031 1.094 3.438 3.594-3.719 0.031q-2.313 0.188-4.344 1.125t-3.578 2.422-2.5 3.453-1.109 4.188l-0.031 0.25h1.469v-0.219q0.156-1.875 1-3.594t2.25-3.063 3.234-2.125 3.828-0.906l0.188-0.031 3.313-0.031-3.438 3.625 1.031 1.063 5.125-5.375-0.031-0.063 0.031-0.063z",
  13223. favorite: "M27.594 13.375q-0.063-0.188-0.219-0.313t-0.344-0.156l-7.094-0.969-3.219-6.406q-0.094-0.188-0.25-0.281t-0.375-0.094q-0.188 0-0.344 0.094t-0.25 0.281l-3.125 6.438-7.094 1.094q-0.188 0.031-0.344 0.156t-0.219 0.313q-0.031 0.188 0.016 0.375t0.172 0.313l5.156 4.969-1.156 7.063q-0.031 0.188 0.047 0.375t0.234 0.313q0.094 0.063 0.188 0.094t0.219 0.031q0.063 0 0.141-0.031t0.172-0.063l6.313-3.375 6.375 3.313q0.063 0.031 0.141 0.047t0.172 0.016q0.188 0 0.344-0.094t0.25-0.281q0.063-0.094 0.078-0.234t-0.016-0.234q0-0.031 0-0.063l-1.25-6.938 5.094-5.031q0.156-0.156 0.203-0.344t-0.016-0.375zM11.469 19.063q0.031-0.188-0.016-0.344t-0.172-0.281l-4.406-4.25 6.063-0.906q0.156-0.031 0.297-0.125t0.203-0.25l2.688-5.531 2.75 5.5q0.063 0.156 0.203 0.25t0.297 0.125l6.094 0.844-4.375 4.281q-0.125 0.125-0.172 0.297t-0.016 0.328l1.063 6.031-5.438-2.813q-0.156-0.094-0.328-0.078t-0.297 0.078l-5.438 2.875 1-6.031z",
  13224. home: "M23.719 16.5q-0.313 0-0.531 0.219t-0.219 0.5v7.063q0 0.219-0.172 0.391t-0.391 0.172h-12.344q-0.25 0-0.422-0.172t-0.172-0.391v-7.063q0-0.281-0.219-0.5t-0.531-0.219q-0.281 0-0.516 0.219t-0.234 0.5v7.063q0.031 0.844 0.625 1.453t1.438 0.609h12.375q0.844 0 1.453-0.609t0.609-1.453v-7.063q0-0.125-0.063-0.266t-0.156-0.234q-0.094-0.125-0.234-0.172t-0.297-0.047zM26.5 14.875l-8.813-8.813q-0.313-0.313-0.688-0.453t-0.781-0.141-0.781 0.141-0.656 0.422l-8.813 8.844q-0.188 0.219-0.188 0.516t0.219 0.484q0.094 0.125 0.234 0.172t0.297 0.047q0.125 0 0.25-0.047t0.25-0.141l8.781-8.781q0.156-0.156 0.406-0.156t0.406 0.156l8.813 8.781q0.219 0.188 0.516 0.188t0.516-0.219q0.188-0.188 0.203-0.484t-0.172-0.516z",
  13225. menu: "M8.938 18.313q0.875 0 1.484-0.609t0.609-1.453-0.609-1.453-1.484-0.609q-0.844 0-1.453 0.609t-0.609 1.453 0.609 1.453 1.453 0.609zM16.188 18.313q0.875 0 1.484-0.609t0.609-1.453-0.609-1.453-1.484-0.609q-0.844 0-1.453 0.609t-0.609 1.453 0.609 1.453 1.453 0.609zM23.469 18.313q0.844 0 1.453-0.609t0.609-1.453-0.609-1.453-1.453-0.609q-0.875 0-1.484 0.609t-0.609 1.453 0.609 1.453 1.484 0.609z",
  13226. close: ICON_PATH_CLOSE
  13227. };
  13228. const PageHead = /* @__PURE__ */ defineSystemComponent({
  13229. name: "PageHead",
  13230. setup() {
  13231. const headRef = vue.ref(null);
  13232. const pageMeta = usePageMeta();
  13233. const navigationBar = useTheme(pageMeta.navigationBar, () => {
  13234. const _navigationBar = parseTheme(pageMeta.navigationBar);
  13235. navigationBar.backgroundColor = _navigationBar.backgroundColor;
  13236. navigationBar.titleColor = _navigationBar.titleColor;
  13237. });
  13238. const {
  13239. clazz: clazz2,
  13240. style
  13241. } = usePageHead(navigationBar);
  13242. const buttons = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__ && usePageHeadButtons(pageMeta);
  13243. const searchInput = __UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__ && navigationBar.searchInput && usePageHeadSearchInput(pageMeta);
  13244. __UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__ && navigationBar.type === "transparent" && usePageHeadTransparent(headRef, pageMeta);
  13245. return () => {
  13246. const backButtonTsx = __UNI_FEATURE_PAGES__ ? createBackButtonTsx(navigationBar, pageMeta.isQuit) : null;
  13247. const leftButtonsTsx = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__ ? createButtonsTsx(buttons.left) : [];
  13248. const rightButtonsTsx = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__ ? createButtonsTsx(buttons.right) : [];
  13249. const type = navigationBar.type || "default";
  13250. const placeholderTsx = type !== "transparent" && type !== "float" && vue.createVNode("div", {
  13251. "class": {
  13252. "uni-placeholder": true,
  13253. "uni-placeholder-titlePenetrate": navigationBar.titlePenetrate
  13254. }
  13255. }, null, 2);
  13256. return vue.createVNode("uni-page-head", {
  13257. "uni-page-head-type": type
  13258. }, [vue.createVNode("div", {
  13259. "ref": headRef,
  13260. "class": clazz2.value,
  13261. "style": style.value
  13262. }, [vue.createVNode("div", {
  13263. "class": "uni-page-head-hd"
  13264. }, [backButtonTsx, ...leftButtonsTsx]), createPageHeadBdTsx(navigationBar, searchInput), vue.createVNode("div", {
  13265. "class": "uni-page-head-ft"
  13266. }, [...rightButtonsTsx])], 6), placeholderTsx], 8, ["uni-page-head-type"]);
  13267. };
  13268. }
  13269. });
  13270. function createBackButtonTsx(navigationBar, isQuit) {
  13271. if (!isQuit) {
  13272. return vue.createVNode("div", {
  13273. "class": "uni-page-head-btn",
  13274. "onClick": onPageHeadBackButton
  13275. }, [createSvgIconVNode(ICON_PATH_BACK, navigationBar.type === "transparent" ? "#fff" : navigationBar.titleColor, 26)], 8, ["onClick"]);
  13276. }
  13277. }
  13278. function createButtonsTsx(btns) {
  13279. return btns.map(({
  13280. onClick,
  13281. btnClass,
  13282. btnStyle,
  13283. btnText,
  13284. btnIconPath,
  13285. badgeText,
  13286. iconStyle,
  13287. btnSelect
  13288. }, index2) => {
  13289. return vue.createVNode("div", {
  13290. "key": index2,
  13291. "class": btnClass,
  13292. "style": btnStyle,
  13293. "onClick": onClick,
  13294. "badge-text": badgeText
  13295. }, [btnIconPath ? createSvgIconVNode(btnIconPath, iconStyle.color, iconStyle.fontSize) : btnSelect ? vue.createVNode("span", {
  13296. "style": iconStyle
  13297. }, [vue.createVNode("i", {
  13298. "class": "uni-btn-icon",
  13299. "innerHTML": btnText
  13300. }, null, 8, ["innerHTML"]), createSvgIconVNode(ICON_PATHS["select"], "#000", 14)], 4) : vue.createVNode("i", {
  13301. "class": "uni-btn-icon",
  13302. "style": iconStyle,
  13303. "innerHTML": btnText
  13304. }, null, 12, ["innerHTML"])], 14, ["onClick", "badge-text"]);
  13305. });
  13306. }
  13307. function createPageHeadBdTsx(navigationBar, searchInput) {
  13308. if (!__UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__ || !navigationBar.searchInput) {
  13309. return createPageHeadTitleTextTsx(navigationBar);
  13310. }
  13311. return createPageHeadSearchInputTsx(navigationBar, searchInput);
  13312. }
  13313. function createPageHeadTitleTextTsx({
  13314. type,
  13315. loading,
  13316. titleSize,
  13317. titleText,
  13318. titleImage
  13319. }) {
  13320. return vue.createVNode("div", {
  13321. "class": "uni-page-head-bd"
  13322. }, [vue.createVNode("div", {
  13323. "style": {
  13324. fontSize: titleSize,
  13325. opacity: type === "transparent" ? 0 : 1
  13326. },
  13327. "class": "uni-page-head__title"
  13328. }, [loading ? vue.createVNode("i", {
  13329. "class": "uni-loading"
  13330. }, null) : titleImage ? vue.createVNode("img", {
  13331. "src": titleImage,
  13332. "class": "uni-page-head__title_image"
  13333. }, null, 8, ["src"]) : titleText], 4)]);
  13334. }
  13335. function createPageHeadSearchInputTsx(navigationBar, {
  13336. text,
  13337. focus,
  13338. composing,
  13339. onBlur,
  13340. onFocus,
  13341. onInput,
  13342. onConfirm,
  13343. onClick
  13344. }) {
  13345. const {
  13346. color,
  13347. align,
  13348. autoFocus,
  13349. disabled,
  13350. borderRadius,
  13351. backgroundColor,
  13352. placeholder,
  13353. placeholderColor
  13354. } = navigationBar.searchInput;
  13355. const searchStyle = {
  13356. borderRadius,
  13357. backgroundColor
  13358. };
  13359. const placeholderClass = ["uni-page-head-search-placeholder", `uni-page-head-search-placeholder-${focus.value || text.value ? "left" : align}`];
  13360. return vue.createVNode("div", {
  13361. "class": "uni-page-head-search",
  13362. "style": searchStyle
  13363. }, [vue.createVNode("div", {
  13364. "style": {
  13365. color: placeholderColor
  13366. },
  13367. "class": placeholderClass
  13368. }, [vue.createVNode("div", {
  13369. "class": "uni-page-head-search-icon"
  13370. }, [createSvgIconVNode(ICON_PATH_SEARCH, placeholderColor, 20)]), text.value || composing.value ? "" : placeholder], 6), disabled ? vue.createVNode(Input, {
  13371. "disabled": true,
  13372. "style": {
  13373. color
  13374. },
  13375. "placeholder-style": "color: " + placeholderColor,
  13376. "class": "uni-page-head-search-input",
  13377. "confirm-type": "search",
  13378. "onClick": onClick
  13379. }, null, 8, ["style", "placeholder-style", "onClick"]) : vue.createVNode(Input, {
  13380. "focus": autoFocus,
  13381. "style": {
  13382. color
  13383. },
  13384. "placeholder-style": "color: " + placeholderColor,
  13385. "class": "uni-page-head-search-input",
  13386. "confirm-type": "search",
  13387. "onFocus": onFocus,
  13388. "onBlur": onBlur,
  13389. "onInput": onInput,
  13390. "onConfirm": onConfirm
  13391. }, null, 8, ["focus", "style", "placeholder-style", "onFocus", "onBlur", "onInput", "onConfirm"])], 4);
  13392. }
  13393. function onPageHeadBackButton() {
  13394. if (getCurrentPages().length === 1) {
  13395. uni.reLaunch({
  13396. url: "/"
  13397. });
  13398. } else {
  13399. uni.navigateBack({
  13400. from: "backbutton",
  13401. success() {
  13402. }
  13403. // 传入空方法,避免返回Promise,因为onBackPress可能导致fail
  13404. });
  13405. }
  13406. }
  13407. function usePageHead(navigationBar) {
  13408. const clazz2 = vue.computed(() => {
  13409. const {
  13410. type,
  13411. titlePenetrate,
  13412. shadowColorType
  13413. } = navigationBar;
  13414. const clazz3 = {
  13415. "uni-page-head": true,
  13416. "uni-page-head-transparent": type === "transparent",
  13417. "uni-page-head-titlePenetrate": titlePenetrate === "YES",
  13418. "uni-page-head-shadow": !!shadowColorType
  13419. };
  13420. if (shadowColorType) {
  13421. clazz3[`uni-page-head-shadow-${shadowColorType}`] = true;
  13422. }
  13423. return clazz3;
  13424. });
  13425. const style = vue.computed(() => {
  13426. const backgroundColor = __UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__ && navigationBar.type === "transparent" ? usePageHeadTransparentBackgroundColor(navigationBar.backgroundColor) : navigationBar.backgroundColor;
  13427. return {
  13428. backgroundColor,
  13429. color: navigationBar.titleColor,
  13430. transitionDuration: navigationBar.duration,
  13431. transitionTimingFunction: navigationBar.timingFunc
  13432. };
  13433. });
  13434. return {
  13435. clazz: clazz2,
  13436. style
  13437. };
  13438. }
  13439. function usePageHeadButtons({
  13440. id: id2,
  13441. navigationBar
  13442. }) {
  13443. const left = [];
  13444. const right = [];
  13445. const {
  13446. buttons
  13447. } = navigationBar;
  13448. if (shared.isArray(buttons)) {
  13449. const {
  13450. type
  13451. } = navigationBar;
  13452. const isTransparent = type === "transparent";
  13453. const fonts = /* @__PURE__ */ Object.create(null);
  13454. buttons.forEach((btn, index2) => {
  13455. if (btn.fontSrc && !btn.fontFamily) {
  13456. const fontSrc = getRealPath(btn.fontSrc);
  13457. let fontFamily = fonts[fontSrc];
  13458. if (!fontFamily) {
  13459. fontFamily = `font${Date.now()}`;
  13460. fonts[fontSrc] = fontFamily;
  13461. }
  13462. btn.fontFamily = fontFamily;
  13463. }
  13464. const pageHeadBtn = usePageHeadButton(id2, index2, btn, isTransparent);
  13465. if (btn.float === "left") {
  13466. left.push(pageHeadBtn);
  13467. } else {
  13468. right.push(pageHeadBtn);
  13469. }
  13470. });
  13471. }
  13472. return {
  13473. left,
  13474. right
  13475. };
  13476. }
  13477. function usePageHeadButton(pageId, index2, btn, isTransparent) {
  13478. const iconStyle = {
  13479. color: btn.color,
  13480. fontSize: btn.fontSize,
  13481. fontWeight: btn.fontWeight
  13482. };
  13483. if (btn.fontFamily) {
  13484. iconStyle.fontFamily = btn.fontFamily;
  13485. }
  13486. return new Proxy({
  13487. btnClass: {
  13488. // 类似这样的大量重复的字符串,会在gzip时压缩大小,无需在代码层考虑优化相同字符串
  13489. "uni-page-head-btn": true,
  13490. "uni-page-head-btn-red-dot": !!(btn.redDot || btn.badgeText),
  13491. "uni-page-head-btn-select": !!btn.select
  13492. },
  13493. btnStyle: {
  13494. backgroundColor: isTransparent ? btn.background : "transparent",
  13495. width: btn.width
  13496. },
  13497. btnText: "",
  13498. btnIconPath: ICON_PATHS[btn.type],
  13499. badgeText: btn.badgeText,
  13500. iconStyle,
  13501. onClick() {
  13502. invokeHook(pageId, uniShared.ON_NAVIGATION_BAR_BUTTON_TAP, shared.extend({
  13503. index: index2
  13504. }, btn));
  13505. },
  13506. btnSelect: btn.select
  13507. }, {
  13508. get(target, key, receiver) {
  13509. if (["btnText"].includes(key)) {
  13510. return btn.fontSrc && btn.fontFamily ? btn.text.replace("\\u", "&#x") : btn.text;
  13511. } else {
  13512. return Reflect.get(target, key, receiver);
  13513. }
  13514. }
  13515. });
  13516. }
  13517. function usePageHeadSearchInput({
  13518. id: id2,
  13519. navigationBar: {
  13520. searchInput
  13521. }
  13522. }) {
  13523. const focus = vue.ref(false);
  13524. const text = vue.ref("");
  13525. const composing = vue.ref(false);
  13526. const {
  13527. disabled
  13528. } = searchInput;
  13529. if (disabled) {
  13530. const onClick = () => {
  13531. invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
  13532. };
  13533. return {
  13534. focus,
  13535. text,
  13536. composing,
  13537. onClick
  13538. };
  13539. }
  13540. const onFocus = () => {
  13541. focus.value = true;
  13542. invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, {
  13543. focus: true
  13544. });
  13545. };
  13546. const onBlur = () => {
  13547. focus.value = false;
  13548. invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, {
  13549. focus: false
  13550. });
  13551. };
  13552. const onInput = (evt) => {
  13553. text.value = evt.detail.value;
  13554. invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, {
  13555. text: text.value
  13556. });
  13557. };
  13558. const onConfirm = (evt) => {
  13559. invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, {
  13560. text: text.value
  13561. });
  13562. };
  13563. return {
  13564. focus,
  13565. text,
  13566. composing,
  13567. onFocus,
  13568. onBlur,
  13569. onInput,
  13570. onConfirm
  13571. };
  13572. }
  13573. const _sfc_main = {
  13574. name: "PageRefresh",
  13575. setup() {
  13576. const { pullToRefresh } = usePageMeta();
  13577. return {
  13578. offset: pullToRefresh.offset,
  13579. color: pullToRefresh.color
  13580. };
  13581. }
  13582. };
  13583. const _export_sfc = (sfc, props2) => {
  13584. const target = sfc.__vccOpts || sfc;
  13585. for (const [key, val] of props2) {
  13586. target[key] = val;
  13587. }
  13588. return target;
  13589. };
  13590. const _hoisted_1 = { class: "uni-page-refresh-inner" };
  13591. const _hoisted_2 = ["fill"];
  13592. const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("path", { d: "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" }, null, -1);
  13593. const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("path", {
  13594. d: "M0 0h24v24H0z",
  13595. fill: "none"
  13596. }, null, -1);
  13597. const _hoisted_5 = [
  13598. _hoisted_3,
  13599. _hoisted_4
  13600. ];
  13601. const _hoisted_6 = {
  13602. class: "uni-page-refresh__spinner",
  13603. width: "24",
  13604. height: "24",
  13605. viewBox: "25 25 50 50"
  13606. };
  13607. const _hoisted_7 = ["stroke"];
  13608. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  13609. return vue.openBlock(), vue.createElementBlock("uni-page-refresh", null, [
  13610. vue.createElementVNode("div", {
  13611. style: vue.normalizeStyle({ "margin-top": $setup.offset + "px" }),
  13612. class: "uni-page-refresh"
  13613. }, [
  13614. vue.createElementVNode("div", _hoisted_1, [
  13615. (vue.openBlock(), vue.createElementBlock("svg", {
  13616. fill: $setup.color,
  13617. class: "uni-page-refresh__icon",
  13618. width: "24",
  13619. height: "24",
  13620. viewBox: "0 0 24 24"
  13621. }, _hoisted_5, 8, _hoisted_2)),
  13622. (vue.openBlock(), vue.createElementBlock("svg", _hoisted_6, [
  13623. vue.createElementVNode("circle", {
  13624. stroke: $setup.color,
  13625. class: "uni-page-refresh__path",
  13626. cx: "50",
  13627. cy: "50",
  13628. r: "20",
  13629. fill: "none",
  13630. "stroke-width": "4",
  13631. "stroke-miterlimit": "10"
  13632. }, null, 8, _hoisted_7)
  13633. ]))
  13634. ])
  13635. ], 4)
  13636. ]);
  13637. }
  13638. const PageRefresh = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
  13639. const PageBody = /* @__PURE__ */ defineSystemComponent({
  13640. name: "PageBody",
  13641. setup(props2, ctx) {
  13642. const pageMeta = __UNI_FEATURE_PULL_DOWN_REFRESH__ && usePageMeta();
  13643. const refreshRef = __UNI_FEATURE_PULL_DOWN_REFRESH__ && vue.ref(null);
  13644. const _pageRefresh = null;
  13645. const pageRefresh = vue.ref(null);
  13646. vue.watch(() => {
  13647. return pageMeta.enablePullDownRefresh;
  13648. }, () => {
  13649. pageRefresh.value = pageMeta.enablePullDownRefresh ? _pageRefresh : null;
  13650. }, {
  13651. immediate: true
  13652. });
  13653. return () => {
  13654. const pageRefreshTsx = __UNI_FEATURE_PULL_DOWN_REFRESH__ && createPageRefreshTsx(refreshRef);
  13655. return vue.createVNode(vue.Fragment, null, [pageRefreshTsx, vue.createVNode("uni-page-wrapper", pageRefresh.value, [vue.createVNode("uni-page-body", null, [vue.renderSlot(ctx.slots, "default")])], 16)]);
  13656. };
  13657. }
  13658. });
  13659. function createPageRefreshTsx(refreshRef, pageMeta) {
  13660. return vue.createVNode(PageRefresh, {
  13661. "ref": refreshRef
  13662. }, null, 512);
  13663. }
  13664. const index = /* @__PURE__ */ defineSystemComponent({
  13665. name: "Page",
  13666. setup(_props, ctx) {
  13667. const pageMeta = providePageMeta(getStateId());
  13668. const navigationBar = pageMeta.navigationBar;
  13669. const pageStyle = {};
  13670. useDocumentTitle(pageMeta);
  13671. {
  13672. useBackgroundColorContent(pageMeta);
  13673. }
  13674. return () => vue.createVNode(
  13675. "uni-page",
  13676. {
  13677. "data-page": pageMeta.route,
  13678. style: pageStyle
  13679. },
  13680. __UNI_FEATURE_NAVIGATIONBAR__ && navigationBar.style !== "custom" ? [vue.createVNode(PageHead), createPageBodyVNode(ctx)] : [createPageBodyVNode(ctx)]
  13681. );
  13682. }
  13683. });
  13684. function createPageBodyVNode(ctx) {
  13685. return vue.openBlock(), vue.createBlock(
  13686. PageBody,
  13687. { key: 0 },
  13688. {
  13689. default: vue.withCtx(() => [vue.renderSlot(ctx.slots, "page")]),
  13690. _: 3
  13691. }
  13692. );
  13693. }
  13694. exports.Ad = index$6;
  13695. exports.AdContentPage = index$5;
  13696. exports.AdDraw = index$4;
  13697. exports.AsyncErrorComponent = AsyncErrorComponent;
  13698. exports.AsyncLoadingComponent = AsyncLoadingComponent;
  13699. exports.Button = index$z;
  13700. exports.Camera = index$3;
  13701. exports.Canvas = indexX$4;
  13702. exports.Checkbox = index$x;
  13703. exports.CheckboxGroup = index$y;
  13704. exports.CoverImage = index$8;
  13705. exports.CoverView = index$9;
  13706. exports.Editor = index$w;
  13707. exports.Form = index$B;
  13708. exports.Icon = index$v;
  13709. exports.Image = index$u;
  13710. exports.Input = Input;
  13711. exports.Label = index$A;
  13712. exports.LayoutComponent = LayoutComponent;
  13713. exports.ListItem = index$g;
  13714. exports.ListView = index$h;
  13715. exports.LivePlayer = index$2;
  13716. exports.LivePusher = index$1;
  13717. exports.Map = index$a;
  13718. exports.MovableArea = index$t;
  13719. exports.MovableView = index$s;
  13720. exports.Navigator = index$r;
  13721. exports.PageComponent = index;
  13722. exports.Picker = index$7;
  13723. exports.PickerView = PickerView;
  13724. exports.PickerViewColumn = PickerViewColumn;
  13725. exports.Progress = index$q;
  13726. exports.Radio = indexX$3;
  13727. exports.RadioGroup = index$p;
  13728. exports.ResizeSensor = ResizeSensor;
  13729. exports.RichText = index$o;
  13730. exports.ScrollView = index$n;
  13731. exports.Slider = indexX$2;
  13732. exports.StickyHeader = index$e;
  13733. exports.StickySection = index$f;
  13734. exports.Swiper = index$m;
  13735. exports.SwiperItem = index$l;
  13736. exports.Switch = indexX$1;
  13737. exports.Text = index$k;
  13738. exports.Textarea = index$j;
  13739. exports.UniServiceJSBridge = UniServiceJSBridge$1;
  13740. exports.UniViewJSBridge = UniViewJSBridge$1;
  13741. exports.Video = index$b;
  13742. exports.View = index$i;
  13743. exports.WebView = indexX;
  13744. exports.clearStorage = clearStorage;
  13745. exports.clearStorageSync = clearStorageSync;
  13746. exports.getApp = getApp$1;
  13747. exports.getAppBaseInfo = getAppBaseInfo;
  13748. exports.getCurrentPages = getCurrentPages$1;
  13749. exports.getDeviceInfo = getDeviceInfo;
  13750. exports.getRealPath = getRealPath;
  13751. exports.getStorage = getStorage;
  13752. exports.getStorageInfo = getStorageInfo;
  13753. exports.getStorageInfoSync = getStorageInfoSync;
  13754. exports.getStorageSync = getStorageSync;
  13755. exports.getSystemInfoSync = getSystemInfoSync;
  13756. exports.plugin = index$c;
  13757. exports.removeStorage = removeStorage;
  13758. exports.removeStorageSync = removeStorageSync;
  13759. exports.request = request;
  13760. exports.setNavigationBarTitle = setNavigationBarTitle;
  13761. exports.setStorage = setStorage;
  13762. exports.setStorageSync = setStorageSync;
  13763. exports.setupApp = setupApp;
  13764. exports.setupPage = setupPage;
  13765. exports.setupWindow = setupWindow;
  13766. exports.uni = uni$1;
  13767. exports.useI18n = useI18n;
  13768. exports.useTabBar = useTabBar;