vant.js 573 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615
  1. (function(global, factory) {
  2. typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.vant = {}, global.Vue));
  3. })(this, function(exports2, vue) {
  4. "use strict";
  5. function noop() {
  6. }
  7. const extend = Object.assign;
  8. const inBrowser$1 = typeof window !== "undefined";
  9. const isObject$1 = (val) => val !== null && typeof val === "object";
  10. const isDef = (val) => val !== void 0 && val !== null;
  11. const isFunction = (val) => typeof val === "function";
  12. const isPromise = (val) => isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
  13. const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
  14. function isMobile(value) {
  15. value = value.replace(/[^-|\d]/g, "");
  16. return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
  17. }
  18. const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
  19. const isIOS$1 = () => inBrowser$1 ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
  20. function get(object, path) {
  21. const keys = path.split(".");
  22. let result = object;
  23. keys.forEach((key) => {
  24. var _a;
  25. result = isObject$1(result) ? (_a = result[key]) != null ? _a : "" : "";
  26. });
  27. return result;
  28. }
  29. function pick(obj, keys, ignoreUndefined) {
  30. return keys.reduce(
  31. (ret, key) => {
  32. if (!ignoreUndefined || obj[key] !== void 0) {
  33. ret[key] = obj[key];
  34. }
  35. return ret;
  36. },
  37. {}
  38. );
  39. }
  40. const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
  41. const toArray = (item) => Array.isArray(item) ? item : [item];
  42. const flat = (arr) => arr.reduce((acc, val) => acc.concat(val), []);
  43. const unknownProp = null;
  44. const numericProp = [Number, String];
  45. const truthProp = {
  46. type: Boolean,
  47. default: true
  48. };
  49. const makeRequiredProp = (type) => ({
  50. type,
  51. required: true
  52. });
  53. const makeArrayProp = () => ({
  54. type: Array,
  55. default: () => []
  56. });
  57. const makeNumberProp = (defaultVal) => ({
  58. type: Number,
  59. default: defaultVal
  60. });
  61. const makeNumericProp = (defaultVal) => ({
  62. type: numericProp,
  63. default: defaultVal
  64. });
  65. const makeStringProp = (defaultVal) => ({
  66. type: String,
  67. default: defaultVal
  68. });
  69. var inBrowser = typeof window !== "undefined";
  70. function raf(fn) {
  71. return inBrowser ? requestAnimationFrame(fn) : -1;
  72. }
  73. function cancelRaf(id) {
  74. if (inBrowser) {
  75. cancelAnimationFrame(id);
  76. }
  77. }
  78. function doubleRaf(fn) {
  79. raf(() => raf(fn));
  80. }
  81. var isWindow = (val) => val === window;
  82. var makeDOMRect = (width2, height2) => ({
  83. top: 0,
  84. left: 0,
  85. right: width2,
  86. bottom: height2,
  87. width: width2,
  88. height: height2
  89. });
  90. var useRect = (elementOrRef) => {
  91. const element = vue.unref(elementOrRef);
  92. if (isWindow(element)) {
  93. const width2 = element.innerWidth;
  94. const height2 = element.innerHeight;
  95. return makeDOMRect(width2, height2);
  96. }
  97. if (element == null ? void 0 : element.getBoundingClientRect) {
  98. return element.getBoundingClientRect();
  99. }
  100. return makeDOMRect(0, 0);
  101. };
  102. function useToggle(defaultValue = false) {
  103. const state = vue.ref(defaultValue);
  104. const toggle = (value = !state.value) => {
  105. state.value = value;
  106. };
  107. return [state, toggle];
  108. }
  109. function useParent(key) {
  110. const parent = vue.inject(key, null);
  111. if (parent) {
  112. const instance2 = vue.getCurrentInstance();
  113. const { link, unlink, internalChildren } = parent;
  114. link(instance2);
  115. vue.onUnmounted(() => unlink(instance2));
  116. const index = vue.computed(() => internalChildren.indexOf(instance2));
  117. return {
  118. parent,
  119. index
  120. };
  121. }
  122. return {
  123. parent: null,
  124. index: vue.ref(-1)
  125. };
  126. }
  127. function flattenVNodes(children) {
  128. const result = [];
  129. const traverse = (children2) => {
  130. if (Array.isArray(children2)) {
  131. children2.forEach((child) => {
  132. var _a;
  133. if (vue.isVNode(child)) {
  134. result.push(child);
  135. if ((_a = child.component) == null ? void 0 : _a.subTree) {
  136. result.push(child.component.subTree);
  137. traverse(child.component.subTree.children);
  138. }
  139. if (child.children) {
  140. traverse(child.children);
  141. }
  142. }
  143. });
  144. }
  145. };
  146. traverse(children);
  147. return result;
  148. }
  149. var findVNodeIndex = (vnodes, vnode) => {
  150. const index = vnodes.indexOf(vnode);
  151. if (index === -1) {
  152. return vnodes.findIndex(
  153. (item) => vnode.key !== void 0 && vnode.key !== null && item.type === vnode.type && item.key === vnode.key
  154. );
  155. }
  156. return index;
  157. };
  158. function sortChildren(parent, publicChildren, internalChildren) {
  159. const vnodes = flattenVNodes(parent.subTree.children);
  160. internalChildren.sort(
  161. (a, b) => findVNodeIndex(vnodes, a.vnode) - findVNodeIndex(vnodes, b.vnode)
  162. );
  163. const orderedPublicChildren = internalChildren.map((item) => item.proxy);
  164. publicChildren.sort((a, b) => {
  165. const indexA = orderedPublicChildren.indexOf(a);
  166. const indexB = orderedPublicChildren.indexOf(b);
  167. return indexA - indexB;
  168. });
  169. }
  170. function useChildren(key) {
  171. const publicChildren = vue.reactive([]);
  172. const internalChildren = vue.reactive([]);
  173. const parent = vue.getCurrentInstance();
  174. const linkChildren = (value) => {
  175. const link = (child) => {
  176. if (child.proxy) {
  177. internalChildren.push(child);
  178. publicChildren.push(child.proxy);
  179. sortChildren(parent, publicChildren, internalChildren);
  180. }
  181. };
  182. const unlink = (child) => {
  183. const index = internalChildren.indexOf(child);
  184. publicChildren.splice(index, 1);
  185. internalChildren.splice(index, 1);
  186. };
  187. vue.provide(
  188. key,
  189. Object.assign(
  190. {
  191. link,
  192. unlink,
  193. children: publicChildren,
  194. internalChildren
  195. },
  196. value
  197. )
  198. );
  199. };
  200. return {
  201. children: publicChildren,
  202. linkChildren
  203. };
  204. }
  205. var SECOND = 1e3;
  206. var MINUTE = 60 * SECOND;
  207. var HOUR = 60 * MINUTE;
  208. var DAY = 24 * HOUR;
  209. function parseTime(time) {
  210. const days = Math.floor(time / DAY);
  211. const hours = Math.floor(time % DAY / HOUR);
  212. const minutes = Math.floor(time % HOUR / MINUTE);
  213. const seconds = Math.floor(time % MINUTE / SECOND);
  214. const milliseconds = Math.floor(time % SECOND);
  215. return {
  216. total: time,
  217. days,
  218. hours,
  219. minutes,
  220. seconds,
  221. milliseconds
  222. };
  223. }
  224. function isSameSecond(time1, time2) {
  225. return Math.floor(time1 / 1e3) === Math.floor(time2 / 1e3);
  226. }
  227. function useCountDown(options) {
  228. let rafId;
  229. let endTime;
  230. let counting;
  231. let deactivated;
  232. const remain = vue.ref(options.time);
  233. const current2 = vue.computed(() => parseTime(remain.value));
  234. const pause = () => {
  235. counting = false;
  236. cancelRaf(rafId);
  237. };
  238. const getCurrentRemain = () => Math.max(endTime - Date.now(), 0);
  239. const setRemain = (value) => {
  240. var _a, _b;
  241. remain.value = value;
  242. (_a = options.onChange) == null ? void 0 : _a.call(options, current2.value);
  243. if (value === 0) {
  244. pause();
  245. (_b = options.onFinish) == null ? void 0 : _b.call(options);
  246. }
  247. };
  248. const microTick = () => {
  249. rafId = raf(() => {
  250. if (counting) {
  251. setRemain(getCurrentRemain());
  252. if (remain.value > 0) {
  253. microTick();
  254. }
  255. }
  256. });
  257. };
  258. const macroTick = () => {
  259. rafId = raf(() => {
  260. if (counting) {
  261. const remainRemain = getCurrentRemain();
  262. if (!isSameSecond(remainRemain, remain.value) || remainRemain === 0) {
  263. setRemain(remainRemain);
  264. }
  265. if (remain.value > 0) {
  266. macroTick();
  267. }
  268. }
  269. });
  270. };
  271. const tick = () => {
  272. if (!inBrowser) {
  273. return;
  274. }
  275. if (options.millisecond) {
  276. microTick();
  277. } else {
  278. macroTick();
  279. }
  280. };
  281. const start2 = () => {
  282. if (!counting) {
  283. endTime = Date.now() + remain.value;
  284. counting = true;
  285. tick();
  286. }
  287. };
  288. const reset = (totalTime = options.time) => {
  289. pause();
  290. remain.value = totalTime;
  291. };
  292. vue.onBeforeUnmount(pause);
  293. vue.onActivated(() => {
  294. if (deactivated) {
  295. counting = true;
  296. deactivated = false;
  297. tick();
  298. }
  299. });
  300. vue.onDeactivated(() => {
  301. if (counting) {
  302. pause();
  303. deactivated = true;
  304. }
  305. });
  306. return {
  307. start: start2,
  308. pause,
  309. reset,
  310. current: current2
  311. };
  312. }
  313. function onMountedOrActivated(hook) {
  314. let mounted;
  315. vue.onMounted(() => {
  316. hook();
  317. vue.nextTick(() => {
  318. mounted = true;
  319. });
  320. });
  321. vue.onActivated(() => {
  322. if (mounted) {
  323. hook();
  324. }
  325. });
  326. }
  327. function useEventListener(type, listener, options = {}) {
  328. if (!inBrowser) {
  329. return;
  330. }
  331. const { target = window, passive: passive2 = false, capture = false } = options;
  332. let cleaned = false;
  333. let attached;
  334. const add = (target2) => {
  335. if (cleaned) {
  336. return;
  337. }
  338. const element = vue.unref(target2);
  339. if (element && !attached) {
  340. element.addEventListener(type, listener, {
  341. capture,
  342. passive: passive2
  343. });
  344. attached = true;
  345. }
  346. };
  347. const remove2 = (target2) => {
  348. if (cleaned) {
  349. return;
  350. }
  351. const element = vue.unref(target2);
  352. if (element && attached) {
  353. element.removeEventListener(type, listener, capture);
  354. attached = false;
  355. }
  356. };
  357. vue.onUnmounted(() => remove2(target));
  358. vue.onDeactivated(() => remove2(target));
  359. onMountedOrActivated(() => add(target));
  360. let stopWatch;
  361. if (vue.isRef(target)) {
  362. stopWatch = vue.watch(target, (val, oldVal) => {
  363. remove2(oldVal);
  364. add(val);
  365. });
  366. }
  367. return () => {
  368. stopWatch == null ? void 0 : stopWatch();
  369. remove2(target);
  370. cleaned = true;
  371. };
  372. }
  373. function useClickAway(target, listener, options = {}) {
  374. if (!inBrowser) {
  375. return;
  376. }
  377. const { eventName = "click" } = options;
  378. const onClick = (event) => {
  379. const targets = Array.isArray(target) ? target : [target];
  380. const isClickAway = targets.every((item) => {
  381. const element = vue.unref(item);
  382. return element && !element.contains(event.target);
  383. });
  384. if (isClickAway) {
  385. listener(event);
  386. }
  387. };
  388. useEventListener(eventName, onClick, { target: document });
  389. }
  390. var width;
  391. var height;
  392. function useWindowSize() {
  393. if (!width) {
  394. width = vue.ref(0);
  395. height = vue.ref(0);
  396. if (inBrowser) {
  397. const update = () => {
  398. width.value = window.innerWidth;
  399. height.value = window.innerHeight;
  400. };
  401. update();
  402. window.addEventListener("resize", update, { passive: true });
  403. window.addEventListener("orientationchange", update, { passive: true });
  404. }
  405. }
  406. return { width, height };
  407. }
  408. var overflowScrollReg = /scroll|auto|overlay/i;
  409. var defaultRoot = inBrowser ? window : void 0;
  410. function isElement$1(node) {
  411. const ELEMENT_NODE_TYPE = 1;
  412. return node.tagName !== "HTML" && node.tagName !== "BODY" && node.nodeType === ELEMENT_NODE_TYPE;
  413. }
  414. function getScrollParent$1(el, root = defaultRoot) {
  415. let node = el;
  416. while (node && node !== root && isElement$1(node)) {
  417. const { overflowY } = window.getComputedStyle(node);
  418. if (overflowScrollReg.test(overflowY)) {
  419. return node;
  420. }
  421. node = node.parentNode;
  422. }
  423. return root;
  424. }
  425. function useScrollParent(el, root = defaultRoot) {
  426. const scrollParent = vue.ref();
  427. vue.onMounted(() => {
  428. if (el.value) {
  429. scrollParent.value = getScrollParent$1(el.value, root);
  430. }
  431. });
  432. return scrollParent;
  433. }
  434. var visibility;
  435. function usePageVisibility() {
  436. if (!visibility) {
  437. visibility = vue.ref("visible");
  438. if (inBrowser) {
  439. const update = () => {
  440. visibility.value = document.hidden ? "hidden" : "visible";
  441. };
  442. update();
  443. window.addEventListener("visibilitychange", update);
  444. }
  445. }
  446. return visibility;
  447. }
  448. var CUSTOM_FIELD_INJECTION_KEY = Symbol("van-field");
  449. function useCustomFieldValue(customValue) {
  450. const field = vue.inject(CUSTOM_FIELD_INJECTION_KEY, null);
  451. if (field && !field.customValue.value) {
  452. field.customValue.value = customValue;
  453. vue.watch(customValue, () => {
  454. field.resetValidation();
  455. field.validateWithTrigger("onChange");
  456. });
  457. }
  458. }
  459. function getScrollTop(el) {
  460. const top2 = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
  461. return Math.max(top2, 0);
  462. }
  463. function setScrollTop(el, value) {
  464. if ("scrollTop" in el) {
  465. el.scrollTop = value;
  466. } else {
  467. el.scrollTo(el.scrollX, value);
  468. }
  469. }
  470. function getRootScrollTop() {
  471. return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
  472. }
  473. function setRootScrollTop(value) {
  474. setScrollTop(window, value);
  475. setScrollTop(document.body, value);
  476. }
  477. function getElementTop(el, scroller) {
  478. if (el === window) {
  479. return 0;
  480. }
  481. const scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
  482. return useRect(el).top + scrollTop;
  483. }
  484. const isIOS = isIOS$1();
  485. function resetScroll() {
  486. if (isIOS) {
  487. setRootScrollTop(getRootScrollTop());
  488. }
  489. }
  490. const stopPropagation = (event) => event.stopPropagation();
  491. function preventDefault(event, isStopPropagation) {
  492. if (typeof event.cancelable !== "boolean" || event.cancelable) {
  493. event.preventDefault();
  494. }
  495. if (isStopPropagation) {
  496. stopPropagation(event);
  497. }
  498. }
  499. function isHidden(elementRef) {
  500. const el = vue.unref(elementRef);
  501. if (!el) {
  502. return false;
  503. }
  504. const style = window.getComputedStyle(el);
  505. const hidden = style.display === "none";
  506. const parentHidden = el.offsetParent === null && style.position !== "fixed";
  507. return hidden || parentHidden;
  508. }
  509. const { width: windowWidth, height: windowHeight } = useWindowSize();
  510. function isContainingBlock(el) {
  511. const css = window.getComputedStyle(el);
  512. return css.transform !== "none" || css.perspective !== "none" || ["transform", "perspective", "filter"].some(
  513. (value) => (css.willChange || "").includes(value)
  514. );
  515. }
  516. function getContainingBlock$1(el) {
  517. let node = el.parentElement;
  518. while (node) {
  519. if (node && node.tagName !== "HTML" && node.tagName !== "BODY" && isContainingBlock(node)) {
  520. return node;
  521. }
  522. node = node.parentElement;
  523. }
  524. return null;
  525. }
  526. function addUnit(value) {
  527. if (isDef(value)) {
  528. return isNumeric(value) ? `${value}px` : String(value);
  529. }
  530. return void 0;
  531. }
  532. function getSizeStyle(originSize) {
  533. if (isDef(originSize)) {
  534. if (Array.isArray(originSize)) {
  535. return {
  536. width: addUnit(originSize[0]),
  537. height: addUnit(originSize[1])
  538. };
  539. }
  540. const size = addUnit(originSize);
  541. return {
  542. width: size,
  543. height: size
  544. };
  545. }
  546. }
  547. function getZIndexStyle(zIndex) {
  548. const style = {};
  549. if (zIndex !== void 0) {
  550. style.zIndex = +zIndex;
  551. }
  552. return style;
  553. }
  554. let rootFontSize;
  555. function getRootFontSize() {
  556. if (!rootFontSize) {
  557. const doc = document.documentElement;
  558. const fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
  559. rootFontSize = parseFloat(fontSize);
  560. }
  561. return rootFontSize;
  562. }
  563. function convertRem(value) {
  564. value = value.replace(/rem/g, "");
  565. return +value * getRootFontSize();
  566. }
  567. function convertVw(value) {
  568. value = value.replace(/vw/g, "");
  569. return +value * windowWidth.value / 100;
  570. }
  571. function convertVh(value) {
  572. value = value.replace(/vh/g, "");
  573. return +value * windowHeight.value / 100;
  574. }
  575. function unitToPx(value) {
  576. if (typeof value === "number") {
  577. return value;
  578. }
  579. if (inBrowser$1) {
  580. if (value.includes("rem")) {
  581. return convertRem(value);
  582. }
  583. if (value.includes("vw")) {
  584. return convertVw(value);
  585. }
  586. if (value.includes("vh")) {
  587. return convertVh(value);
  588. }
  589. }
  590. return parseFloat(value);
  591. }
  592. const camelizeRE = /-(\w)/g;
  593. const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase());
  594. const kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
  595. function padZero(num, targetLength = 2) {
  596. let str = num + "";
  597. while (str.length < targetLength) {
  598. str = "0" + str;
  599. }
  600. return str;
  601. }
  602. const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
  603. function trimExtraChar(value, char, regExp) {
  604. const index = value.indexOf(char);
  605. if (index === -1) {
  606. return value;
  607. }
  608. if (char === "-" && index !== 0) {
  609. return value.slice(0, index);
  610. }
  611. return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
  612. }
  613. function formatNumber(value, allowDot = true, allowMinus = true) {
  614. if (allowDot) {
  615. value = trimExtraChar(value, ".", /\./g);
  616. } else {
  617. value = value.split(".")[0];
  618. }
  619. if (allowMinus) {
  620. value = trimExtraChar(value, "-", /-/g);
  621. } else {
  622. value = value.replace(/-/, "");
  623. }
  624. const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
  625. return value.replace(regExp, "");
  626. }
  627. function addNumber(num1, num2) {
  628. const cardinal = 10 ** 10;
  629. return Math.round((num1 + num2) * cardinal) / cardinal;
  630. }
  631. const { hasOwnProperty } = Object.prototype;
  632. function assignKey(to, from, key) {
  633. const val = from[key];
  634. if (!isDef(val)) {
  635. return;
  636. }
  637. if (!hasOwnProperty.call(to, key) || !isObject$1(val)) {
  638. to[key] = val;
  639. } else {
  640. to[key] = deepAssign(Object(to[key]), val);
  641. }
  642. }
  643. function deepAssign(to, from) {
  644. Object.keys(from).forEach((key) => {
  645. assignKey(to, from, key);
  646. });
  647. return to;
  648. }
  649. var stdin_default$1W = {
  650. name: "姓名",
  651. tel: "电话",
  652. save: "保存",
  653. clear: "清空",
  654. cancel: "取消",
  655. confirm: "确认",
  656. delete: "删除",
  657. loading: "加载中...",
  658. noCoupon: "暂无优惠券",
  659. nameEmpty: "请填写姓名",
  660. addContact: "添加联系人",
  661. telInvalid: "请填写正确的电话",
  662. vanCalendar: {
  663. end: "结束",
  664. start: "开始",
  665. title: "日期选择",
  666. weekdays: ["日", "一", "二", "三", "四", "五", "六"],
  667. monthTitle: (year, month) => `${year}年${month}月`,
  668. rangePrompt: (maxRange) => `最多选择 ${maxRange} 天`
  669. },
  670. vanCascader: {
  671. select: "请选择"
  672. },
  673. vanPagination: {
  674. prev: "上一页",
  675. next: "下一页"
  676. },
  677. vanPullRefresh: {
  678. pulling: "下拉即可刷新...",
  679. loosing: "释放即可刷新..."
  680. },
  681. vanSubmitBar: {
  682. label: "合计:"
  683. },
  684. vanCoupon: {
  685. unlimited: "无门槛",
  686. discount: (discount) => `${discount}折`,
  687. condition: (condition) => `满${condition}元可用`
  688. },
  689. vanCouponCell: {
  690. title: "优惠券",
  691. count: (count) => `${count}张可用`
  692. },
  693. vanCouponList: {
  694. exchange: "兑换",
  695. close: "不使用",
  696. enable: "可用",
  697. disabled: "不可用",
  698. placeholder: "输入优惠码"
  699. },
  700. vanAddressEdit: {
  701. area: "地区",
  702. areaEmpty: "请选择地区",
  703. addressEmpty: "请填写详细地址",
  704. addressDetail: "详细地址",
  705. defaultAddress: "设为默认收货地址"
  706. },
  707. vanAddressList: {
  708. add: "新增地址"
  709. }
  710. };
  711. const lang = vue.ref("zh-CN");
  712. const messages = vue.reactive({
  713. "zh-CN": stdin_default$1W
  714. });
  715. const Locale = {
  716. messages() {
  717. return messages[lang.value];
  718. },
  719. use(newLang, newMessages) {
  720. lang.value = newLang;
  721. this.add({ [newLang]: newMessages });
  722. },
  723. add(newMessages = {}) {
  724. deepAssign(messages, newMessages);
  725. }
  726. };
  727. const useCurrentLang = () => lang;
  728. var stdin_default$1V = Locale;
  729. function createTranslate(name2) {
  730. const prefix = camelize(name2) + ".";
  731. return (path, ...args) => {
  732. const messages2 = stdin_default$1V.messages();
  733. const message = get(messages2, prefix + path) || get(messages2, path);
  734. return isFunction(message) ? message(...args) : message;
  735. };
  736. }
  737. function genBem(name2, mods) {
  738. if (!mods) {
  739. return "";
  740. }
  741. if (typeof mods === "string") {
  742. return ` ${name2}--${mods}`;
  743. }
  744. if (Array.isArray(mods)) {
  745. return mods.reduce(
  746. (ret, item) => ret + genBem(name2, item),
  747. ""
  748. );
  749. }
  750. return Object.keys(mods).reduce(
  751. (ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
  752. ""
  753. );
  754. }
  755. function createBEM(name2) {
  756. return (el, mods) => {
  757. if (el && typeof el !== "string") {
  758. mods = el;
  759. el = "";
  760. }
  761. el = el ? `${name2}__${el}` : name2;
  762. return `${el}${genBem(el, mods)}`;
  763. };
  764. }
  765. function createNamespace(name2) {
  766. const prefixedName = `van-${name2}`;
  767. return [
  768. prefixedName,
  769. createBEM(prefixedName),
  770. createTranslate(prefixedName)
  771. ];
  772. }
  773. const BORDER = "van-hairline";
  774. const BORDER_TOP = `${BORDER}--top`;
  775. const BORDER_LEFT = `${BORDER}--left`;
  776. const BORDER_RIGHT = `${BORDER}--right`;
  777. const BORDER_BOTTOM = `${BORDER}--bottom`;
  778. const BORDER_SURROUND = `${BORDER}--surround`;
  779. const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
  780. const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
  781. const HAPTICS_FEEDBACK = "van-haptics-feedback";
  782. const FORM_KEY = Symbol("van-form");
  783. const LONG_PRESS_START_TIME = 500;
  784. const TAP_OFFSET = 5;
  785. function callInterceptor(interceptor, {
  786. args = [],
  787. done,
  788. canceled,
  789. error
  790. }) {
  791. if (interceptor) {
  792. const returnVal = interceptor.apply(null, args);
  793. if (isPromise(returnVal)) {
  794. returnVal.then((value) => {
  795. if (value) {
  796. done();
  797. } else if (canceled) {
  798. canceled();
  799. }
  800. }).catch(error || noop);
  801. } else if (returnVal) {
  802. done();
  803. } else if (canceled) {
  804. canceled();
  805. }
  806. } else {
  807. done();
  808. }
  809. }
  810. function withInstall(options) {
  811. options.install = (app) => {
  812. const { name: name2 } = options;
  813. if (name2) {
  814. app.component(name2, options);
  815. app.component(camelize(`-${name2}`), options);
  816. }
  817. };
  818. return options;
  819. }
  820. function closest(arr, target) {
  821. return arr.reduce(
  822. (pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur
  823. );
  824. }
  825. const POPUP_TOGGLE_KEY = Symbol();
  826. function onPopupReopen(callback) {
  827. const popupToggleStatus = vue.inject(POPUP_TOGGLE_KEY, null);
  828. if (popupToggleStatus) {
  829. vue.watch(popupToggleStatus, (show) => {
  830. if (show) {
  831. callback();
  832. }
  833. });
  834. }
  835. }
  836. const useHeight = (element, withSafeArea) => {
  837. const height2 = vue.ref();
  838. const setHeight = () => {
  839. height2.value = useRect(element).height;
  840. };
  841. vue.onMounted(() => {
  842. vue.nextTick(setHeight);
  843. if (withSafeArea) {
  844. for (let i = 1; i <= 3; i++) {
  845. setTimeout(setHeight, 100 * i);
  846. }
  847. }
  848. });
  849. onPopupReopen(() => vue.nextTick(setHeight));
  850. vue.watch([windowWidth, windowHeight], setHeight);
  851. return height2;
  852. };
  853. function usePlaceholder(contentRef, bem2) {
  854. const height2 = useHeight(contentRef, true);
  855. return (renderContent) => vue.createVNode("div", {
  856. "class": bem2("placeholder"),
  857. "style": {
  858. height: height2.value ? `${height2.value}px` : void 0
  859. }
  860. }, [renderContent()]);
  861. }
  862. const [name$1K, bem$1F] = createNamespace("action-bar");
  863. const ACTION_BAR_KEY = Symbol(name$1K);
  864. const actionBarProps = {
  865. placeholder: Boolean,
  866. safeAreaInsetBottom: truthProp
  867. };
  868. var stdin_default$1U = vue.defineComponent({
  869. name: name$1K,
  870. props: actionBarProps,
  871. setup(props2, {
  872. slots
  873. }) {
  874. const root = vue.ref();
  875. const renderPlaceholder = usePlaceholder(root, bem$1F);
  876. const {
  877. linkChildren
  878. } = useChildren(ACTION_BAR_KEY);
  879. linkChildren();
  880. const renderActionBar = () => {
  881. var _a;
  882. return vue.createVNode("div", {
  883. "ref": root,
  884. "class": [bem$1F(), {
  885. "van-safe-area-bottom": props2.safeAreaInsetBottom
  886. }]
  887. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  888. };
  889. return () => {
  890. if (props2.placeholder) {
  891. return renderPlaceholder(renderActionBar);
  892. }
  893. return renderActionBar();
  894. };
  895. }
  896. });
  897. const ActionBar = withInstall(stdin_default$1U);
  898. function useExpose(apis) {
  899. const instance2 = vue.getCurrentInstance();
  900. if (instance2) {
  901. extend(instance2.proxy, apis);
  902. }
  903. }
  904. const routeProps = {
  905. to: [String, Object],
  906. url: String,
  907. replace: Boolean
  908. };
  909. function route({
  910. to,
  911. url,
  912. replace,
  913. $router: router
  914. }) {
  915. if (to && router) {
  916. router[replace ? "replace" : "push"](to);
  917. } else if (url) {
  918. replace ? location.replace(url) : location.href = url;
  919. }
  920. }
  921. function useRoute() {
  922. const vm = vue.getCurrentInstance().proxy;
  923. return () => route(vm);
  924. }
  925. const [name$1J, bem$1E] = createNamespace("badge");
  926. const badgeProps = {
  927. dot: Boolean,
  928. max: numericProp,
  929. tag: makeStringProp("div"),
  930. color: String,
  931. offset: Array,
  932. content: numericProp,
  933. showZero: truthProp,
  934. position: makeStringProp("top-right")
  935. };
  936. var stdin_default$1T = vue.defineComponent({
  937. name: name$1J,
  938. props: badgeProps,
  939. setup(props2, {
  940. slots
  941. }) {
  942. const hasContent = () => {
  943. if (slots.content) {
  944. return true;
  945. }
  946. const {
  947. content,
  948. showZero
  949. } = props2;
  950. return isDef(content) && content !== "" && (showZero || content !== 0 && content !== "0");
  951. };
  952. const renderContent = () => {
  953. const {
  954. dot,
  955. max,
  956. content
  957. } = props2;
  958. if (!dot && hasContent()) {
  959. if (slots.content) {
  960. return slots.content();
  961. }
  962. if (isDef(max) && isNumeric(content) && +content > +max) {
  963. return `${max}+`;
  964. }
  965. return content;
  966. }
  967. };
  968. const getOffsetWithMinusString = (val) => val.startsWith("-") ? val.replace("-", "") : `-${val}`;
  969. const style = vue.computed(() => {
  970. const style2 = {
  971. background: props2.color
  972. };
  973. if (props2.offset) {
  974. const [x, y] = props2.offset;
  975. const {
  976. position
  977. } = props2;
  978. const [offsetY, offsetX] = position.split("-");
  979. if (slots.default) {
  980. if (typeof y === "number") {
  981. style2[offsetY] = addUnit(offsetY === "top" ? y : -y);
  982. } else {
  983. style2[offsetY] = offsetY === "top" ? addUnit(y) : getOffsetWithMinusString(y);
  984. }
  985. if (typeof x === "number") {
  986. style2[offsetX] = addUnit(offsetX === "left" ? x : -x);
  987. } else {
  988. style2[offsetX] = offsetX === "left" ? addUnit(x) : getOffsetWithMinusString(x);
  989. }
  990. } else {
  991. style2.marginTop = addUnit(y);
  992. style2.marginLeft = addUnit(x);
  993. }
  994. }
  995. return style2;
  996. });
  997. const renderBadge = () => {
  998. if (hasContent() || props2.dot) {
  999. return vue.createVNode("div", {
  1000. "class": bem$1E([props2.position, {
  1001. dot: props2.dot,
  1002. fixed: !!slots.default
  1003. }]),
  1004. "style": style.value
  1005. }, [renderContent()]);
  1006. }
  1007. };
  1008. return () => {
  1009. if (slots.default) {
  1010. const {
  1011. tag
  1012. } = props2;
  1013. return vue.createVNode(tag, {
  1014. "class": bem$1E("wrapper")
  1015. }, {
  1016. default: () => [slots.default(), renderBadge()]
  1017. });
  1018. }
  1019. return renderBadge();
  1020. };
  1021. }
  1022. });
  1023. const Badge = withInstall(stdin_default$1T);
  1024. let globalZIndex = 2e3;
  1025. const useGlobalZIndex = () => ++globalZIndex;
  1026. const setGlobalZIndex = (val) => {
  1027. globalZIndex = val;
  1028. };
  1029. const [name$1I, bem$1D] = createNamespace("config-provider");
  1030. const CONFIG_PROVIDER_KEY = Symbol(name$1I);
  1031. const configProviderProps = {
  1032. tag: makeStringProp("div"),
  1033. theme: makeStringProp("light"),
  1034. zIndex: Number,
  1035. themeVars: Object,
  1036. themeVarsDark: Object,
  1037. themeVarsLight: Object,
  1038. themeVarsScope: makeStringProp("local"),
  1039. iconPrefix: String
  1040. };
  1041. function insertDash(str) {
  1042. return str.replace(/([a-zA-Z])(\d)/g, "$1-$2");
  1043. }
  1044. function mapThemeVarsToCSSVars(themeVars) {
  1045. const cssVars = {};
  1046. Object.keys(themeVars).forEach((key) => {
  1047. const formattedKey = insertDash(kebabCase(key));
  1048. cssVars[`--van-${formattedKey}`] = themeVars[key];
  1049. });
  1050. return cssVars;
  1051. }
  1052. function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
  1053. Object.keys(newStyle).forEach((key) => {
  1054. if (newStyle[key] !== oldStyle[key]) {
  1055. document.documentElement.style.setProperty(key, newStyle[key]);
  1056. }
  1057. });
  1058. Object.keys(oldStyle).forEach((key) => {
  1059. if (!newStyle[key]) {
  1060. document.documentElement.style.removeProperty(key);
  1061. }
  1062. });
  1063. }
  1064. var stdin_default$1S = vue.defineComponent({
  1065. name: name$1I,
  1066. props: configProviderProps,
  1067. setup(props2, {
  1068. slots
  1069. }) {
  1070. const style = vue.computed(() => mapThemeVarsToCSSVars(extend({}, props2.themeVars, props2.theme === "dark" ? props2.themeVarsDark : props2.themeVarsLight)));
  1071. if (inBrowser$1) {
  1072. const addTheme = () => {
  1073. document.documentElement.classList.add(`van-theme-${props2.theme}`);
  1074. };
  1075. const removeTheme = (theme = props2.theme) => {
  1076. document.documentElement.classList.remove(`van-theme-${theme}`);
  1077. };
  1078. vue.watch(() => props2.theme, (newVal, oldVal) => {
  1079. if (oldVal) {
  1080. removeTheme(oldVal);
  1081. }
  1082. addTheme();
  1083. }, {
  1084. immediate: true
  1085. });
  1086. vue.onActivated(addTheme);
  1087. vue.onDeactivated(removeTheme);
  1088. vue.onBeforeUnmount(removeTheme);
  1089. vue.watch(style, (newStyle, oldStyle) => {
  1090. if (props2.themeVarsScope === "global") {
  1091. syncThemeVarsOnRoot(newStyle, oldStyle);
  1092. }
  1093. });
  1094. vue.watch(() => props2.themeVarsScope, (newScope, oldScope) => {
  1095. if (oldScope === "global") {
  1096. syncThemeVarsOnRoot({}, style.value);
  1097. }
  1098. if (newScope === "global") {
  1099. syncThemeVarsOnRoot(style.value, {});
  1100. }
  1101. });
  1102. if (props2.themeVarsScope === "global") {
  1103. syncThemeVarsOnRoot(style.value, {});
  1104. }
  1105. }
  1106. vue.provide(CONFIG_PROVIDER_KEY, props2);
  1107. vue.watchEffect(() => {
  1108. if (props2.zIndex !== void 0) {
  1109. setGlobalZIndex(props2.zIndex);
  1110. }
  1111. });
  1112. return () => vue.createVNode(props2.tag, {
  1113. "class": bem$1D(),
  1114. "style": props2.themeVarsScope === "local" ? style.value : void 0
  1115. }, {
  1116. default: () => {
  1117. var _a;
  1118. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  1119. }
  1120. });
  1121. }
  1122. });
  1123. const [name$1H, bem$1C] = createNamespace("icon");
  1124. const isImage$1 = (name2) => name2 == null ? void 0 : name2.includes("/");
  1125. const iconProps = {
  1126. dot: Boolean,
  1127. tag: makeStringProp("i"),
  1128. name: String,
  1129. size: numericProp,
  1130. badge: numericProp,
  1131. color: String,
  1132. badgeProps: Object,
  1133. classPrefix: String
  1134. };
  1135. var stdin_default$1R = vue.defineComponent({
  1136. name: name$1H,
  1137. props: iconProps,
  1138. setup(props2, {
  1139. slots
  1140. }) {
  1141. const config = vue.inject(CONFIG_PROVIDER_KEY, null);
  1142. const classPrefix = vue.computed(() => props2.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem$1C());
  1143. return () => {
  1144. const {
  1145. tag,
  1146. dot,
  1147. name: name2,
  1148. size,
  1149. badge,
  1150. color
  1151. } = props2;
  1152. const isImageIcon = isImage$1(name2);
  1153. return vue.createVNode(Badge, vue.mergeProps({
  1154. "dot": dot,
  1155. "tag": tag,
  1156. "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`],
  1157. "style": {
  1158. color,
  1159. fontSize: addUnit(size)
  1160. },
  1161. "content": badge
  1162. }, props2.badgeProps), {
  1163. default: () => {
  1164. var _a;
  1165. return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && vue.createVNode("img", {
  1166. "class": bem$1C("image"),
  1167. "src": name2
  1168. }, null)];
  1169. }
  1170. });
  1171. };
  1172. }
  1173. });
  1174. const Icon = withInstall(stdin_default$1R);
  1175. var stdin_default$1Q = Icon;
  1176. const [name$1G, bem$1B] = createNamespace("loading");
  1177. const SpinIcon = Array(12).fill(null).map((_, index) => vue.createVNode("i", {
  1178. "class": bem$1B("line", String(index + 1))
  1179. }, null));
  1180. const CircularIcon = vue.createVNode("svg", {
  1181. "class": bem$1B("circular"),
  1182. "viewBox": "25 25 50 50"
  1183. }, [vue.createVNode("circle", {
  1184. "cx": "50",
  1185. "cy": "50",
  1186. "r": "20",
  1187. "fill": "none"
  1188. }, null)]);
  1189. const loadingProps = {
  1190. size: numericProp,
  1191. type: makeStringProp("circular"),
  1192. color: String,
  1193. vertical: Boolean,
  1194. textSize: numericProp,
  1195. textColor: String
  1196. };
  1197. var stdin_default$1P = vue.defineComponent({
  1198. name: name$1G,
  1199. props: loadingProps,
  1200. setup(props2, {
  1201. slots
  1202. }) {
  1203. const spinnerStyle = vue.computed(() => extend({
  1204. color: props2.color
  1205. }, getSizeStyle(props2.size)));
  1206. const renderIcon = () => {
  1207. const DefaultIcon = props2.type === "spinner" ? SpinIcon : CircularIcon;
  1208. return vue.createVNode("span", {
  1209. "class": bem$1B("spinner", props2.type),
  1210. "style": spinnerStyle.value
  1211. }, [slots.icon ? slots.icon() : DefaultIcon]);
  1212. };
  1213. const renderText = () => {
  1214. var _a;
  1215. if (slots.default) {
  1216. return vue.createVNode("span", {
  1217. "class": bem$1B("text"),
  1218. "style": {
  1219. fontSize: addUnit(props2.textSize),
  1220. color: (_a = props2.textColor) != null ? _a : props2.color
  1221. }
  1222. }, [slots.default()]);
  1223. }
  1224. };
  1225. return () => {
  1226. const {
  1227. type,
  1228. vertical
  1229. } = props2;
  1230. return vue.createVNode("div", {
  1231. "class": bem$1B([type, {
  1232. vertical
  1233. }]),
  1234. "aria-live": "polite",
  1235. "aria-busy": true
  1236. }, [renderIcon(), renderText()]);
  1237. };
  1238. }
  1239. });
  1240. const Loading = withInstall(stdin_default$1P);
  1241. const [name$1F, bem$1A] = createNamespace("button");
  1242. const buttonProps = extend({}, routeProps, {
  1243. tag: makeStringProp("button"),
  1244. text: String,
  1245. icon: String,
  1246. type: makeStringProp("default"),
  1247. size: makeStringProp("normal"),
  1248. color: String,
  1249. block: Boolean,
  1250. plain: Boolean,
  1251. round: Boolean,
  1252. square: Boolean,
  1253. loading: Boolean,
  1254. hairline: Boolean,
  1255. disabled: Boolean,
  1256. iconPrefix: String,
  1257. nativeType: makeStringProp("button"),
  1258. loadingSize: numericProp,
  1259. loadingText: String,
  1260. loadingType: String,
  1261. iconPosition: makeStringProp("left")
  1262. });
  1263. var stdin_default$1O = vue.defineComponent({
  1264. name: name$1F,
  1265. props: buttonProps,
  1266. emits: ["click"],
  1267. setup(props2, {
  1268. emit,
  1269. slots
  1270. }) {
  1271. const route2 = useRoute();
  1272. const renderLoadingIcon = () => {
  1273. if (slots.loading) {
  1274. return slots.loading();
  1275. }
  1276. return vue.createVNode(Loading, {
  1277. "size": props2.loadingSize,
  1278. "type": props2.loadingType,
  1279. "class": bem$1A("loading")
  1280. }, null);
  1281. };
  1282. const renderIcon = () => {
  1283. if (props2.loading) {
  1284. return renderLoadingIcon();
  1285. }
  1286. if (slots.icon) {
  1287. return vue.createVNode("div", {
  1288. "class": bem$1A("icon")
  1289. }, [slots.icon()]);
  1290. }
  1291. if (props2.icon) {
  1292. return vue.createVNode(Icon, {
  1293. "name": props2.icon,
  1294. "class": bem$1A("icon"),
  1295. "classPrefix": props2.iconPrefix
  1296. }, null);
  1297. }
  1298. };
  1299. const renderText = () => {
  1300. let text;
  1301. if (props2.loading) {
  1302. text = props2.loadingText;
  1303. } else {
  1304. text = slots.default ? slots.default() : props2.text;
  1305. }
  1306. if (text) {
  1307. return vue.createVNode("span", {
  1308. "class": bem$1A("text")
  1309. }, [text]);
  1310. }
  1311. };
  1312. const getStyle = () => {
  1313. const {
  1314. color,
  1315. plain
  1316. } = props2;
  1317. if (color) {
  1318. const style = {
  1319. color: plain ? color : "white"
  1320. };
  1321. if (!plain) {
  1322. style.background = color;
  1323. }
  1324. if (color.includes("gradient")) {
  1325. style.border = 0;
  1326. } else {
  1327. style.borderColor = color;
  1328. }
  1329. return style;
  1330. }
  1331. };
  1332. const onClick = (event) => {
  1333. if (props2.loading) {
  1334. preventDefault(event);
  1335. } else if (!props2.disabled) {
  1336. emit("click", event);
  1337. route2();
  1338. }
  1339. };
  1340. return () => {
  1341. const {
  1342. tag,
  1343. type,
  1344. size,
  1345. block,
  1346. round: round2,
  1347. plain,
  1348. square,
  1349. loading,
  1350. disabled,
  1351. hairline,
  1352. nativeType,
  1353. iconPosition
  1354. } = props2;
  1355. const classes = [bem$1A([type, size, {
  1356. plain,
  1357. block,
  1358. round: round2,
  1359. square,
  1360. loading,
  1361. disabled,
  1362. hairline
  1363. }]), {
  1364. [BORDER_SURROUND]: hairline
  1365. }];
  1366. return vue.createVNode(tag, {
  1367. "type": nativeType,
  1368. "class": classes,
  1369. "style": getStyle(),
  1370. "disabled": disabled,
  1371. "onClick": onClick
  1372. }, {
  1373. default: () => [vue.createVNode("div", {
  1374. "class": bem$1A("content")
  1375. }, [iconPosition === "left" && renderIcon(), renderText(), iconPosition === "right" && renderIcon()])]
  1376. });
  1377. };
  1378. }
  1379. });
  1380. const Button = withInstall(stdin_default$1O);
  1381. const [name$1E, bem$1z] = createNamespace("action-bar-button");
  1382. const actionBarButtonProps = extend({}, routeProps, {
  1383. type: String,
  1384. text: String,
  1385. icon: String,
  1386. color: String,
  1387. loading: Boolean,
  1388. disabled: Boolean
  1389. });
  1390. var stdin_default$1N = vue.defineComponent({
  1391. name: name$1E,
  1392. props: actionBarButtonProps,
  1393. setup(props2, {
  1394. slots
  1395. }) {
  1396. const route2 = useRoute();
  1397. const {
  1398. parent,
  1399. index
  1400. } = useParent(ACTION_BAR_KEY);
  1401. const isFirst = vue.computed(() => {
  1402. if (parent) {
  1403. const prev = parent.children[index.value - 1];
  1404. return !(prev && "isButton" in prev);
  1405. }
  1406. });
  1407. const isLast = vue.computed(() => {
  1408. if (parent) {
  1409. const next = parent.children[index.value + 1];
  1410. return !(next && "isButton" in next);
  1411. }
  1412. });
  1413. useExpose({
  1414. isButton: true
  1415. });
  1416. return () => {
  1417. const {
  1418. type,
  1419. icon,
  1420. text,
  1421. color,
  1422. loading,
  1423. disabled
  1424. } = props2;
  1425. return vue.createVNode(Button, {
  1426. "class": bem$1z([type, {
  1427. last: isLast.value,
  1428. first: isFirst.value
  1429. }]),
  1430. "size": "large",
  1431. "type": type,
  1432. "icon": icon,
  1433. "color": color,
  1434. "loading": loading,
  1435. "disabled": disabled,
  1436. "onClick": route2
  1437. }, {
  1438. default: () => [slots.default ? slots.default() : text]
  1439. });
  1440. };
  1441. }
  1442. });
  1443. const ActionBarButton = withInstall(stdin_default$1N);
  1444. const [name$1D, bem$1y] = createNamespace("action-bar-icon");
  1445. const actionBarIconProps = extend({}, routeProps, {
  1446. dot: Boolean,
  1447. text: String,
  1448. icon: String,
  1449. color: String,
  1450. badge: numericProp,
  1451. iconClass: unknownProp,
  1452. badgeProps: Object,
  1453. iconPrefix: String
  1454. });
  1455. var stdin_default$1M = vue.defineComponent({
  1456. name: name$1D,
  1457. props: actionBarIconProps,
  1458. setup(props2, {
  1459. slots
  1460. }) {
  1461. const route2 = useRoute();
  1462. useParent(ACTION_BAR_KEY);
  1463. const renderIcon = () => {
  1464. const {
  1465. dot,
  1466. badge,
  1467. icon,
  1468. color,
  1469. iconClass,
  1470. badgeProps: badgeProps2,
  1471. iconPrefix
  1472. } = props2;
  1473. if (slots.icon) {
  1474. return vue.createVNode(Badge, vue.mergeProps({
  1475. "dot": dot,
  1476. "class": bem$1y("icon"),
  1477. "content": badge
  1478. }, badgeProps2), {
  1479. default: slots.icon
  1480. });
  1481. }
  1482. return vue.createVNode(Icon, {
  1483. "tag": "div",
  1484. "dot": dot,
  1485. "name": icon,
  1486. "badge": badge,
  1487. "color": color,
  1488. "class": [bem$1y("icon"), iconClass],
  1489. "badgeProps": badgeProps2,
  1490. "classPrefix": iconPrefix
  1491. }, null);
  1492. };
  1493. return () => vue.createVNode("div", {
  1494. "role": "button",
  1495. "class": bem$1y(),
  1496. "tabindex": 0,
  1497. "onClick": route2
  1498. }, [renderIcon(), slots.default ? slots.default() : props2.text]);
  1499. }
  1500. });
  1501. const ActionBarIcon = withInstall(stdin_default$1M);
  1502. const popupSharedProps = {
  1503. // whether to show popup
  1504. show: Boolean,
  1505. // z-index
  1506. zIndex: numericProp,
  1507. // whether to show overlay
  1508. overlay: truthProp,
  1509. // transition duration
  1510. duration: numericProp,
  1511. // teleport
  1512. teleport: [String, Object],
  1513. // prevent body scroll
  1514. lockScroll: truthProp,
  1515. // whether to lazy render
  1516. lazyRender: truthProp,
  1517. // callback function before close
  1518. beforeClose: Function,
  1519. // overlay custom style
  1520. overlayStyle: Object,
  1521. // overlay custom class name
  1522. overlayClass: unknownProp,
  1523. // Initial rendering animation
  1524. transitionAppear: Boolean,
  1525. // whether to close popup when overlay is clicked
  1526. closeOnClickOverlay: truthProp
  1527. };
  1528. const popupSharedPropKeys = Object.keys(
  1529. popupSharedProps
  1530. );
  1531. function getDirection(x, y) {
  1532. if (x > y) {
  1533. return "horizontal";
  1534. }
  1535. if (y > x) {
  1536. return "vertical";
  1537. }
  1538. return "";
  1539. }
  1540. function useTouch() {
  1541. const startX = vue.ref(0);
  1542. const startY = vue.ref(0);
  1543. const deltaX = vue.ref(0);
  1544. const deltaY = vue.ref(0);
  1545. const offsetX = vue.ref(0);
  1546. const offsetY = vue.ref(0);
  1547. const direction = vue.ref("");
  1548. const isTap = vue.ref(true);
  1549. const isVertical = () => direction.value === "vertical";
  1550. const isHorizontal = () => direction.value === "horizontal";
  1551. const reset = () => {
  1552. deltaX.value = 0;
  1553. deltaY.value = 0;
  1554. offsetX.value = 0;
  1555. offsetY.value = 0;
  1556. direction.value = "";
  1557. isTap.value = true;
  1558. };
  1559. const start2 = (event) => {
  1560. reset();
  1561. startX.value = event.touches[0].clientX;
  1562. startY.value = event.touches[0].clientY;
  1563. };
  1564. const move = (event) => {
  1565. const touch = event.touches[0];
  1566. deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
  1567. deltaY.value = touch.clientY - startY.value;
  1568. offsetX.value = Math.abs(deltaX.value);
  1569. offsetY.value = Math.abs(deltaY.value);
  1570. const LOCK_DIRECTION_DISTANCE = 10;
  1571. if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
  1572. direction.value = getDirection(offsetX.value, offsetY.value);
  1573. }
  1574. if (isTap.value && (offsetX.value > TAP_OFFSET || offsetY.value > TAP_OFFSET)) {
  1575. isTap.value = false;
  1576. }
  1577. };
  1578. return {
  1579. move,
  1580. start: start2,
  1581. reset,
  1582. startX,
  1583. startY,
  1584. deltaX,
  1585. deltaY,
  1586. offsetX,
  1587. offsetY,
  1588. direction,
  1589. isVertical,
  1590. isHorizontal,
  1591. isTap
  1592. };
  1593. }
  1594. let totalLockCount = 0;
  1595. const BODY_LOCK_CLASS = "van-overflow-hidden";
  1596. function useLockScroll(rootRef, shouldLock) {
  1597. const touch = useTouch();
  1598. const DIRECTION_UP = "01";
  1599. const DIRECTION_DOWN = "10";
  1600. const onTouchMove = (event) => {
  1601. touch.move(event);
  1602. const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
  1603. const el = getScrollParent$1(
  1604. event.target,
  1605. rootRef.value
  1606. );
  1607. const { scrollHeight, offsetHeight, scrollTop } = el;
  1608. let status = "11";
  1609. if (scrollTop === 0) {
  1610. status = offsetHeight >= scrollHeight ? "00" : "01";
  1611. } else if (scrollTop + offsetHeight >= scrollHeight) {
  1612. status = "10";
  1613. }
  1614. if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
  1615. preventDefault(event, true);
  1616. }
  1617. };
  1618. const lock = () => {
  1619. document.addEventListener("touchstart", touch.start);
  1620. document.addEventListener("touchmove", onTouchMove, { passive: false });
  1621. if (!totalLockCount) {
  1622. document.body.classList.add(BODY_LOCK_CLASS);
  1623. }
  1624. totalLockCount++;
  1625. };
  1626. const unlock = () => {
  1627. if (totalLockCount) {
  1628. document.removeEventListener("touchstart", touch.start);
  1629. document.removeEventListener("touchmove", onTouchMove);
  1630. totalLockCount--;
  1631. if (!totalLockCount) {
  1632. document.body.classList.remove(BODY_LOCK_CLASS);
  1633. }
  1634. }
  1635. };
  1636. const init = () => shouldLock() && lock();
  1637. const destroy = () => shouldLock() && unlock();
  1638. onMountedOrActivated(init);
  1639. vue.onDeactivated(destroy);
  1640. vue.onBeforeUnmount(destroy);
  1641. vue.watch(shouldLock, (value) => {
  1642. value ? lock() : unlock();
  1643. });
  1644. }
  1645. function useLazyRender(show) {
  1646. const inited = vue.ref(false);
  1647. vue.watch(
  1648. show,
  1649. (value) => {
  1650. if (value) {
  1651. inited.value = value;
  1652. }
  1653. },
  1654. { immediate: true }
  1655. );
  1656. return (render) => () => inited.value ? render() : null;
  1657. }
  1658. const useScopeId = () => {
  1659. var _a;
  1660. const { scopeId } = ((_a = vue.getCurrentInstance()) == null ? void 0 : _a.vnode) || {};
  1661. return scopeId ? { [scopeId]: "" } : null;
  1662. };
  1663. const [name$1C, bem$1x] = createNamespace("overlay");
  1664. const overlayProps = {
  1665. show: Boolean,
  1666. zIndex: numericProp,
  1667. duration: numericProp,
  1668. className: unknownProp,
  1669. lockScroll: truthProp,
  1670. lazyRender: truthProp,
  1671. customStyle: Object,
  1672. teleport: [String, Object]
  1673. };
  1674. var stdin_default$1L = vue.defineComponent({
  1675. name: name$1C,
  1676. props: overlayProps,
  1677. setup(props2, {
  1678. slots
  1679. }) {
  1680. const root = vue.ref();
  1681. const lazyRender = useLazyRender(() => props2.show || !props2.lazyRender);
  1682. const onTouchMove = (event) => {
  1683. if (props2.lockScroll) {
  1684. preventDefault(event, true);
  1685. }
  1686. };
  1687. const renderOverlay = lazyRender(() => {
  1688. var _a;
  1689. const style = extend(getZIndexStyle(props2.zIndex), props2.customStyle);
  1690. if (isDef(props2.duration)) {
  1691. style.animationDuration = `${props2.duration}s`;
  1692. }
  1693. return vue.withDirectives(vue.createVNode("div", {
  1694. "ref": root,
  1695. "style": style,
  1696. "class": [bem$1x(), props2.className]
  1697. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vue.vShow, props2.show]]);
  1698. });
  1699. useEventListener("touchmove", onTouchMove, {
  1700. target: root
  1701. });
  1702. return () => {
  1703. const Content = vue.createVNode(vue.Transition, {
  1704. "name": "van-fade",
  1705. "appear": true
  1706. }, {
  1707. default: renderOverlay
  1708. });
  1709. if (props2.teleport) {
  1710. return vue.createVNode(vue.Teleport, {
  1711. "to": props2.teleport
  1712. }, {
  1713. default: () => [Content]
  1714. });
  1715. }
  1716. return Content;
  1717. };
  1718. }
  1719. });
  1720. const Overlay = withInstall(stdin_default$1L);
  1721. const popupProps$2 = extend({}, popupSharedProps, {
  1722. round: Boolean,
  1723. position: makeStringProp("center"),
  1724. closeIcon: makeStringProp("cross"),
  1725. closeable: Boolean,
  1726. transition: String,
  1727. iconPrefix: String,
  1728. closeOnPopstate: Boolean,
  1729. closeIconPosition: makeStringProp("top-right"),
  1730. safeAreaInsetTop: Boolean,
  1731. safeAreaInsetBottom: Boolean
  1732. });
  1733. const [name$1B, bem$1w] = createNamespace("popup");
  1734. var stdin_default$1K = vue.defineComponent({
  1735. name: name$1B,
  1736. inheritAttrs: false,
  1737. props: popupProps$2,
  1738. emits: ["open", "close", "opened", "closed", "keydown", "update:show", "clickOverlay", "clickCloseIcon"],
  1739. setup(props2, {
  1740. emit,
  1741. attrs,
  1742. slots
  1743. }) {
  1744. let opened;
  1745. let shouldReopen;
  1746. const zIndex = vue.ref();
  1747. const popupRef = vue.ref();
  1748. const lazyRender = useLazyRender(() => props2.show || !props2.lazyRender);
  1749. const style = vue.computed(() => {
  1750. const style2 = {
  1751. zIndex: zIndex.value
  1752. };
  1753. if (isDef(props2.duration)) {
  1754. const key = props2.position === "center" ? "animationDuration" : "transitionDuration";
  1755. style2[key] = `${props2.duration}s`;
  1756. }
  1757. return style2;
  1758. });
  1759. const open = () => {
  1760. if (!opened) {
  1761. opened = true;
  1762. zIndex.value = props2.zIndex !== void 0 ? +props2.zIndex : useGlobalZIndex();
  1763. emit("open");
  1764. }
  1765. };
  1766. const close = () => {
  1767. if (opened) {
  1768. callInterceptor(props2.beforeClose, {
  1769. done() {
  1770. opened = false;
  1771. emit("close");
  1772. emit("update:show", false);
  1773. }
  1774. });
  1775. }
  1776. };
  1777. const onClickOverlay = (event) => {
  1778. emit("clickOverlay", event);
  1779. if (props2.closeOnClickOverlay) {
  1780. close();
  1781. }
  1782. };
  1783. const renderOverlay = () => {
  1784. if (props2.overlay) {
  1785. return vue.createVNode(Overlay, vue.mergeProps({
  1786. "show": props2.show,
  1787. "class": props2.overlayClass,
  1788. "zIndex": zIndex.value,
  1789. "duration": props2.duration,
  1790. "customStyle": props2.overlayStyle,
  1791. "role": props2.closeOnClickOverlay ? "button" : void 0,
  1792. "tabindex": props2.closeOnClickOverlay ? 0 : void 0
  1793. }, useScopeId(), {
  1794. "onClick": onClickOverlay
  1795. }), {
  1796. default: slots["overlay-content"]
  1797. });
  1798. }
  1799. };
  1800. const onClickCloseIcon = (event) => {
  1801. emit("clickCloseIcon", event);
  1802. close();
  1803. };
  1804. const renderCloseIcon = () => {
  1805. if (props2.closeable) {
  1806. return vue.createVNode(Icon, {
  1807. "role": "button",
  1808. "tabindex": 0,
  1809. "name": props2.closeIcon,
  1810. "class": [bem$1w("close-icon", props2.closeIconPosition), HAPTICS_FEEDBACK],
  1811. "classPrefix": props2.iconPrefix,
  1812. "onClick": onClickCloseIcon
  1813. }, null);
  1814. }
  1815. };
  1816. let timer2;
  1817. const onOpened = () => {
  1818. if (timer2) clearTimeout(timer2);
  1819. timer2 = setTimeout(() => {
  1820. emit("opened");
  1821. });
  1822. };
  1823. const onClosed = () => emit("closed");
  1824. const onKeydown = (event) => emit("keydown", event);
  1825. const renderPopup = lazyRender(() => {
  1826. var _a;
  1827. const {
  1828. round: round2,
  1829. position,
  1830. safeAreaInsetTop,
  1831. safeAreaInsetBottom
  1832. } = props2;
  1833. return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  1834. "ref": popupRef,
  1835. "style": style.value,
  1836. "role": "dialog",
  1837. "tabindex": 0,
  1838. "class": [bem$1w({
  1839. round: round2,
  1840. [position]: position
  1841. }), {
  1842. "van-safe-area-top": safeAreaInsetTop,
  1843. "van-safe-area-bottom": safeAreaInsetBottom
  1844. }],
  1845. "onKeydown": onKeydown
  1846. }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vue.vShow, props2.show]]);
  1847. });
  1848. const renderTransition = () => {
  1849. const {
  1850. position,
  1851. transition,
  1852. transitionAppear
  1853. } = props2;
  1854. const name2 = position === "center" ? "van-fade" : `van-popup-slide-${position}`;
  1855. return vue.createVNode(vue.Transition, {
  1856. "name": transition || name2,
  1857. "appear": transitionAppear,
  1858. "onAfterEnter": onOpened,
  1859. "onAfterLeave": onClosed
  1860. }, {
  1861. default: renderPopup
  1862. });
  1863. };
  1864. vue.watch(() => props2.show, (show) => {
  1865. if (show && !opened) {
  1866. open();
  1867. if (attrs.tabindex === 0) {
  1868. vue.nextTick(() => {
  1869. var _a;
  1870. (_a = popupRef.value) == null ? void 0 : _a.focus();
  1871. });
  1872. }
  1873. }
  1874. if (!show && opened) {
  1875. opened = false;
  1876. emit("close");
  1877. }
  1878. });
  1879. useExpose({
  1880. popupRef
  1881. });
  1882. useLockScroll(popupRef, () => props2.show && props2.lockScroll);
  1883. useEventListener("popstate", () => {
  1884. if (props2.closeOnPopstate) {
  1885. close();
  1886. shouldReopen = false;
  1887. }
  1888. });
  1889. vue.onMounted(() => {
  1890. if (props2.show) {
  1891. open();
  1892. }
  1893. });
  1894. vue.onActivated(() => {
  1895. if (shouldReopen) {
  1896. emit("update:show", true);
  1897. shouldReopen = false;
  1898. }
  1899. });
  1900. vue.onDeactivated(() => {
  1901. if (props2.show && props2.teleport) {
  1902. close();
  1903. shouldReopen = true;
  1904. }
  1905. });
  1906. vue.provide(POPUP_TOGGLE_KEY, () => props2.show);
  1907. return () => {
  1908. if (props2.teleport) {
  1909. return vue.createVNode(vue.Teleport, {
  1910. "to": props2.teleport
  1911. }, {
  1912. default: () => [renderOverlay(), renderTransition()]
  1913. });
  1914. }
  1915. return vue.createVNode(vue.Fragment, null, [renderOverlay(), renderTransition()]);
  1916. };
  1917. }
  1918. });
  1919. const Popup = withInstall(stdin_default$1K);
  1920. const [name$1A, bem$1v] = createNamespace("action-sheet");
  1921. const actionSheetProps = extend({}, popupSharedProps, {
  1922. title: String,
  1923. round: truthProp,
  1924. actions: makeArrayProp(),
  1925. closeIcon: makeStringProp("cross"),
  1926. closeable: truthProp,
  1927. cancelText: String,
  1928. description: String,
  1929. closeOnPopstate: truthProp,
  1930. closeOnClickAction: Boolean,
  1931. safeAreaInsetBottom: truthProp
  1932. });
  1933. const popupInheritKeys$2 = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
  1934. var stdin_default$1J = vue.defineComponent({
  1935. name: name$1A,
  1936. props: actionSheetProps,
  1937. emits: ["select", "cancel", "update:show"],
  1938. setup(props2, {
  1939. slots,
  1940. emit
  1941. }) {
  1942. const updateShow = (show) => emit("update:show", show);
  1943. const onCancel = () => {
  1944. updateShow(false);
  1945. emit("cancel");
  1946. };
  1947. const renderHeader = () => {
  1948. if (props2.title) {
  1949. return vue.createVNode("div", {
  1950. "class": bem$1v("header")
  1951. }, [props2.title, props2.closeable && vue.createVNode(Icon, {
  1952. "name": props2.closeIcon,
  1953. "class": [bem$1v("close"), HAPTICS_FEEDBACK],
  1954. "onClick": onCancel
  1955. }, null)]);
  1956. }
  1957. };
  1958. const renderCancel = () => {
  1959. if (slots.cancel || props2.cancelText) {
  1960. return [vue.createVNode("div", {
  1961. "class": bem$1v("gap")
  1962. }, null), vue.createVNode("button", {
  1963. "type": "button",
  1964. "class": bem$1v("cancel"),
  1965. "onClick": onCancel
  1966. }, [slots.cancel ? slots.cancel() : props2.cancelText])];
  1967. }
  1968. };
  1969. const renderIcon = (action) => {
  1970. if (action.icon) {
  1971. return vue.createVNode(Icon, {
  1972. "class": bem$1v("item-icon"),
  1973. "name": action.icon
  1974. }, null);
  1975. }
  1976. };
  1977. const renderActionContent = (action, index) => {
  1978. if (action.loading) {
  1979. return vue.createVNode(Loading, {
  1980. "class": bem$1v("loading-icon")
  1981. }, null);
  1982. }
  1983. if (slots.action) {
  1984. return slots.action({
  1985. action,
  1986. index
  1987. });
  1988. }
  1989. return [vue.createVNode("span", {
  1990. "class": bem$1v("name")
  1991. }, [action.name]), action.subname && vue.createVNode("div", {
  1992. "class": bem$1v("subname")
  1993. }, [action.subname])];
  1994. };
  1995. const renderAction = (action, index) => {
  1996. const {
  1997. color,
  1998. loading,
  1999. callback,
  2000. disabled,
  2001. className
  2002. } = action;
  2003. const onClick = () => {
  2004. if (disabled || loading) {
  2005. return;
  2006. }
  2007. if (callback) {
  2008. callback(action);
  2009. }
  2010. if (props2.closeOnClickAction) {
  2011. updateShow(false);
  2012. }
  2013. vue.nextTick(() => emit("select", action, index));
  2014. };
  2015. return vue.createVNode("button", {
  2016. "type": "button",
  2017. "style": {
  2018. color
  2019. },
  2020. "class": [bem$1v("item", {
  2021. loading,
  2022. disabled
  2023. }), className],
  2024. "onClick": onClick
  2025. }, [renderIcon(action), renderActionContent(action, index)]);
  2026. };
  2027. const renderDescription = () => {
  2028. if (props2.description || slots.description) {
  2029. const content = slots.description ? slots.description() : props2.description;
  2030. return vue.createVNode("div", {
  2031. "class": bem$1v("description")
  2032. }, [content]);
  2033. }
  2034. };
  2035. return () => vue.createVNode(Popup, vue.mergeProps({
  2036. "class": bem$1v(),
  2037. "position": "bottom",
  2038. "onUpdate:show": updateShow
  2039. }, pick(props2, popupInheritKeys$2)), {
  2040. default: () => {
  2041. var _a;
  2042. return [renderHeader(), renderDescription(), vue.createVNode("div", {
  2043. "class": bem$1v("content")
  2044. }, [props2.actions.map(renderAction), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderCancel()];
  2045. }
  2046. });
  2047. }
  2048. });
  2049. const ActionSheet = withInstall(stdin_default$1J);
  2050. const [name$1z, bem$1u, t$k] = createNamespace("picker");
  2051. const getFirstEnabledOption = (options) => options.find((option) => !option.disabled) || options[0];
  2052. function getColumnsType(columns, fields) {
  2053. const firstColumn = columns[0];
  2054. if (firstColumn) {
  2055. if (Array.isArray(firstColumn)) {
  2056. return "multiple";
  2057. }
  2058. if (fields.children in firstColumn) {
  2059. return "cascade";
  2060. }
  2061. }
  2062. return "default";
  2063. }
  2064. function findIndexOfEnabledOption(options, index) {
  2065. index = clamp(index, 0, options.length);
  2066. for (let i = index; i < options.length; i++) {
  2067. if (!options[i].disabled) return i;
  2068. }
  2069. for (let i = index - 1; i >= 0; i--) {
  2070. if (!options[i].disabled) return i;
  2071. }
  2072. return 0;
  2073. }
  2074. const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
  2075. function findOptionByValue(options, value, fields) {
  2076. const index = options.findIndex((option) => option[fields.value] === value);
  2077. const enabledIndex = findIndexOfEnabledOption(options, index);
  2078. return options[enabledIndex];
  2079. }
  2080. function formatCascadeColumns(columns, fields, selectedValues) {
  2081. const formatted = [];
  2082. let cursor = {
  2083. [fields.children]: columns
  2084. };
  2085. let columnIndex = 0;
  2086. while (cursor && cursor[fields.children]) {
  2087. const options = cursor[fields.children];
  2088. const value = selectedValues.value[columnIndex];
  2089. cursor = isDef(value) ? findOptionByValue(options, value, fields) : void 0;
  2090. if (!cursor && options.length) {
  2091. const firstValue = getFirstEnabledOption(options)[fields.value];
  2092. cursor = findOptionByValue(options, firstValue, fields);
  2093. }
  2094. columnIndex++;
  2095. formatted.push(options);
  2096. }
  2097. return formatted;
  2098. }
  2099. function getElementTranslateY(element) {
  2100. const { transform } = window.getComputedStyle(element);
  2101. const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
  2102. return Number(translateY);
  2103. }
  2104. function assignDefaultFields(fields) {
  2105. return extend(
  2106. {
  2107. text: "text",
  2108. value: "value",
  2109. children: "children"
  2110. },
  2111. fields
  2112. );
  2113. }
  2114. const DEFAULT_DURATION = 200;
  2115. const MOMENTUM_TIME = 300;
  2116. const MOMENTUM_DISTANCE = 15;
  2117. const [name$1y, bem$1t] = createNamespace("picker-column");
  2118. const PICKER_KEY = Symbol(name$1y);
  2119. var stdin_default$1I = vue.defineComponent({
  2120. name: name$1y,
  2121. props: {
  2122. value: numericProp,
  2123. fields: makeRequiredProp(Object),
  2124. options: makeArrayProp(),
  2125. readonly: Boolean,
  2126. allowHtml: Boolean,
  2127. optionHeight: makeRequiredProp(Number),
  2128. swipeDuration: makeRequiredProp(numericProp),
  2129. visibleOptionNum: makeRequiredProp(numericProp)
  2130. },
  2131. emits: ["change", "clickOption", "scrollInto"],
  2132. setup(props2, {
  2133. emit,
  2134. slots
  2135. }) {
  2136. let moving;
  2137. let startOffset;
  2138. let touchStartTime;
  2139. let momentumOffset;
  2140. let transitionEndTrigger;
  2141. const root = vue.ref();
  2142. const wrapper = vue.ref();
  2143. const currentOffset = vue.ref(0);
  2144. const currentDuration = vue.ref(0);
  2145. const touch = useTouch();
  2146. const count = () => props2.options.length;
  2147. const baseOffset = () => props2.optionHeight * (+props2.visibleOptionNum - 1) / 2;
  2148. const updateValueByIndex = (index) => {
  2149. let enabledIndex = findIndexOfEnabledOption(props2.options, index);
  2150. const offset2 = -enabledIndex * props2.optionHeight;
  2151. const trigger = () => {
  2152. if (enabledIndex > count() - 1) {
  2153. enabledIndex = findIndexOfEnabledOption(props2.options, index);
  2154. }
  2155. const value = props2.options[enabledIndex][props2.fields.value];
  2156. if (value !== props2.value) {
  2157. emit("change", value);
  2158. }
  2159. };
  2160. if (moving && offset2 !== currentOffset.value) {
  2161. transitionEndTrigger = trigger;
  2162. } else {
  2163. trigger();
  2164. }
  2165. currentOffset.value = offset2;
  2166. };
  2167. const isReadonly = () => props2.readonly || !props2.options.length;
  2168. const onClickOption = (index) => {
  2169. if (moving || isReadonly()) {
  2170. return;
  2171. }
  2172. transitionEndTrigger = null;
  2173. currentDuration.value = DEFAULT_DURATION;
  2174. updateValueByIndex(index);
  2175. emit("clickOption", props2.options[index]);
  2176. };
  2177. const getIndexByOffset = (offset2) => clamp(Math.round(-offset2 / props2.optionHeight), 0, count() - 1);
  2178. const currentIndex = vue.computed(() => getIndexByOffset(currentOffset.value));
  2179. const momentum = (distance, duration) => {
  2180. const speed = Math.abs(distance / duration);
  2181. distance = currentOffset.value + speed / 3e-3 * (distance < 0 ? -1 : 1);
  2182. const index = getIndexByOffset(distance);
  2183. currentDuration.value = +props2.swipeDuration;
  2184. updateValueByIndex(index);
  2185. };
  2186. const stopMomentum = () => {
  2187. moving = false;
  2188. currentDuration.value = 0;
  2189. if (transitionEndTrigger) {
  2190. transitionEndTrigger();
  2191. transitionEndTrigger = null;
  2192. }
  2193. };
  2194. const onTouchStart = (event) => {
  2195. if (isReadonly()) {
  2196. return;
  2197. }
  2198. touch.start(event);
  2199. if (moving) {
  2200. const translateY = getElementTranslateY(wrapper.value);
  2201. currentOffset.value = Math.min(0, translateY - baseOffset());
  2202. }
  2203. currentDuration.value = 0;
  2204. startOffset = currentOffset.value;
  2205. touchStartTime = Date.now();
  2206. momentumOffset = startOffset;
  2207. transitionEndTrigger = null;
  2208. };
  2209. const onTouchMove = (event) => {
  2210. if (isReadonly()) {
  2211. return;
  2212. }
  2213. touch.move(event);
  2214. if (touch.isVertical()) {
  2215. moving = true;
  2216. preventDefault(event, true);
  2217. }
  2218. const newOffset = clamp(startOffset + touch.deltaY.value, -(count() * props2.optionHeight), props2.optionHeight);
  2219. const newIndex = getIndexByOffset(newOffset);
  2220. if (newIndex !== currentIndex.value) {
  2221. emit("scrollInto", props2.options[newIndex]);
  2222. }
  2223. currentOffset.value = newOffset;
  2224. const now = Date.now();
  2225. if (now - touchStartTime > MOMENTUM_TIME) {
  2226. touchStartTime = now;
  2227. momentumOffset = newOffset;
  2228. }
  2229. };
  2230. const onTouchEnd = () => {
  2231. if (isReadonly()) {
  2232. return;
  2233. }
  2234. const distance = currentOffset.value - momentumOffset;
  2235. const duration = Date.now() - touchStartTime;
  2236. const startMomentum = duration < MOMENTUM_TIME && Math.abs(distance) > MOMENTUM_DISTANCE;
  2237. if (startMomentum) {
  2238. momentum(distance, duration);
  2239. return;
  2240. }
  2241. const index = getIndexByOffset(currentOffset.value);
  2242. currentDuration.value = DEFAULT_DURATION;
  2243. updateValueByIndex(index);
  2244. setTimeout(() => {
  2245. moving = false;
  2246. }, 0);
  2247. };
  2248. const renderOptions = () => {
  2249. const optionStyle = {
  2250. height: `${props2.optionHeight}px`
  2251. };
  2252. return props2.options.map((option, index) => {
  2253. const text = option[props2.fields.text];
  2254. const {
  2255. disabled
  2256. } = option;
  2257. const value = option[props2.fields.value];
  2258. const data = {
  2259. role: "button",
  2260. style: optionStyle,
  2261. tabindex: disabled ? -1 : 0,
  2262. class: [bem$1t("item", {
  2263. disabled,
  2264. selected: value === props2.value
  2265. }), option.className],
  2266. onClick: () => onClickOption(index)
  2267. };
  2268. const childData = {
  2269. class: "van-ellipsis",
  2270. [props2.allowHtml ? "innerHTML" : "textContent"]: text
  2271. };
  2272. return vue.createVNode("li", data, [slots.option ? slots.option(option, index) : vue.createVNode("div", childData, null)]);
  2273. });
  2274. };
  2275. useParent(PICKER_KEY);
  2276. useExpose({
  2277. stopMomentum
  2278. });
  2279. vue.watchEffect(() => {
  2280. const index = moving ? Math.floor(-currentOffset.value / props2.optionHeight) : props2.options.findIndex((option) => option[props2.fields.value] === props2.value);
  2281. const enabledIndex = findIndexOfEnabledOption(props2.options, index);
  2282. const offset2 = -enabledIndex * props2.optionHeight;
  2283. if (moving && enabledIndex < index) stopMomentum();
  2284. currentOffset.value = offset2;
  2285. });
  2286. useEventListener("touchmove", onTouchMove, {
  2287. target: root
  2288. });
  2289. return () => vue.createVNode("div", {
  2290. "ref": root,
  2291. "class": bem$1t(),
  2292. "onTouchstartPassive": onTouchStart,
  2293. "onTouchend": onTouchEnd,
  2294. "onTouchcancel": onTouchEnd
  2295. }, [vue.createVNode("ul", {
  2296. "ref": wrapper,
  2297. "style": {
  2298. transform: `translate3d(0, ${currentOffset.value + baseOffset()}px, 0)`,
  2299. transitionDuration: `${currentDuration.value}ms`,
  2300. transitionProperty: currentDuration.value ? "all" : "none"
  2301. },
  2302. "class": bem$1t("wrapper"),
  2303. "onTransitionend": stopMomentum
  2304. }, [renderOptions()])]);
  2305. }
  2306. });
  2307. const [name$1x] = createNamespace("picker-toolbar");
  2308. const pickerToolbarProps = {
  2309. title: String,
  2310. cancelButtonText: String,
  2311. confirmButtonText: String
  2312. };
  2313. const pickerToolbarSlots = ["cancel", "confirm", "title", "toolbar"];
  2314. const pickerToolbarPropKeys = Object.keys(pickerToolbarProps);
  2315. var stdin_default$1H = vue.defineComponent({
  2316. name: name$1x,
  2317. props: pickerToolbarProps,
  2318. emits: ["confirm", "cancel"],
  2319. setup(props2, {
  2320. emit,
  2321. slots
  2322. }) {
  2323. const renderTitle = () => {
  2324. if (slots.title) {
  2325. return slots.title();
  2326. }
  2327. if (props2.title) {
  2328. return vue.createVNode("div", {
  2329. "class": [bem$1u("title"), "van-ellipsis"]
  2330. }, [props2.title]);
  2331. }
  2332. };
  2333. const onCancel = () => emit("cancel");
  2334. const onConfirm = () => emit("confirm");
  2335. const renderCancel = () => {
  2336. var _a;
  2337. const text = (_a = props2.cancelButtonText) != null ? _a : t$k("cancel");
  2338. if (!slots.cancel && !text) {
  2339. return;
  2340. }
  2341. return vue.createVNode("button", {
  2342. "type": "button",
  2343. "class": [bem$1u("cancel"), HAPTICS_FEEDBACK],
  2344. "onClick": onCancel
  2345. }, [slots.cancel ? slots.cancel() : text]);
  2346. };
  2347. const renderConfirm = () => {
  2348. var _a;
  2349. const text = (_a = props2.confirmButtonText) != null ? _a : t$k("confirm");
  2350. if (!slots.confirm && !text) {
  2351. return;
  2352. }
  2353. return vue.createVNode("button", {
  2354. "type": "button",
  2355. "class": [bem$1u("confirm"), HAPTICS_FEEDBACK],
  2356. "onClick": onConfirm
  2357. }, [slots.confirm ? slots.confirm() : text]);
  2358. };
  2359. return () => vue.createVNode("div", {
  2360. "class": bem$1u("toolbar")
  2361. }, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderTitle(), renderConfirm()]]);
  2362. }
  2363. });
  2364. const useSyncPropRef = (getProp, setProp) => {
  2365. const propRef = vue.ref(getProp());
  2366. vue.watch(getProp, (value) => {
  2367. if (value !== propRef.value) {
  2368. propRef.value = value;
  2369. }
  2370. });
  2371. vue.watch(propRef, (value) => {
  2372. if (value !== getProp()) {
  2373. setProp(value);
  2374. }
  2375. });
  2376. return propRef;
  2377. };
  2378. /**
  2379. * @vue/shared v3.5.12
  2380. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  2381. * @license MIT
  2382. **/
  2383. const isArray = Array.isArray;
  2384. const isString = (val) => typeof val === "string";
  2385. const isObject = (val) => val !== null && typeof val === "object";
  2386. const cacheStringFunction = (fn) => {
  2387. const cache = /* @__PURE__ */ Object.create(null);
  2388. return (str) => {
  2389. const hit = cache[str];
  2390. return hit || (cache[str] = fn(str));
  2391. };
  2392. };
  2393. const hyphenateRE = /\B([A-Z])/g;
  2394. const hyphenate = cacheStringFunction(
  2395. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  2396. );
  2397. function normalizeStyle(value) {
  2398. if (isArray(value)) {
  2399. const res = {};
  2400. for (let i = 0; i < value.length; i++) {
  2401. const item = value[i];
  2402. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  2403. if (normalized) {
  2404. for (const key in normalized) {
  2405. res[key] = normalized[key];
  2406. }
  2407. }
  2408. }
  2409. return res;
  2410. } else if (isString(value) || isObject(value)) {
  2411. return value;
  2412. }
  2413. }
  2414. const listDelimiterRE = /;(?![^(]*\))/g;
  2415. const propertyDelimiterRE = /:([^]+)/;
  2416. const styleCommentRE = /\/\*[^]*?\*\//g;
  2417. function parseStringStyle(cssText) {
  2418. const ret = {};
  2419. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  2420. if (item) {
  2421. const tmp = item.split(propertyDelimiterRE);
  2422. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  2423. }
  2424. });
  2425. return ret;
  2426. }
  2427. function stringifyStyle(styles) {
  2428. let ret = "";
  2429. if (!styles || isString(styles)) {
  2430. return ret;
  2431. }
  2432. for (const key in styles) {
  2433. const value = styles[key];
  2434. if (isString(value) || typeof value === "number") {
  2435. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  2436. ret += `${normalizedKey}:${value};`;
  2437. }
  2438. }
  2439. return ret;
  2440. }
  2441. function normalizeClass(value) {
  2442. let res = "";
  2443. if (isString(value)) {
  2444. res = value;
  2445. } else if (isArray(value)) {
  2446. for (let i = 0; i < value.length; i++) {
  2447. const normalized = normalizeClass(value[i]);
  2448. if (normalized) {
  2449. res += normalized + " ";
  2450. }
  2451. }
  2452. } else if (isObject(value)) {
  2453. for (const name2 in value) {
  2454. if (value[name2]) {
  2455. res += name2 + " ";
  2456. }
  2457. }
  2458. }
  2459. return res.trim();
  2460. }
  2461. function scrollLeftTo(scroller, to, duration) {
  2462. let rafId;
  2463. let count = 0;
  2464. const from = scroller.scrollLeft;
  2465. const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
  2466. let scrollLeft = from;
  2467. function cancel() {
  2468. cancelRaf(rafId);
  2469. }
  2470. function animate() {
  2471. scrollLeft += (to - from) / frames;
  2472. scroller.scrollLeft = scrollLeft;
  2473. if (++count < frames) {
  2474. rafId = raf(animate);
  2475. }
  2476. }
  2477. animate();
  2478. return cancel;
  2479. }
  2480. function scrollTopTo(scroller, to, duration, callback) {
  2481. let rafId;
  2482. let current2 = getScrollTop(scroller);
  2483. const isDown = current2 < to;
  2484. const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
  2485. const step = (to - current2) / frames;
  2486. function cancel() {
  2487. cancelRaf(rafId);
  2488. }
  2489. function animate() {
  2490. current2 += step;
  2491. if (isDown && current2 > to || !isDown && current2 < to) {
  2492. current2 = to;
  2493. }
  2494. setScrollTop(scroller, current2);
  2495. if (isDown && current2 < to || !isDown && current2 > to) {
  2496. rafId = raf(animate);
  2497. } else if (callback) {
  2498. rafId = raf(callback);
  2499. }
  2500. }
  2501. animate();
  2502. return cancel;
  2503. }
  2504. let current = 0;
  2505. function useId() {
  2506. const vm = vue.getCurrentInstance();
  2507. const { name: name2 = "unknown" } = (vm == null ? void 0 : vm.type) || {};
  2508. return `${name2}-${++current}`;
  2509. }
  2510. function useRefs() {
  2511. const refs = vue.ref([]);
  2512. const cache = [];
  2513. vue.onBeforeUpdate(() => {
  2514. refs.value = [];
  2515. });
  2516. const setRefs = (index) => {
  2517. if (!cache[index]) {
  2518. cache[index] = (el) => {
  2519. refs.value[index] = el;
  2520. };
  2521. }
  2522. return cache[index];
  2523. };
  2524. return [refs, setRefs];
  2525. }
  2526. function useVisibilityChange(target, onChange) {
  2527. if (!inBrowser$1 || !window.IntersectionObserver) {
  2528. return;
  2529. }
  2530. const observer = new IntersectionObserver(
  2531. (entries) => {
  2532. onChange(entries[0].intersectionRatio > 0);
  2533. },
  2534. { root: document.body }
  2535. );
  2536. const observe = () => {
  2537. if (target.value) {
  2538. observer.observe(target.value);
  2539. }
  2540. };
  2541. const unobserve = () => {
  2542. if (target.value) {
  2543. observer.unobserve(target.value);
  2544. }
  2545. };
  2546. vue.onDeactivated(unobserve);
  2547. vue.onBeforeUnmount(unobserve);
  2548. onMountedOrActivated(observe);
  2549. }
  2550. const [name$1w, bem$1s] = createNamespace("sticky");
  2551. const stickyProps = {
  2552. zIndex: numericProp,
  2553. position: makeStringProp("top"),
  2554. container: Object,
  2555. offsetTop: makeNumericProp(0),
  2556. offsetBottom: makeNumericProp(0)
  2557. };
  2558. var stdin_default$1G = vue.defineComponent({
  2559. name: name$1w,
  2560. props: stickyProps,
  2561. emits: ["scroll", "change"],
  2562. setup(props2, {
  2563. emit,
  2564. slots
  2565. }) {
  2566. const root = vue.ref();
  2567. const scrollParent = useScrollParent(root);
  2568. const state = vue.reactive({
  2569. fixed: false,
  2570. width: 0,
  2571. // root width
  2572. height: 0,
  2573. // root height
  2574. transform: 0
  2575. });
  2576. const isReset = vue.ref(false);
  2577. const offset2 = vue.computed(() => unitToPx(props2.position === "top" ? props2.offsetTop : props2.offsetBottom));
  2578. const rootStyle = vue.computed(() => {
  2579. if (isReset.value) {
  2580. return;
  2581. }
  2582. const {
  2583. fixed,
  2584. height: height2,
  2585. width: width2
  2586. } = state;
  2587. if (fixed) {
  2588. return {
  2589. width: `${width2}px`,
  2590. height: `${height2}px`
  2591. };
  2592. }
  2593. });
  2594. const stickyStyle = vue.computed(() => {
  2595. if (!state.fixed || isReset.value) {
  2596. return;
  2597. }
  2598. const style = extend(getZIndexStyle(props2.zIndex), {
  2599. width: `${state.width}px`,
  2600. height: `${state.height}px`,
  2601. [props2.position]: `${offset2.value}px`
  2602. });
  2603. if (state.transform) {
  2604. style.transform = `translate3d(0, ${state.transform}px, 0)`;
  2605. }
  2606. return style;
  2607. });
  2608. const emitScroll = (scrollTop) => emit("scroll", {
  2609. scrollTop,
  2610. isFixed: state.fixed
  2611. });
  2612. const onScroll = () => {
  2613. if (!root.value || isHidden(root)) {
  2614. return;
  2615. }
  2616. const {
  2617. container,
  2618. position
  2619. } = props2;
  2620. const rootRect = useRect(root);
  2621. const scrollTop = getScrollTop(window);
  2622. state.width = rootRect.width;
  2623. state.height = rootRect.height;
  2624. if (position === "top") {
  2625. if (container) {
  2626. const containerRect = useRect(container);
  2627. const difference = containerRect.bottom - offset2.value - state.height;
  2628. state.fixed = offset2.value > rootRect.top && containerRect.bottom > 0;
  2629. state.transform = difference < 0 ? difference : 0;
  2630. } else {
  2631. state.fixed = offset2.value > rootRect.top;
  2632. }
  2633. } else {
  2634. const {
  2635. clientHeight
  2636. } = document.documentElement;
  2637. if (container) {
  2638. const containerRect = useRect(container);
  2639. const difference = clientHeight - containerRect.top - offset2.value - state.height;
  2640. state.fixed = clientHeight - offset2.value < rootRect.bottom && clientHeight > containerRect.top;
  2641. state.transform = difference < 0 ? -difference : 0;
  2642. } else {
  2643. state.fixed = clientHeight - offset2.value < rootRect.bottom;
  2644. }
  2645. }
  2646. emitScroll(scrollTop);
  2647. };
  2648. vue.watch(() => state.fixed, (value) => emit("change", value));
  2649. useEventListener("scroll", onScroll, {
  2650. target: scrollParent,
  2651. passive: true
  2652. });
  2653. useVisibilityChange(root, onScroll);
  2654. vue.watch([windowWidth, windowHeight], () => {
  2655. if (!root.value || isHidden(root) || !state.fixed) {
  2656. return;
  2657. }
  2658. isReset.value = true;
  2659. vue.nextTick(() => {
  2660. const rootRect = useRect(root);
  2661. state.width = rootRect.width;
  2662. state.height = rootRect.height;
  2663. isReset.value = false;
  2664. });
  2665. });
  2666. return () => {
  2667. var _a;
  2668. return vue.createVNode("div", {
  2669. "ref": root,
  2670. "style": rootStyle.value
  2671. }, [vue.createVNode("div", {
  2672. "class": bem$1s({
  2673. fixed: state.fixed && !isReset.value
  2674. }),
  2675. "style": stickyStyle.value
  2676. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  2677. };
  2678. }
  2679. });
  2680. const Sticky = withInstall(stdin_default$1G);
  2681. const [name$1v, bem$1r] = createNamespace("swipe");
  2682. const swipeProps = {
  2683. loop: truthProp,
  2684. width: numericProp,
  2685. height: numericProp,
  2686. vertical: Boolean,
  2687. autoplay: makeNumericProp(0),
  2688. duration: makeNumericProp(500),
  2689. touchable: truthProp,
  2690. lazyRender: Boolean,
  2691. initialSwipe: makeNumericProp(0),
  2692. indicatorColor: String,
  2693. showIndicators: truthProp,
  2694. stopPropagation: truthProp
  2695. };
  2696. const SWIPE_KEY = Symbol(name$1v);
  2697. var stdin_default$1F = vue.defineComponent({
  2698. name: name$1v,
  2699. props: swipeProps,
  2700. emits: ["change", "dragStart", "dragEnd"],
  2701. setup(props2, {
  2702. emit,
  2703. slots
  2704. }) {
  2705. const root = vue.ref();
  2706. const track = vue.ref();
  2707. const state = vue.reactive({
  2708. rect: null,
  2709. width: 0,
  2710. height: 0,
  2711. offset: 0,
  2712. active: 0,
  2713. swiping: false
  2714. });
  2715. let dragging = false;
  2716. const touch = useTouch();
  2717. const {
  2718. children,
  2719. linkChildren
  2720. } = useChildren(SWIPE_KEY);
  2721. const count = vue.computed(() => children.length);
  2722. const size = vue.computed(() => state[props2.vertical ? "height" : "width"]);
  2723. const delta = vue.computed(() => props2.vertical ? touch.deltaY.value : touch.deltaX.value);
  2724. const minOffset = vue.computed(() => {
  2725. if (state.rect) {
  2726. const base = props2.vertical ? state.rect.height : state.rect.width;
  2727. return base - size.value * count.value;
  2728. }
  2729. return 0;
  2730. });
  2731. const maxCount = vue.computed(() => size.value ? Math.ceil(Math.abs(minOffset.value) / size.value) : count.value);
  2732. const trackSize = vue.computed(() => count.value * size.value);
  2733. const activeIndicator = vue.computed(() => (state.active + count.value) % count.value);
  2734. const isCorrectDirection = vue.computed(() => {
  2735. const expect = props2.vertical ? "vertical" : "horizontal";
  2736. return touch.direction.value === expect;
  2737. });
  2738. const trackStyle = vue.computed(() => {
  2739. const style = {
  2740. transitionDuration: `${state.swiping ? 0 : props2.duration}ms`,
  2741. transform: `translate${props2.vertical ? "Y" : "X"}(${+state.offset.toFixed(2)}px)`
  2742. };
  2743. if (size.value) {
  2744. const mainAxis = props2.vertical ? "height" : "width";
  2745. const crossAxis = props2.vertical ? "width" : "height";
  2746. style[mainAxis] = `${trackSize.value}px`;
  2747. style[crossAxis] = props2[crossAxis] ? `${props2[crossAxis]}px` : "";
  2748. }
  2749. return style;
  2750. });
  2751. const getTargetActive = (pace) => {
  2752. const {
  2753. active
  2754. } = state;
  2755. if (pace) {
  2756. if (props2.loop) {
  2757. return clamp(active + pace, -1, count.value);
  2758. }
  2759. return clamp(active + pace, 0, maxCount.value);
  2760. }
  2761. return active;
  2762. };
  2763. const getTargetOffset = (targetActive, offset2 = 0) => {
  2764. let currentPosition = targetActive * size.value;
  2765. if (!props2.loop) {
  2766. currentPosition = Math.min(currentPosition, -minOffset.value);
  2767. }
  2768. let targetOffset = offset2 - currentPosition;
  2769. if (!props2.loop) {
  2770. targetOffset = clamp(targetOffset, minOffset.value, 0);
  2771. }
  2772. return targetOffset;
  2773. };
  2774. const move = ({
  2775. pace = 0,
  2776. offset: offset2 = 0,
  2777. emitChange
  2778. }) => {
  2779. if (count.value <= 1) {
  2780. return;
  2781. }
  2782. const {
  2783. active
  2784. } = state;
  2785. const targetActive = getTargetActive(pace);
  2786. const targetOffset = getTargetOffset(targetActive, offset2);
  2787. if (props2.loop) {
  2788. if (children[0] && targetOffset !== minOffset.value) {
  2789. const outRightBound = targetOffset < minOffset.value;
  2790. children[0].setOffset(outRightBound ? trackSize.value : 0);
  2791. }
  2792. if (children[count.value - 1] && targetOffset !== 0) {
  2793. const outLeftBound = targetOffset > 0;
  2794. children[count.value - 1].setOffset(outLeftBound ? -trackSize.value : 0);
  2795. }
  2796. }
  2797. state.active = targetActive;
  2798. state.offset = targetOffset;
  2799. if (emitChange && targetActive !== active) {
  2800. emit("change", activeIndicator.value);
  2801. }
  2802. };
  2803. const correctPosition = () => {
  2804. state.swiping = true;
  2805. if (state.active <= -1) {
  2806. move({
  2807. pace: count.value
  2808. });
  2809. } else if (state.active >= count.value) {
  2810. move({
  2811. pace: -count.value
  2812. });
  2813. }
  2814. };
  2815. const prev = () => {
  2816. correctPosition();
  2817. touch.reset();
  2818. doubleRaf(() => {
  2819. state.swiping = false;
  2820. move({
  2821. pace: -1,
  2822. emitChange: true
  2823. });
  2824. });
  2825. };
  2826. const next = () => {
  2827. correctPosition();
  2828. touch.reset();
  2829. doubleRaf(() => {
  2830. state.swiping = false;
  2831. move({
  2832. pace: 1,
  2833. emitChange: true
  2834. });
  2835. });
  2836. };
  2837. let autoplayTimer;
  2838. const stopAutoplay = () => clearTimeout(autoplayTimer);
  2839. const autoplay = () => {
  2840. stopAutoplay();
  2841. if (+props2.autoplay > 0 && count.value > 1) {
  2842. autoplayTimer = setTimeout(() => {
  2843. next();
  2844. autoplay();
  2845. }, +props2.autoplay);
  2846. }
  2847. };
  2848. const initialize = (active = +props2.initialSwipe) => {
  2849. if (!root.value) {
  2850. return;
  2851. }
  2852. const cb = () => {
  2853. var _a, _b;
  2854. if (!isHidden(root)) {
  2855. const rect = {
  2856. width: root.value.offsetWidth,
  2857. height: root.value.offsetHeight
  2858. };
  2859. state.rect = rect;
  2860. state.width = +((_a = props2.width) != null ? _a : rect.width);
  2861. state.height = +((_b = props2.height) != null ? _b : rect.height);
  2862. }
  2863. if (count.value) {
  2864. active = Math.min(count.value - 1, active);
  2865. if (active === -1) {
  2866. active = count.value - 1;
  2867. }
  2868. }
  2869. state.active = active;
  2870. state.swiping = true;
  2871. state.offset = getTargetOffset(active);
  2872. children.forEach((swipe) => {
  2873. swipe.setOffset(0);
  2874. });
  2875. autoplay();
  2876. };
  2877. if (isHidden(root)) {
  2878. vue.nextTick().then(cb);
  2879. } else {
  2880. cb();
  2881. }
  2882. };
  2883. const resize = () => initialize(state.active);
  2884. let touchStartTime;
  2885. const onTouchStart = (event) => {
  2886. if (!props2.touchable || // avoid resetting position on multi-finger touch
  2887. event.touches.length > 1) return;
  2888. touch.start(event);
  2889. dragging = false;
  2890. touchStartTime = Date.now();
  2891. stopAutoplay();
  2892. correctPosition();
  2893. };
  2894. const onTouchMove = (event) => {
  2895. if (props2.touchable && state.swiping) {
  2896. touch.move(event);
  2897. if (isCorrectDirection.value) {
  2898. const isEdgeTouch = !props2.loop && (state.active === 0 && delta.value > 0 || state.active === count.value - 1 && delta.value < 0);
  2899. if (!isEdgeTouch) {
  2900. preventDefault(event, props2.stopPropagation);
  2901. move({
  2902. offset: delta.value
  2903. });
  2904. if (!dragging) {
  2905. emit("dragStart", {
  2906. index: activeIndicator.value
  2907. });
  2908. dragging = true;
  2909. }
  2910. }
  2911. }
  2912. }
  2913. };
  2914. const onTouchEnd = () => {
  2915. if (!props2.touchable || !state.swiping) {
  2916. return;
  2917. }
  2918. const duration = Date.now() - touchStartTime;
  2919. const speed = delta.value / duration;
  2920. const shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta.value) > size.value / 2;
  2921. if (shouldSwipe && isCorrectDirection.value) {
  2922. const offset2 = props2.vertical ? touch.offsetY.value : touch.offsetX.value;
  2923. let pace = 0;
  2924. if (props2.loop) {
  2925. pace = offset2 > 0 ? delta.value > 0 ? -1 : 1 : 0;
  2926. } else {
  2927. pace = -Math[delta.value > 0 ? "ceil" : "floor"](delta.value / size.value);
  2928. }
  2929. move({
  2930. pace,
  2931. emitChange: true
  2932. });
  2933. } else if (delta.value) {
  2934. move({
  2935. pace: 0
  2936. });
  2937. }
  2938. dragging = false;
  2939. state.swiping = false;
  2940. emit("dragEnd", {
  2941. index: activeIndicator.value
  2942. });
  2943. autoplay();
  2944. };
  2945. const swipeTo = (index, options = {}) => {
  2946. correctPosition();
  2947. touch.reset();
  2948. doubleRaf(() => {
  2949. let targetIndex;
  2950. if (props2.loop && index === count.value) {
  2951. targetIndex = state.active === 0 ? 0 : index;
  2952. } else {
  2953. targetIndex = index % count.value;
  2954. }
  2955. if (options.immediate) {
  2956. doubleRaf(() => {
  2957. state.swiping = false;
  2958. });
  2959. } else {
  2960. state.swiping = false;
  2961. }
  2962. move({
  2963. pace: targetIndex - state.active,
  2964. emitChange: true
  2965. });
  2966. });
  2967. };
  2968. const renderDot = (_, index) => {
  2969. const active = index === activeIndicator.value;
  2970. const style = active ? {
  2971. backgroundColor: props2.indicatorColor
  2972. } : void 0;
  2973. return vue.createVNode("i", {
  2974. "style": style,
  2975. "class": bem$1r("indicator", {
  2976. active
  2977. })
  2978. }, null);
  2979. };
  2980. const renderIndicator = () => {
  2981. if (slots.indicator) {
  2982. return slots.indicator({
  2983. active: activeIndicator.value,
  2984. total: count.value
  2985. });
  2986. }
  2987. if (props2.showIndicators && count.value > 1) {
  2988. return vue.createVNode("div", {
  2989. "class": bem$1r("indicators", {
  2990. vertical: props2.vertical
  2991. })
  2992. }, [Array(count.value).fill("").map(renderDot)]);
  2993. }
  2994. };
  2995. useExpose({
  2996. prev,
  2997. next,
  2998. state,
  2999. resize,
  3000. swipeTo
  3001. });
  3002. linkChildren({
  3003. size,
  3004. props: props2,
  3005. count,
  3006. activeIndicator
  3007. });
  3008. vue.watch(() => props2.initialSwipe, (value) => initialize(+value));
  3009. vue.watch(count, () => initialize(state.active));
  3010. vue.watch(() => props2.autoplay, autoplay);
  3011. vue.watch([windowWidth, windowHeight, () => props2.width, () => props2.height], resize);
  3012. vue.watch(usePageVisibility(), (visible) => {
  3013. if (visible === "visible") {
  3014. autoplay();
  3015. } else {
  3016. stopAutoplay();
  3017. }
  3018. });
  3019. vue.onMounted(initialize);
  3020. vue.onActivated(() => initialize(state.active));
  3021. onPopupReopen(() => initialize(state.active));
  3022. vue.onDeactivated(stopAutoplay);
  3023. vue.onBeforeUnmount(stopAutoplay);
  3024. useEventListener("touchmove", onTouchMove, {
  3025. target: track
  3026. });
  3027. return () => {
  3028. var _a;
  3029. return vue.createVNode("div", {
  3030. "ref": root,
  3031. "class": bem$1r()
  3032. }, [vue.createVNode("div", {
  3033. "ref": track,
  3034. "style": trackStyle.value,
  3035. "class": bem$1r("track", {
  3036. vertical: props2.vertical
  3037. }),
  3038. "onTouchstartPassive": onTouchStart,
  3039. "onTouchend": onTouchEnd,
  3040. "onTouchcancel": onTouchEnd
  3041. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), renderIndicator()]);
  3042. };
  3043. }
  3044. });
  3045. const Swipe = withInstall(stdin_default$1F);
  3046. const [name$1u, bem$1q] = createNamespace("tabs");
  3047. var stdin_default$1E = vue.defineComponent({
  3048. name: name$1u,
  3049. props: {
  3050. count: makeRequiredProp(Number),
  3051. inited: Boolean,
  3052. animated: Boolean,
  3053. duration: makeRequiredProp(numericProp),
  3054. swipeable: Boolean,
  3055. lazyRender: Boolean,
  3056. currentIndex: makeRequiredProp(Number)
  3057. },
  3058. emits: ["change"],
  3059. setup(props2, {
  3060. emit,
  3061. slots
  3062. }) {
  3063. const swipeRef = vue.ref();
  3064. const onChange = (index) => emit("change", index);
  3065. const renderChildren = () => {
  3066. var _a;
  3067. const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
  3068. if (props2.animated || props2.swipeable) {
  3069. return vue.createVNode(Swipe, {
  3070. "ref": swipeRef,
  3071. "loop": false,
  3072. "class": bem$1q("track"),
  3073. "duration": +props2.duration * 1e3,
  3074. "touchable": props2.swipeable,
  3075. "lazyRender": props2.lazyRender,
  3076. "showIndicators": false,
  3077. "onChange": onChange
  3078. }, {
  3079. default: () => [Content]
  3080. });
  3081. }
  3082. return Content;
  3083. };
  3084. const swipeToCurrentTab = (index) => {
  3085. const swipe = swipeRef.value;
  3086. if (swipe && swipe.state.active !== index) {
  3087. swipe.swipeTo(index, {
  3088. immediate: !props2.inited
  3089. });
  3090. }
  3091. };
  3092. vue.watch(() => props2.currentIndex, swipeToCurrentTab);
  3093. vue.onMounted(() => {
  3094. swipeToCurrentTab(props2.currentIndex);
  3095. });
  3096. useExpose({
  3097. swipeRef
  3098. });
  3099. return () => vue.createVNode("div", {
  3100. "class": bem$1q("content", {
  3101. animated: props2.animated || props2.swipeable
  3102. })
  3103. }, [renderChildren()]);
  3104. }
  3105. });
  3106. const [name$1t, bem$1p] = createNamespace("tabs");
  3107. const tabsProps = {
  3108. type: makeStringProp("line"),
  3109. color: String,
  3110. border: Boolean,
  3111. sticky: Boolean,
  3112. shrink: Boolean,
  3113. active: makeNumericProp(0),
  3114. duration: makeNumericProp(0.3),
  3115. animated: Boolean,
  3116. ellipsis: truthProp,
  3117. swipeable: Boolean,
  3118. scrollspy: Boolean,
  3119. offsetTop: makeNumericProp(0),
  3120. background: String,
  3121. lazyRender: truthProp,
  3122. showHeader: truthProp,
  3123. lineWidth: numericProp,
  3124. lineHeight: numericProp,
  3125. beforeChange: Function,
  3126. swipeThreshold: makeNumericProp(5),
  3127. titleActiveColor: String,
  3128. titleInactiveColor: String
  3129. };
  3130. const TABS_KEY = Symbol(name$1t);
  3131. var stdin_default$1D = vue.defineComponent({
  3132. name: name$1t,
  3133. props: tabsProps,
  3134. emits: ["change", "scroll", "rendered", "clickTab", "update:active"],
  3135. setup(props2, {
  3136. emit,
  3137. slots
  3138. }) {
  3139. let tabHeight;
  3140. let lockScroll;
  3141. let stickyFixed;
  3142. let cancelScrollLeftToRaf;
  3143. let cancelScrollTopToRaf;
  3144. const root = vue.ref();
  3145. const navRef = vue.ref();
  3146. const wrapRef = vue.ref();
  3147. const contentRef = vue.ref();
  3148. const id = useId();
  3149. const scroller = useScrollParent(root);
  3150. const [titleRefs, setTitleRefs] = useRefs();
  3151. const {
  3152. children,
  3153. linkChildren
  3154. } = useChildren(TABS_KEY);
  3155. const state = vue.reactive({
  3156. inited: false,
  3157. position: "",
  3158. lineStyle: {},
  3159. currentIndex: -1
  3160. });
  3161. const scrollable = vue.computed(() => children.length > +props2.swipeThreshold || !props2.ellipsis || props2.shrink);
  3162. const navStyle = vue.computed(() => ({
  3163. borderColor: props2.color,
  3164. background: props2.background
  3165. }));
  3166. const getTabName = (tab, index) => {
  3167. var _a;
  3168. return (_a = tab.name) != null ? _a : index;
  3169. };
  3170. const currentName = vue.computed(() => {
  3171. const activeTab = children[state.currentIndex];
  3172. if (activeTab) {
  3173. return getTabName(activeTab, state.currentIndex);
  3174. }
  3175. });
  3176. const offsetTopPx = vue.computed(() => unitToPx(props2.offsetTop));
  3177. const scrollOffset = vue.computed(() => {
  3178. if (props2.sticky) {
  3179. return offsetTopPx.value + tabHeight;
  3180. }
  3181. return 0;
  3182. });
  3183. const scrollIntoView = (immediate) => {
  3184. const nav = navRef.value;
  3185. const titles = titleRefs.value;
  3186. if (!scrollable.value || !nav || !titles || !titles[state.currentIndex]) {
  3187. return;
  3188. }
  3189. const title = titles[state.currentIndex].$el;
  3190. const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
  3191. if (cancelScrollLeftToRaf) cancelScrollLeftToRaf();
  3192. cancelScrollLeftToRaf = scrollLeftTo(nav, to, immediate ? 0 : +props2.duration);
  3193. };
  3194. const setLine = () => {
  3195. const shouldAnimate = state.inited;
  3196. vue.nextTick(() => {
  3197. const titles = titleRefs.value;
  3198. if (!titles || !titles[state.currentIndex] || props2.type !== "line" || isHidden(root.value)) {
  3199. return;
  3200. }
  3201. const title = titles[state.currentIndex].$el;
  3202. const {
  3203. lineWidth,
  3204. lineHeight
  3205. } = props2;
  3206. const left2 = title.offsetLeft + title.offsetWidth / 2;
  3207. const lineStyle = {
  3208. width: addUnit(lineWidth),
  3209. backgroundColor: props2.color,
  3210. transform: `translateX(${left2}px) translateX(-50%)`
  3211. };
  3212. if (shouldAnimate) {
  3213. lineStyle.transitionDuration = `${props2.duration}s`;
  3214. }
  3215. if (isDef(lineHeight)) {
  3216. const height2 = addUnit(lineHeight);
  3217. lineStyle.height = height2;
  3218. lineStyle.borderRadius = height2;
  3219. }
  3220. state.lineStyle = lineStyle;
  3221. });
  3222. };
  3223. const findAvailableTab = (index) => {
  3224. const diff = index < state.currentIndex ? -1 : 1;
  3225. while (index >= 0 && index < children.length) {
  3226. if (!children[index].disabled) {
  3227. return index;
  3228. }
  3229. index += diff;
  3230. }
  3231. };
  3232. const setCurrentIndex = (currentIndex, skipScrollIntoView) => {
  3233. const newIndex = findAvailableTab(currentIndex);
  3234. if (!isDef(newIndex)) {
  3235. return;
  3236. }
  3237. const newTab = children[newIndex];
  3238. const newName = getTabName(newTab, newIndex);
  3239. const shouldEmitChange = state.currentIndex !== null;
  3240. if (state.currentIndex !== newIndex) {
  3241. state.currentIndex = newIndex;
  3242. if (!skipScrollIntoView) {
  3243. scrollIntoView();
  3244. }
  3245. setLine();
  3246. }
  3247. if (newName !== props2.active) {
  3248. emit("update:active", newName);
  3249. if (shouldEmitChange) {
  3250. emit("change", newName, newTab.title);
  3251. }
  3252. }
  3253. if (stickyFixed && !props2.scrollspy) {
  3254. setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
  3255. }
  3256. };
  3257. const setCurrentIndexByName = (name2, skipScrollIntoView) => {
  3258. const matched = children.find((tab, index2) => getTabName(tab, index2) === name2);
  3259. const index = matched ? children.indexOf(matched) : 0;
  3260. setCurrentIndex(index, skipScrollIntoView);
  3261. };
  3262. const scrollToCurrentContent = (immediate = false) => {
  3263. if (props2.scrollspy) {
  3264. const target = children[state.currentIndex].$el;
  3265. if (target && scroller.value) {
  3266. const to = getElementTop(target, scroller.value) - scrollOffset.value;
  3267. lockScroll = true;
  3268. if (cancelScrollTopToRaf) cancelScrollTopToRaf();
  3269. cancelScrollTopToRaf = scrollTopTo(scroller.value, to, immediate ? 0 : +props2.duration, () => {
  3270. lockScroll = false;
  3271. });
  3272. }
  3273. }
  3274. };
  3275. const onClickTab = (item, index, event) => {
  3276. const {
  3277. title,
  3278. disabled
  3279. } = children[index];
  3280. const name2 = getTabName(children[index], index);
  3281. if (!disabled) {
  3282. callInterceptor(props2.beforeChange, {
  3283. args: [name2],
  3284. done: () => {
  3285. setCurrentIndex(index);
  3286. scrollToCurrentContent();
  3287. }
  3288. });
  3289. route(item);
  3290. }
  3291. emit("clickTab", {
  3292. name: name2,
  3293. title,
  3294. event,
  3295. disabled
  3296. });
  3297. };
  3298. const onStickyScroll = (params) => {
  3299. stickyFixed = params.isFixed;
  3300. emit("scroll", params);
  3301. };
  3302. const scrollTo = (name2) => {
  3303. vue.nextTick(() => {
  3304. setCurrentIndexByName(name2);
  3305. scrollToCurrentContent(true);
  3306. });
  3307. };
  3308. const getCurrentIndexOnScroll = () => {
  3309. for (let index = 0; index < children.length; index++) {
  3310. const {
  3311. top: top2
  3312. } = useRect(children[index].$el);
  3313. if (top2 > scrollOffset.value) {
  3314. return index === 0 ? 0 : index - 1;
  3315. }
  3316. }
  3317. return children.length - 1;
  3318. };
  3319. const onScroll = () => {
  3320. if (props2.scrollspy && !lockScroll) {
  3321. const index = getCurrentIndexOnScroll();
  3322. setCurrentIndex(index);
  3323. }
  3324. };
  3325. const renderLine = () => {
  3326. if (props2.type === "line" && children.length) {
  3327. return vue.createVNode("div", {
  3328. "class": bem$1p("line"),
  3329. "style": state.lineStyle
  3330. }, null);
  3331. }
  3332. };
  3333. const renderHeader = () => {
  3334. var _a, _b, _c;
  3335. const {
  3336. type,
  3337. border,
  3338. sticky
  3339. } = props2;
  3340. const Header = [vue.createVNode("div", {
  3341. "ref": sticky ? void 0 : wrapRef,
  3342. "class": [bem$1p("wrap"), {
  3343. [BORDER_TOP_BOTTOM]: type === "line" && border
  3344. }]
  3345. }, [vue.createVNode("div", {
  3346. "ref": navRef,
  3347. "role": "tablist",
  3348. "class": bem$1p("nav", [type, {
  3349. shrink: props2.shrink,
  3350. complete: scrollable.value
  3351. }]),
  3352. "style": navStyle.value,
  3353. "aria-orientation": "horizontal"
  3354. }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), children.map((item) => item.renderTitle(onClickTab)), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
  3355. if (sticky) {
  3356. return vue.createVNode("div", {
  3357. "ref": wrapRef
  3358. }, [Header]);
  3359. }
  3360. return Header;
  3361. };
  3362. const resize = () => {
  3363. setLine();
  3364. vue.nextTick(() => {
  3365. var _a, _b;
  3366. scrollIntoView(true);
  3367. (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
  3368. });
  3369. };
  3370. vue.watch(() => [props2.color, props2.duration, props2.lineWidth, props2.lineHeight], setLine);
  3371. vue.watch(windowWidth, resize);
  3372. vue.watch(() => props2.active, (value) => {
  3373. if (value !== currentName.value) {
  3374. setCurrentIndexByName(value);
  3375. }
  3376. });
  3377. vue.watch(() => children.length, () => {
  3378. if (state.inited) {
  3379. setCurrentIndexByName(props2.active);
  3380. setLine();
  3381. vue.nextTick(() => {
  3382. scrollIntoView(true);
  3383. });
  3384. }
  3385. });
  3386. const init = () => {
  3387. setCurrentIndexByName(props2.active, true);
  3388. vue.nextTick(() => {
  3389. state.inited = true;
  3390. if (wrapRef.value) {
  3391. tabHeight = useRect(wrapRef.value).height;
  3392. }
  3393. scrollIntoView(true);
  3394. });
  3395. };
  3396. const onRendered = (name2, title) => emit("rendered", name2, title);
  3397. useExpose({
  3398. resize,
  3399. scrollTo
  3400. });
  3401. vue.onActivated(setLine);
  3402. onPopupReopen(setLine);
  3403. onMountedOrActivated(init);
  3404. useVisibilityChange(root, setLine);
  3405. useEventListener("scroll", onScroll, {
  3406. target: scroller,
  3407. passive: true
  3408. });
  3409. linkChildren({
  3410. id,
  3411. props: props2,
  3412. setLine,
  3413. scrollable,
  3414. onRendered,
  3415. currentName,
  3416. setTitleRefs,
  3417. scrollIntoView
  3418. });
  3419. return () => vue.createVNode("div", {
  3420. "ref": root,
  3421. "class": bem$1p([props2.type])
  3422. }, [props2.showHeader ? props2.sticky ? vue.createVNode(Sticky, {
  3423. "container": root.value,
  3424. "offsetTop": offsetTopPx.value,
  3425. "onScroll": onStickyScroll
  3426. }, {
  3427. default: () => [renderHeader()]
  3428. }) : renderHeader() : null, vue.createVNode(stdin_default$1E, {
  3429. "ref": contentRef,
  3430. "count": children.length,
  3431. "inited": state.inited,
  3432. "animated": props2.animated,
  3433. "duration": props2.duration,
  3434. "swipeable": props2.swipeable,
  3435. "lazyRender": props2.lazyRender,
  3436. "currentIndex": state.currentIndex,
  3437. "onChange": setCurrentIndex
  3438. }, {
  3439. default: () => {
  3440. var _a;
  3441. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  3442. }
  3443. })]);
  3444. }
  3445. });
  3446. const TAB_STATUS_KEY = Symbol();
  3447. const useTabStatus = () => vue.inject(TAB_STATUS_KEY, null);
  3448. const [name$1s, bem$1o] = createNamespace("tab");
  3449. const TabTitle = vue.defineComponent({
  3450. name: name$1s,
  3451. props: {
  3452. id: String,
  3453. dot: Boolean,
  3454. type: String,
  3455. color: String,
  3456. title: String,
  3457. badge: numericProp,
  3458. shrink: Boolean,
  3459. isActive: Boolean,
  3460. disabled: Boolean,
  3461. controls: String,
  3462. scrollable: Boolean,
  3463. activeColor: String,
  3464. inactiveColor: String,
  3465. showZeroBadge: truthProp
  3466. },
  3467. setup(props2, {
  3468. slots
  3469. }) {
  3470. const style = vue.computed(() => {
  3471. const style2 = {};
  3472. const {
  3473. type,
  3474. color,
  3475. disabled,
  3476. isActive,
  3477. activeColor,
  3478. inactiveColor
  3479. } = props2;
  3480. const isCard = type === "card";
  3481. if (color && isCard) {
  3482. style2.borderColor = color;
  3483. if (!disabled) {
  3484. if (isActive) {
  3485. style2.backgroundColor = color;
  3486. } else {
  3487. style2.color = color;
  3488. }
  3489. }
  3490. }
  3491. const titleColor = isActive ? activeColor : inactiveColor;
  3492. if (titleColor) {
  3493. style2.color = titleColor;
  3494. }
  3495. return style2;
  3496. });
  3497. const renderText = () => {
  3498. const Text = vue.createVNode("span", {
  3499. "class": bem$1o("text", {
  3500. ellipsis: !props2.scrollable
  3501. })
  3502. }, [slots.title ? slots.title() : props2.title]);
  3503. if (props2.dot || isDef(props2.badge) && props2.badge !== "") {
  3504. return vue.createVNode(Badge, {
  3505. "dot": props2.dot,
  3506. "content": props2.badge,
  3507. "showZero": props2.showZeroBadge
  3508. }, {
  3509. default: () => [Text]
  3510. });
  3511. }
  3512. return Text;
  3513. };
  3514. return () => vue.createVNode("div", {
  3515. "id": props2.id,
  3516. "role": "tab",
  3517. "class": [bem$1o([props2.type, {
  3518. grow: props2.scrollable && !props2.shrink,
  3519. shrink: props2.shrink,
  3520. active: props2.isActive,
  3521. disabled: props2.disabled
  3522. }])],
  3523. "style": style.value,
  3524. "tabindex": props2.disabled ? void 0 : props2.isActive ? 0 : -1,
  3525. "aria-selected": props2.isActive,
  3526. "aria-disabled": props2.disabled || void 0,
  3527. "aria-controls": props2.controls,
  3528. "data-allow-mismatch": "attribute"
  3529. }, [renderText()]);
  3530. }
  3531. });
  3532. const [name$1r, bem$1n] = createNamespace("swipe-item");
  3533. var stdin_default$1C = vue.defineComponent({
  3534. name: name$1r,
  3535. setup(props2, {
  3536. slots
  3537. }) {
  3538. let rendered;
  3539. const state = vue.reactive({
  3540. offset: 0,
  3541. inited: false,
  3542. mounted: false
  3543. });
  3544. const {
  3545. parent,
  3546. index
  3547. } = useParent(SWIPE_KEY);
  3548. if (!parent) {
  3549. return;
  3550. }
  3551. const style = vue.computed(() => {
  3552. const style2 = {};
  3553. const {
  3554. vertical
  3555. } = parent.props;
  3556. if (parent.size.value) {
  3557. style2[vertical ? "height" : "width"] = `${parent.size.value}px`;
  3558. }
  3559. if (state.offset) {
  3560. style2.transform = `translate${vertical ? "Y" : "X"}(${state.offset}px)`;
  3561. }
  3562. return style2;
  3563. });
  3564. const shouldRender = vue.computed(() => {
  3565. const {
  3566. loop,
  3567. lazyRender
  3568. } = parent.props;
  3569. if (!lazyRender || rendered) {
  3570. return true;
  3571. }
  3572. if (!state.mounted) {
  3573. return false;
  3574. }
  3575. const active = parent.activeIndicator.value;
  3576. const maxActive = parent.count.value - 1;
  3577. const prevActive = active === 0 && loop ? maxActive : active - 1;
  3578. const nextActive = active === maxActive && loop ? 0 : active + 1;
  3579. rendered = index.value === active || index.value === prevActive || index.value === nextActive;
  3580. return rendered;
  3581. });
  3582. const setOffset = (offset2) => {
  3583. state.offset = offset2;
  3584. };
  3585. vue.onMounted(() => {
  3586. vue.nextTick(() => {
  3587. state.mounted = true;
  3588. });
  3589. });
  3590. useExpose({
  3591. setOffset
  3592. });
  3593. return () => {
  3594. var _a;
  3595. return vue.createVNode("div", {
  3596. "class": bem$1n(),
  3597. "style": style.value
  3598. }, [shouldRender.value ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null]);
  3599. };
  3600. }
  3601. });
  3602. const SwipeItem = withInstall(stdin_default$1C);
  3603. const [name$1q, bem$1m] = createNamespace("tab");
  3604. const tabProps = extend({}, routeProps, {
  3605. dot: Boolean,
  3606. name: numericProp,
  3607. badge: numericProp,
  3608. title: String,
  3609. disabled: Boolean,
  3610. titleClass: unknownProp,
  3611. titleStyle: [String, Object],
  3612. showZeroBadge: truthProp
  3613. });
  3614. var stdin_default$1B = vue.defineComponent({
  3615. name: name$1q,
  3616. props: tabProps,
  3617. setup(props2, {
  3618. slots
  3619. }) {
  3620. const id = useId();
  3621. const inited = vue.ref(false);
  3622. const instance2 = vue.getCurrentInstance();
  3623. const {
  3624. parent,
  3625. index
  3626. } = useParent(TABS_KEY);
  3627. if (!parent) {
  3628. return;
  3629. }
  3630. const getName = () => {
  3631. var _a;
  3632. return (_a = props2.name) != null ? _a : index.value;
  3633. };
  3634. const init = () => {
  3635. inited.value = true;
  3636. if (parent.props.lazyRender) {
  3637. vue.nextTick(() => {
  3638. parent.onRendered(getName(), props2.title);
  3639. });
  3640. }
  3641. };
  3642. const active = vue.computed(() => {
  3643. const isActive = getName() === parent.currentName.value;
  3644. if (isActive && !inited.value) {
  3645. init();
  3646. }
  3647. return isActive;
  3648. });
  3649. const parsedClass = vue.ref("");
  3650. const parsedStyle = vue.ref("");
  3651. vue.watchEffect(() => {
  3652. const {
  3653. titleClass,
  3654. titleStyle
  3655. } = props2;
  3656. parsedClass.value = titleClass ? normalizeClass(titleClass) : "";
  3657. parsedStyle.value = titleStyle && typeof titleStyle !== "string" ? stringifyStyle(normalizeStyle(titleStyle)) : titleStyle;
  3658. });
  3659. const renderTitle = (onClickTab) => vue.createVNode(TabTitle, vue.mergeProps({
  3660. "key": id,
  3661. "id": `${parent.id}-${index.value}`,
  3662. "ref": parent.setTitleRefs(index.value),
  3663. "style": parsedStyle.value,
  3664. "class": parsedClass.value,
  3665. "isActive": active.value,
  3666. "controls": id,
  3667. "scrollable": parent.scrollable.value,
  3668. "activeColor": parent.props.titleActiveColor,
  3669. "inactiveColor": parent.props.titleInactiveColor,
  3670. "onClick": (event) => onClickTab(instance2.proxy, index.value, event)
  3671. }, pick(parent.props, ["type", "color", "shrink"]), pick(props2, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
  3672. title: slots.title
  3673. });
  3674. const hasInactiveClass = vue.ref(!active.value);
  3675. vue.watch(active, (val) => {
  3676. if (val) {
  3677. hasInactiveClass.value = false;
  3678. } else {
  3679. doubleRaf(() => {
  3680. hasInactiveClass.value = true;
  3681. });
  3682. }
  3683. });
  3684. vue.watch(() => props2.title, () => {
  3685. parent.setLine();
  3686. parent.scrollIntoView();
  3687. });
  3688. vue.provide(TAB_STATUS_KEY, active);
  3689. useExpose({
  3690. id,
  3691. renderTitle
  3692. });
  3693. return () => {
  3694. var _a;
  3695. const label = `${parent.id}-${index.value}`;
  3696. const {
  3697. animated,
  3698. swipeable,
  3699. scrollspy,
  3700. lazyRender
  3701. } = parent.props;
  3702. if (!slots.default && !animated) {
  3703. return;
  3704. }
  3705. const show = scrollspy || active.value;
  3706. if (animated || swipeable) {
  3707. return vue.createVNode(SwipeItem, {
  3708. "id": id,
  3709. "role": "tabpanel",
  3710. "class": bem$1m("panel-wrapper", {
  3711. inactive: hasInactiveClass.value
  3712. }),
  3713. "tabindex": active.value ? 0 : -1,
  3714. "aria-hidden": !active.value,
  3715. "aria-labelledby": label,
  3716. "data-allow-mismatch": "attribute"
  3717. }, {
  3718. default: () => {
  3719. var _a2;
  3720. return [vue.createVNode("div", {
  3721. "class": bem$1m("panel")
  3722. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])];
  3723. }
  3724. });
  3725. }
  3726. const shouldRender = inited.value || scrollspy || !lazyRender;
  3727. const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
  3728. return vue.withDirectives(vue.createVNode("div", {
  3729. "id": id,
  3730. "role": "tabpanel",
  3731. "class": bem$1m("panel"),
  3732. "tabindex": show ? 0 : -1,
  3733. "aria-labelledby": label,
  3734. "data-allow-mismatch": "attribute"
  3735. }, [Content]), [[vue.vShow, show]]);
  3736. };
  3737. }
  3738. });
  3739. const Tab = withInstall(stdin_default$1B);
  3740. const Tabs = withInstall(stdin_default$1D);
  3741. const [name$1p, bem$1l] = createNamespace("picker-group");
  3742. const PICKER_GROUP_KEY = Symbol(name$1p);
  3743. const pickerGroupProps = extend({
  3744. tabs: makeArrayProp(),
  3745. activeTab: makeNumericProp(0),
  3746. nextStepText: String,
  3747. showToolbar: truthProp
  3748. }, pickerToolbarProps);
  3749. var stdin_default$1A = vue.defineComponent({
  3750. name: name$1p,
  3751. props: pickerGroupProps,
  3752. emits: ["confirm", "cancel", "update:activeTab"],
  3753. setup(props2, {
  3754. emit,
  3755. slots
  3756. }) {
  3757. const activeTab = useSyncPropRef(() => props2.activeTab, (value) => emit("update:activeTab", value));
  3758. const {
  3759. children,
  3760. linkChildren
  3761. } = useChildren(PICKER_GROUP_KEY);
  3762. linkChildren();
  3763. const showNextButton = () => +activeTab.value < props2.tabs.length - 1 && props2.nextStepText;
  3764. const onConfirm = () => {
  3765. if (showNextButton()) {
  3766. activeTab.value = +activeTab.value + 1;
  3767. } else {
  3768. emit("confirm", children.map((item) => item.confirm()));
  3769. }
  3770. };
  3771. const onCancel = () => emit("cancel");
  3772. return () => {
  3773. var _a, _b;
  3774. let childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment).map((node) => {
  3775. if (node.type === vue.Fragment) {
  3776. return node.children;
  3777. }
  3778. return node;
  3779. });
  3780. if (childNodes) {
  3781. childNodes = flat(childNodes);
  3782. }
  3783. const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
  3784. return vue.createVNode("div", {
  3785. "class": bem$1l()
  3786. }, [props2.showToolbar ? vue.createVNode(stdin_default$1H, {
  3787. "title": props2.title,
  3788. "cancelButtonText": props2.cancelButtonText,
  3789. "confirmButtonText": confirmButtonText,
  3790. "onConfirm": onConfirm,
  3791. "onCancel": onCancel
  3792. }, pick(slots, pickerToolbarSlots)) : null, vue.createVNode(Tabs, {
  3793. "active": activeTab.value,
  3794. "onUpdate:active": ($event) => activeTab.value = $event,
  3795. "class": bem$1l("tabs"),
  3796. "shrink": true,
  3797. "animated": true,
  3798. "lazyRender": false
  3799. }, {
  3800. default: () => [props2.tabs.map((title, index) => vue.createVNode(Tab, {
  3801. "title": title,
  3802. "titleClass": bem$1l("tab-title")
  3803. }, {
  3804. default: () => [childNodes == null ? void 0 : childNodes[index]]
  3805. }))]
  3806. })]);
  3807. };
  3808. }
  3809. });
  3810. const pickerSharedProps = extend({
  3811. loading: Boolean,
  3812. readonly: Boolean,
  3813. allowHtml: Boolean,
  3814. optionHeight: makeNumericProp(44),
  3815. showToolbar: truthProp,
  3816. swipeDuration: makeNumericProp(1e3),
  3817. visibleOptionNum: makeNumericProp(6)
  3818. }, pickerToolbarProps);
  3819. const pickerProps = extend({}, pickerSharedProps, {
  3820. columns: makeArrayProp(),
  3821. modelValue: makeArrayProp(),
  3822. toolbarPosition: makeStringProp("top"),
  3823. columnsFieldNames: Object
  3824. });
  3825. var stdin_default$1z = vue.defineComponent({
  3826. name: name$1z,
  3827. props: pickerProps,
  3828. emits: ["confirm", "cancel", "change", "scrollInto", "clickOption", "update:modelValue"],
  3829. setup(props2, {
  3830. emit,
  3831. slots
  3832. }) {
  3833. const columnsRef = vue.ref();
  3834. const selectedValues = vue.ref(props2.modelValue.slice(0));
  3835. const {
  3836. parent
  3837. } = useParent(PICKER_GROUP_KEY);
  3838. const {
  3839. children,
  3840. linkChildren
  3841. } = useChildren(PICKER_KEY);
  3842. linkChildren();
  3843. const fields = vue.computed(() => assignDefaultFields(props2.columnsFieldNames));
  3844. const optionHeight = vue.computed(() => unitToPx(props2.optionHeight));
  3845. const columnsType = vue.computed(() => getColumnsType(props2.columns, fields.value));
  3846. const currentColumns = vue.computed(() => {
  3847. const {
  3848. columns
  3849. } = props2;
  3850. switch (columnsType.value) {
  3851. case "multiple":
  3852. return columns;
  3853. case "cascade":
  3854. return formatCascadeColumns(columns, fields.value, selectedValues);
  3855. default:
  3856. return [columns];
  3857. }
  3858. });
  3859. const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
  3860. const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
  3861. const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
  3862. const setValue = (index, value) => {
  3863. if (selectedValues.value[index] !== value) {
  3864. const newValues = selectedValues.value.slice(0);
  3865. newValues[index] = value;
  3866. selectedValues.value = newValues;
  3867. }
  3868. };
  3869. const getEventParams = () => ({
  3870. selectedValues: selectedValues.value.slice(0),
  3871. selectedOptions: selectedOptions.value,
  3872. selectedIndexes: selectedIndexes.value
  3873. });
  3874. const onChange = (value, columnIndex) => {
  3875. setValue(columnIndex, value);
  3876. if (columnsType.value === "cascade") {
  3877. selectedValues.value.forEach((value2, index) => {
  3878. const options = currentColumns.value[index];
  3879. if (!isOptionExist(options, value2, fields.value)) {
  3880. setValue(index, options.length ? options[0][fields.value.value] : void 0);
  3881. }
  3882. });
  3883. }
  3884. vue.nextTick(() => {
  3885. emit("change", extend({
  3886. columnIndex
  3887. }, getEventParams()));
  3888. });
  3889. };
  3890. const onClickOption = (currentOption, columnIndex) => {
  3891. const params = {
  3892. columnIndex,
  3893. currentOption
  3894. };
  3895. emit("clickOption", extend(getEventParams(), params));
  3896. emit("scrollInto", params);
  3897. };
  3898. const confirm = () => {
  3899. children.forEach((child) => child.stopMomentum());
  3900. const params = getEventParams();
  3901. vue.nextTick(() => {
  3902. emit("confirm", params);
  3903. });
  3904. return params;
  3905. };
  3906. const cancel = () => emit("cancel", getEventParams());
  3907. const renderColumnItems = () => currentColumns.value.map((options, columnIndex) => vue.createVNode(stdin_default$1I, {
  3908. "value": selectedValues.value[columnIndex],
  3909. "fields": fields.value,
  3910. "options": options,
  3911. "readonly": props2.readonly,
  3912. "allowHtml": props2.allowHtml,
  3913. "optionHeight": optionHeight.value,
  3914. "swipeDuration": props2.swipeDuration,
  3915. "visibleOptionNum": props2.visibleOptionNum,
  3916. "onChange": (value) => onChange(value, columnIndex),
  3917. "onClickOption": (option) => onClickOption(option, columnIndex),
  3918. "onScrollInto": (option) => {
  3919. emit("scrollInto", {
  3920. currentOption: option,
  3921. columnIndex
  3922. });
  3923. }
  3924. }, {
  3925. option: slots.option
  3926. }));
  3927. const renderMask = (wrapHeight) => {
  3928. if (hasOptions.value) {
  3929. const frameStyle = {
  3930. height: `${optionHeight.value}px`
  3931. };
  3932. const maskStyle = {
  3933. backgroundSize: `100% ${(wrapHeight - optionHeight.value) / 2}px`
  3934. };
  3935. return [vue.createVNode("div", {
  3936. "class": bem$1u("mask"),
  3937. "style": maskStyle
  3938. }, null), vue.createVNode("div", {
  3939. "class": [BORDER_UNSET_TOP_BOTTOM, bem$1u("frame")],
  3940. "style": frameStyle
  3941. }, null)];
  3942. }
  3943. };
  3944. const renderColumns = () => {
  3945. const wrapHeight = optionHeight.value * +props2.visibleOptionNum;
  3946. const columnsStyle = {
  3947. height: `${wrapHeight}px`
  3948. };
  3949. return vue.createVNode("div", {
  3950. "ref": columnsRef,
  3951. "class": bem$1u("columns"),
  3952. "style": columnsStyle
  3953. }, [renderColumnItems(), renderMask(wrapHeight)]);
  3954. };
  3955. const renderToolbar = () => {
  3956. if (props2.showToolbar && !parent) {
  3957. return vue.createVNode(stdin_default$1H, vue.mergeProps(pick(props2, pickerToolbarPropKeys), {
  3958. "onConfirm": confirm,
  3959. "onCancel": cancel
  3960. }), pick(slots, pickerToolbarSlots));
  3961. }
  3962. };
  3963. vue.watch(currentColumns, (columns) => {
  3964. columns.forEach((options, index) => {
  3965. if (options.length && !isOptionExist(options, selectedValues.value[index], fields.value)) {
  3966. setValue(index, getFirstEnabledOption(options)[fields.value.value]);
  3967. }
  3968. });
  3969. }, {
  3970. immediate: true
  3971. });
  3972. let lastEmittedModelValue;
  3973. vue.watch(() => props2.modelValue, (newValues) => {
  3974. if (!isSameValue(newValues, selectedValues.value) && !isSameValue(newValues, lastEmittedModelValue)) {
  3975. selectedValues.value = newValues.slice(0);
  3976. lastEmittedModelValue = newValues.slice(0);
  3977. }
  3978. }, {
  3979. deep: true
  3980. });
  3981. vue.watch(selectedValues, (newValues) => {
  3982. if (!isSameValue(newValues, props2.modelValue)) {
  3983. lastEmittedModelValue = newValues.slice(0);
  3984. emit("update:modelValue", lastEmittedModelValue);
  3985. }
  3986. }, {
  3987. immediate: true
  3988. });
  3989. useEventListener("touchmove", preventDefault, {
  3990. target: columnsRef
  3991. });
  3992. const getSelectedOptions = () => selectedOptions.value;
  3993. useExpose({
  3994. confirm,
  3995. getSelectedOptions
  3996. });
  3997. return () => {
  3998. var _a, _b;
  3999. return vue.createVNode("div", {
  4000. "class": bem$1u()
  4001. }, [props2.toolbarPosition === "top" ? renderToolbar() : null, props2.loading ? vue.createVNode(Loading, {
  4002. "class": bem$1u("loading")
  4003. }, null) : null, (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderColumns(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots), props2.toolbarPosition === "bottom" ? renderToolbar() : null]);
  4004. };
  4005. }
  4006. });
  4007. const AREA_EMPTY_CODE = "000000";
  4008. const INHERIT_SLOTS = [
  4009. "title",
  4010. "cancel",
  4011. "confirm",
  4012. "toolbar",
  4013. "columns-top",
  4014. "columns-bottom"
  4015. ];
  4016. const INHERIT_PROPS = [
  4017. "title",
  4018. "loading",
  4019. "readonly",
  4020. "optionHeight",
  4021. "swipeDuration",
  4022. "visibleOptionNum",
  4023. "cancelButtonText",
  4024. "confirmButtonText"
  4025. ];
  4026. const makeOption = (text = "", value = AREA_EMPTY_CODE, children = void 0) => ({
  4027. text,
  4028. value,
  4029. children
  4030. });
  4031. function formatDataForCascade({
  4032. areaList,
  4033. columnsNum,
  4034. columnsPlaceholder: placeholder
  4035. }) {
  4036. const {
  4037. city_list: city = {},
  4038. county_list: county = {},
  4039. province_list: province = {}
  4040. } = areaList;
  4041. const showCity = +columnsNum > 1;
  4042. const showCounty = +columnsNum > 2;
  4043. const getProvinceChildren = () => {
  4044. if (showCity) {
  4045. return placeholder.length > 1 ? [
  4046. makeOption(
  4047. placeholder[1],
  4048. AREA_EMPTY_CODE,
  4049. showCounty ? [] : void 0
  4050. )
  4051. ] : [];
  4052. }
  4053. };
  4054. const provinceMap = /* @__PURE__ */ new Map();
  4055. Object.keys(province).forEach((code) => {
  4056. provinceMap.set(
  4057. code.slice(0, 2),
  4058. makeOption(province[code], code, getProvinceChildren())
  4059. );
  4060. });
  4061. const cityMap = /* @__PURE__ */ new Map();
  4062. if (showCity) {
  4063. const getCityChildren = () => {
  4064. if (showCounty) {
  4065. return placeholder.length > 2 ? [makeOption(placeholder[2])] : [];
  4066. }
  4067. };
  4068. Object.keys(city).forEach((code) => {
  4069. const option = makeOption(city[code], code, getCityChildren());
  4070. cityMap.set(code.slice(0, 4), option);
  4071. const province2 = provinceMap.get(code.slice(0, 2));
  4072. if (province2) {
  4073. province2.children.push(option);
  4074. }
  4075. });
  4076. }
  4077. if (showCounty) {
  4078. Object.keys(county).forEach((code) => {
  4079. const city2 = cityMap.get(code.slice(0, 4));
  4080. if (city2) {
  4081. city2.children.push(makeOption(county[code], code));
  4082. }
  4083. });
  4084. }
  4085. const options = Array.from(provinceMap.values());
  4086. if (placeholder.length) {
  4087. const county2 = showCounty ? [makeOption(placeholder[2])] : void 0;
  4088. const city2 = showCity ? [makeOption(placeholder[1], AREA_EMPTY_CODE, county2)] : void 0;
  4089. options.unshift(makeOption(placeholder[0], AREA_EMPTY_CODE, city2));
  4090. }
  4091. return options;
  4092. }
  4093. const Picker = withInstall(stdin_default$1z);
  4094. const [name$1o, bem$1k] = createNamespace("area");
  4095. const areaProps = extend({}, pick(pickerSharedProps, INHERIT_PROPS), {
  4096. modelValue: String,
  4097. columnsNum: makeNumericProp(3),
  4098. columnsPlaceholder: makeArrayProp(),
  4099. areaList: {
  4100. type: Object,
  4101. default: () => ({})
  4102. }
  4103. });
  4104. var stdin_default$1y = vue.defineComponent({
  4105. name: name$1o,
  4106. props: areaProps,
  4107. emits: ["change", "confirm", "cancel", "update:modelValue"],
  4108. setup(props2, {
  4109. emit,
  4110. slots
  4111. }) {
  4112. const codes = vue.ref([]);
  4113. const picker = vue.ref();
  4114. const columns = vue.computed(() => formatDataForCascade(props2));
  4115. const onChange = (...args) => emit("change", ...args);
  4116. const onCancel = (...args) => emit("cancel", ...args);
  4117. const onConfirm = (...args) => emit("confirm", ...args);
  4118. vue.watch(codes, (newCodes) => {
  4119. const lastCode = newCodes.length ? newCodes[newCodes.length - 1] : "";
  4120. if (lastCode && lastCode !== props2.modelValue) {
  4121. emit("update:modelValue", lastCode);
  4122. }
  4123. }, {
  4124. deep: true
  4125. });
  4126. vue.watch(() => props2.modelValue, (newCode) => {
  4127. if (newCode) {
  4128. const lastCode = codes.value.length ? codes.value[codes.value.length - 1] : "";
  4129. if (newCode !== lastCode) {
  4130. codes.value = [`${newCode.slice(0, 2)}0000`, `${newCode.slice(0, 4)}00`, newCode].slice(0, +props2.columnsNum);
  4131. }
  4132. } else {
  4133. codes.value = [];
  4134. }
  4135. }, {
  4136. immediate: true
  4137. });
  4138. useExpose({
  4139. confirm: () => {
  4140. var _a;
  4141. return (_a = picker.value) == null ? void 0 : _a.confirm();
  4142. },
  4143. getSelectedOptions: () => {
  4144. var _a;
  4145. return ((_a = picker.value) == null ? void 0 : _a.getSelectedOptions()) || [];
  4146. }
  4147. });
  4148. return () => vue.createVNode(Picker, vue.mergeProps({
  4149. "ref": picker,
  4150. "modelValue": codes.value,
  4151. "onUpdate:modelValue": ($event) => codes.value = $event,
  4152. "class": bem$1k(),
  4153. "columns": columns.value,
  4154. "onChange": onChange,
  4155. "onCancel": onCancel,
  4156. "onConfirm": onConfirm
  4157. }, pick(props2, INHERIT_PROPS)), pick(slots, INHERIT_SLOTS));
  4158. }
  4159. });
  4160. const Area = withInstall(stdin_default$1y);
  4161. const [name$1n, bem$1j] = createNamespace("cell");
  4162. const cellSharedProps = {
  4163. tag: makeStringProp("div"),
  4164. icon: String,
  4165. size: String,
  4166. title: numericProp,
  4167. value: numericProp,
  4168. label: numericProp,
  4169. center: Boolean,
  4170. isLink: Boolean,
  4171. border: truthProp,
  4172. iconPrefix: String,
  4173. valueClass: unknownProp,
  4174. labelClass: unknownProp,
  4175. titleClass: unknownProp,
  4176. titleStyle: null,
  4177. arrowDirection: String,
  4178. required: {
  4179. type: [Boolean, String],
  4180. default: null
  4181. },
  4182. clickable: {
  4183. type: Boolean,
  4184. default: null
  4185. }
  4186. };
  4187. const cellProps = extend({}, cellSharedProps, routeProps);
  4188. var stdin_default$1x = vue.defineComponent({
  4189. name: name$1n,
  4190. props: cellProps,
  4191. setup(props2, {
  4192. slots
  4193. }) {
  4194. const route2 = useRoute();
  4195. const renderLabel = () => {
  4196. const showLabel = slots.label || isDef(props2.label);
  4197. if (showLabel) {
  4198. return vue.createVNode("div", {
  4199. "class": [bem$1j("label"), props2.labelClass]
  4200. }, [slots.label ? slots.label() : props2.label]);
  4201. }
  4202. };
  4203. const renderTitle = () => {
  4204. var _a;
  4205. if (slots.title || isDef(props2.title)) {
  4206. const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
  4207. if (Array.isArray(titleSlot) && titleSlot.length === 0) {
  4208. return;
  4209. }
  4210. return vue.createVNode("div", {
  4211. "class": [bem$1j("title"), props2.titleClass],
  4212. "style": props2.titleStyle
  4213. }, [titleSlot || vue.createVNode("span", null, [props2.title]), renderLabel()]);
  4214. }
  4215. };
  4216. const renderValue = () => {
  4217. const slot = slots.value || slots.default;
  4218. const hasValue = slot || isDef(props2.value);
  4219. if (hasValue) {
  4220. return vue.createVNode("div", {
  4221. "class": [bem$1j("value"), props2.valueClass]
  4222. }, [slot ? slot() : vue.createVNode("span", null, [props2.value])]);
  4223. }
  4224. };
  4225. const renderLeftIcon = () => {
  4226. if (slots.icon) {
  4227. return slots.icon();
  4228. }
  4229. if (props2.icon) {
  4230. return vue.createVNode(Icon, {
  4231. "name": props2.icon,
  4232. "class": bem$1j("left-icon"),
  4233. "classPrefix": props2.iconPrefix
  4234. }, null);
  4235. }
  4236. };
  4237. const renderRightIcon = () => {
  4238. if (slots["right-icon"]) {
  4239. return slots["right-icon"]();
  4240. }
  4241. if (props2.isLink) {
  4242. const name2 = props2.arrowDirection && props2.arrowDirection !== "right" ? `arrow-${props2.arrowDirection}` : "arrow";
  4243. return vue.createVNode(Icon, {
  4244. "name": name2,
  4245. "class": bem$1j("right-icon")
  4246. }, null);
  4247. }
  4248. };
  4249. return () => {
  4250. var _a;
  4251. const {
  4252. tag,
  4253. size,
  4254. center,
  4255. border,
  4256. isLink,
  4257. required
  4258. } = props2;
  4259. const clickable = (_a = props2.clickable) != null ? _a : isLink;
  4260. const classes = {
  4261. center,
  4262. required: !!required,
  4263. clickable,
  4264. borderless: !border
  4265. };
  4266. if (size) {
  4267. classes[size] = !!size;
  4268. }
  4269. return vue.createVNode(tag, {
  4270. "class": bem$1j(classes),
  4271. "role": clickable ? "button" : void 0,
  4272. "tabindex": clickable ? 0 : void 0,
  4273. "onClick": route2
  4274. }, {
  4275. default: () => {
  4276. var _a2;
  4277. return [renderLeftIcon(), renderTitle(), renderValue(), renderRightIcon(), (_a2 = slots.extra) == null ? void 0 : _a2.call(slots)];
  4278. }
  4279. });
  4280. };
  4281. }
  4282. });
  4283. const Cell = withInstall(stdin_default$1x);
  4284. const [name$1m, bem$1i] = createNamespace("form");
  4285. const formProps = {
  4286. colon: Boolean,
  4287. disabled: Boolean,
  4288. readonly: Boolean,
  4289. required: [Boolean, String],
  4290. showError: Boolean,
  4291. labelWidth: numericProp,
  4292. labelAlign: String,
  4293. inputAlign: String,
  4294. scrollToError: Boolean,
  4295. scrollToErrorPosition: String,
  4296. validateFirst: Boolean,
  4297. submitOnEnter: truthProp,
  4298. showErrorMessage: truthProp,
  4299. errorMessageAlign: String,
  4300. validateTrigger: {
  4301. type: [String, Array],
  4302. default: "onBlur"
  4303. }
  4304. };
  4305. var stdin_default$1w = vue.defineComponent({
  4306. name: name$1m,
  4307. props: formProps,
  4308. emits: ["submit", "failed"],
  4309. setup(props2, {
  4310. emit,
  4311. slots
  4312. }) {
  4313. const {
  4314. children,
  4315. linkChildren
  4316. } = useChildren(FORM_KEY);
  4317. const getFieldsByNames = (names) => {
  4318. if (names) {
  4319. return children.filter((field) => names.includes(field.name));
  4320. }
  4321. return children;
  4322. };
  4323. const validateSeq = (names) => new Promise((resolve, reject) => {
  4324. const errors = [];
  4325. const fields = getFieldsByNames(names);
  4326. fields.reduce((promise, field) => promise.then(() => {
  4327. if (!errors.length) {
  4328. return field.validate().then((error) => {
  4329. if (error) {
  4330. errors.push(error);
  4331. }
  4332. });
  4333. }
  4334. }), Promise.resolve()).then(() => {
  4335. if (errors.length) {
  4336. reject(errors);
  4337. } else {
  4338. resolve();
  4339. }
  4340. });
  4341. });
  4342. const validateAll = (names) => new Promise((resolve, reject) => {
  4343. const fields = getFieldsByNames(names);
  4344. Promise.all(fields.map((item) => item.validate())).then((errors) => {
  4345. errors = errors.filter(Boolean);
  4346. if (errors.length) {
  4347. reject(errors);
  4348. } else {
  4349. resolve();
  4350. }
  4351. });
  4352. });
  4353. const validateField = (name2) => {
  4354. const matched = children.find((item) => item.name === name2);
  4355. if (matched) {
  4356. return new Promise((resolve, reject) => {
  4357. matched.validate().then((error) => {
  4358. if (error) {
  4359. reject(error);
  4360. } else {
  4361. resolve();
  4362. }
  4363. });
  4364. });
  4365. }
  4366. return Promise.reject();
  4367. };
  4368. const validate = (name2) => {
  4369. if (typeof name2 === "string") {
  4370. return validateField(name2);
  4371. }
  4372. return props2.validateFirst ? validateSeq(name2) : validateAll(name2);
  4373. };
  4374. const resetValidation = (name2) => {
  4375. if (typeof name2 === "string") {
  4376. name2 = [name2];
  4377. }
  4378. const fields = getFieldsByNames(name2);
  4379. fields.forEach((item) => {
  4380. item.resetValidation();
  4381. });
  4382. };
  4383. const getValidationStatus = () => children.reduce((form, field) => {
  4384. form[field.name] = field.getValidationStatus();
  4385. return form;
  4386. }, {});
  4387. const scrollToField = (name2, options) => {
  4388. children.some((item) => {
  4389. if (item.name === name2) {
  4390. item.$el.scrollIntoView(options);
  4391. return true;
  4392. }
  4393. return false;
  4394. });
  4395. };
  4396. const getValues = () => children.reduce((form, field) => {
  4397. if (field.name !== void 0) {
  4398. form[field.name] = field.formValue.value;
  4399. }
  4400. return form;
  4401. }, {});
  4402. const submit = () => {
  4403. const values = getValues();
  4404. validate().then(() => emit("submit", values)).catch((errors) => {
  4405. emit("failed", {
  4406. values,
  4407. errors
  4408. });
  4409. const {
  4410. scrollToError,
  4411. scrollToErrorPosition
  4412. } = props2;
  4413. if (scrollToError && errors[0].name) {
  4414. scrollToField(errors[0].name, scrollToErrorPosition ? {
  4415. block: scrollToErrorPosition
  4416. } : void 0);
  4417. }
  4418. });
  4419. };
  4420. const onSubmit = (event) => {
  4421. preventDefault(event);
  4422. submit();
  4423. };
  4424. linkChildren({
  4425. props: props2
  4426. });
  4427. useExpose({
  4428. submit,
  4429. validate,
  4430. getValues,
  4431. scrollToField,
  4432. resetValidation,
  4433. getValidationStatus
  4434. });
  4435. return () => {
  4436. var _a;
  4437. return vue.createVNode("form", {
  4438. "class": bem$1i(),
  4439. "onSubmit": onSubmit
  4440. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  4441. };
  4442. }
  4443. });
  4444. const Form = withInstall(stdin_default$1w);
  4445. function isEmptyValue(value) {
  4446. if (Array.isArray(value)) {
  4447. return !value.length;
  4448. }
  4449. if (value === 0) {
  4450. return false;
  4451. }
  4452. return !value;
  4453. }
  4454. function runSyncRule(value, rule) {
  4455. if (isEmptyValue(value)) {
  4456. if (rule.required) {
  4457. return false;
  4458. }
  4459. if (rule.validateEmpty === false) {
  4460. return true;
  4461. }
  4462. }
  4463. if (rule.pattern && !rule.pattern.test(String(value))) {
  4464. return false;
  4465. }
  4466. return true;
  4467. }
  4468. function runRuleValidator(value, rule) {
  4469. return new Promise((resolve) => {
  4470. const returnVal = rule.validator(value, rule);
  4471. if (isPromise(returnVal)) {
  4472. returnVal.then(resolve);
  4473. return;
  4474. }
  4475. resolve(returnVal);
  4476. });
  4477. }
  4478. function getRuleMessage(value, rule) {
  4479. const { message } = rule;
  4480. if (isFunction(message)) {
  4481. return message(value, rule);
  4482. }
  4483. return message || "";
  4484. }
  4485. function startComposing({ target }) {
  4486. target.composing = true;
  4487. }
  4488. function endComposing({ target }) {
  4489. if (target.composing) {
  4490. target.composing = false;
  4491. target.dispatchEvent(new Event("input"));
  4492. }
  4493. }
  4494. function resizeTextarea(input, autosize) {
  4495. const scrollTop = getRootScrollTop();
  4496. input.style.height = "auto";
  4497. let height2 = input.scrollHeight;
  4498. if (isObject$1(autosize)) {
  4499. const { maxHeight, minHeight } = autosize;
  4500. if (maxHeight !== void 0) {
  4501. height2 = Math.min(height2, maxHeight);
  4502. }
  4503. if (minHeight !== void 0) {
  4504. height2 = Math.max(height2, minHeight);
  4505. }
  4506. }
  4507. if (height2) {
  4508. input.style.height = `${height2}px`;
  4509. setRootScrollTop(scrollTop);
  4510. }
  4511. }
  4512. function mapInputType(type, inputmode) {
  4513. if (type === "number") {
  4514. type = "text";
  4515. inputmode != null ? inputmode : inputmode = "decimal";
  4516. }
  4517. if (type === "digit") {
  4518. type = "tel";
  4519. inputmode != null ? inputmode : inputmode = "numeric";
  4520. }
  4521. return { type, inputmode };
  4522. }
  4523. function getStringLength(str) {
  4524. return [...str].length;
  4525. }
  4526. function cutString(str, maxlength) {
  4527. return [...str].slice(0, maxlength).join("");
  4528. }
  4529. const [name$1l, bem$1h] = createNamespace("field");
  4530. const fieldSharedProps = {
  4531. id: String,
  4532. name: String,
  4533. leftIcon: String,
  4534. rightIcon: String,
  4535. autofocus: Boolean,
  4536. clearable: Boolean,
  4537. maxlength: numericProp,
  4538. max: Number,
  4539. min: Number,
  4540. formatter: Function,
  4541. clearIcon: makeStringProp("clear"),
  4542. modelValue: makeNumericProp(""),
  4543. inputAlign: String,
  4544. placeholder: String,
  4545. autocomplete: String,
  4546. autocapitalize: String,
  4547. autocorrect: String,
  4548. errorMessage: String,
  4549. enterkeyhint: String,
  4550. clearTrigger: makeStringProp("focus"),
  4551. formatTrigger: makeStringProp("onChange"),
  4552. spellcheck: {
  4553. type: Boolean,
  4554. default: null
  4555. },
  4556. error: {
  4557. type: Boolean,
  4558. default: null
  4559. },
  4560. disabled: {
  4561. type: Boolean,
  4562. default: null
  4563. },
  4564. readonly: {
  4565. type: Boolean,
  4566. default: null
  4567. },
  4568. inputmode: String
  4569. };
  4570. const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
  4571. rows: numericProp,
  4572. type: makeStringProp("text"),
  4573. rules: Array,
  4574. autosize: [Boolean, Object],
  4575. labelWidth: numericProp,
  4576. labelClass: unknownProp,
  4577. labelAlign: String,
  4578. showWordLimit: Boolean,
  4579. errorMessageAlign: String,
  4580. colon: {
  4581. type: Boolean,
  4582. default: null
  4583. }
  4584. });
  4585. var stdin_default$1v = vue.defineComponent({
  4586. name: name$1l,
  4587. props: fieldProps,
  4588. emits: ["blur", "focus", "clear", "keypress", "clickInput", "endValidate", "startValidate", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
  4589. setup(props2, {
  4590. emit,
  4591. slots
  4592. }) {
  4593. const id = useId();
  4594. const state = vue.reactive({
  4595. status: "unvalidated",
  4596. focused: false,
  4597. validateMessage: ""
  4598. });
  4599. const inputRef = vue.ref();
  4600. const clearIconRef = vue.ref();
  4601. const customValue = vue.ref();
  4602. const {
  4603. parent: form
  4604. } = useParent(FORM_KEY);
  4605. const getModelValue = () => {
  4606. var _a;
  4607. return String((_a = props2.modelValue) != null ? _a : "");
  4608. };
  4609. const getProp = (key) => {
  4610. if (isDef(props2[key])) {
  4611. return props2[key];
  4612. }
  4613. if (form && isDef(form.props[key])) {
  4614. return form.props[key];
  4615. }
  4616. };
  4617. const showClear = vue.computed(() => {
  4618. const readonly = getProp("readonly");
  4619. if (props2.clearable && !readonly) {
  4620. const hasValue = getModelValue() !== "";
  4621. const trigger = props2.clearTrigger === "always" || props2.clearTrigger === "focus" && state.focused;
  4622. return hasValue && trigger;
  4623. }
  4624. return false;
  4625. });
  4626. const formValue = vue.computed(() => {
  4627. if (customValue.value && slots.input) {
  4628. return customValue.value();
  4629. }
  4630. return props2.modelValue;
  4631. });
  4632. const showRequiredMark = vue.computed(() => {
  4633. var _a;
  4634. const required = getProp("required");
  4635. if (required === "auto") {
  4636. return (_a = props2.rules) == null ? void 0 : _a.some((rule) => rule.required);
  4637. }
  4638. return required;
  4639. });
  4640. const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
  4641. if (state.status === "failed") {
  4642. return;
  4643. }
  4644. let {
  4645. value
  4646. } = formValue;
  4647. if (rule.formatter) {
  4648. value = rule.formatter(value, rule);
  4649. }
  4650. if (!runSyncRule(value, rule)) {
  4651. state.status = "failed";
  4652. state.validateMessage = getRuleMessage(value, rule);
  4653. return;
  4654. }
  4655. if (rule.validator) {
  4656. if (isEmptyValue(value) && rule.validateEmpty === false) {
  4657. return;
  4658. }
  4659. return runRuleValidator(value, rule).then((result) => {
  4660. if (result && typeof result === "string") {
  4661. state.status = "failed";
  4662. state.validateMessage = result;
  4663. } else if (result === false) {
  4664. state.status = "failed";
  4665. state.validateMessage = getRuleMessage(value, rule);
  4666. }
  4667. });
  4668. }
  4669. }), Promise.resolve());
  4670. const resetValidation = () => {
  4671. state.status = "unvalidated";
  4672. state.validateMessage = "";
  4673. };
  4674. const endValidate = () => emit("endValidate", {
  4675. status: state.status,
  4676. message: state.validateMessage
  4677. });
  4678. const validate = (rules = props2.rules) => new Promise((resolve) => {
  4679. resetValidation();
  4680. if (rules) {
  4681. emit("startValidate");
  4682. runRules(rules).then(() => {
  4683. if (state.status === "failed") {
  4684. resolve({
  4685. name: props2.name,
  4686. message: state.validateMessage
  4687. });
  4688. endValidate();
  4689. } else {
  4690. state.status = "passed";
  4691. resolve();
  4692. endValidate();
  4693. }
  4694. });
  4695. } else {
  4696. resolve();
  4697. }
  4698. });
  4699. const validateWithTrigger = (trigger) => {
  4700. if (form && props2.rules) {
  4701. const {
  4702. validateTrigger
  4703. } = form.props;
  4704. const defaultTrigger = toArray(validateTrigger).includes(trigger);
  4705. const rules = props2.rules.filter((rule) => {
  4706. if (rule.trigger) {
  4707. return toArray(rule.trigger).includes(trigger);
  4708. }
  4709. return defaultTrigger;
  4710. });
  4711. if (rules.length) {
  4712. validate(rules);
  4713. }
  4714. }
  4715. };
  4716. const limitValueLength = (value) => {
  4717. var _a;
  4718. const {
  4719. maxlength
  4720. } = props2;
  4721. if (isDef(maxlength) && getStringLength(value) > +maxlength) {
  4722. const modelValue = getModelValue();
  4723. if (modelValue && getStringLength(modelValue) === +maxlength) {
  4724. return modelValue;
  4725. }
  4726. const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
  4727. if (state.focused && selectionEnd) {
  4728. const valueArr = [...value];
  4729. const exceededLength = valueArr.length - +maxlength;
  4730. valueArr.splice(selectionEnd - exceededLength, exceededLength);
  4731. return valueArr.join("");
  4732. }
  4733. return cutString(value, +maxlength);
  4734. }
  4735. return value;
  4736. };
  4737. const updateValue = (value, trigger = "onChange") => {
  4738. var _a, _b;
  4739. const originalValue = value;
  4740. value = limitValueLength(value);
  4741. const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
  4742. if (props2.type === "number" || props2.type === "digit") {
  4743. const isNumber = props2.type === "number";
  4744. value = formatNumber(value, isNumber, isNumber);
  4745. if (trigger === "onBlur" && value !== "" && (props2.min !== void 0 || props2.max !== void 0)) {
  4746. const adjustedValue = clamp(+value, (_a = props2.min) != null ? _a : -Infinity, (_b = props2.max) != null ? _b : Infinity);
  4747. value = adjustedValue.toString();
  4748. }
  4749. }
  4750. let formatterDiffLen = 0;
  4751. if (props2.formatter && trigger === props2.formatTrigger) {
  4752. const {
  4753. formatter,
  4754. maxlength
  4755. } = props2;
  4756. value = formatter(value);
  4757. if (isDef(maxlength) && getStringLength(value) > +maxlength) {
  4758. value = cutString(value, +maxlength);
  4759. }
  4760. if (inputRef.value && state.focused) {
  4761. const {
  4762. selectionEnd
  4763. } = inputRef.value;
  4764. const bcoVal = cutString(originalValue, selectionEnd);
  4765. formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
  4766. }
  4767. }
  4768. if (inputRef.value && inputRef.value.value !== value) {
  4769. if (state.focused) {
  4770. let {
  4771. selectionStart,
  4772. selectionEnd
  4773. } = inputRef.value;
  4774. inputRef.value.value = value;
  4775. if (isDef(selectionStart) && isDef(selectionEnd)) {
  4776. const valueLen = getStringLength(value);
  4777. if (limitDiffLen) {
  4778. selectionStart -= limitDiffLen;
  4779. selectionEnd -= limitDiffLen;
  4780. } else if (formatterDiffLen) {
  4781. selectionStart += formatterDiffLen;
  4782. selectionEnd += formatterDiffLen;
  4783. }
  4784. inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
  4785. }
  4786. } else {
  4787. inputRef.value.value = value;
  4788. }
  4789. }
  4790. if (value !== props2.modelValue) {
  4791. emit("update:modelValue", value);
  4792. }
  4793. };
  4794. const onInput = (event) => {
  4795. if (!event.target.composing) {
  4796. updateValue(event.target.value);
  4797. }
  4798. };
  4799. const blur = () => {
  4800. var _a;
  4801. return (_a = inputRef.value) == null ? void 0 : _a.blur();
  4802. };
  4803. const focus = () => {
  4804. var _a;
  4805. return (_a = inputRef.value) == null ? void 0 : _a.focus();
  4806. };
  4807. const adjustTextareaSize = () => {
  4808. const input = inputRef.value;
  4809. if (props2.type === "textarea" && props2.autosize && input) {
  4810. resizeTextarea(input, props2.autosize);
  4811. }
  4812. };
  4813. const onFocus = (event) => {
  4814. state.focused = true;
  4815. emit("focus", event);
  4816. vue.nextTick(adjustTextareaSize);
  4817. if (getProp("readonly")) {
  4818. blur();
  4819. }
  4820. };
  4821. const onBlur = (event) => {
  4822. state.focused = false;
  4823. updateValue(getModelValue(), "onBlur");
  4824. emit("blur", event);
  4825. if (getProp("readonly")) {
  4826. return;
  4827. }
  4828. validateWithTrigger("onBlur");
  4829. vue.nextTick(adjustTextareaSize);
  4830. resetScroll();
  4831. };
  4832. const onClickInput = (event) => emit("clickInput", event);
  4833. const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
  4834. const onClickRightIcon = (event) => emit("clickRightIcon", event);
  4835. const onClear = (event) => {
  4836. preventDefault(event);
  4837. emit("update:modelValue", "");
  4838. emit("clear", event);
  4839. };
  4840. const showError = vue.computed(() => {
  4841. if (typeof props2.error === "boolean") {
  4842. return props2.error;
  4843. }
  4844. if (form && form.props.showError && state.status === "failed") {
  4845. return true;
  4846. }
  4847. });
  4848. const labelStyle = vue.computed(() => {
  4849. const labelWidth = getProp("labelWidth");
  4850. const labelAlign = getProp("labelAlign");
  4851. if (labelWidth && labelAlign !== "top") {
  4852. return {
  4853. width: addUnit(labelWidth)
  4854. };
  4855. }
  4856. });
  4857. const onKeypress = (event) => {
  4858. const ENTER_CODE = 13;
  4859. if (event.keyCode === ENTER_CODE) {
  4860. const submitOnEnter = form && form.props.submitOnEnter;
  4861. if (!submitOnEnter && props2.type !== "textarea") {
  4862. preventDefault(event);
  4863. }
  4864. if (props2.type === "search") {
  4865. blur();
  4866. }
  4867. }
  4868. emit("keypress", event);
  4869. };
  4870. const getInputId = () => props2.id || `${id}-input`;
  4871. const getValidationStatus = () => state.status;
  4872. const renderInput = () => {
  4873. const controlClass = bem$1h("control", [getProp("inputAlign"), {
  4874. error: showError.value,
  4875. custom: !!slots.input,
  4876. "min-height": props2.type === "textarea" && !props2.autosize
  4877. }]);
  4878. if (slots.input) {
  4879. return vue.createVNode("div", {
  4880. "class": controlClass,
  4881. "onClick": onClickInput
  4882. }, [slots.input()]);
  4883. }
  4884. const inputAttrs = {
  4885. id: getInputId(),
  4886. ref: inputRef,
  4887. name: props2.name,
  4888. rows: props2.rows !== void 0 ? +props2.rows : void 0,
  4889. class: controlClass,
  4890. disabled: getProp("disabled"),
  4891. readonly: getProp("readonly"),
  4892. autofocus: props2.autofocus,
  4893. placeholder: props2.placeholder,
  4894. autocomplete: props2.autocomplete,
  4895. autocapitalize: props2.autocapitalize,
  4896. autocorrect: props2.autocorrect,
  4897. enterkeyhint: props2.enterkeyhint,
  4898. spellcheck: props2.spellcheck,
  4899. "aria-labelledby": props2.label ? `${id}-label` : void 0,
  4900. "data-allow-mismatch": "attribute",
  4901. onBlur,
  4902. onFocus,
  4903. onInput,
  4904. onClick: onClickInput,
  4905. onChange: endComposing,
  4906. onKeypress,
  4907. onCompositionend: endComposing,
  4908. onCompositionstart: startComposing
  4909. };
  4910. if (props2.type === "textarea") {
  4911. return vue.createVNode("textarea", vue.mergeProps(inputAttrs, {
  4912. "inputmode": props2.inputmode
  4913. }), null);
  4914. }
  4915. return vue.createVNode("input", vue.mergeProps(mapInputType(props2.type, props2.inputmode), inputAttrs), null);
  4916. };
  4917. const renderLeftIcon = () => {
  4918. const leftIconSlot = slots["left-icon"];
  4919. if (props2.leftIcon || leftIconSlot) {
  4920. return vue.createVNode("div", {
  4921. "class": bem$1h("left-icon"),
  4922. "onClick": onClickLeftIcon
  4923. }, [leftIconSlot ? leftIconSlot() : vue.createVNode(Icon, {
  4924. "name": props2.leftIcon,
  4925. "classPrefix": props2.iconPrefix
  4926. }, null)]);
  4927. }
  4928. };
  4929. const renderRightIcon = () => {
  4930. const rightIconSlot = slots["right-icon"];
  4931. if (props2.rightIcon || rightIconSlot) {
  4932. return vue.createVNode("div", {
  4933. "class": bem$1h("right-icon"),
  4934. "onClick": onClickRightIcon
  4935. }, [rightIconSlot ? rightIconSlot() : vue.createVNode(Icon, {
  4936. "name": props2.rightIcon,
  4937. "classPrefix": props2.iconPrefix
  4938. }, null)]);
  4939. }
  4940. };
  4941. const renderWordLimit = () => {
  4942. if (props2.showWordLimit && props2.maxlength) {
  4943. const count = getStringLength(getModelValue());
  4944. return vue.createVNode("div", {
  4945. "class": bem$1h("word-limit")
  4946. }, [vue.createVNode("span", {
  4947. "class": bem$1h("word-num")
  4948. }, [count]), vue.createTextVNode("/"), props2.maxlength]);
  4949. }
  4950. };
  4951. const renderMessage = () => {
  4952. if (form && form.props.showErrorMessage === false) {
  4953. return;
  4954. }
  4955. const message = props2.errorMessage || state.validateMessage;
  4956. if (message) {
  4957. const slot = slots["error-message"];
  4958. const errorMessageAlign = getProp("errorMessageAlign");
  4959. return vue.createVNode("div", {
  4960. "class": bem$1h("error-message", errorMessageAlign)
  4961. }, [slot ? slot({
  4962. message
  4963. }) : message]);
  4964. }
  4965. };
  4966. const renderLabel = () => {
  4967. const labelWidth = getProp("labelWidth");
  4968. const labelAlign = getProp("labelAlign");
  4969. const colon = getProp("colon") ? ":" : "";
  4970. if (slots.label) {
  4971. return [slots.label(), colon];
  4972. }
  4973. if (props2.label) {
  4974. return vue.createVNode("label", {
  4975. "id": `${id}-label`,
  4976. "for": slots.input ? void 0 : getInputId(),
  4977. "data-allow-mismatch": "attribute",
  4978. "onClick": (event) => {
  4979. preventDefault(event);
  4980. focus();
  4981. },
  4982. "style": labelAlign === "top" && labelWidth ? {
  4983. width: addUnit(labelWidth)
  4984. } : void 0
  4985. }, [props2.label + colon]);
  4986. }
  4987. };
  4988. const renderFieldBody = () => [vue.createVNode("div", {
  4989. "class": bem$1h("body")
  4990. }, [renderInput(), showClear.value && vue.createVNode(Icon, {
  4991. "ref": clearIconRef,
  4992. "name": props2.clearIcon,
  4993. "class": bem$1h("clear")
  4994. }, null), renderRightIcon(), slots.button && vue.createVNode("div", {
  4995. "class": bem$1h("button")
  4996. }, [slots.button()])]), renderWordLimit(), renderMessage()];
  4997. useExpose({
  4998. blur,
  4999. focus,
  5000. validate,
  5001. formValue,
  5002. resetValidation,
  5003. getValidationStatus
  5004. });
  5005. vue.provide(CUSTOM_FIELD_INJECTION_KEY, {
  5006. customValue,
  5007. resetValidation,
  5008. validateWithTrigger
  5009. });
  5010. vue.watch(() => props2.modelValue, () => {
  5011. updateValue(getModelValue());
  5012. resetValidation();
  5013. validateWithTrigger("onChange");
  5014. vue.nextTick(adjustTextareaSize);
  5015. });
  5016. vue.onMounted(() => {
  5017. updateValue(getModelValue(), props2.formatTrigger);
  5018. vue.nextTick(adjustTextareaSize);
  5019. });
  5020. useEventListener("touchstart", onClear, {
  5021. target: vue.computed(() => {
  5022. var _a;
  5023. return (_a = clearIconRef.value) == null ? void 0 : _a.$el;
  5024. })
  5025. });
  5026. return () => {
  5027. const disabled = getProp("disabled");
  5028. const labelAlign = getProp("labelAlign");
  5029. const LeftIcon = renderLeftIcon();
  5030. const renderTitle = () => {
  5031. const Label = renderLabel();
  5032. if (labelAlign === "top") {
  5033. return [LeftIcon, Label].filter(Boolean);
  5034. }
  5035. return Label || [];
  5036. };
  5037. return vue.createVNode(Cell, {
  5038. "size": props2.size,
  5039. "class": bem$1h({
  5040. error: showError.value,
  5041. disabled,
  5042. [`label-${labelAlign}`]: labelAlign
  5043. }),
  5044. "center": props2.center,
  5045. "border": props2.border,
  5046. "isLink": props2.isLink,
  5047. "clickable": props2.clickable,
  5048. "titleStyle": labelStyle.value,
  5049. "valueClass": bem$1h("value"),
  5050. "titleClass": [bem$1h("label", [labelAlign, {
  5051. required: showRequiredMark.value
  5052. }]), props2.labelClass],
  5053. "arrowDirection": props2.arrowDirection
  5054. }, {
  5055. icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
  5056. title: renderTitle,
  5057. value: renderFieldBody,
  5058. extra: slots.extra
  5059. });
  5060. };
  5061. }
  5062. });
  5063. const Field = withInstall(stdin_default$1v);
  5064. let lockCount = 0;
  5065. function lockClick(lock) {
  5066. if (lock) {
  5067. if (!lockCount) {
  5068. document.body.classList.add("van-toast--unclickable");
  5069. }
  5070. lockCount++;
  5071. } else if (lockCount) {
  5072. lockCount--;
  5073. if (!lockCount) {
  5074. document.body.classList.remove("van-toast--unclickable");
  5075. }
  5076. }
  5077. }
  5078. const [name$1k, bem$1g] = createNamespace("toast");
  5079. const popupInheritProps$1 = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay", "zIndex"];
  5080. const toastProps = {
  5081. icon: String,
  5082. show: Boolean,
  5083. type: makeStringProp("text"),
  5084. overlay: Boolean,
  5085. message: numericProp,
  5086. iconSize: numericProp,
  5087. duration: makeNumberProp(2e3),
  5088. position: makeStringProp("middle"),
  5089. teleport: [String, Object],
  5090. wordBreak: String,
  5091. className: unknownProp,
  5092. iconPrefix: String,
  5093. transition: makeStringProp("van-fade"),
  5094. loadingType: String,
  5095. forbidClick: Boolean,
  5096. overlayClass: unknownProp,
  5097. overlayStyle: Object,
  5098. closeOnClick: Boolean,
  5099. closeOnClickOverlay: Boolean,
  5100. zIndex: numericProp
  5101. };
  5102. var stdin_default$1u = vue.defineComponent({
  5103. name: name$1k,
  5104. props: toastProps,
  5105. emits: ["update:show"],
  5106. setup(props2, {
  5107. emit,
  5108. slots
  5109. }) {
  5110. let timer2;
  5111. let clickable = false;
  5112. const toggleClickable = () => {
  5113. const newValue = props2.show && props2.forbidClick;
  5114. if (clickable !== newValue) {
  5115. clickable = newValue;
  5116. lockClick(clickable);
  5117. }
  5118. };
  5119. const updateShow = (show) => emit("update:show", show);
  5120. const onClick = () => {
  5121. if (props2.closeOnClick) {
  5122. updateShow(false);
  5123. }
  5124. };
  5125. const clearTimer = () => clearTimeout(timer2);
  5126. const renderIcon = () => {
  5127. const {
  5128. icon,
  5129. type,
  5130. iconSize,
  5131. iconPrefix,
  5132. loadingType
  5133. } = props2;
  5134. const hasIcon = icon || type === "success" || type === "fail";
  5135. if (hasIcon) {
  5136. return vue.createVNode(Icon, {
  5137. "name": icon || type,
  5138. "size": iconSize,
  5139. "class": bem$1g("icon"),
  5140. "classPrefix": iconPrefix
  5141. }, null);
  5142. }
  5143. if (type === "loading") {
  5144. return vue.createVNode(Loading, {
  5145. "class": bem$1g("loading"),
  5146. "size": iconSize,
  5147. "type": loadingType
  5148. }, null);
  5149. }
  5150. };
  5151. const renderMessage = () => {
  5152. const {
  5153. type,
  5154. message
  5155. } = props2;
  5156. if (slots.message) {
  5157. return vue.createVNode("div", {
  5158. "class": bem$1g("text")
  5159. }, [slots.message()]);
  5160. }
  5161. if (isDef(message) && message !== "") {
  5162. return type === "html" ? vue.createVNode("div", {
  5163. "key": 0,
  5164. "class": bem$1g("text"),
  5165. "innerHTML": String(message)
  5166. }, null) : vue.createVNode("div", {
  5167. "class": bem$1g("text")
  5168. }, [message]);
  5169. }
  5170. };
  5171. vue.watch(() => [props2.show, props2.forbidClick], toggleClickable);
  5172. vue.watch(() => [props2.show, props2.type, props2.message, props2.duration], () => {
  5173. clearTimer();
  5174. if (props2.show && props2.duration > 0) {
  5175. timer2 = setTimeout(() => {
  5176. updateShow(false);
  5177. }, props2.duration);
  5178. }
  5179. });
  5180. vue.onMounted(toggleClickable);
  5181. vue.onUnmounted(toggleClickable);
  5182. return () => vue.createVNode(Popup, vue.mergeProps({
  5183. "class": [bem$1g([props2.position, props2.wordBreak === "normal" ? "break-normal" : props2.wordBreak, {
  5184. [props2.type]: !props2.icon
  5185. }]), props2.className],
  5186. "lockScroll": false,
  5187. "onClick": onClick,
  5188. "onClosed": clearTimer,
  5189. "onUpdate:show": updateShow
  5190. }, pick(props2, popupInheritProps$1)), {
  5191. default: () => [renderIcon(), renderMessage()]
  5192. });
  5193. }
  5194. });
  5195. function usePopupState() {
  5196. const state = vue.reactive({
  5197. show: false
  5198. });
  5199. const toggle = (show) => {
  5200. state.show = show;
  5201. };
  5202. const open = (props2) => {
  5203. extend(state, props2, { transitionAppear: true });
  5204. toggle(true);
  5205. };
  5206. const close = () => toggle(false);
  5207. useExpose({ open, close, toggle });
  5208. return {
  5209. open,
  5210. close,
  5211. state,
  5212. toggle
  5213. };
  5214. }
  5215. function mountComponent(RootComponent) {
  5216. const app = vue.createApp(RootComponent);
  5217. const root = document.createElement("div");
  5218. document.body.appendChild(root);
  5219. return {
  5220. instance: app.mount(root),
  5221. unmount() {
  5222. app.unmount();
  5223. document.body.removeChild(root);
  5224. }
  5225. };
  5226. }
  5227. const defaultOptions$1 = {
  5228. icon: "",
  5229. type: "text",
  5230. message: "",
  5231. className: "",
  5232. overlay: false,
  5233. onClose: void 0,
  5234. onOpened: void 0,
  5235. duration: 2e3,
  5236. teleport: "body",
  5237. iconSize: void 0,
  5238. iconPrefix: void 0,
  5239. position: "middle",
  5240. transition: "van-fade",
  5241. forbidClick: false,
  5242. loadingType: void 0,
  5243. overlayClass: "",
  5244. overlayStyle: void 0,
  5245. closeOnClick: false,
  5246. closeOnClickOverlay: false
  5247. };
  5248. let queue = [];
  5249. let allowMultiple = false;
  5250. let currentOptions$2 = extend({}, defaultOptions$1);
  5251. const defaultOptionsMap = /* @__PURE__ */ new Map();
  5252. function parseOptions$1(message) {
  5253. if (isObject$1(message)) {
  5254. return message;
  5255. }
  5256. return {
  5257. message
  5258. };
  5259. }
  5260. function createInstance() {
  5261. const {
  5262. instance: instance2,
  5263. unmount
  5264. } = mountComponent({
  5265. setup() {
  5266. const message = vue.ref("");
  5267. const {
  5268. open,
  5269. state,
  5270. close,
  5271. toggle
  5272. } = usePopupState();
  5273. const onClosed = () => {
  5274. if (allowMultiple) {
  5275. queue = queue.filter((item) => item !== instance2);
  5276. unmount();
  5277. }
  5278. };
  5279. const render = () => {
  5280. const attrs = {
  5281. onClosed,
  5282. "onUpdate:show": toggle
  5283. };
  5284. return vue.createVNode(stdin_default$1u, vue.mergeProps(state, attrs), null);
  5285. };
  5286. vue.watch(message, (val) => {
  5287. state.message = val;
  5288. });
  5289. vue.getCurrentInstance().render = render;
  5290. return {
  5291. open,
  5292. close,
  5293. message
  5294. };
  5295. }
  5296. });
  5297. return instance2;
  5298. }
  5299. function getInstance() {
  5300. if (!queue.length || allowMultiple) {
  5301. const instance2 = createInstance();
  5302. queue.push(instance2);
  5303. }
  5304. return queue[queue.length - 1];
  5305. }
  5306. function showToast(options = {}) {
  5307. if (!inBrowser$1) {
  5308. return {};
  5309. }
  5310. const toast = getInstance();
  5311. const parsedOptions = parseOptions$1(options);
  5312. toast.open(extend({}, currentOptions$2, defaultOptionsMap.get(parsedOptions.type || currentOptions$2.type), parsedOptions));
  5313. return toast;
  5314. }
  5315. const createMethod = (type) => (options) => showToast(extend({
  5316. type
  5317. }, parseOptions$1(options)));
  5318. const showLoadingToast = createMethod("loading");
  5319. const showSuccessToast = createMethod("success");
  5320. const showFailToast = createMethod("fail");
  5321. const closeToast = (all) => {
  5322. var _a;
  5323. if (queue.length) {
  5324. if (all) {
  5325. queue.forEach((toast) => {
  5326. toast.close();
  5327. });
  5328. queue = [];
  5329. } else if (!allowMultiple) {
  5330. queue[0].close();
  5331. } else {
  5332. (_a = queue.shift()) == null ? void 0 : _a.close();
  5333. }
  5334. }
  5335. };
  5336. function setToastDefaultOptions(type, options) {
  5337. if (typeof type === "string") {
  5338. defaultOptionsMap.set(type, options);
  5339. } else {
  5340. extend(currentOptions$2, type);
  5341. }
  5342. }
  5343. const resetToastDefaultOptions = (type) => {
  5344. if (typeof type === "string") {
  5345. defaultOptionsMap.delete(type);
  5346. } else {
  5347. currentOptions$2 = extend({}, defaultOptions$1);
  5348. defaultOptionsMap.clear();
  5349. }
  5350. };
  5351. const allowMultipleToast = (value = true) => {
  5352. allowMultiple = value;
  5353. };
  5354. const Toast = withInstall(stdin_default$1u);
  5355. const [name$1j, bem$1f] = createNamespace("switch");
  5356. const switchProps = {
  5357. size: numericProp,
  5358. loading: Boolean,
  5359. disabled: Boolean,
  5360. modelValue: unknownProp,
  5361. activeColor: String,
  5362. inactiveColor: String,
  5363. activeValue: {
  5364. type: unknownProp,
  5365. default: true
  5366. },
  5367. inactiveValue: {
  5368. type: unknownProp,
  5369. default: false
  5370. }
  5371. };
  5372. var stdin_default$1t = vue.defineComponent({
  5373. name: name$1j,
  5374. props: switchProps,
  5375. emits: ["change", "update:modelValue"],
  5376. setup(props2, {
  5377. emit,
  5378. slots
  5379. }) {
  5380. const isChecked = () => props2.modelValue === props2.activeValue;
  5381. const onClick = () => {
  5382. if (!props2.disabled && !props2.loading) {
  5383. const newValue = isChecked() ? props2.inactiveValue : props2.activeValue;
  5384. emit("update:modelValue", newValue);
  5385. emit("change", newValue);
  5386. }
  5387. };
  5388. const renderLoading = () => {
  5389. if (props2.loading) {
  5390. const color = isChecked() ? props2.activeColor : props2.inactiveColor;
  5391. return vue.createVNode(Loading, {
  5392. "class": bem$1f("loading"),
  5393. "color": color
  5394. }, null);
  5395. }
  5396. if (slots.node) {
  5397. return slots.node();
  5398. }
  5399. };
  5400. useCustomFieldValue(() => props2.modelValue);
  5401. return () => {
  5402. var _a;
  5403. const {
  5404. size,
  5405. loading,
  5406. disabled,
  5407. activeColor,
  5408. inactiveColor
  5409. } = props2;
  5410. const checked = isChecked();
  5411. const style = {
  5412. fontSize: addUnit(size),
  5413. backgroundColor: checked ? activeColor : inactiveColor
  5414. };
  5415. return vue.createVNode("div", {
  5416. "role": "switch",
  5417. "class": bem$1f({
  5418. on: checked,
  5419. loading,
  5420. disabled
  5421. }),
  5422. "style": style,
  5423. "tabindex": disabled ? void 0 : 0,
  5424. "aria-checked": checked,
  5425. "onClick": onClick
  5426. }, [vue.createVNode("div", {
  5427. "class": bem$1f("node")
  5428. }, [renderLoading()]), (_a = slots.background) == null ? void 0 : _a.call(slots)]);
  5429. };
  5430. }
  5431. });
  5432. const Switch = withInstall(stdin_default$1t);
  5433. const [name$1i, bem$1e] = createNamespace("address-edit-detail");
  5434. const t$j = createNamespace("address-edit")[2];
  5435. var stdin_default$1s = vue.defineComponent({
  5436. name: name$1i,
  5437. props: {
  5438. show: Boolean,
  5439. rows: numericProp,
  5440. value: String,
  5441. rules: Array,
  5442. focused: Boolean,
  5443. maxlength: numericProp,
  5444. searchResult: Array,
  5445. showSearchResult: Boolean
  5446. },
  5447. emits: ["blur", "focus", "input", "selectSearch"],
  5448. setup(props2, {
  5449. emit
  5450. }) {
  5451. const field = vue.ref();
  5452. const showSearchResult = () => props2.focused && props2.searchResult && props2.showSearchResult;
  5453. const onSelect = (express) => {
  5454. emit("selectSearch", express);
  5455. emit("input", `${express.address || ""} ${express.name || ""}`.trim());
  5456. };
  5457. const renderSearchResult = () => {
  5458. if (!showSearchResult()) {
  5459. return;
  5460. }
  5461. const {
  5462. searchResult
  5463. } = props2;
  5464. return searchResult.map((express) => vue.createVNode(Cell, {
  5465. "clickable": true,
  5466. "key": (express.name || "") + (express.address || ""),
  5467. "icon": "location-o",
  5468. "title": express.name,
  5469. "label": express.address,
  5470. "class": bem$1e("search-item"),
  5471. "border": false,
  5472. "onClick": () => onSelect(express)
  5473. }, null));
  5474. };
  5475. const onBlur = (event) => emit("blur", event);
  5476. const onFocus = (event) => emit("focus", event);
  5477. const onInput = (value) => emit("input", value);
  5478. return () => {
  5479. if (props2.show) {
  5480. return vue.createVNode(vue.Fragment, null, [vue.createVNode(Field, {
  5481. "autosize": true,
  5482. "clearable": true,
  5483. "ref": field,
  5484. "class": bem$1e(),
  5485. "rows": props2.rows,
  5486. "type": "textarea",
  5487. "rules": props2.rules,
  5488. "label": t$j("addressDetail"),
  5489. "border": !showSearchResult(),
  5490. "maxlength": props2.maxlength,
  5491. "modelValue": props2.value,
  5492. "placeholder": t$j("addressDetail"),
  5493. "onBlur": onBlur,
  5494. "onFocus": onFocus,
  5495. "onUpdate:modelValue": onInput
  5496. }, null), renderSearchResult()]);
  5497. }
  5498. };
  5499. }
  5500. });
  5501. const [name$1h, bem$1d, t$i] = createNamespace("address-edit");
  5502. const DEFAULT_DATA = {
  5503. name: "",
  5504. tel: "",
  5505. city: "",
  5506. county: "",
  5507. country: "",
  5508. province: "",
  5509. areaCode: "",
  5510. isDefault: false,
  5511. addressDetail: ""
  5512. };
  5513. const addressEditProps = {
  5514. areaList: Object,
  5515. isSaving: Boolean,
  5516. isDeleting: Boolean,
  5517. validator: Function,
  5518. showArea: truthProp,
  5519. showDetail: truthProp,
  5520. showDelete: Boolean,
  5521. disableArea: Boolean,
  5522. searchResult: Array,
  5523. telMaxlength: numericProp,
  5524. showSetDefault: Boolean,
  5525. saveButtonText: String,
  5526. areaPlaceholder: String,
  5527. deleteButtonText: String,
  5528. showSearchResult: Boolean,
  5529. detailRows: makeNumericProp(1),
  5530. detailMaxlength: makeNumericProp(200),
  5531. areaColumnsPlaceholder: makeArrayProp(),
  5532. addressInfo: {
  5533. type: Object,
  5534. default: () => extend({}, DEFAULT_DATA)
  5535. },
  5536. telValidator: {
  5537. type: Function,
  5538. default: isMobile
  5539. }
  5540. };
  5541. var stdin_default$1r = vue.defineComponent({
  5542. name: name$1h,
  5543. props: addressEditProps,
  5544. emits: ["save", "focus", "change", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
  5545. setup(props2, {
  5546. emit,
  5547. slots
  5548. }) {
  5549. const areaRef = vue.ref();
  5550. const data = vue.reactive({});
  5551. const showAreaPopup = vue.ref(false);
  5552. const detailFocused = vue.ref(false);
  5553. const areaListLoaded = vue.computed(() => isObject$1(props2.areaList) && Object.keys(props2.areaList).length);
  5554. const areaText = vue.computed(() => {
  5555. const {
  5556. province,
  5557. city,
  5558. county,
  5559. areaCode
  5560. } = data;
  5561. if (areaCode) {
  5562. const arr = [province, city, county];
  5563. if (province && province === city) {
  5564. arr.splice(1, 1);
  5565. }
  5566. return arr.filter(Boolean).join("/");
  5567. }
  5568. return "";
  5569. });
  5570. const hideBottomFields = vue.computed(() => {
  5571. var _a;
  5572. return ((_a = props2.searchResult) == null ? void 0 : _a.length) && detailFocused.value;
  5573. });
  5574. const onFocus = (key) => {
  5575. detailFocused.value = key === "addressDetail";
  5576. emit("focus", key);
  5577. };
  5578. const onChange = (key, value) => {
  5579. emit("change", {
  5580. key,
  5581. value
  5582. });
  5583. };
  5584. const rules = vue.computed(() => {
  5585. const {
  5586. validator,
  5587. telValidator
  5588. } = props2;
  5589. const makeRule = (name2, emptyMessage) => ({
  5590. validator: (value) => {
  5591. if (validator) {
  5592. const message = validator(name2, value);
  5593. if (message) {
  5594. return message;
  5595. }
  5596. }
  5597. if (!value) {
  5598. return emptyMessage;
  5599. }
  5600. return true;
  5601. }
  5602. });
  5603. return {
  5604. name: [makeRule("name", t$i("nameEmpty"))],
  5605. tel: [makeRule("tel", t$i("telInvalid")), {
  5606. validator: telValidator,
  5607. message: t$i("telInvalid")
  5608. }],
  5609. areaCode: [makeRule("areaCode", t$i("areaEmpty"))],
  5610. addressDetail: [makeRule("addressDetail", t$i("addressEmpty"))]
  5611. };
  5612. });
  5613. const onSave = () => emit("save", data);
  5614. const onChangeDetail = (val) => {
  5615. data.addressDetail = val;
  5616. emit("changeDetail", val);
  5617. };
  5618. const assignAreaText = (options) => {
  5619. data.province = options[0].text;
  5620. data.city = options[1].text;
  5621. data.county = options[2].text;
  5622. };
  5623. const onAreaConfirm = ({
  5624. selectedValues,
  5625. selectedOptions
  5626. }) => {
  5627. if (selectedValues.some((value) => value === AREA_EMPTY_CODE)) {
  5628. showToast(t$i("areaEmpty"));
  5629. } else {
  5630. showAreaPopup.value = false;
  5631. assignAreaText(selectedOptions);
  5632. emit("changeArea", selectedOptions);
  5633. }
  5634. };
  5635. const onDelete = () => emit("delete", data);
  5636. const setAreaCode = (code) => {
  5637. data.areaCode = code || "";
  5638. };
  5639. const onDetailBlur = () => {
  5640. setTimeout(() => {
  5641. detailFocused.value = false;
  5642. });
  5643. };
  5644. const setAddressDetail = (value) => {
  5645. data.addressDetail = value;
  5646. };
  5647. const renderSetDefaultCell = () => {
  5648. if (props2.showSetDefault) {
  5649. const slots2 = {
  5650. "right-icon": () => vue.createVNode(Switch, {
  5651. "modelValue": data.isDefault,
  5652. "onUpdate:modelValue": ($event) => data.isDefault = $event,
  5653. "onChange": (event) => emit("changeDefault", event)
  5654. }, null)
  5655. };
  5656. return vue.withDirectives(vue.createVNode(Cell, {
  5657. "center": true,
  5658. "border": false,
  5659. "title": t$i("defaultAddress"),
  5660. "class": bem$1d("default")
  5661. }, slots2), [[vue.vShow, !hideBottomFields.value]]);
  5662. }
  5663. };
  5664. useExpose({
  5665. setAreaCode,
  5666. setAddressDetail
  5667. });
  5668. vue.watch(() => props2.addressInfo, (value) => {
  5669. extend(data, DEFAULT_DATA, value);
  5670. vue.nextTick(() => {
  5671. var _a;
  5672. const options = (_a = areaRef.value) == null ? void 0 : _a.getSelectedOptions();
  5673. if (options && options.every((option) => option && option.value !== AREA_EMPTY_CODE)) {
  5674. assignAreaText(options);
  5675. }
  5676. });
  5677. }, {
  5678. deep: true,
  5679. immediate: true
  5680. });
  5681. return () => {
  5682. const {
  5683. disableArea
  5684. } = props2;
  5685. return vue.createVNode(Form, {
  5686. "class": bem$1d(),
  5687. "onSubmit": onSave
  5688. }, {
  5689. default: () => {
  5690. var _a;
  5691. return [vue.createVNode("div", {
  5692. "class": bem$1d("fields")
  5693. }, [vue.createVNode(Field, {
  5694. "modelValue": data.name,
  5695. "onUpdate:modelValue": [($event) => data.name = $event, (val) => onChange("name", val)],
  5696. "clearable": true,
  5697. "label": t$i("name"),
  5698. "rules": rules.value.name,
  5699. "placeholder": t$i("name"),
  5700. "onFocus": () => onFocus("name")
  5701. }, null), vue.createVNode(Field, {
  5702. "modelValue": data.tel,
  5703. "onUpdate:modelValue": [($event) => data.tel = $event, (val) => onChange("tel", val)],
  5704. "clearable": true,
  5705. "type": "tel",
  5706. "label": t$i("tel"),
  5707. "rules": rules.value.tel,
  5708. "maxlength": props2.telMaxlength,
  5709. "placeholder": t$i("tel"),
  5710. "onFocus": () => onFocus("tel")
  5711. }, null), vue.withDirectives(vue.createVNode(Field, {
  5712. "readonly": true,
  5713. "label": t$i("area"),
  5714. "is-link": !disableArea,
  5715. "modelValue": areaText.value,
  5716. "rules": props2.showArea ? rules.value.areaCode : void 0,
  5717. "placeholder": props2.areaPlaceholder || t$i("area"),
  5718. "onFocus": () => onFocus("areaCode"),
  5719. "onClick": () => {
  5720. emit("clickArea");
  5721. showAreaPopup.value = !disableArea;
  5722. }
  5723. }, null), [[vue.vShow, props2.showArea]]), vue.createVNode(stdin_default$1s, {
  5724. "show": props2.showDetail,
  5725. "rows": props2.detailRows,
  5726. "rules": rules.value.addressDetail,
  5727. "value": data.addressDetail,
  5728. "focused": detailFocused.value,
  5729. "maxlength": props2.detailMaxlength,
  5730. "searchResult": props2.searchResult,
  5731. "showSearchResult": props2.showSearchResult,
  5732. "onBlur": onDetailBlur,
  5733. "onFocus": () => onFocus("addressDetail"),
  5734. "onInput": onChangeDetail,
  5735. "onSelectSearch": (event) => emit("selectSearch", event)
  5736. }, null), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderSetDefaultCell(), vue.withDirectives(vue.createVNode("div", {
  5737. "class": bem$1d("buttons")
  5738. }, [vue.createVNode(Button, {
  5739. "block": true,
  5740. "round": true,
  5741. "type": "primary",
  5742. "text": props2.saveButtonText || t$i("save"),
  5743. "class": bem$1d("button"),
  5744. "loading": props2.isSaving,
  5745. "nativeType": "submit"
  5746. }, null), props2.showDelete && vue.createVNode(Button, {
  5747. "block": true,
  5748. "round": true,
  5749. "class": bem$1d("button"),
  5750. "loading": props2.isDeleting,
  5751. "text": props2.deleteButtonText || t$i("delete"),
  5752. "onClick": onDelete
  5753. }, null)]), [[vue.vShow, !hideBottomFields.value]]), vue.createVNode(Popup, {
  5754. "show": showAreaPopup.value,
  5755. "onUpdate:show": ($event) => showAreaPopup.value = $event,
  5756. "round": true,
  5757. "teleport": "body",
  5758. "position": "bottom",
  5759. "lazyRender": false
  5760. }, {
  5761. default: () => [vue.createVNode(Area, {
  5762. "modelValue": data.areaCode,
  5763. "onUpdate:modelValue": ($event) => data.areaCode = $event,
  5764. "ref": areaRef,
  5765. "loading": !areaListLoaded.value,
  5766. "areaList": props2.areaList,
  5767. "columnsPlaceholder": props2.areaColumnsPlaceholder,
  5768. "onConfirm": onAreaConfirm,
  5769. "onCancel": () => {
  5770. showAreaPopup.value = false;
  5771. }
  5772. }, null)]
  5773. })];
  5774. }
  5775. });
  5776. };
  5777. }
  5778. });
  5779. const AddressEdit = withInstall(stdin_default$1r);
  5780. const [name$1g, bem$1c] = createNamespace("radio-group");
  5781. const radioGroupProps = {
  5782. shape: String,
  5783. disabled: Boolean,
  5784. iconSize: numericProp,
  5785. direction: String,
  5786. modelValue: unknownProp,
  5787. checkedColor: String
  5788. };
  5789. const RADIO_KEY = Symbol(name$1g);
  5790. var stdin_default$1q = vue.defineComponent({
  5791. name: name$1g,
  5792. props: radioGroupProps,
  5793. emits: ["change", "update:modelValue"],
  5794. setup(props2, {
  5795. emit,
  5796. slots
  5797. }) {
  5798. const {
  5799. linkChildren
  5800. } = useChildren(RADIO_KEY);
  5801. const updateValue = (value) => emit("update:modelValue", value);
  5802. vue.watch(() => props2.modelValue, (value) => emit("change", value));
  5803. linkChildren({
  5804. props: props2,
  5805. updateValue
  5806. });
  5807. useCustomFieldValue(() => props2.modelValue);
  5808. return () => {
  5809. var _a;
  5810. return vue.createVNode("div", {
  5811. "class": bem$1c([props2.direction]),
  5812. "role": "radiogroup"
  5813. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  5814. };
  5815. }
  5816. });
  5817. const RadioGroup = withInstall(stdin_default$1q);
  5818. const [name$1f, bem$1b] = createNamespace("checkbox-group");
  5819. const checkboxGroupProps = {
  5820. max: numericProp,
  5821. shape: makeStringProp("round"),
  5822. disabled: Boolean,
  5823. iconSize: numericProp,
  5824. direction: String,
  5825. modelValue: makeArrayProp(),
  5826. checkedColor: String
  5827. };
  5828. const CHECKBOX_GROUP_KEY = Symbol(name$1f);
  5829. var stdin_default$1p = vue.defineComponent({
  5830. name: name$1f,
  5831. props: checkboxGroupProps,
  5832. emits: ["change", "update:modelValue"],
  5833. setup(props2, {
  5834. emit,
  5835. slots
  5836. }) {
  5837. const {
  5838. children,
  5839. linkChildren
  5840. } = useChildren(CHECKBOX_GROUP_KEY);
  5841. const updateValue = (value) => emit("update:modelValue", value);
  5842. const toggleAll = (options = {}) => {
  5843. if (typeof options === "boolean") {
  5844. options = {
  5845. checked: options
  5846. };
  5847. }
  5848. const {
  5849. checked,
  5850. skipDisabled
  5851. } = options;
  5852. const checkedChildren = children.filter((item) => {
  5853. if (!item.props.bindGroup) {
  5854. return false;
  5855. }
  5856. if (item.props.disabled && skipDisabled) {
  5857. return item.checked.value;
  5858. }
  5859. return checked != null ? checked : !item.checked.value;
  5860. });
  5861. const names = checkedChildren.map((item) => item.name);
  5862. updateValue(names);
  5863. };
  5864. vue.watch(() => props2.modelValue, (value) => emit("change", value));
  5865. useExpose({
  5866. toggleAll
  5867. });
  5868. useCustomFieldValue(() => props2.modelValue);
  5869. linkChildren({
  5870. props: props2,
  5871. updateValue
  5872. });
  5873. return () => {
  5874. var _a;
  5875. return vue.createVNode("div", {
  5876. "class": bem$1b([props2.direction])
  5877. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  5878. };
  5879. }
  5880. });
  5881. const CheckboxGroup = withInstall(stdin_default$1p);
  5882. const [name$1e, bem$1a] = createNamespace("tag");
  5883. const tagProps = {
  5884. size: String,
  5885. mark: Boolean,
  5886. show: truthProp,
  5887. type: makeStringProp("default"),
  5888. color: String,
  5889. plain: Boolean,
  5890. round: Boolean,
  5891. textColor: String,
  5892. closeable: Boolean
  5893. };
  5894. var stdin_default$1o = vue.defineComponent({
  5895. name: name$1e,
  5896. props: tagProps,
  5897. emits: ["close"],
  5898. setup(props2, {
  5899. slots,
  5900. emit
  5901. }) {
  5902. const onClose = (event) => {
  5903. event.stopPropagation();
  5904. emit("close", event);
  5905. };
  5906. const getStyle = () => {
  5907. if (props2.plain) {
  5908. return {
  5909. color: props2.textColor || props2.color,
  5910. borderColor: props2.color
  5911. };
  5912. }
  5913. return {
  5914. color: props2.textColor,
  5915. background: props2.color
  5916. };
  5917. };
  5918. const renderTag = () => {
  5919. var _a;
  5920. const {
  5921. type,
  5922. mark,
  5923. plain,
  5924. round: round2,
  5925. size,
  5926. closeable
  5927. } = props2;
  5928. const classes = {
  5929. mark,
  5930. plain,
  5931. round: round2
  5932. };
  5933. if (size) {
  5934. classes[size] = size;
  5935. }
  5936. const CloseIcon = closeable && vue.createVNode(Icon, {
  5937. "name": "cross",
  5938. "class": [bem$1a("close"), HAPTICS_FEEDBACK],
  5939. "onClick": onClose
  5940. }, null);
  5941. return vue.createVNode("span", {
  5942. "style": getStyle(),
  5943. "class": bem$1a([classes, type])
  5944. }, [(_a = slots.default) == null ? void 0 : _a.call(slots), CloseIcon]);
  5945. };
  5946. return () => vue.createVNode(vue.Transition, {
  5947. "name": props2.closeable ? "van-fade" : void 0
  5948. }, {
  5949. default: () => [props2.show ? renderTag() : null]
  5950. });
  5951. }
  5952. });
  5953. const Tag = withInstall(stdin_default$1o);
  5954. const checkerProps = {
  5955. name: unknownProp,
  5956. disabled: Boolean,
  5957. iconSize: numericProp,
  5958. modelValue: unknownProp,
  5959. checkedColor: String,
  5960. labelPosition: String,
  5961. labelDisabled: Boolean
  5962. };
  5963. var stdin_default$1n = vue.defineComponent({
  5964. props: extend({}, checkerProps, {
  5965. bem: makeRequiredProp(Function),
  5966. role: String,
  5967. shape: String,
  5968. parent: Object,
  5969. checked: Boolean,
  5970. bindGroup: truthProp,
  5971. indeterminate: {
  5972. type: Boolean,
  5973. default: null
  5974. }
  5975. }),
  5976. emits: ["click", "toggle"],
  5977. setup(props2, {
  5978. emit,
  5979. slots
  5980. }) {
  5981. const iconRef = vue.ref();
  5982. const getParentProp = (name2) => {
  5983. if (props2.parent && props2.bindGroup) {
  5984. return props2.parent.props[name2];
  5985. }
  5986. };
  5987. const disabled = vue.computed(() => {
  5988. if (props2.parent && props2.bindGroup) {
  5989. const disabled2 = getParentProp("disabled") || props2.disabled;
  5990. if (props2.role === "checkbox") {
  5991. const checkedCount = getParentProp("modelValue").length;
  5992. const max = getParentProp("max");
  5993. const overlimit = max && checkedCount >= +max;
  5994. return disabled2 || overlimit && !props2.checked;
  5995. }
  5996. return disabled2;
  5997. }
  5998. return props2.disabled;
  5999. });
  6000. const direction = vue.computed(() => getParentProp("direction"));
  6001. const iconStyle = vue.computed(() => {
  6002. const checkedColor = props2.checkedColor || getParentProp("checkedColor");
  6003. if (checkedColor && props2.checked && !disabled.value) {
  6004. return {
  6005. borderColor: checkedColor,
  6006. backgroundColor: checkedColor
  6007. };
  6008. }
  6009. });
  6010. const shape = vue.computed(() => {
  6011. return props2.shape || getParentProp("shape") || "round";
  6012. });
  6013. const onClick = (event) => {
  6014. const {
  6015. target
  6016. } = event;
  6017. const icon = iconRef.value;
  6018. const iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));
  6019. if (!disabled.value && (iconClicked || !props2.labelDisabled)) {
  6020. emit("toggle");
  6021. }
  6022. emit("click", event);
  6023. };
  6024. const renderIcon = () => {
  6025. var _a, _b;
  6026. const {
  6027. bem: bem2,
  6028. checked,
  6029. indeterminate
  6030. } = props2;
  6031. const iconSize = props2.iconSize || getParentProp("iconSize");
  6032. return vue.createVNode("div", {
  6033. "ref": iconRef,
  6034. "class": bem2("icon", [shape.value, {
  6035. disabled: disabled.value,
  6036. checked,
  6037. indeterminate
  6038. }]),
  6039. "style": shape.value !== "dot" ? {
  6040. fontSize: addUnit(iconSize)
  6041. } : {
  6042. width: addUnit(iconSize),
  6043. height: addUnit(iconSize),
  6044. borderColor: (_a = iconStyle.value) == null ? void 0 : _a.borderColor
  6045. }
  6046. }, [slots.icon ? slots.icon({
  6047. checked,
  6048. disabled: disabled.value
  6049. }) : shape.value !== "dot" ? vue.createVNode(Icon, {
  6050. "name": indeterminate ? "minus" : "success",
  6051. "style": iconStyle.value
  6052. }, null) : vue.createVNode("div", {
  6053. "class": bem2("icon--dot__icon"),
  6054. "style": {
  6055. backgroundColor: (_b = iconStyle.value) == null ? void 0 : _b.backgroundColor
  6056. }
  6057. }, null)]);
  6058. };
  6059. const renderLabel = () => {
  6060. const {
  6061. checked
  6062. } = props2;
  6063. if (slots.default) {
  6064. return vue.createVNode("span", {
  6065. "class": props2.bem("label", [props2.labelPosition, {
  6066. disabled: disabled.value
  6067. }])
  6068. }, [slots.default({
  6069. checked,
  6070. disabled: disabled.value
  6071. })]);
  6072. }
  6073. };
  6074. return () => {
  6075. const nodes = props2.labelPosition === "left" ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()];
  6076. return vue.createVNode("div", {
  6077. "role": props2.role,
  6078. "class": props2.bem([{
  6079. disabled: disabled.value,
  6080. "label-disabled": props2.labelDisabled
  6081. }, direction.value]),
  6082. "tabindex": disabled.value ? void 0 : 0,
  6083. "aria-checked": props2.checked,
  6084. "onClick": onClick
  6085. }, [nodes]);
  6086. };
  6087. }
  6088. });
  6089. const radioProps = extend({}, checkerProps, {
  6090. shape: String
  6091. });
  6092. const [name$1d, bem$19] = createNamespace("radio");
  6093. var stdin_default$1m = vue.defineComponent({
  6094. name: name$1d,
  6095. props: radioProps,
  6096. emits: ["update:modelValue"],
  6097. setup(props2, {
  6098. emit,
  6099. slots
  6100. }) {
  6101. const {
  6102. parent
  6103. } = useParent(RADIO_KEY);
  6104. const checked = () => {
  6105. const value = parent ? parent.props.modelValue : props2.modelValue;
  6106. return value === props2.name;
  6107. };
  6108. const toggle = () => {
  6109. if (parent) {
  6110. parent.updateValue(props2.name);
  6111. } else {
  6112. emit("update:modelValue", props2.name);
  6113. }
  6114. };
  6115. return () => vue.createVNode(stdin_default$1n, vue.mergeProps({
  6116. "bem": bem$19,
  6117. "role": "radio",
  6118. "parent": parent,
  6119. "checked": checked(),
  6120. "onToggle": toggle
  6121. }, props2), pick(slots, ["default", "icon"]));
  6122. }
  6123. });
  6124. const Radio = withInstall(stdin_default$1m);
  6125. const [name$1c, bem$18] = createNamespace("checkbox");
  6126. const checkboxProps = extend({}, checkerProps, {
  6127. shape: String,
  6128. bindGroup: truthProp,
  6129. indeterminate: {
  6130. type: Boolean,
  6131. default: null
  6132. }
  6133. });
  6134. var stdin_default$1l = vue.defineComponent({
  6135. name: name$1c,
  6136. props: checkboxProps,
  6137. emits: ["change", "update:modelValue"],
  6138. setup(props2, {
  6139. emit,
  6140. slots
  6141. }) {
  6142. const {
  6143. parent
  6144. } = useParent(CHECKBOX_GROUP_KEY);
  6145. const setParentValue = (checked2) => {
  6146. const {
  6147. name: name2
  6148. } = props2;
  6149. const {
  6150. max,
  6151. modelValue
  6152. } = parent.props;
  6153. const value = modelValue.slice();
  6154. if (checked2) {
  6155. const overlimit = max && value.length >= +max;
  6156. if (!overlimit && !value.includes(name2)) {
  6157. value.push(name2);
  6158. if (props2.bindGroup) {
  6159. parent.updateValue(value);
  6160. }
  6161. }
  6162. } else {
  6163. const index = value.indexOf(name2);
  6164. if (index !== -1) {
  6165. value.splice(index, 1);
  6166. if (props2.bindGroup) {
  6167. parent.updateValue(value);
  6168. }
  6169. }
  6170. }
  6171. };
  6172. const checked = vue.computed(() => {
  6173. if (parent && props2.bindGroup) {
  6174. return parent.props.modelValue.indexOf(props2.name) !== -1;
  6175. }
  6176. return !!props2.modelValue;
  6177. });
  6178. const toggle = (newValue = !checked.value) => {
  6179. if (parent && props2.bindGroup) {
  6180. setParentValue(newValue);
  6181. } else {
  6182. emit("update:modelValue", newValue);
  6183. }
  6184. if (props2.indeterminate !== null) emit("change", newValue);
  6185. };
  6186. vue.watch(() => props2.modelValue, (value) => {
  6187. if (props2.indeterminate === null) emit("change", value);
  6188. });
  6189. useExpose({
  6190. toggle,
  6191. props: props2,
  6192. checked
  6193. });
  6194. useCustomFieldValue(() => props2.modelValue);
  6195. return () => vue.createVNode(stdin_default$1n, vue.mergeProps({
  6196. "bem": bem$18,
  6197. "role": "checkbox",
  6198. "parent": parent,
  6199. "checked": checked.value,
  6200. "onToggle": toggle
  6201. }, props2), pick(slots, ["default", "icon"]));
  6202. }
  6203. });
  6204. const Checkbox = withInstall(stdin_default$1l);
  6205. const [name$1b, bem$17] = createNamespace("address-item");
  6206. var stdin_default$1k = vue.defineComponent({
  6207. name: name$1b,
  6208. props: {
  6209. address: makeRequiredProp(Object),
  6210. disabled: Boolean,
  6211. switchable: Boolean,
  6212. singleChoice: Boolean,
  6213. defaultTagText: String,
  6214. rightIcon: makeStringProp("edit")
  6215. },
  6216. emits: ["edit", "click", "select"],
  6217. setup(props2, {
  6218. slots,
  6219. emit
  6220. }) {
  6221. const onClick = (event) => {
  6222. if (props2.switchable) {
  6223. emit("select");
  6224. }
  6225. emit("click", event);
  6226. };
  6227. const renderRightIcon = () => vue.createVNode(Icon, {
  6228. "name": props2.rightIcon,
  6229. "class": bem$17("edit"),
  6230. "onClick": (event) => {
  6231. event.stopPropagation();
  6232. emit("edit");
  6233. emit("click", event);
  6234. }
  6235. }, null);
  6236. const renderTag = () => {
  6237. if (slots.tag) {
  6238. return slots.tag(props2.address);
  6239. }
  6240. if (props2.address.isDefault && props2.defaultTagText) {
  6241. return vue.createVNode(Tag, {
  6242. "type": "primary",
  6243. "round": true,
  6244. "class": bem$17("tag")
  6245. }, {
  6246. default: () => [props2.defaultTagText]
  6247. });
  6248. }
  6249. };
  6250. const renderContent = () => {
  6251. const {
  6252. address,
  6253. disabled,
  6254. switchable,
  6255. singleChoice
  6256. } = props2;
  6257. const Info = [vue.createVNode("div", {
  6258. "class": bem$17("name")
  6259. }, [`${address.name} ${address.tel}`, renderTag()]), vue.createVNode("div", {
  6260. "class": bem$17("address")
  6261. }, [address.address])];
  6262. if (switchable && !disabled) {
  6263. if (singleChoice) {
  6264. return vue.createVNode(Radio, {
  6265. "name": address.id,
  6266. "iconSize": 18
  6267. }, {
  6268. default: () => [Info]
  6269. });
  6270. } else {
  6271. return vue.createVNode(Checkbox, {
  6272. "name": address.id,
  6273. "iconSize": 18
  6274. }, {
  6275. default: () => [Info]
  6276. });
  6277. }
  6278. }
  6279. return Info;
  6280. };
  6281. return () => {
  6282. var _a;
  6283. const {
  6284. disabled
  6285. } = props2;
  6286. return vue.createVNode("div", {
  6287. "class": bem$17({
  6288. disabled
  6289. }),
  6290. "onClick": onClick
  6291. }, [vue.createVNode(Cell, {
  6292. "border": false,
  6293. "titleClass": bem$17("title")
  6294. }, {
  6295. title: renderContent,
  6296. "right-icon": renderRightIcon
  6297. }), (_a = slots.bottom) == null ? void 0 : _a.call(slots, extend({}, props2.address, {
  6298. disabled
  6299. }))]);
  6300. };
  6301. }
  6302. });
  6303. const [name$1a, bem$16, t$h] = createNamespace("address-list");
  6304. const addressListProps = {
  6305. list: makeArrayProp(),
  6306. modelValue: [...numericProp, Array],
  6307. switchable: truthProp,
  6308. disabledText: String,
  6309. disabledList: makeArrayProp(),
  6310. showAddButton: truthProp,
  6311. addButtonText: String,
  6312. defaultTagText: String,
  6313. rightIcon: makeStringProp("edit")
  6314. };
  6315. var stdin_default$1j = vue.defineComponent({
  6316. name: name$1a,
  6317. props: addressListProps,
  6318. emits: ["add", "edit", "select", "clickItem", "editDisabled", "selectDisabled", "update:modelValue"],
  6319. setup(props2, {
  6320. slots,
  6321. emit
  6322. }) {
  6323. const singleChoice = vue.computed(() => !Array.isArray(props2.modelValue));
  6324. const renderItem = (item, index, disabled) => {
  6325. const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
  6326. const onClick = (event) => emit("clickItem", item, index, {
  6327. event
  6328. });
  6329. const onSelect = () => {
  6330. emit(disabled ? "selectDisabled" : "select", item, index);
  6331. if (!disabled) {
  6332. if (singleChoice.value) {
  6333. emit("update:modelValue", item.id);
  6334. } else {
  6335. const value = props2.modelValue;
  6336. if (value.includes(item.id)) {
  6337. emit("update:modelValue", value.filter((id) => id !== item.id));
  6338. } else {
  6339. emit("update:modelValue", [...value, item.id]);
  6340. }
  6341. }
  6342. }
  6343. };
  6344. return vue.createVNode(stdin_default$1k, {
  6345. "key": item.id,
  6346. "address": item,
  6347. "disabled": disabled,
  6348. "switchable": props2.switchable,
  6349. "singleChoice": singleChoice.value,
  6350. "defaultTagText": props2.defaultTagText,
  6351. "rightIcon": props2.rightIcon,
  6352. "onEdit": onEdit,
  6353. "onClick": onClick,
  6354. "onSelect": onSelect
  6355. }, {
  6356. bottom: slots["item-bottom"],
  6357. tag: slots.tag
  6358. });
  6359. };
  6360. const renderList = (list, disabled) => {
  6361. if (list) {
  6362. return list.map((item, index) => renderItem(item, index, disabled));
  6363. }
  6364. };
  6365. const renderBottom = () => props2.showAddButton ? vue.createVNode("div", {
  6366. "class": [bem$16("bottom"), "van-safe-area-bottom"]
  6367. }, [vue.createVNode(Button, {
  6368. "round": true,
  6369. "block": true,
  6370. "type": "primary",
  6371. "text": props2.addButtonText || t$h("add"),
  6372. "class": bem$16("add"),
  6373. "onClick": () => emit("add")
  6374. }, null)]) : void 0;
  6375. return () => {
  6376. var _a, _b;
  6377. const List2 = renderList(props2.list);
  6378. const DisabledList = renderList(props2.disabledList, true);
  6379. const DisabledText = props2.disabledText && vue.createVNode("div", {
  6380. "class": bem$16("disabled-text")
  6381. }, [props2.disabledText]);
  6382. return vue.createVNode("div", {
  6383. "class": bem$16()
  6384. }, [(_a = slots.top) == null ? void 0 : _a.call(slots), !singleChoice.value && Array.isArray(props2.modelValue) ? vue.createVNode(CheckboxGroup, {
  6385. "modelValue": props2.modelValue
  6386. }, {
  6387. default: () => [List2]
  6388. }) : vue.createVNode(RadioGroup, {
  6389. "modelValue": props2.modelValue
  6390. }, {
  6391. default: () => [List2]
  6392. }), DisabledText, DisabledList, (_b = slots.default) == null ? void 0 : _b.call(slots), renderBottom()]);
  6393. };
  6394. }
  6395. });
  6396. const AddressList = withInstall(stdin_default$1j);
  6397. const hasIntersectionObserver = inBrowser && "IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype;
  6398. const modeType = {
  6399. event: "event",
  6400. observer: "observer"
  6401. };
  6402. function remove(arr, item) {
  6403. if (!arr.length) return;
  6404. const index = arr.indexOf(item);
  6405. if (index > -1) return arr.splice(index, 1);
  6406. }
  6407. function getBestSelectionFromSrcset(el, scale) {
  6408. if (el.tagName !== "IMG" || !el.getAttribute("data-srcset")) return;
  6409. let options = el.getAttribute("data-srcset");
  6410. const container = el.parentNode;
  6411. const containerWidth = container.offsetWidth * scale;
  6412. let spaceIndex;
  6413. let tmpSrc;
  6414. let tmpWidth;
  6415. options = options.trim().split(",");
  6416. const result = options.map((item) => {
  6417. item = item.trim();
  6418. spaceIndex = item.lastIndexOf(" ");
  6419. if (spaceIndex === -1) {
  6420. tmpSrc = item;
  6421. tmpWidth = 999998;
  6422. } else {
  6423. tmpSrc = item.substr(0, spaceIndex);
  6424. tmpWidth = parseInt(
  6425. item.substr(spaceIndex + 1, item.length - spaceIndex - 2),
  6426. 10
  6427. );
  6428. }
  6429. return [tmpWidth, tmpSrc];
  6430. });
  6431. result.sort((a, b) => {
  6432. if (a[0] < b[0]) {
  6433. return 1;
  6434. }
  6435. if (a[0] > b[0]) {
  6436. return -1;
  6437. }
  6438. if (a[0] === b[0]) {
  6439. if (b[1].indexOf(".webp", b[1].length - 5) !== -1) {
  6440. return 1;
  6441. }
  6442. if (a[1].indexOf(".webp", a[1].length - 5) !== -1) {
  6443. return -1;
  6444. }
  6445. }
  6446. return 0;
  6447. });
  6448. let bestSelectedSrc = "";
  6449. let tmpOption;
  6450. for (let i = 0; i < result.length; i++) {
  6451. tmpOption = result[i];
  6452. bestSelectedSrc = tmpOption[1];
  6453. const next = result[i + 1];
  6454. if (next && next[0] < containerWidth) {
  6455. bestSelectedSrc = tmpOption[1];
  6456. break;
  6457. } else if (!next) {
  6458. bestSelectedSrc = tmpOption[1];
  6459. break;
  6460. }
  6461. }
  6462. return bestSelectedSrc;
  6463. }
  6464. const getDPR = (scale = 1) => inBrowser ? window.devicePixelRatio || scale : scale;
  6465. function supportWebp() {
  6466. if (!inBrowser) return false;
  6467. let support = true;
  6468. try {
  6469. const elem = document.createElement("canvas");
  6470. if (elem.getContext && elem.getContext("2d")) {
  6471. support = elem.toDataURL("image/webp").indexOf("data:image/webp") === 0;
  6472. }
  6473. } catch (err) {
  6474. support = false;
  6475. }
  6476. return support;
  6477. }
  6478. function throttle(action, delay) {
  6479. let timeout = null;
  6480. let lastRun = 0;
  6481. return function(...args) {
  6482. if (timeout) {
  6483. return;
  6484. }
  6485. const elapsed = Date.now() - lastRun;
  6486. const runCallback = () => {
  6487. lastRun = Date.now();
  6488. timeout = false;
  6489. action.apply(this, args);
  6490. };
  6491. if (elapsed >= delay) {
  6492. runCallback();
  6493. } else {
  6494. timeout = setTimeout(runCallback, delay);
  6495. }
  6496. };
  6497. }
  6498. function on(el, type, func) {
  6499. el.addEventListener(type, func, {
  6500. capture: false,
  6501. passive: true
  6502. });
  6503. }
  6504. function off(el, type, func) {
  6505. el.removeEventListener(type, func, false);
  6506. }
  6507. const loadImageAsync = (item, resolve, reject) => {
  6508. const image = new Image();
  6509. if (!item || !item.src) {
  6510. return reject(new Error("image src is required"));
  6511. }
  6512. image.src = item.src;
  6513. if (item.cors) {
  6514. image.crossOrigin = item.cors;
  6515. }
  6516. image.onload = () => resolve({
  6517. naturalHeight: image.naturalHeight,
  6518. naturalWidth: image.naturalWidth,
  6519. src: image.src
  6520. });
  6521. image.onerror = (e) => reject(e);
  6522. };
  6523. class ImageCache {
  6524. constructor({ max }) {
  6525. this.options = {
  6526. max: max || 100
  6527. };
  6528. this.caches = [];
  6529. }
  6530. has(key) {
  6531. return this.caches.indexOf(key) > -1;
  6532. }
  6533. add(key) {
  6534. if (this.has(key)) return;
  6535. this.caches.push(key);
  6536. if (this.caches.length > this.options.max) {
  6537. this.free();
  6538. }
  6539. }
  6540. free() {
  6541. this.caches.shift();
  6542. }
  6543. }
  6544. const [name$19, bem$15] = createNamespace("back-top");
  6545. const backTopProps = {
  6546. right: numericProp,
  6547. bottom: numericProp,
  6548. zIndex: numericProp,
  6549. target: [String, Object],
  6550. offset: makeNumericProp(200),
  6551. immediate: Boolean,
  6552. teleport: {
  6553. type: [String, Object],
  6554. default: "body"
  6555. }
  6556. };
  6557. var stdin_default$1i = vue.defineComponent({
  6558. name: name$19,
  6559. inheritAttrs: false,
  6560. props: backTopProps,
  6561. emits: ["click"],
  6562. setup(props2, {
  6563. emit,
  6564. slots,
  6565. attrs
  6566. }) {
  6567. let shouldReshow = false;
  6568. const show = vue.ref(false);
  6569. const root = vue.ref();
  6570. const scrollParent = vue.ref();
  6571. const style = vue.computed(() => extend(getZIndexStyle(props2.zIndex), {
  6572. right: addUnit(props2.right),
  6573. bottom: addUnit(props2.bottom)
  6574. }));
  6575. const onClick = (event) => {
  6576. var _a;
  6577. emit("click", event);
  6578. (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
  6579. top: 0,
  6580. behavior: props2.immediate ? "auto" : "smooth"
  6581. });
  6582. };
  6583. const scroll = () => {
  6584. show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= +props2.offset : false;
  6585. };
  6586. const getTarget = () => {
  6587. const {
  6588. target
  6589. } = props2;
  6590. if (typeof target === "string") {
  6591. const el = document.querySelector(target);
  6592. if (el) {
  6593. return el;
  6594. }
  6595. } else {
  6596. return target;
  6597. }
  6598. };
  6599. const updateTarget = () => {
  6600. if (inBrowser$1) {
  6601. vue.nextTick(() => {
  6602. scrollParent.value = props2.target ? getTarget() : getScrollParent$1(root.value);
  6603. scroll();
  6604. });
  6605. }
  6606. };
  6607. useEventListener("scroll", throttle(scroll, 100), {
  6608. target: scrollParent
  6609. });
  6610. vue.onMounted(updateTarget);
  6611. vue.onActivated(() => {
  6612. if (shouldReshow) {
  6613. show.value = true;
  6614. shouldReshow = false;
  6615. }
  6616. });
  6617. vue.onDeactivated(() => {
  6618. if (show.value && props2.teleport) {
  6619. show.value = false;
  6620. shouldReshow = true;
  6621. }
  6622. });
  6623. vue.watch(() => props2.target, updateTarget);
  6624. return () => {
  6625. const Content = vue.createVNode("div", vue.mergeProps({
  6626. "ref": !props2.teleport ? root : void 0,
  6627. "class": bem$15({
  6628. active: show.value
  6629. }),
  6630. "style": style.value,
  6631. "onClick": onClick
  6632. }, attrs), [slots.default ? slots.default() : vue.createVNode(Icon, {
  6633. "name": "back-top",
  6634. "class": bem$15("icon")
  6635. }, null)]);
  6636. if (props2.teleport) {
  6637. return [vue.createVNode("div", {
  6638. "ref": root,
  6639. "class": bem$15("placeholder")
  6640. }, null), vue.createVNode(vue.Teleport, {
  6641. "to": props2.teleport
  6642. }, {
  6643. default: () => [Content]
  6644. })];
  6645. }
  6646. return Content;
  6647. };
  6648. }
  6649. });
  6650. const BackTop = withInstall(stdin_default$1i);
  6651. var __async = (__this, __arguments, generator) => {
  6652. return new Promise((resolve, reject) => {
  6653. var fulfilled = (value) => {
  6654. try {
  6655. step(generator.next(value));
  6656. } catch (e) {
  6657. reject(e);
  6658. }
  6659. };
  6660. var rejected = (value) => {
  6661. try {
  6662. step(generator.throw(value));
  6663. } catch (e) {
  6664. reject(e);
  6665. }
  6666. };
  6667. var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
  6668. step((generator = generator.apply(__this, __arguments)).next());
  6669. });
  6670. };
  6671. const barrageProps = {
  6672. top: makeNumericProp(10),
  6673. rows: makeNumericProp(4),
  6674. duration: makeNumericProp(4e3),
  6675. autoPlay: truthProp,
  6676. delay: makeNumberProp(300),
  6677. modelValue: makeArrayProp()
  6678. };
  6679. const [name$18, bem$14] = createNamespace("barrage");
  6680. var stdin_default$1h = vue.defineComponent({
  6681. name: name$18,
  6682. props: barrageProps,
  6683. emits: ["update:modelValue"],
  6684. setup(props2, {
  6685. emit,
  6686. slots
  6687. }) {
  6688. const barrageWrapper = vue.ref();
  6689. const className = bem$14("item");
  6690. const total = vue.ref(0);
  6691. const barrageItems = [];
  6692. const createBarrageItem = (text, delay = props2.delay) => {
  6693. const item = document.createElement("span");
  6694. item.className = className;
  6695. item.innerText = String(text);
  6696. item.style.animationDuration = `${props2.duration}ms`;
  6697. item.style.animationDelay = `${delay}ms`;
  6698. item.style.animationName = "van-barrage";
  6699. item.style.animationTimingFunction = "linear";
  6700. return item;
  6701. };
  6702. const isInitBarrage = vue.ref(true);
  6703. const isPlay = vue.ref(props2.autoPlay);
  6704. const appendBarrageItem = ({
  6705. id,
  6706. text
  6707. }, i) => {
  6708. var _a;
  6709. const item = createBarrageItem(text, isInitBarrage.value ? i * props2.delay : void 0);
  6710. if (!props2.autoPlay && isPlay.value === false) {
  6711. item.style.animationPlayState = "paused";
  6712. }
  6713. (_a = barrageWrapper.value) == null ? void 0 : _a.append(item);
  6714. total.value++;
  6715. const top2 = (total.value - 1) % +props2.rows * item.offsetHeight + +props2.top;
  6716. item.style.top = `${top2}px`;
  6717. item.dataset.id = String(id);
  6718. barrageItems.push(item);
  6719. item.addEventListener("animationend", () => {
  6720. emit("update:modelValue", [...props2.modelValue].filter((v) => String(v.id) !== item.dataset.id));
  6721. });
  6722. };
  6723. const updateBarrages = (newValue, oldValue) => {
  6724. const map = new Map(oldValue.map((item) => [item.id, item]));
  6725. newValue.forEach((item, i) => {
  6726. if (map.has(item.id)) {
  6727. map.delete(item.id);
  6728. } else {
  6729. appendBarrageItem(item, i);
  6730. }
  6731. });
  6732. map.forEach((item) => {
  6733. const index = barrageItems.findIndex((span) => span.dataset.id === String(item.id));
  6734. if (index > -1) {
  6735. barrageItems[index].remove();
  6736. barrageItems.splice(index, 1);
  6737. }
  6738. });
  6739. isInitBarrage.value = false;
  6740. };
  6741. vue.watch(() => props2.modelValue.slice(), (newValue, oldValue) => updateBarrages(newValue != null ? newValue : [], oldValue != null ? oldValue : []), {
  6742. deep: true
  6743. });
  6744. const rootStyle = vue.ref({});
  6745. vue.onMounted(() => __async(this, null, function* () {
  6746. var _a;
  6747. rootStyle.value["--move-distance"] = `-${(_a = barrageWrapper.value) == null ? void 0 : _a.offsetWidth}px`;
  6748. yield vue.nextTick();
  6749. updateBarrages(props2.modelValue, []);
  6750. }));
  6751. const play = () => {
  6752. isPlay.value = true;
  6753. barrageItems.forEach((item) => {
  6754. item.style.animationPlayState = "running";
  6755. });
  6756. };
  6757. const pause = () => {
  6758. isPlay.value = false;
  6759. barrageItems.forEach((item) => {
  6760. item.style.animationPlayState = "paused";
  6761. });
  6762. };
  6763. useExpose({
  6764. play,
  6765. pause
  6766. });
  6767. return () => {
  6768. var _a;
  6769. return vue.createVNode("div", {
  6770. "class": bem$14(),
  6771. "ref": barrageWrapper,
  6772. "style": rootStyle.value
  6773. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  6774. };
  6775. }
  6776. });
  6777. const Barrage = withInstall(stdin_default$1h);
  6778. const [name$17, bem$13, t$g] = createNamespace("calendar");
  6779. const formatMonthTitle = (date) => t$g("monthTitle", date.getFullYear(), date.getMonth() + 1);
  6780. function compareMonth(date1, date2) {
  6781. const year1 = date1.getFullYear();
  6782. const year2 = date2.getFullYear();
  6783. if (year1 === year2) {
  6784. const month1 = date1.getMonth();
  6785. const month2 = date2.getMonth();
  6786. return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
  6787. }
  6788. return year1 > year2 ? 1 : -1;
  6789. }
  6790. function compareDay(day1, day2) {
  6791. const compareMonthResult = compareMonth(day1, day2);
  6792. if (compareMonthResult === 0) {
  6793. const date1 = day1.getDate();
  6794. const date2 = day2.getDate();
  6795. return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
  6796. }
  6797. return compareMonthResult;
  6798. }
  6799. const cloneDate = (date) => new Date(date);
  6800. const cloneDates = (dates) => Array.isArray(dates) ? dates.map(cloneDate) : cloneDate(dates);
  6801. function getDayByOffset(date, offset2) {
  6802. const cloned = cloneDate(date);
  6803. cloned.setDate(cloned.getDate() + offset2);
  6804. return cloned;
  6805. }
  6806. function getMonthByOffset(date, offset2) {
  6807. const cloned = cloneDate(date);
  6808. cloned.setMonth(cloned.getMonth() + offset2);
  6809. if (cloned.getDate() !== date.getDate()) {
  6810. cloned.setDate(0);
  6811. }
  6812. return cloned;
  6813. }
  6814. function getYearByOffset(date, offset2) {
  6815. const cloned = cloneDate(date);
  6816. cloned.setFullYear(cloned.getFullYear() + offset2);
  6817. if (cloned.getDate() !== date.getDate()) {
  6818. cloned.setDate(0);
  6819. }
  6820. return cloned;
  6821. }
  6822. const getPrevDay = (date) => getDayByOffset(date, -1);
  6823. const getNextDay = (date) => getDayByOffset(date, 1);
  6824. const getPrevMonth = (date) => getMonthByOffset(date, -1);
  6825. const getNextMonth = (date) => getMonthByOffset(date, 1);
  6826. const getPrevYear = (date) => getYearByOffset(date, -1);
  6827. const getNextYear = (date) => getYearByOffset(date, 1);
  6828. const getToday = () => {
  6829. const today = /* @__PURE__ */ new Date();
  6830. today.setHours(0, 0, 0, 0);
  6831. return today;
  6832. };
  6833. function calcDateNum(date) {
  6834. const day1 = date[0].getTime();
  6835. const day2 = date[1].getTime();
  6836. return (day2 - day1) / (1e3 * 60 * 60 * 24) + 1;
  6837. }
  6838. const sharedProps = extend({}, pickerSharedProps, {
  6839. modelValue: makeArrayProp(),
  6840. filter: Function,
  6841. formatter: {
  6842. type: Function,
  6843. default: (type, option) => option
  6844. }
  6845. });
  6846. const pickerInheritKeys = Object.keys(pickerSharedProps);
  6847. function times(n, iteratee) {
  6848. if (n < 0) {
  6849. return [];
  6850. }
  6851. const result = Array(n);
  6852. let index = -1;
  6853. while (++index < n) {
  6854. result[index] = iteratee(index);
  6855. }
  6856. return result;
  6857. }
  6858. const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
  6859. const genOptions = (min, max, type, formatter, filter, values) => {
  6860. const options = times(max - min + 1, (index) => {
  6861. const value = padZero(min + index);
  6862. return formatter(type, {
  6863. text: value,
  6864. value
  6865. });
  6866. });
  6867. return filter ? filter(type, options, values) : options;
  6868. };
  6869. const formatValueRange = (values, columns) => values.map((value, index) => {
  6870. const column = columns[index];
  6871. if (column.length) {
  6872. const minValue = +column[0].value;
  6873. const maxValue = +column[column.length - 1].value;
  6874. return padZero(clamp(+value, minValue, maxValue));
  6875. }
  6876. return value;
  6877. });
  6878. const [name$16] = createNamespace("calendar-day");
  6879. var stdin_default$1g = vue.defineComponent({
  6880. name: name$16,
  6881. props: {
  6882. item: makeRequiredProp(Object),
  6883. color: String,
  6884. index: Number,
  6885. offset: makeNumberProp(0),
  6886. rowHeight: String
  6887. },
  6888. emits: ["click", "clickDisabledDate"],
  6889. setup(props2, {
  6890. emit,
  6891. slots
  6892. }) {
  6893. const style = vue.computed(() => {
  6894. var _a;
  6895. const {
  6896. item,
  6897. index,
  6898. color,
  6899. offset: offset2,
  6900. rowHeight
  6901. } = props2;
  6902. const style2 = {
  6903. height: rowHeight
  6904. };
  6905. if (item.type === "placeholder") {
  6906. style2.width = "100%";
  6907. return style2;
  6908. }
  6909. if (index === 0) {
  6910. style2.marginLeft = `${100 * offset2 / 7}%`;
  6911. }
  6912. if (color) {
  6913. switch (item.type) {
  6914. case "end":
  6915. case "start":
  6916. case "start-end":
  6917. case "multiple-middle":
  6918. case "multiple-selected":
  6919. style2.background = color;
  6920. break;
  6921. case "middle":
  6922. style2.color = color;
  6923. break;
  6924. }
  6925. }
  6926. if (offset2 + (((_a = item.date) == null ? void 0 : _a.getDate()) || 1) > 28) {
  6927. style2.marginBottom = 0;
  6928. }
  6929. return style2;
  6930. });
  6931. const onClick = () => {
  6932. if (props2.item.type !== "disabled") {
  6933. emit("click", props2.item);
  6934. } else {
  6935. emit("clickDisabledDate", props2.item);
  6936. }
  6937. };
  6938. const renderTopInfo = () => {
  6939. const {
  6940. topInfo
  6941. } = props2.item;
  6942. if (topInfo || slots["top-info"]) {
  6943. return vue.createVNode("div", {
  6944. "class": bem$13("top-info")
  6945. }, [slots["top-info"] ? slots["top-info"](props2.item) : topInfo]);
  6946. }
  6947. };
  6948. const renderBottomInfo = () => {
  6949. const {
  6950. bottomInfo
  6951. } = props2.item;
  6952. if (bottomInfo || slots["bottom-info"]) {
  6953. return vue.createVNode("div", {
  6954. "class": bem$13("bottom-info")
  6955. }, [slots["bottom-info"] ? slots["bottom-info"](props2.item) : bottomInfo]);
  6956. }
  6957. };
  6958. const renderText = () => {
  6959. return slots.text ? slots.text(props2.item) : props2.item.text;
  6960. };
  6961. const renderContent = () => {
  6962. const {
  6963. item,
  6964. color,
  6965. rowHeight
  6966. } = props2;
  6967. const {
  6968. type
  6969. } = item;
  6970. const Nodes = [renderTopInfo(), renderText(), renderBottomInfo()];
  6971. if (type === "selected") {
  6972. return vue.createVNode("div", {
  6973. "class": bem$13("selected-day"),
  6974. "style": {
  6975. width: rowHeight,
  6976. height: rowHeight,
  6977. background: color
  6978. }
  6979. }, [Nodes]);
  6980. }
  6981. return Nodes;
  6982. };
  6983. return () => {
  6984. const {
  6985. type,
  6986. className
  6987. } = props2.item;
  6988. if (type === "placeholder") {
  6989. return vue.createVNode("div", {
  6990. "class": bem$13("day"),
  6991. "style": style.value
  6992. }, null);
  6993. }
  6994. return vue.createVNode("div", {
  6995. "role": "gridcell",
  6996. "style": style.value,
  6997. "class": [bem$13("day", type), className],
  6998. "tabindex": type === "disabled" ? void 0 : -1,
  6999. "onClick": onClick
  7000. }, [renderContent()]);
  7001. };
  7002. }
  7003. });
  7004. const [name$15] = createNamespace("calendar-month");
  7005. const calendarMonthProps = {
  7006. date: makeRequiredProp(Date),
  7007. type: String,
  7008. color: String,
  7009. minDate: Date,
  7010. maxDate: Date,
  7011. showMark: Boolean,
  7012. rowHeight: numericProp,
  7013. formatter: Function,
  7014. lazyRender: Boolean,
  7015. currentDate: [Date, Array],
  7016. allowSameDay: Boolean,
  7017. showSubtitle: Boolean,
  7018. showMonthTitle: Boolean,
  7019. firstDayOfWeek: Number
  7020. };
  7021. var stdin_default$1f = vue.defineComponent({
  7022. name: name$15,
  7023. props: calendarMonthProps,
  7024. emits: ["click", "clickDisabledDate"],
  7025. setup(props2, {
  7026. emit,
  7027. slots
  7028. }) {
  7029. const [visible, setVisible] = useToggle();
  7030. const daysRef = vue.ref();
  7031. const monthRef = vue.ref();
  7032. const height2 = useHeight(monthRef);
  7033. const title = vue.computed(() => formatMonthTitle(props2.date));
  7034. const rowHeight = vue.computed(() => addUnit(props2.rowHeight));
  7035. const offset2 = vue.computed(() => {
  7036. const date = props2.date.getDate();
  7037. const day = props2.date.getDay();
  7038. const realDay = (day - date % 7 + 8) % 7;
  7039. if (props2.firstDayOfWeek) {
  7040. return (realDay + 7 - props2.firstDayOfWeek) % 7;
  7041. }
  7042. return realDay;
  7043. });
  7044. const totalDay = vue.computed(() => getMonthEndDay(props2.date.getFullYear(), props2.date.getMonth() + 1));
  7045. const shouldRender = vue.computed(() => visible.value || !props2.lazyRender);
  7046. const getTitle = () => title.value;
  7047. const getMultipleDayType = (day) => {
  7048. const isSelected = (date) => props2.currentDate.some((item) => compareDay(item, date) === 0);
  7049. if (isSelected(day)) {
  7050. const prevDay = getPrevDay(day);
  7051. const nextDay = getNextDay(day);
  7052. const prevSelected = isSelected(prevDay);
  7053. const nextSelected = isSelected(nextDay);
  7054. if (prevSelected && nextSelected) {
  7055. return "multiple-middle";
  7056. }
  7057. if (prevSelected) {
  7058. return "end";
  7059. }
  7060. if (nextSelected) {
  7061. return "start";
  7062. }
  7063. return "multiple-selected";
  7064. }
  7065. return "";
  7066. };
  7067. const getRangeDayType = (day) => {
  7068. const [startDay, endDay] = props2.currentDate;
  7069. if (!startDay) {
  7070. return "";
  7071. }
  7072. const compareToStart = compareDay(day, startDay);
  7073. if (!endDay) {
  7074. return compareToStart === 0 ? "start" : "";
  7075. }
  7076. const compareToEnd = compareDay(day, endDay);
  7077. if (props2.allowSameDay && compareToStart === 0 && compareToEnd === 0) {
  7078. return "start-end";
  7079. }
  7080. if (compareToStart === 0) {
  7081. return "start";
  7082. }
  7083. if (compareToEnd === 0) {
  7084. return "end";
  7085. }
  7086. if (compareToStart > 0 && compareToEnd < 0) {
  7087. return "middle";
  7088. }
  7089. return "";
  7090. };
  7091. const getDayType = (day) => {
  7092. const {
  7093. type,
  7094. minDate,
  7095. maxDate,
  7096. currentDate
  7097. } = props2;
  7098. if (minDate && compareDay(day, minDate) < 0 || maxDate && compareDay(day, maxDate) > 0) {
  7099. return "disabled";
  7100. }
  7101. if (currentDate === null) {
  7102. return "";
  7103. }
  7104. if (Array.isArray(currentDate)) {
  7105. if (type === "multiple") {
  7106. return getMultipleDayType(day);
  7107. }
  7108. if (type === "range") {
  7109. return getRangeDayType(day);
  7110. }
  7111. } else if (type === "single") {
  7112. return compareDay(day, currentDate) === 0 ? "selected" : "";
  7113. }
  7114. return "";
  7115. };
  7116. const getBottomInfo = (dayType) => {
  7117. if (props2.type === "range") {
  7118. if (dayType === "start" || dayType === "end") {
  7119. return t$g(dayType);
  7120. }
  7121. if (dayType === "start-end") {
  7122. return `${t$g("start")}/${t$g("end")}`;
  7123. }
  7124. }
  7125. };
  7126. const renderTitle = () => {
  7127. if (props2.showMonthTitle) {
  7128. return vue.createVNode("div", {
  7129. "class": bem$13("month-title")
  7130. }, [slots["month-title"] ? slots["month-title"]({
  7131. date: props2.date,
  7132. text: title.value
  7133. }) : title.value]);
  7134. }
  7135. };
  7136. const renderMark = () => {
  7137. if (props2.showMark && shouldRender.value) {
  7138. return vue.createVNode("div", {
  7139. "class": bem$13("month-mark")
  7140. }, [props2.date.getMonth() + 1]);
  7141. }
  7142. };
  7143. const placeholders = vue.computed(() => {
  7144. const count = Math.ceil((totalDay.value + offset2.value) / 7);
  7145. return Array(count).fill({
  7146. type: "placeholder"
  7147. });
  7148. });
  7149. const days = vue.computed(() => {
  7150. const days2 = [];
  7151. const year = props2.date.getFullYear();
  7152. const month = props2.date.getMonth();
  7153. for (let day = 1; day <= totalDay.value; day++) {
  7154. const date = new Date(year, month, day);
  7155. const type = getDayType(date);
  7156. let config = {
  7157. date,
  7158. type,
  7159. text: day,
  7160. bottomInfo: getBottomInfo(type)
  7161. };
  7162. if (props2.formatter) {
  7163. config = props2.formatter(config);
  7164. }
  7165. days2.push(config);
  7166. }
  7167. return days2;
  7168. });
  7169. const disabledDays = vue.computed(() => days.value.filter((day) => day.type === "disabled"));
  7170. const scrollToDate = (body, targetDate) => {
  7171. if (daysRef.value) {
  7172. const daysRect = useRect(daysRef.value);
  7173. const totalRows = placeholders.value.length;
  7174. const currentRow = Math.ceil((targetDate.getDate() + offset2.value) / 7);
  7175. const rowOffset = (currentRow - 1) * daysRect.height / totalRows;
  7176. setScrollTop(body, daysRect.top + rowOffset + body.scrollTop - useRect(body).top);
  7177. }
  7178. };
  7179. const renderDay = (item, index) => vue.createVNode(stdin_default$1g, {
  7180. "item": item,
  7181. "index": index,
  7182. "color": props2.color,
  7183. "offset": offset2.value,
  7184. "rowHeight": rowHeight.value,
  7185. "onClick": (item2) => emit("click", item2),
  7186. "onClickDisabledDate": (item2) => emit("clickDisabledDate", item2)
  7187. }, pick(slots, ["top-info", "bottom-info", "text"]));
  7188. const renderDays = () => vue.createVNode("div", {
  7189. "ref": daysRef,
  7190. "role": "grid",
  7191. "class": bem$13("days")
  7192. }, [renderMark(), (shouldRender.value ? days : placeholders).value.map(renderDay)]);
  7193. useExpose({
  7194. getTitle,
  7195. getHeight: () => height2.value,
  7196. setVisible,
  7197. scrollToDate,
  7198. disabledDays
  7199. });
  7200. return () => vue.createVNode("div", {
  7201. "class": bem$13("month"),
  7202. "ref": monthRef
  7203. }, [renderTitle(), renderDays()]);
  7204. }
  7205. });
  7206. const [name$14] = createNamespace("calendar-header");
  7207. var stdin_default$1e = vue.defineComponent({
  7208. name: name$14,
  7209. props: {
  7210. date: Date,
  7211. minDate: Date,
  7212. maxDate: Date,
  7213. title: String,
  7214. subtitle: String,
  7215. showTitle: Boolean,
  7216. showSubtitle: Boolean,
  7217. firstDayOfWeek: Number,
  7218. switchMode: makeStringProp("none")
  7219. },
  7220. emits: ["clickSubtitle", "panelChange"],
  7221. setup(props2, {
  7222. slots,
  7223. emit
  7224. }) {
  7225. const prevMonthDisabled = vue.computed(() => props2.date && props2.minDate && compareMonth(getPrevMonth(props2.date), props2.minDate) < 0);
  7226. const prevYearDisabled = vue.computed(() => props2.date && props2.minDate && compareMonth(getPrevYear(props2.date), props2.minDate) < 0);
  7227. const nextMonthDisabled = vue.computed(() => props2.date && props2.maxDate && compareMonth(getNextMonth(props2.date), props2.maxDate) > 0);
  7228. const nextYearDisabled = vue.computed(() => props2.date && props2.maxDate && compareMonth(getNextYear(props2.date), props2.maxDate) > 0);
  7229. const renderTitle = () => {
  7230. if (props2.showTitle) {
  7231. const text = props2.title || t$g("title");
  7232. const title = slots.title ? slots.title() : text;
  7233. return vue.createVNode("div", {
  7234. "class": bem$13("header-title")
  7235. }, [title]);
  7236. }
  7237. };
  7238. const onClickSubtitle = (event) => emit("clickSubtitle", event);
  7239. const onPanelChange = (date) => emit("panelChange", date);
  7240. const renderAction = (isNext) => {
  7241. const showYearAction = props2.switchMode === "year-month";
  7242. const monthSlot = slots[isNext ? "next-month" : "prev-month"];
  7243. const yearSlot = slots[isNext ? "next-year" : "prev-year"];
  7244. const monthDisabled = isNext ? nextMonthDisabled.value : prevMonthDisabled.value;
  7245. const yearDisabled = isNext ? nextYearDisabled.value : prevYearDisabled.value;
  7246. const monthIconName = isNext ? "arrow" : "arrow-left";
  7247. const yearIconName = isNext ? "arrow-double-right" : "arrow-double-left";
  7248. const onMonthChange = () => onPanelChange((isNext ? getNextMonth : getPrevMonth)(props2.date));
  7249. const onYearChange = () => onPanelChange((isNext ? getNextYear : getPrevYear)(props2.date));
  7250. const MonthAction = vue.createVNode("view", {
  7251. "class": bem$13("header-action", {
  7252. disabled: monthDisabled
  7253. }),
  7254. "onClick": monthDisabled ? void 0 : onMonthChange
  7255. }, [monthSlot ? monthSlot({
  7256. disabled: monthDisabled
  7257. }) : vue.createVNode(Icon, {
  7258. "class": {
  7259. [HAPTICS_FEEDBACK]: !monthDisabled
  7260. },
  7261. "name": monthIconName
  7262. }, null)]);
  7263. const YearAction = showYearAction && vue.createVNode("view", {
  7264. "class": bem$13("header-action", {
  7265. disabled: yearDisabled
  7266. }),
  7267. "onClick": yearDisabled ? void 0 : onYearChange
  7268. }, [yearSlot ? yearSlot({
  7269. disabled: yearDisabled
  7270. }) : vue.createVNode(Icon, {
  7271. "class": {
  7272. [HAPTICS_FEEDBACK]: !yearDisabled
  7273. },
  7274. "name": yearIconName
  7275. }, null)]);
  7276. return isNext ? [MonthAction, YearAction] : [YearAction, MonthAction];
  7277. };
  7278. const renderSubtitle = () => {
  7279. if (props2.showSubtitle) {
  7280. const title = slots.subtitle ? slots.subtitle({
  7281. date: props2.date,
  7282. text: props2.subtitle
  7283. }) : props2.subtitle;
  7284. const canSwitch = props2.switchMode !== "none";
  7285. return vue.createVNode("div", {
  7286. "class": bem$13("header-subtitle", {
  7287. "with-switch": canSwitch
  7288. }),
  7289. "onClick": onClickSubtitle
  7290. }, [canSwitch ? [renderAction(), vue.createVNode("div", {
  7291. "class": bem$13("header-subtitle-text")
  7292. }, [title]), renderAction(true)] : title]);
  7293. }
  7294. };
  7295. const renderWeekDays = () => {
  7296. const {
  7297. firstDayOfWeek
  7298. } = props2;
  7299. const weekdays = t$g("weekdays");
  7300. const renderWeekDays2 = [...weekdays.slice(firstDayOfWeek, 7), ...weekdays.slice(0, firstDayOfWeek)];
  7301. return vue.createVNode("div", {
  7302. "class": bem$13("weekdays")
  7303. }, [renderWeekDays2.map((text) => vue.createVNode("span", {
  7304. "class": bem$13("weekday")
  7305. }, [text]))]);
  7306. };
  7307. return () => vue.createVNode("div", {
  7308. "class": bem$13("header")
  7309. }, [renderTitle(), renderSubtitle(), renderWeekDays()]);
  7310. }
  7311. });
  7312. const calendarProps = {
  7313. show: Boolean,
  7314. type: makeStringProp("single"),
  7315. switchMode: makeStringProp("none"),
  7316. title: String,
  7317. color: String,
  7318. round: truthProp,
  7319. readonly: Boolean,
  7320. poppable: truthProp,
  7321. maxRange: makeNumericProp(null),
  7322. position: makeStringProp("bottom"),
  7323. teleport: [String, Object],
  7324. showMark: truthProp,
  7325. showTitle: truthProp,
  7326. formatter: Function,
  7327. rowHeight: numericProp,
  7328. confirmText: String,
  7329. rangePrompt: String,
  7330. lazyRender: truthProp,
  7331. showConfirm: truthProp,
  7332. defaultDate: [Date, Array],
  7333. allowSameDay: Boolean,
  7334. showSubtitle: truthProp,
  7335. closeOnPopstate: truthProp,
  7336. showRangePrompt: truthProp,
  7337. confirmDisabledText: String,
  7338. closeOnClickOverlay: truthProp,
  7339. safeAreaInsetTop: Boolean,
  7340. safeAreaInsetBottom: truthProp,
  7341. minDate: {
  7342. type: Date,
  7343. validator: isDate
  7344. },
  7345. maxDate: {
  7346. type: Date,
  7347. validator: isDate
  7348. },
  7349. firstDayOfWeek: {
  7350. type: numericProp,
  7351. default: 0,
  7352. validator: (val) => val >= 0 && val <= 6
  7353. }
  7354. };
  7355. var stdin_default$1d = vue.defineComponent({
  7356. name: name$17,
  7357. props: calendarProps,
  7358. emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate", "panelChange"],
  7359. setup(props2, {
  7360. emit,
  7361. slots
  7362. }) {
  7363. const canSwitch = vue.computed(() => props2.switchMode !== "none");
  7364. const minDate = vue.computed(() => {
  7365. if (!props2.minDate && !canSwitch.value) {
  7366. return getToday();
  7367. }
  7368. return props2.minDate;
  7369. });
  7370. const maxDate = vue.computed(() => {
  7371. if (!props2.maxDate && !canSwitch.value) {
  7372. return getMonthByOffset(getToday(), 6);
  7373. }
  7374. return props2.maxDate;
  7375. });
  7376. const limitDateRange = (date, min = minDate.value, max = maxDate.value) => {
  7377. if (min && compareDay(date, min) === -1) {
  7378. return min;
  7379. }
  7380. if (max && compareDay(date, max) === 1) {
  7381. return max;
  7382. }
  7383. return date;
  7384. };
  7385. const getInitialDate = (defaultDate = props2.defaultDate) => {
  7386. const {
  7387. type,
  7388. allowSameDay
  7389. } = props2;
  7390. if (defaultDate === null) {
  7391. return defaultDate;
  7392. }
  7393. const now = getToday();
  7394. if (type === "range") {
  7395. if (!Array.isArray(defaultDate)) {
  7396. defaultDate = [];
  7397. }
  7398. if (defaultDate.length === 1 && compareDay(defaultDate[0], now) === 1) {
  7399. defaultDate = [];
  7400. }
  7401. const min = minDate.value;
  7402. const max = maxDate.value;
  7403. const start2 = limitDateRange(defaultDate[0] || now, min, max ? allowSameDay ? max : getPrevDay(max) : void 0);
  7404. const end2 = limitDateRange(defaultDate[1] || (allowSameDay ? now : getNextDay(now)), min ? allowSameDay ? min : getNextDay(min) : void 0);
  7405. return [start2, end2];
  7406. }
  7407. if (type === "multiple") {
  7408. if (Array.isArray(defaultDate)) {
  7409. return defaultDate.map((date) => limitDateRange(date));
  7410. }
  7411. return [limitDateRange(now)];
  7412. }
  7413. if (!defaultDate || Array.isArray(defaultDate)) {
  7414. defaultDate = now;
  7415. }
  7416. return limitDateRange(defaultDate);
  7417. };
  7418. const getInitialPanelDate = () => {
  7419. const date = Array.isArray(currentDate.value) ? currentDate.value[0] : currentDate.value;
  7420. return date ? date : limitDateRange(getToday());
  7421. };
  7422. let bodyHeight;
  7423. const bodyRef = vue.ref();
  7424. const currentDate = vue.ref(getInitialDate());
  7425. const currentPanelDate = vue.ref(getInitialPanelDate());
  7426. const currentMonthRef = vue.ref();
  7427. const [monthRefs, setMonthRefs] = useRefs();
  7428. const dayOffset = vue.computed(() => props2.firstDayOfWeek ? +props2.firstDayOfWeek % 7 : 0);
  7429. const months = vue.computed(() => {
  7430. const months2 = [];
  7431. if (!minDate.value || !maxDate.value) {
  7432. return months2;
  7433. }
  7434. const cursor = new Date(minDate.value);
  7435. cursor.setDate(1);
  7436. do {
  7437. months2.push(new Date(cursor));
  7438. cursor.setMonth(cursor.getMonth() + 1);
  7439. } while (compareMonth(cursor, maxDate.value) !== 1);
  7440. return months2;
  7441. });
  7442. const buttonDisabled = vue.computed(() => {
  7443. if (currentDate.value) {
  7444. if (props2.type === "range") {
  7445. return !currentDate.value[0] || !currentDate.value[1];
  7446. }
  7447. if (props2.type === "multiple") {
  7448. return !currentDate.value.length;
  7449. }
  7450. }
  7451. return !currentDate.value;
  7452. });
  7453. const getSelectedDate = () => currentDate.value;
  7454. const onScroll = () => {
  7455. const top2 = getScrollTop(bodyRef.value);
  7456. const bottom2 = top2 + bodyHeight;
  7457. const heights = months.value.map((item, index) => monthRefs.value[index].getHeight());
  7458. const heightSum = heights.reduce((a, b) => a + b, 0);
  7459. if (bottom2 > heightSum && top2 > 0) {
  7460. return;
  7461. }
  7462. let height2 = 0;
  7463. let currentMonth;
  7464. const visibleRange = [-1, -1];
  7465. for (let i = 0; i < months.value.length; i++) {
  7466. const month = monthRefs.value[i];
  7467. const visible = height2 <= bottom2 && height2 + heights[i] >= top2;
  7468. if (visible) {
  7469. visibleRange[1] = i;
  7470. if (!currentMonth) {
  7471. currentMonth = month;
  7472. visibleRange[0] = i;
  7473. }
  7474. if (!monthRefs.value[i].showed) {
  7475. monthRefs.value[i].showed = true;
  7476. emit("monthShow", {
  7477. date: month.date,
  7478. title: month.getTitle()
  7479. });
  7480. }
  7481. }
  7482. height2 += heights[i];
  7483. }
  7484. months.value.forEach((month, index) => {
  7485. const visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
  7486. monthRefs.value[index].setVisible(visible);
  7487. });
  7488. if (currentMonth) {
  7489. currentMonthRef.value = currentMonth;
  7490. }
  7491. };
  7492. const scrollToDate = (targetDate) => {
  7493. if (canSwitch.value) {
  7494. currentPanelDate.value = targetDate;
  7495. } else {
  7496. raf(() => {
  7497. months.value.some((month, index) => {
  7498. if (compareMonth(month, targetDate) === 0) {
  7499. if (bodyRef.value) {
  7500. monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
  7501. }
  7502. return true;
  7503. }
  7504. return false;
  7505. });
  7506. onScroll();
  7507. });
  7508. }
  7509. };
  7510. const scrollToCurrentDate = () => {
  7511. if (props2.poppable && !props2.show) {
  7512. return;
  7513. }
  7514. if (currentDate.value) {
  7515. const targetDate = props2.type === "single" ? currentDate.value : currentDate.value[0];
  7516. if (isDate(targetDate)) {
  7517. scrollToDate(targetDate);
  7518. }
  7519. } else if (!canSwitch.value) {
  7520. raf(onScroll);
  7521. }
  7522. };
  7523. const init = () => {
  7524. if (props2.poppable && !props2.show) {
  7525. return;
  7526. }
  7527. if (!canSwitch.value) {
  7528. raf(() => {
  7529. bodyHeight = Math.floor(useRect(bodyRef).height);
  7530. });
  7531. }
  7532. scrollToCurrentDate();
  7533. };
  7534. const reset = (date = getInitialDate()) => {
  7535. currentDate.value = date;
  7536. scrollToCurrentDate();
  7537. };
  7538. const checkRange = (date) => {
  7539. const {
  7540. maxRange,
  7541. rangePrompt,
  7542. showRangePrompt
  7543. } = props2;
  7544. if (maxRange && calcDateNum(date) > +maxRange) {
  7545. if (showRangePrompt) {
  7546. showToast(rangePrompt || t$g("rangePrompt", maxRange));
  7547. }
  7548. emit("overRange");
  7549. return false;
  7550. }
  7551. return true;
  7552. };
  7553. const onPanelChange = (date) => {
  7554. currentPanelDate.value = date;
  7555. emit("panelChange", {
  7556. date
  7557. });
  7558. };
  7559. const onConfirm = () => {
  7560. var _a;
  7561. return emit("confirm", (_a = currentDate.value) != null ? _a : cloneDates(currentDate.value));
  7562. };
  7563. const select = (date, complete) => {
  7564. const setCurrentDate = (date2) => {
  7565. currentDate.value = date2;
  7566. emit("select", cloneDates(date2));
  7567. };
  7568. if (complete && props2.type === "range") {
  7569. const valid = checkRange(date);
  7570. if (!valid) {
  7571. setCurrentDate([date[0], getDayByOffset(date[0], +props2.maxRange - 1)]);
  7572. return;
  7573. }
  7574. }
  7575. setCurrentDate(date);
  7576. if (complete && !props2.showConfirm) {
  7577. onConfirm();
  7578. }
  7579. };
  7580. const getDisabledDate = (disabledDays2, startDay, date) => {
  7581. var _a;
  7582. return (_a = disabledDays2.find((day) => compareDay(startDay, day.date) === -1 && compareDay(day.date, date) === -1)) == null ? void 0 : _a.date;
  7583. };
  7584. const disabledDays = vue.computed(() => monthRefs.value.reduce((arr, ref2) => {
  7585. var _a, _b;
  7586. arr.push(...(_b = (_a = ref2.disabledDays) == null ? void 0 : _a.value) != null ? _b : []);
  7587. return arr;
  7588. }, []));
  7589. const onClickDay = (item) => {
  7590. if (props2.readonly || !item.date) {
  7591. return;
  7592. }
  7593. const {
  7594. date
  7595. } = item;
  7596. const {
  7597. type
  7598. } = props2;
  7599. if (type === "range") {
  7600. if (!currentDate.value) {
  7601. select([date]);
  7602. return;
  7603. }
  7604. const [startDay, endDay] = currentDate.value;
  7605. if (startDay && !endDay) {
  7606. const compareToStart = compareDay(date, startDay);
  7607. if (compareToStart === 1) {
  7608. const disabledDay = getDisabledDate(disabledDays.value, startDay, date);
  7609. if (disabledDay) {
  7610. const endDay2 = getPrevDay(disabledDay);
  7611. if (compareDay(startDay, endDay2) === -1) {
  7612. select([startDay, endDay2]);
  7613. } else {
  7614. select([date]);
  7615. }
  7616. } else {
  7617. select([startDay, date], true);
  7618. }
  7619. } else if (compareToStart === -1) {
  7620. select([date]);
  7621. } else if (props2.allowSameDay) {
  7622. select([date, date], true);
  7623. }
  7624. } else {
  7625. select([date]);
  7626. }
  7627. } else if (type === "multiple") {
  7628. if (!currentDate.value) {
  7629. select([date]);
  7630. return;
  7631. }
  7632. const dates = currentDate.value;
  7633. const selectedIndex = dates.findIndex((dateItem) => compareDay(dateItem, date) === 0);
  7634. if (selectedIndex !== -1) {
  7635. const [unselectedDate] = dates.splice(selectedIndex, 1);
  7636. emit("unselect", cloneDate(unselectedDate));
  7637. } else if (props2.maxRange && dates.length >= +props2.maxRange) {
  7638. showToast(props2.rangePrompt || t$g("rangePrompt", props2.maxRange));
  7639. } else {
  7640. select([...dates, date]);
  7641. }
  7642. } else {
  7643. select(date, true);
  7644. }
  7645. };
  7646. const updateShow = (value) => emit("update:show", value);
  7647. const renderMonth = (date, index) => {
  7648. const showMonthTitle = index !== 0 || !props2.showSubtitle;
  7649. return vue.createVNode(stdin_default$1f, vue.mergeProps({
  7650. "ref": canSwitch.value ? currentMonthRef : setMonthRefs(index),
  7651. "date": date,
  7652. "currentDate": currentDate.value,
  7653. "showMonthTitle": showMonthTitle,
  7654. "firstDayOfWeek": dayOffset.value,
  7655. "lazyRender": canSwitch.value ? false : props2.lazyRender,
  7656. "maxDate": maxDate.value,
  7657. "minDate": minDate.value
  7658. }, pick(props2, ["type", "color", "showMark", "formatter", "rowHeight", "showSubtitle", "allowSameDay"]), {
  7659. "onClick": onClickDay,
  7660. "onClickDisabledDate": (item) => emit("clickDisabledDate", item)
  7661. }), pick(slots, ["top-info", "bottom-info", "month-title", "text"]));
  7662. };
  7663. const renderFooterButton = () => {
  7664. if (slots.footer) {
  7665. return slots.footer();
  7666. }
  7667. if (props2.showConfirm) {
  7668. const slot = slots["confirm-text"];
  7669. const disabled = buttonDisabled.value;
  7670. const text = disabled ? props2.confirmDisabledText : props2.confirmText;
  7671. return vue.createVNode(Button, {
  7672. "round": true,
  7673. "block": true,
  7674. "type": "primary",
  7675. "color": props2.color,
  7676. "class": bem$13("confirm"),
  7677. "disabled": disabled,
  7678. "nativeType": "button",
  7679. "onClick": onConfirm
  7680. }, {
  7681. default: () => [slot ? slot({
  7682. disabled
  7683. }) : text || t$g("confirm")]
  7684. });
  7685. }
  7686. };
  7687. const renderFooter = () => vue.createVNode("div", {
  7688. "class": [bem$13("footer"), {
  7689. "van-safe-area-bottom": props2.safeAreaInsetBottom
  7690. }]
  7691. }, [renderFooterButton()]);
  7692. const renderCalendar = () => {
  7693. var _a, _b;
  7694. return vue.createVNode("div", {
  7695. "class": bem$13()
  7696. }, [vue.createVNode(stdin_default$1e, {
  7697. "date": (_a = currentMonthRef.value) == null ? void 0 : _a.date,
  7698. "maxDate": maxDate.value,
  7699. "minDate": minDate.value,
  7700. "title": props2.title,
  7701. "subtitle": (_b = currentMonthRef.value) == null ? void 0 : _b.getTitle(),
  7702. "showTitle": props2.showTitle,
  7703. "showSubtitle": props2.showSubtitle,
  7704. "switchMode": props2.switchMode,
  7705. "firstDayOfWeek": dayOffset.value,
  7706. "onClickSubtitle": (event) => emit("clickSubtitle", event),
  7707. "onPanelChange": onPanelChange
  7708. }, pick(slots, ["title", "subtitle", "prev-month", "prev-year", "next-month", "next-year"])), vue.createVNode("div", {
  7709. "ref": bodyRef,
  7710. "class": bem$13("body"),
  7711. "onScroll": canSwitch.value ? void 0 : onScroll
  7712. }, [canSwitch.value ? renderMonth(currentPanelDate.value, 0) : months.value.map(renderMonth)]), renderFooter()]);
  7713. };
  7714. vue.watch(() => props2.show, init);
  7715. vue.watch(() => [props2.type, props2.minDate, props2.maxDate, props2.switchMode], () => reset(getInitialDate(currentDate.value)));
  7716. vue.watch(() => props2.defaultDate, (value) => {
  7717. reset(value);
  7718. });
  7719. useExpose({
  7720. reset,
  7721. scrollToDate,
  7722. getSelectedDate
  7723. });
  7724. onMountedOrActivated(init);
  7725. return () => {
  7726. if (props2.poppable) {
  7727. return vue.createVNode(Popup, {
  7728. "show": props2.show,
  7729. "class": bem$13("popup"),
  7730. "round": props2.round,
  7731. "position": props2.position,
  7732. "closeable": props2.showTitle || props2.showSubtitle,
  7733. "teleport": props2.teleport,
  7734. "closeOnPopstate": props2.closeOnPopstate,
  7735. "safeAreaInsetTop": props2.safeAreaInsetTop,
  7736. "closeOnClickOverlay": props2.closeOnClickOverlay,
  7737. "onUpdate:show": updateShow
  7738. }, {
  7739. default: renderCalendar
  7740. });
  7741. }
  7742. return renderCalendar();
  7743. };
  7744. }
  7745. });
  7746. const Calendar = withInstall(stdin_default$1d);
  7747. const [name$13, bem$12] = createNamespace("image");
  7748. const imageProps = {
  7749. src: String,
  7750. alt: String,
  7751. fit: String,
  7752. position: String,
  7753. round: Boolean,
  7754. block: Boolean,
  7755. width: numericProp,
  7756. height: numericProp,
  7757. radius: numericProp,
  7758. lazyLoad: Boolean,
  7759. iconSize: numericProp,
  7760. showError: truthProp,
  7761. errorIcon: makeStringProp("photo-fail"),
  7762. iconPrefix: String,
  7763. showLoading: truthProp,
  7764. loadingIcon: makeStringProp("photo"),
  7765. crossorigin: String,
  7766. referrerpolicy: String
  7767. };
  7768. var stdin_default$1c = vue.defineComponent({
  7769. name: name$13,
  7770. props: imageProps,
  7771. emits: ["load", "error"],
  7772. setup(props2, {
  7773. emit,
  7774. slots
  7775. }) {
  7776. const error = vue.ref(false);
  7777. const loading = vue.ref(true);
  7778. const imageRef = vue.ref();
  7779. const {
  7780. $Lazyload
  7781. } = vue.getCurrentInstance().proxy;
  7782. const style = vue.computed(() => {
  7783. const style2 = {
  7784. width: addUnit(props2.width),
  7785. height: addUnit(props2.height)
  7786. };
  7787. if (isDef(props2.radius)) {
  7788. style2.overflow = "hidden";
  7789. style2.borderRadius = addUnit(props2.radius);
  7790. }
  7791. return style2;
  7792. });
  7793. vue.watch(() => props2.src, () => {
  7794. error.value = false;
  7795. loading.value = true;
  7796. });
  7797. const onLoad = (event) => {
  7798. if (loading.value) {
  7799. loading.value = false;
  7800. emit("load", event);
  7801. }
  7802. };
  7803. const triggerLoad = () => {
  7804. const loadEvent = new Event("load");
  7805. Object.defineProperty(loadEvent, "target", {
  7806. value: imageRef.value,
  7807. enumerable: true
  7808. });
  7809. onLoad(loadEvent);
  7810. };
  7811. const onError = (event) => {
  7812. error.value = true;
  7813. loading.value = false;
  7814. emit("error", event);
  7815. };
  7816. const renderIcon = (name2, className, slot) => {
  7817. if (slot) {
  7818. return slot();
  7819. }
  7820. return vue.createVNode(Icon, {
  7821. "name": name2,
  7822. "size": props2.iconSize,
  7823. "class": className,
  7824. "classPrefix": props2.iconPrefix
  7825. }, null);
  7826. };
  7827. const renderPlaceholder = () => {
  7828. if (loading.value && props2.showLoading) {
  7829. return vue.createVNode("div", {
  7830. "class": bem$12("loading")
  7831. }, [renderIcon(props2.loadingIcon, bem$12("loading-icon"), slots.loading)]);
  7832. }
  7833. if (error.value && props2.showError) {
  7834. return vue.createVNode("div", {
  7835. "class": bem$12("error")
  7836. }, [renderIcon(props2.errorIcon, bem$12("error-icon"), slots.error)]);
  7837. }
  7838. };
  7839. const renderImage = () => {
  7840. if (error.value || !props2.src) {
  7841. return;
  7842. }
  7843. const attrs = {
  7844. alt: props2.alt,
  7845. class: bem$12("img"),
  7846. style: {
  7847. objectFit: props2.fit,
  7848. objectPosition: props2.position
  7849. },
  7850. crossorigin: props2.crossorigin,
  7851. referrerpolicy: props2.referrerpolicy
  7852. };
  7853. if (props2.lazyLoad) {
  7854. return vue.withDirectives(vue.createVNode("img", vue.mergeProps({
  7855. "ref": imageRef
  7856. }, attrs), null), [[vue.resolveDirective("lazy"), props2.src]]);
  7857. }
  7858. return vue.createVNode("img", vue.mergeProps({
  7859. "ref": imageRef,
  7860. "src": props2.src,
  7861. "onLoad": onLoad,
  7862. "onError": onError
  7863. }, attrs), null);
  7864. };
  7865. const onLazyLoaded = ({
  7866. el
  7867. }) => {
  7868. const check = () => {
  7869. if (el === imageRef.value && loading.value) {
  7870. triggerLoad();
  7871. }
  7872. };
  7873. if (imageRef.value) {
  7874. check();
  7875. } else {
  7876. vue.nextTick(check);
  7877. }
  7878. };
  7879. const onLazyLoadError = ({
  7880. el
  7881. }) => {
  7882. if (el === imageRef.value && !error.value) {
  7883. onError();
  7884. }
  7885. };
  7886. if ($Lazyload && inBrowser$1) {
  7887. $Lazyload.$on("loaded", onLazyLoaded);
  7888. $Lazyload.$on("error", onLazyLoadError);
  7889. vue.onBeforeUnmount(() => {
  7890. $Lazyload.$off("loaded", onLazyLoaded);
  7891. $Lazyload.$off("error", onLazyLoadError);
  7892. });
  7893. }
  7894. vue.onMounted(() => {
  7895. vue.nextTick(() => {
  7896. var _a;
  7897. if (((_a = imageRef.value) == null ? void 0 : _a.complete) && !props2.lazyLoad) {
  7898. triggerLoad();
  7899. }
  7900. });
  7901. });
  7902. return () => {
  7903. var _a;
  7904. return vue.createVNode("div", {
  7905. "class": bem$12({
  7906. round: props2.round,
  7907. block: props2.block
  7908. }),
  7909. "style": style.value
  7910. }, [renderImage(), renderPlaceholder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
  7911. };
  7912. }
  7913. });
  7914. const Image$1 = withInstall(stdin_default$1c);
  7915. const [name$12, bem$11] = createNamespace("card");
  7916. const cardProps = {
  7917. tag: String,
  7918. num: numericProp,
  7919. desc: String,
  7920. thumb: String,
  7921. title: String,
  7922. price: numericProp,
  7923. centered: Boolean,
  7924. lazyLoad: Boolean,
  7925. currency: makeStringProp("¥"),
  7926. thumbLink: String,
  7927. originPrice: numericProp
  7928. };
  7929. var stdin_default$1b = vue.defineComponent({
  7930. name: name$12,
  7931. props: cardProps,
  7932. emits: ["clickThumb"],
  7933. setup(props2, {
  7934. slots,
  7935. emit
  7936. }) {
  7937. const renderTitle = () => {
  7938. if (slots.title) {
  7939. return slots.title();
  7940. }
  7941. if (props2.title) {
  7942. return vue.createVNode("div", {
  7943. "class": [bem$11("title"), "van-multi-ellipsis--l2"]
  7944. }, [props2.title]);
  7945. }
  7946. };
  7947. const renderThumbTag = () => {
  7948. if (slots.tag || props2.tag) {
  7949. return vue.createVNode("div", {
  7950. "class": bem$11("tag")
  7951. }, [slots.tag ? slots.tag() : vue.createVNode(Tag, {
  7952. "mark": true,
  7953. "type": "primary"
  7954. }, {
  7955. default: () => [props2.tag]
  7956. })]);
  7957. }
  7958. };
  7959. const renderThumbImage = () => {
  7960. if (slots.thumb) {
  7961. return slots.thumb();
  7962. }
  7963. return vue.createVNode(Image$1, {
  7964. "src": props2.thumb,
  7965. "fit": "cover",
  7966. "width": "100%",
  7967. "height": "100%",
  7968. "lazyLoad": props2.lazyLoad
  7969. }, null);
  7970. };
  7971. const renderThumb = () => {
  7972. if (slots.thumb || props2.thumb) {
  7973. return vue.createVNode("a", {
  7974. "href": props2.thumbLink,
  7975. "class": bem$11("thumb"),
  7976. "onClick": (event) => emit("clickThumb", event)
  7977. }, [renderThumbImage(), renderThumbTag()]);
  7978. }
  7979. };
  7980. const renderDesc = () => {
  7981. if (slots.desc) {
  7982. return slots.desc();
  7983. }
  7984. if (props2.desc) {
  7985. return vue.createVNode("div", {
  7986. "class": [bem$11("desc"), "van-ellipsis"]
  7987. }, [props2.desc]);
  7988. }
  7989. };
  7990. const renderPriceText = () => {
  7991. const priceArr = props2.price.toString().split(".");
  7992. return vue.createVNode("div", null, [vue.createVNode("span", {
  7993. "class": bem$11("price-currency")
  7994. }, [props2.currency]), vue.createVNode("span", {
  7995. "class": bem$11("price-integer")
  7996. }, [priceArr[0]]), priceArr.length > 1 && vue.createVNode(vue.Fragment, null, [vue.createTextVNode("."), vue.createVNode("span", {
  7997. "class": bem$11("price-decimal")
  7998. }, [priceArr[1]])])]);
  7999. };
  8000. return () => {
  8001. var _a, _b, _c;
  8002. const showNum = slots.num || isDef(props2.num);
  8003. const showPrice = slots.price || isDef(props2.price);
  8004. const showOriginPrice = slots["origin-price"] || isDef(props2.originPrice);
  8005. const showBottom = showNum || showPrice || showOriginPrice || slots.bottom;
  8006. const Price = showPrice && vue.createVNode("div", {
  8007. "class": bem$11("price")
  8008. }, [slots.price ? slots.price() : renderPriceText()]);
  8009. const OriginPrice = showOriginPrice && vue.createVNode("div", {
  8010. "class": bem$11("origin-price")
  8011. }, [slots["origin-price"] ? slots["origin-price"]() : `${props2.currency} ${props2.originPrice}`]);
  8012. const Num = showNum && vue.createVNode("div", {
  8013. "class": bem$11("num")
  8014. }, [slots.num ? slots.num() : `x${props2.num}`]);
  8015. const Footer = slots.footer && vue.createVNode("div", {
  8016. "class": bem$11("footer")
  8017. }, [slots.footer()]);
  8018. const Bottom = showBottom && vue.createVNode("div", {
  8019. "class": bem$11("bottom")
  8020. }, [(_a = slots["price-top"]) == null ? void 0 : _a.call(slots), Price, OriginPrice, Num, (_b = slots.bottom) == null ? void 0 : _b.call(slots)]);
  8021. return vue.createVNode("div", {
  8022. "class": bem$11()
  8023. }, [vue.createVNode("div", {
  8024. "class": bem$11("header")
  8025. }, [renderThumb(), vue.createVNode("div", {
  8026. "class": bem$11("content", {
  8027. centered: props2.centered
  8028. })
  8029. }, [vue.createVNode("div", null, [renderTitle(), renderDesc(), (_c = slots.tags) == null ? void 0 : _c.call(slots)]), Bottom])]), Footer]);
  8030. };
  8031. }
  8032. });
  8033. const Card = withInstall(stdin_default$1b);
  8034. const [name$11, bem$10, t$f] = createNamespace("cascader");
  8035. const cascaderProps = {
  8036. title: String,
  8037. options: makeArrayProp(),
  8038. closeable: truthProp,
  8039. swipeable: truthProp,
  8040. closeIcon: makeStringProp("cross"),
  8041. showHeader: truthProp,
  8042. modelValue: numericProp,
  8043. fieldNames: Object,
  8044. placeholder: String,
  8045. activeColor: String
  8046. };
  8047. var stdin_default$1a = vue.defineComponent({
  8048. name: name$11,
  8049. props: cascaderProps,
  8050. emits: ["close", "change", "finish", "clickTab", "update:modelValue"],
  8051. setup(props2, {
  8052. slots,
  8053. emit
  8054. }) {
  8055. const tabs = vue.ref([]);
  8056. const activeTab = vue.ref(0);
  8057. const [selectedElementRefs, setSelectedElementRefs] = useRefs();
  8058. const {
  8059. text: textKey,
  8060. value: valueKey,
  8061. children: childrenKey
  8062. } = extend({
  8063. text: "text",
  8064. value: "value",
  8065. children: "children"
  8066. }, props2.fieldNames);
  8067. const getSelectedOptionsByValue = (options, value) => {
  8068. for (const option of options) {
  8069. if (option[valueKey] === value) {
  8070. return [option];
  8071. }
  8072. if (option[childrenKey]) {
  8073. const selectedOptions = getSelectedOptionsByValue(option[childrenKey], value);
  8074. if (selectedOptions) {
  8075. return [option, ...selectedOptions];
  8076. }
  8077. }
  8078. }
  8079. };
  8080. const updateTabs = () => {
  8081. const {
  8082. options,
  8083. modelValue
  8084. } = props2;
  8085. if (modelValue !== void 0) {
  8086. const selectedOptions = getSelectedOptionsByValue(options, modelValue);
  8087. if (selectedOptions) {
  8088. let optionsCursor = options;
  8089. tabs.value = selectedOptions.map((option) => {
  8090. const tab = {
  8091. options: optionsCursor,
  8092. selected: option
  8093. };
  8094. const next = optionsCursor.find((item) => item[valueKey] === option[valueKey]);
  8095. if (next) {
  8096. optionsCursor = next[childrenKey];
  8097. }
  8098. return tab;
  8099. });
  8100. if (optionsCursor) {
  8101. tabs.value.push({
  8102. options: optionsCursor,
  8103. selected: null
  8104. });
  8105. }
  8106. vue.nextTick(() => {
  8107. activeTab.value = tabs.value.length - 1;
  8108. });
  8109. return;
  8110. }
  8111. }
  8112. tabs.value = [{
  8113. options,
  8114. selected: null
  8115. }];
  8116. };
  8117. const onSelect = (option, tabIndex) => {
  8118. if (option.disabled) {
  8119. return;
  8120. }
  8121. tabs.value[tabIndex].selected = option;
  8122. if (tabs.value.length > tabIndex + 1) {
  8123. tabs.value = tabs.value.slice(0, tabIndex + 1);
  8124. }
  8125. if (option[childrenKey]) {
  8126. const nextTab = {
  8127. options: option[childrenKey],
  8128. selected: null
  8129. };
  8130. if (tabs.value[tabIndex + 1]) {
  8131. tabs.value[tabIndex + 1] = nextTab;
  8132. } else {
  8133. tabs.value.push(nextTab);
  8134. }
  8135. vue.nextTick(() => {
  8136. activeTab.value++;
  8137. });
  8138. }
  8139. const selectedOptions = tabs.value.map((tab) => tab.selected).filter(Boolean);
  8140. emit("update:modelValue", option[valueKey]);
  8141. const params = {
  8142. value: option[valueKey],
  8143. tabIndex,
  8144. selectedOptions
  8145. };
  8146. emit("change", params);
  8147. if (!option[childrenKey]) {
  8148. emit("finish", params);
  8149. }
  8150. };
  8151. const onClose = () => emit("close");
  8152. const onClickTab = ({
  8153. name: name2,
  8154. title
  8155. }) => emit("clickTab", name2, title);
  8156. const renderHeader = () => props2.showHeader ? vue.createVNode("div", {
  8157. "class": bem$10("header")
  8158. }, [vue.createVNode("h2", {
  8159. "class": bem$10("title")
  8160. }, [slots.title ? slots.title() : props2.title]), props2.closeable ? vue.createVNode(Icon, {
  8161. "name": props2.closeIcon,
  8162. "class": [bem$10("close-icon"), HAPTICS_FEEDBACK],
  8163. "onClick": onClose
  8164. }, null) : null]) : null;
  8165. const renderOption = (option, selectedOption, tabIndex) => {
  8166. const {
  8167. disabled
  8168. } = option;
  8169. const selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
  8170. const color = option.color || (selected ? props2.activeColor : void 0);
  8171. const Text = slots.option ? slots.option({
  8172. option,
  8173. selected
  8174. }) : vue.createVNode("span", null, [option[textKey]]);
  8175. return vue.createVNode("li", {
  8176. "ref": selected ? setSelectedElementRefs(tabIndex) : void 0,
  8177. "role": "menuitemradio",
  8178. "class": [bem$10("option", {
  8179. selected,
  8180. disabled
  8181. }), option.className],
  8182. "style": {
  8183. color
  8184. },
  8185. "tabindex": disabled ? void 0 : selected ? 0 : -1,
  8186. "aria-checked": selected,
  8187. "aria-disabled": disabled || void 0,
  8188. "onClick": () => onSelect(option, tabIndex)
  8189. }, [Text, selected ? vue.createVNode(Icon, {
  8190. "name": "success",
  8191. "class": bem$10("selected-icon")
  8192. }, null) : null]);
  8193. };
  8194. const renderOptions = (options, selectedOption, tabIndex) => vue.createVNode("ul", {
  8195. "role": "menu",
  8196. "class": bem$10("options")
  8197. }, [options.map((option) => renderOption(option, selectedOption, tabIndex))]);
  8198. const renderTab = (tab, tabIndex) => {
  8199. const {
  8200. options,
  8201. selected
  8202. } = tab;
  8203. const placeholder = props2.placeholder || t$f("select");
  8204. const title = selected ? selected[textKey] : placeholder;
  8205. return vue.createVNode(Tab, {
  8206. "title": title,
  8207. "titleClass": bem$10("tab", {
  8208. unselected: !selected
  8209. })
  8210. }, {
  8211. default: () => {
  8212. var _a, _b;
  8213. return [(_a = slots["options-top"]) == null ? void 0 : _a.call(slots, {
  8214. tabIndex
  8215. }), renderOptions(options, selected, tabIndex), (_b = slots["options-bottom"]) == null ? void 0 : _b.call(slots, {
  8216. tabIndex
  8217. })];
  8218. }
  8219. });
  8220. };
  8221. const renderTabs = () => vue.createVNode(Tabs, {
  8222. "active": activeTab.value,
  8223. "onUpdate:active": ($event) => activeTab.value = $event,
  8224. "shrink": true,
  8225. "animated": true,
  8226. "class": bem$10("tabs"),
  8227. "color": props2.activeColor,
  8228. "swipeable": props2.swipeable,
  8229. "onClickTab": onClickTab
  8230. }, {
  8231. default: () => [tabs.value.map(renderTab)]
  8232. });
  8233. const scrollIntoView = (el) => {
  8234. const scrollParent = el.parentElement;
  8235. if (scrollParent) {
  8236. scrollParent.scrollTop = el.offsetTop - (scrollParent.offsetHeight - el.offsetHeight) / 2;
  8237. }
  8238. };
  8239. updateTabs();
  8240. vue.watch(activeTab, (value) => {
  8241. const el = selectedElementRefs.value[value];
  8242. if (el) scrollIntoView(el);
  8243. });
  8244. vue.watch(() => props2.options, updateTabs, {
  8245. deep: true
  8246. });
  8247. vue.watch(() => props2.modelValue, (value) => {
  8248. if (value !== void 0) {
  8249. const values = tabs.value.map((tab) => {
  8250. var _a;
  8251. return (_a = tab.selected) == null ? void 0 : _a[valueKey];
  8252. });
  8253. if (values.includes(value)) {
  8254. return;
  8255. }
  8256. }
  8257. updateTabs();
  8258. });
  8259. return () => vue.createVNode("div", {
  8260. "class": bem$10()
  8261. }, [renderHeader(), renderTabs()]);
  8262. }
  8263. });
  8264. const Cascader = withInstall(stdin_default$1a);
  8265. const [name$10, bem$$] = createNamespace("cell-group");
  8266. const cellGroupProps = {
  8267. title: String,
  8268. inset: Boolean,
  8269. border: truthProp
  8270. };
  8271. var stdin_default$19 = vue.defineComponent({
  8272. name: name$10,
  8273. inheritAttrs: false,
  8274. props: cellGroupProps,
  8275. setup(props2, {
  8276. slots,
  8277. attrs
  8278. }) {
  8279. const renderGroup = () => {
  8280. var _a;
  8281. return vue.createVNode("div", vue.mergeProps({
  8282. "class": [bem$$({
  8283. inset: props2.inset
  8284. }), {
  8285. [BORDER_TOP_BOTTOM]: props2.border && !props2.inset
  8286. }]
  8287. }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  8288. };
  8289. const renderTitle = () => vue.createVNode("div", {
  8290. "class": bem$$("title", {
  8291. inset: props2.inset
  8292. })
  8293. }, [slots.title ? slots.title() : props2.title]);
  8294. return () => {
  8295. if (props2.title || slots.title) {
  8296. return vue.createVNode(vue.Fragment, null, [renderTitle(), renderGroup()]);
  8297. }
  8298. return renderGroup();
  8299. };
  8300. }
  8301. });
  8302. const CellGroup = withInstall(stdin_default$19);
  8303. const [name$$, bem$_] = createNamespace("circle");
  8304. let uid = 0;
  8305. const format = (rate) => Math.min(Math.max(+rate, 0), 100);
  8306. function getPath(clockwise, viewBoxSize) {
  8307. const sweepFlag = clockwise ? 1 : 0;
  8308. return `M ${viewBoxSize / 2} ${viewBoxSize / 2} m 0, -500 a 500, 500 0 1, ${sweepFlag} 0, 1000 a 500, 500 0 1, ${sweepFlag} 0, -1000`;
  8309. }
  8310. const circleProps = {
  8311. text: String,
  8312. size: numericProp,
  8313. fill: makeStringProp("none"),
  8314. rate: makeNumericProp(100),
  8315. speed: makeNumericProp(0),
  8316. color: [String, Object],
  8317. clockwise: truthProp,
  8318. layerColor: String,
  8319. currentRate: makeNumberProp(0),
  8320. strokeWidth: makeNumericProp(40),
  8321. strokeLinecap: String,
  8322. startPosition: makeStringProp("top")
  8323. };
  8324. var stdin_default$18 = vue.defineComponent({
  8325. name: name$$,
  8326. props: circleProps,
  8327. emits: ["update:currentRate"],
  8328. setup(props2, {
  8329. emit,
  8330. slots
  8331. }) {
  8332. const id = `van-circle-${uid++}`;
  8333. const viewBoxSize = vue.computed(() => +props2.strokeWidth + 1e3);
  8334. const path = vue.computed(() => getPath(props2.clockwise, viewBoxSize.value));
  8335. const svgStyle = vue.computed(() => {
  8336. const ROTATE_ANGLE_MAP = {
  8337. top: 0,
  8338. right: 90,
  8339. bottom: 180,
  8340. left: 270
  8341. };
  8342. const angleValue = ROTATE_ANGLE_MAP[props2.startPosition];
  8343. if (angleValue) {
  8344. return {
  8345. transform: `rotate(${angleValue}deg)`
  8346. };
  8347. }
  8348. });
  8349. vue.watch(() => props2.rate, (rate) => {
  8350. let rafId;
  8351. const startTime = Date.now();
  8352. const startRate = props2.currentRate;
  8353. const endRate = format(rate);
  8354. const duration = Math.abs((startRate - endRate) * 1e3 / +props2.speed);
  8355. const animate = () => {
  8356. const now = Date.now();
  8357. const progress = Math.min((now - startTime) / duration, 1);
  8358. const rate2 = progress * (endRate - startRate) + startRate;
  8359. emit("update:currentRate", format(parseFloat(rate2.toFixed(1))));
  8360. if (endRate > startRate ? rate2 < endRate : rate2 > endRate) {
  8361. rafId = raf(animate);
  8362. }
  8363. };
  8364. if (props2.speed) {
  8365. if (rafId) {
  8366. cancelRaf(rafId);
  8367. }
  8368. rafId = raf(animate);
  8369. } else {
  8370. emit("update:currentRate", endRate);
  8371. }
  8372. }, {
  8373. immediate: true
  8374. });
  8375. const renderHover = () => {
  8376. const PERIMETER = 3140;
  8377. const {
  8378. strokeWidth,
  8379. currentRate,
  8380. strokeLinecap
  8381. } = props2;
  8382. const offset2 = PERIMETER * currentRate / 100;
  8383. const color = isObject$1(props2.color) ? `url(#${id})` : props2.color;
  8384. const style = {
  8385. stroke: color,
  8386. strokeWidth: `${+strokeWidth + 1}px`,
  8387. strokeLinecap,
  8388. strokeDasharray: `${offset2}px ${PERIMETER}px`
  8389. };
  8390. return vue.createVNode("path", {
  8391. "d": path.value,
  8392. "style": style,
  8393. "class": bem$_("hover"),
  8394. "stroke": color
  8395. }, null);
  8396. };
  8397. const renderLayer = () => {
  8398. const style = {
  8399. fill: props2.fill,
  8400. stroke: props2.layerColor,
  8401. strokeWidth: `${props2.strokeWidth}px`
  8402. };
  8403. return vue.createVNode("path", {
  8404. "class": bem$_("layer"),
  8405. "style": style,
  8406. "d": path.value
  8407. }, null);
  8408. };
  8409. const renderGradient = () => {
  8410. const {
  8411. color
  8412. } = props2;
  8413. if (!isObject$1(color)) {
  8414. return;
  8415. }
  8416. const Stops = Object.keys(color).sort((a, b) => parseFloat(a) - parseFloat(b)).map((key, index) => vue.createVNode("stop", {
  8417. "key": index,
  8418. "offset": key,
  8419. "stop-color": color[key]
  8420. }, null));
  8421. return vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8422. "id": id,
  8423. "x1": "100%",
  8424. "y1": "0%",
  8425. "x2": "0%",
  8426. "y2": "0%"
  8427. }, [Stops])]);
  8428. };
  8429. const renderText = () => {
  8430. if (slots.default) {
  8431. return slots.default();
  8432. }
  8433. if (props2.text) {
  8434. return vue.createVNode("div", {
  8435. "class": bem$_("text")
  8436. }, [props2.text]);
  8437. }
  8438. };
  8439. return () => vue.createVNode("div", {
  8440. "class": bem$_(),
  8441. "style": getSizeStyle(props2.size)
  8442. }, [vue.createVNode("svg", {
  8443. "viewBox": `0 0 ${viewBoxSize.value} ${viewBoxSize.value}`,
  8444. "style": svgStyle.value
  8445. }, [renderGradient(), renderLayer(), renderHover()]), renderText()]);
  8446. }
  8447. });
  8448. const Circle = withInstall(stdin_default$18);
  8449. const [name$_, bem$Z] = createNamespace("row");
  8450. const ROW_KEY = Symbol(name$_);
  8451. const rowProps = {
  8452. tag: makeStringProp("div"),
  8453. wrap: truthProp,
  8454. align: String,
  8455. gutter: {
  8456. type: [String, Number, Array],
  8457. default: 0
  8458. },
  8459. justify: String
  8460. };
  8461. var stdin_default$17 = vue.defineComponent({
  8462. name: name$_,
  8463. props: rowProps,
  8464. setup(props2, {
  8465. slots
  8466. }) {
  8467. const {
  8468. children,
  8469. linkChildren
  8470. } = useChildren(ROW_KEY);
  8471. const groups = vue.computed(() => {
  8472. const groups2 = [[]];
  8473. let totalSpan = 0;
  8474. children.forEach((child, index) => {
  8475. totalSpan += Number(child.span);
  8476. if (totalSpan > 24) {
  8477. groups2.push([index]);
  8478. totalSpan -= 24;
  8479. } else {
  8480. groups2[groups2.length - 1].push(index);
  8481. }
  8482. });
  8483. return groups2;
  8484. });
  8485. const spaces = vue.computed(() => {
  8486. let gutter = 0;
  8487. if (Array.isArray(props2.gutter)) {
  8488. gutter = Number(props2.gutter[0]) || 0;
  8489. } else {
  8490. gutter = Number(props2.gutter);
  8491. }
  8492. const spaces2 = [];
  8493. if (!gutter) {
  8494. return spaces2;
  8495. }
  8496. groups.value.forEach((group) => {
  8497. const averagePadding = gutter * (group.length - 1) / group.length;
  8498. group.forEach((item, index) => {
  8499. if (index === 0) {
  8500. spaces2.push({
  8501. right: averagePadding
  8502. });
  8503. } else {
  8504. const left2 = gutter - spaces2[item - 1].right;
  8505. const right2 = averagePadding - left2;
  8506. spaces2.push({
  8507. left: left2,
  8508. right: right2
  8509. });
  8510. }
  8511. });
  8512. });
  8513. return spaces2;
  8514. });
  8515. const verticalSpaces = vue.computed(() => {
  8516. const {
  8517. gutter
  8518. } = props2;
  8519. const spaces2 = [];
  8520. if (Array.isArray(gutter) && gutter.length > 1) {
  8521. const bottom2 = Number(gutter[1]) || 0;
  8522. if (bottom2 <= 0) {
  8523. return spaces2;
  8524. }
  8525. groups.value.forEach((group, index) => {
  8526. if (index === groups.value.length - 1) return;
  8527. group.forEach(() => {
  8528. spaces2.push({
  8529. bottom: bottom2
  8530. });
  8531. });
  8532. });
  8533. }
  8534. return spaces2;
  8535. });
  8536. linkChildren({
  8537. spaces,
  8538. verticalSpaces
  8539. });
  8540. return () => {
  8541. const {
  8542. tag,
  8543. wrap,
  8544. align,
  8545. justify
  8546. } = props2;
  8547. return vue.createVNode(tag, {
  8548. "class": bem$Z({
  8549. [`align-${align}`]: align,
  8550. [`justify-${justify}`]: justify,
  8551. nowrap: !wrap
  8552. })
  8553. }, {
  8554. default: () => {
  8555. var _a;
  8556. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  8557. }
  8558. });
  8559. };
  8560. }
  8561. });
  8562. const [name$Z, bem$Y] = createNamespace("col");
  8563. const colProps = {
  8564. tag: makeStringProp("div"),
  8565. span: makeNumericProp(0),
  8566. offset: numericProp
  8567. };
  8568. var stdin_default$16 = vue.defineComponent({
  8569. name: name$Z,
  8570. props: colProps,
  8571. setup(props2, {
  8572. slots
  8573. }) {
  8574. const {
  8575. parent,
  8576. index
  8577. } = useParent(ROW_KEY);
  8578. const style = vue.computed(() => {
  8579. if (!parent) {
  8580. return;
  8581. }
  8582. const {
  8583. spaces,
  8584. verticalSpaces
  8585. } = parent;
  8586. let styles = {};
  8587. if (spaces && spaces.value && spaces.value[index.value]) {
  8588. const {
  8589. left: left2,
  8590. right: right2
  8591. } = spaces.value[index.value];
  8592. styles = {
  8593. paddingLeft: left2 ? `${left2}px` : null,
  8594. paddingRight: right2 ? `${right2}px` : null
  8595. };
  8596. }
  8597. const {
  8598. bottom: bottom2
  8599. } = verticalSpaces.value[index.value] || {};
  8600. return extend(styles, {
  8601. marginBottom: bottom2 ? `${bottom2}px` : null
  8602. });
  8603. });
  8604. return () => {
  8605. const {
  8606. tag,
  8607. span,
  8608. offset: offset2
  8609. } = props2;
  8610. return vue.createVNode(tag, {
  8611. "style": style.value,
  8612. "class": bem$Y({
  8613. [span]: span,
  8614. [`offset-${offset2}`]: offset2
  8615. })
  8616. }, {
  8617. default: () => {
  8618. var _a;
  8619. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  8620. }
  8621. });
  8622. };
  8623. }
  8624. });
  8625. const Col = withInstall(stdin_default$16);
  8626. const [name$Y, bem$X] = createNamespace("collapse");
  8627. const COLLAPSE_KEY = Symbol(name$Y);
  8628. const collapseProps = {
  8629. border: truthProp,
  8630. accordion: Boolean,
  8631. modelValue: {
  8632. type: [String, Number, Array],
  8633. default: ""
  8634. }
  8635. };
  8636. var stdin_default$15 = vue.defineComponent({
  8637. name: name$Y,
  8638. props: collapseProps,
  8639. emits: ["change", "update:modelValue"],
  8640. setup(props2, {
  8641. emit,
  8642. slots
  8643. }) {
  8644. const {
  8645. linkChildren,
  8646. children
  8647. } = useChildren(COLLAPSE_KEY);
  8648. const updateName = (name2) => {
  8649. emit("change", name2);
  8650. emit("update:modelValue", name2);
  8651. };
  8652. const toggle = (name2, expanded) => {
  8653. const {
  8654. accordion,
  8655. modelValue
  8656. } = props2;
  8657. if (accordion) {
  8658. updateName(name2 === modelValue ? "" : name2);
  8659. } else if (expanded) {
  8660. updateName(modelValue.concat(name2));
  8661. } else {
  8662. updateName(modelValue.filter((activeName) => activeName !== name2));
  8663. }
  8664. };
  8665. const toggleAll = (options = {}) => {
  8666. if (props2.accordion) {
  8667. return;
  8668. }
  8669. if (typeof options === "boolean") {
  8670. options = {
  8671. expanded: options
  8672. };
  8673. }
  8674. const {
  8675. expanded,
  8676. skipDisabled
  8677. } = options;
  8678. const expandedChildren = children.filter((item) => {
  8679. if (item.disabled && skipDisabled) {
  8680. return item.expanded.value;
  8681. }
  8682. return expanded != null ? expanded : !item.expanded.value;
  8683. });
  8684. const names = expandedChildren.map((item) => item.itemName.value);
  8685. updateName(names);
  8686. };
  8687. const isExpanded = (name2) => {
  8688. const {
  8689. accordion,
  8690. modelValue
  8691. } = props2;
  8692. return accordion ? modelValue === name2 : modelValue.includes(name2);
  8693. };
  8694. useExpose({
  8695. toggleAll
  8696. });
  8697. linkChildren({
  8698. toggle,
  8699. isExpanded
  8700. });
  8701. return () => {
  8702. var _a;
  8703. return vue.createVNode("div", {
  8704. "class": [bem$X(), {
  8705. [BORDER_TOP_BOTTOM]: props2.border
  8706. }]
  8707. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  8708. };
  8709. }
  8710. });
  8711. const Collapse = withInstall(stdin_default$15);
  8712. const [name$X, bem$W] = createNamespace("collapse-item");
  8713. const CELL_SLOTS = ["icon", "title", "value", "label", "right-icon"];
  8714. const collapseItemProps = extend({}, cellSharedProps, {
  8715. name: numericProp,
  8716. isLink: truthProp,
  8717. disabled: Boolean,
  8718. readonly: Boolean,
  8719. lazyRender: truthProp
  8720. });
  8721. var stdin_default$14 = vue.defineComponent({
  8722. name: name$X,
  8723. props: collapseItemProps,
  8724. setup(props2, {
  8725. slots
  8726. }) {
  8727. const wrapperRef = vue.ref();
  8728. const contentRef = vue.ref();
  8729. const {
  8730. parent,
  8731. index
  8732. } = useParent(COLLAPSE_KEY);
  8733. if (!parent) {
  8734. return;
  8735. }
  8736. const name2 = vue.computed(() => {
  8737. var _a;
  8738. return (_a = props2.name) != null ? _a : index.value;
  8739. });
  8740. const expanded = vue.computed(() => parent.isExpanded(name2.value));
  8741. const show = vue.ref(expanded.value);
  8742. const lazyRender = useLazyRender(() => show.value || !props2.lazyRender);
  8743. const onTransitionEnd = () => {
  8744. if (!expanded.value) {
  8745. show.value = false;
  8746. } else if (wrapperRef.value) {
  8747. wrapperRef.value.style.height = "";
  8748. }
  8749. };
  8750. vue.watch(expanded, (value, oldValue) => {
  8751. if (oldValue === null) {
  8752. return;
  8753. }
  8754. if (value) {
  8755. show.value = true;
  8756. }
  8757. const tick = value ? vue.nextTick : raf;
  8758. tick(() => {
  8759. if (!contentRef.value || !wrapperRef.value) {
  8760. return;
  8761. }
  8762. const {
  8763. offsetHeight
  8764. } = contentRef.value;
  8765. if (offsetHeight) {
  8766. const contentHeight = `${offsetHeight}px`;
  8767. wrapperRef.value.style.height = value ? "0" : contentHeight;
  8768. doubleRaf(() => {
  8769. if (wrapperRef.value) {
  8770. wrapperRef.value.style.height = value ? contentHeight : "0";
  8771. }
  8772. });
  8773. } else {
  8774. onTransitionEnd();
  8775. }
  8776. });
  8777. });
  8778. const toggle = (newValue = !expanded.value) => {
  8779. parent.toggle(name2.value, newValue);
  8780. };
  8781. const onClickTitle = () => {
  8782. if (!props2.disabled && !props2.readonly) {
  8783. toggle();
  8784. }
  8785. };
  8786. const renderTitle = () => {
  8787. const {
  8788. border,
  8789. disabled,
  8790. readonly
  8791. } = props2;
  8792. const attrs = pick(props2, Object.keys(cellSharedProps));
  8793. if (readonly) {
  8794. attrs.isLink = false;
  8795. }
  8796. if (disabled || readonly) {
  8797. attrs.clickable = false;
  8798. }
  8799. return vue.createVNode(Cell, vue.mergeProps({
  8800. "role": "button",
  8801. "class": bem$W("title", {
  8802. disabled,
  8803. expanded: expanded.value,
  8804. borderless: !border
  8805. }),
  8806. "aria-expanded": String(expanded.value),
  8807. "onClick": onClickTitle
  8808. }, attrs), pick(slots, CELL_SLOTS));
  8809. };
  8810. const renderContent = lazyRender(() => {
  8811. var _a;
  8812. return vue.withDirectives(vue.createVNode("div", {
  8813. "ref": wrapperRef,
  8814. "class": bem$W("wrapper"),
  8815. "onTransitionend": onTransitionEnd
  8816. }, [vue.createVNode("div", {
  8817. "ref": contentRef,
  8818. "class": bem$W("content")
  8819. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[vue.vShow, show.value]]);
  8820. });
  8821. useExpose({
  8822. toggle,
  8823. expanded,
  8824. itemName: name2
  8825. });
  8826. return () => vue.createVNode("div", {
  8827. "class": [bem$W({
  8828. border: index.value && props2.border
  8829. })]
  8830. }, [renderTitle(), renderContent()]);
  8831. }
  8832. });
  8833. const CollapseItem = withInstall(stdin_default$14);
  8834. const ConfigProvider = withInstall(stdin_default$1S);
  8835. const [name$W, bem$V, t$e] = createNamespace("contact-card");
  8836. const contactCardProps = {
  8837. tel: String,
  8838. name: String,
  8839. type: makeStringProp("add"),
  8840. addText: String,
  8841. editable: truthProp
  8842. };
  8843. var stdin_default$13 = vue.defineComponent({
  8844. name: name$W,
  8845. props: contactCardProps,
  8846. emits: ["click"],
  8847. setup(props2, {
  8848. emit
  8849. }) {
  8850. const onClick = (event) => {
  8851. if (props2.editable) {
  8852. emit("click", event);
  8853. }
  8854. };
  8855. const renderContent = () => {
  8856. if (props2.type === "add") {
  8857. return props2.addText || t$e("addContact");
  8858. }
  8859. return [vue.createVNode("div", null, [`${t$e("name")}:${props2.name}`]), vue.createVNode("div", null, [`${t$e("tel")}:${props2.tel}`])];
  8860. };
  8861. return () => vue.createVNode(Cell, {
  8862. "center": true,
  8863. "icon": props2.type === "edit" ? "contact" : "add-square",
  8864. "class": bem$V([props2.type]),
  8865. "border": false,
  8866. "isLink": props2.editable,
  8867. "titleClass": bem$V("title"),
  8868. "onClick": onClick
  8869. }, {
  8870. title: renderContent
  8871. });
  8872. }
  8873. });
  8874. const ContactCard = withInstall(stdin_default$13);
  8875. const [name$V, bem$U, t$d] = createNamespace("contact-edit");
  8876. const DEFAULT_CONTACT = {
  8877. tel: "",
  8878. name: ""
  8879. };
  8880. const contactEditProps = {
  8881. isEdit: Boolean,
  8882. isSaving: Boolean,
  8883. isDeleting: Boolean,
  8884. showSetDefault: Boolean,
  8885. setDefaultLabel: String,
  8886. contactInfo: {
  8887. type: Object,
  8888. default: () => extend({}, DEFAULT_CONTACT)
  8889. },
  8890. telValidator: {
  8891. type: Function,
  8892. default: isMobile
  8893. }
  8894. };
  8895. var stdin_default$12 = vue.defineComponent({
  8896. name: name$V,
  8897. props: contactEditProps,
  8898. emits: ["save", "delete", "changeDefault"],
  8899. setup(props2, {
  8900. emit
  8901. }) {
  8902. const contact = vue.reactive(extend({}, DEFAULT_CONTACT, props2.contactInfo));
  8903. const onSave = () => {
  8904. if (!props2.isSaving) {
  8905. emit("save", contact);
  8906. }
  8907. };
  8908. const onDelete = () => emit("delete", contact);
  8909. const renderButtons = () => vue.createVNode("div", {
  8910. "class": bem$U("buttons")
  8911. }, [vue.createVNode(Button, {
  8912. "block": true,
  8913. "round": true,
  8914. "type": "primary",
  8915. "text": t$d("save"),
  8916. "class": bem$U("button"),
  8917. "loading": props2.isSaving,
  8918. "nativeType": "submit"
  8919. }, null), props2.isEdit && vue.createVNode(Button, {
  8920. "block": true,
  8921. "round": true,
  8922. "text": t$d("delete"),
  8923. "class": bem$U("button"),
  8924. "loading": props2.isDeleting,
  8925. "onClick": onDelete
  8926. }, null)]);
  8927. const renderSwitch = () => vue.createVNode(Switch, {
  8928. "modelValue": contact.isDefault,
  8929. "onUpdate:modelValue": ($event) => contact.isDefault = $event,
  8930. "onChange": (checked) => emit("changeDefault", checked)
  8931. }, null);
  8932. const renderSetDefault = () => {
  8933. if (props2.showSetDefault) {
  8934. return vue.createVNode(Cell, {
  8935. "title": props2.setDefaultLabel,
  8936. "class": bem$U("switch-cell"),
  8937. "border": false
  8938. }, {
  8939. "right-icon": renderSwitch
  8940. });
  8941. }
  8942. };
  8943. vue.watch(() => props2.contactInfo, (value) => extend(contact, DEFAULT_CONTACT, value));
  8944. return () => vue.createVNode(Form, {
  8945. "class": bem$U(),
  8946. "onSubmit": onSave
  8947. }, {
  8948. default: () => [vue.createVNode("div", {
  8949. "class": bem$U("fields")
  8950. }, [vue.createVNode(Field, {
  8951. "modelValue": contact.name,
  8952. "onUpdate:modelValue": ($event) => contact.name = $event,
  8953. "clearable": true,
  8954. "label": t$d("name"),
  8955. "rules": [{
  8956. required: true,
  8957. message: t$d("nameEmpty")
  8958. }],
  8959. "maxlength": "30",
  8960. "placeholder": t$d("name")
  8961. }, null), vue.createVNode(Field, {
  8962. "modelValue": contact.tel,
  8963. "onUpdate:modelValue": ($event) => contact.tel = $event,
  8964. "clearable": true,
  8965. "type": "tel",
  8966. "label": t$d("tel"),
  8967. "rules": [{
  8968. validator: props2.telValidator,
  8969. message: t$d("telInvalid")
  8970. }],
  8971. "placeholder": t$d("tel")
  8972. }, null)]), renderSetDefault(), renderButtons()]
  8973. });
  8974. }
  8975. });
  8976. const ContactEdit = withInstall(stdin_default$12);
  8977. const [name$U, bem$T, t$c] = createNamespace("contact-list");
  8978. const contactListProps = {
  8979. list: Array,
  8980. addText: String,
  8981. modelValue: unknownProp,
  8982. defaultTagText: String
  8983. };
  8984. var stdin_default$11 = vue.defineComponent({
  8985. name: name$U,
  8986. props: contactListProps,
  8987. emits: ["add", "edit", "select", "update:modelValue"],
  8988. setup(props2, {
  8989. emit
  8990. }) {
  8991. const renderItem = (item, index) => {
  8992. const onClick = () => {
  8993. emit("update:modelValue", item.id);
  8994. emit("select", item, index);
  8995. };
  8996. const renderRightIcon = () => vue.createVNode(Radio, {
  8997. "class": bem$T("radio"),
  8998. "name": item.id,
  8999. "iconSize": 18
  9000. }, null);
  9001. const renderEditIcon = () => vue.createVNode(Icon, {
  9002. "name": "edit",
  9003. "class": bem$T("edit"),
  9004. "onClick": (event) => {
  9005. event.stopPropagation();
  9006. emit("edit", item, index);
  9007. }
  9008. }, null);
  9009. const renderContent = () => {
  9010. const nodes = [`${item.name},${item.tel}`];
  9011. if (item.isDefault && props2.defaultTagText) {
  9012. nodes.push(vue.createVNode(Tag, {
  9013. "type": "primary",
  9014. "round": true,
  9015. "class": bem$T("item-tag")
  9016. }, {
  9017. default: () => [props2.defaultTagText]
  9018. }));
  9019. }
  9020. return nodes;
  9021. };
  9022. return vue.createVNode(Cell, {
  9023. "key": item.id,
  9024. "isLink": true,
  9025. "center": true,
  9026. "class": bem$T("item"),
  9027. "titleClass": bem$T("item-title"),
  9028. "onClick": onClick
  9029. }, {
  9030. icon: renderEditIcon,
  9031. title: renderContent,
  9032. "right-icon": renderRightIcon
  9033. });
  9034. };
  9035. return () => vue.createVNode("div", {
  9036. "class": bem$T()
  9037. }, [vue.createVNode(RadioGroup, {
  9038. "modelValue": props2.modelValue,
  9039. "class": bem$T("group")
  9040. }, {
  9041. default: () => [props2.list && props2.list.map(renderItem)]
  9042. }), vue.createVNode("div", {
  9043. "class": [bem$T("bottom"), "van-safe-area-bottom"]
  9044. }, [vue.createVNode(Button, {
  9045. "round": true,
  9046. "block": true,
  9047. "type": "primary",
  9048. "class": bem$T("add"),
  9049. "text": props2.addText || t$c("addContact"),
  9050. "onClick": () => emit("add")
  9051. }, null)])]);
  9052. }
  9053. });
  9054. const ContactList = withInstall(stdin_default$11);
  9055. function parseFormat(format2, currentTime) {
  9056. const { days } = currentTime;
  9057. let { hours, minutes, seconds, milliseconds } = currentTime;
  9058. if (format2.includes("DD")) {
  9059. format2 = format2.replace("DD", padZero(days));
  9060. } else {
  9061. hours += days * 24;
  9062. }
  9063. if (format2.includes("HH")) {
  9064. format2 = format2.replace("HH", padZero(hours));
  9065. } else {
  9066. minutes += hours * 60;
  9067. }
  9068. if (format2.includes("mm")) {
  9069. format2 = format2.replace("mm", padZero(minutes));
  9070. } else {
  9071. seconds += minutes * 60;
  9072. }
  9073. if (format2.includes("ss")) {
  9074. format2 = format2.replace("ss", padZero(seconds));
  9075. } else {
  9076. milliseconds += seconds * 1e3;
  9077. }
  9078. if (format2.includes("S")) {
  9079. const ms = padZero(milliseconds, 3);
  9080. if (format2.includes("SSS")) {
  9081. format2 = format2.replace("SSS", ms);
  9082. } else if (format2.includes("SS")) {
  9083. format2 = format2.replace("SS", ms.slice(0, 2));
  9084. } else {
  9085. format2 = format2.replace("S", ms.charAt(0));
  9086. }
  9087. }
  9088. return format2;
  9089. }
  9090. const [name$T, bem$S] = createNamespace("count-down");
  9091. const countDownProps = {
  9092. time: makeNumericProp(0),
  9093. format: makeStringProp("HH:mm:ss"),
  9094. autoStart: truthProp,
  9095. millisecond: Boolean
  9096. };
  9097. var stdin_default$10 = vue.defineComponent({
  9098. name: name$T,
  9099. props: countDownProps,
  9100. emits: ["change", "finish"],
  9101. setup(props2, {
  9102. emit,
  9103. slots
  9104. }) {
  9105. const {
  9106. start: start2,
  9107. pause,
  9108. reset,
  9109. current: current2
  9110. } = useCountDown({
  9111. time: +props2.time,
  9112. millisecond: props2.millisecond,
  9113. onChange: (current22) => emit("change", current22),
  9114. onFinish: () => emit("finish")
  9115. });
  9116. const timeText = vue.computed(() => parseFormat(props2.format, current2.value));
  9117. const resetTime = () => {
  9118. reset(+props2.time);
  9119. if (props2.autoStart) {
  9120. start2();
  9121. }
  9122. };
  9123. vue.watch(() => props2.time, resetTime, {
  9124. immediate: true
  9125. });
  9126. useExpose({
  9127. start: start2,
  9128. pause,
  9129. reset: resetTime
  9130. });
  9131. return () => vue.createVNode("div", {
  9132. "role": "timer",
  9133. "class": bem$S()
  9134. }, [slots.default ? slots.default(current2.value) : timeText.value]);
  9135. }
  9136. });
  9137. const CountDown = withInstall(stdin_default$10);
  9138. function getDate(timeStamp) {
  9139. const date = new Date(timeStamp * 1e3);
  9140. return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
  9141. date.getDate()
  9142. )}`;
  9143. }
  9144. const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
  9145. const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
  9146. const [name$S, bem$R, t$b] = createNamespace("coupon");
  9147. var stdin_default$$ = vue.defineComponent({
  9148. name: name$S,
  9149. props: {
  9150. chosen: Boolean,
  9151. coupon: makeRequiredProp(Object),
  9152. disabled: Boolean,
  9153. currency: makeStringProp("¥")
  9154. },
  9155. setup(props2) {
  9156. const validPeriod = vue.computed(() => {
  9157. const {
  9158. startAt,
  9159. endAt
  9160. } = props2.coupon;
  9161. return `${getDate(startAt)} - ${getDate(endAt)}`;
  9162. });
  9163. const faceAmount = vue.computed(() => {
  9164. const {
  9165. coupon,
  9166. currency
  9167. } = props2;
  9168. if (coupon.valueDesc) {
  9169. return [coupon.valueDesc, vue.createVNode("span", null, [coupon.unitDesc || ""])];
  9170. }
  9171. if (coupon.denominations) {
  9172. const denominations = formatAmount(coupon.denominations);
  9173. return [vue.createVNode("span", null, [currency]), ` ${denominations}`];
  9174. }
  9175. if (coupon.discount) {
  9176. return t$b("discount", formatDiscount(coupon.discount));
  9177. }
  9178. return "";
  9179. });
  9180. const conditionMessage = vue.computed(() => {
  9181. const condition = formatAmount(props2.coupon.originCondition || 0);
  9182. return condition === "0" ? t$b("unlimited") : t$b("condition", condition);
  9183. });
  9184. return () => {
  9185. const {
  9186. chosen,
  9187. coupon,
  9188. disabled
  9189. } = props2;
  9190. const description = disabled && coupon.reason || coupon.description;
  9191. return vue.createVNode("div", {
  9192. "class": bem$R({
  9193. disabled
  9194. })
  9195. }, [vue.createVNode("div", {
  9196. "class": bem$R("content")
  9197. }, [vue.createVNode("div", {
  9198. "class": bem$R("head")
  9199. }, [vue.createVNode("h2", {
  9200. "class": bem$R("amount")
  9201. }, [faceAmount.value]), vue.createVNode("p", {
  9202. "class": bem$R("condition")
  9203. }, [coupon.condition || conditionMessage.value])]), vue.createVNode("div", {
  9204. "class": bem$R("body")
  9205. }, [vue.createVNode("p", {
  9206. "class": bem$R("name")
  9207. }, [coupon.name]), vue.createVNode("p", {
  9208. "class": bem$R("valid")
  9209. }, [validPeriod.value]), !disabled && vue.createVNode(Checkbox, {
  9210. "class": bem$R("corner"),
  9211. "modelValue": chosen
  9212. }, null)])]), description && vue.createVNode("p", {
  9213. "class": bem$R("description")
  9214. }, [description])]);
  9215. };
  9216. }
  9217. });
  9218. const Coupon = withInstall(stdin_default$$);
  9219. const [name$R, bem$Q, t$a] = createNamespace("coupon-cell");
  9220. const couponCellProps = {
  9221. title: String,
  9222. border: truthProp,
  9223. editable: truthProp,
  9224. coupons: makeArrayProp(),
  9225. currency: makeStringProp("¥"),
  9226. chosenCoupon: {
  9227. type: [Number, Array],
  9228. default: -1
  9229. }
  9230. };
  9231. const getValue = (coupon) => {
  9232. const {
  9233. value,
  9234. denominations
  9235. } = coupon;
  9236. if (isDef(value)) {
  9237. return value;
  9238. }
  9239. if (isDef(denominations)) {
  9240. return denominations;
  9241. }
  9242. return 0;
  9243. };
  9244. function formatValue({
  9245. coupons,
  9246. chosenCoupon,
  9247. currency
  9248. }) {
  9249. let value = 0;
  9250. let isExist = false;
  9251. (Array.isArray(chosenCoupon) ? chosenCoupon : [chosenCoupon]).forEach((i) => {
  9252. const coupon = coupons[+i];
  9253. if (coupon) {
  9254. isExist = true;
  9255. value += getValue(coupon);
  9256. }
  9257. });
  9258. if (isExist) {
  9259. return `-${currency} ${(value / 100).toFixed(2)}`;
  9260. }
  9261. return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
  9262. }
  9263. var stdin_default$_ = vue.defineComponent({
  9264. name: name$R,
  9265. props: couponCellProps,
  9266. setup(props2) {
  9267. return () => {
  9268. const selected = Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.length : props2.coupons[+props2.chosenCoupon];
  9269. return vue.createVNode(Cell, {
  9270. "class": bem$Q(),
  9271. "value": formatValue(props2),
  9272. "title": props2.title || t$a("title"),
  9273. "border": props2.border,
  9274. "isLink": props2.editable,
  9275. "valueClass": bem$Q("value", {
  9276. selected
  9277. })
  9278. }, null);
  9279. };
  9280. }
  9281. });
  9282. const CouponCell = withInstall(stdin_default$_);
  9283. const [name$Q, bem$P] = createNamespace("empty");
  9284. const emptyProps = {
  9285. image: makeStringProp("default"),
  9286. imageSize: [Number, String, Array],
  9287. description: String
  9288. };
  9289. var stdin_default$Z = vue.defineComponent({
  9290. name: name$Q,
  9291. props: emptyProps,
  9292. setup(props2, {
  9293. slots
  9294. }) {
  9295. const renderDescription = () => {
  9296. const description = slots.description ? slots.description() : props2.description;
  9297. if (description) {
  9298. return vue.createVNode("p", {
  9299. "class": bem$P("description")
  9300. }, [description]);
  9301. }
  9302. };
  9303. const renderBottom = () => {
  9304. if (slots.default) {
  9305. return vue.createVNode("div", {
  9306. "class": bem$P("bottom")
  9307. }, [slots.default()]);
  9308. }
  9309. };
  9310. const baseId = useId();
  9311. const getId = (num) => `${baseId}-${num}`;
  9312. const getUrlById = (num) => `url(#${getId(num)})`;
  9313. const renderStop = (color, offset2, opacity) => vue.createVNode("stop", {
  9314. "stop-color": color,
  9315. "offset": `${offset2}%`,
  9316. "stop-opacity": opacity
  9317. }, null);
  9318. const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
  9319. const renderShadow = (id) => [vue.createVNode("defs", null, [vue.createVNode("radialGradient", {
  9320. "id": getId(id),
  9321. "cx": "50%",
  9322. "cy": "54%",
  9323. "fx": "50%",
  9324. "fy": "54%",
  9325. "r": "297%",
  9326. "gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)",
  9327. "data-allow-mismatch": "attribute"
  9328. }, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), vue.createVNode("ellipse", {
  9329. "fill": getUrlById(id),
  9330. "opacity": ".8",
  9331. "cx": "80",
  9332. "cy": "140",
  9333. "rx": "46",
  9334. "ry": "8",
  9335. "data-allow-mismatch": "attribute"
  9336. }, null)];
  9337. const renderBuilding = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  9338. "id": getId("a"),
  9339. "x1": "64%",
  9340. "y1": "100%",
  9341. "x2": "64%",
  9342. "data-allow-mismatch": "attribute"
  9343. }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
  9344. "opacity": ".8",
  9345. "data-allow-mismatch": "children"
  9346. }, [vue.createVNode("path", {
  9347. "d": "M36 131V53H16v20H2v58h34z",
  9348. "fill": getUrlById("a")
  9349. }, null), vue.createVNode("path", {
  9350. "d": "M123 15h22v14h9v77h-31V15z",
  9351. "fill": getUrlById("a")
  9352. }, null)])];
  9353. const renderCloud = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  9354. "id": getId("b"),
  9355. "x1": "64%",
  9356. "y1": "97%",
  9357. "x2": "64%",
  9358. "y2": "0%",
  9359. "data-allow-mismatch": "attribute"
  9360. }, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
  9361. "opacity": ".8",
  9362. "data-allow-mismatch": "children"
  9363. }, [vue.createVNode("path", {
  9364. "d": "M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",
  9365. "fill": getUrlById("b")
  9366. }, null), vue.createVNode("path", {
  9367. "d": "M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",
  9368. "fill": getUrlById("b")
  9369. }, null)])];
  9370. const renderNetwork = () => vue.createVNode("svg", {
  9371. "viewBox": "0 0 160 160"
  9372. }, [vue.createVNode("defs", {
  9373. "data-allow-mismatch": "children"
  9374. }, [vue.createVNode("linearGradient", {
  9375. "id": getId(1),
  9376. "x1": "64%",
  9377. "y1": "100%",
  9378. "x2": "64%"
  9379. }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), vue.createVNode("linearGradient", {
  9380. "id": getId(2),
  9381. "x1": "50%",
  9382. "x2": "50%",
  9383. "y2": "84%"
  9384. }, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), vue.createVNode("linearGradient", {
  9385. "id": getId(3),
  9386. "x1": "100%",
  9387. "x2": "100%",
  9388. "y2": "100%"
  9389. }, [renderStops("#EAEDF0", "#DCDEE0")]), vue.createVNode("radialGradient", {
  9390. "id": getId(4),
  9391. "cx": "50%",
  9392. "cy": "0%",
  9393. "fx": "50%",
  9394. "fy": "0%",
  9395. "r": "100%",
  9396. "gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
  9397. }, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), vue.createVNode("g", {
  9398. "fill": "none"
  9399. }, [renderBuilding(), vue.createVNode("path", {
  9400. "fill": getUrlById(4),
  9401. "d": "M0 139h160v21H0z",
  9402. "data-allow-mismatch": "attribute"
  9403. }, null), vue.createVNode("path", {
  9404. "d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
  9405. "fill": getUrlById(2),
  9406. "data-allow-mismatch": "attribute"
  9407. }, null), vue.createVNode("g", {
  9408. "opacity": ".6",
  9409. "stroke-linecap": "round",
  9410. "stroke-width": "7",
  9411. "data-allow-mismatch": "children"
  9412. }, [vue.createVNode("path", {
  9413. "d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
  9414. "stroke": getUrlById(3)
  9415. }, null), vue.createVNode("path", {
  9416. "d": "M53 36a34 34 0 0 0 0 48",
  9417. "stroke": getUrlById(3)
  9418. }, null), vue.createVNode("path", {
  9419. "d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
  9420. "stroke": getUrlById(3)
  9421. }, null), vue.createVNode("path", {
  9422. "d": "M106 84a34 34 0 0 0 0-48",
  9423. "stroke": getUrlById(3)
  9424. }, null)]), vue.createVNode("g", {
  9425. "transform": "translate(31 105)"
  9426. }, [vue.createVNode("rect", {
  9427. "fill": "#EBEDF0",
  9428. "width": "98",
  9429. "height": "34",
  9430. "rx": "2"
  9431. }, null), vue.createVNode("rect", {
  9432. "fill": "#FFF",
  9433. "x": "9",
  9434. "y": "8",
  9435. "width": "80",
  9436. "height": "18",
  9437. "rx": "1.1"
  9438. }, null), vue.createVNode("rect", {
  9439. "fill": "#EBEDF0",
  9440. "x": "15",
  9441. "y": "12",
  9442. "width": "18",
  9443. "height": "6",
  9444. "rx": "1.1"
  9445. }, null)])])]);
  9446. const renderMaterial = () => vue.createVNode("svg", {
  9447. "viewBox": "0 0 160 160"
  9448. }, [vue.createVNode("defs", {
  9449. "data-allow-mismatch": "children"
  9450. }, [vue.createVNode("linearGradient", {
  9451. "x1": "50%",
  9452. "x2": "50%",
  9453. "y2": "100%",
  9454. "id": getId(5)
  9455. }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
  9456. "x1": "95%",
  9457. "y1": "48%",
  9458. "x2": "5.5%",
  9459. "y2": "51%",
  9460. "id": getId(6)
  9461. }, [renderStops("#EAEDF1", "#DCDEE0")]), vue.createVNode("linearGradient", {
  9462. "y1": "45%",
  9463. "x2": "100%",
  9464. "y2": "54%",
  9465. "id": getId(7)
  9466. }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), vue.createVNode("g", {
  9467. "transform": "translate(36 50)",
  9468. "fill": "none"
  9469. }, [vue.createVNode("g", {
  9470. "transform": "translate(8)"
  9471. }, [vue.createVNode("rect", {
  9472. "fill": "#EBEDF0",
  9473. "opacity": ".6",
  9474. "x": "38",
  9475. "y": "13",
  9476. "width": "36",
  9477. "height": "53",
  9478. "rx": "2"
  9479. }, null), vue.createVNode("rect", {
  9480. "fill": getUrlById(5),
  9481. "width": "64",
  9482. "height": "66",
  9483. "rx": "2",
  9484. "data-allow-mismatch": "attribute"
  9485. }, null), vue.createVNode("rect", {
  9486. "fill": "#FFF",
  9487. "x": "6",
  9488. "y": "6",
  9489. "width": "52",
  9490. "height": "55",
  9491. "rx": "1"
  9492. }, null), vue.createVNode("g", {
  9493. "transform": "translate(15 17)",
  9494. "fill": getUrlById(6),
  9495. "data-allow-mismatch": "attribute"
  9496. }, [vue.createVNode("rect", {
  9497. "width": "34",
  9498. "height": "6",
  9499. "rx": "1"
  9500. }, null), vue.createVNode("path", {
  9501. "d": "M0 14h34v6H0z"
  9502. }, null), vue.createVNode("rect", {
  9503. "y": "28",
  9504. "width": "34",
  9505. "height": "6",
  9506. "rx": "1"
  9507. }, null)])]), vue.createVNode("rect", {
  9508. "fill": getUrlById(7),
  9509. "y": "61",
  9510. "width": "88",
  9511. "height": "28",
  9512. "rx": "1",
  9513. "data-allow-mismatch": "attribute"
  9514. }, null), vue.createVNode("rect", {
  9515. "fill": "#F7F8FA",
  9516. "x": "29",
  9517. "y": "72",
  9518. "width": "30",
  9519. "height": "6",
  9520. "rx": "1"
  9521. }, null)])]);
  9522. const renderError = () => vue.createVNode("svg", {
  9523. "viewBox": "0 0 160 160"
  9524. }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  9525. "x1": "50%",
  9526. "x2": "50%",
  9527. "y2": "100%",
  9528. "id": getId(8),
  9529. "data-allow-mismatch": "attribute"
  9530. }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), vue.createVNode("path", {
  9531. "d": "m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",
  9532. "fill": getUrlById(8),
  9533. "data-allow-mismatch": "attribute"
  9534. }, null)]);
  9535. const renderSearch = () => vue.createVNode("svg", {
  9536. "viewBox": "0 0 160 160"
  9537. }, [vue.createVNode("defs", {
  9538. "data-allow-mismatch": "children"
  9539. }, [vue.createVNode("linearGradient", {
  9540. "x1": "50%",
  9541. "y1": "100%",
  9542. "x2": "50%",
  9543. "id": getId(9)
  9544. }, [renderStops("#EEE", "#D8D8D8")]), vue.createVNode("linearGradient", {
  9545. "x1": "100%",
  9546. "y1": "50%",
  9547. "y2": "50%",
  9548. "id": getId(10)
  9549. }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
  9550. "x1": "50%",
  9551. "x2": "50%",
  9552. "y2": "100%",
  9553. "id": getId(11)
  9554. }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
  9555. "x1": "50%",
  9556. "x2": "50%",
  9557. "y2": "100%",
  9558. "id": getId(12)
  9559. }, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), vue.createVNode("g", {
  9560. "transform": "rotate(-45 113 -4)",
  9561. "fill": "none",
  9562. "data-allow-mismatch": "children"
  9563. }, [vue.createVNode("rect", {
  9564. "fill": getUrlById(9),
  9565. "x": "24",
  9566. "y": "52.8",
  9567. "width": "5.8",
  9568. "height": "19",
  9569. "rx": "1"
  9570. }, null), vue.createVNode("rect", {
  9571. "fill": getUrlById(10),
  9572. "x": "22.1",
  9573. "y": "67.3",
  9574. "width": "9.9",
  9575. "height": "28",
  9576. "rx": "1"
  9577. }, null), vue.createVNode("circle", {
  9578. "stroke": getUrlById(11),
  9579. "stroke-width": "8",
  9580. "cx": "27",
  9581. "cy": "27",
  9582. "r": "27"
  9583. }, null), vue.createVNode("circle", {
  9584. "fill": getUrlById(12),
  9585. "cx": "27",
  9586. "cy": "27",
  9587. "r": "16"
  9588. }, null), vue.createVNode("path", {
  9589. "d": "M37 7c-8 0-15 5-16 12",
  9590. "stroke": getUrlById(11),
  9591. "stroke-width": "3",
  9592. "opacity": ".5",
  9593. "stroke-linecap": "round",
  9594. "transform": "rotate(45 29 13)"
  9595. }, null)])]);
  9596. const renderImage = () => {
  9597. var _a;
  9598. if (slots.image) {
  9599. return slots.image();
  9600. }
  9601. const PRESET_IMAGES = {
  9602. error: renderError,
  9603. search: renderSearch,
  9604. network: renderNetwork,
  9605. default: renderMaterial
  9606. };
  9607. return ((_a = PRESET_IMAGES[props2.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || vue.createVNode("img", {
  9608. "src": props2.image
  9609. }, null);
  9610. };
  9611. return () => vue.createVNode("div", {
  9612. "class": bem$P()
  9613. }, [vue.createVNode("div", {
  9614. "class": bem$P("image"),
  9615. "style": getSizeStyle(props2.imageSize)
  9616. }, [renderImage()]), renderDescription(), renderBottom()]);
  9617. }
  9618. });
  9619. const Empty = withInstall(stdin_default$Z);
  9620. const [name$P, bem$O, t$9] = createNamespace("coupon-list");
  9621. const couponListProps = {
  9622. code: makeStringProp(""),
  9623. coupons: makeArrayProp(),
  9624. currency: makeStringProp("¥"),
  9625. showCount: truthProp,
  9626. emptyImage: String,
  9627. enabledTitle: String,
  9628. disabledTitle: String,
  9629. disabledCoupons: makeArrayProp(),
  9630. showExchangeBar: truthProp,
  9631. showCloseButton: truthProp,
  9632. closeButtonText: String,
  9633. inputPlaceholder: String,
  9634. exchangeMinLength: makeNumberProp(1),
  9635. exchangeButtonText: String,
  9636. displayedCouponIndex: makeNumberProp(-1),
  9637. exchangeButtonLoading: Boolean,
  9638. exchangeButtonDisabled: Boolean,
  9639. chosenCoupon: {
  9640. type: [Number, Array],
  9641. default: -1
  9642. }
  9643. };
  9644. var stdin_default$Y = vue.defineComponent({
  9645. name: name$P,
  9646. props: couponListProps,
  9647. emits: ["change", "exchange", "update:code"],
  9648. setup(props2, {
  9649. emit,
  9650. slots
  9651. }) {
  9652. const [couponRefs, setCouponRefs] = useRefs();
  9653. const root = vue.ref();
  9654. const barRef = vue.ref();
  9655. const activeTab = vue.ref(0);
  9656. const listHeight = vue.ref(0);
  9657. const currentCode = vue.ref(props2.code);
  9658. const buttonDisabled = vue.computed(() => !props2.exchangeButtonLoading && (props2.exchangeButtonDisabled || !currentCode.value || currentCode.value.length < props2.exchangeMinLength));
  9659. const updateListHeight = () => {
  9660. const TABS_HEIGHT = 44;
  9661. const rootHeight = useRect(root).height;
  9662. const headerHeight = useRect(barRef).height + TABS_HEIGHT;
  9663. listHeight.value = (rootHeight > headerHeight ? rootHeight : windowHeight.value) - headerHeight;
  9664. };
  9665. const onExchange = () => {
  9666. emit("exchange", currentCode.value);
  9667. if (!props2.code) {
  9668. currentCode.value = "";
  9669. }
  9670. };
  9671. const scrollToCoupon = (index) => {
  9672. vue.nextTick(() => {
  9673. var _a;
  9674. return (_a = couponRefs.value[index]) == null ? void 0 : _a.scrollIntoView();
  9675. });
  9676. };
  9677. const renderEmpty = () => vue.createVNode(Empty, {
  9678. "image": props2.emptyImage
  9679. }, {
  9680. default: () => [vue.createVNode("p", {
  9681. "class": bem$O("empty-tip")
  9682. }, [t$9("noCoupon")])]
  9683. });
  9684. const renderExchangeBar = () => {
  9685. if (props2.showExchangeBar) {
  9686. return vue.createVNode("div", {
  9687. "ref": barRef,
  9688. "class": bem$O("exchange-bar")
  9689. }, [vue.createVNode(Field, {
  9690. "modelValue": currentCode.value,
  9691. "onUpdate:modelValue": ($event) => currentCode.value = $event,
  9692. "clearable": true,
  9693. "border": false,
  9694. "class": bem$O("field"),
  9695. "placeholder": props2.inputPlaceholder || t$9("placeholder"),
  9696. "maxlength": "20"
  9697. }, null), vue.createVNode(Button, {
  9698. "plain": true,
  9699. "type": "primary",
  9700. "class": bem$O("exchange"),
  9701. "text": props2.exchangeButtonText || t$9("exchange"),
  9702. "loading": props2.exchangeButtonLoading,
  9703. "disabled": buttonDisabled.value,
  9704. "onClick": onExchange
  9705. }, null)]);
  9706. }
  9707. };
  9708. const renderCouponTab = () => {
  9709. const {
  9710. coupons,
  9711. chosenCoupon
  9712. } = props2;
  9713. const count = props2.showCount ? ` (${coupons.length})` : "";
  9714. const title = (props2.enabledTitle || t$9("enable")) + count;
  9715. const updateChosenCoupon = (currentValues = [], value = 0) => {
  9716. if (currentValues.includes(value)) {
  9717. return currentValues.filter((item) => item !== value);
  9718. }
  9719. return [...currentValues, value];
  9720. };
  9721. return vue.createVNode(Tab, {
  9722. "title": title
  9723. }, {
  9724. default: () => {
  9725. var _a;
  9726. return [vue.createVNode("div", {
  9727. "class": bem$O("list", {
  9728. "with-bottom": props2.showCloseButton
  9729. }),
  9730. "style": {
  9731. height: `${listHeight.value}px`
  9732. }
  9733. }, [coupons.map((coupon, index) => vue.createVNode(Coupon, {
  9734. "key": coupon.id,
  9735. "ref": setCouponRefs(index),
  9736. "coupon": coupon,
  9737. "chosen": Array.isArray(chosenCoupon) ? chosenCoupon.includes(index) : index === chosenCoupon,
  9738. "currency": props2.currency,
  9739. "onClick": () => emit("change", Array.isArray(chosenCoupon) ? updateChosenCoupon(chosenCoupon, index) : index)
  9740. }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
  9741. }
  9742. });
  9743. };
  9744. const renderDisabledTab = () => {
  9745. const {
  9746. disabledCoupons
  9747. } = props2;
  9748. const count = props2.showCount ? ` (${disabledCoupons.length})` : "";
  9749. const title = (props2.disabledTitle || t$9("disabled")) + count;
  9750. return vue.createVNode(Tab, {
  9751. "title": title
  9752. }, {
  9753. default: () => {
  9754. var _a;
  9755. return [vue.createVNode("div", {
  9756. "class": bem$O("list", {
  9757. "with-bottom": props2.showCloseButton
  9758. }),
  9759. "style": {
  9760. height: `${listHeight.value}px`
  9761. }
  9762. }, [disabledCoupons.map((coupon) => vue.createVNode(Coupon, {
  9763. "disabled": true,
  9764. "key": coupon.id,
  9765. "coupon": coupon,
  9766. "currency": props2.currency
  9767. }, null)), !disabledCoupons.length && renderEmpty(), (_a = slots["disabled-list-footer"]) == null ? void 0 : _a.call(slots)])];
  9768. }
  9769. });
  9770. };
  9771. vue.watch(() => props2.code, (value) => {
  9772. currentCode.value = value;
  9773. });
  9774. vue.watch(windowHeight, updateListHeight);
  9775. vue.watch(currentCode, (value) => emit("update:code", value));
  9776. vue.watch(() => props2.displayedCouponIndex, scrollToCoupon);
  9777. vue.onMounted(() => {
  9778. updateListHeight();
  9779. scrollToCoupon(props2.displayedCouponIndex);
  9780. });
  9781. return () => vue.createVNode("div", {
  9782. "ref": root,
  9783. "class": bem$O()
  9784. }, [renderExchangeBar(), vue.createVNode(Tabs, {
  9785. "active": activeTab.value,
  9786. "onUpdate:active": ($event) => activeTab.value = $event,
  9787. "class": bem$O("tab")
  9788. }, {
  9789. default: () => [renderCouponTab(), renderDisabledTab()]
  9790. }), vue.createVNode("div", {
  9791. "class": bem$O("bottom")
  9792. }, [slots["list-button"] ? slots["list-button"]() : vue.withDirectives(vue.createVNode(Button, {
  9793. "round": true,
  9794. "block": true,
  9795. "type": "primary",
  9796. "class": bem$O("close"),
  9797. "text": props2.closeButtonText || t$9("close"),
  9798. "onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? [] : -1)
  9799. }, null), [[vue.vShow, props2.showCloseButton]])])]);
  9800. }
  9801. });
  9802. const CouponList = withInstall(stdin_default$Y);
  9803. const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
  9804. const [name$O] = createNamespace("date-picker");
  9805. const datePickerProps = extend({}, sharedProps, {
  9806. columnsType: {
  9807. type: Array,
  9808. default: () => ["year", "month", "day"]
  9809. },
  9810. minDate: {
  9811. type: Date,
  9812. default: () => new Date(currentYear - 10, 0, 1),
  9813. validator: isDate
  9814. },
  9815. maxDate: {
  9816. type: Date,
  9817. default: () => new Date(currentYear + 10, 11, 31),
  9818. validator: isDate
  9819. }
  9820. });
  9821. var stdin_default$X = vue.defineComponent({
  9822. name: name$O,
  9823. props: datePickerProps,
  9824. emits: ["confirm", "cancel", "change", "update:modelValue"],
  9825. setup(props2, {
  9826. emit,
  9827. slots
  9828. }) {
  9829. const currentValues = vue.ref(props2.modelValue);
  9830. const updatedByExternalSources = vue.ref(false);
  9831. const pickerRef = vue.ref();
  9832. const computedValues = vue.computed(() => updatedByExternalSources.value ? props2.modelValue : currentValues.value);
  9833. const isMinYear = (year) => year === props2.minDate.getFullYear();
  9834. const isMaxYear = (year) => year === props2.maxDate.getFullYear();
  9835. const isMinMonth = (month) => month === props2.minDate.getMonth() + 1;
  9836. const isMaxMonth = (month) => month === props2.maxDate.getMonth() + 1;
  9837. const getValue2 = (type) => {
  9838. const {
  9839. minDate,
  9840. columnsType
  9841. } = props2;
  9842. const index = columnsType.indexOf(type);
  9843. const value = computedValues.value[index];
  9844. if (value) {
  9845. return +value;
  9846. }
  9847. switch (type) {
  9848. case "year":
  9849. return minDate.getFullYear();
  9850. case "month":
  9851. return minDate.getMonth() + 1;
  9852. case "day":
  9853. return minDate.getDate();
  9854. }
  9855. };
  9856. const genYearOptions = () => {
  9857. const minYear = props2.minDate.getFullYear();
  9858. const maxYear = props2.maxDate.getFullYear();
  9859. return genOptions(minYear, maxYear, "year", props2.formatter, props2.filter, computedValues.value);
  9860. };
  9861. const genMonthOptions = () => {
  9862. const year = getValue2("year");
  9863. const minMonth = isMinYear(year) ? props2.minDate.getMonth() + 1 : 1;
  9864. const maxMonth = isMaxYear(year) ? props2.maxDate.getMonth() + 1 : 12;
  9865. return genOptions(minMonth, maxMonth, "month", props2.formatter, props2.filter, computedValues.value);
  9866. };
  9867. const genDayOptions = () => {
  9868. const year = getValue2("year");
  9869. const month = getValue2("month");
  9870. const minDate = isMinYear(year) && isMinMonth(month) ? props2.minDate.getDate() : 1;
  9871. const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
  9872. return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter, computedValues.value);
  9873. };
  9874. const confirm = () => {
  9875. var _a;
  9876. return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
  9877. };
  9878. const getSelectedDate = () => currentValues.value;
  9879. const columns = vue.computed(() => props2.columnsType.map((type) => {
  9880. switch (type) {
  9881. case "year":
  9882. return genYearOptions();
  9883. case "month":
  9884. return genMonthOptions();
  9885. case "day":
  9886. return genDayOptions();
  9887. default:
  9888. return [];
  9889. }
  9890. }));
  9891. vue.watch(currentValues, (newValues) => {
  9892. if (!isSameValue(newValues, props2.modelValue)) {
  9893. emit("update:modelValue", newValues);
  9894. }
  9895. });
  9896. vue.watch(() => props2.modelValue, (newValues, oldValues) => {
  9897. updatedByExternalSources.value = isSameValue(oldValues, currentValues.value);
  9898. newValues = formatValueRange(newValues, columns.value);
  9899. if (!isSameValue(newValues, currentValues.value)) {
  9900. currentValues.value = newValues;
  9901. }
  9902. updatedByExternalSources.value = false;
  9903. }, {
  9904. immediate: true
  9905. });
  9906. const onChange = (...args) => emit("change", ...args);
  9907. const onCancel = (...args) => emit("cancel", ...args);
  9908. const onConfirm = (...args) => emit("confirm", ...args);
  9909. useExpose({
  9910. confirm,
  9911. getSelectedDate
  9912. });
  9913. return () => vue.createVNode(Picker, vue.mergeProps({
  9914. "ref": pickerRef,
  9915. "modelValue": currentValues.value,
  9916. "onUpdate:modelValue": ($event) => currentValues.value = $event,
  9917. "columns": columns.value,
  9918. "onChange": onChange,
  9919. "onCancel": onCancel,
  9920. "onConfirm": onConfirm
  9921. }, pick(props2, pickerInheritKeys)), slots);
  9922. }
  9923. });
  9924. const DatePicker = withInstall(stdin_default$X);
  9925. const [name$N, bem$N, t$8] = createNamespace("dialog");
  9926. const dialogProps = extend({}, popupSharedProps, {
  9927. title: String,
  9928. theme: String,
  9929. width: numericProp,
  9930. message: [String, Function],
  9931. callback: Function,
  9932. allowHtml: Boolean,
  9933. className: unknownProp,
  9934. transition: makeStringProp("van-dialog-bounce"),
  9935. messageAlign: String,
  9936. closeOnPopstate: truthProp,
  9937. showCancelButton: Boolean,
  9938. cancelButtonText: String,
  9939. cancelButtonColor: String,
  9940. cancelButtonDisabled: Boolean,
  9941. confirmButtonText: String,
  9942. confirmButtonColor: String,
  9943. confirmButtonDisabled: Boolean,
  9944. showConfirmButton: truthProp,
  9945. closeOnClickOverlay: Boolean,
  9946. keyboardEnabled: truthProp
  9947. });
  9948. const popupInheritKeys$1 = [...popupSharedPropKeys, "transition", "closeOnPopstate"];
  9949. var stdin_default$W = vue.defineComponent({
  9950. name: name$N,
  9951. props: dialogProps,
  9952. emits: ["confirm", "cancel", "keydown", "update:show"],
  9953. setup(props2, {
  9954. emit,
  9955. slots
  9956. }) {
  9957. const root = vue.ref();
  9958. const loading = vue.reactive({
  9959. confirm: false,
  9960. cancel: false
  9961. });
  9962. const updateShow = (value) => emit("update:show", value);
  9963. const close = (action) => {
  9964. var _a;
  9965. updateShow(false);
  9966. (_a = props2.callback) == null ? void 0 : _a.call(props2, action);
  9967. };
  9968. const getActionHandler = (action) => () => {
  9969. if (!props2.show) {
  9970. return;
  9971. }
  9972. emit(action);
  9973. if (props2.beforeClose) {
  9974. loading[action] = true;
  9975. callInterceptor(props2.beforeClose, {
  9976. args: [action],
  9977. done() {
  9978. close(action);
  9979. loading[action] = false;
  9980. },
  9981. canceled() {
  9982. loading[action] = false;
  9983. }
  9984. });
  9985. } else {
  9986. close(action);
  9987. }
  9988. };
  9989. const onCancel = getActionHandler("cancel");
  9990. const onConfirm = getActionHandler("confirm");
  9991. const onKeydown = vue.withKeys((event) => {
  9992. var _a, _b;
  9993. if (!props2.keyboardEnabled) {
  9994. return;
  9995. }
  9996. if (event.target !== ((_b = (_a = root.value) == null ? void 0 : _a.popupRef) == null ? void 0 : _b.value)) {
  9997. return;
  9998. }
  9999. const onEventType = {
  10000. Enter: props2.showConfirmButton ? onConfirm : noop,
  10001. Escape: props2.showCancelButton ? onCancel : noop
  10002. };
  10003. onEventType[event.key]();
  10004. emit("keydown", event);
  10005. }, ["enter", "esc"]);
  10006. const renderTitle = () => {
  10007. const title = slots.title ? slots.title() : props2.title;
  10008. if (title) {
  10009. return vue.createVNode("div", {
  10010. "class": bem$N("header", {
  10011. isolated: !props2.message && !slots.default
  10012. })
  10013. }, [title]);
  10014. }
  10015. };
  10016. const renderMessage = (hasTitle) => {
  10017. const {
  10018. message,
  10019. allowHtml,
  10020. messageAlign
  10021. } = props2;
  10022. const classNames = bem$N("message", {
  10023. "has-title": hasTitle,
  10024. [messageAlign]: messageAlign
  10025. });
  10026. const content = isFunction(message) ? message() : message;
  10027. if (allowHtml && typeof content === "string") {
  10028. return vue.createVNode("div", {
  10029. "class": classNames,
  10030. "innerHTML": content
  10031. }, null);
  10032. }
  10033. return vue.createVNode("div", {
  10034. "class": classNames
  10035. }, [content]);
  10036. };
  10037. const renderContent = () => {
  10038. if (slots.default) {
  10039. return vue.createVNode("div", {
  10040. "class": bem$N("content")
  10041. }, [slots.default()]);
  10042. }
  10043. const {
  10044. title,
  10045. message,
  10046. allowHtml
  10047. } = props2;
  10048. if (message) {
  10049. const hasTitle = !!(title || slots.title);
  10050. return vue.createVNode("div", {
  10051. "key": allowHtml ? 1 : 0,
  10052. "class": bem$N("content", {
  10053. isolated: !hasTitle
  10054. })
  10055. }, [renderMessage(hasTitle)]);
  10056. }
  10057. };
  10058. const renderButtons = () => vue.createVNode("div", {
  10059. "class": [BORDER_TOP, bem$N("footer")]
  10060. }, [props2.showCancelButton && vue.createVNode(Button, {
  10061. "size": "large",
  10062. "text": props2.cancelButtonText || t$8("cancel"),
  10063. "class": bem$N("cancel"),
  10064. "style": {
  10065. color: props2.cancelButtonColor
  10066. },
  10067. "loading": loading.cancel,
  10068. "disabled": props2.cancelButtonDisabled,
  10069. "onClick": onCancel
  10070. }, null), props2.showConfirmButton && vue.createVNode(Button, {
  10071. "size": "large",
  10072. "text": props2.confirmButtonText || t$8("confirm"),
  10073. "class": [bem$N("confirm"), {
  10074. [BORDER_LEFT]: props2.showCancelButton
  10075. }],
  10076. "style": {
  10077. color: props2.confirmButtonColor
  10078. },
  10079. "loading": loading.confirm,
  10080. "disabled": props2.confirmButtonDisabled,
  10081. "onClick": onConfirm
  10082. }, null)]);
  10083. const renderRoundButtons = () => vue.createVNode(ActionBar, {
  10084. "class": bem$N("footer")
  10085. }, {
  10086. default: () => [props2.showCancelButton && vue.createVNode(ActionBarButton, {
  10087. "type": "warning",
  10088. "text": props2.cancelButtonText || t$8("cancel"),
  10089. "class": bem$N("cancel"),
  10090. "color": props2.cancelButtonColor,
  10091. "loading": loading.cancel,
  10092. "disabled": props2.cancelButtonDisabled,
  10093. "onClick": onCancel
  10094. }, null), props2.showConfirmButton && vue.createVNode(ActionBarButton, {
  10095. "type": "danger",
  10096. "text": props2.confirmButtonText || t$8("confirm"),
  10097. "class": bem$N("confirm"),
  10098. "color": props2.confirmButtonColor,
  10099. "loading": loading.confirm,
  10100. "disabled": props2.confirmButtonDisabled,
  10101. "onClick": onConfirm
  10102. }, null)]
  10103. });
  10104. const renderFooter = () => {
  10105. if (slots.footer) {
  10106. return slots.footer();
  10107. }
  10108. return props2.theme === "round-button" ? renderRoundButtons() : renderButtons();
  10109. };
  10110. return () => {
  10111. const {
  10112. width: width2,
  10113. title,
  10114. theme,
  10115. message,
  10116. className
  10117. } = props2;
  10118. return vue.createVNode(Popup, vue.mergeProps({
  10119. "ref": root,
  10120. "role": "dialog",
  10121. "class": [bem$N([theme]), className],
  10122. "style": {
  10123. width: addUnit(width2)
  10124. },
  10125. "tabindex": 0,
  10126. "aria-labelledby": title || message,
  10127. "onKeydown": onKeydown,
  10128. "onUpdate:show": updateShow
  10129. }, pick(props2, popupInheritKeys$1)), {
  10130. default: () => [renderTitle(), renderContent(), renderFooter()]
  10131. });
  10132. };
  10133. }
  10134. });
  10135. let instance$2;
  10136. const DEFAULT_OPTIONS$1 = {
  10137. title: "",
  10138. width: "",
  10139. theme: null,
  10140. message: "",
  10141. overlay: true,
  10142. callback: null,
  10143. teleport: "body",
  10144. className: "",
  10145. allowHtml: false,
  10146. lockScroll: true,
  10147. transition: void 0,
  10148. beforeClose: null,
  10149. overlayClass: "",
  10150. overlayStyle: void 0,
  10151. messageAlign: "",
  10152. cancelButtonText: "",
  10153. cancelButtonColor: null,
  10154. cancelButtonDisabled: false,
  10155. confirmButtonText: "",
  10156. confirmButtonColor: null,
  10157. confirmButtonDisabled: false,
  10158. showConfirmButton: true,
  10159. showCancelButton: false,
  10160. closeOnPopstate: true,
  10161. closeOnClickOverlay: false
  10162. };
  10163. let currentOptions$1 = extend({}, DEFAULT_OPTIONS$1);
  10164. function initInstance$2() {
  10165. const Wrapper = {
  10166. setup() {
  10167. const {
  10168. state,
  10169. toggle
  10170. } = usePopupState();
  10171. return () => vue.createVNode(stdin_default$W, vue.mergeProps(state, {
  10172. "onUpdate:show": toggle
  10173. }), null);
  10174. }
  10175. };
  10176. ({
  10177. instance: instance$2
  10178. } = mountComponent(Wrapper));
  10179. }
  10180. function showDialog(options) {
  10181. if (!inBrowser$1) {
  10182. return Promise.resolve(void 0);
  10183. }
  10184. return new Promise((resolve, reject) => {
  10185. if (!instance$2) {
  10186. initInstance$2();
  10187. }
  10188. instance$2.open(extend({}, currentOptions$1, options, {
  10189. callback: (action) => {
  10190. (action === "confirm" ? resolve : reject)(action);
  10191. }
  10192. }));
  10193. });
  10194. }
  10195. const setDialogDefaultOptions = (options) => {
  10196. extend(currentOptions$1, options);
  10197. };
  10198. const resetDialogDefaultOptions = () => {
  10199. currentOptions$1 = extend({}, DEFAULT_OPTIONS$1);
  10200. };
  10201. const showConfirmDialog = (options) => showDialog(extend({
  10202. showCancelButton: true
  10203. }, options));
  10204. const closeDialog = () => {
  10205. if (instance$2) {
  10206. instance$2.toggle(false);
  10207. }
  10208. };
  10209. const Dialog = withInstall(stdin_default$W);
  10210. const [name$M, bem$M] = createNamespace("divider");
  10211. const dividerProps = {
  10212. dashed: Boolean,
  10213. hairline: truthProp,
  10214. vertical: Boolean,
  10215. contentPosition: makeStringProp("center")
  10216. };
  10217. var stdin_default$V = vue.defineComponent({
  10218. name: name$M,
  10219. props: dividerProps,
  10220. setup(props2, {
  10221. slots
  10222. }) {
  10223. return () => {
  10224. var _a;
  10225. return vue.createVNode("div", {
  10226. "role": "separator",
  10227. "class": bem$M({
  10228. dashed: props2.dashed,
  10229. hairline: props2.hairline,
  10230. vertical: props2.vertical,
  10231. [`content-${props2.contentPosition}`]: !!slots.default && !props2.vertical
  10232. })
  10233. }, [!props2.vertical && ((_a = slots.default) == null ? void 0 : _a.call(slots))]);
  10234. };
  10235. }
  10236. });
  10237. const Divider = withInstall(stdin_default$V);
  10238. const [name$L, bem$L] = createNamespace("dropdown-menu");
  10239. const dropdownMenuProps = {
  10240. overlay: truthProp,
  10241. zIndex: numericProp,
  10242. duration: makeNumericProp(0.2),
  10243. direction: makeStringProp("down"),
  10244. activeColor: String,
  10245. autoLocate: Boolean,
  10246. closeOnClickOutside: truthProp,
  10247. closeOnClickOverlay: truthProp,
  10248. swipeThreshold: numericProp
  10249. };
  10250. const DROPDOWN_KEY = Symbol(name$L);
  10251. var stdin_default$U = vue.defineComponent({
  10252. name: name$L,
  10253. props: dropdownMenuProps,
  10254. setup(props2, {
  10255. slots
  10256. }) {
  10257. const id = useId();
  10258. const root = vue.ref();
  10259. const barRef = vue.ref();
  10260. const offset2 = vue.ref(0);
  10261. const {
  10262. children,
  10263. linkChildren
  10264. } = useChildren(DROPDOWN_KEY);
  10265. const scrollParent = useScrollParent(root);
  10266. const opened = vue.computed(() => children.some((item) => item.state.showWrapper));
  10267. const scrollable = vue.computed(() => props2.swipeThreshold && children.length > +props2.swipeThreshold);
  10268. const barStyle = vue.computed(() => {
  10269. if (opened.value && isDef(props2.zIndex)) {
  10270. return {
  10271. zIndex: +props2.zIndex + 1
  10272. };
  10273. }
  10274. });
  10275. const close = () => {
  10276. children.forEach((item) => {
  10277. item.toggle(false);
  10278. });
  10279. };
  10280. const onClickAway = () => {
  10281. if (props2.closeOnClickOutside) {
  10282. close();
  10283. }
  10284. };
  10285. const updateOffset = () => {
  10286. if (barRef.value) {
  10287. const rect = useRect(barRef);
  10288. if (props2.direction === "down") {
  10289. offset2.value = rect.bottom;
  10290. } else {
  10291. offset2.value = windowHeight.value - rect.top;
  10292. }
  10293. }
  10294. };
  10295. const onScroll = () => {
  10296. if (opened.value) {
  10297. updateOffset();
  10298. }
  10299. };
  10300. const toggleItem = (active) => {
  10301. children.forEach((item, index) => {
  10302. if (index === active) {
  10303. item.toggle();
  10304. } else if (item.state.showPopup) {
  10305. item.toggle(false, {
  10306. immediate: true
  10307. });
  10308. }
  10309. });
  10310. };
  10311. const renderTitle = (item, index) => {
  10312. const {
  10313. showPopup
  10314. } = item.state;
  10315. const {
  10316. disabled,
  10317. titleClass
  10318. } = item;
  10319. return vue.createVNode("div", {
  10320. "id": `${id}-${index}`,
  10321. "role": "button",
  10322. "tabindex": disabled ? void 0 : 0,
  10323. "data-allow-mismatch": "attribute",
  10324. "class": [bem$L("item", {
  10325. disabled,
  10326. grow: scrollable.value
  10327. }), {
  10328. [HAPTICS_FEEDBACK]: !disabled
  10329. }],
  10330. "onClick": () => {
  10331. if (!disabled) {
  10332. toggleItem(index);
  10333. }
  10334. }
  10335. }, [vue.createVNode("span", {
  10336. "class": [bem$L("title", {
  10337. down: showPopup === (props2.direction === "down"),
  10338. active: showPopup
  10339. }), titleClass],
  10340. "style": {
  10341. color: showPopup ? props2.activeColor : ""
  10342. }
  10343. }, [vue.createVNode("div", {
  10344. "class": "van-ellipsis"
  10345. }, [item.renderTitle()])])]);
  10346. };
  10347. useExpose({
  10348. close
  10349. });
  10350. linkChildren({
  10351. id,
  10352. props: props2,
  10353. offset: offset2,
  10354. updateOffset
  10355. });
  10356. useClickAway(root, onClickAway);
  10357. useEventListener("scroll", onScroll, {
  10358. target: scrollParent,
  10359. passive: true
  10360. });
  10361. return () => {
  10362. var _a;
  10363. return vue.createVNode("div", {
  10364. "ref": root,
  10365. "class": bem$L()
  10366. }, [vue.createVNode("div", {
  10367. "ref": barRef,
  10368. "style": barStyle.value,
  10369. "class": bem$L("bar", {
  10370. opened: opened.value,
  10371. scrollable: scrollable.value
  10372. })
  10373. }, [children.map(renderTitle)]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
  10374. };
  10375. }
  10376. });
  10377. const [name$K, bem$K] = createNamespace("dropdown-item");
  10378. const dropdownItemProps = {
  10379. title: String,
  10380. options: makeArrayProp(),
  10381. disabled: Boolean,
  10382. teleport: [String, Object],
  10383. lazyRender: truthProp,
  10384. modelValue: unknownProp,
  10385. titleClass: unknownProp
  10386. };
  10387. var stdin_default$T = vue.defineComponent({
  10388. name: name$K,
  10389. inheritAttrs: false,
  10390. props: dropdownItemProps,
  10391. emits: ["open", "opened", "close", "closed", "change", "update:modelValue"],
  10392. setup(props2, {
  10393. emit,
  10394. slots,
  10395. attrs
  10396. }) {
  10397. const state = vue.reactive({
  10398. showPopup: false,
  10399. transition: true,
  10400. showWrapper: false
  10401. });
  10402. const wrapperRef = vue.ref();
  10403. const {
  10404. parent,
  10405. index
  10406. } = useParent(DROPDOWN_KEY);
  10407. if (!parent) {
  10408. return;
  10409. }
  10410. const getEmitter = (name2) => () => emit(name2);
  10411. const onOpen = getEmitter("open");
  10412. const onClose = getEmitter("close");
  10413. const onOpened = getEmitter("opened");
  10414. const onClosed = () => {
  10415. state.showWrapper = false;
  10416. emit("closed");
  10417. };
  10418. const onClickWrapper = (event) => {
  10419. if (props2.teleport) {
  10420. event.stopPropagation();
  10421. }
  10422. };
  10423. const toggle = (show = !state.showPopup, options = {}) => {
  10424. if (show === state.showPopup) {
  10425. return;
  10426. }
  10427. state.showPopup = show;
  10428. state.transition = !options.immediate;
  10429. if (show) {
  10430. parent.updateOffset();
  10431. state.showWrapper = true;
  10432. }
  10433. };
  10434. const renderTitle = () => {
  10435. if (slots.title) {
  10436. return slots.title();
  10437. }
  10438. if (props2.title) {
  10439. return props2.title;
  10440. }
  10441. const match = props2.options.find((option) => option.value === props2.modelValue);
  10442. return match ? match.text : "";
  10443. };
  10444. const renderOption = (option) => {
  10445. const {
  10446. activeColor
  10447. } = parent.props;
  10448. const {
  10449. disabled
  10450. } = option;
  10451. const active = option.value === props2.modelValue;
  10452. const onClick = () => {
  10453. if (disabled) {
  10454. return;
  10455. }
  10456. state.showPopup = false;
  10457. if (option.value !== props2.modelValue) {
  10458. emit("update:modelValue", option.value);
  10459. emit("change", option.value);
  10460. }
  10461. };
  10462. const renderIcon = () => {
  10463. if (active) {
  10464. return vue.createVNode(Icon, {
  10465. "class": bem$K("icon"),
  10466. "color": disabled ? void 0 : activeColor,
  10467. "name": "success"
  10468. }, null);
  10469. }
  10470. };
  10471. return vue.createVNode(Cell, {
  10472. "role": "menuitem",
  10473. "key": String(option.value),
  10474. "icon": option.icon,
  10475. "title": option.text,
  10476. "class": bem$K("option", {
  10477. active,
  10478. disabled
  10479. }),
  10480. "style": {
  10481. color: active ? activeColor : ""
  10482. },
  10483. "tabindex": active ? 0 : -1,
  10484. "clickable": !disabled,
  10485. "onClick": onClick
  10486. }, {
  10487. value: renderIcon
  10488. });
  10489. };
  10490. const renderContent = () => {
  10491. const {
  10492. offset: offset2
  10493. } = parent;
  10494. const {
  10495. autoLocate,
  10496. zIndex,
  10497. overlay,
  10498. duration,
  10499. direction,
  10500. closeOnClickOverlay
  10501. } = parent.props;
  10502. const style = getZIndexStyle(zIndex);
  10503. let offsetValue = offset2.value;
  10504. if (autoLocate && wrapperRef.value) {
  10505. const offsetParent = getContainingBlock$1(wrapperRef.value);
  10506. if (offsetParent) {
  10507. offsetValue -= useRect(offsetParent).top;
  10508. }
  10509. }
  10510. if (direction === "down") {
  10511. style.top = `${offsetValue}px`;
  10512. } else {
  10513. style.bottom = `${offsetValue}px`;
  10514. }
  10515. return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  10516. "ref": wrapperRef,
  10517. "style": style,
  10518. "class": bem$K([direction]),
  10519. "onClick": onClickWrapper
  10520. }, attrs), [vue.createVNode(Popup, {
  10521. "show": state.showPopup,
  10522. "onUpdate:show": ($event) => state.showPopup = $event,
  10523. "role": "menu",
  10524. "class": bem$K("content"),
  10525. "overlay": overlay,
  10526. "position": direction === "down" ? "top" : "bottom",
  10527. "duration": state.transition ? duration : 0,
  10528. "lazyRender": props2.lazyRender,
  10529. "overlayStyle": {
  10530. position: "absolute"
  10531. },
  10532. "aria-labelledby": `${parent.id}-${index.value}`,
  10533. "data-allow-mismatch": "attribute",
  10534. "closeOnClickOverlay": closeOnClickOverlay,
  10535. "onOpen": onOpen,
  10536. "onClose": onClose,
  10537. "onOpened": onOpened,
  10538. "onClosed": onClosed
  10539. }, {
  10540. default: () => {
  10541. var _a;
  10542. return [props2.options.map(renderOption), (_a = slots.default) == null ? void 0 : _a.call(slots)];
  10543. }
  10544. })]), [[vue.vShow, state.showWrapper]]);
  10545. };
  10546. useExpose({
  10547. state,
  10548. toggle,
  10549. renderTitle
  10550. });
  10551. return () => {
  10552. if (props2.teleport) {
  10553. return vue.createVNode(vue.Teleport, {
  10554. "to": props2.teleport
  10555. }, {
  10556. default: () => [renderContent()]
  10557. });
  10558. }
  10559. return renderContent();
  10560. };
  10561. }
  10562. });
  10563. const DropdownItem = withInstall(stdin_default$T);
  10564. const DropdownMenu = withInstall(stdin_default$U);
  10565. const floatingBubbleProps = {
  10566. gap: makeNumberProp(24),
  10567. icon: String,
  10568. axis: makeStringProp("y"),
  10569. magnetic: String,
  10570. offset: {
  10571. type: Object,
  10572. default: () => ({
  10573. x: -1,
  10574. y: -1
  10575. })
  10576. },
  10577. teleport: {
  10578. type: [String, Object],
  10579. default: "body"
  10580. }
  10581. };
  10582. const [name$J, bem$J] = createNamespace("floating-bubble");
  10583. var stdin_default$S = vue.defineComponent({
  10584. name: name$J,
  10585. inheritAttrs: false,
  10586. props: floatingBubbleProps,
  10587. emits: ["click", "update:offset", "offsetChange"],
  10588. setup(props2, {
  10589. slots,
  10590. emit,
  10591. attrs
  10592. }) {
  10593. const rootRef = vue.ref();
  10594. const state = vue.ref({
  10595. x: 0,
  10596. y: 0,
  10597. width: 0,
  10598. height: 0
  10599. });
  10600. const boundary = vue.computed(() => ({
  10601. top: props2.gap,
  10602. right: windowWidth.value - state.value.width - props2.gap,
  10603. bottom: windowHeight.value - state.value.height - props2.gap,
  10604. left: props2.gap
  10605. }));
  10606. const dragging = vue.ref(false);
  10607. let initialized = false;
  10608. const rootStyle = vue.computed(() => {
  10609. const style = {};
  10610. const x = addUnit(state.value.x);
  10611. const y = addUnit(state.value.y);
  10612. style.transform = `translate3d(${x}, ${y}, 0)`;
  10613. if (dragging.value || !initialized) {
  10614. style.transition = "none";
  10615. }
  10616. return style;
  10617. });
  10618. const updateState = () => {
  10619. if (!show.value) return;
  10620. const {
  10621. width: width2,
  10622. height: height2
  10623. } = useRect(rootRef.value);
  10624. const {
  10625. offset: offset2
  10626. } = props2;
  10627. state.value = {
  10628. x: offset2.x > -1 ? offset2.x : windowWidth.value - width2 - props2.gap,
  10629. y: offset2.y > -1 ? offset2.y : windowHeight.value - height2 - props2.gap,
  10630. width: width2,
  10631. height: height2
  10632. };
  10633. };
  10634. const touch = useTouch();
  10635. let prevX = 0;
  10636. let prevY = 0;
  10637. const onTouchStart = (e) => {
  10638. touch.start(e);
  10639. dragging.value = true;
  10640. prevX = state.value.x;
  10641. prevY = state.value.y;
  10642. };
  10643. const onTouchMove = (e) => {
  10644. e.preventDefault();
  10645. touch.move(e);
  10646. if (props2.axis === "lock") return;
  10647. if (!touch.isTap.value) {
  10648. if (props2.axis === "x" || props2.axis === "xy") {
  10649. let nextX = prevX + touch.deltaX.value;
  10650. if (nextX < boundary.value.left) nextX = boundary.value.left;
  10651. if (nextX > boundary.value.right) nextX = boundary.value.right;
  10652. state.value.x = nextX;
  10653. }
  10654. if (props2.axis === "y" || props2.axis === "xy") {
  10655. let nextY = prevY + touch.deltaY.value;
  10656. if (nextY < boundary.value.top) nextY = boundary.value.top;
  10657. if (nextY > boundary.value.bottom) nextY = boundary.value.bottom;
  10658. state.value.y = nextY;
  10659. }
  10660. const offset2 = pick(state.value, ["x", "y"]);
  10661. emit("update:offset", offset2);
  10662. }
  10663. };
  10664. useEventListener("touchmove", onTouchMove, {
  10665. target: rootRef
  10666. });
  10667. const onTouchEnd = () => {
  10668. dragging.value = false;
  10669. vue.nextTick(() => {
  10670. if (props2.magnetic === "x") {
  10671. const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
  10672. state.value.x = nextX;
  10673. }
  10674. if (props2.magnetic === "y") {
  10675. const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
  10676. state.value.y = nextY;
  10677. }
  10678. if (!touch.isTap.value) {
  10679. const offset2 = pick(state.value, ["x", "y"]);
  10680. emit("update:offset", offset2);
  10681. if (prevX !== offset2.x || prevY !== offset2.y) {
  10682. emit("offsetChange", offset2);
  10683. }
  10684. }
  10685. });
  10686. };
  10687. const onClick = (e) => {
  10688. if (touch.isTap.value) emit("click", e);
  10689. else e.stopPropagation();
  10690. };
  10691. vue.onMounted(() => {
  10692. updateState();
  10693. vue.nextTick(() => {
  10694. initialized = true;
  10695. });
  10696. });
  10697. vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState, {
  10698. deep: true
  10699. });
  10700. const show = vue.ref(true);
  10701. vue.onActivated(() => {
  10702. show.value = true;
  10703. });
  10704. vue.onDeactivated(() => {
  10705. if (props2.teleport) {
  10706. show.value = false;
  10707. }
  10708. });
  10709. return () => {
  10710. const Content = vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  10711. "class": bem$J(),
  10712. "ref": rootRef,
  10713. "onTouchstartPassive": onTouchStart,
  10714. "onTouchend": onTouchEnd,
  10715. "onTouchcancel": onTouchEnd,
  10716. "onClickCapture": onClick,
  10717. "style": rootStyle.value
  10718. }, attrs), [slots.default ? slots.default() : vue.createVNode(stdin_default$1Q, {
  10719. "name": props2.icon,
  10720. "class": bem$J("icon")
  10721. }, null)]), [[vue.vShow, show.value]]);
  10722. return props2.teleport ? vue.createVNode(vue.Teleport, {
  10723. "to": props2.teleport
  10724. }, {
  10725. default: () => [Content]
  10726. }) : Content;
  10727. };
  10728. }
  10729. });
  10730. const FloatingBubble = withInstall(stdin_default$S);
  10731. const floatingPanelProps = {
  10732. height: makeNumericProp(0),
  10733. anchors: makeArrayProp(),
  10734. duration: makeNumericProp(0.3),
  10735. contentDraggable: truthProp,
  10736. lockScroll: Boolean,
  10737. safeAreaInsetBottom: truthProp
  10738. };
  10739. const [name$I, bem$I] = createNamespace("floating-panel");
  10740. var stdin_default$R = vue.defineComponent({
  10741. name: name$I,
  10742. props: floatingPanelProps,
  10743. emits: ["heightChange", "update:height"],
  10744. setup(props2, {
  10745. emit,
  10746. slots
  10747. }) {
  10748. const DAMP = 0.2;
  10749. const rootRef = vue.ref();
  10750. const contentRef = vue.ref();
  10751. const height2 = useSyncPropRef(() => +props2.height, (value) => emit("update:height", value));
  10752. const boundary = vue.computed(() => {
  10753. var _a, _b;
  10754. return {
  10755. min: (_a = props2.anchors[0]) != null ? _a : 100,
  10756. max: (_b = props2.anchors[props2.anchors.length - 1]) != null ? _b : Math.round(windowHeight.value * 0.6)
  10757. };
  10758. });
  10759. const anchors = vue.computed(() => props2.anchors.length >= 2 ? props2.anchors : [boundary.value.min, boundary.value.max]);
  10760. const dragging = vue.ref(false);
  10761. const rootStyle = vue.computed(() => ({
  10762. height: addUnit(boundary.value.max),
  10763. transform: `translateY(calc(100% + ${addUnit(-height2.value)}))`,
  10764. transition: !dragging.value ? `transform ${props2.duration}s cubic-bezier(0.18, 0.89, 0.32, 1.28)` : "none"
  10765. }));
  10766. const ease = (moveY) => {
  10767. const absDistance = Math.abs(moveY);
  10768. const {
  10769. min,
  10770. max
  10771. } = boundary.value;
  10772. if (absDistance > max) {
  10773. return -(max + (absDistance - max) * DAMP);
  10774. }
  10775. if (absDistance < min) {
  10776. return -(min - (min - absDistance) * DAMP);
  10777. }
  10778. return moveY;
  10779. };
  10780. let startY;
  10781. let maxScroll = -1;
  10782. const touch = useTouch();
  10783. const onTouchstart = (e) => {
  10784. touch.start(e);
  10785. dragging.value = true;
  10786. startY = -height2.value;
  10787. maxScroll = -1;
  10788. };
  10789. const onTouchmove = (e) => {
  10790. var _a;
  10791. touch.move(e);
  10792. const target = e.target;
  10793. if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
  10794. const {
  10795. scrollTop
  10796. } = contentRef.value;
  10797. maxScroll = Math.max(maxScroll, scrollTop);
  10798. if (!props2.contentDraggable) return;
  10799. if (-startY < boundary.value.max) {
  10800. preventDefault(e, true);
  10801. } else if (!(scrollTop <= 0 && touch.deltaY.value > 0) || maxScroll > 0) {
  10802. return;
  10803. }
  10804. }
  10805. const moveY = touch.deltaY.value + startY;
  10806. height2.value = -ease(moveY);
  10807. };
  10808. const onTouchend = () => {
  10809. maxScroll = -1;
  10810. dragging.value = false;
  10811. height2.value = closest(anchors.value, height2.value);
  10812. if (height2.value !== -startY) {
  10813. emit("heightChange", {
  10814. height: height2.value
  10815. });
  10816. }
  10817. };
  10818. vue.watch(boundary, () => {
  10819. height2.value = closest(anchors.value, height2.value);
  10820. }, {
  10821. immediate: true
  10822. });
  10823. useLockScroll(rootRef, () => props2.lockScroll || dragging.value);
  10824. useEventListener("touchmove", onTouchmove, {
  10825. target: rootRef
  10826. });
  10827. const renderHeader = () => {
  10828. if (slots.header) {
  10829. return slots.header();
  10830. }
  10831. return vue.createVNode("div", {
  10832. "class": bem$I("header")
  10833. }, [vue.createVNode("div", {
  10834. "class": bem$I("header-bar")
  10835. }, null)]);
  10836. };
  10837. return () => {
  10838. var _a;
  10839. return vue.createVNode("div", {
  10840. "class": [bem$I(), {
  10841. "van-safe-area-bottom": props2.safeAreaInsetBottom
  10842. }],
  10843. "ref": rootRef,
  10844. "style": rootStyle.value,
  10845. "onTouchstartPassive": onTouchstart,
  10846. "onTouchend": onTouchend,
  10847. "onTouchcancel": onTouchend
  10848. }, [renderHeader(), vue.createVNode("div", {
  10849. "class": bem$I("content"),
  10850. "ref": contentRef
  10851. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  10852. };
  10853. }
  10854. });
  10855. const FloatingPanel = withInstall(stdin_default$R);
  10856. const [name$H, bem$H] = createNamespace("grid");
  10857. const gridProps = {
  10858. square: Boolean,
  10859. center: truthProp,
  10860. border: truthProp,
  10861. gutter: numericProp,
  10862. reverse: Boolean,
  10863. iconSize: numericProp,
  10864. direction: String,
  10865. clickable: Boolean,
  10866. columnNum: makeNumericProp(4)
  10867. };
  10868. const GRID_KEY = Symbol(name$H);
  10869. var stdin_default$Q = vue.defineComponent({
  10870. name: name$H,
  10871. props: gridProps,
  10872. setup(props2, {
  10873. slots
  10874. }) {
  10875. const {
  10876. linkChildren
  10877. } = useChildren(GRID_KEY);
  10878. linkChildren({
  10879. props: props2
  10880. });
  10881. return () => {
  10882. var _a;
  10883. return vue.createVNode("div", {
  10884. "style": {
  10885. paddingLeft: addUnit(props2.gutter)
  10886. },
  10887. "class": [bem$H(), {
  10888. [BORDER_TOP]: props2.border && !props2.gutter
  10889. }]
  10890. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  10891. };
  10892. }
  10893. });
  10894. const Grid = withInstall(stdin_default$Q);
  10895. const [name$G, bem$G] = createNamespace("grid-item");
  10896. const gridItemProps = extend({}, routeProps, {
  10897. dot: Boolean,
  10898. text: String,
  10899. icon: String,
  10900. badge: numericProp,
  10901. iconColor: String,
  10902. iconPrefix: String,
  10903. badgeProps: Object
  10904. });
  10905. var stdin_default$P = vue.defineComponent({
  10906. name: name$G,
  10907. props: gridItemProps,
  10908. setup(props2, {
  10909. slots
  10910. }) {
  10911. const {
  10912. parent,
  10913. index
  10914. } = useParent(GRID_KEY);
  10915. const route2 = useRoute();
  10916. if (!parent) {
  10917. return;
  10918. }
  10919. const rootStyle = vue.computed(() => {
  10920. const {
  10921. square,
  10922. gutter,
  10923. columnNum
  10924. } = parent.props;
  10925. const percent = `${100 / +columnNum}%`;
  10926. const style = {
  10927. flexBasis: percent
  10928. };
  10929. if (square) {
  10930. style.paddingTop = percent;
  10931. } else if (gutter) {
  10932. const gutterValue = addUnit(gutter);
  10933. style.paddingRight = gutterValue;
  10934. if (index.value >= +columnNum) {
  10935. style.marginTop = gutterValue;
  10936. }
  10937. }
  10938. return style;
  10939. });
  10940. const contentStyle = vue.computed(() => {
  10941. const {
  10942. square,
  10943. gutter
  10944. } = parent.props;
  10945. if (square && gutter) {
  10946. const gutterValue = addUnit(gutter);
  10947. return {
  10948. right: gutterValue,
  10949. bottom: gutterValue,
  10950. height: "auto"
  10951. };
  10952. }
  10953. });
  10954. const renderIcon = () => {
  10955. if (slots.icon) {
  10956. return vue.createVNode(Badge, vue.mergeProps({
  10957. "dot": props2.dot,
  10958. "content": props2.badge
  10959. }, props2.badgeProps), {
  10960. default: slots.icon
  10961. });
  10962. }
  10963. if (props2.icon) {
  10964. return vue.createVNode(Icon, {
  10965. "dot": props2.dot,
  10966. "name": props2.icon,
  10967. "size": parent.props.iconSize,
  10968. "badge": props2.badge,
  10969. "class": bem$G("icon"),
  10970. "color": props2.iconColor,
  10971. "badgeProps": props2.badgeProps,
  10972. "classPrefix": props2.iconPrefix
  10973. }, null);
  10974. }
  10975. };
  10976. const renderText = () => {
  10977. if (slots.text) {
  10978. return slots.text();
  10979. }
  10980. if (props2.text) {
  10981. return vue.createVNode("span", {
  10982. "class": bem$G("text")
  10983. }, [props2.text]);
  10984. }
  10985. };
  10986. const renderContent = () => {
  10987. if (slots.default) {
  10988. return slots.default();
  10989. }
  10990. return [renderIcon(), renderText()];
  10991. };
  10992. return () => {
  10993. const {
  10994. center,
  10995. border,
  10996. square,
  10997. gutter,
  10998. reverse,
  10999. direction,
  11000. clickable
  11001. } = parent.props;
  11002. const classes = [bem$G("content", [direction, {
  11003. center,
  11004. square,
  11005. reverse,
  11006. clickable,
  11007. surround: border && gutter
  11008. }]), {
  11009. [BORDER]: border
  11010. }];
  11011. return vue.createVNode("div", {
  11012. "class": [bem$G({
  11013. square
  11014. })],
  11015. "style": rootStyle.value
  11016. }, [vue.createVNode("div", {
  11017. "role": clickable ? "button" : void 0,
  11018. "class": classes,
  11019. "style": contentStyle.value,
  11020. "tabindex": clickable ? 0 : void 0,
  11021. "onClick": route2
  11022. }, [renderContent()])]);
  11023. };
  11024. }
  11025. });
  11026. const GridItem = withInstall(stdin_default$P);
  11027. const [name$F, bem$F] = createNamespace("highlight");
  11028. const highlightProps = {
  11029. autoEscape: truthProp,
  11030. caseSensitive: Boolean,
  11031. highlightClass: String,
  11032. highlightTag: makeStringProp("span"),
  11033. keywords: makeRequiredProp([String, Array]),
  11034. sourceString: makeStringProp(""),
  11035. tag: makeStringProp("div"),
  11036. unhighlightClass: String,
  11037. unhighlightTag: makeStringProp("span")
  11038. };
  11039. var stdin_default$O = vue.defineComponent({
  11040. name: name$F,
  11041. props: highlightProps,
  11042. setup(props2) {
  11043. const highlightChunks = vue.computed(() => {
  11044. const {
  11045. autoEscape,
  11046. caseSensitive,
  11047. keywords,
  11048. sourceString
  11049. } = props2;
  11050. const flags = caseSensitive ? "g" : "gi";
  11051. const _keywords = Array.isArray(keywords) ? keywords : [keywords];
  11052. let chunks = _keywords.filter((keyword) => keyword).reduce((chunks2, keyword) => {
  11053. if (autoEscape) {
  11054. keyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  11055. }
  11056. const regex = new RegExp(keyword, flags);
  11057. let match;
  11058. while (match = regex.exec(sourceString)) {
  11059. const start2 = match.index;
  11060. const end2 = regex.lastIndex;
  11061. if (start2 >= end2) {
  11062. regex.lastIndex++;
  11063. continue;
  11064. }
  11065. chunks2.push({
  11066. start: start2,
  11067. end: end2,
  11068. highlight: true
  11069. });
  11070. }
  11071. return chunks2;
  11072. }, []);
  11073. chunks = chunks.sort((a, b) => a.start - b.start).reduce((chunks2, currentChunk) => {
  11074. const prevChunk = chunks2[chunks2.length - 1];
  11075. if (!prevChunk || currentChunk.start > prevChunk.end) {
  11076. const unhighlightStart = prevChunk ? prevChunk.end : 0;
  11077. const unhighlightEnd = currentChunk.start;
  11078. if (unhighlightStart !== unhighlightEnd) {
  11079. chunks2.push({
  11080. start: unhighlightStart,
  11081. end: unhighlightEnd,
  11082. highlight: false
  11083. });
  11084. }
  11085. chunks2.push(currentChunk);
  11086. } else {
  11087. prevChunk.end = Math.max(prevChunk.end, currentChunk.end);
  11088. }
  11089. return chunks2;
  11090. }, []);
  11091. const lastChunk = chunks[chunks.length - 1];
  11092. if (!lastChunk) {
  11093. chunks.push({
  11094. start: 0,
  11095. end: sourceString.length,
  11096. highlight: false
  11097. });
  11098. }
  11099. if (lastChunk && lastChunk.end < sourceString.length) {
  11100. chunks.push({
  11101. start: lastChunk.end,
  11102. end: sourceString.length,
  11103. highlight: false
  11104. });
  11105. }
  11106. return chunks;
  11107. });
  11108. const renderContent = () => {
  11109. const {
  11110. sourceString,
  11111. highlightClass,
  11112. unhighlightClass,
  11113. highlightTag,
  11114. unhighlightTag
  11115. } = props2;
  11116. return highlightChunks.value.map((chunk) => {
  11117. const {
  11118. start: start2,
  11119. end: end2,
  11120. highlight
  11121. } = chunk;
  11122. const text = sourceString.slice(start2, end2);
  11123. if (highlight) {
  11124. return vue.createVNode(highlightTag, {
  11125. "class": [bem$F("tag"), highlightClass]
  11126. }, {
  11127. default: () => [text]
  11128. });
  11129. }
  11130. return vue.createVNode(unhighlightTag, {
  11131. "class": unhighlightClass
  11132. }, {
  11133. default: () => [text]
  11134. });
  11135. });
  11136. };
  11137. return () => {
  11138. const {
  11139. tag
  11140. } = props2;
  11141. return vue.createVNode(tag, {
  11142. "class": bem$F()
  11143. }, {
  11144. default: () => [renderContent()]
  11145. });
  11146. };
  11147. }
  11148. });
  11149. const Highlight = withInstall(stdin_default$O);
  11150. const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
  11151. const getCenter = (touches) => ({
  11152. x: (touches[0].clientX + touches[1].clientX) / 2,
  11153. y: (touches[0].clientY + touches[1].clientY) / 2
  11154. });
  11155. const bem$E = createNamespace("image-preview")[1];
  11156. const longImageRatio = 2.6;
  11157. const imagePreviewItemProps = {
  11158. src: String,
  11159. show: Boolean,
  11160. active: Number,
  11161. minZoom: makeRequiredProp(numericProp),
  11162. maxZoom: makeRequiredProp(numericProp),
  11163. rootWidth: makeRequiredProp(Number),
  11164. rootHeight: makeRequiredProp(Number),
  11165. disableZoom: Boolean,
  11166. doubleScale: Boolean,
  11167. closeOnClickImage: Boolean,
  11168. closeOnClickOverlay: Boolean,
  11169. vertical: Boolean
  11170. };
  11171. var stdin_default$N = vue.defineComponent({
  11172. props: imagePreviewItemProps,
  11173. emits: ["scale", "close", "longPress"],
  11174. setup(props2, {
  11175. emit,
  11176. slots
  11177. }) {
  11178. const state = vue.reactive({
  11179. scale: 1,
  11180. moveX: 0,
  11181. moveY: 0,
  11182. moving: false,
  11183. zooming: false,
  11184. initializing: false,
  11185. imageRatio: 0
  11186. });
  11187. const touch = useTouch();
  11188. const imageRef = vue.ref();
  11189. const swipeItem = vue.ref();
  11190. const vertical = vue.ref(false);
  11191. const isLongImage = vue.ref(false);
  11192. let initialMoveY = 0;
  11193. const imageStyle = vue.computed(() => {
  11194. const {
  11195. scale,
  11196. moveX,
  11197. moveY,
  11198. moving,
  11199. zooming,
  11200. initializing
  11201. } = state;
  11202. const style = {
  11203. transitionDuration: zooming || moving || initializing ? "0s" : ".3s"
  11204. };
  11205. if (scale !== 1 || isLongImage.value) {
  11206. style.transform = `matrix(${scale}, 0, 0, ${scale}, ${moveX}, ${moveY})`;
  11207. }
  11208. return style;
  11209. });
  11210. const maxMoveX = vue.computed(() => {
  11211. if (state.imageRatio) {
  11212. const {
  11213. rootWidth,
  11214. rootHeight
  11215. } = props2;
  11216. const displayWidth = vertical.value ? rootHeight / state.imageRatio : rootWidth;
  11217. return Math.max(0, (state.scale * displayWidth - rootWidth) / 2);
  11218. }
  11219. return 0;
  11220. });
  11221. const maxMoveY = vue.computed(() => {
  11222. if (state.imageRatio) {
  11223. const {
  11224. rootWidth,
  11225. rootHeight
  11226. } = props2;
  11227. const displayHeight = vertical.value ? rootHeight : rootWidth * state.imageRatio;
  11228. return Math.max(0, (state.scale * displayHeight - rootHeight) / 2);
  11229. }
  11230. return 0;
  11231. });
  11232. const setScale = (scale, center) => {
  11233. var _a;
  11234. scale = clamp(scale, +props2.minZoom, +props2.maxZoom + 1);
  11235. if (scale !== state.scale) {
  11236. const ratio = scale / state.scale;
  11237. state.scale = scale;
  11238. if (center) {
  11239. const imageRect = useRect((_a = imageRef.value) == null ? void 0 : _a.$el);
  11240. const origin = {
  11241. x: imageRect.width * 0.5,
  11242. y: imageRect.height * 0.5
  11243. };
  11244. const moveX = state.moveX - (center.x - imageRect.left - origin.x) * (ratio - 1);
  11245. const moveY = state.moveY - (center.y - imageRect.top - origin.y) * (ratio - 1);
  11246. state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
  11247. state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
  11248. } else {
  11249. state.moveX = 0;
  11250. state.moveY = isLongImage.value ? initialMoveY : 0;
  11251. }
  11252. emit("scale", {
  11253. scale,
  11254. index: props2.active
  11255. });
  11256. }
  11257. };
  11258. const resetScale = () => {
  11259. setScale(1);
  11260. };
  11261. const toggleScale = () => {
  11262. const scale = state.scale > 1 ? 1 : 2;
  11263. setScale(scale, scale === 2 || isLongImage.value ? {
  11264. x: touch.startX.value,
  11265. y: touch.startY.value
  11266. } : void 0);
  11267. };
  11268. let fingerNum;
  11269. let startMoveX;
  11270. let startMoveY;
  11271. let startScale;
  11272. let startDistance;
  11273. let lastCenter;
  11274. let doubleTapTimer;
  11275. let touchStartTime;
  11276. let isImageMoved = false;
  11277. const onTouchStart = (event) => {
  11278. const {
  11279. touches
  11280. } = event;
  11281. fingerNum = touches.length;
  11282. if (fingerNum === 2 && props2.disableZoom) {
  11283. return;
  11284. }
  11285. const {
  11286. offsetX
  11287. } = touch;
  11288. touch.start(event);
  11289. startMoveX = state.moveX;
  11290. startMoveY = state.moveY;
  11291. touchStartTime = Date.now();
  11292. isImageMoved = false;
  11293. state.moving = fingerNum === 1 && (state.scale !== 1 || isLongImage.value);
  11294. state.zooming = fingerNum === 2 && !offsetX.value;
  11295. if (state.zooming) {
  11296. startScale = state.scale;
  11297. startDistance = getDistance(touches);
  11298. }
  11299. };
  11300. const onTouchMove = (event) => {
  11301. const {
  11302. touches
  11303. } = event;
  11304. touch.move(event);
  11305. if (state.moving) {
  11306. const {
  11307. deltaX,
  11308. deltaY
  11309. } = touch;
  11310. const moveX = deltaX.value + startMoveX;
  11311. const moveY = deltaY.value + startMoveY;
  11312. if ((props2.vertical ? touch.isVertical() && Math.abs(moveY) > maxMoveY.value : touch.isHorizontal() && Math.abs(moveX) > maxMoveX.value) && !isImageMoved) {
  11313. state.moving = false;
  11314. return;
  11315. }
  11316. isImageMoved = true;
  11317. preventDefault(event, true);
  11318. state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
  11319. state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
  11320. }
  11321. if (state.zooming) {
  11322. preventDefault(event, true);
  11323. if (touches.length === 2) {
  11324. const distance = getDistance(touches);
  11325. const scale = startScale * distance / startDistance;
  11326. lastCenter = getCenter(touches);
  11327. setScale(scale, lastCenter);
  11328. }
  11329. }
  11330. };
  11331. const checkClose = (event) => {
  11332. var _a;
  11333. const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
  11334. if (!swipeItemEl) return;
  11335. const imageEl = swipeItemEl.firstElementChild;
  11336. const isClickOverlay = event.target === swipeItemEl;
  11337. const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
  11338. if (!props2.closeOnClickImage && isClickImage) return;
  11339. if (!props2.closeOnClickOverlay && isClickOverlay) return;
  11340. emit("close");
  11341. };
  11342. const checkTap = (event) => {
  11343. if (fingerNum > 1) {
  11344. return;
  11345. }
  11346. const deltaTime = Date.now() - touchStartTime;
  11347. const TAP_TIME = 250;
  11348. if (touch.isTap.value) {
  11349. if (deltaTime < TAP_TIME) {
  11350. if (props2.doubleScale) {
  11351. if (doubleTapTimer) {
  11352. clearTimeout(doubleTapTimer);
  11353. doubleTapTimer = null;
  11354. toggleScale();
  11355. } else {
  11356. doubleTapTimer = setTimeout(() => {
  11357. checkClose(event);
  11358. doubleTapTimer = null;
  11359. }, TAP_TIME);
  11360. }
  11361. } else {
  11362. checkClose(event);
  11363. }
  11364. } else if (deltaTime > LONG_PRESS_START_TIME) {
  11365. emit("longPress");
  11366. }
  11367. }
  11368. };
  11369. const onTouchEnd = (event) => {
  11370. let stopPropagation2 = false;
  11371. if (state.moving || state.zooming) {
  11372. stopPropagation2 = true;
  11373. if (state.moving && startMoveX === state.moveX && startMoveY === state.moveY) {
  11374. stopPropagation2 = false;
  11375. }
  11376. if (!event.touches.length) {
  11377. if (state.zooming) {
  11378. state.moveX = clamp(state.moveX, -maxMoveX.value, maxMoveX.value);
  11379. state.moveY = clamp(state.moveY, -maxMoveY.value, maxMoveY.value);
  11380. state.zooming = false;
  11381. }
  11382. state.moving = false;
  11383. startMoveX = 0;
  11384. startMoveY = 0;
  11385. startScale = 1;
  11386. if (state.scale < 1) {
  11387. resetScale();
  11388. }
  11389. const maxZoom = +props2.maxZoom;
  11390. if (state.scale > maxZoom) {
  11391. setScale(maxZoom, lastCenter);
  11392. }
  11393. }
  11394. }
  11395. preventDefault(event, stopPropagation2);
  11396. checkTap(event);
  11397. touch.reset();
  11398. };
  11399. const resize = () => {
  11400. const {
  11401. rootWidth,
  11402. rootHeight
  11403. } = props2;
  11404. const rootRatio = rootHeight / rootWidth;
  11405. const {
  11406. imageRatio
  11407. } = state;
  11408. vertical.value = state.imageRatio > rootRatio && imageRatio < longImageRatio;
  11409. isLongImage.value = state.imageRatio > rootRatio && imageRatio >= longImageRatio;
  11410. if (isLongImage.value) {
  11411. initialMoveY = (imageRatio * rootWidth - rootHeight) / 2;
  11412. state.moveY = initialMoveY;
  11413. state.initializing = true;
  11414. raf(() => {
  11415. state.initializing = false;
  11416. });
  11417. }
  11418. resetScale();
  11419. };
  11420. const onLoad = (event) => {
  11421. const {
  11422. naturalWidth,
  11423. naturalHeight
  11424. } = event.target;
  11425. state.imageRatio = naturalHeight / naturalWidth;
  11426. resize();
  11427. };
  11428. vue.watch(() => props2.active, resetScale);
  11429. vue.watch(() => props2.show, (value) => {
  11430. if (!value) {
  11431. resetScale();
  11432. }
  11433. });
  11434. vue.watch(() => [props2.rootWidth, props2.rootHeight], resize);
  11435. useEventListener("touchmove", onTouchMove, {
  11436. target: vue.computed(() => {
  11437. var _a;
  11438. return (_a = swipeItem.value) == null ? void 0 : _a.$el;
  11439. })
  11440. });
  11441. useExpose({
  11442. resetScale
  11443. });
  11444. return () => {
  11445. const imageSlots = {
  11446. loading: () => vue.createVNode(Loading, {
  11447. "type": "spinner"
  11448. }, null)
  11449. };
  11450. return vue.createVNode(SwipeItem, {
  11451. "ref": swipeItem,
  11452. "class": bem$E("swipe-item"),
  11453. "onTouchstartPassive": onTouchStart,
  11454. "onTouchend": onTouchEnd,
  11455. "onTouchcancel": onTouchEnd
  11456. }, {
  11457. default: () => [slots.image ? vue.createVNode("div", {
  11458. "class": bem$E("image-wrap")
  11459. }, [slots.image({
  11460. src: props2.src,
  11461. onLoad,
  11462. style: imageStyle.value
  11463. })]) : vue.createVNode(Image$1, {
  11464. "ref": imageRef,
  11465. "src": props2.src,
  11466. "fit": "contain",
  11467. "class": bem$E("image", {
  11468. vertical: vertical.value
  11469. }),
  11470. "style": imageStyle.value,
  11471. "onLoad": onLoad
  11472. }, imageSlots)]
  11473. });
  11474. };
  11475. }
  11476. });
  11477. const [name$E, bem$D] = createNamespace("image-preview");
  11478. const popupProps$1 = ["show", "teleport", "transition", "overlayStyle", "closeOnPopstate"];
  11479. const imagePreviewProps = {
  11480. show: Boolean,
  11481. loop: truthProp,
  11482. images: makeArrayProp(),
  11483. minZoom: makeNumericProp(1 / 3),
  11484. maxZoom: makeNumericProp(3),
  11485. overlay: truthProp,
  11486. vertical: Boolean,
  11487. closeable: Boolean,
  11488. showIndex: truthProp,
  11489. className: unknownProp,
  11490. closeIcon: makeStringProp("clear"),
  11491. transition: String,
  11492. beforeClose: Function,
  11493. doubleScale: truthProp,
  11494. overlayClass: unknownProp,
  11495. overlayStyle: Object,
  11496. swipeDuration: makeNumericProp(300),
  11497. startPosition: makeNumericProp(0),
  11498. showIndicators: Boolean,
  11499. closeOnPopstate: truthProp,
  11500. closeOnClickImage: truthProp,
  11501. closeOnClickOverlay: truthProp,
  11502. closeIconPosition: makeStringProp("top-right"),
  11503. teleport: [String, Object]
  11504. };
  11505. var stdin_default$M = vue.defineComponent({
  11506. name: name$E,
  11507. props: imagePreviewProps,
  11508. emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
  11509. setup(props2, {
  11510. emit,
  11511. slots
  11512. }) {
  11513. const swipeRef = vue.ref();
  11514. const activedPreviewItemRef = vue.ref();
  11515. const state = vue.reactive({
  11516. active: 0,
  11517. rootWidth: 0,
  11518. rootHeight: 0,
  11519. disableZoom: false
  11520. });
  11521. const resize = () => {
  11522. if (swipeRef.value) {
  11523. const rect = useRect(swipeRef.value.$el);
  11524. state.rootWidth = rect.width;
  11525. state.rootHeight = rect.height;
  11526. swipeRef.value.resize();
  11527. }
  11528. };
  11529. const emitScale = (args) => emit("scale", args);
  11530. const updateShow = (show) => emit("update:show", show);
  11531. const emitClose = () => {
  11532. callInterceptor(props2.beforeClose, {
  11533. args: [state.active],
  11534. done: () => updateShow(false)
  11535. });
  11536. };
  11537. const setActive = (active) => {
  11538. if (active !== state.active) {
  11539. state.active = active;
  11540. emit("change", active);
  11541. }
  11542. };
  11543. const renderIndex = () => {
  11544. if (props2.showIndex) {
  11545. return vue.createVNode("div", {
  11546. "class": bem$D("index")
  11547. }, [slots.index ? slots.index({
  11548. index: state.active
  11549. }) : `${state.active + 1} / ${props2.images.length}`]);
  11550. }
  11551. };
  11552. const renderCover = () => {
  11553. if (slots.cover) {
  11554. return vue.createVNode("div", {
  11555. "class": bem$D("cover")
  11556. }, [slots.cover()]);
  11557. }
  11558. };
  11559. const onDragStart = () => {
  11560. state.disableZoom = true;
  11561. };
  11562. const onDragEnd = () => {
  11563. state.disableZoom = false;
  11564. };
  11565. const renderImages = () => vue.createVNode(Swipe, {
  11566. "ref": swipeRef,
  11567. "lazyRender": true,
  11568. "loop": props2.loop,
  11569. "class": bem$D("swipe"),
  11570. "vertical": props2.vertical,
  11571. "duration": props2.swipeDuration,
  11572. "initialSwipe": props2.startPosition,
  11573. "showIndicators": props2.showIndicators,
  11574. "indicatorColor": "white",
  11575. "onChange": setActive,
  11576. "onDragEnd": onDragEnd,
  11577. "onDragStart": onDragStart
  11578. }, {
  11579. default: () => [props2.images.map((image, index) => vue.createVNode(stdin_default$N, {
  11580. "ref": (item) => {
  11581. if (index === state.active) {
  11582. activedPreviewItemRef.value = item;
  11583. }
  11584. },
  11585. "src": image,
  11586. "show": props2.show,
  11587. "active": state.active,
  11588. "maxZoom": props2.maxZoom,
  11589. "minZoom": props2.minZoom,
  11590. "rootWidth": state.rootWidth,
  11591. "rootHeight": state.rootHeight,
  11592. "disableZoom": state.disableZoom,
  11593. "doubleScale": props2.doubleScale,
  11594. "closeOnClickImage": props2.closeOnClickImage,
  11595. "closeOnClickOverlay": props2.closeOnClickOverlay,
  11596. "vertical": props2.vertical,
  11597. "onScale": emitScale,
  11598. "onClose": emitClose,
  11599. "onLongPress": () => emit("longPress", {
  11600. index
  11601. })
  11602. }, {
  11603. image: slots.image
  11604. }))]
  11605. });
  11606. const renderClose = () => {
  11607. if (props2.closeable) {
  11608. return vue.createVNode(Icon, {
  11609. "role": "button",
  11610. "name": props2.closeIcon,
  11611. "class": [bem$D("close-icon", props2.closeIconPosition), HAPTICS_FEEDBACK],
  11612. "onClick": emitClose
  11613. }, null);
  11614. }
  11615. };
  11616. const onClosed = () => emit("closed");
  11617. const swipeTo = (index, options) => {
  11618. var _a;
  11619. return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index, options);
  11620. };
  11621. useExpose({
  11622. resetScale: () => {
  11623. var _a;
  11624. (_a = activedPreviewItemRef.value) == null ? void 0 : _a.resetScale();
  11625. },
  11626. swipeTo
  11627. });
  11628. vue.onMounted(resize);
  11629. vue.watch([windowWidth, windowHeight], resize);
  11630. vue.watch(() => props2.startPosition, (value) => setActive(+value));
  11631. vue.watch(() => props2.show, (value) => {
  11632. const {
  11633. images,
  11634. startPosition
  11635. } = props2;
  11636. if (value) {
  11637. setActive(+startPosition);
  11638. vue.nextTick(() => {
  11639. resize();
  11640. swipeTo(+startPosition, {
  11641. immediate: true
  11642. });
  11643. });
  11644. } else {
  11645. emit("close", {
  11646. index: state.active,
  11647. url: images[state.active]
  11648. });
  11649. }
  11650. });
  11651. return () => vue.createVNode(Popup, vue.mergeProps({
  11652. "class": [bem$D(), props2.className],
  11653. "overlayClass": [bem$D("overlay"), props2.overlayClass],
  11654. "onClosed": onClosed,
  11655. "onUpdate:show": updateShow
  11656. }, pick(props2, popupProps$1)), {
  11657. default: () => [renderClose(), renderImages(), renderIndex(), renderCover()]
  11658. });
  11659. }
  11660. });
  11661. let instance$1;
  11662. const defaultConfig = {
  11663. loop: true,
  11664. images: [],
  11665. maxZoom: 3,
  11666. minZoom: 1 / 3,
  11667. onScale: void 0,
  11668. onClose: void 0,
  11669. onChange: void 0,
  11670. vertical: false,
  11671. teleport: "body",
  11672. className: "",
  11673. showIndex: true,
  11674. closeable: false,
  11675. closeIcon: "clear",
  11676. transition: void 0,
  11677. beforeClose: void 0,
  11678. doubleScale: true,
  11679. overlayStyle: void 0,
  11680. overlayClass: void 0,
  11681. startPosition: 0,
  11682. swipeDuration: 300,
  11683. showIndicators: false,
  11684. closeOnPopstate: true,
  11685. closeOnClickOverlay: true,
  11686. closeIconPosition: "top-right"
  11687. };
  11688. function initInstance$1() {
  11689. ({
  11690. instance: instance$1
  11691. } = mountComponent({
  11692. setup() {
  11693. const {
  11694. state,
  11695. toggle
  11696. } = usePopupState();
  11697. const onClosed = () => {
  11698. state.images = [];
  11699. };
  11700. return () => vue.createVNode(stdin_default$M, vue.mergeProps(state, {
  11701. "onClosed": onClosed,
  11702. "onUpdate:show": toggle
  11703. }), null);
  11704. }
  11705. }));
  11706. }
  11707. const showImagePreview = (options, startPosition = 0) => {
  11708. if (!inBrowser$1) {
  11709. return;
  11710. }
  11711. if (!instance$1) {
  11712. initInstance$1();
  11713. }
  11714. options = Array.isArray(options) ? {
  11715. images: options,
  11716. startPosition
  11717. } : options;
  11718. instance$1.open(extend({}, defaultConfig, options));
  11719. return instance$1;
  11720. };
  11721. const ImagePreview = withInstall(stdin_default$M);
  11722. function genAlphabet() {
  11723. const charCodeOfA = "A".charCodeAt(0);
  11724. const indexList = Array(26).fill("").map((_, i) => String.fromCharCode(charCodeOfA + i));
  11725. return indexList;
  11726. }
  11727. const [name$D, bem$C] = createNamespace("index-bar");
  11728. const indexBarProps = {
  11729. sticky: truthProp,
  11730. zIndex: numericProp,
  11731. teleport: [String, Object],
  11732. highlightColor: String,
  11733. stickyOffsetTop: makeNumberProp(0),
  11734. indexList: {
  11735. type: Array,
  11736. default: genAlphabet
  11737. }
  11738. };
  11739. const INDEX_BAR_KEY = Symbol(name$D);
  11740. var stdin_default$L = vue.defineComponent({
  11741. name: name$D,
  11742. props: indexBarProps,
  11743. emits: ["select", "change"],
  11744. setup(props2, {
  11745. emit,
  11746. slots
  11747. }) {
  11748. const root = vue.ref();
  11749. const sidebar = vue.ref();
  11750. const activeAnchor = vue.ref("");
  11751. const touch = useTouch();
  11752. const scrollParent = useScrollParent(root);
  11753. const {
  11754. children,
  11755. linkChildren
  11756. } = useChildren(INDEX_BAR_KEY);
  11757. let selectActiveIndex;
  11758. linkChildren({
  11759. props: props2
  11760. });
  11761. const sidebarStyle = vue.computed(() => {
  11762. if (isDef(props2.zIndex)) {
  11763. return {
  11764. zIndex: +props2.zIndex + 1
  11765. };
  11766. }
  11767. });
  11768. const highlightStyle = vue.computed(() => {
  11769. if (props2.highlightColor) {
  11770. return {
  11771. color: props2.highlightColor
  11772. };
  11773. }
  11774. });
  11775. const getActiveAnchor = (scrollTop, rects) => {
  11776. for (let i = children.length - 1; i >= 0; i--) {
  11777. const prevHeight = i > 0 ? rects[i - 1].height : 0;
  11778. const reachTop = props2.sticky ? prevHeight + props2.stickyOffsetTop : 0;
  11779. if (scrollTop + reachTop >= rects[i].top) {
  11780. return i;
  11781. }
  11782. }
  11783. return -1;
  11784. };
  11785. const getMatchAnchor = (index) => children.find((item) => String(item.index) === index);
  11786. const onScroll = () => {
  11787. if (isHidden(root)) {
  11788. return;
  11789. }
  11790. const {
  11791. sticky,
  11792. indexList
  11793. } = props2;
  11794. const scrollTop = getScrollTop(scrollParent.value);
  11795. const scrollParentRect = useRect(scrollParent);
  11796. const rects = children.map((item) => item.getRect(scrollParent.value, scrollParentRect));
  11797. let active = -1;
  11798. if (selectActiveIndex) {
  11799. const match = getMatchAnchor(selectActiveIndex);
  11800. if (match) {
  11801. const rect = match.getRect(scrollParent.value, scrollParentRect);
  11802. if (props2.sticky && props2.stickyOffsetTop) {
  11803. active = getActiveAnchor(rect.top - props2.stickyOffsetTop, rects);
  11804. } else {
  11805. active = getActiveAnchor(rect.top, rects);
  11806. }
  11807. }
  11808. } else {
  11809. active = getActiveAnchor(scrollTop, rects);
  11810. }
  11811. activeAnchor.value = indexList[active];
  11812. if (sticky) {
  11813. children.forEach((item, index) => {
  11814. const {
  11815. state,
  11816. $el
  11817. } = item;
  11818. if (index === active || index === active - 1) {
  11819. const rect = $el.getBoundingClientRect();
  11820. state.left = rect.left;
  11821. state.width = rect.width;
  11822. } else {
  11823. state.left = null;
  11824. state.width = null;
  11825. }
  11826. if (index === active) {
  11827. state.active = true;
  11828. state.top = Math.max(props2.stickyOffsetTop, rects[index].top - scrollTop) + scrollParentRect.top;
  11829. } else if (index === active - 1 && selectActiveIndex === "") {
  11830. const activeItemTop = rects[active].top - scrollTop;
  11831. state.active = activeItemTop > 0;
  11832. state.top = activeItemTop + scrollParentRect.top - rects[index].height;
  11833. } else {
  11834. state.active = false;
  11835. }
  11836. });
  11837. }
  11838. selectActiveIndex = "";
  11839. };
  11840. const init = () => {
  11841. vue.nextTick(onScroll);
  11842. };
  11843. useEventListener("scroll", onScroll, {
  11844. target: scrollParent,
  11845. passive: true
  11846. });
  11847. vue.onMounted(init);
  11848. vue.watch(() => props2.indexList, init);
  11849. vue.watch(activeAnchor, (value) => {
  11850. if (value) {
  11851. emit("change", value);
  11852. }
  11853. });
  11854. const renderIndexes = () => props2.indexList.map((index) => {
  11855. const active = index === activeAnchor.value;
  11856. return vue.createVNode("span", {
  11857. "class": bem$C("index", {
  11858. active
  11859. }),
  11860. "style": active ? highlightStyle.value : void 0,
  11861. "data-index": index
  11862. }, [index]);
  11863. });
  11864. const scrollTo = (index) => {
  11865. selectActiveIndex = String(index);
  11866. const match = getMatchAnchor(selectActiveIndex);
  11867. if (match) {
  11868. const scrollTop = getScrollTop(scrollParent.value);
  11869. const scrollParentRect = useRect(scrollParent);
  11870. const {
  11871. offsetHeight
  11872. } = document.documentElement;
  11873. match.$el.scrollIntoView();
  11874. if (scrollTop === offsetHeight - scrollParentRect.height) {
  11875. onScroll();
  11876. return;
  11877. }
  11878. if (props2.sticky && props2.stickyOffsetTop) {
  11879. if (getRootScrollTop() === offsetHeight - scrollParentRect.height) {
  11880. setRootScrollTop(getRootScrollTop());
  11881. } else {
  11882. setRootScrollTop(getRootScrollTop() - props2.stickyOffsetTop);
  11883. }
  11884. }
  11885. emit("select", match.index);
  11886. }
  11887. };
  11888. const scrollToElement = (element) => {
  11889. const {
  11890. index
  11891. } = element.dataset;
  11892. if (index) {
  11893. scrollTo(index);
  11894. }
  11895. };
  11896. const onClickSidebar = (event) => {
  11897. scrollToElement(event.target);
  11898. };
  11899. let touchActiveIndex;
  11900. const onTouchMove = (event) => {
  11901. touch.move(event);
  11902. if (touch.isVertical()) {
  11903. preventDefault(event);
  11904. const {
  11905. clientX,
  11906. clientY
  11907. } = event.touches[0];
  11908. const target = document.elementFromPoint(clientX, clientY);
  11909. if (target) {
  11910. const {
  11911. index
  11912. } = target.dataset;
  11913. if (index && touchActiveIndex !== index) {
  11914. touchActiveIndex = index;
  11915. scrollToElement(target);
  11916. }
  11917. }
  11918. }
  11919. };
  11920. const renderSidebar = () => vue.createVNode("div", {
  11921. "ref": sidebar,
  11922. "class": bem$C("sidebar"),
  11923. "style": sidebarStyle.value,
  11924. "onClick": onClickSidebar,
  11925. "onTouchstartPassive": touch.start
  11926. }, [renderIndexes()]);
  11927. useExpose({
  11928. scrollTo
  11929. });
  11930. useEventListener("touchmove", onTouchMove, {
  11931. target: sidebar
  11932. });
  11933. return () => {
  11934. var _a;
  11935. return vue.createVNode("div", {
  11936. "ref": root,
  11937. "class": bem$C()
  11938. }, [props2.teleport ? vue.createVNode(vue.Teleport, {
  11939. "to": props2.teleport
  11940. }, {
  11941. default: () => [renderSidebar()]
  11942. }) : renderSidebar(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
  11943. };
  11944. }
  11945. });
  11946. const [name$C, bem$B] = createNamespace("index-anchor");
  11947. const indexAnchorProps = {
  11948. index: numericProp
  11949. };
  11950. var stdin_default$K = vue.defineComponent({
  11951. name: name$C,
  11952. props: indexAnchorProps,
  11953. setup(props2, {
  11954. slots
  11955. }) {
  11956. const state = vue.reactive({
  11957. top: 0,
  11958. left: null,
  11959. rect: {
  11960. top: 0,
  11961. height: 0
  11962. },
  11963. width: null,
  11964. active: false
  11965. });
  11966. const root = vue.ref();
  11967. const {
  11968. parent
  11969. } = useParent(INDEX_BAR_KEY);
  11970. if (!parent) {
  11971. return;
  11972. }
  11973. const isSticky = () => state.active && parent.props.sticky;
  11974. const anchorStyle = vue.computed(() => {
  11975. const {
  11976. zIndex,
  11977. highlightColor
  11978. } = parent.props;
  11979. if (isSticky()) {
  11980. return extend(getZIndexStyle(zIndex), {
  11981. left: state.left ? `${state.left}px` : void 0,
  11982. width: state.width ? `${state.width}px` : void 0,
  11983. transform: state.top ? `translate3d(0, ${state.top}px, 0)` : void 0,
  11984. color: highlightColor
  11985. });
  11986. }
  11987. });
  11988. const getRect = (scrollParent, scrollParentRect) => {
  11989. const rootRect = useRect(root);
  11990. state.rect.height = rootRect.height;
  11991. if (scrollParent === window || scrollParent === document.body) {
  11992. state.rect.top = rootRect.top + getRootScrollTop();
  11993. } else {
  11994. state.rect.top = rootRect.top + getScrollTop(scrollParent) - scrollParentRect.top;
  11995. }
  11996. return state.rect;
  11997. };
  11998. useExpose({
  11999. state,
  12000. getRect
  12001. });
  12002. return () => {
  12003. const sticky = isSticky();
  12004. return vue.createVNode("div", {
  12005. "ref": root,
  12006. "style": {
  12007. height: sticky ? `${state.rect.height}px` : void 0
  12008. }
  12009. }, [vue.createVNode("div", {
  12010. "style": anchorStyle.value,
  12011. "class": [bem$B({
  12012. sticky
  12013. }), {
  12014. [BORDER_BOTTOM]: sticky
  12015. }]
  12016. }, [slots.default ? slots.default() : props2.index])]);
  12017. };
  12018. }
  12019. });
  12020. const IndexAnchor = withInstall(stdin_default$K);
  12021. const IndexBar = withInstall(stdin_default$L);
  12022. const [name$B, bem$A, t$7] = createNamespace("list");
  12023. const listProps = {
  12024. error: Boolean,
  12025. offset: makeNumericProp(300),
  12026. loading: Boolean,
  12027. disabled: Boolean,
  12028. finished: Boolean,
  12029. scroller: Object,
  12030. errorText: String,
  12031. direction: makeStringProp("down"),
  12032. loadingText: String,
  12033. finishedText: String,
  12034. immediateCheck: truthProp
  12035. };
  12036. var stdin_default$J = vue.defineComponent({
  12037. name: name$B,
  12038. props: listProps,
  12039. emits: ["load", "update:error", "update:loading"],
  12040. setup(props2, {
  12041. emit,
  12042. slots
  12043. }) {
  12044. const loading = vue.ref(props2.loading);
  12045. const root = vue.ref();
  12046. const placeholder = vue.ref();
  12047. const tabStatus = useTabStatus();
  12048. const scrollParent = useScrollParent(root);
  12049. const scroller = vue.computed(() => props2.scroller || scrollParent.value);
  12050. const check = () => {
  12051. vue.nextTick(() => {
  12052. if (loading.value || props2.finished || props2.disabled || props2.error || // skip check when inside an inactive tab
  12053. (tabStatus == null ? void 0 : tabStatus.value) === false) {
  12054. return;
  12055. }
  12056. const {
  12057. direction
  12058. } = props2;
  12059. const offset2 = +props2.offset;
  12060. const scrollParentRect = useRect(scroller);
  12061. if (!scrollParentRect.height || isHidden(root)) {
  12062. return;
  12063. }
  12064. let isReachEdge = false;
  12065. const placeholderRect = useRect(placeholder);
  12066. if (direction === "up") {
  12067. isReachEdge = scrollParentRect.top - placeholderRect.top <= offset2;
  12068. } else {
  12069. isReachEdge = placeholderRect.bottom - scrollParentRect.bottom <= offset2;
  12070. }
  12071. if (isReachEdge) {
  12072. loading.value = true;
  12073. emit("update:loading", true);
  12074. emit("load");
  12075. }
  12076. });
  12077. };
  12078. const renderFinishedText = () => {
  12079. if (props2.finished) {
  12080. const text = slots.finished ? slots.finished() : props2.finishedText;
  12081. if (text) {
  12082. return vue.createVNode("div", {
  12083. "class": bem$A("finished-text")
  12084. }, [text]);
  12085. }
  12086. }
  12087. };
  12088. const clickErrorText = () => {
  12089. emit("update:error", false);
  12090. check();
  12091. };
  12092. const renderErrorText = () => {
  12093. if (props2.error) {
  12094. const text = slots.error ? slots.error() : props2.errorText;
  12095. if (text) {
  12096. return vue.createVNode("div", {
  12097. "role": "button",
  12098. "class": bem$A("error-text"),
  12099. "tabindex": 0,
  12100. "onClick": clickErrorText
  12101. }, [text]);
  12102. }
  12103. }
  12104. };
  12105. const renderLoading = () => {
  12106. if (loading.value && !props2.finished && !props2.disabled) {
  12107. return vue.createVNode("div", {
  12108. "class": bem$A("loading")
  12109. }, [slots.loading ? slots.loading() : vue.createVNode(Loading, {
  12110. "class": bem$A("loading-icon")
  12111. }, {
  12112. default: () => [props2.loadingText || t$7("loading")]
  12113. })]);
  12114. }
  12115. };
  12116. vue.watch(() => [props2.loading, props2.finished, props2.error], check);
  12117. if (tabStatus) {
  12118. vue.watch(tabStatus, (tabActive) => {
  12119. if (tabActive) {
  12120. check();
  12121. }
  12122. });
  12123. }
  12124. vue.onUpdated(() => {
  12125. loading.value = props2.loading;
  12126. });
  12127. vue.onMounted(() => {
  12128. if (props2.immediateCheck) {
  12129. check();
  12130. }
  12131. });
  12132. useExpose({
  12133. check
  12134. });
  12135. useEventListener("scroll", check, {
  12136. target: scroller,
  12137. passive: true
  12138. });
  12139. return () => {
  12140. var _a;
  12141. const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
  12142. const Placeholder = vue.createVNode("div", {
  12143. "ref": placeholder,
  12144. "class": bem$A("placeholder")
  12145. }, null);
  12146. return vue.createVNode("div", {
  12147. "ref": root,
  12148. "role": "feed",
  12149. "class": bem$A(),
  12150. "aria-busy": loading.value
  12151. }, [props2.direction === "down" ? Content : Placeholder, renderLoading(), renderFinishedText(), renderErrorText(), props2.direction === "up" ? Content : Placeholder]);
  12152. };
  12153. }
  12154. });
  12155. const List = withInstall(stdin_default$J);
  12156. const [name$A, bem$z] = createNamespace("nav-bar");
  12157. const navBarProps = {
  12158. title: String,
  12159. fixed: Boolean,
  12160. zIndex: numericProp,
  12161. border: truthProp,
  12162. leftText: String,
  12163. rightText: String,
  12164. leftDisabled: Boolean,
  12165. rightDisabled: Boolean,
  12166. leftArrow: Boolean,
  12167. placeholder: Boolean,
  12168. safeAreaInsetTop: Boolean,
  12169. clickable: truthProp
  12170. };
  12171. var stdin_default$I = vue.defineComponent({
  12172. name: name$A,
  12173. props: navBarProps,
  12174. emits: ["clickLeft", "clickRight"],
  12175. setup(props2, {
  12176. emit,
  12177. slots
  12178. }) {
  12179. const navBarRef = vue.ref();
  12180. const renderPlaceholder = usePlaceholder(navBarRef, bem$z);
  12181. const onClickLeft = (event) => {
  12182. if (!props2.leftDisabled) {
  12183. emit("clickLeft", event);
  12184. }
  12185. };
  12186. const onClickRight = (event) => {
  12187. if (!props2.rightDisabled) {
  12188. emit("clickRight", event);
  12189. }
  12190. };
  12191. const renderLeft = () => {
  12192. if (slots.left) {
  12193. return slots.left();
  12194. }
  12195. return [props2.leftArrow && vue.createVNode(Icon, {
  12196. "class": bem$z("arrow"),
  12197. "name": "arrow-left"
  12198. }, null), props2.leftText && vue.createVNode("span", {
  12199. "class": bem$z("text")
  12200. }, [props2.leftText])];
  12201. };
  12202. const renderRight = () => {
  12203. if (slots.right) {
  12204. return slots.right();
  12205. }
  12206. return vue.createVNode("span", {
  12207. "class": bem$z("text")
  12208. }, [props2.rightText]);
  12209. };
  12210. const renderNavBar = () => {
  12211. const {
  12212. title,
  12213. fixed,
  12214. border,
  12215. zIndex
  12216. } = props2;
  12217. const style = getZIndexStyle(zIndex);
  12218. const hasLeft = props2.leftArrow || props2.leftText || slots.left;
  12219. const hasRight = props2.rightText || slots.right;
  12220. return vue.createVNode("div", {
  12221. "ref": navBarRef,
  12222. "style": style,
  12223. "class": [bem$z({
  12224. fixed
  12225. }), {
  12226. [BORDER_BOTTOM]: border,
  12227. "van-safe-area-top": props2.safeAreaInsetTop
  12228. }]
  12229. }, [vue.createVNode("div", {
  12230. "class": bem$z("content")
  12231. }, [hasLeft && vue.createVNode("div", {
  12232. "class": [bem$z("left", {
  12233. disabled: props2.leftDisabled
  12234. }), props2.clickable && !props2.leftDisabled ? HAPTICS_FEEDBACK : ""],
  12235. "onClick": onClickLeft
  12236. }, [renderLeft()]), vue.createVNode("div", {
  12237. "class": [bem$z("title"), "van-ellipsis"]
  12238. }, [slots.title ? slots.title() : title]), hasRight && vue.createVNode("div", {
  12239. "class": [bem$z("right", {
  12240. disabled: props2.rightDisabled
  12241. }), props2.clickable && !props2.rightDisabled ? HAPTICS_FEEDBACK : ""],
  12242. "onClick": onClickRight
  12243. }, [renderRight()])])]);
  12244. };
  12245. return () => {
  12246. if (props2.fixed && props2.placeholder) {
  12247. return renderPlaceholder(renderNavBar);
  12248. }
  12249. return renderNavBar();
  12250. };
  12251. }
  12252. });
  12253. const NavBar = withInstall(stdin_default$I);
  12254. const [name$z, bem$y] = createNamespace("notice-bar");
  12255. const noticeBarProps = {
  12256. text: String,
  12257. mode: String,
  12258. color: String,
  12259. delay: makeNumericProp(1),
  12260. speed: makeNumericProp(60),
  12261. leftIcon: String,
  12262. wrapable: Boolean,
  12263. background: String,
  12264. scrollable: {
  12265. type: Boolean,
  12266. default: null
  12267. }
  12268. };
  12269. var stdin_default$H = vue.defineComponent({
  12270. name: name$z,
  12271. props: noticeBarProps,
  12272. emits: ["close", "replay"],
  12273. setup(props2, {
  12274. emit,
  12275. slots
  12276. }) {
  12277. let wrapWidth = 0;
  12278. let contentWidth = 0;
  12279. let startTimer;
  12280. const wrapRef = vue.ref();
  12281. const contentRef = vue.ref();
  12282. const state = vue.reactive({
  12283. show: true,
  12284. offset: 0,
  12285. duration: 0
  12286. });
  12287. const renderLeftIcon = () => {
  12288. if (slots["left-icon"]) {
  12289. return slots["left-icon"]();
  12290. }
  12291. if (props2.leftIcon) {
  12292. return vue.createVNode(Icon, {
  12293. "class": bem$y("left-icon"),
  12294. "name": props2.leftIcon
  12295. }, null);
  12296. }
  12297. };
  12298. const getRightIconName = () => {
  12299. if (props2.mode === "closeable") {
  12300. return "cross";
  12301. }
  12302. if (props2.mode === "link") {
  12303. return "arrow";
  12304. }
  12305. };
  12306. const onClickRightIcon = (event) => {
  12307. if (props2.mode === "closeable") {
  12308. state.show = false;
  12309. emit("close", event);
  12310. }
  12311. };
  12312. const renderRightIcon = () => {
  12313. if (slots["right-icon"]) {
  12314. return slots["right-icon"]();
  12315. }
  12316. const name2 = getRightIconName();
  12317. if (name2) {
  12318. return vue.createVNode(Icon, {
  12319. "name": name2,
  12320. "class": bem$y("right-icon"),
  12321. "onClick": onClickRightIcon
  12322. }, null);
  12323. }
  12324. };
  12325. const onTransitionEnd = () => {
  12326. state.offset = wrapWidth;
  12327. state.duration = 0;
  12328. raf(() => {
  12329. doubleRaf(() => {
  12330. state.offset = -contentWidth;
  12331. state.duration = (contentWidth + wrapWidth) / +props2.speed;
  12332. emit("replay");
  12333. });
  12334. });
  12335. };
  12336. const renderMarquee = () => {
  12337. const ellipsis = props2.scrollable === false && !props2.wrapable;
  12338. const style = {
  12339. transform: state.offset ? `translateX(${state.offset}px)` : "",
  12340. transitionDuration: `${state.duration}s`
  12341. };
  12342. return vue.createVNode("div", {
  12343. "ref": wrapRef,
  12344. "role": "marquee",
  12345. "class": bem$y("wrap")
  12346. }, [vue.createVNode("div", {
  12347. "ref": contentRef,
  12348. "style": style,
  12349. "class": [bem$y("content"), {
  12350. "van-ellipsis": ellipsis
  12351. }],
  12352. "onTransitionend": onTransitionEnd
  12353. }, [slots.default ? slots.default() : props2.text])]);
  12354. };
  12355. const reset = () => {
  12356. const {
  12357. delay,
  12358. speed,
  12359. scrollable
  12360. } = props2;
  12361. const ms = isDef(delay) ? +delay * 1e3 : 0;
  12362. wrapWidth = 0;
  12363. contentWidth = 0;
  12364. state.offset = 0;
  12365. state.duration = 0;
  12366. clearTimeout(startTimer);
  12367. startTimer = setTimeout(() => {
  12368. if (!wrapRef.value || !contentRef.value || scrollable === false) {
  12369. return;
  12370. }
  12371. const wrapRefWidth = useRect(wrapRef).width;
  12372. const contentRefWidth = useRect(contentRef).width;
  12373. if (scrollable || contentRefWidth > wrapRefWidth) {
  12374. doubleRaf(() => {
  12375. wrapWidth = wrapRefWidth;
  12376. contentWidth = contentRefWidth;
  12377. state.offset = -contentWidth;
  12378. state.duration = contentWidth / +speed;
  12379. });
  12380. }
  12381. }, ms);
  12382. };
  12383. onPopupReopen(reset);
  12384. onMountedOrActivated(reset);
  12385. useEventListener("pageshow", reset);
  12386. useExpose({
  12387. reset
  12388. });
  12389. vue.watch(() => [props2.text, props2.scrollable], reset);
  12390. return () => {
  12391. const {
  12392. color,
  12393. wrapable,
  12394. background
  12395. } = props2;
  12396. return vue.withDirectives(vue.createVNode("div", {
  12397. "role": "alert",
  12398. "class": bem$y({
  12399. wrapable
  12400. }),
  12401. "style": {
  12402. color,
  12403. background
  12404. }
  12405. }, [renderLeftIcon(), renderMarquee(), renderRightIcon()]), [[vue.vShow, state.show]]);
  12406. };
  12407. }
  12408. });
  12409. const NoticeBar = withInstall(stdin_default$H);
  12410. const [name$y, bem$x] = createNamespace("notify");
  12411. const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
  12412. const notifyProps = extend({}, popupSharedProps, {
  12413. type: makeStringProp("danger"),
  12414. color: String,
  12415. message: numericProp,
  12416. position: makeStringProp("top"),
  12417. className: unknownProp,
  12418. background: String,
  12419. lockScroll: Boolean
  12420. });
  12421. var stdin_default$G = vue.defineComponent({
  12422. name: name$y,
  12423. props: notifyProps,
  12424. emits: ["update:show"],
  12425. setup(props2, {
  12426. emit,
  12427. slots
  12428. }) {
  12429. const updateShow = (show) => emit("update:show", show);
  12430. return () => vue.createVNode(Popup, vue.mergeProps({
  12431. "class": [bem$x([props2.type]), props2.className],
  12432. "style": {
  12433. color: props2.color,
  12434. background: props2.background
  12435. },
  12436. "overlay": false,
  12437. "duration": 0.2,
  12438. "onUpdate:show": updateShow
  12439. }, pick(props2, popupInheritProps)), {
  12440. default: () => [slots.default ? slots.default() : props2.message]
  12441. });
  12442. }
  12443. });
  12444. let timer;
  12445. let instance;
  12446. const parseOptions = (message) => isObject$1(message) ? message : {
  12447. message
  12448. };
  12449. function initInstance() {
  12450. ({
  12451. instance
  12452. } = mountComponent({
  12453. setup() {
  12454. const {
  12455. state,
  12456. toggle
  12457. } = usePopupState();
  12458. return () => vue.createVNode(stdin_default$G, vue.mergeProps(state, {
  12459. "onUpdate:show": toggle
  12460. }), null);
  12461. }
  12462. }));
  12463. }
  12464. const getDefaultOptions = () => ({
  12465. type: "danger",
  12466. color: void 0,
  12467. message: "",
  12468. onClose: void 0,
  12469. onClick: void 0,
  12470. onOpened: void 0,
  12471. duration: 3e3,
  12472. position: void 0,
  12473. className: "",
  12474. lockScroll: false,
  12475. background: void 0
  12476. });
  12477. let currentOptions = getDefaultOptions();
  12478. const closeNotify = () => {
  12479. if (instance) {
  12480. instance.toggle(false);
  12481. }
  12482. };
  12483. function showNotify(options) {
  12484. if (!inBrowser$1) {
  12485. return;
  12486. }
  12487. if (!instance) {
  12488. initInstance();
  12489. }
  12490. options = extend({}, currentOptions, parseOptions(options));
  12491. instance.open(options);
  12492. clearTimeout(timer);
  12493. if (options.duration > 0) {
  12494. timer = setTimeout(closeNotify, options.duration);
  12495. }
  12496. return instance;
  12497. }
  12498. const setNotifyDefaultOptions = (options) => extend(currentOptions, options);
  12499. const resetNotifyDefaultOptions = () => {
  12500. currentOptions = getDefaultOptions();
  12501. };
  12502. const Notify = withInstall(stdin_default$G);
  12503. const [name$x, bem$w] = createNamespace("key");
  12504. const CollapseIcon = vue.createVNode("svg", {
  12505. "class": bem$w("collapse-icon"),
  12506. "viewBox": "0 0 30 24"
  12507. }, [vue.createVNode("path", {
  12508. "d": "M26 13h-2v2h2v-2zm-8-3h2V8h-2v2zm2-4h2V4h-2v2zm2 4h4V4h-2v4h-2v2zm-7 14 3-3h-6l3 3zM6 13H4v2h2v-2zm16 0H8v2h14v-2zm-12-3h2V8h-2v2zM28 0l1 1 1 1v15l-1 2H1l-1-2V2l1-1 1-1zm0 2H2v15h26V2zM6 4v2H4V4zm10 2h2V4h-2v2zM8 9v1H4V8zm8 0v1h-2V8zm-6-5v2H8V4zm4 0v2h-2V4z",
  12509. "fill": "currentColor"
  12510. }, null)]);
  12511. const DeleteIcon = vue.createVNode("svg", {
  12512. "class": bem$w("delete-icon"),
  12513. "viewBox": "0 0 32 22"
  12514. }, [vue.createVNode("path", {
  12515. "d": "M28 0a4 4 0 0 1 4 4v14a4 4 0 0 1-4 4H10.4a2 2 0 0 1-1.4-.6L1 13.1c-.6-.5-.9-1.3-.9-2 0-1 .3-1.7.9-2.2L9 .6a2 2 0 0 1 1.4-.6zm0 2H10.4l-8.2 8.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7l8.2 8.4H28a2 2 0 0 0 2-2V4c0-1.1-.9-2-2-2zm-5 4a1 1 0 0 1 .7.3 1 1 0 0 1 0 1.4L20.4 11l3.3 3.3c.2.2.3.5.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3L19 12.4l-3.4 3.3a1 1 0 0 1-.6.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.2.1-.5.3-.7l3.3-3.3-3.3-3.3A1 1 0 0 1 14 7c0-.3.1-.5.3-.7A1 1 0 0 1 15 6a1 1 0 0 1 .6.3L19 9.6l3.3-3.3A1 1 0 0 1 23 6z",
  12516. "fill": "currentColor"
  12517. }, null)]);
  12518. var stdin_default$F = vue.defineComponent({
  12519. name: name$x,
  12520. props: {
  12521. type: String,
  12522. text: numericProp,
  12523. color: String,
  12524. wider: Boolean,
  12525. large: Boolean,
  12526. loading: Boolean
  12527. },
  12528. emits: ["press"],
  12529. setup(props2, {
  12530. emit,
  12531. slots
  12532. }) {
  12533. const active = vue.ref(false);
  12534. const touch = useTouch();
  12535. const onTouchStart = (event) => {
  12536. touch.start(event);
  12537. active.value = true;
  12538. };
  12539. const onTouchMove = (event) => {
  12540. touch.move(event);
  12541. if (touch.direction.value) {
  12542. active.value = false;
  12543. }
  12544. };
  12545. const onTouchEnd = (event) => {
  12546. if (active.value) {
  12547. if (!slots.default) {
  12548. preventDefault(event);
  12549. }
  12550. active.value = false;
  12551. emit("press", props2.text, props2.type);
  12552. }
  12553. };
  12554. const renderContent = () => {
  12555. if (props2.loading) {
  12556. return vue.createVNode(Loading, {
  12557. "class": bem$w("loading-icon")
  12558. }, null);
  12559. }
  12560. const text = slots.default ? slots.default() : props2.text;
  12561. switch (props2.type) {
  12562. case "delete":
  12563. return text || DeleteIcon;
  12564. case "extra":
  12565. return text || CollapseIcon;
  12566. default:
  12567. return text;
  12568. }
  12569. };
  12570. return () => vue.createVNode("div", {
  12571. "class": bem$w("wrapper", {
  12572. wider: props2.wider
  12573. }),
  12574. "onTouchstartPassive": onTouchStart,
  12575. "onTouchmovePassive": onTouchMove,
  12576. "onTouchend": onTouchEnd,
  12577. "onTouchcancel": onTouchEnd
  12578. }, [vue.createVNode("div", {
  12579. "role": "button",
  12580. "tabindex": 0,
  12581. "class": bem$w([props2.color, {
  12582. large: props2.large,
  12583. active: active.value,
  12584. delete: props2.type === "delete"
  12585. }])
  12586. }, [renderContent()])]);
  12587. }
  12588. });
  12589. const [name$w, bem$v] = createNamespace("number-keyboard");
  12590. const numberKeyboardProps = {
  12591. show: Boolean,
  12592. title: String,
  12593. theme: makeStringProp("default"),
  12594. zIndex: numericProp,
  12595. teleport: [String, Object],
  12596. maxlength: makeNumericProp(Infinity),
  12597. modelValue: makeStringProp(""),
  12598. transition: truthProp,
  12599. blurOnClose: truthProp,
  12600. showDeleteKey: truthProp,
  12601. randomKeyOrder: Boolean,
  12602. closeButtonText: String,
  12603. deleteButtonText: String,
  12604. closeButtonLoading: Boolean,
  12605. hideOnClickOutside: truthProp,
  12606. safeAreaInsetBottom: truthProp,
  12607. extraKey: {
  12608. type: [String, Array],
  12609. default: ""
  12610. }
  12611. };
  12612. function shuffle(array) {
  12613. for (let i = array.length - 1; i > 0; i--) {
  12614. const j = Math.floor(Math.random() * (i + 1));
  12615. const temp = array[i];
  12616. array[i] = array[j];
  12617. array[j] = temp;
  12618. }
  12619. return array;
  12620. }
  12621. var stdin_default$E = vue.defineComponent({
  12622. name: name$w,
  12623. inheritAttrs: false,
  12624. props: numberKeyboardProps,
  12625. emits: ["show", "hide", "blur", "input", "close", "delete", "update:modelValue"],
  12626. setup(props2, {
  12627. emit,
  12628. slots,
  12629. attrs
  12630. }) {
  12631. const root = vue.ref();
  12632. const genBasicKeys = () => {
  12633. const keys2 = Array(9).fill("").map((_, i) => ({
  12634. text: i + 1
  12635. }));
  12636. if (props2.randomKeyOrder) {
  12637. shuffle(keys2);
  12638. }
  12639. return keys2;
  12640. };
  12641. const genDefaultKeys = () => [...genBasicKeys(), {
  12642. text: props2.extraKey,
  12643. type: "extra"
  12644. }, {
  12645. text: 0
  12646. }, {
  12647. text: props2.showDeleteKey ? props2.deleteButtonText : "",
  12648. type: props2.showDeleteKey ? "delete" : ""
  12649. }];
  12650. const genCustomKeys = () => {
  12651. const keys2 = genBasicKeys();
  12652. const {
  12653. extraKey
  12654. } = props2;
  12655. const extraKeys = Array.isArray(extraKey) ? extraKey : [extraKey];
  12656. if (extraKeys.length === 0) {
  12657. keys2.push({
  12658. text: 0,
  12659. wider: true
  12660. });
  12661. } else if (extraKeys.length === 1) {
  12662. keys2.push({
  12663. text: 0,
  12664. wider: true
  12665. }, {
  12666. text: extraKeys[0],
  12667. type: "extra"
  12668. });
  12669. } else if (extraKeys.length === 2) {
  12670. keys2.push({
  12671. text: extraKeys[0],
  12672. type: "extra"
  12673. }, {
  12674. text: 0
  12675. }, {
  12676. text: extraKeys[1],
  12677. type: "extra"
  12678. });
  12679. }
  12680. return keys2;
  12681. };
  12682. const keys = vue.computed(() => props2.theme === "custom" ? genCustomKeys() : genDefaultKeys());
  12683. const onBlur = () => {
  12684. if (props2.show) {
  12685. emit("blur");
  12686. }
  12687. };
  12688. const onClose = () => {
  12689. emit("close");
  12690. if (props2.blurOnClose) {
  12691. onBlur();
  12692. }
  12693. };
  12694. const onAnimationEnd = () => emit(props2.show ? "show" : "hide");
  12695. const onPress = (text, type) => {
  12696. if (text === "") {
  12697. if (type === "extra") {
  12698. onBlur();
  12699. }
  12700. return;
  12701. }
  12702. const value = props2.modelValue;
  12703. if (type === "delete") {
  12704. emit("delete");
  12705. emit("update:modelValue", value.slice(0, value.length - 1));
  12706. } else if (type === "close") {
  12707. onClose();
  12708. } else if (value.length < +props2.maxlength) {
  12709. emit("input", text);
  12710. emit("update:modelValue", value + text);
  12711. }
  12712. };
  12713. const renderTitle = () => {
  12714. const {
  12715. title,
  12716. theme,
  12717. closeButtonText
  12718. } = props2;
  12719. const leftSlot = slots["title-left"];
  12720. const showClose = closeButtonText && theme === "default";
  12721. const showTitle = title || showClose || leftSlot;
  12722. if (!showTitle) {
  12723. return;
  12724. }
  12725. return vue.createVNode("div", {
  12726. "class": bem$v("header")
  12727. }, [leftSlot && vue.createVNode("span", {
  12728. "class": bem$v("title-left")
  12729. }, [leftSlot()]), title && vue.createVNode("h2", {
  12730. "class": bem$v("title")
  12731. }, [title]), showClose && vue.createVNode("button", {
  12732. "type": "button",
  12733. "class": [bem$v("close"), HAPTICS_FEEDBACK],
  12734. "onClick": onClose
  12735. }, [closeButtonText])]);
  12736. };
  12737. const renderKeys = () => keys.value.map((key) => {
  12738. const keySlots = {};
  12739. if (key.type === "delete") {
  12740. keySlots.default = slots.delete;
  12741. }
  12742. if (key.type === "extra") {
  12743. keySlots.default = slots["extra-key"];
  12744. }
  12745. return vue.createVNode(stdin_default$F, {
  12746. "key": key.text,
  12747. "text": key.text,
  12748. "type": key.type,
  12749. "wider": key.wider,
  12750. "color": key.color,
  12751. "onPress": onPress
  12752. }, keySlots);
  12753. });
  12754. const renderSidebar = () => {
  12755. if (props2.theme === "custom") {
  12756. return vue.createVNode("div", {
  12757. "class": bem$v("sidebar")
  12758. }, [props2.showDeleteKey && vue.createVNode(stdin_default$F, {
  12759. "large": true,
  12760. "text": props2.deleteButtonText,
  12761. "type": "delete",
  12762. "onPress": onPress
  12763. }, {
  12764. default: slots.delete
  12765. }), vue.createVNode(stdin_default$F, {
  12766. "large": true,
  12767. "text": props2.closeButtonText,
  12768. "type": "close",
  12769. "color": "blue",
  12770. "loading": props2.closeButtonLoading,
  12771. "onPress": onPress
  12772. }, null)]);
  12773. }
  12774. };
  12775. vue.watch(() => props2.show, (value) => {
  12776. if (!props2.transition) {
  12777. emit(value ? "show" : "hide");
  12778. }
  12779. });
  12780. if (props2.hideOnClickOutside) {
  12781. useClickAway(root, onBlur, {
  12782. eventName: "touchstart"
  12783. });
  12784. }
  12785. return () => {
  12786. const Title = renderTitle();
  12787. const Content = vue.createVNode(vue.Transition, {
  12788. "name": props2.transition ? "van-slide-up" : ""
  12789. }, {
  12790. default: () => [vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  12791. "ref": root,
  12792. "style": getZIndexStyle(props2.zIndex),
  12793. "class": bem$v({
  12794. unfit: !props2.safeAreaInsetBottom,
  12795. "with-title": !!Title
  12796. }),
  12797. "onAnimationend": onAnimationEnd,
  12798. "onTouchstartPassive": stopPropagation
  12799. }, attrs), [Title, vue.createVNode("div", {
  12800. "class": bem$v("body")
  12801. }, [vue.createVNode("div", {
  12802. "class": bem$v("keys")
  12803. }, [renderKeys()]), renderSidebar()])]), [[vue.vShow, props2.show]])]
  12804. });
  12805. if (props2.teleport) {
  12806. return vue.createVNode(vue.Teleport, {
  12807. "to": props2.teleport
  12808. }, {
  12809. default: () => [Content]
  12810. });
  12811. }
  12812. return Content;
  12813. };
  12814. }
  12815. });
  12816. const NumberKeyboard = withInstall(stdin_default$E);
  12817. const [name$v, bem$u, t$6] = createNamespace("pagination");
  12818. const makePage = (number, text, active) => ({
  12819. number,
  12820. text,
  12821. active
  12822. });
  12823. const paginationProps = {
  12824. mode: makeStringProp("multi"),
  12825. prevText: String,
  12826. nextText: String,
  12827. pageCount: makeNumericProp(0),
  12828. modelValue: makeNumberProp(0),
  12829. totalItems: makeNumericProp(0),
  12830. showPageSize: makeNumericProp(5),
  12831. itemsPerPage: makeNumericProp(10),
  12832. forceEllipses: Boolean,
  12833. showPrevButton: truthProp,
  12834. showNextButton: truthProp
  12835. };
  12836. var stdin_default$D = vue.defineComponent({
  12837. name: name$v,
  12838. props: paginationProps,
  12839. emits: ["change", "update:modelValue"],
  12840. setup(props2, {
  12841. emit,
  12842. slots
  12843. }) {
  12844. const count = vue.computed(() => {
  12845. const {
  12846. pageCount,
  12847. totalItems,
  12848. itemsPerPage
  12849. } = props2;
  12850. const count2 = +pageCount || Math.ceil(+totalItems / +itemsPerPage);
  12851. return Math.max(1, count2);
  12852. });
  12853. const pages = vue.computed(() => {
  12854. const items = [];
  12855. const pageCount = count.value;
  12856. const showPageSize = +props2.showPageSize;
  12857. const {
  12858. modelValue,
  12859. forceEllipses
  12860. } = props2;
  12861. let startPage = 1;
  12862. let endPage = pageCount;
  12863. const isMaxSized = showPageSize < pageCount;
  12864. if (isMaxSized) {
  12865. startPage = Math.max(modelValue - Math.floor(showPageSize / 2), 1);
  12866. endPage = startPage + showPageSize - 1;
  12867. if (endPage > pageCount) {
  12868. endPage = pageCount;
  12869. startPage = endPage - showPageSize + 1;
  12870. }
  12871. }
  12872. for (let number = startPage; number <= endPage; number++) {
  12873. const page = makePage(number, number, number === modelValue);
  12874. items.push(page);
  12875. }
  12876. if (isMaxSized && showPageSize > 0 && forceEllipses) {
  12877. if (startPage > 1) {
  12878. const prevPages = makePage(startPage - 1, "...");
  12879. items.unshift(prevPages);
  12880. }
  12881. if (endPage < pageCount) {
  12882. const nextPages = makePage(endPage + 1, "...");
  12883. items.push(nextPages);
  12884. }
  12885. }
  12886. return items;
  12887. });
  12888. const updateModelValue = (value, emitChange) => {
  12889. value = clamp(value, 1, count.value);
  12890. if (props2.modelValue !== value) {
  12891. emit("update:modelValue", value);
  12892. if (emitChange) {
  12893. emit("change", value);
  12894. }
  12895. }
  12896. };
  12897. vue.watchEffect(() => updateModelValue(props2.modelValue));
  12898. const renderDesc = () => vue.createVNode("li", {
  12899. "class": bem$u("page-desc")
  12900. }, [slots.pageDesc ? slots.pageDesc() : `${props2.modelValue}/${count.value}`]);
  12901. const renderPrevButton = () => {
  12902. const {
  12903. mode,
  12904. modelValue,
  12905. showPrevButton
  12906. } = props2;
  12907. if (!showPrevButton) {
  12908. return;
  12909. }
  12910. const slot = slots["prev-text"];
  12911. const disabled = modelValue === 1;
  12912. return vue.createVNode("li", {
  12913. "class": [bem$u("item", {
  12914. disabled,
  12915. border: mode === "simple",
  12916. prev: true
  12917. }), BORDER_SURROUND]
  12918. }, [vue.createVNode("button", {
  12919. "type": "button",
  12920. "disabled": disabled,
  12921. "onClick": () => updateModelValue(modelValue - 1, true)
  12922. }, [slot ? slot() : props2.prevText || t$6("prev")])]);
  12923. };
  12924. const renderNextButton = () => {
  12925. const {
  12926. mode,
  12927. modelValue,
  12928. showNextButton
  12929. } = props2;
  12930. if (!showNextButton) {
  12931. return;
  12932. }
  12933. const slot = slots["next-text"];
  12934. const disabled = modelValue === count.value;
  12935. return vue.createVNode("li", {
  12936. "class": [bem$u("item", {
  12937. disabled,
  12938. border: mode === "simple",
  12939. next: true
  12940. }), BORDER_SURROUND]
  12941. }, [vue.createVNode("button", {
  12942. "type": "button",
  12943. "disabled": disabled,
  12944. "onClick": () => updateModelValue(modelValue + 1, true)
  12945. }, [slot ? slot() : props2.nextText || t$6("next")])]);
  12946. };
  12947. const renderPages = () => pages.value.map((page) => vue.createVNode("li", {
  12948. "class": [bem$u("item", {
  12949. active: page.active,
  12950. page: true
  12951. }), BORDER_SURROUND]
  12952. }, [vue.createVNode("button", {
  12953. "type": "button",
  12954. "aria-current": page.active || void 0,
  12955. "onClick": () => updateModelValue(page.number, true)
  12956. }, [slots.page ? slots.page(page) : page.text])]));
  12957. return () => vue.createVNode("nav", {
  12958. "role": "navigation",
  12959. "class": bem$u()
  12960. }, [vue.createVNode("ul", {
  12961. "class": bem$u("items")
  12962. }, [renderPrevButton(), props2.mode === "simple" ? renderDesc() : renderPages(), renderNextButton()])]);
  12963. }
  12964. });
  12965. const Pagination = withInstall(stdin_default$D);
  12966. const [name$u, bem$t] = createNamespace("password-input");
  12967. const passwordInputProps = {
  12968. info: String,
  12969. mask: truthProp,
  12970. value: makeStringProp(""),
  12971. gutter: numericProp,
  12972. length: makeNumericProp(6),
  12973. focused: Boolean,
  12974. errorInfo: String
  12975. };
  12976. var stdin_default$C = vue.defineComponent({
  12977. name: name$u,
  12978. props: passwordInputProps,
  12979. emits: ["focus"],
  12980. setup(props2, {
  12981. emit
  12982. }) {
  12983. const onTouchStart = (event) => {
  12984. event.stopPropagation();
  12985. emit("focus", event);
  12986. };
  12987. const renderPoints = () => {
  12988. const Points = [];
  12989. const {
  12990. mask,
  12991. value,
  12992. gutter,
  12993. focused
  12994. } = props2;
  12995. const length = +props2.length;
  12996. for (let i = 0; i < length; i++) {
  12997. const char = value[i];
  12998. const showBorder = i !== 0 && !gutter;
  12999. const showCursor = focused && i === value.length;
  13000. let style;
  13001. if (i !== 0 && gutter) {
  13002. style = {
  13003. marginLeft: addUnit(gutter)
  13004. };
  13005. }
  13006. Points.push(vue.createVNode("li", {
  13007. "class": [{
  13008. [BORDER_LEFT]: showBorder
  13009. }, bem$t("item", {
  13010. focus: showCursor
  13011. })],
  13012. "style": style
  13013. }, [mask ? vue.createVNode("i", {
  13014. "style": {
  13015. visibility: char ? "visible" : "hidden"
  13016. }
  13017. }, null) : char, showCursor && vue.createVNode("div", {
  13018. "class": bem$t("cursor")
  13019. }, null)]));
  13020. }
  13021. return Points;
  13022. };
  13023. return () => {
  13024. const info = props2.errorInfo || props2.info;
  13025. return vue.createVNode("div", {
  13026. "class": bem$t()
  13027. }, [vue.createVNode("ul", {
  13028. "class": [bem$t("security"), {
  13029. [BORDER_SURROUND]: !props2.gutter
  13030. }],
  13031. "onTouchstartPassive": onTouchStart
  13032. }, [renderPoints()]), info && vue.createVNode("div", {
  13033. "class": bem$t(props2.errorInfo ? "error-info" : "info")
  13034. }, [info])]);
  13035. };
  13036. }
  13037. });
  13038. const PasswordInput = withInstall(stdin_default$C);
  13039. const PickerGroup = withInstall(stdin_default$1A);
  13040. function getWindow(node) {
  13041. if (node == null) {
  13042. return window;
  13043. }
  13044. if (node.toString() !== "[object Window]") {
  13045. var ownerDocument = node.ownerDocument;
  13046. return ownerDocument ? ownerDocument.defaultView || window : window;
  13047. }
  13048. return node;
  13049. }
  13050. function isElement(node) {
  13051. var OwnElement = getWindow(node).Element;
  13052. return node instanceof OwnElement || node instanceof Element;
  13053. }
  13054. function isHTMLElement(node) {
  13055. var OwnElement = getWindow(node).HTMLElement;
  13056. return node instanceof OwnElement || node instanceof HTMLElement;
  13057. }
  13058. function isShadowRoot(node) {
  13059. if (typeof ShadowRoot === "undefined") {
  13060. return false;
  13061. }
  13062. var OwnElement = getWindow(node).ShadowRoot;
  13063. return node instanceof OwnElement || node instanceof ShadowRoot;
  13064. }
  13065. var round = Math.round;
  13066. function getUAString() {
  13067. var uaData = navigator.userAgentData;
  13068. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  13069. return uaData.brands.map(function(item) {
  13070. return item.brand + "/" + item.version;
  13071. }).join(" ");
  13072. }
  13073. return navigator.userAgent;
  13074. }
  13075. function isLayoutViewport() {
  13076. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  13077. }
  13078. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  13079. if (includeScale === void 0) {
  13080. includeScale = false;
  13081. }
  13082. if (isFixedStrategy === void 0) {
  13083. isFixedStrategy = false;
  13084. }
  13085. var clientRect = element.getBoundingClientRect();
  13086. var scaleX = 1;
  13087. var scaleY = 1;
  13088. if (includeScale && isHTMLElement(element)) {
  13089. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  13090. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  13091. }
  13092. var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  13093. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  13094. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  13095. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  13096. var width2 = clientRect.width / scaleX;
  13097. var height2 = clientRect.height / scaleY;
  13098. return {
  13099. width: width2,
  13100. height: height2,
  13101. top: y,
  13102. right: x + width2,
  13103. bottom: y + height2,
  13104. left: x,
  13105. x,
  13106. y
  13107. };
  13108. }
  13109. function getWindowScroll(node) {
  13110. var win = getWindow(node);
  13111. var scrollLeft = win.pageXOffset;
  13112. var scrollTop = win.pageYOffset;
  13113. return {
  13114. scrollLeft,
  13115. scrollTop
  13116. };
  13117. }
  13118. function getHTMLElementScroll(element) {
  13119. return {
  13120. scrollLeft: element.scrollLeft,
  13121. scrollTop: element.scrollTop
  13122. };
  13123. }
  13124. function getNodeScroll(node) {
  13125. if (node === getWindow(node) || !isHTMLElement(node)) {
  13126. return getWindowScroll(node);
  13127. } else {
  13128. return getHTMLElementScroll(node);
  13129. }
  13130. }
  13131. function getNodeName(element) {
  13132. return element ? (element.nodeName || "").toLowerCase() : null;
  13133. }
  13134. function getDocumentElement(element) {
  13135. return ((isElement(element) ? element.ownerDocument : (
  13136. // $FlowFixMe[prop-missing]
  13137. element.document
  13138. )) || window.document).documentElement;
  13139. }
  13140. function getWindowScrollBarX(element) {
  13141. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  13142. }
  13143. function getComputedStyle(element) {
  13144. return getWindow(element).getComputedStyle(element);
  13145. }
  13146. function isScrollParent(element) {
  13147. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  13148. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  13149. }
  13150. function isElementScaled(element) {
  13151. var rect = element.getBoundingClientRect();
  13152. var scaleX = round(rect.width) / element.offsetWidth || 1;
  13153. var scaleY = round(rect.height) / element.offsetHeight || 1;
  13154. return scaleX !== 1 || scaleY !== 1;
  13155. }
  13156. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  13157. if (isFixed === void 0) {
  13158. isFixed = false;
  13159. }
  13160. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  13161. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  13162. var documentElement = getDocumentElement(offsetParent);
  13163. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  13164. var scroll = {
  13165. scrollLeft: 0,
  13166. scrollTop: 0
  13167. };
  13168. var offsets = {
  13169. x: 0,
  13170. y: 0
  13171. };
  13172. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  13173. if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  13174. isScrollParent(documentElement)) {
  13175. scroll = getNodeScroll(offsetParent);
  13176. }
  13177. if (isHTMLElement(offsetParent)) {
  13178. offsets = getBoundingClientRect(offsetParent, true);
  13179. offsets.x += offsetParent.clientLeft;
  13180. offsets.y += offsetParent.clientTop;
  13181. } else if (documentElement) {
  13182. offsets.x = getWindowScrollBarX(documentElement);
  13183. }
  13184. }
  13185. return {
  13186. x: rect.left + scroll.scrollLeft - offsets.x,
  13187. y: rect.top + scroll.scrollTop - offsets.y,
  13188. width: rect.width,
  13189. height: rect.height
  13190. };
  13191. }
  13192. function getLayoutRect(element) {
  13193. var clientRect = getBoundingClientRect(element);
  13194. var width2 = element.offsetWidth;
  13195. var height2 = element.offsetHeight;
  13196. if (Math.abs(clientRect.width - width2) <= 1) {
  13197. width2 = clientRect.width;
  13198. }
  13199. if (Math.abs(clientRect.height - height2) <= 1) {
  13200. height2 = clientRect.height;
  13201. }
  13202. return {
  13203. x: element.offsetLeft,
  13204. y: element.offsetTop,
  13205. width: width2,
  13206. height: height2
  13207. };
  13208. }
  13209. function getParentNode(element) {
  13210. if (getNodeName(element) === "html") {
  13211. return element;
  13212. }
  13213. return (
  13214. // this is a quicker (but less type safe) way to save quite some bytes from the bundle
  13215. // $FlowFixMe[incompatible-return]
  13216. // $FlowFixMe[prop-missing]
  13217. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  13218. element.parentNode || // DOM Element detected
  13219. (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  13220. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  13221. getDocumentElement(element)
  13222. );
  13223. }
  13224. function getScrollParent(node) {
  13225. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  13226. return node.ownerDocument.body;
  13227. }
  13228. if (isHTMLElement(node) && isScrollParent(node)) {
  13229. return node;
  13230. }
  13231. return getScrollParent(getParentNode(node));
  13232. }
  13233. function listScrollParents(element, list) {
  13234. var _element$ownerDocumen;
  13235. if (list === void 0) {
  13236. list = [];
  13237. }
  13238. var scrollParent = getScrollParent(element);
  13239. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  13240. var win = getWindow(scrollParent);
  13241. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  13242. var updatedList = list.concat(target);
  13243. return isBody ? updatedList : (
  13244. // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  13245. updatedList.concat(listScrollParents(getParentNode(target)))
  13246. );
  13247. }
  13248. function isTableElement(element) {
  13249. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  13250. }
  13251. function getTrueOffsetParent(element) {
  13252. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  13253. getComputedStyle(element).position === "fixed") {
  13254. return null;
  13255. }
  13256. return element.offsetParent;
  13257. }
  13258. function getContainingBlock(element) {
  13259. var isFirefox = /firefox/i.test(getUAString());
  13260. var isIE = /Trident/i.test(getUAString());
  13261. if (isIE && isHTMLElement(element)) {
  13262. var elementCss = getComputedStyle(element);
  13263. if (elementCss.position === "fixed") {
  13264. return null;
  13265. }
  13266. }
  13267. var currentNode = getParentNode(element);
  13268. if (isShadowRoot(currentNode)) {
  13269. currentNode = currentNode.host;
  13270. }
  13271. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  13272. var css = getComputedStyle(currentNode);
  13273. if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
  13274. return currentNode;
  13275. } else {
  13276. currentNode = currentNode.parentNode;
  13277. }
  13278. }
  13279. return null;
  13280. }
  13281. function getOffsetParent(element) {
  13282. var window2 = getWindow(element);
  13283. var offsetParent = getTrueOffsetParent(element);
  13284. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  13285. offsetParent = getTrueOffsetParent(offsetParent);
  13286. }
  13287. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  13288. return window2;
  13289. }
  13290. return offsetParent || getContainingBlock(element) || window2;
  13291. }
  13292. var top = "top";
  13293. var bottom = "bottom";
  13294. var right = "right";
  13295. var left = "left";
  13296. var auto = "auto";
  13297. var basePlacements = [top, bottom, right, left];
  13298. var start = "start";
  13299. var end = "end";
  13300. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  13301. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  13302. }, []);
  13303. var beforeRead = "beforeRead";
  13304. var read = "read";
  13305. var afterRead = "afterRead";
  13306. var beforeMain = "beforeMain";
  13307. var main = "main";
  13308. var afterMain = "afterMain";
  13309. var beforeWrite = "beforeWrite";
  13310. var write = "write";
  13311. var afterWrite = "afterWrite";
  13312. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  13313. function order(modifiers) {
  13314. var map = /* @__PURE__ */ new Map();
  13315. var visited = /* @__PURE__ */ new Set();
  13316. var result = [];
  13317. modifiers.forEach(function(modifier) {
  13318. map.set(modifier.name, modifier);
  13319. });
  13320. function sort(modifier) {
  13321. visited.add(modifier.name);
  13322. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  13323. requires.forEach(function(dep) {
  13324. if (!visited.has(dep)) {
  13325. var depModifier = map.get(dep);
  13326. if (depModifier) {
  13327. sort(depModifier);
  13328. }
  13329. }
  13330. });
  13331. result.push(modifier);
  13332. }
  13333. modifiers.forEach(function(modifier) {
  13334. if (!visited.has(modifier.name)) {
  13335. sort(modifier);
  13336. }
  13337. });
  13338. return result;
  13339. }
  13340. function orderModifiers(modifiers) {
  13341. var orderedModifiers = order(modifiers);
  13342. return modifierPhases.reduce(function(acc, phase) {
  13343. return acc.concat(orderedModifiers.filter(function(modifier) {
  13344. return modifier.phase === phase;
  13345. }));
  13346. }, []);
  13347. }
  13348. function debounce(fn2) {
  13349. var pending;
  13350. return function() {
  13351. if (!pending) {
  13352. pending = new Promise(function(resolve) {
  13353. Promise.resolve().then(function() {
  13354. pending = void 0;
  13355. resolve(fn2());
  13356. });
  13357. });
  13358. }
  13359. return pending;
  13360. };
  13361. }
  13362. function mergeByName(modifiers) {
  13363. var merged = modifiers.reduce(function(merged2, current2) {
  13364. var existing = merged2[current2.name];
  13365. merged2[current2.name] = existing ? Object.assign({}, existing, current2, {
  13366. options: Object.assign({}, existing.options, current2.options),
  13367. data: Object.assign({}, existing.data, current2.data)
  13368. }) : current2;
  13369. return merged2;
  13370. }, {});
  13371. return Object.keys(merged).map(function(key) {
  13372. return merged[key];
  13373. });
  13374. }
  13375. function getBasePlacement(placement) {
  13376. return placement.split("-")[0];
  13377. }
  13378. function getVariation(placement) {
  13379. return placement.split("-")[1];
  13380. }
  13381. function getMainAxisFromPlacement(placement) {
  13382. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  13383. }
  13384. function computeOffsets(_ref) {
  13385. var reference = _ref.reference, element = _ref.element, placement = _ref.placement;
  13386. var basePlacement = placement ? getBasePlacement(placement) : null;
  13387. var variation = placement ? getVariation(placement) : null;
  13388. var commonX = reference.x + reference.width / 2 - element.width / 2;
  13389. var commonY = reference.y + reference.height / 2 - element.height / 2;
  13390. var offsets;
  13391. switch (basePlacement) {
  13392. case top:
  13393. offsets = {
  13394. x: commonX,
  13395. y: reference.y - element.height
  13396. };
  13397. break;
  13398. case bottom:
  13399. offsets = {
  13400. x: commonX,
  13401. y: reference.y + reference.height
  13402. };
  13403. break;
  13404. case right:
  13405. offsets = {
  13406. x: reference.x + reference.width,
  13407. y: commonY
  13408. };
  13409. break;
  13410. case left:
  13411. offsets = {
  13412. x: reference.x - element.width,
  13413. y: commonY
  13414. };
  13415. break;
  13416. default:
  13417. offsets = {
  13418. x: reference.x,
  13419. y: reference.y
  13420. };
  13421. }
  13422. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  13423. if (mainAxis != null) {
  13424. var len = mainAxis === "y" ? "height" : "width";
  13425. switch (variation) {
  13426. case start:
  13427. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  13428. break;
  13429. case end:
  13430. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  13431. break;
  13432. }
  13433. }
  13434. return offsets;
  13435. }
  13436. var DEFAULT_OPTIONS = {
  13437. placement: "bottom",
  13438. modifiers: [],
  13439. strategy: "absolute"
  13440. };
  13441. function areValidElements() {
  13442. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  13443. args[_key] = arguments[_key];
  13444. }
  13445. return !args.some(function(element) {
  13446. return !(element && typeof element.getBoundingClientRect === "function");
  13447. });
  13448. }
  13449. function popperGenerator(generatorOptions) {
  13450. if (generatorOptions === void 0) {
  13451. generatorOptions = {};
  13452. }
  13453. var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions2 = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  13454. return function createPopper2(reference, popper, options) {
  13455. if (options === void 0) {
  13456. options = defaultOptions2;
  13457. }
  13458. var state = {
  13459. placement: "bottom",
  13460. orderedModifiers: [],
  13461. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions2),
  13462. modifiersData: {},
  13463. elements: {
  13464. reference,
  13465. popper
  13466. },
  13467. attributes: {},
  13468. styles: {}
  13469. };
  13470. var effectCleanupFns = [];
  13471. var isDestroyed = false;
  13472. var instance2 = {
  13473. state,
  13474. setOptions: function setOptions(setOptionsAction) {
  13475. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  13476. cleanupModifierEffects();
  13477. state.options = Object.assign({}, defaultOptions2, state.options, options2);
  13478. state.scrollParents = {
  13479. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  13480. popper: listScrollParents(popper)
  13481. };
  13482. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  13483. state.orderedModifiers = orderedModifiers.filter(function(m) {
  13484. return m.enabled;
  13485. });
  13486. runModifierEffects();
  13487. return instance2.update();
  13488. },
  13489. // Sync update – it will always be executed, even if not necessary. This
  13490. // is useful for low frequency updates where sync behavior simplifies the
  13491. // logic.
  13492. // For high frequency updates (e.g. `resize` and `scroll` events), always
  13493. // prefer the async Popper#update method
  13494. forceUpdate: function forceUpdate() {
  13495. if (isDestroyed) {
  13496. return;
  13497. }
  13498. var _state$elements = state.elements, reference2 = _state$elements.reference, popper2 = _state$elements.popper;
  13499. if (!areValidElements(reference2, popper2)) {
  13500. return;
  13501. }
  13502. state.rects = {
  13503. reference: getCompositeRect(reference2, getOffsetParent(popper2), state.options.strategy === "fixed"),
  13504. popper: getLayoutRect(popper2)
  13505. };
  13506. state.reset = false;
  13507. state.placement = state.options.placement;
  13508. state.orderedModifiers.forEach(function(modifier) {
  13509. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  13510. });
  13511. for (var index = 0; index < state.orderedModifiers.length; index++) {
  13512. if (state.reset === true) {
  13513. state.reset = false;
  13514. index = -1;
  13515. continue;
  13516. }
  13517. var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name2 = _state$orderedModifie.name;
  13518. if (typeof fn2 === "function") {
  13519. state = fn2({
  13520. state,
  13521. options: _options,
  13522. name: name2,
  13523. instance: instance2
  13524. }) || state;
  13525. }
  13526. }
  13527. },
  13528. // Async and optimistically optimized update – it will not be executed if
  13529. // not necessary (debounced to run at most once-per-tick)
  13530. update: debounce(function() {
  13531. return new Promise(function(resolve) {
  13532. instance2.forceUpdate();
  13533. resolve(state);
  13534. });
  13535. }),
  13536. destroy: function destroy() {
  13537. cleanupModifierEffects();
  13538. isDestroyed = true;
  13539. }
  13540. };
  13541. if (!areValidElements(reference, popper)) {
  13542. return instance2;
  13543. }
  13544. instance2.setOptions(options).then(function(state2) {
  13545. if (!isDestroyed && options.onFirstUpdate) {
  13546. options.onFirstUpdate(state2);
  13547. }
  13548. });
  13549. function runModifierEffects() {
  13550. state.orderedModifiers.forEach(function(_ref) {
  13551. var name2 = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
  13552. if (typeof effect3 === "function") {
  13553. var cleanupFn = effect3({
  13554. state,
  13555. name: name2,
  13556. instance: instance2,
  13557. options: options2
  13558. });
  13559. var noopFn = function noopFn2() {
  13560. };
  13561. effectCleanupFns.push(cleanupFn || noopFn);
  13562. }
  13563. });
  13564. }
  13565. function cleanupModifierEffects() {
  13566. effectCleanupFns.forEach(function(fn2) {
  13567. return fn2();
  13568. });
  13569. effectCleanupFns = [];
  13570. }
  13571. return instance2;
  13572. };
  13573. }
  13574. var passive = {
  13575. passive: true
  13576. };
  13577. function effect(_ref) {
  13578. var state = _ref.state, instance2 = _ref.instance, options = _ref.options;
  13579. var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
  13580. var window2 = getWindow(state.elements.popper);
  13581. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  13582. if (scroll) {
  13583. scrollParents.forEach(function(scrollParent) {
  13584. scrollParent.addEventListener("scroll", instance2.update, passive);
  13585. });
  13586. }
  13587. if (resize) {
  13588. window2.addEventListener("resize", instance2.update, passive);
  13589. }
  13590. return function() {
  13591. if (scroll) {
  13592. scrollParents.forEach(function(scrollParent) {
  13593. scrollParent.removeEventListener("scroll", instance2.update, passive);
  13594. });
  13595. }
  13596. if (resize) {
  13597. window2.removeEventListener("resize", instance2.update, passive);
  13598. }
  13599. };
  13600. }
  13601. var eventListeners_default = {
  13602. name: "eventListeners",
  13603. enabled: true,
  13604. phase: "write",
  13605. fn: function fn() {
  13606. },
  13607. effect,
  13608. data: {}
  13609. };
  13610. function popperOffsets(_ref) {
  13611. var state = _ref.state, name2 = _ref.name;
  13612. state.modifiersData[name2] = computeOffsets({
  13613. reference: state.rects.reference,
  13614. element: state.rects.popper,
  13615. strategy: "absolute",
  13616. placement: state.placement
  13617. });
  13618. }
  13619. var popperOffsets_default = {
  13620. name: "popperOffsets",
  13621. enabled: true,
  13622. phase: "read",
  13623. fn: popperOffsets,
  13624. data: {}
  13625. };
  13626. var unsetSides = {
  13627. top: "auto",
  13628. right: "auto",
  13629. bottom: "auto",
  13630. left: "auto"
  13631. };
  13632. function roundOffsetsByDPR(_ref, win) {
  13633. var x = _ref.x, y = _ref.y;
  13634. var dpr = win.devicePixelRatio || 1;
  13635. return {
  13636. x: round(x * dpr) / dpr || 0,
  13637. y: round(y * dpr) / dpr || 0
  13638. };
  13639. }
  13640. function mapToStyles(_ref2) {
  13641. var _Object$assign2;
  13642. var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
  13643. var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
  13644. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  13645. x,
  13646. y
  13647. }) : {
  13648. x,
  13649. y
  13650. };
  13651. x = _ref3.x;
  13652. y = _ref3.y;
  13653. var hasX = offsets.hasOwnProperty("x");
  13654. var hasY = offsets.hasOwnProperty("y");
  13655. var sideX = left;
  13656. var sideY = top;
  13657. var win = window;
  13658. if (adaptive) {
  13659. var offsetParent = getOffsetParent(popper);
  13660. var heightProp = "clientHeight";
  13661. var widthProp = "clientWidth";
  13662. if (offsetParent === getWindow(popper)) {
  13663. offsetParent = getDocumentElement(popper);
  13664. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  13665. heightProp = "scrollHeight";
  13666. widthProp = "scrollWidth";
  13667. }
  13668. }
  13669. offsetParent = offsetParent;
  13670. if (placement === top || (placement === left || placement === right) && variation === end) {
  13671. sideY = bottom;
  13672. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
  13673. // $FlowFixMe[prop-missing]
  13674. offsetParent[heightProp]
  13675. );
  13676. y -= offsetY - popperRect.height;
  13677. y *= gpuAcceleration ? 1 : -1;
  13678. }
  13679. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  13680. sideX = right;
  13681. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
  13682. // $FlowFixMe[prop-missing]
  13683. offsetParent[widthProp]
  13684. );
  13685. x -= offsetX - popperRect.width;
  13686. x *= gpuAcceleration ? 1 : -1;
  13687. }
  13688. }
  13689. var commonStyles = Object.assign({
  13690. position
  13691. }, adaptive && unsetSides);
  13692. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  13693. x,
  13694. y
  13695. }, getWindow(popper)) : {
  13696. x,
  13697. y
  13698. };
  13699. x = _ref4.x;
  13700. y = _ref4.y;
  13701. if (gpuAcceleration) {
  13702. var _Object$assign;
  13703. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  13704. }
  13705. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  13706. }
  13707. function computeStyles(_ref5) {
  13708. var state = _ref5.state, options = _ref5.options;
  13709. var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  13710. var commonStyles = {
  13711. placement: getBasePlacement(state.placement),
  13712. variation: getVariation(state.placement),
  13713. popper: state.elements.popper,
  13714. popperRect: state.rects.popper,
  13715. gpuAcceleration,
  13716. isFixed: state.options.strategy === "fixed"
  13717. };
  13718. if (state.modifiersData.popperOffsets != null) {
  13719. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  13720. offsets: state.modifiersData.popperOffsets,
  13721. position: state.options.strategy,
  13722. adaptive,
  13723. roundOffsets
  13724. })));
  13725. }
  13726. if (state.modifiersData.arrow != null) {
  13727. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  13728. offsets: state.modifiersData.arrow,
  13729. position: "absolute",
  13730. adaptive: false,
  13731. roundOffsets
  13732. })));
  13733. }
  13734. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  13735. "data-popper-placement": state.placement
  13736. });
  13737. }
  13738. var computeStyles_default = {
  13739. name: "computeStyles",
  13740. enabled: true,
  13741. phase: "beforeWrite",
  13742. fn: computeStyles,
  13743. data: {}
  13744. };
  13745. function applyStyles(_ref) {
  13746. var state = _ref.state;
  13747. Object.keys(state.elements).forEach(function(name2) {
  13748. var style = state.styles[name2] || {};
  13749. var attributes = state.attributes[name2] || {};
  13750. var element = state.elements[name2];
  13751. if (!isHTMLElement(element) || !getNodeName(element)) {
  13752. return;
  13753. }
  13754. Object.assign(element.style, style);
  13755. Object.keys(attributes).forEach(function(name22) {
  13756. var value = attributes[name22];
  13757. if (value === false) {
  13758. element.removeAttribute(name22);
  13759. } else {
  13760. element.setAttribute(name22, value === true ? "" : value);
  13761. }
  13762. });
  13763. });
  13764. }
  13765. function effect2(_ref2) {
  13766. var state = _ref2.state;
  13767. var initialStyles = {
  13768. popper: {
  13769. position: state.options.strategy,
  13770. left: "0",
  13771. top: "0",
  13772. margin: "0"
  13773. },
  13774. arrow: {
  13775. position: "absolute"
  13776. },
  13777. reference: {}
  13778. };
  13779. Object.assign(state.elements.popper.style, initialStyles.popper);
  13780. state.styles = initialStyles;
  13781. if (state.elements.arrow) {
  13782. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  13783. }
  13784. return function() {
  13785. Object.keys(state.elements).forEach(function(name2) {
  13786. var element = state.elements[name2];
  13787. var attributes = state.attributes[name2] || {};
  13788. var styleProperties = Object.keys(state.styles.hasOwnProperty(name2) ? state.styles[name2] : initialStyles[name2]);
  13789. var style = styleProperties.reduce(function(style2, property) {
  13790. style2[property] = "";
  13791. return style2;
  13792. }, {});
  13793. if (!isHTMLElement(element) || !getNodeName(element)) {
  13794. return;
  13795. }
  13796. Object.assign(element.style, style);
  13797. Object.keys(attributes).forEach(function(attribute) {
  13798. element.removeAttribute(attribute);
  13799. });
  13800. });
  13801. };
  13802. }
  13803. var applyStyles_default = {
  13804. name: "applyStyles",
  13805. enabled: true,
  13806. phase: "write",
  13807. fn: applyStyles,
  13808. effect: effect2,
  13809. requires: ["computeStyles"]
  13810. };
  13811. var defaultModifiers = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default];
  13812. var createPopper = /* @__PURE__ */ popperGenerator({
  13813. defaultModifiers
  13814. });
  13815. function distanceAndSkiddingToXY(placement, rects, offset2) {
  13816. var basePlacement = getBasePlacement(placement);
  13817. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  13818. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  13819. placement
  13820. })) : offset2, skidding = _ref[0], distance = _ref[1];
  13821. skidding = skidding || 0;
  13822. distance = (distance || 0) * invertDistance;
  13823. return [left, right].indexOf(basePlacement) >= 0 ? {
  13824. x: distance,
  13825. y: skidding
  13826. } : {
  13827. x: skidding,
  13828. y: distance
  13829. };
  13830. }
  13831. function offset(_ref2) {
  13832. var state = _ref2.state, options = _ref2.options, name2 = _ref2.name;
  13833. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  13834. var data = placements.reduce(function(acc, placement) {
  13835. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  13836. return acc;
  13837. }, {});
  13838. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  13839. if (state.modifiersData.popperOffsets != null) {
  13840. state.modifiersData.popperOffsets.x += x;
  13841. state.modifiersData.popperOffsets.y += y;
  13842. }
  13843. state.modifiersData[name2] = data;
  13844. }
  13845. var offset_default = {
  13846. name: "offset",
  13847. enabled: true,
  13848. phase: "main",
  13849. requires: ["popperOffsets"],
  13850. fn: offset
  13851. };
  13852. const [name$t, bem$s] = createNamespace("popover");
  13853. const popupProps = ["overlay", "duration", "teleport", "overlayStyle", "overlayClass", "closeOnClickOverlay"];
  13854. const popoverProps = {
  13855. show: Boolean,
  13856. theme: makeStringProp("light"),
  13857. overlay: Boolean,
  13858. actions: makeArrayProp(),
  13859. actionsDirection: makeStringProp("vertical"),
  13860. trigger: makeStringProp("click"),
  13861. duration: numericProp,
  13862. showArrow: truthProp,
  13863. placement: makeStringProp("bottom"),
  13864. iconPrefix: String,
  13865. overlayClass: unknownProp,
  13866. overlayStyle: Object,
  13867. closeOnClickAction: truthProp,
  13868. closeOnClickOverlay: truthProp,
  13869. closeOnClickOutside: truthProp,
  13870. offset: {
  13871. type: Array,
  13872. default: () => [0, 8]
  13873. },
  13874. teleport: {
  13875. type: [String, Object],
  13876. default: "body"
  13877. }
  13878. };
  13879. var stdin_default$B = vue.defineComponent({
  13880. name: name$t,
  13881. props: popoverProps,
  13882. emits: ["select", "touchstart", "update:show"],
  13883. setup(props2, {
  13884. emit,
  13885. slots,
  13886. attrs
  13887. }) {
  13888. let popper;
  13889. const popupRef = vue.ref();
  13890. const wrapperRef = vue.ref();
  13891. const popoverRef = vue.ref();
  13892. const show = useSyncPropRef(() => props2.show, (value) => emit("update:show", value));
  13893. const getPopoverOptions = () => ({
  13894. placement: props2.placement,
  13895. modifiers: [{
  13896. name: "computeStyles",
  13897. options: {
  13898. adaptive: false,
  13899. gpuAcceleration: false
  13900. }
  13901. }, extend({}, offset_default, {
  13902. options: {
  13903. offset: props2.offset
  13904. }
  13905. })]
  13906. });
  13907. const createPopperInstance = () => {
  13908. if (wrapperRef.value && popoverRef.value) {
  13909. return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
  13910. }
  13911. return null;
  13912. };
  13913. const updateLocation = () => {
  13914. vue.nextTick(() => {
  13915. if (!show.value) {
  13916. return;
  13917. }
  13918. if (!popper) {
  13919. popper = createPopperInstance();
  13920. if (inBrowser$1) {
  13921. window.addEventListener("animationend", updateLocation);
  13922. window.addEventListener("transitionend", updateLocation);
  13923. }
  13924. } else {
  13925. popper.setOptions(getPopoverOptions());
  13926. }
  13927. });
  13928. };
  13929. const updateShow = (value) => {
  13930. show.value = value;
  13931. };
  13932. const onClickWrapper = () => {
  13933. if (props2.trigger === "click") {
  13934. show.value = !show.value;
  13935. }
  13936. };
  13937. const onClickAction = (action, index) => {
  13938. if (action.disabled) {
  13939. return;
  13940. }
  13941. emit("select", action, index);
  13942. if (props2.closeOnClickAction) {
  13943. show.value = false;
  13944. }
  13945. };
  13946. const onClickAway = () => {
  13947. if (show.value && props2.closeOnClickOutside && (!props2.overlay || props2.closeOnClickOverlay)) {
  13948. show.value = false;
  13949. }
  13950. };
  13951. const renderActionContent = (action, index) => {
  13952. if (slots.action) {
  13953. return slots.action({
  13954. action,
  13955. index
  13956. });
  13957. }
  13958. return [action.icon && vue.createVNode(Icon, {
  13959. "name": action.icon,
  13960. "classPrefix": props2.iconPrefix,
  13961. "class": bem$s("action-icon")
  13962. }, null), vue.createVNode("div", {
  13963. "class": [bem$s("action-text"), {
  13964. [BORDER_BOTTOM]: props2.actionsDirection === "vertical"
  13965. }]
  13966. }, [action.text])];
  13967. };
  13968. const renderAction = (action, index) => {
  13969. const {
  13970. icon,
  13971. color,
  13972. disabled,
  13973. className
  13974. } = action;
  13975. return vue.createVNode("div", {
  13976. "role": "menuitem",
  13977. "class": [bem$s("action", {
  13978. disabled,
  13979. "with-icon": icon
  13980. }), {
  13981. [BORDER_RIGHT]: props2.actionsDirection === "horizontal"
  13982. }, className],
  13983. "style": {
  13984. color
  13985. },
  13986. "tabindex": disabled ? void 0 : 0,
  13987. "aria-disabled": disabled || void 0,
  13988. "onClick": () => onClickAction(action, index)
  13989. }, [renderActionContent(action, index)]);
  13990. };
  13991. vue.onMounted(() => {
  13992. updateLocation();
  13993. vue.watchEffect(() => {
  13994. var _a;
  13995. popupRef.value = (_a = popoverRef.value) == null ? void 0 : _a.popupRef.value;
  13996. });
  13997. });
  13998. vue.onBeforeUnmount(() => {
  13999. if (popper) {
  14000. if (inBrowser$1) {
  14001. window.removeEventListener("animationend", updateLocation);
  14002. window.removeEventListener("transitionend", updateLocation);
  14003. }
  14004. popper.destroy();
  14005. popper = null;
  14006. }
  14007. });
  14008. vue.watch(() => [show.value, props2.offset, props2.placement], updateLocation);
  14009. useClickAway([wrapperRef, popupRef], onClickAway, {
  14010. eventName: "touchstart"
  14011. });
  14012. return () => {
  14013. var _a;
  14014. return vue.createVNode(vue.Fragment, null, [vue.createVNode("span", {
  14015. "ref": wrapperRef,
  14016. "class": bem$s("wrapper"),
  14017. "onClick": onClickWrapper
  14018. }, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), vue.createVNode(Popup, vue.mergeProps({
  14019. "ref": popoverRef,
  14020. "show": show.value,
  14021. "class": bem$s([props2.theme]),
  14022. "position": "",
  14023. "transition": "van-popover-zoom",
  14024. "lockScroll": false,
  14025. "onUpdate:show": updateShow
  14026. }, attrs, useScopeId(), pick(props2, popupProps)), {
  14027. default: () => [props2.showArrow && vue.createVNode("div", {
  14028. "class": bem$s("arrow")
  14029. }, null), vue.createVNode("div", {
  14030. "role": "menu",
  14031. "class": bem$s("content", props2.actionsDirection)
  14032. }, [slots.default ? slots.default() : props2.actions.map(renderAction)])]
  14033. })]);
  14034. };
  14035. }
  14036. });
  14037. const Popover = withInstall(stdin_default$B);
  14038. const [name$s, bem$r] = createNamespace("progress");
  14039. const progressProps = {
  14040. color: String,
  14041. inactive: Boolean,
  14042. pivotText: String,
  14043. textColor: String,
  14044. showPivot: truthProp,
  14045. pivotColor: String,
  14046. trackColor: String,
  14047. strokeWidth: numericProp,
  14048. percentage: {
  14049. type: numericProp,
  14050. default: 0,
  14051. validator: (value) => +value >= 0 && +value <= 100
  14052. }
  14053. };
  14054. var stdin_default$A = vue.defineComponent({
  14055. name: name$s,
  14056. props: progressProps,
  14057. setup(props2) {
  14058. const background = vue.computed(() => props2.inactive ? void 0 : props2.color);
  14059. const renderPivot = () => {
  14060. const {
  14061. textColor,
  14062. pivotText,
  14063. pivotColor,
  14064. percentage
  14065. } = props2;
  14066. const text = pivotText != null ? pivotText : `${percentage}%`;
  14067. if (props2.showPivot && text) {
  14068. const style = {
  14069. color: textColor,
  14070. left: `${+percentage}%`,
  14071. transform: `translate(-${+percentage}%,-50%)`,
  14072. background: pivotColor || background.value
  14073. };
  14074. return vue.createVNode("span", {
  14075. "style": style,
  14076. "class": bem$r("pivot", {
  14077. inactive: props2.inactive
  14078. })
  14079. }, [text]);
  14080. }
  14081. };
  14082. return () => {
  14083. const {
  14084. trackColor,
  14085. percentage,
  14086. strokeWidth
  14087. } = props2;
  14088. const rootStyle = {
  14089. background: trackColor,
  14090. height: addUnit(strokeWidth)
  14091. };
  14092. const portionStyle = {
  14093. width: `${percentage}%`,
  14094. background: background.value
  14095. };
  14096. return vue.createVNode("div", {
  14097. "class": bem$r(),
  14098. "style": rootStyle
  14099. }, [vue.createVNode("span", {
  14100. "class": bem$r("portion", {
  14101. inactive: props2.inactive
  14102. }),
  14103. "style": portionStyle
  14104. }, null), renderPivot()]);
  14105. };
  14106. }
  14107. });
  14108. const Progress = withInstall(stdin_default$A);
  14109. const [name$r, bem$q, t$5] = createNamespace("pull-refresh");
  14110. const DEFAULT_HEAD_HEIGHT = 50;
  14111. const TEXT_STATUS = ["pulling", "loosing", "success"];
  14112. const pullRefreshProps = {
  14113. disabled: Boolean,
  14114. modelValue: Boolean,
  14115. headHeight: makeNumericProp(DEFAULT_HEAD_HEIGHT),
  14116. successText: String,
  14117. pullingText: String,
  14118. loosingText: String,
  14119. loadingText: String,
  14120. pullDistance: numericProp,
  14121. successDuration: makeNumericProp(500),
  14122. animationDuration: makeNumericProp(300)
  14123. };
  14124. var stdin_default$z = vue.defineComponent({
  14125. name: name$r,
  14126. props: pullRefreshProps,
  14127. emits: ["change", "refresh", "update:modelValue"],
  14128. setup(props2, {
  14129. emit,
  14130. slots
  14131. }) {
  14132. let reachTop;
  14133. const root = vue.ref();
  14134. const track = vue.ref();
  14135. const scrollParent = useScrollParent(root);
  14136. const state = vue.reactive({
  14137. status: "normal",
  14138. distance: 0,
  14139. duration: 0
  14140. });
  14141. const touch = useTouch();
  14142. const getHeadStyle = () => {
  14143. if (props2.headHeight !== DEFAULT_HEAD_HEIGHT) {
  14144. return {
  14145. height: `${props2.headHeight}px`
  14146. };
  14147. }
  14148. };
  14149. const isTouchable = () => state.status !== "loading" && state.status !== "success" && !props2.disabled;
  14150. const ease = (distance) => {
  14151. const pullDistance = +(props2.pullDistance || props2.headHeight);
  14152. if (distance > pullDistance) {
  14153. if (distance < pullDistance * 2) {
  14154. distance = pullDistance + (distance - pullDistance) / 2;
  14155. } else {
  14156. distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
  14157. }
  14158. }
  14159. return Math.round(distance);
  14160. };
  14161. const setStatus = (distance, isLoading) => {
  14162. const pullDistance = +(props2.pullDistance || props2.headHeight);
  14163. state.distance = distance;
  14164. if (isLoading) {
  14165. state.status = "loading";
  14166. } else if (distance === 0) {
  14167. state.status = "normal";
  14168. } else if (distance < pullDistance) {
  14169. state.status = "pulling";
  14170. } else {
  14171. state.status = "loosing";
  14172. }
  14173. emit("change", {
  14174. status: state.status,
  14175. distance
  14176. });
  14177. };
  14178. const getStatusText = () => {
  14179. const {
  14180. status
  14181. } = state;
  14182. if (status === "normal") {
  14183. return "";
  14184. }
  14185. return props2[`${status}Text`] || t$5(status);
  14186. };
  14187. const renderStatus = () => {
  14188. const {
  14189. status,
  14190. distance
  14191. } = state;
  14192. if (slots[status]) {
  14193. return slots[status]({
  14194. distance
  14195. });
  14196. }
  14197. const nodes = [];
  14198. if (TEXT_STATUS.includes(status)) {
  14199. nodes.push(vue.createVNode("div", {
  14200. "class": bem$q("text")
  14201. }, [getStatusText()]));
  14202. }
  14203. if (status === "loading") {
  14204. nodes.push(vue.createVNode(Loading, {
  14205. "class": bem$q("loading")
  14206. }, {
  14207. default: getStatusText
  14208. }));
  14209. }
  14210. return nodes;
  14211. };
  14212. const showSuccessTip = () => {
  14213. state.status = "success";
  14214. setTimeout(() => {
  14215. setStatus(0);
  14216. }, +props2.successDuration);
  14217. };
  14218. const checkPosition = (event) => {
  14219. reachTop = getScrollTop(scrollParent.value) === 0;
  14220. if (reachTop) {
  14221. state.duration = 0;
  14222. touch.start(event);
  14223. }
  14224. };
  14225. const onTouchStart = (event) => {
  14226. if (isTouchable()) {
  14227. checkPosition(event);
  14228. }
  14229. };
  14230. const onTouchMove = (event) => {
  14231. if (isTouchable()) {
  14232. if (!reachTop) {
  14233. checkPosition(event);
  14234. }
  14235. const {
  14236. deltaY
  14237. } = touch;
  14238. touch.move(event);
  14239. if (reachTop && deltaY.value >= 0 && touch.isVertical()) {
  14240. preventDefault(event);
  14241. setStatus(ease(deltaY.value));
  14242. }
  14243. }
  14244. };
  14245. const onTouchEnd = () => {
  14246. if (reachTop && touch.deltaY.value && isTouchable()) {
  14247. state.duration = +props2.animationDuration;
  14248. if (state.status === "loosing") {
  14249. setStatus(+props2.headHeight, true);
  14250. emit("update:modelValue", true);
  14251. vue.nextTick(() => emit("refresh"));
  14252. } else {
  14253. setStatus(0);
  14254. }
  14255. }
  14256. };
  14257. vue.watch(() => props2.modelValue, (value) => {
  14258. state.duration = +props2.animationDuration;
  14259. if (value) {
  14260. setStatus(+props2.headHeight, true);
  14261. } else if (slots.success || props2.successText) {
  14262. showSuccessTip();
  14263. } else {
  14264. setStatus(0, false);
  14265. }
  14266. });
  14267. useEventListener("touchmove", onTouchMove, {
  14268. target: track
  14269. });
  14270. return () => {
  14271. var _a;
  14272. const trackStyle = {
  14273. transitionDuration: `${state.duration}ms`,
  14274. transform: state.distance ? `translate3d(0,${state.distance}px, 0)` : ""
  14275. };
  14276. return vue.createVNode("div", {
  14277. "ref": root,
  14278. "class": bem$q()
  14279. }, [vue.createVNode("div", {
  14280. "ref": track,
  14281. "class": bem$q("track"),
  14282. "style": trackStyle,
  14283. "onTouchstartPassive": onTouchStart,
  14284. "onTouchend": onTouchEnd,
  14285. "onTouchcancel": onTouchEnd
  14286. }, [vue.createVNode("div", {
  14287. "class": bem$q("head"),
  14288. "style": getHeadStyle()
  14289. }, [renderStatus()]), (_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  14290. };
  14291. }
  14292. });
  14293. const PullRefresh = withInstall(stdin_default$z);
  14294. const [name$q, bem$p] = createNamespace("rate");
  14295. function getRateStatus(value, index, allowHalf, readonly) {
  14296. if (value >= index) {
  14297. return {
  14298. status: "full",
  14299. value: 1
  14300. };
  14301. }
  14302. if (value + 0.5 >= index && allowHalf && !readonly) {
  14303. return {
  14304. status: "half",
  14305. value: 0.5
  14306. };
  14307. }
  14308. if (value + 1 >= index && allowHalf && readonly) {
  14309. const cardinal = 10 ** 10;
  14310. return {
  14311. status: "half",
  14312. value: Math.round((value - index + 1) * cardinal) / cardinal
  14313. };
  14314. }
  14315. return {
  14316. status: "void",
  14317. value: 0
  14318. };
  14319. }
  14320. const rateProps = {
  14321. size: numericProp,
  14322. icon: makeStringProp("star"),
  14323. color: String,
  14324. count: makeNumericProp(5),
  14325. gutter: numericProp,
  14326. clearable: Boolean,
  14327. readonly: Boolean,
  14328. disabled: Boolean,
  14329. voidIcon: makeStringProp("star-o"),
  14330. allowHalf: Boolean,
  14331. voidColor: String,
  14332. touchable: truthProp,
  14333. iconPrefix: String,
  14334. modelValue: makeNumberProp(0),
  14335. disabledColor: String
  14336. };
  14337. var stdin_default$y = vue.defineComponent({
  14338. name: name$q,
  14339. props: rateProps,
  14340. emits: ["change", "update:modelValue"],
  14341. setup(props2, {
  14342. emit
  14343. }) {
  14344. const touch = useTouch();
  14345. const [itemRefs, setItemRefs] = useRefs();
  14346. const groupRef = vue.ref();
  14347. const unselectable = vue.computed(() => props2.readonly || props2.disabled);
  14348. const untouchable = vue.computed(() => unselectable.value || !props2.touchable);
  14349. const list = vue.computed(() => Array(+props2.count).fill("").map((_, i) => getRateStatus(props2.modelValue, i + 1, props2.allowHalf, props2.readonly)));
  14350. let ranges;
  14351. let groupRefRect;
  14352. let minRectTop = Number.MAX_SAFE_INTEGER;
  14353. let maxRectTop = Number.MIN_SAFE_INTEGER;
  14354. const updateRanges = () => {
  14355. groupRefRect = useRect(groupRef);
  14356. const rects = itemRefs.value.map(useRect);
  14357. ranges = [];
  14358. rects.forEach((rect, index) => {
  14359. minRectTop = Math.min(rect.top, minRectTop);
  14360. maxRectTop = Math.max(rect.top, maxRectTop);
  14361. if (props2.allowHalf) {
  14362. ranges.push({
  14363. score: index + 0.5,
  14364. left: rect.left,
  14365. top: rect.top,
  14366. height: rect.height
  14367. }, {
  14368. score: index + 1,
  14369. left: rect.left + rect.width / 2,
  14370. top: rect.top,
  14371. height: rect.height
  14372. });
  14373. } else {
  14374. ranges.push({
  14375. score: index + 1,
  14376. left: rect.left,
  14377. top: rect.top,
  14378. height: rect.height
  14379. });
  14380. }
  14381. });
  14382. };
  14383. const getScoreByPosition = (x, y) => {
  14384. for (let i = ranges.length - 1; i > 0; i--) {
  14385. if (y >= groupRefRect.top && y <= groupRefRect.bottom) {
  14386. if (x > ranges[i].left && y >= ranges[i].top && y <= ranges[i].top + ranges[i].height) {
  14387. return ranges[i].score;
  14388. }
  14389. } else {
  14390. const curTop = y < groupRefRect.top ? minRectTop : maxRectTop;
  14391. if (x > ranges[i].left && ranges[i].top === curTop) {
  14392. return ranges[i].score;
  14393. }
  14394. }
  14395. }
  14396. return props2.allowHalf ? 0.5 : 1;
  14397. };
  14398. const select = (value) => {
  14399. if (unselectable.value || value === props2.modelValue) return;
  14400. emit("update:modelValue", value);
  14401. emit("change", value);
  14402. };
  14403. const onTouchStart = (event) => {
  14404. if (untouchable.value) {
  14405. return;
  14406. }
  14407. touch.start(event);
  14408. updateRanges();
  14409. };
  14410. const onTouchMove = (event) => {
  14411. if (untouchable.value) {
  14412. return;
  14413. }
  14414. touch.move(event);
  14415. if (touch.isHorizontal() && !touch.isTap.value) {
  14416. const {
  14417. clientX,
  14418. clientY
  14419. } = event.touches[0];
  14420. preventDefault(event);
  14421. select(getScoreByPosition(clientX, clientY));
  14422. }
  14423. };
  14424. const renderStar = (item, index) => {
  14425. const {
  14426. icon,
  14427. size,
  14428. color,
  14429. count,
  14430. gutter,
  14431. voidIcon,
  14432. disabled,
  14433. voidColor,
  14434. allowHalf,
  14435. iconPrefix,
  14436. disabledColor
  14437. } = props2;
  14438. const score = index + 1;
  14439. const isFull = item.status === "full";
  14440. const isVoid = item.status === "void";
  14441. const renderHalf = allowHalf && item.value > 0 && item.value < 1;
  14442. let style;
  14443. if (gutter && score !== +count) {
  14444. style = {
  14445. paddingRight: addUnit(gutter)
  14446. };
  14447. }
  14448. const onClickItem = (event) => {
  14449. updateRanges();
  14450. let value = allowHalf ? getScoreByPosition(event.clientX, event.clientY) : score;
  14451. if (props2.clearable && touch.isTap.value && value === props2.modelValue) {
  14452. value = 0;
  14453. }
  14454. select(value);
  14455. };
  14456. return vue.createVNode("div", {
  14457. "key": index,
  14458. "ref": setItemRefs(index),
  14459. "role": "radio",
  14460. "style": style,
  14461. "class": bem$p("item"),
  14462. "tabindex": disabled ? void 0 : 0,
  14463. "aria-setsize": count,
  14464. "aria-posinset": score,
  14465. "aria-checked": !isVoid,
  14466. "onClick": onClickItem
  14467. }, [vue.createVNode(Icon, {
  14468. "size": size,
  14469. "name": isFull ? icon : voidIcon,
  14470. "class": bem$p("icon", {
  14471. disabled,
  14472. full: isFull
  14473. }),
  14474. "color": disabled ? disabledColor : isFull ? color : voidColor,
  14475. "classPrefix": iconPrefix
  14476. }, null), renderHalf && vue.createVNode(Icon, {
  14477. "size": size,
  14478. "style": {
  14479. width: item.value + "em"
  14480. },
  14481. "name": isVoid ? voidIcon : icon,
  14482. "class": bem$p("icon", ["half", {
  14483. disabled,
  14484. full: !isVoid
  14485. }]),
  14486. "color": disabled ? disabledColor : isVoid ? voidColor : color,
  14487. "classPrefix": iconPrefix
  14488. }, null)]);
  14489. };
  14490. useCustomFieldValue(() => props2.modelValue);
  14491. useEventListener("touchmove", onTouchMove, {
  14492. target: groupRef
  14493. });
  14494. return () => vue.createVNode("div", {
  14495. "ref": groupRef,
  14496. "role": "radiogroup",
  14497. "class": bem$p({
  14498. readonly: props2.readonly,
  14499. disabled: props2.disabled
  14500. }),
  14501. "tabindex": props2.disabled ? void 0 : 0,
  14502. "aria-disabled": props2.disabled,
  14503. "aria-readonly": props2.readonly,
  14504. "onTouchstartPassive": onTouchStart
  14505. }, [list.value.map(renderStar)]);
  14506. }
  14507. });
  14508. const Rate = withInstall(stdin_default$y);
  14509. const props = {
  14510. figureArr: makeArrayProp(),
  14511. delay: Number,
  14512. duration: makeNumberProp(2),
  14513. isStart: Boolean,
  14514. direction: makeStringProp("down"),
  14515. height: makeNumberProp(40)
  14516. };
  14517. const [name$p, bem$o] = createNamespace("rolling-text-item");
  14518. var stdin_default$x = vue.defineComponent({
  14519. name: name$p,
  14520. props,
  14521. setup(props2) {
  14522. const newFigureArr = vue.computed(() => props2.direction === "down" ? props2.figureArr.slice().reverse() : props2.figureArr);
  14523. const translatePx = vue.computed(() => {
  14524. const totalHeight = props2.height * (props2.figureArr.length - 1);
  14525. return `-${totalHeight}px`;
  14526. });
  14527. const itemStyle = vue.computed(() => ({
  14528. lineHeight: addUnit(props2.height)
  14529. }));
  14530. const rootStyle = vue.computed(() => ({
  14531. height: addUnit(props2.height),
  14532. "--van-translate": translatePx.value,
  14533. "--van-duration": props2.duration + "s",
  14534. "--van-delay": props2.delay + "s"
  14535. }));
  14536. return () => vue.createVNode("div", {
  14537. "class": bem$o([props2.direction]),
  14538. "style": rootStyle.value
  14539. }, [vue.createVNode("div", {
  14540. "class": bem$o("box", {
  14541. animate: props2.isStart
  14542. })
  14543. }, [Array.isArray(newFigureArr.value) && newFigureArr.value.map((figure) => vue.createVNode("div", {
  14544. "class": bem$o("item"),
  14545. "style": itemStyle.value
  14546. }, [figure]))])]);
  14547. }
  14548. });
  14549. const [name$o, bem$n] = createNamespace("rolling-text");
  14550. const rollingTextProps = {
  14551. startNum: makeNumberProp(0),
  14552. targetNum: Number,
  14553. textList: makeArrayProp(),
  14554. duration: makeNumberProp(2),
  14555. autoStart: truthProp,
  14556. direction: makeStringProp("down"),
  14557. stopOrder: makeStringProp("ltr"),
  14558. height: makeNumberProp(40)
  14559. };
  14560. const CIRCLE_NUM = 2;
  14561. var stdin_default$w = vue.defineComponent({
  14562. name: name$o,
  14563. props: rollingTextProps,
  14564. setup(props2) {
  14565. const isCustomType = vue.computed(() => Array.isArray(props2.textList) && props2.textList.length);
  14566. const itemLength = vue.computed(() => {
  14567. if (isCustomType.value) return props2.textList[0].length;
  14568. return `${Math.max(props2.startNum, props2.targetNum)}`.length;
  14569. });
  14570. const getTextArrByIdx = (idx) => {
  14571. const result = [];
  14572. for (let i = 0; i < props2.textList.length; i++) {
  14573. result.push(props2.textList[i][idx]);
  14574. }
  14575. return result;
  14576. };
  14577. const targetNumArr = vue.computed(() => {
  14578. if (isCustomType.value) return new Array(itemLength.value).fill("");
  14579. return padZero(props2.targetNum, itemLength.value).split("");
  14580. });
  14581. const startNumArr = vue.computed(() => padZero(props2.startNum, itemLength.value).split(""));
  14582. const getFigureArr = (i) => {
  14583. const start22 = +startNumArr.value[i];
  14584. const target = +targetNumArr.value[i];
  14585. const result = [];
  14586. for (let i2 = start22; i2 <= 9; i2++) {
  14587. result.push(i2);
  14588. }
  14589. for (let i2 = 0; i2 <= CIRCLE_NUM; i2++) {
  14590. for (let j = 0; j <= 9; j++) {
  14591. result.push(j);
  14592. }
  14593. }
  14594. for (let i2 = 0; i2 <= target; i2++) {
  14595. result.push(i2);
  14596. }
  14597. return result;
  14598. };
  14599. const getDelay = (i, len) => {
  14600. if (props2.stopOrder === "ltr") return 0.2 * i;
  14601. return 0.2 * (len - 1 - i);
  14602. };
  14603. const rolling = vue.ref(props2.autoStart);
  14604. const start2 = () => {
  14605. rolling.value = true;
  14606. };
  14607. const reset = () => {
  14608. rolling.value = false;
  14609. if (props2.autoStart) {
  14610. raf(() => start2());
  14611. }
  14612. };
  14613. vue.watch(() => props2.autoStart, (value) => {
  14614. if (value) {
  14615. start2();
  14616. }
  14617. });
  14618. useExpose({
  14619. start: start2,
  14620. reset
  14621. });
  14622. return () => vue.createVNode("div", {
  14623. "class": bem$n()
  14624. }, [targetNumArr.value.map((_, i) => vue.createVNode(stdin_default$x, {
  14625. "figureArr": isCustomType.value ? getTextArrByIdx(i) : getFigureArr(i),
  14626. "duration": props2.duration,
  14627. "direction": props2.direction,
  14628. "isStart": rolling.value,
  14629. "height": props2.height,
  14630. "delay": getDelay(i, itemLength.value)
  14631. }, null))]);
  14632. }
  14633. });
  14634. const RollingText = withInstall(stdin_default$w);
  14635. const Row = withInstall(stdin_default$17);
  14636. const [name$n, bem$m, t$4] = createNamespace("search");
  14637. const searchProps = extend({}, fieldSharedProps, {
  14638. label: String,
  14639. shape: makeStringProp("square"),
  14640. leftIcon: makeStringProp("search"),
  14641. clearable: truthProp,
  14642. actionText: String,
  14643. background: String,
  14644. showAction: Boolean
  14645. });
  14646. var stdin_default$v = vue.defineComponent({
  14647. name: name$n,
  14648. props: searchProps,
  14649. emits: ["blur", "focus", "clear", "search", "cancel", "clickInput", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
  14650. setup(props2, {
  14651. emit,
  14652. slots,
  14653. attrs
  14654. }) {
  14655. const id = useId();
  14656. const fieldRef = vue.ref();
  14657. const onCancel = () => {
  14658. if (!slots.action) {
  14659. emit("update:modelValue", "");
  14660. emit("cancel");
  14661. }
  14662. };
  14663. const onKeypress = (event) => {
  14664. const ENTER_CODE = 13;
  14665. if (event.keyCode === ENTER_CODE) {
  14666. preventDefault(event);
  14667. emit("search", props2.modelValue);
  14668. }
  14669. };
  14670. const getInputId = () => props2.id || `${id}-input`;
  14671. const renderLabel = () => {
  14672. if (slots.label || props2.label) {
  14673. return vue.createVNode("label", {
  14674. "class": bem$m("label"),
  14675. "for": getInputId(),
  14676. "data-allow-mismatch": "attribute"
  14677. }, [slots.label ? slots.label() : props2.label]);
  14678. }
  14679. };
  14680. const renderAction = () => {
  14681. if (props2.showAction) {
  14682. const text = props2.actionText || t$4("cancel");
  14683. return vue.createVNode("div", {
  14684. "class": bem$m("action"),
  14685. "role": "button",
  14686. "tabindex": 0,
  14687. "onClick": onCancel
  14688. }, [slots.action ? slots.action() : text]);
  14689. }
  14690. };
  14691. const blur = () => {
  14692. var _a;
  14693. return (_a = fieldRef.value) == null ? void 0 : _a.blur();
  14694. };
  14695. const focus = () => {
  14696. var _a;
  14697. return (_a = fieldRef.value) == null ? void 0 : _a.focus();
  14698. };
  14699. const onBlur = (event) => emit("blur", event);
  14700. const onFocus = (event) => emit("focus", event);
  14701. const onClear = (event) => emit("clear", event);
  14702. const onClickInput = (event) => emit("clickInput", event);
  14703. const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
  14704. const onClickRightIcon = (event) => emit("clickRightIcon", event);
  14705. const fieldPropNames = Object.keys(fieldSharedProps);
  14706. const renderField = () => {
  14707. const fieldAttrs = extend({}, attrs, pick(props2, fieldPropNames), {
  14708. id: getInputId()
  14709. });
  14710. const onInput = (value) => emit("update:modelValue", value);
  14711. return vue.createVNode(Field, vue.mergeProps({
  14712. "ref": fieldRef,
  14713. "type": "search",
  14714. "class": bem$m("field", {
  14715. "with-message": fieldAttrs.errorMessage
  14716. }),
  14717. "border": false,
  14718. "onBlur": onBlur,
  14719. "onFocus": onFocus,
  14720. "onClear": onClear,
  14721. "onKeypress": onKeypress,
  14722. "onClickInput": onClickInput,
  14723. "onClickLeftIcon": onClickLeftIcon,
  14724. "onClickRightIcon": onClickRightIcon,
  14725. "onUpdate:modelValue": onInput
  14726. }, fieldAttrs), pick(slots, ["left-icon", "right-icon"]));
  14727. };
  14728. useExpose({
  14729. focus,
  14730. blur
  14731. });
  14732. return () => {
  14733. var _a;
  14734. return vue.createVNode("div", {
  14735. "class": bem$m({
  14736. "show-action": props2.showAction
  14737. }),
  14738. "style": {
  14739. background: props2.background
  14740. }
  14741. }, [(_a = slots.left) == null ? void 0 : _a.call(slots), vue.createVNode("div", {
  14742. "class": bem$m("content", props2.shape)
  14743. }, [renderLabel(), renderField()]), renderAction()]);
  14744. };
  14745. }
  14746. });
  14747. const Search = withInstall(stdin_default$v);
  14748. const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
  14749. const popupInheritKeys = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
  14750. const iconMap = {
  14751. qq: "qq",
  14752. link: "link-o",
  14753. weibo: "weibo",
  14754. qrcode: "qr",
  14755. poster: "photo-o",
  14756. wechat: "wechat",
  14757. "weapp-qrcode": "miniprogram-o",
  14758. "wechat-moments": "wechat-moments"
  14759. };
  14760. const [name$m, bem$l, t$3] = createNamespace("share-sheet");
  14761. const shareSheetProps = extend({}, popupSharedProps, {
  14762. title: String,
  14763. round: truthProp,
  14764. options: makeArrayProp(),
  14765. cancelText: String,
  14766. description: String,
  14767. closeOnPopstate: truthProp,
  14768. safeAreaInsetBottom: truthProp
  14769. });
  14770. var stdin_default$u = vue.defineComponent({
  14771. name: name$m,
  14772. props: shareSheetProps,
  14773. emits: ["cancel", "select", "update:show"],
  14774. setup(props2, {
  14775. emit,
  14776. slots
  14777. }) {
  14778. const updateShow = (value) => emit("update:show", value);
  14779. const onCancel = () => {
  14780. updateShow(false);
  14781. emit("cancel");
  14782. };
  14783. const onSelect = (option, index) => emit("select", option, index);
  14784. const renderHeader = () => {
  14785. const title = slots.title ? slots.title() : props2.title;
  14786. const description = slots.description ? slots.description() : props2.description;
  14787. if (title || description) {
  14788. return vue.createVNode("div", {
  14789. "class": bem$l("header")
  14790. }, [title && vue.createVNode("h2", {
  14791. "class": bem$l("title")
  14792. }, [title]), description && vue.createVNode("span", {
  14793. "class": bem$l("description")
  14794. }, [description])]);
  14795. }
  14796. };
  14797. const renderIcon = (icon) => {
  14798. if (isImage(icon)) {
  14799. return vue.createVNode("img", {
  14800. "src": icon,
  14801. "class": bem$l("image-icon")
  14802. }, null);
  14803. }
  14804. return vue.createVNode("div", {
  14805. "class": bem$l("icon", [icon])
  14806. }, [vue.createVNode(Icon, {
  14807. "name": iconMap[icon] || icon
  14808. }, null)]);
  14809. };
  14810. const renderOption = (option, index) => {
  14811. const {
  14812. name: name2,
  14813. icon,
  14814. className,
  14815. description
  14816. } = option;
  14817. return vue.createVNode("div", {
  14818. "role": "button",
  14819. "tabindex": 0,
  14820. "class": [bem$l("option"), className, HAPTICS_FEEDBACK],
  14821. "onClick": () => onSelect(option, index)
  14822. }, [renderIcon(icon), name2 && vue.createVNode("span", {
  14823. "class": bem$l("name")
  14824. }, [name2]), description && vue.createVNode("span", {
  14825. "class": bem$l("option-description")
  14826. }, [description])]);
  14827. };
  14828. const renderOptions = (options, border) => vue.createVNode("div", {
  14829. "class": bem$l("options", {
  14830. border
  14831. })
  14832. }, [options.map(renderOption)]);
  14833. const renderRows = () => {
  14834. const {
  14835. options
  14836. } = props2;
  14837. if (Array.isArray(options[0])) {
  14838. return options.map((item, index) => renderOptions(item, index !== 0));
  14839. }
  14840. return renderOptions(options);
  14841. };
  14842. const renderCancelButton = () => {
  14843. var _a;
  14844. const cancelText = (_a = props2.cancelText) != null ? _a : t$3("cancel");
  14845. if (slots.cancel || cancelText) {
  14846. return vue.createVNode("button", {
  14847. "type": "button",
  14848. "class": bem$l("cancel"),
  14849. "onClick": onCancel
  14850. }, [slots.cancel ? slots.cancel() : cancelText]);
  14851. }
  14852. };
  14853. return () => vue.createVNode(Popup, vue.mergeProps({
  14854. "class": bem$l(),
  14855. "position": "bottom",
  14856. "onUpdate:show": updateShow
  14857. }, pick(props2, popupInheritKeys)), {
  14858. default: () => [renderHeader(), renderRows(), renderCancelButton()]
  14859. });
  14860. }
  14861. });
  14862. const ShareSheet = withInstall(stdin_default$u);
  14863. const [name$l, bem$k] = createNamespace("sidebar");
  14864. const SIDEBAR_KEY = Symbol(name$l);
  14865. const sidebarProps = {
  14866. modelValue: makeNumericProp(0)
  14867. };
  14868. var stdin_default$t = vue.defineComponent({
  14869. name: name$l,
  14870. props: sidebarProps,
  14871. emits: ["change", "update:modelValue"],
  14872. setup(props2, {
  14873. emit,
  14874. slots
  14875. }) {
  14876. const {
  14877. linkChildren
  14878. } = useChildren(SIDEBAR_KEY);
  14879. const getActive = () => +props2.modelValue;
  14880. const setActive = (value) => {
  14881. if (value !== getActive()) {
  14882. emit("update:modelValue", value);
  14883. emit("change", value);
  14884. }
  14885. };
  14886. linkChildren({
  14887. getActive,
  14888. setActive
  14889. });
  14890. return () => {
  14891. var _a;
  14892. return vue.createVNode("div", {
  14893. "role": "tablist",
  14894. "class": bem$k()
  14895. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  14896. };
  14897. }
  14898. });
  14899. const Sidebar = withInstall(stdin_default$t);
  14900. const [name$k, bem$j] = createNamespace("sidebar-item");
  14901. const sidebarItemProps = extend({}, routeProps, {
  14902. dot: Boolean,
  14903. title: String,
  14904. badge: numericProp,
  14905. disabled: Boolean,
  14906. badgeProps: Object
  14907. });
  14908. var stdin_default$s = vue.defineComponent({
  14909. name: name$k,
  14910. props: sidebarItemProps,
  14911. emits: ["click"],
  14912. setup(props2, {
  14913. emit,
  14914. slots
  14915. }) {
  14916. const route2 = useRoute();
  14917. const {
  14918. parent,
  14919. index
  14920. } = useParent(SIDEBAR_KEY);
  14921. if (!parent) {
  14922. return;
  14923. }
  14924. const onClick = () => {
  14925. if (props2.disabled) {
  14926. return;
  14927. }
  14928. emit("click", index.value);
  14929. parent.setActive(index.value);
  14930. route2();
  14931. };
  14932. return () => {
  14933. const {
  14934. dot,
  14935. badge,
  14936. title,
  14937. disabled
  14938. } = props2;
  14939. const selected = index.value === parent.getActive();
  14940. return vue.createVNode("div", {
  14941. "role": "tab",
  14942. "class": bem$j({
  14943. select: selected,
  14944. disabled
  14945. }),
  14946. "tabindex": disabled ? void 0 : 0,
  14947. "aria-selected": selected,
  14948. "onClick": onClick
  14949. }, [vue.createVNode(Badge, vue.mergeProps({
  14950. "dot": dot,
  14951. "class": bem$j("text"),
  14952. "content": badge
  14953. }, props2.badgeProps), {
  14954. default: () => [slots.title ? slots.title() : title]
  14955. })]);
  14956. };
  14957. }
  14958. });
  14959. const SidebarItem = withInstall(stdin_default$s);
  14960. const [name$j, bem$i, t$2] = createNamespace("signature");
  14961. const signatureProps = {
  14962. tips: String,
  14963. type: makeStringProp("png"),
  14964. penColor: makeStringProp("#000"),
  14965. lineWidth: makeNumberProp(3),
  14966. clearButtonText: String,
  14967. backgroundColor: makeStringProp(""),
  14968. confirmButtonText: String
  14969. };
  14970. const hasCanvasSupport = () => {
  14971. var _a;
  14972. const canvas = document.createElement("canvas");
  14973. return !!((_a = canvas.getContext) == null ? void 0 : _a.call(canvas, "2d"));
  14974. };
  14975. var stdin_default$r = vue.defineComponent({
  14976. name: name$j,
  14977. props: signatureProps,
  14978. emits: ["submit", "clear", "start", "end", "signing"],
  14979. setup(props2, {
  14980. emit
  14981. }) {
  14982. const canvasRef = vue.ref();
  14983. const wrapRef = vue.ref();
  14984. const ctx = vue.computed(() => {
  14985. if (!canvasRef.value) return null;
  14986. return canvasRef.value.getContext("2d");
  14987. });
  14988. const isRenderCanvas = inBrowser$1 ? hasCanvasSupport() : true;
  14989. let canvasWidth = 0;
  14990. let canvasHeight = 0;
  14991. let canvasRect;
  14992. const touchStart = () => {
  14993. if (!ctx.value) {
  14994. return false;
  14995. }
  14996. ctx.value.beginPath();
  14997. ctx.value.lineWidth = props2.lineWidth;
  14998. ctx.value.strokeStyle = props2.penColor;
  14999. canvasRect = useRect(canvasRef);
  15000. emit("start");
  15001. };
  15002. const touchMove = (event) => {
  15003. if (!ctx.value) {
  15004. return false;
  15005. }
  15006. preventDefault(event);
  15007. const touch = event.touches[0];
  15008. const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
  15009. const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
  15010. ctx.value.lineCap = "round";
  15011. ctx.value.lineJoin = "round";
  15012. ctx.value.lineTo(mouseX, mouseY);
  15013. ctx.value.stroke();
  15014. emit("signing", event);
  15015. };
  15016. const touchEnd = (event) => {
  15017. preventDefault(event);
  15018. emit("end");
  15019. };
  15020. const isCanvasEmpty = (canvas) => {
  15021. const empty = document.createElement("canvas");
  15022. empty.width = canvas.width;
  15023. empty.height = canvas.height;
  15024. if (props2.backgroundColor) {
  15025. const emptyCtx = empty.getContext("2d");
  15026. setCanvasBgColor(emptyCtx);
  15027. }
  15028. return canvas.toDataURL() === empty.toDataURL();
  15029. };
  15030. const setCanvasBgColor = (ctx2) => {
  15031. if (ctx2 && props2.backgroundColor) {
  15032. ctx2.fillStyle = props2.backgroundColor;
  15033. ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
  15034. }
  15035. };
  15036. const submit = () => {
  15037. var _a, _b;
  15038. const canvas = canvasRef.value;
  15039. if (!canvas) {
  15040. return;
  15041. }
  15042. const isEmpty = isCanvasEmpty(canvas);
  15043. const image = isEmpty ? "" : ((_b = (_a = {
  15044. jpg: () => canvas.toDataURL("image/jpeg", 0.8),
  15045. jpeg: () => canvas.toDataURL("image/jpeg", 0.8)
  15046. })[props2.type]) == null ? void 0 : _b.call(_a)) || canvas.toDataURL(`image/${props2.type}`);
  15047. emit("submit", {
  15048. image,
  15049. canvas
  15050. });
  15051. };
  15052. const clear = () => {
  15053. if (ctx.value) {
  15054. ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
  15055. ctx.value.closePath();
  15056. setCanvasBgColor(ctx.value);
  15057. }
  15058. emit("clear");
  15059. };
  15060. const initialize = () => {
  15061. var _a, _b, _c;
  15062. if (isRenderCanvas && canvasRef.value) {
  15063. const canvas = canvasRef.value;
  15064. const dpr = inBrowser$1 ? window.devicePixelRatio : 1;
  15065. canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
  15066. canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
  15067. (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
  15068. setCanvasBgColor(ctx.value);
  15069. }
  15070. };
  15071. const resize = () => {
  15072. if (ctx.value) {
  15073. const data = ctx.value.getImageData(0, 0, canvasWidth, canvasHeight);
  15074. initialize();
  15075. ctx.value.putImageData(data, 0, 0);
  15076. }
  15077. };
  15078. vue.watch(windowWidth, resize);
  15079. vue.onMounted(initialize);
  15080. useExpose({
  15081. resize,
  15082. clear,
  15083. submit
  15084. });
  15085. return () => vue.createVNode("div", {
  15086. "class": bem$i()
  15087. }, [vue.createVNode("div", {
  15088. "class": bem$i("content"),
  15089. "ref": wrapRef
  15090. }, [isRenderCanvas ? vue.createVNode("canvas", {
  15091. "ref": canvasRef,
  15092. "onTouchstartPassive": touchStart,
  15093. "onTouchmove": touchMove,
  15094. "onTouchend": touchEnd
  15095. }, null) : vue.createVNode("p", null, [props2.tips])]), vue.createVNode("div", {
  15096. "class": bem$i("footer")
  15097. }, [vue.createVNode(Button, {
  15098. "size": "small",
  15099. "onClick": clear
  15100. }, {
  15101. default: () => [props2.clearButtonText || t$2("clear")]
  15102. }), vue.createVNode(Button, {
  15103. "type": "primary",
  15104. "size": "small",
  15105. "onClick": submit
  15106. }, {
  15107. default: () => [props2.confirmButtonText || t$2("confirm")]
  15108. })])]);
  15109. }
  15110. });
  15111. const Signature = withInstall(stdin_default$r);
  15112. const [name$i, bem$h] = createNamespace("skeleton-title");
  15113. const skeletonTitleProps = {
  15114. round: Boolean,
  15115. titleWidth: numericProp
  15116. };
  15117. var stdin_default$q = vue.defineComponent({
  15118. name: name$i,
  15119. props: skeletonTitleProps,
  15120. setup(props2) {
  15121. return () => vue.createVNode("h3", {
  15122. "class": bem$h([{
  15123. round: props2.round
  15124. }]),
  15125. "style": {
  15126. width: addUnit(props2.titleWidth)
  15127. }
  15128. }, null);
  15129. }
  15130. });
  15131. const SkeletonTitle = withInstall(stdin_default$q);
  15132. var stdin_default$p = SkeletonTitle;
  15133. const [name$h, bem$g] = createNamespace("skeleton-avatar");
  15134. const skeletonAvatarProps = {
  15135. avatarSize: numericProp,
  15136. avatarShape: makeStringProp("round")
  15137. };
  15138. var stdin_default$o = vue.defineComponent({
  15139. name: name$h,
  15140. props: skeletonAvatarProps,
  15141. setup(props2) {
  15142. return () => vue.createVNode("div", {
  15143. "class": bem$g([props2.avatarShape]),
  15144. "style": getSizeStyle(props2.avatarSize)
  15145. }, null);
  15146. }
  15147. });
  15148. const SkeletonAvatar = withInstall(stdin_default$o);
  15149. var stdin_default$n = SkeletonAvatar;
  15150. const DEFAULT_ROW_WIDTH = "100%";
  15151. const skeletonParagraphProps = {
  15152. round: Boolean,
  15153. rowWidth: {
  15154. type: numericProp,
  15155. default: DEFAULT_ROW_WIDTH
  15156. }
  15157. };
  15158. const [name$g, bem$f] = createNamespace("skeleton-paragraph");
  15159. var stdin_default$m = vue.defineComponent({
  15160. name: name$g,
  15161. props: skeletonParagraphProps,
  15162. setup(props2) {
  15163. return () => vue.createVNode("div", {
  15164. "class": bem$f([{
  15165. round: props2.round
  15166. }]),
  15167. "style": {
  15168. width: props2.rowWidth
  15169. }
  15170. }, null);
  15171. }
  15172. });
  15173. const SkeletonParagraph = withInstall(stdin_default$m);
  15174. var stdin_default$l = SkeletonParagraph;
  15175. const [name$f, bem$e] = createNamespace("skeleton");
  15176. const DEFAULT_LAST_ROW_WIDTH = "60%";
  15177. const skeletonProps = {
  15178. row: makeNumericProp(0),
  15179. round: Boolean,
  15180. title: Boolean,
  15181. titleWidth: numericProp,
  15182. avatar: Boolean,
  15183. avatarSize: numericProp,
  15184. avatarShape: makeStringProp("round"),
  15185. loading: truthProp,
  15186. animate: truthProp,
  15187. rowWidth: {
  15188. type: [Number, String, Array],
  15189. default: DEFAULT_ROW_WIDTH
  15190. }
  15191. };
  15192. var stdin_default$k = vue.defineComponent({
  15193. name: name$f,
  15194. inheritAttrs: false,
  15195. props: skeletonProps,
  15196. setup(props2, {
  15197. slots,
  15198. attrs
  15199. }) {
  15200. const renderAvatar = () => {
  15201. if (props2.avatar) {
  15202. return vue.createVNode(stdin_default$n, {
  15203. "avatarShape": props2.avatarShape,
  15204. "avatarSize": props2.avatarSize
  15205. }, null);
  15206. }
  15207. };
  15208. const renderTitle = () => {
  15209. if (props2.title) {
  15210. return vue.createVNode(stdin_default$p, {
  15211. "round": props2.round,
  15212. "titleWidth": props2.titleWidth
  15213. }, null);
  15214. }
  15215. };
  15216. const getRowWidth = (index) => {
  15217. const {
  15218. rowWidth
  15219. } = props2;
  15220. if (rowWidth === DEFAULT_ROW_WIDTH && index === +props2.row - 1) {
  15221. return DEFAULT_LAST_ROW_WIDTH;
  15222. }
  15223. if (Array.isArray(rowWidth)) {
  15224. return rowWidth[index];
  15225. }
  15226. return rowWidth;
  15227. };
  15228. const renderRows = () => Array(+props2.row).fill("").map((_, i) => vue.createVNode(stdin_default$l, {
  15229. "key": i,
  15230. "round": props2.round,
  15231. "rowWidth": addUnit(getRowWidth(i))
  15232. }, null));
  15233. const renderContents = () => {
  15234. if (slots.template) {
  15235. return slots.template();
  15236. }
  15237. return vue.createVNode(vue.Fragment, null, [renderAvatar(), vue.createVNode("div", {
  15238. "class": bem$e("content")
  15239. }, [renderTitle(), renderRows()])]);
  15240. };
  15241. return () => {
  15242. var _a;
  15243. if (!props2.loading) {
  15244. return (_a = slots.default) == null ? void 0 : _a.call(slots);
  15245. }
  15246. return vue.createVNode("div", vue.mergeProps({
  15247. "class": bem$e({
  15248. animate: props2.animate,
  15249. round: props2.round
  15250. })
  15251. }, attrs), [renderContents()]);
  15252. };
  15253. }
  15254. });
  15255. const Skeleton = withInstall(stdin_default$k);
  15256. const [name$e, bem$d] = createNamespace("skeleton-image");
  15257. const skeletonImageProps = {
  15258. imageSize: numericProp,
  15259. imageShape: makeStringProp("square")
  15260. };
  15261. var stdin_default$j = vue.defineComponent({
  15262. name: name$e,
  15263. props: skeletonImageProps,
  15264. setup(props2) {
  15265. return () => vue.createVNode("div", {
  15266. "class": bem$d([props2.imageShape]),
  15267. "style": getSizeStyle(props2.imageSize)
  15268. }, [vue.createVNode(Icon, {
  15269. "name": "photo",
  15270. "class": bem$d("icon")
  15271. }, null)]);
  15272. }
  15273. });
  15274. const SkeletonImage = withInstall(stdin_default$j);
  15275. const [name$d, bem$c] = createNamespace("slider");
  15276. const sliderProps = {
  15277. min: makeNumericProp(0),
  15278. max: makeNumericProp(100),
  15279. step: makeNumericProp(1),
  15280. range: Boolean,
  15281. reverse: Boolean,
  15282. disabled: Boolean,
  15283. readonly: Boolean,
  15284. vertical: Boolean,
  15285. barHeight: numericProp,
  15286. buttonSize: numericProp,
  15287. activeColor: String,
  15288. inactiveColor: String,
  15289. modelValue: {
  15290. type: [Number, Array],
  15291. default: 0
  15292. }
  15293. };
  15294. var stdin_default$i = vue.defineComponent({
  15295. name: name$d,
  15296. props: sliderProps,
  15297. emits: ["change", "dragEnd", "dragStart", "update:modelValue"],
  15298. setup(props2, {
  15299. emit,
  15300. slots
  15301. }) {
  15302. let buttonIndex;
  15303. let current2;
  15304. let startValue;
  15305. const root = vue.ref();
  15306. const slider = [vue.ref(), vue.ref()];
  15307. const dragStatus = vue.ref();
  15308. const touch = useTouch();
  15309. const scope = vue.computed(() => Number(props2.max) - Number(props2.min));
  15310. const wrapperStyle = vue.computed(() => {
  15311. const crossAxis = props2.vertical ? "width" : "height";
  15312. return {
  15313. background: props2.inactiveColor,
  15314. [crossAxis]: addUnit(props2.barHeight)
  15315. };
  15316. });
  15317. const isRange = (val) => props2.range && Array.isArray(val);
  15318. const calcMainAxis = () => {
  15319. const {
  15320. modelValue,
  15321. min
  15322. } = props2;
  15323. if (isRange(modelValue)) {
  15324. return `${(modelValue[1] - modelValue[0]) * 100 / scope.value}%`;
  15325. }
  15326. return `${(modelValue - Number(min)) * 100 / scope.value}%`;
  15327. };
  15328. const calcOffset = () => {
  15329. const {
  15330. modelValue,
  15331. min
  15332. } = props2;
  15333. if (isRange(modelValue)) {
  15334. return `${(modelValue[0] - Number(min)) * 100 / scope.value}%`;
  15335. }
  15336. return "0%";
  15337. };
  15338. const barStyle = vue.computed(() => {
  15339. const mainAxis = props2.vertical ? "height" : "width";
  15340. const style = {
  15341. [mainAxis]: calcMainAxis(),
  15342. background: props2.activeColor
  15343. };
  15344. if (dragStatus.value) {
  15345. style.transition = "none";
  15346. }
  15347. const getPositionKey = () => {
  15348. if (props2.vertical) {
  15349. return props2.reverse ? "bottom" : "top";
  15350. }
  15351. return props2.reverse ? "right" : "left";
  15352. };
  15353. style[getPositionKey()] = calcOffset();
  15354. return style;
  15355. });
  15356. const format2 = (value) => {
  15357. const min = +props2.min;
  15358. const max = +props2.max;
  15359. const step = +props2.step;
  15360. value = clamp(value, min, max);
  15361. const diff = Math.round((value - min) / step) * step;
  15362. return addNumber(min, diff);
  15363. };
  15364. const updateStartValue = () => {
  15365. const current22 = props2.modelValue;
  15366. if (isRange(current22)) {
  15367. startValue = current22.map(format2);
  15368. } else {
  15369. startValue = format2(current22);
  15370. }
  15371. };
  15372. const handleRangeValue = (value) => {
  15373. var _a, _b;
  15374. const left2 = (_a = value[0]) != null ? _a : Number(props2.min);
  15375. const right2 = (_b = value[1]) != null ? _b : Number(props2.max);
  15376. return left2 > right2 ? [right2, left2] : [left2, right2];
  15377. };
  15378. const updateValue = (value, end2) => {
  15379. if (isRange(value)) {
  15380. value = handleRangeValue(value).map(format2);
  15381. } else {
  15382. value = format2(value);
  15383. }
  15384. if (!isSameValue(value, props2.modelValue)) {
  15385. emit("update:modelValue", value);
  15386. }
  15387. if (end2 && !isSameValue(value, startValue)) {
  15388. emit("change", value);
  15389. }
  15390. };
  15391. const onClick = (event) => {
  15392. event.stopPropagation();
  15393. if (props2.disabled || props2.readonly) {
  15394. return;
  15395. }
  15396. updateStartValue();
  15397. const {
  15398. min,
  15399. reverse,
  15400. vertical,
  15401. modelValue
  15402. } = props2;
  15403. const rect = useRect(root);
  15404. const getDelta = () => {
  15405. if (vertical) {
  15406. if (reverse) {
  15407. return rect.bottom - event.clientY;
  15408. }
  15409. return event.clientY - rect.top;
  15410. }
  15411. if (reverse) {
  15412. return rect.right - event.clientX;
  15413. }
  15414. return event.clientX - rect.left;
  15415. };
  15416. const total = vertical ? rect.height : rect.width;
  15417. const value = Number(min) + getDelta() / total * scope.value;
  15418. if (isRange(modelValue)) {
  15419. const [left2, right2] = modelValue;
  15420. const middle = (left2 + right2) / 2;
  15421. if (value <= middle) {
  15422. updateValue([value, right2], true);
  15423. } else {
  15424. updateValue([left2, value], true);
  15425. }
  15426. } else {
  15427. updateValue(value, true);
  15428. }
  15429. };
  15430. const onTouchStart = (event) => {
  15431. if (props2.disabled || props2.readonly) {
  15432. return;
  15433. }
  15434. touch.start(event);
  15435. current2 = props2.modelValue;
  15436. updateStartValue();
  15437. dragStatus.value = "start";
  15438. };
  15439. const onTouchMove = (event) => {
  15440. if (props2.disabled || props2.readonly) {
  15441. return;
  15442. }
  15443. if (dragStatus.value === "start") {
  15444. emit("dragStart", event);
  15445. }
  15446. preventDefault(event, true);
  15447. touch.move(event);
  15448. dragStatus.value = "dragging";
  15449. const rect = useRect(root);
  15450. const delta = props2.vertical ? touch.deltaY.value : touch.deltaX.value;
  15451. const total = props2.vertical ? rect.height : rect.width;
  15452. let diff = delta / total * scope.value;
  15453. if (props2.reverse) {
  15454. diff = -diff;
  15455. }
  15456. if (isRange(startValue)) {
  15457. const index = props2.reverse ? 1 - buttonIndex : buttonIndex;
  15458. current2[index] = startValue[index] + diff;
  15459. } else {
  15460. current2 = startValue + diff;
  15461. }
  15462. updateValue(current2);
  15463. };
  15464. const onTouchEnd = (event) => {
  15465. if (props2.disabled || props2.readonly) {
  15466. return;
  15467. }
  15468. if (dragStatus.value === "dragging") {
  15469. updateValue(current2, true);
  15470. emit("dragEnd", event);
  15471. }
  15472. dragStatus.value = "";
  15473. };
  15474. const getButtonClassName = (index) => {
  15475. if (typeof index === "number") {
  15476. const position = ["left", "right"];
  15477. return bem$c(`button-wrapper`, position[index]);
  15478. }
  15479. return bem$c("button-wrapper", props2.reverse ? "left" : "right");
  15480. };
  15481. const renderButtonContent = (value, index) => {
  15482. const dragging = dragStatus.value === "dragging";
  15483. if (typeof index === "number") {
  15484. const slot = slots[index === 0 ? "left-button" : "right-button"];
  15485. let dragIndex;
  15486. if (dragging && Array.isArray(current2)) {
  15487. dragIndex = current2[0] > current2[1] ? buttonIndex ^ 1 : buttonIndex;
  15488. }
  15489. if (slot) {
  15490. return slot({
  15491. value,
  15492. dragging,
  15493. dragIndex
  15494. });
  15495. }
  15496. }
  15497. if (slots.button) {
  15498. return slots.button({
  15499. value,
  15500. dragging
  15501. });
  15502. }
  15503. return vue.createVNode("div", {
  15504. "class": bem$c("button"),
  15505. "style": getSizeStyle(props2.buttonSize)
  15506. }, null);
  15507. };
  15508. const renderButton = (index) => {
  15509. const current22 = typeof index === "number" ? props2.modelValue[index] : props2.modelValue;
  15510. return vue.createVNode("div", {
  15511. "ref": slider[index != null ? index : 0],
  15512. "role": "slider",
  15513. "class": getButtonClassName(index),
  15514. "tabindex": props2.disabled ? void 0 : 0,
  15515. "aria-valuemin": props2.min,
  15516. "aria-valuenow": current22,
  15517. "aria-valuemax": props2.max,
  15518. "aria-disabled": props2.disabled || void 0,
  15519. "aria-readonly": props2.readonly || void 0,
  15520. "aria-orientation": props2.vertical ? "vertical" : "horizontal",
  15521. "onTouchstartPassive": (event) => {
  15522. if (typeof index === "number") {
  15523. buttonIndex = index;
  15524. }
  15525. onTouchStart(event);
  15526. },
  15527. "onTouchend": onTouchEnd,
  15528. "onTouchcancel": onTouchEnd,
  15529. "onClick": stopPropagation
  15530. }, [renderButtonContent(current22, index)]);
  15531. };
  15532. updateValue(props2.modelValue);
  15533. useCustomFieldValue(() => props2.modelValue);
  15534. slider.forEach((item) => {
  15535. useEventListener("touchmove", onTouchMove, {
  15536. target: item
  15537. });
  15538. });
  15539. return () => vue.createVNode("div", {
  15540. "ref": root,
  15541. "style": wrapperStyle.value,
  15542. "class": bem$c({
  15543. vertical: props2.vertical,
  15544. disabled: props2.disabled
  15545. }),
  15546. "onClick": onClick
  15547. }, [vue.createVNode("div", {
  15548. "class": bem$c("bar"),
  15549. "style": barStyle.value
  15550. }, [props2.range ? [renderButton(0), renderButton(1)] : renderButton()])]);
  15551. }
  15552. });
  15553. const Slider = withInstall(stdin_default$i);
  15554. const [name$c, bem$b] = createNamespace("space");
  15555. const spaceProps = {
  15556. align: String,
  15557. direction: {
  15558. type: String,
  15559. default: "horizontal"
  15560. },
  15561. size: {
  15562. type: [Number, String, Array],
  15563. default: 8
  15564. },
  15565. wrap: Boolean,
  15566. fill: Boolean
  15567. };
  15568. function filterEmpty(children = []) {
  15569. const nodes = [];
  15570. children.forEach((child) => {
  15571. if (Array.isArray(child)) {
  15572. nodes.push(...child);
  15573. } else if (child.type === vue.Fragment) {
  15574. nodes.push(...filterEmpty(child.children));
  15575. } else {
  15576. nodes.push(child);
  15577. }
  15578. });
  15579. return nodes.filter((c) => {
  15580. var _a;
  15581. return !(c && (c.type === vue.Comment || c.type === vue.Fragment && ((_a = c.children) == null ? void 0 : _a.length) === 0 || c.type === vue.Text && c.children.trim() === ""));
  15582. });
  15583. }
  15584. var stdin_default$h = vue.defineComponent({
  15585. name: name$c,
  15586. props: spaceProps,
  15587. setup(props2, {
  15588. slots
  15589. }) {
  15590. const mergedAlign = vue.computed(() => {
  15591. var _a;
  15592. return (_a = props2.align) != null ? _a : props2.direction === "horizontal" ? "center" : "";
  15593. });
  15594. const getMargin = (size) => {
  15595. if (typeof size === "number") {
  15596. return size + "px";
  15597. }
  15598. return size;
  15599. };
  15600. const getMarginStyle = (isLast) => {
  15601. const style = {};
  15602. const marginRight = `${getMargin(Array.isArray(props2.size) ? props2.size[0] : props2.size)}`;
  15603. const marginBottom = `${getMargin(Array.isArray(props2.size) ? props2.size[1] : props2.size)}`;
  15604. if (isLast) {
  15605. return props2.wrap ? {
  15606. marginBottom
  15607. } : {};
  15608. }
  15609. if (props2.direction === "horizontal") {
  15610. style.marginRight = marginRight;
  15611. }
  15612. if (props2.direction === "vertical" || props2.wrap) {
  15613. style.marginBottom = marginBottom;
  15614. }
  15615. return style;
  15616. };
  15617. return () => {
  15618. var _a;
  15619. const children = filterEmpty((_a = slots.default) == null ? void 0 : _a.call(slots));
  15620. return vue.createVNode("div", {
  15621. "class": [bem$b({
  15622. [props2.direction]: props2.direction,
  15623. [`align-${mergedAlign.value}`]: mergedAlign.value,
  15624. wrap: props2.wrap,
  15625. fill: props2.fill
  15626. })]
  15627. }, [children.map((c, i) => vue.createVNode("div", {
  15628. "key": `item-${i}`,
  15629. "class": `${name$c}-item`,
  15630. "style": getMarginStyle(i === children.length - 1)
  15631. }, [c]))]);
  15632. };
  15633. }
  15634. });
  15635. const Space = withInstall(stdin_default$h);
  15636. const [name$b, bem$a] = createNamespace("steps");
  15637. const stepsProps = {
  15638. active: makeNumericProp(0),
  15639. direction: makeStringProp("horizontal"),
  15640. activeIcon: makeStringProp("checked"),
  15641. iconPrefix: String,
  15642. finishIcon: String,
  15643. activeColor: String,
  15644. inactiveIcon: String,
  15645. inactiveColor: String
  15646. };
  15647. const STEPS_KEY = Symbol(name$b);
  15648. var stdin_default$g = vue.defineComponent({
  15649. name: name$b,
  15650. props: stepsProps,
  15651. emits: ["clickStep"],
  15652. setup(props2, {
  15653. emit,
  15654. slots
  15655. }) {
  15656. const {
  15657. linkChildren
  15658. } = useChildren(STEPS_KEY);
  15659. const onClickStep = (index) => emit("clickStep", index);
  15660. linkChildren({
  15661. props: props2,
  15662. onClickStep
  15663. });
  15664. return () => {
  15665. var _a;
  15666. return vue.createVNode("div", {
  15667. "class": bem$a([props2.direction])
  15668. }, [vue.createVNode("div", {
  15669. "class": bem$a("items")
  15670. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  15671. };
  15672. }
  15673. });
  15674. const [name$a, bem$9] = createNamespace("step");
  15675. var stdin_default$f = vue.defineComponent({
  15676. name: name$a,
  15677. setup(props2, {
  15678. slots
  15679. }) {
  15680. const {
  15681. parent,
  15682. index
  15683. } = useParent(STEPS_KEY);
  15684. if (!parent) {
  15685. return;
  15686. }
  15687. const parentProps = parent.props;
  15688. const getStatus = () => {
  15689. const active = +parentProps.active;
  15690. if (index.value < active) {
  15691. return "finish";
  15692. }
  15693. return index.value === active ? "process" : "waiting";
  15694. };
  15695. const isActive = () => getStatus() === "process";
  15696. const lineStyle = vue.computed(() => ({
  15697. background: getStatus() === "finish" ? parentProps.activeColor : parentProps.inactiveColor
  15698. }));
  15699. const titleStyle = vue.computed(() => {
  15700. if (isActive()) {
  15701. return {
  15702. color: parentProps.activeColor
  15703. };
  15704. }
  15705. if (getStatus() === "waiting") {
  15706. return {
  15707. color: parentProps.inactiveColor
  15708. };
  15709. }
  15710. });
  15711. const onClickStep = () => parent.onClickStep(index.value);
  15712. const renderCircle = () => {
  15713. const {
  15714. iconPrefix,
  15715. finishIcon,
  15716. activeIcon,
  15717. activeColor,
  15718. inactiveIcon
  15719. } = parentProps;
  15720. if (isActive()) {
  15721. if (slots["active-icon"]) {
  15722. return slots["active-icon"]();
  15723. }
  15724. return vue.createVNode(Icon, {
  15725. "class": bem$9("icon", "active"),
  15726. "name": activeIcon,
  15727. "color": activeColor,
  15728. "classPrefix": iconPrefix
  15729. }, null);
  15730. }
  15731. if (getStatus() === "finish" && (finishIcon || slots["finish-icon"])) {
  15732. if (slots["finish-icon"]) {
  15733. return slots["finish-icon"]();
  15734. }
  15735. return vue.createVNode(Icon, {
  15736. "class": bem$9("icon", "finish"),
  15737. "name": finishIcon,
  15738. "color": activeColor,
  15739. "classPrefix": iconPrefix
  15740. }, null);
  15741. }
  15742. if (slots["inactive-icon"]) {
  15743. return slots["inactive-icon"]();
  15744. }
  15745. if (inactiveIcon) {
  15746. return vue.createVNode(Icon, {
  15747. "class": bem$9("icon"),
  15748. "name": inactiveIcon,
  15749. "classPrefix": iconPrefix
  15750. }, null);
  15751. }
  15752. return vue.createVNode("i", {
  15753. "class": bem$9("circle"),
  15754. "style": lineStyle.value
  15755. }, null);
  15756. };
  15757. return () => {
  15758. var _a;
  15759. const status = getStatus();
  15760. return vue.createVNode("div", {
  15761. "class": [BORDER, bem$9([parentProps.direction, {
  15762. [status]: status
  15763. }])]
  15764. }, [vue.createVNode("div", {
  15765. "class": bem$9("title", {
  15766. active: isActive()
  15767. }),
  15768. "style": titleStyle.value,
  15769. "onClick": onClickStep
  15770. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), vue.createVNode("div", {
  15771. "class": bem$9("circle-container"),
  15772. "onClick": onClickStep
  15773. }, [renderCircle()]), vue.createVNode("div", {
  15774. "class": bem$9("line"),
  15775. "style": lineStyle.value
  15776. }, null)]);
  15777. };
  15778. }
  15779. });
  15780. const Step = withInstall(stdin_default$f);
  15781. const [name$9, bem$8] = createNamespace("stepper");
  15782. const LONG_PRESS_INTERVAL = 200;
  15783. const isEqual = (value1, value2) => String(value1) === String(value2);
  15784. const stepperProps = {
  15785. min: makeNumericProp(1),
  15786. max: makeNumericProp(Infinity),
  15787. name: makeNumericProp(""),
  15788. step: makeNumericProp(1),
  15789. theme: String,
  15790. integer: Boolean,
  15791. disabled: Boolean,
  15792. showPlus: truthProp,
  15793. showMinus: truthProp,
  15794. showInput: truthProp,
  15795. longPress: truthProp,
  15796. autoFixed: truthProp,
  15797. allowEmpty: Boolean,
  15798. modelValue: numericProp,
  15799. inputWidth: numericProp,
  15800. buttonSize: numericProp,
  15801. placeholder: String,
  15802. disablePlus: Boolean,
  15803. disableMinus: Boolean,
  15804. disableInput: Boolean,
  15805. beforeChange: Function,
  15806. defaultValue: makeNumericProp(1),
  15807. decimalLength: numericProp
  15808. };
  15809. var stdin_default$e = vue.defineComponent({
  15810. name: name$9,
  15811. props: stepperProps,
  15812. emits: ["plus", "blur", "minus", "focus", "change", "overlimit", "update:modelValue"],
  15813. setup(props2, {
  15814. emit
  15815. }) {
  15816. const format2 = (value, autoFixed = true) => {
  15817. const {
  15818. min,
  15819. max,
  15820. allowEmpty,
  15821. decimalLength
  15822. } = props2;
  15823. if (allowEmpty && value === "") {
  15824. return value;
  15825. }
  15826. value = formatNumber(String(value), !props2.integer);
  15827. value = value === "" ? 0 : +value;
  15828. value = Number.isNaN(value) ? +min : value;
  15829. value = autoFixed ? Math.max(Math.min(+max, value), +min) : value;
  15830. if (isDef(decimalLength)) {
  15831. value = value.toFixed(+decimalLength);
  15832. }
  15833. return value;
  15834. };
  15835. const getInitialValue = () => {
  15836. var _a;
  15837. const defaultValue = (_a = props2.modelValue) != null ? _a : props2.defaultValue;
  15838. const value = format2(defaultValue);
  15839. if (!isEqual(value, props2.modelValue)) {
  15840. emit("update:modelValue", value);
  15841. }
  15842. return value;
  15843. };
  15844. let actionType;
  15845. const inputRef = vue.ref();
  15846. const current2 = vue.ref(getInitialValue());
  15847. const minusDisabled = vue.computed(() => props2.disabled || props2.disableMinus || +current2.value <= +props2.min);
  15848. const plusDisabled = vue.computed(() => props2.disabled || props2.disablePlus || +current2.value >= +props2.max);
  15849. const inputStyle = vue.computed(() => ({
  15850. width: addUnit(props2.inputWidth),
  15851. height: addUnit(props2.buttonSize)
  15852. }));
  15853. const buttonStyle = vue.computed(() => getSizeStyle(props2.buttonSize));
  15854. const check = () => {
  15855. const value = format2(current2.value);
  15856. if (!isEqual(value, current2.value)) {
  15857. current2.value = value;
  15858. }
  15859. };
  15860. const setValue = (value) => {
  15861. if (props2.beforeChange) {
  15862. callInterceptor(props2.beforeChange, {
  15863. args: [value],
  15864. done() {
  15865. current2.value = value;
  15866. }
  15867. });
  15868. } else {
  15869. current2.value = value;
  15870. }
  15871. };
  15872. const onChange = () => {
  15873. if (actionType === "plus" && plusDisabled.value || actionType === "minus" && minusDisabled.value) {
  15874. emit("overlimit", actionType);
  15875. return;
  15876. }
  15877. const diff = actionType === "minus" ? -props2.step : +props2.step;
  15878. const value = format2(addNumber(+current2.value, diff));
  15879. setValue(value);
  15880. emit(actionType);
  15881. };
  15882. const onInput = (event) => {
  15883. const input = event.target;
  15884. const {
  15885. value
  15886. } = input;
  15887. const {
  15888. decimalLength
  15889. } = props2;
  15890. let formatted = formatNumber(String(value), !props2.integer);
  15891. if (isDef(decimalLength) && formatted.includes(".")) {
  15892. const pair = formatted.split(".");
  15893. formatted = `${pair[0]}.${pair[1].slice(0, +decimalLength)}`;
  15894. }
  15895. if (props2.beforeChange) {
  15896. input.value = String(current2.value);
  15897. } else if (!isEqual(value, formatted)) {
  15898. input.value = formatted;
  15899. }
  15900. const isNumeric2 = formatted === String(+formatted);
  15901. setValue(isNumeric2 ? +formatted : formatted);
  15902. };
  15903. const onFocus = (event) => {
  15904. var _a;
  15905. if (props2.disableInput) {
  15906. (_a = inputRef.value) == null ? void 0 : _a.blur();
  15907. } else {
  15908. emit("focus", event);
  15909. }
  15910. };
  15911. const onBlur = (event) => {
  15912. const input = event.target;
  15913. const value = format2(input.value, props2.autoFixed);
  15914. input.value = String(value);
  15915. current2.value = value;
  15916. vue.nextTick(() => {
  15917. emit("blur", event);
  15918. resetScroll();
  15919. });
  15920. };
  15921. let isLongPress;
  15922. let longPressTimer;
  15923. const longPressStep = () => {
  15924. longPressTimer = setTimeout(() => {
  15925. onChange();
  15926. longPressStep();
  15927. }, LONG_PRESS_INTERVAL);
  15928. };
  15929. const onTouchStart = () => {
  15930. if (props2.longPress) {
  15931. isLongPress = false;
  15932. clearTimeout(longPressTimer);
  15933. longPressTimer = setTimeout(() => {
  15934. isLongPress = true;
  15935. onChange();
  15936. longPressStep();
  15937. }, LONG_PRESS_START_TIME);
  15938. }
  15939. };
  15940. const onTouchEnd = (event) => {
  15941. if (props2.longPress) {
  15942. clearTimeout(longPressTimer);
  15943. if (isLongPress) {
  15944. preventDefault(event);
  15945. }
  15946. }
  15947. };
  15948. const onMousedown = (event) => {
  15949. if (props2.disableInput) {
  15950. preventDefault(event);
  15951. }
  15952. };
  15953. const createListeners = (type) => ({
  15954. onClick: (event) => {
  15955. preventDefault(event);
  15956. actionType = type;
  15957. onChange();
  15958. },
  15959. onTouchstartPassive: () => {
  15960. actionType = type;
  15961. onTouchStart();
  15962. },
  15963. onTouchend: onTouchEnd,
  15964. onTouchcancel: onTouchEnd
  15965. });
  15966. vue.watch(() => [props2.max, props2.min, props2.integer, props2.decimalLength], check);
  15967. vue.watch(() => props2.modelValue, (value) => {
  15968. if (!isEqual(value, current2.value)) {
  15969. current2.value = format2(value);
  15970. }
  15971. });
  15972. vue.watch(current2, (value) => {
  15973. emit("update:modelValue", value);
  15974. emit("change", value, {
  15975. name: props2.name
  15976. });
  15977. });
  15978. useCustomFieldValue(() => props2.modelValue);
  15979. return () => vue.createVNode("div", {
  15980. "role": "group",
  15981. "class": bem$8([props2.theme])
  15982. }, [vue.withDirectives(vue.createVNode("button", vue.mergeProps({
  15983. "type": "button",
  15984. "style": buttonStyle.value,
  15985. "class": [bem$8("minus", {
  15986. disabled: minusDisabled.value
  15987. }), {
  15988. [HAPTICS_FEEDBACK]: !minusDisabled.value
  15989. }],
  15990. "aria-disabled": minusDisabled.value || void 0
  15991. }, createListeners("minus")), null), [[vue.vShow, props2.showMinus]]), vue.withDirectives(vue.createVNode("input", {
  15992. "ref": inputRef,
  15993. "type": props2.integer ? "tel" : "text",
  15994. "role": "spinbutton",
  15995. "class": bem$8("input"),
  15996. "value": current2.value,
  15997. "style": inputStyle.value,
  15998. "disabled": props2.disabled,
  15999. "readonly": props2.disableInput,
  16000. "inputmode": props2.integer ? "numeric" : "decimal",
  16001. "placeholder": props2.placeholder,
  16002. "autocomplete": "off",
  16003. "aria-valuemax": props2.max,
  16004. "aria-valuemin": props2.min,
  16005. "aria-valuenow": current2.value,
  16006. "onBlur": onBlur,
  16007. "onInput": onInput,
  16008. "onFocus": onFocus,
  16009. "onMousedown": onMousedown
  16010. }, null), [[vue.vShow, props2.showInput]]), vue.withDirectives(vue.createVNode("button", vue.mergeProps({
  16011. "type": "button",
  16012. "style": buttonStyle.value,
  16013. "class": [bem$8("plus", {
  16014. disabled: plusDisabled.value
  16015. }), {
  16016. [HAPTICS_FEEDBACK]: !plusDisabled.value
  16017. }],
  16018. "aria-disabled": plusDisabled.value || void 0
  16019. }, createListeners("plus")), null), [[vue.vShow, props2.showPlus]])]);
  16020. }
  16021. });
  16022. const Stepper = withInstall(stdin_default$e);
  16023. const Steps = withInstall(stdin_default$g);
  16024. const [name$8, bem$7, t$1] = createNamespace("submit-bar");
  16025. const submitBarProps = {
  16026. tip: String,
  16027. label: String,
  16028. price: Number,
  16029. tipIcon: String,
  16030. loading: Boolean,
  16031. currency: makeStringProp("¥"),
  16032. disabled: Boolean,
  16033. textAlign: String,
  16034. buttonText: String,
  16035. buttonType: makeStringProp("danger"),
  16036. buttonColor: String,
  16037. suffixLabel: String,
  16038. placeholder: Boolean,
  16039. decimalLength: makeNumericProp(2),
  16040. safeAreaInsetBottom: truthProp
  16041. };
  16042. var stdin_default$d = vue.defineComponent({
  16043. name: name$8,
  16044. props: submitBarProps,
  16045. emits: ["submit"],
  16046. setup(props2, {
  16047. emit,
  16048. slots
  16049. }) {
  16050. const root = vue.ref();
  16051. const renderPlaceholder = usePlaceholder(root, bem$7);
  16052. const renderText = () => {
  16053. const {
  16054. price,
  16055. label,
  16056. currency,
  16057. textAlign,
  16058. suffixLabel,
  16059. decimalLength
  16060. } = props2;
  16061. if (typeof price === "number") {
  16062. const pricePair = (price / 100).toFixed(+decimalLength).split(".");
  16063. const decimal = decimalLength ? `.${pricePair[1]}` : "";
  16064. return vue.createVNode("div", {
  16065. "class": bem$7("text"),
  16066. "style": {
  16067. textAlign
  16068. }
  16069. }, [vue.createVNode("span", null, [label || t$1("label")]), vue.createVNode("span", {
  16070. "class": bem$7("price")
  16071. }, [currency, vue.createVNode("span", {
  16072. "class": bem$7("price-integer")
  16073. }, [pricePair[0]]), decimal]), suffixLabel && vue.createVNode("span", {
  16074. "class": bem$7("suffix-label")
  16075. }, [suffixLabel])]);
  16076. }
  16077. };
  16078. const renderTip = () => {
  16079. var _a;
  16080. const {
  16081. tip,
  16082. tipIcon
  16083. } = props2;
  16084. if (slots.tip || tip) {
  16085. return vue.createVNode("div", {
  16086. "class": bem$7("tip")
  16087. }, [tipIcon && vue.createVNode(Icon, {
  16088. "class": bem$7("tip-icon"),
  16089. "name": tipIcon
  16090. }, null), tip && vue.createVNode("span", {
  16091. "class": bem$7("tip-text")
  16092. }, [tip]), (_a = slots.tip) == null ? void 0 : _a.call(slots)]);
  16093. }
  16094. };
  16095. const onClickButton = () => emit("submit");
  16096. const renderButton = () => {
  16097. if (slots.button) {
  16098. return slots.button();
  16099. }
  16100. return vue.createVNode(Button, {
  16101. "round": true,
  16102. "type": props2.buttonType,
  16103. "text": props2.buttonText,
  16104. "class": bem$7("button", props2.buttonType),
  16105. "color": props2.buttonColor,
  16106. "loading": props2.loading,
  16107. "disabled": props2.disabled,
  16108. "onClick": onClickButton
  16109. }, null);
  16110. };
  16111. const renderSubmitBar = () => {
  16112. var _a, _b;
  16113. return vue.createVNode("div", {
  16114. "ref": root,
  16115. "class": [bem$7(), {
  16116. "van-safe-area-bottom": props2.safeAreaInsetBottom
  16117. }]
  16118. }, [(_a = slots.top) == null ? void 0 : _a.call(slots), renderTip(), vue.createVNode("div", {
  16119. "class": bem$7("bar")
  16120. }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
  16121. };
  16122. return () => {
  16123. if (props2.placeholder) {
  16124. return renderPlaceholder(renderSubmitBar);
  16125. }
  16126. return renderSubmitBar();
  16127. };
  16128. }
  16129. });
  16130. const SubmitBar = withInstall(stdin_default$d);
  16131. const [name$7, bem$6] = createNamespace("swipe-cell");
  16132. const swipeCellProps = {
  16133. name: makeNumericProp(""),
  16134. disabled: Boolean,
  16135. leftWidth: numericProp,
  16136. rightWidth: numericProp,
  16137. beforeClose: Function,
  16138. stopPropagation: Boolean
  16139. };
  16140. var stdin_default$c = vue.defineComponent({
  16141. name: name$7,
  16142. props: swipeCellProps,
  16143. emits: ["open", "close", "click"],
  16144. setup(props2, {
  16145. emit,
  16146. slots
  16147. }) {
  16148. let opened;
  16149. let lockClick2;
  16150. let startOffset;
  16151. let isInBeforeClosing;
  16152. const root = vue.ref();
  16153. const leftRef = vue.ref();
  16154. const rightRef = vue.ref();
  16155. const state = vue.reactive({
  16156. offset: 0,
  16157. dragging: false
  16158. });
  16159. const touch = useTouch();
  16160. const getWidthByRef = (ref2) => ref2.value ? useRect(ref2).width : 0;
  16161. const leftWidth = vue.computed(() => isDef(props2.leftWidth) ? +props2.leftWidth : getWidthByRef(leftRef));
  16162. const rightWidth = vue.computed(() => isDef(props2.rightWidth) ? +props2.rightWidth : getWidthByRef(rightRef));
  16163. const open = (side) => {
  16164. state.offset = side === "left" ? leftWidth.value : -rightWidth.value;
  16165. if (!opened) {
  16166. opened = true;
  16167. emit("open", {
  16168. name: props2.name,
  16169. position: side
  16170. });
  16171. }
  16172. };
  16173. const close = (position) => {
  16174. state.offset = 0;
  16175. if (opened) {
  16176. opened = false;
  16177. emit("close", {
  16178. name: props2.name,
  16179. position
  16180. });
  16181. }
  16182. };
  16183. const toggle = (side) => {
  16184. const offset2 = Math.abs(state.offset);
  16185. const THRESHOLD = 0.15;
  16186. const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
  16187. const width2 = side === "left" ? leftWidth.value : rightWidth.value;
  16188. if (width2 && offset2 > width2 * threshold) {
  16189. open(side);
  16190. } else {
  16191. close(side);
  16192. }
  16193. };
  16194. const onTouchStart = (event) => {
  16195. if (!props2.disabled) {
  16196. startOffset = state.offset;
  16197. touch.start(event);
  16198. }
  16199. };
  16200. const onTouchMove = (event) => {
  16201. if (props2.disabled) {
  16202. return;
  16203. }
  16204. const {
  16205. deltaX
  16206. } = touch;
  16207. touch.move(event);
  16208. if (touch.isHorizontal()) {
  16209. lockClick2 = true;
  16210. state.dragging = true;
  16211. const isEdge = !opened || deltaX.value * startOffset < 0;
  16212. if (isEdge) {
  16213. preventDefault(event, props2.stopPropagation);
  16214. }
  16215. state.offset = clamp(deltaX.value + startOffset, -rightWidth.value, leftWidth.value);
  16216. }
  16217. };
  16218. const onTouchEnd = () => {
  16219. if (state.dragging) {
  16220. state.dragging = false;
  16221. toggle(state.offset > 0 ? "left" : "right");
  16222. setTimeout(() => {
  16223. lockClick2 = false;
  16224. }, 0);
  16225. }
  16226. };
  16227. const onClick = (position = "outside", event) => {
  16228. if (isInBeforeClosing) return;
  16229. emit("click", position);
  16230. if (opened && !lockClick2) {
  16231. isInBeforeClosing = true;
  16232. callInterceptor(props2.beforeClose, {
  16233. args: [{
  16234. event,
  16235. name: props2.name,
  16236. position
  16237. }],
  16238. done: () => {
  16239. isInBeforeClosing = false;
  16240. close(position);
  16241. },
  16242. canceled: () => isInBeforeClosing = false,
  16243. error: () => isInBeforeClosing = false
  16244. });
  16245. }
  16246. };
  16247. const getClickHandler = (position, stop) => (event) => {
  16248. if (stop) {
  16249. event.stopPropagation();
  16250. }
  16251. if (lockClick2) {
  16252. return;
  16253. }
  16254. onClick(position, event);
  16255. };
  16256. const renderSideContent = (side, ref2) => {
  16257. const contentSlot = slots[side];
  16258. if (contentSlot) {
  16259. return vue.createVNode("div", {
  16260. "ref": ref2,
  16261. "class": bem$6(side),
  16262. "onClick": getClickHandler(side, true)
  16263. }, [contentSlot()]);
  16264. }
  16265. };
  16266. useExpose({
  16267. open,
  16268. close
  16269. });
  16270. useClickAway(root, (event) => onClick("outside", event), {
  16271. eventName: "touchstart"
  16272. });
  16273. useEventListener("touchmove", onTouchMove, {
  16274. target: root
  16275. });
  16276. return () => {
  16277. var _a;
  16278. const wrapperStyle = {
  16279. transform: `translate3d(${state.offset}px, 0, 0)`,
  16280. transitionDuration: state.dragging ? "0s" : ".6s"
  16281. };
  16282. return vue.createVNode("div", {
  16283. "ref": root,
  16284. "class": bem$6(),
  16285. "onClick": getClickHandler("cell", lockClick2),
  16286. "onTouchstartPassive": onTouchStart,
  16287. "onTouchend": onTouchEnd,
  16288. "onTouchcancel": onTouchEnd
  16289. }, [vue.createVNode("div", {
  16290. "class": bem$6("wrapper"),
  16291. "style": wrapperStyle
  16292. }, [renderSideContent("left", leftRef), (_a = slots.default) == null ? void 0 : _a.call(slots), renderSideContent("right", rightRef)])]);
  16293. };
  16294. }
  16295. });
  16296. const SwipeCell = withInstall(stdin_default$c);
  16297. const [name$6, bem$5] = createNamespace("tabbar");
  16298. const tabbarProps = {
  16299. route: Boolean,
  16300. fixed: truthProp,
  16301. border: truthProp,
  16302. zIndex: numericProp,
  16303. placeholder: Boolean,
  16304. activeColor: String,
  16305. beforeChange: Function,
  16306. inactiveColor: String,
  16307. modelValue: makeNumericProp(0),
  16308. safeAreaInsetBottom: {
  16309. type: Boolean,
  16310. default: null
  16311. }
  16312. };
  16313. const TABBAR_KEY = Symbol(name$6);
  16314. var stdin_default$b = vue.defineComponent({
  16315. name: name$6,
  16316. props: tabbarProps,
  16317. emits: ["change", "update:modelValue"],
  16318. setup(props2, {
  16319. emit,
  16320. slots
  16321. }) {
  16322. const root = vue.ref();
  16323. const {
  16324. linkChildren
  16325. } = useChildren(TABBAR_KEY);
  16326. const renderPlaceholder = usePlaceholder(root, bem$5);
  16327. const enableSafeArea = () => {
  16328. var _a;
  16329. return (_a = props2.safeAreaInsetBottom) != null ? _a : props2.fixed;
  16330. };
  16331. const renderTabbar = () => {
  16332. var _a;
  16333. const {
  16334. fixed,
  16335. zIndex,
  16336. border
  16337. } = props2;
  16338. return vue.createVNode("div", {
  16339. "ref": root,
  16340. "role": "tablist",
  16341. "style": getZIndexStyle(zIndex),
  16342. "class": [bem$5({
  16343. fixed
  16344. }), {
  16345. [BORDER_TOP_BOTTOM]: border,
  16346. "van-safe-area-bottom": enableSafeArea()
  16347. }]
  16348. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  16349. };
  16350. const setActive = (active, afterChange) => {
  16351. callInterceptor(props2.beforeChange, {
  16352. args: [active],
  16353. done() {
  16354. emit("update:modelValue", active);
  16355. emit("change", active);
  16356. afterChange();
  16357. }
  16358. });
  16359. };
  16360. linkChildren({
  16361. props: props2,
  16362. setActive
  16363. });
  16364. return () => {
  16365. if (props2.fixed && props2.placeholder) {
  16366. return renderPlaceholder(renderTabbar);
  16367. }
  16368. return renderTabbar();
  16369. };
  16370. }
  16371. });
  16372. const Tabbar = withInstall(stdin_default$b);
  16373. const [name$5, bem$4] = createNamespace("tabbar-item");
  16374. const tabbarItemProps = extend({}, routeProps, {
  16375. dot: Boolean,
  16376. icon: String,
  16377. name: numericProp,
  16378. badge: numericProp,
  16379. badgeProps: Object,
  16380. iconPrefix: String
  16381. });
  16382. var stdin_default$a = vue.defineComponent({
  16383. name: name$5,
  16384. props: tabbarItemProps,
  16385. emits: ["click"],
  16386. setup(props2, {
  16387. emit,
  16388. slots
  16389. }) {
  16390. const route2 = useRoute();
  16391. const vm = vue.getCurrentInstance().proxy;
  16392. const {
  16393. parent,
  16394. index
  16395. } = useParent(TABBAR_KEY);
  16396. if (!parent) {
  16397. return;
  16398. }
  16399. const active = vue.computed(() => {
  16400. var _a;
  16401. const {
  16402. route: route22,
  16403. modelValue
  16404. } = parent.props;
  16405. if (route22 && "$route" in vm) {
  16406. const {
  16407. $route
  16408. } = vm;
  16409. const {
  16410. to
  16411. } = props2;
  16412. const config = isObject$1(to) ? to : {
  16413. path: to
  16414. };
  16415. return !!$route.matched.find((val) => {
  16416. const pathMatched = "path" in config && config.path === val.path;
  16417. const nameMatched = "name" in config && config.name === val.name;
  16418. return pathMatched || nameMatched;
  16419. });
  16420. }
  16421. return ((_a = props2.name) != null ? _a : index.value) === modelValue;
  16422. });
  16423. const onClick = (event) => {
  16424. var _a;
  16425. if (!active.value) {
  16426. parent.setActive((_a = props2.name) != null ? _a : index.value, route2);
  16427. }
  16428. emit("click", event);
  16429. };
  16430. const renderIcon = () => {
  16431. if (slots.icon) {
  16432. return slots.icon({
  16433. active: active.value
  16434. });
  16435. }
  16436. if (props2.icon) {
  16437. return vue.createVNode(Icon, {
  16438. "name": props2.icon,
  16439. "classPrefix": props2.iconPrefix
  16440. }, null);
  16441. }
  16442. };
  16443. return () => {
  16444. var _a;
  16445. const {
  16446. dot,
  16447. badge
  16448. } = props2;
  16449. const {
  16450. activeColor,
  16451. inactiveColor
  16452. } = parent.props;
  16453. const color = active.value ? activeColor : inactiveColor;
  16454. return vue.createVNode("div", {
  16455. "role": "tab",
  16456. "class": bem$4({
  16457. active: active.value
  16458. }),
  16459. "style": {
  16460. color
  16461. },
  16462. "tabindex": 0,
  16463. "aria-selected": active.value,
  16464. "onClick": onClick
  16465. }, [vue.createVNode(Badge, vue.mergeProps({
  16466. "dot": dot,
  16467. "class": bem$4("icon"),
  16468. "content": badge
  16469. }, props2.badgeProps), {
  16470. default: renderIcon
  16471. }), vue.createVNode("div", {
  16472. "class": bem$4("text")
  16473. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  16474. active: active.value
  16475. })])]);
  16476. };
  16477. }
  16478. });
  16479. const TabbarItem = withInstall(stdin_default$a);
  16480. const [name$4, bem$3] = createNamespace("text-ellipsis");
  16481. const textEllipsisProps = {
  16482. rows: makeNumericProp(1),
  16483. dots: makeStringProp("..."),
  16484. content: makeStringProp(""),
  16485. expandText: makeStringProp(""),
  16486. collapseText: makeStringProp(""),
  16487. position: makeStringProp("end")
  16488. };
  16489. var stdin_default$9 = vue.defineComponent({
  16490. name: name$4,
  16491. props: textEllipsisProps,
  16492. emits: ["clickAction"],
  16493. setup(props2, {
  16494. emit,
  16495. slots
  16496. }) {
  16497. const text = vue.ref(props2.content);
  16498. const expanded = vue.ref(false);
  16499. const hasAction = vue.ref(false);
  16500. const root = vue.ref();
  16501. const actionRef = vue.ref();
  16502. let needRecalculate = false;
  16503. const actionText = vue.computed(() => expanded.value ? props2.collapseText : props2.expandText);
  16504. const pxToNum = (value) => {
  16505. if (!value) return 0;
  16506. const match = value.match(/^\d*(\.\d*)?/);
  16507. return match ? Number(match[0]) : 0;
  16508. };
  16509. const cloneContainer = () => {
  16510. if (!root.value || !root.value.isConnected) return;
  16511. const originStyle = window.getComputedStyle(root.value);
  16512. const container = document.createElement("div");
  16513. const styleNames = Array.prototype.slice.apply(originStyle);
  16514. styleNames.forEach((name2) => {
  16515. container.style.setProperty(name2, originStyle.getPropertyValue(name2));
  16516. });
  16517. container.style.position = "fixed";
  16518. container.style.zIndex = "-9999";
  16519. container.style.top = "-9999px";
  16520. container.style.height = "auto";
  16521. container.style.minHeight = "auto";
  16522. container.style.maxHeight = "auto";
  16523. container.innerText = props2.content;
  16524. document.body.appendChild(container);
  16525. return container;
  16526. };
  16527. const calcEllipsisText = (container, maxHeight) => {
  16528. var _a, _b;
  16529. const {
  16530. content,
  16531. position,
  16532. dots
  16533. } = props2;
  16534. const end2 = content.length;
  16535. const middle = 0 + end2 >> 1;
  16536. const actionHTML = slots.action ? (_b = (_a = actionRef.value) == null ? void 0 : _a.outerHTML) != null ? _b : "" : props2.expandText;
  16537. const calcEllipse = () => {
  16538. const tail = (left2, right2) => {
  16539. if (right2 - left2 <= 1) {
  16540. if (position === "end") {
  16541. return content.slice(0, left2) + dots;
  16542. }
  16543. return dots + content.slice(right2, end2);
  16544. }
  16545. const middle2 = Math.round((left2 + right2) / 2);
  16546. if (position === "end") {
  16547. container.innerText = content.slice(0, middle2) + dots;
  16548. } else {
  16549. container.innerText = dots + content.slice(middle2, end2);
  16550. }
  16551. container.innerHTML += actionHTML;
  16552. if (container.offsetHeight > maxHeight) {
  16553. if (position === "end") {
  16554. return tail(left2, middle2);
  16555. }
  16556. return tail(middle2, right2);
  16557. }
  16558. if (position === "end") {
  16559. return tail(middle2, right2);
  16560. }
  16561. return tail(left2, middle2);
  16562. };
  16563. return tail(0, end2);
  16564. };
  16565. const middleTail = (leftPart, rightPart) => {
  16566. if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
  16567. return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end2);
  16568. }
  16569. const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
  16570. const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
  16571. container.innerText = props2.content.slice(0, leftMiddle) + props2.dots + props2.content.slice(rightMiddle, end2);
  16572. container.innerHTML += actionHTML;
  16573. if (container.offsetHeight >= maxHeight) {
  16574. return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
  16575. }
  16576. return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
  16577. };
  16578. return props2.position === "middle" ? middleTail([0, middle], [middle, end2]) : calcEllipse();
  16579. };
  16580. const calcEllipsised = () => {
  16581. const container = cloneContainer();
  16582. if (!container) {
  16583. needRecalculate = true;
  16584. return;
  16585. }
  16586. const {
  16587. paddingBottom,
  16588. paddingTop,
  16589. lineHeight
  16590. } = container.style;
  16591. const maxHeight = Math.ceil((Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom));
  16592. if (maxHeight < container.offsetHeight) {
  16593. hasAction.value = true;
  16594. text.value = calcEllipsisText(container, maxHeight);
  16595. } else {
  16596. hasAction.value = false;
  16597. text.value = props2.content;
  16598. }
  16599. document.body.removeChild(container);
  16600. };
  16601. const toggle = (isExpanded = !expanded.value) => {
  16602. expanded.value = isExpanded;
  16603. };
  16604. const onClickAction = (event) => {
  16605. toggle();
  16606. emit("clickAction", event);
  16607. };
  16608. const renderAction = () => {
  16609. const action = slots.action ? slots.action({
  16610. expanded: expanded.value
  16611. }) : actionText.value;
  16612. return vue.createVNode("span", {
  16613. "ref": actionRef,
  16614. "class": bem$3("action"),
  16615. "onClick": onClickAction
  16616. }, [action]);
  16617. };
  16618. vue.onMounted(() => {
  16619. calcEllipsised();
  16620. if (slots.action) {
  16621. vue.nextTick(calcEllipsised);
  16622. }
  16623. });
  16624. vue.onActivated(() => {
  16625. if (needRecalculate) {
  16626. needRecalculate = false;
  16627. calcEllipsised();
  16628. }
  16629. });
  16630. vue.watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
  16631. useExpose({
  16632. toggle
  16633. });
  16634. return () => vue.createVNode("div", {
  16635. "ref": root,
  16636. "class": bem$3()
  16637. }, [expanded.value ? props2.content : text.value, hasAction.value ? renderAction() : null]);
  16638. }
  16639. });
  16640. const TextEllipsis = withInstall(stdin_default$9);
  16641. const [name$3] = createNamespace("time-picker");
  16642. const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
  16643. const fullColumns = ["hour", "minute", "second"];
  16644. const timePickerProps = extend({}, sharedProps, {
  16645. minHour: makeNumericProp(0),
  16646. maxHour: makeNumericProp(23),
  16647. minMinute: makeNumericProp(0),
  16648. maxMinute: makeNumericProp(59),
  16649. minSecond: makeNumericProp(0),
  16650. maxSecond: makeNumericProp(59),
  16651. minTime: {
  16652. type: String,
  16653. validator: validateTime
  16654. },
  16655. maxTime: {
  16656. type: String,
  16657. validator: validateTime
  16658. },
  16659. columnsType: {
  16660. type: Array,
  16661. default: () => ["hour", "minute"]
  16662. }
  16663. });
  16664. var stdin_default$8 = vue.defineComponent({
  16665. name: name$3,
  16666. props: timePickerProps,
  16667. emits: ["confirm", "cancel", "change", "update:modelValue"],
  16668. setup(props2, {
  16669. emit,
  16670. slots
  16671. }) {
  16672. const currentValues = vue.ref(props2.modelValue);
  16673. const pickerRef = vue.ref();
  16674. const getValidTime = (time) => {
  16675. const timeLimitArr = time.split(":");
  16676. return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
  16677. };
  16678. const confirm = () => {
  16679. var _a;
  16680. return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
  16681. };
  16682. const getSelectedTime = () => currentValues.value;
  16683. const columns = vue.computed(() => {
  16684. let {
  16685. minHour,
  16686. maxHour,
  16687. minMinute,
  16688. maxMinute,
  16689. minSecond,
  16690. maxSecond
  16691. } = props2;
  16692. if (props2.minTime || props2.maxTime) {
  16693. const fullTime = {
  16694. hour: 0,
  16695. minute: 0,
  16696. second: 0
  16697. };
  16698. props2.columnsType.forEach((col, i) => {
  16699. var _a;
  16700. fullTime[col] = (_a = currentValues.value[i]) != null ? _a : 0;
  16701. });
  16702. const {
  16703. hour,
  16704. minute
  16705. } = fullTime;
  16706. if (props2.minTime) {
  16707. const [minH, minM, minS] = getValidTime(props2.minTime);
  16708. minHour = minH;
  16709. minMinute = +hour <= +minHour ? minM : "00";
  16710. minSecond = +hour <= +minHour && +minute <= +minMinute ? minS : "00";
  16711. }
  16712. if (props2.maxTime) {
  16713. const [maxH, maxM, maxS] = getValidTime(props2.maxTime);
  16714. maxHour = maxH;
  16715. maxMinute = +hour >= +maxHour ? maxM : "59";
  16716. maxSecond = +hour >= +maxHour && +minute >= +maxMinute ? maxS : "59";
  16717. }
  16718. }
  16719. return props2.columnsType.map((type) => {
  16720. const {
  16721. filter,
  16722. formatter
  16723. } = props2;
  16724. switch (type) {
  16725. case "hour":
  16726. return genOptions(+minHour, +maxHour, type, formatter, filter, currentValues.value);
  16727. case "minute":
  16728. return genOptions(+minMinute, +maxMinute, type, formatter, filter, currentValues.value);
  16729. case "second":
  16730. return genOptions(+minSecond, +maxSecond, type, formatter, filter, currentValues.value);
  16731. default:
  16732. return [];
  16733. }
  16734. });
  16735. });
  16736. vue.watch(currentValues, (newValues) => {
  16737. if (!isSameValue(newValues, props2.modelValue)) {
  16738. emit("update:modelValue", newValues);
  16739. }
  16740. });
  16741. vue.watch(() => props2.modelValue, (newValues) => {
  16742. newValues = formatValueRange(newValues, columns.value);
  16743. if (!isSameValue(newValues, currentValues.value)) {
  16744. currentValues.value = newValues;
  16745. }
  16746. }, {
  16747. immediate: true
  16748. });
  16749. const onChange = (...args) => emit("change", ...args);
  16750. const onCancel = (...args) => emit("cancel", ...args);
  16751. const onConfirm = (...args) => emit("confirm", ...args);
  16752. useExpose({
  16753. confirm,
  16754. getSelectedTime
  16755. });
  16756. return () => vue.createVNode(Picker, vue.mergeProps({
  16757. "ref": pickerRef,
  16758. "modelValue": currentValues.value,
  16759. "onUpdate:modelValue": ($event) => currentValues.value = $event,
  16760. "columns": columns.value,
  16761. "onChange": onChange,
  16762. "onCancel": onCancel,
  16763. "onConfirm": onConfirm
  16764. }, pick(props2, pickerInheritKeys)), slots);
  16765. }
  16766. });
  16767. const TimePicker = withInstall(stdin_default$8);
  16768. const [name$2, bem$2] = createNamespace("tree-select");
  16769. const treeSelectProps = {
  16770. max: makeNumericProp(Infinity),
  16771. items: makeArrayProp(),
  16772. height: makeNumericProp(300),
  16773. selectedIcon: makeStringProp("success"),
  16774. mainActiveIndex: makeNumericProp(0),
  16775. activeId: {
  16776. type: [Number, String, Array],
  16777. default: 0
  16778. }
  16779. };
  16780. var stdin_default$7 = vue.defineComponent({
  16781. name: name$2,
  16782. props: treeSelectProps,
  16783. emits: ["clickNav", "clickItem", "update:activeId", "update:mainActiveIndex"],
  16784. setup(props2, {
  16785. emit,
  16786. slots
  16787. }) {
  16788. const isActiveItem = (id) => Array.isArray(props2.activeId) ? props2.activeId.includes(id) : props2.activeId === id;
  16789. const renderSubItem = (item) => {
  16790. const onClick = () => {
  16791. if (item.disabled) {
  16792. return;
  16793. }
  16794. let activeId;
  16795. if (Array.isArray(props2.activeId)) {
  16796. activeId = props2.activeId.slice();
  16797. const index = activeId.indexOf(item.id);
  16798. if (index !== -1) {
  16799. activeId.splice(index, 1);
  16800. } else if (activeId.length < +props2.max) {
  16801. activeId.push(item.id);
  16802. }
  16803. } else {
  16804. activeId = item.id;
  16805. }
  16806. emit("update:activeId", activeId);
  16807. emit("clickItem", item);
  16808. };
  16809. return vue.createVNode("div", {
  16810. "key": item.id,
  16811. "class": ["van-ellipsis", bem$2("item", {
  16812. active: isActiveItem(item.id),
  16813. disabled: item.disabled
  16814. })],
  16815. "onClick": onClick
  16816. }, [item.text, isActiveItem(item.id) && vue.createVNode(Icon, {
  16817. "name": props2.selectedIcon,
  16818. "class": bem$2("selected")
  16819. }, null)]);
  16820. };
  16821. const onSidebarChange = (index) => {
  16822. emit("update:mainActiveIndex", index);
  16823. };
  16824. const onClickSidebarItem = (index) => emit("clickNav", index);
  16825. const renderSidebar = () => {
  16826. const Items = props2.items.map((item) => vue.createVNode(SidebarItem, {
  16827. "dot": item.dot,
  16828. "badge": item.badge,
  16829. "class": [bem$2("nav-item"), item.className],
  16830. "disabled": item.disabled,
  16831. "onClick": onClickSidebarItem
  16832. }, {
  16833. title: () => slots["nav-text"] ? slots["nav-text"](item) : item.text
  16834. }));
  16835. return vue.createVNode(Sidebar, {
  16836. "class": bem$2("nav"),
  16837. "modelValue": props2.mainActiveIndex,
  16838. "onChange": onSidebarChange
  16839. }, {
  16840. default: () => [Items]
  16841. });
  16842. };
  16843. const renderContent = () => {
  16844. if (slots.content) {
  16845. return slots.content();
  16846. }
  16847. const selected = props2.items[+props2.mainActiveIndex] || {};
  16848. if (selected.children) {
  16849. return selected.children.map(renderSubItem);
  16850. }
  16851. };
  16852. return () => vue.createVNode("div", {
  16853. "class": bem$2(),
  16854. "style": {
  16855. height: addUnit(props2.height)
  16856. }
  16857. }, [renderSidebar(), vue.createVNode("div", {
  16858. "class": bem$2("content")
  16859. }, [renderContent()])]);
  16860. }
  16861. });
  16862. const TreeSelect = withInstall(stdin_default$7);
  16863. const [name$1, bem$1, t] = createNamespace("uploader");
  16864. function readFileContent(file, resultType) {
  16865. return new Promise((resolve) => {
  16866. if (resultType === "file") {
  16867. resolve();
  16868. return;
  16869. }
  16870. const reader = new FileReader();
  16871. reader.onload = (event) => {
  16872. resolve(event.target.result);
  16873. };
  16874. if (resultType === "dataUrl") {
  16875. reader.readAsDataURL(file);
  16876. } else if (resultType === "text") {
  16877. reader.readAsText(file);
  16878. }
  16879. });
  16880. }
  16881. function isOversize(items, maxSize) {
  16882. return toArray(items).some((item) => {
  16883. if (item.file) {
  16884. if (isFunction(maxSize)) {
  16885. return maxSize(item.file);
  16886. }
  16887. return item.file.size > +maxSize;
  16888. }
  16889. return false;
  16890. });
  16891. }
  16892. function filterFiles(items, maxSize) {
  16893. const valid = [];
  16894. const invalid = [];
  16895. items.forEach((item) => {
  16896. if (isOversize(item, maxSize)) {
  16897. invalid.push(item);
  16898. } else {
  16899. valid.push(item);
  16900. }
  16901. });
  16902. return { valid, invalid };
  16903. }
  16904. const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
  16905. const isImageUrl = (url) => IMAGE_REGEXP.test(url);
  16906. function isImageFile(item) {
  16907. if (item.isImage) {
  16908. return true;
  16909. }
  16910. if (item.file && item.file.type) {
  16911. return item.file.type.indexOf("image") === 0;
  16912. }
  16913. if (item.url) {
  16914. return isImageUrl(item.url);
  16915. }
  16916. if (typeof item.content === "string") {
  16917. return item.content.indexOf("data:image") === 0;
  16918. }
  16919. return false;
  16920. }
  16921. var stdin_default$6 = vue.defineComponent({
  16922. props: {
  16923. name: numericProp,
  16924. item: makeRequiredProp(Object),
  16925. index: Number,
  16926. imageFit: String,
  16927. lazyLoad: Boolean,
  16928. deletable: Boolean,
  16929. reupload: Boolean,
  16930. previewSize: [Number, String, Array],
  16931. beforeDelete: Function
  16932. },
  16933. emits: ["delete", "preview", "reupload"],
  16934. setup(props2, {
  16935. emit,
  16936. slots
  16937. }) {
  16938. const renderMask = () => {
  16939. const {
  16940. status,
  16941. message
  16942. } = props2.item;
  16943. if (status === "uploading" || status === "failed") {
  16944. const MaskIcon = status === "failed" ? vue.createVNode(Icon, {
  16945. "name": "close",
  16946. "class": bem$1("mask-icon")
  16947. }, null) : vue.createVNode(Loading, {
  16948. "class": bem$1("loading")
  16949. }, null);
  16950. const showMessage = isDef(message) && message !== "";
  16951. return vue.createVNode("div", {
  16952. "class": bem$1("mask")
  16953. }, [MaskIcon, showMessage && vue.createVNode("div", {
  16954. "class": bem$1("mask-message")
  16955. }, [message])]);
  16956. }
  16957. };
  16958. const onDelete = (event) => {
  16959. const {
  16960. name: name2,
  16961. item,
  16962. index,
  16963. beforeDelete
  16964. } = props2;
  16965. event.stopPropagation();
  16966. callInterceptor(beforeDelete, {
  16967. args: [item, {
  16968. name: name2,
  16969. index
  16970. }],
  16971. done: () => emit("delete")
  16972. });
  16973. };
  16974. const onPreview = () => emit("preview");
  16975. const onReupload = () => emit("reupload");
  16976. const renderDeleteIcon = () => {
  16977. if (props2.deletable && props2.item.status !== "uploading") {
  16978. const slot = slots["preview-delete"];
  16979. return vue.createVNode("div", {
  16980. "role": "button",
  16981. "class": bem$1("preview-delete", {
  16982. shadow: !slot
  16983. }),
  16984. "tabindex": 0,
  16985. "aria-label": t("delete"),
  16986. "onClick": onDelete
  16987. }, [slot ? slot() : vue.createVNode(Icon, {
  16988. "name": "cross",
  16989. "class": bem$1("preview-delete-icon")
  16990. }, null)]);
  16991. }
  16992. };
  16993. const renderCover = () => {
  16994. if (slots["preview-cover"]) {
  16995. const {
  16996. index,
  16997. item
  16998. } = props2;
  16999. return vue.createVNode("div", {
  17000. "class": bem$1("preview-cover")
  17001. }, [slots["preview-cover"](extend({
  17002. index
  17003. }, item))]);
  17004. }
  17005. };
  17006. const renderPreview = () => {
  17007. const {
  17008. item,
  17009. lazyLoad,
  17010. imageFit,
  17011. previewSize,
  17012. reupload
  17013. } = props2;
  17014. if (isImageFile(item)) {
  17015. return vue.createVNode(Image$1, {
  17016. "fit": imageFit,
  17017. "src": item.objectUrl || item.content || item.url,
  17018. "class": bem$1("preview-image"),
  17019. "width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
  17020. "height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
  17021. "lazyLoad": lazyLoad,
  17022. "onClick": reupload ? onReupload : onPreview
  17023. }, {
  17024. default: renderCover
  17025. });
  17026. }
  17027. return vue.createVNode("div", {
  17028. "class": bem$1("file"),
  17029. "style": getSizeStyle(props2.previewSize)
  17030. }, [vue.createVNode(Icon, {
  17031. "class": bem$1("file-icon"),
  17032. "name": "description"
  17033. }, null), vue.createVNode("div", {
  17034. "class": [bem$1("file-name"), "van-ellipsis"]
  17035. }, [item.file ? item.file.name : item.url]), renderCover()]);
  17036. };
  17037. return () => vue.createVNode("div", {
  17038. "class": bem$1("preview")
  17039. }, [renderPreview(), renderMask(), renderDeleteIcon()]);
  17040. }
  17041. });
  17042. const uploaderProps = {
  17043. name: makeNumericProp(""),
  17044. accept: makeStringProp("image/*"),
  17045. capture: String,
  17046. multiple: Boolean,
  17047. disabled: Boolean,
  17048. readonly: Boolean,
  17049. lazyLoad: Boolean,
  17050. maxCount: makeNumericProp(Infinity),
  17051. imageFit: makeStringProp("cover"),
  17052. resultType: makeStringProp("dataUrl"),
  17053. uploadIcon: makeStringProp("photograph"),
  17054. uploadText: String,
  17055. deletable: truthProp,
  17056. reupload: Boolean,
  17057. afterRead: Function,
  17058. showUpload: truthProp,
  17059. modelValue: makeArrayProp(),
  17060. beforeRead: Function,
  17061. beforeDelete: Function,
  17062. previewSize: [Number, String, Array],
  17063. previewImage: truthProp,
  17064. previewOptions: Object,
  17065. previewFullImage: truthProp,
  17066. maxSize: {
  17067. type: [Number, String, Function],
  17068. default: Infinity
  17069. }
  17070. };
  17071. var stdin_default$5 = vue.defineComponent({
  17072. name: name$1,
  17073. props: uploaderProps,
  17074. emits: ["delete", "oversize", "clickUpload", "closePreview", "clickPreview", "clickReupload", "update:modelValue"],
  17075. setup(props2, {
  17076. emit,
  17077. slots
  17078. }) {
  17079. const inputRef = vue.ref();
  17080. const urls = [];
  17081. const reuploadIndex = vue.ref(-1);
  17082. const isReuploading = vue.ref(false);
  17083. const getDetail = (index = props2.modelValue.length) => ({
  17084. name: props2.name,
  17085. index
  17086. });
  17087. const resetInput = () => {
  17088. if (inputRef.value) {
  17089. inputRef.value.value = "";
  17090. }
  17091. };
  17092. const onAfterRead = (items) => {
  17093. resetInput();
  17094. if (isOversize(items, props2.maxSize)) {
  17095. if (Array.isArray(items)) {
  17096. const result = filterFiles(items, props2.maxSize);
  17097. items = result.valid;
  17098. emit("oversize", result.invalid, getDetail());
  17099. if (!items.length) {
  17100. return;
  17101. }
  17102. } else {
  17103. emit("oversize", items, getDetail());
  17104. return;
  17105. }
  17106. }
  17107. items = vue.reactive(items);
  17108. if (reuploadIndex.value > -1) {
  17109. const arr = [...props2.modelValue];
  17110. arr.splice(reuploadIndex.value, 1, items);
  17111. emit("update:modelValue", arr);
  17112. reuploadIndex.value = -1;
  17113. } else {
  17114. emit("update:modelValue", [...props2.modelValue, ...toArray(items)]);
  17115. }
  17116. if (props2.afterRead) {
  17117. props2.afterRead(items, getDetail());
  17118. }
  17119. };
  17120. const readFile = (files) => {
  17121. const {
  17122. maxCount,
  17123. modelValue,
  17124. resultType
  17125. } = props2;
  17126. if (Array.isArray(files)) {
  17127. const remainCount = +maxCount - modelValue.length;
  17128. if (files.length > remainCount) {
  17129. files = files.slice(0, remainCount);
  17130. }
  17131. Promise.all(files.map((file) => readFileContent(file, resultType))).then((contents) => {
  17132. const fileList = files.map((file, index) => {
  17133. const result = {
  17134. file,
  17135. status: "",
  17136. message: "",
  17137. objectUrl: URL.createObjectURL(file)
  17138. };
  17139. if (contents[index]) {
  17140. result.content = contents[index];
  17141. }
  17142. return result;
  17143. });
  17144. onAfterRead(fileList);
  17145. });
  17146. } else {
  17147. readFileContent(files, resultType).then((content) => {
  17148. const result = {
  17149. file: files,
  17150. status: "",
  17151. message: "",
  17152. objectUrl: URL.createObjectURL(files)
  17153. };
  17154. if (content) {
  17155. result.content = content;
  17156. }
  17157. onAfterRead(result);
  17158. });
  17159. }
  17160. };
  17161. const onChange = (event) => {
  17162. const {
  17163. files
  17164. } = event.target;
  17165. if (props2.disabled || !files || !files.length) {
  17166. return;
  17167. }
  17168. const file = files.length === 1 ? files[0] : [].slice.call(files);
  17169. if (props2.beforeRead) {
  17170. const response = props2.beforeRead(file, getDetail());
  17171. if (!response) {
  17172. resetInput();
  17173. return;
  17174. }
  17175. if (isPromise(response)) {
  17176. response.then((data) => {
  17177. if (data) {
  17178. readFile(data);
  17179. } else {
  17180. readFile(file);
  17181. }
  17182. }).catch(resetInput);
  17183. return;
  17184. }
  17185. }
  17186. readFile(file);
  17187. };
  17188. let imagePreview;
  17189. const onClosePreview = () => emit("closePreview");
  17190. const previewImage = (item) => {
  17191. if (props2.previewFullImage) {
  17192. const imageFiles = props2.modelValue.filter(isImageFile);
  17193. const images = imageFiles.map((item2) => {
  17194. if (item2.objectUrl && !item2.url && item2.status !== "failed") {
  17195. item2.url = item2.objectUrl;
  17196. urls.push(item2.url);
  17197. }
  17198. return item2.url;
  17199. }).filter(Boolean);
  17200. imagePreview = showImagePreview(extend({
  17201. images,
  17202. startPosition: imageFiles.indexOf(item),
  17203. onClose: onClosePreview
  17204. }, props2.previewOptions));
  17205. }
  17206. };
  17207. const closeImagePreview = () => {
  17208. if (imagePreview) {
  17209. imagePreview.close();
  17210. }
  17211. };
  17212. const deleteFile = (item, index) => {
  17213. const fileList = props2.modelValue.slice(0);
  17214. fileList.splice(index, 1);
  17215. emit("update:modelValue", fileList);
  17216. emit("delete", item, getDetail(index));
  17217. };
  17218. const reuploadFile = (index) => {
  17219. isReuploading.value = true;
  17220. reuploadIndex.value = index;
  17221. vue.nextTick(() => chooseFile());
  17222. };
  17223. const onInputClick = () => {
  17224. if (!isReuploading.value) {
  17225. reuploadIndex.value = -1;
  17226. }
  17227. isReuploading.value = false;
  17228. };
  17229. const renderPreviewItem = (item, index) => {
  17230. const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
  17231. const previewData = extend(pick(props2, needPickData), pick(item, needPickData, true));
  17232. return vue.createVNode(stdin_default$6, vue.mergeProps({
  17233. "item": item,
  17234. "index": index,
  17235. "onClick": () => emit(props2.reupload ? "clickReupload" : "clickPreview", item, getDetail(index)),
  17236. "onDelete": () => deleteFile(item, index),
  17237. "onPreview": () => previewImage(item),
  17238. "onReupload": () => reuploadFile(index)
  17239. }, pick(props2, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
  17240. };
  17241. const renderPreviewList = () => {
  17242. if (props2.previewImage) {
  17243. return props2.modelValue.map(renderPreviewItem);
  17244. }
  17245. };
  17246. const onClickUpload = (event) => emit("clickUpload", event);
  17247. const renderUpload = () => {
  17248. const lessThanMax = props2.modelValue.length < +props2.maxCount;
  17249. const Input = props2.readonly ? null : vue.createVNode("input", {
  17250. "ref": inputRef,
  17251. "type": "file",
  17252. "class": bem$1("input"),
  17253. "accept": props2.accept,
  17254. "capture": props2.capture,
  17255. "multiple": props2.multiple && reuploadIndex.value === -1,
  17256. "disabled": props2.disabled,
  17257. "onChange": onChange,
  17258. "onClick": onInputClick
  17259. }, null);
  17260. if (slots.default) {
  17261. return vue.withDirectives(vue.createVNode("div", {
  17262. "class": bem$1("input-wrapper"),
  17263. "onClick": onClickUpload
  17264. }, [slots.default(), Input]), [[vue.vShow, lessThanMax]]);
  17265. }
  17266. return vue.withDirectives(vue.createVNode("div", {
  17267. "class": bem$1("upload", {
  17268. readonly: props2.readonly
  17269. }),
  17270. "style": getSizeStyle(props2.previewSize),
  17271. "onClick": onClickUpload
  17272. }, [vue.createVNode(Icon, {
  17273. "name": props2.uploadIcon,
  17274. "class": bem$1("upload-icon")
  17275. }, null), props2.uploadText && vue.createVNode("span", {
  17276. "class": bem$1("upload-text")
  17277. }, [props2.uploadText]), Input]), [[vue.vShow, props2.showUpload && lessThanMax]]);
  17278. };
  17279. const chooseFile = () => {
  17280. if (inputRef.value && !props2.disabled) {
  17281. inputRef.value.click();
  17282. }
  17283. };
  17284. vue.onBeforeUnmount(() => {
  17285. urls.forEach((url) => URL.revokeObjectURL(url));
  17286. });
  17287. useExpose({
  17288. chooseFile,
  17289. reuploadFile,
  17290. closeImagePreview
  17291. });
  17292. useCustomFieldValue(() => props2.modelValue);
  17293. return () => vue.createVNode("div", {
  17294. "class": bem$1()
  17295. }, [vue.createVNode("div", {
  17296. "class": bem$1("wrapper", {
  17297. disabled: props2.disabled
  17298. })
  17299. }, [renderPreviewList(), renderUpload()])]);
  17300. }
  17301. });
  17302. const Uploader = withInstall(stdin_default$5);
  17303. const [name, bem] = createNamespace("watermark");
  17304. const watermarkProps = {
  17305. gapX: makeNumberProp(0),
  17306. gapY: makeNumberProp(0),
  17307. image: String,
  17308. width: makeNumberProp(100),
  17309. height: makeNumberProp(100),
  17310. rotate: makeNumericProp(-22),
  17311. zIndex: numericProp,
  17312. content: String,
  17313. opacity: numericProp,
  17314. fullPage: truthProp,
  17315. textColor: makeStringProp("#dcdee0")
  17316. };
  17317. var stdin_default$4 = vue.defineComponent({
  17318. name,
  17319. props: watermarkProps,
  17320. setup(props2, {
  17321. slots
  17322. }) {
  17323. const svgElRef = vue.ref();
  17324. const watermarkUrl = vue.ref("");
  17325. const imageBase64 = vue.ref("");
  17326. const renderWatermark = () => {
  17327. const rotateStyle = {
  17328. transformOrigin: "center",
  17329. transform: `rotate(${props2.rotate}deg)`
  17330. };
  17331. const svgInner = () => {
  17332. if (props2.image && !slots.content) {
  17333. return vue.createVNode("image", {
  17334. "href": imageBase64.value,
  17335. "xlink:href": imageBase64.value,
  17336. "x": "0",
  17337. "y": "0",
  17338. "width": props2.width,
  17339. "height": props2.height,
  17340. "style": rotateStyle
  17341. }, null);
  17342. }
  17343. return vue.createVNode("foreignObject", {
  17344. "x": "0",
  17345. "y": "0",
  17346. "width": props2.width,
  17347. "height": props2.height
  17348. }, [vue.createVNode("div", {
  17349. "xmlns": "http://www.w3.org/1999/xhtml",
  17350. "style": rotateStyle
  17351. }, [slots.content ? slots.content() : vue.createVNode("span", {
  17352. "style": {
  17353. color: props2.textColor
  17354. }
  17355. }, [props2.content])])]);
  17356. };
  17357. const svgWidth = props2.width + props2.gapX;
  17358. const svgHeight = props2.height + props2.gapY;
  17359. return vue.createVNode("svg", {
  17360. "viewBox": `0 0 ${svgWidth} ${svgHeight}`,
  17361. "width": svgWidth,
  17362. "height": svgHeight,
  17363. "xmlns": "http://www.w3.org/2000/svg",
  17364. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  17365. "style": {
  17366. padding: `0 ${props2.gapX}px ${props2.gapY}px 0`,
  17367. opacity: props2.opacity
  17368. }
  17369. }, [svgInner()]);
  17370. };
  17371. const makeImageToBase64 = (url) => {
  17372. const canvas = document.createElement("canvas");
  17373. const image = new Image();
  17374. image.crossOrigin = "anonymous";
  17375. image.referrerPolicy = "no-referrer";
  17376. image.onload = () => {
  17377. canvas.width = image.naturalWidth;
  17378. canvas.height = image.naturalHeight;
  17379. const ctx = canvas.getContext("2d");
  17380. ctx == null ? void 0 : ctx.drawImage(image, 0, 0);
  17381. imageBase64.value = canvas.toDataURL();
  17382. };
  17383. image.src = url;
  17384. };
  17385. const makeSvgToBlobUrl = (svgStr) => {
  17386. const svgBlob = new Blob([svgStr], {
  17387. type: "image/svg+xml"
  17388. });
  17389. return URL.createObjectURL(svgBlob);
  17390. };
  17391. vue.watchEffect(() => {
  17392. if (props2.image) {
  17393. makeImageToBase64(props2.image);
  17394. }
  17395. });
  17396. vue.watch(() => [imageBase64.value, props2.content, props2.textColor, props2.height, props2.width, props2.rotate, props2.gapX, props2.gapY], () => {
  17397. vue.nextTick(() => {
  17398. if (svgElRef.value) {
  17399. if (watermarkUrl.value) {
  17400. URL.revokeObjectURL(watermarkUrl.value);
  17401. }
  17402. watermarkUrl.value = makeSvgToBlobUrl(svgElRef.value.innerHTML);
  17403. }
  17404. });
  17405. }, {
  17406. immediate: true
  17407. });
  17408. vue.onUnmounted(() => {
  17409. if (watermarkUrl.value) {
  17410. URL.revokeObjectURL(watermarkUrl.value);
  17411. }
  17412. });
  17413. return () => {
  17414. const style = extend({
  17415. backgroundImage: `url(${watermarkUrl.value})`
  17416. }, getZIndexStyle(props2.zIndex));
  17417. return vue.createVNode("div", {
  17418. "class": bem({
  17419. full: props2.fullPage
  17420. }),
  17421. "style": style
  17422. }, [vue.createVNode("div", {
  17423. "class": bem("wrapper"),
  17424. "ref": svgElRef
  17425. }, [renderWatermark()])]);
  17426. };
  17427. }
  17428. });
  17429. const Watermark = withInstall(stdin_default$4);
  17430. class ReactiveListener {
  17431. constructor({
  17432. el,
  17433. src,
  17434. error,
  17435. loading,
  17436. bindType,
  17437. $parent,
  17438. options,
  17439. cors,
  17440. elRenderer,
  17441. imageCache
  17442. }) {
  17443. this.el = el;
  17444. this.src = src;
  17445. this.error = error;
  17446. this.loading = loading;
  17447. this.bindType = bindType;
  17448. this.attempt = 0;
  17449. this.cors = cors;
  17450. this.naturalHeight = 0;
  17451. this.naturalWidth = 0;
  17452. this.options = options;
  17453. this.$parent = $parent;
  17454. this.elRenderer = elRenderer;
  17455. this.imageCache = imageCache;
  17456. this.performanceData = {
  17457. loadStart: 0,
  17458. loadEnd: 0
  17459. };
  17460. this.filter();
  17461. this.initState();
  17462. this.render("loading", false);
  17463. }
  17464. /*
  17465. * init listener state
  17466. * @return
  17467. */
  17468. initState() {
  17469. if ("dataset" in this.el) {
  17470. this.el.dataset.src = this.src;
  17471. } else {
  17472. this.el.setAttribute("data-src", this.src);
  17473. }
  17474. this.state = {
  17475. loading: false,
  17476. error: false,
  17477. loaded: false,
  17478. rendered: false
  17479. };
  17480. }
  17481. /*
  17482. * record performance
  17483. * @return
  17484. */
  17485. record(event) {
  17486. this.performanceData[event] = Date.now();
  17487. }
  17488. /*
  17489. * update image listener data
  17490. * @param {String} image uri
  17491. * @param {String} loading image uri
  17492. * @param {String} error image uri
  17493. * @return
  17494. */
  17495. update({ src, loading, error }) {
  17496. const oldSrc = this.src;
  17497. this.src = src;
  17498. this.loading = loading;
  17499. this.error = error;
  17500. this.filter();
  17501. if (oldSrc !== this.src) {
  17502. this.attempt = 0;
  17503. this.initState();
  17504. }
  17505. }
  17506. /*
  17507. * check el is in view
  17508. * @return {Boolean} el is in view
  17509. */
  17510. checkInView() {
  17511. const rect = useRect(this.el);
  17512. return rect.top < window.innerHeight * this.options.preLoad && rect.bottom > this.options.preLoadTop && rect.left < window.innerWidth * this.options.preLoad && rect.right > 0;
  17513. }
  17514. /*
  17515. * listener filter
  17516. */
  17517. filter() {
  17518. Object.keys(this.options.filter).forEach((key) => {
  17519. this.options.filter[key](this, this.options);
  17520. });
  17521. }
  17522. /*
  17523. * render loading first
  17524. * @params cb:Function
  17525. * @return
  17526. */
  17527. renderLoading(cb) {
  17528. this.state.loading = true;
  17529. loadImageAsync(
  17530. {
  17531. src: this.loading,
  17532. cors: this.cors
  17533. },
  17534. () => {
  17535. this.render("loading", false);
  17536. this.state.loading = false;
  17537. cb();
  17538. },
  17539. () => {
  17540. cb();
  17541. this.state.loading = false;
  17542. }
  17543. );
  17544. }
  17545. /*
  17546. * try load image and render it
  17547. * @return
  17548. */
  17549. load(onFinish = noop) {
  17550. if (this.attempt > this.options.attempt - 1 && this.state.error) {
  17551. onFinish();
  17552. return;
  17553. }
  17554. if (this.state.rendered && this.state.loaded) return;
  17555. if (this.imageCache.has(this.src)) {
  17556. this.state.loaded = true;
  17557. this.render("loaded", true);
  17558. this.state.rendered = true;
  17559. return onFinish();
  17560. }
  17561. this.renderLoading(() => {
  17562. var _a, _b;
  17563. this.attempt++;
  17564. (_b = (_a = this.options.adapter).beforeLoad) == null ? void 0 : _b.call(_a, this, this.options);
  17565. this.record("loadStart");
  17566. loadImageAsync(
  17567. {
  17568. src: this.src,
  17569. cors: this.cors
  17570. },
  17571. (data) => {
  17572. this.naturalHeight = data.naturalHeight;
  17573. this.naturalWidth = data.naturalWidth;
  17574. this.state.loaded = true;
  17575. this.state.error = false;
  17576. this.record("loadEnd");
  17577. this.render("loaded", false);
  17578. this.state.rendered = true;
  17579. this.imageCache.add(this.src);
  17580. onFinish();
  17581. },
  17582. (err) => {
  17583. !this.options.silent && console.error(err);
  17584. this.state.error = true;
  17585. this.state.loaded = false;
  17586. this.render("error", false);
  17587. }
  17588. );
  17589. });
  17590. }
  17591. /*
  17592. * render image
  17593. * @param {String} state to render // ['loading', 'src', 'error']
  17594. * @param {String} is form cache
  17595. * @return
  17596. */
  17597. render(state, cache) {
  17598. this.elRenderer(this, state, cache);
  17599. }
  17600. /*
  17601. * output performance data
  17602. * @return {Object} performance data
  17603. */
  17604. performance() {
  17605. let state = "loading";
  17606. let time = 0;
  17607. if (this.state.loaded) {
  17608. state = "loaded";
  17609. time = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1e3;
  17610. }
  17611. if (this.state.error) state = "error";
  17612. return {
  17613. src: this.src,
  17614. state,
  17615. time
  17616. };
  17617. }
  17618. /*
  17619. * $destroy
  17620. * @return
  17621. */
  17622. $destroy() {
  17623. this.el = null;
  17624. this.src = null;
  17625. this.error = null;
  17626. this.loading = null;
  17627. this.bindType = null;
  17628. this.attempt = 0;
  17629. }
  17630. }
  17631. const DEFAULT_URL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
  17632. const DEFAULT_EVENTS = [
  17633. "scroll",
  17634. "wheel",
  17635. "mousewheel",
  17636. "resize",
  17637. "animationend",
  17638. "transitionend",
  17639. "touchmove"
  17640. ];
  17641. const DEFAULT_OBSERVER_OPTIONS = {
  17642. rootMargin: "0px",
  17643. threshold: 0
  17644. };
  17645. function stdin_default$3() {
  17646. return class Lazy {
  17647. constructor({
  17648. preLoad,
  17649. error,
  17650. throttleWait,
  17651. preLoadTop,
  17652. dispatchEvent,
  17653. loading,
  17654. attempt,
  17655. silent = true,
  17656. scale,
  17657. listenEvents,
  17658. filter,
  17659. adapter,
  17660. observer,
  17661. observerOptions
  17662. }) {
  17663. this.mode = modeType.event;
  17664. this.listeners = [];
  17665. this.targetIndex = 0;
  17666. this.targets = [];
  17667. this.options = {
  17668. silent,
  17669. dispatchEvent: !!dispatchEvent,
  17670. throttleWait: throttleWait || 200,
  17671. preLoad: preLoad || 1.3,
  17672. preLoadTop: preLoadTop || 0,
  17673. error: error || DEFAULT_URL,
  17674. loading: loading || DEFAULT_URL,
  17675. attempt: attempt || 3,
  17676. scale: scale || getDPR(scale),
  17677. ListenEvents: listenEvents || DEFAULT_EVENTS,
  17678. supportWebp: supportWebp(),
  17679. filter: filter || {},
  17680. adapter: adapter || {},
  17681. observer: !!observer,
  17682. observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
  17683. };
  17684. this.initEvent();
  17685. this.imageCache = new ImageCache({ max: 200 });
  17686. this.lazyLoadHandler = throttle(
  17687. this.lazyLoadHandler.bind(this),
  17688. this.options.throttleWait
  17689. );
  17690. this.setMode(this.options.observer ? modeType.observer : modeType.event);
  17691. }
  17692. /**
  17693. * update config
  17694. * @param {Object} config params
  17695. * @return
  17696. */
  17697. config(options = {}) {
  17698. Object.assign(this.options, options);
  17699. }
  17700. /**
  17701. * output listener's load performance
  17702. * @return {Array}
  17703. */
  17704. performance() {
  17705. return this.listeners.map((item) => item.performance());
  17706. }
  17707. /*
  17708. * add lazy component to queue
  17709. * @param {Vue} vm lazy component instance
  17710. * @return
  17711. */
  17712. addLazyBox(vm) {
  17713. this.listeners.push(vm);
  17714. if (inBrowser) {
  17715. this.addListenerTarget(window);
  17716. this.observer && this.observer.observe(vm.el);
  17717. if (vm.$el && vm.$el.parentNode) {
  17718. this.addListenerTarget(vm.$el.parentNode);
  17719. }
  17720. }
  17721. }
  17722. /*
  17723. * add image listener to queue
  17724. * @param {DOM} el
  17725. * @param {object} binding vue directive binding
  17726. * @param {vnode} vnode vue directive vnode
  17727. * @return
  17728. */
  17729. add(el, binding, vnode) {
  17730. if (this.listeners.some((item) => item.el === el)) {
  17731. this.update(el, binding);
  17732. return vue.nextTick(this.lazyLoadHandler);
  17733. }
  17734. const value = this.valueFormatter(binding.value);
  17735. let { src } = value;
  17736. vue.nextTick(() => {
  17737. src = getBestSelectionFromSrcset(el, this.options.scale) || src;
  17738. this.observer && this.observer.observe(el);
  17739. const container = Object.keys(binding.modifiers)[0];
  17740. let $parent;
  17741. if (container) {
  17742. $parent = vnode.context.$refs[container];
  17743. $parent = $parent ? $parent.$el || $parent : document.getElementById(container);
  17744. }
  17745. if (!$parent) {
  17746. $parent = getScrollParent$1(el);
  17747. }
  17748. const newListener = new ReactiveListener({
  17749. bindType: binding.arg,
  17750. $parent,
  17751. el,
  17752. src,
  17753. loading: value.loading,
  17754. error: value.error,
  17755. cors: value.cors,
  17756. elRenderer: this.elRenderer.bind(this),
  17757. options: this.options,
  17758. imageCache: this.imageCache
  17759. });
  17760. this.listeners.push(newListener);
  17761. if (inBrowser) {
  17762. this.addListenerTarget(window);
  17763. this.addListenerTarget($parent);
  17764. }
  17765. this.lazyLoadHandler();
  17766. vue.nextTick(() => this.lazyLoadHandler());
  17767. });
  17768. }
  17769. /**
  17770. * update image src
  17771. * @param {DOM} el
  17772. * @param {object} vue directive binding
  17773. * @return
  17774. */
  17775. update(el, binding, vnode) {
  17776. const value = this.valueFormatter(binding.value);
  17777. let { src } = value;
  17778. src = getBestSelectionFromSrcset(el, this.options.scale) || src;
  17779. const exist = this.listeners.find((item) => item.el === el);
  17780. if (!exist) {
  17781. this.add(el, binding, vnode);
  17782. } else {
  17783. exist.update({
  17784. src,
  17785. error: value.error,
  17786. loading: value.loading
  17787. });
  17788. }
  17789. if (this.observer) {
  17790. this.observer.unobserve(el);
  17791. this.observer.observe(el);
  17792. }
  17793. this.lazyLoadHandler();
  17794. vue.nextTick(() => this.lazyLoadHandler());
  17795. }
  17796. /**
  17797. * remove listener form list
  17798. * @param {DOM} el
  17799. * @return
  17800. */
  17801. remove(el) {
  17802. if (!el) return;
  17803. this.observer && this.observer.unobserve(el);
  17804. const existItem = this.listeners.find((item) => item.el === el);
  17805. if (existItem) {
  17806. this.removeListenerTarget(existItem.$parent);
  17807. this.removeListenerTarget(window);
  17808. remove(this.listeners, existItem);
  17809. existItem.$destroy();
  17810. }
  17811. }
  17812. /*
  17813. * remove lazy components form list
  17814. * @param {Vue} vm Vue instance
  17815. * @return
  17816. */
  17817. removeComponent(vm) {
  17818. if (!vm) return;
  17819. remove(this.listeners, vm);
  17820. this.observer && this.observer.unobserve(vm.el);
  17821. if (vm.$parent && vm.$el.parentNode) {
  17822. this.removeListenerTarget(vm.$el.parentNode);
  17823. }
  17824. this.removeListenerTarget(window);
  17825. }
  17826. setMode(mode) {
  17827. if (!hasIntersectionObserver && mode === modeType.observer) {
  17828. mode = modeType.event;
  17829. }
  17830. this.mode = mode;
  17831. if (mode === modeType.event) {
  17832. if (this.observer) {
  17833. this.listeners.forEach((listener) => {
  17834. this.observer.unobserve(listener.el);
  17835. });
  17836. this.observer = null;
  17837. }
  17838. this.targets.forEach((target) => {
  17839. this.initListen(target.el, true);
  17840. });
  17841. } else {
  17842. this.targets.forEach((target) => {
  17843. this.initListen(target.el, false);
  17844. });
  17845. this.initIntersectionObserver();
  17846. }
  17847. }
  17848. /*
  17849. *** Private functions ***
  17850. */
  17851. /*
  17852. * add listener target
  17853. * @param {DOM} el listener target
  17854. * @return
  17855. */
  17856. addListenerTarget(el) {
  17857. if (!el) return;
  17858. let target = this.targets.find((target2) => target2.el === el);
  17859. if (!target) {
  17860. target = {
  17861. el,
  17862. id: ++this.targetIndex,
  17863. childrenCount: 1,
  17864. listened: true
  17865. };
  17866. this.mode === modeType.event && this.initListen(target.el, true);
  17867. this.targets.push(target);
  17868. } else {
  17869. target.childrenCount++;
  17870. }
  17871. return this.targetIndex;
  17872. }
  17873. /*
  17874. * remove listener target or reduce target childrenCount
  17875. * @param {DOM} el or window
  17876. * @return
  17877. */
  17878. removeListenerTarget(el) {
  17879. this.targets.forEach((target, index) => {
  17880. if (target.el === el) {
  17881. target.childrenCount--;
  17882. if (!target.childrenCount) {
  17883. this.initListen(target.el, false);
  17884. this.targets.splice(index, 1);
  17885. target = null;
  17886. }
  17887. }
  17888. });
  17889. }
  17890. /*
  17891. * add or remove eventlistener
  17892. * @param {DOM} el DOM or Window
  17893. * @param {boolean} start flag
  17894. * @return
  17895. */
  17896. initListen(el, start2) {
  17897. this.options.ListenEvents.forEach(
  17898. (evt) => (start2 ? on : off)(el, evt, this.lazyLoadHandler)
  17899. );
  17900. }
  17901. initEvent() {
  17902. this.Event = {
  17903. listeners: {
  17904. loading: [],
  17905. loaded: [],
  17906. error: []
  17907. }
  17908. };
  17909. this.$on = (event, func) => {
  17910. if (!this.Event.listeners[event]) this.Event.listeners[event] = [];
  17911. this.Event.listeners[event].push(func);
  17912. };
  17913. this.$once = (event, func) => {
  17914. const on2 = (...args) => {
  17915. this.$off(event, on2);
  17916. func.apply(this, args);
  17917. };
  17918. this.$on(event, on2);
  17919. };
  17920. this.$off = (event, func) => {
  17921. if (!func) {
  17922. if (!this.Event.listeners[event]) return;
  17923. this.Event.listeners[event].length = 0;
  17924. return;
  17925. }
  17926. remove(this.Event.listeners[event], func);
  17927. };
  17928. this.$emit = (event, context, inCache) => {
  17929. if (!this.Event.listeners[event]) return;
  17930. this.Event.listeners[event].forEach((func) => func(context, inCache));
  17931. };
  17932. }
  17933. /**
  17934. * find nodes which in viewport and trigger load
  17935. * @return
  17936. */
  17937. lazyLoadHandler() {
  17938. const freeList = [];
  17939. this.listeners.forEach((listener) => {
  17940. if (!listener.el || !listener.el.parentNode) {
  17941. freeList.push(listener);
  17942. }
  17943. const catIn = listener.checkInView();
  17944. if (!catIn) return;
  17945. listener.load();
  17946. });
  17947. freeList.forEach((item) => {
  17948. remove(this.listeners, item);
  17949. item.$destroy();
  17950. });
  17951. }
  17952. /**
  17953. * init IntersectionObserver
  17954. * set mode to observer
  17955. * @return
  17956. */
  17957. initIntersectionObserver() {
  17958. if (!hasIntersectionObserver) {
  17959. return;
  17960. }
  17961. this.observer = new IntersectionObserver(
  17962. this.observerHandler.bind(this),
  17963. this.options.observerOptions
  17964. );
  17965. if (this.listeners.length) {
  17966. this.listeners.forEach((listener) => {
  17967. this.observer.observe(listener.el);
  17968. });
  17969. }
  17970. }
  17971. /**
  17972. * init IntersectionObserver
  17973. * @return
  17974. */
  17975. observerHandler(entries) {
  17976. entries.forEach((entry) => {
  17977. if (entry.isIntersecting) {
  17978. this.listeners.forEach((listener) => {
  17979. if (listener.el === entry.target) {
  17980. if (listener.state.loaded)
  17981. return this.observer.unobserve(listener.el);
  17982. listener.load();
  17983. }
  17984. });
  17985. }
  17986. });
  17987. }
  17988. /**
  17989. * set element attribute with image'url and state
  17990. * @param {object} lazyload listener object
  17991. * @param {string} state will be rendered
  17992. * @param {bool} inCache is rendered from cache
  17993. * @return
  17994. */
  17995. elRenderer(listener, state, cache) {
  17996. if (!listener.el) return;
  17997. const { el, bindType } = listener;
  17998. let src;
  17999. switch (state) {
  18000. case "loading":
  18001. src = listener.loading;
  18002. break;
  18003. case "error":
  18004. src = listener.error;
  18005. break;
  18006. default:
  18007. ({ src } = listener);
  18008. break;
  18009. }
  18010. if (bindType) {
  18011. el.style[bindType] = 'url("' + src + '")';
  18012. } else if (el.getAttribute("src") !== src) {
  18013. el.setAttribute("src", src);
  18014. }
  18015. el.setAttribute("lazy", state);
  18016. this.$emit(state, listener, cache);
  18017. this.options.adapter[state] && this.options.adapter[state](listener, this.options);
  18018. if (this.options.dispatchEvent) {
  18019. const event = new CustomEvent(state, {
  18020. detail: listener
  18021. });
  18022. el.dispatchEvent(event);
  18023. }
  18024. }
  18025. /**
  18026. * generate loading loaded error image url
  18027. * @param {string} image's src
  18028. * @return {object} image's loading, loaded, error url
  18029. */
  18030. valueFormatter(value) {
  18031. let src = value;
  18032. let { loading, error } = this.options;
  18033. if (isObject$1(value)) {
  18034. ({ src } = value);
  18035. loading = value.loading || this.options.loading;
  18036. error = value.error || this.options.error;
  18037. }
  18038. return {
  18039. src,
  18040. loading,
  18041. error
  18042. };
  18043. }
  18044. };
  18045. }
  18046. var stdin_default$2 = (lazy) => ({
  18047. props: {
  18048. tag: {
  18049. type: String,
  18050. default: "div"
  18051. }
  18052. },
  18053. emits: ["show"],
  18054. render() {
  18055. return vue.h(
  18056. this.tag,
  18057. this.show && this.$slots.default ? this.$slots.default() : null
  18058. );
  18059. },
  18060. data() {
  18061. return {
  18062. el: null,
  18063. state: {
  18064. loaded: false
  18065. },
  18066. show: false
  18067. };
  18068. },
  18069. mounted() {
  18070. this.el = this.$el;
  18071. lazy.addLazyBox(this);
  18072. lazy.lazyLoadHandler();
  18073. },
  18074. beforeUnmount() {
  18075. lazy.removeComponent(this);
  18076. },
  18077. methods: {
  18078. checkInView() {
  18079. const rect = useRect(this.$el);
  18080. return inBrowser && rect.top < window.innerHeight * lazy.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazy.options.preLoad && rect.right > 0;
  18081. },
  18082. load() {
  18083. this.show = true;
  18084. this.state.loaded = true;
  18085. this.$emit("show", this);
  18086. },
  18087. destroy() {
  18088. return this.$destroy;
  18089. }
  18090. }
  18091. });
  18092. const defaultOptions = {
  18093. selector: "img"
  18094. };
  18095. class LazyContainer {
  18096. constructor({ el, binding, vnode, lazy }) {
  18097. this.el = null;
  18098. this.vnode = vnode;
  18099. this.binding = binding;
  18100. this.options = {};
  18101. this.lazy = lazy;
  18102. this.queue = [];
  18103. this.update({ el, binding });
  18104. }
  18105. update({ el, binding }) {
  18106. this.el = el;
  18107. this.options = Object.assign({}, defaultOptions, binding.value);
  18108. const imgs = this.getImgs();
  18109. imgs.forEach((el2) => {
  18110. this.lazy.add(
  18111. el2,
  18112. Object.assign({}, this.binding, {
  18113. value: {
  18114. src: "dataset" in el2 ? el2.dataset.src : el2.getAttribute("data-src"),
  18115. error: ("dataset" in el2 ? el2.dataset.error : el2.getAttribute("data-error")) || this.options.error,
  18116. loading: ("dataset" in el2 ? el2.dataset.loading : el2.getAttribute("data-loading")) || this.options.loading
  18117. }
  18118. }),
  18119. this.vnode
  18120. );
  18121. });
  18122. }
  18123. getImgs() {
  18124. return Array.from(this.el.querySelectorAll(this.options.selector));
  18125. }
  18126. clear() {
  18127. const imgs = this.getImgs();
  18128. imgs.forEach((el) => this.lazy.remove(el));
  18129. this.vnode = null;
  18130. this.binding = null;
  18131. this.lazy = null;
  18132. }
  18133. }
  18134. class LazyContainerManager {
  18135. constructor({ lazy }) {
  18136. this.lazy = lazy;
  18137. this.queue = [];
  18138. }
  18139. bind(el, binding, vnode) {
  18140. const container = new LazyContainer({
  18141. el,
  18142. binding,
  18143. vnode,
  18144. lazy: this.lazy
  18145. });
  18146. this.queue.push(container);
  18147. }
  18148. update(el, binding, vnode) {
  18149. const container = this.queue.find((item) => item.el === el);
  18150. if (!container) return;
  18151. container.update({ el, binding, vnode });
  18152. }
  18153. unbind(el) {
  18154. const container = this.queue.find((item) => item.el === el);
  18155. if (!container) return;
  18156. container.clear();
  18157. remove(this.queue, container);
  18158. }
  18159. }
  18160. var stdin_default$1 = (lazyManager) => ({
  18161. props: {
  18162. src: [String, Object],
  18163. tag: {
  18164. type: String,
  18165. default: "img"
  18166. }
  18167. },
  18168. render() {
  18169. var _a, _b;
  18170. return vue.h(
  18171. this.tag,
  18172. {
  18173. src: this.renderSrc
  18174. },
  18175. (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
  18176. );
  18177. },
  18178. data() {
  18179. return {
  18180. el: null,
  18181. options: {
  18182. src: "",
  18183. error: "",
  18184. loading: "",
  18185. attempt: lazyManager.options.attempt
  18186. },
  18187. state: {
  18188. loaded: false,
  18189. error: false,
  18190. attempt: 0
  18191. },
  18192. renderSrc: ""
  18193. };
  18194. },
  18195. watch: {
  18196. src() {
  18197. this.init();
  18198. lazyManager.addLazyBox(this);
  18199. lazyManager.lazyLoadHandler();
  18200. }
  18201. },
  18202. created() {
  18203. this.init();
  18204. },
  18205. mounted() {
  18206. this.el = this.$el;
  18207. lazyManager.addLazyBox(this);
  18208. lazyManager.lazyLoadHandler();
  18209. },
  18210. beforeUnmount() {
  18211. lazyManager.removeComponent(this);
  18212. },
  18213. methods: {
  18214. init() {
  18215. const { src, loading, error } = lazyManager.valueFormatter(this.src);
  18216. this.state.loaded = false;
  18217. this.options.src = src;
  18218. this.options.error = error;
  18219. this.options.loading = loading;
  18220. this.renderSrc = this.options.loading;
  18221. },
  18222. checkInView() {
  18223. const rect = useRect(this.$el);
  18224. return rect.top < window.innerHeight * lazyManager.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazyManager.options.preLoad && rect.right > 0;
  18225. },
  18226. load(onFinish = noop) {
  18227. if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
  18228. onFinish();
  18229. return;
  18230. }
  18231. const { src } = this.options;
  18232. loadImageAsync(
  18233. { src },
  18234. ({ src: src2 }) => {
  18235. this.renderSrc = src2;
  18236. this.state.loaded = true;
  18237. },
  18238. () => {
  18239. this.state.attempt++;
  18240. this.renderSrc = this.options.error;
  18241. this.state.error = true;
  18242. }
  18243. );
  18244. }
  18245. }
  18246. });
  18247. const Lazyload = {
  18248. /*
  18249. * install function
  18250. * @param {App} app
  18251. * @param {object} options lazyload options
  18252. */
  18253. install(app, options = {}) {
  18254. const LazyClass = stdin_default$3();
  18255. const lazy = new LazyClass(options);
  18256. const lazyContainer = new LazyContainerManager({ lazy });
  18257. app.config.globalProperties.$Lazyload = lazy;
  18258. if (options.lazyComponent) {
  18259. app.component("LazyComponent", stdin_default$2(lazy));
  18260. }
  18261. if (options.lazyImage) {
  18262. app.component("LazyImage", stdin_default$1(lazy));
  18263. }
  18264. app.directive("lazy", {
  18265. beforeMount: lazy.add.bind(lazy),
  18266. updated: lazy.update.bind(lazy),
  18267. unmounted: lazy.remove.bind(lazy)
  18268. });
  18269. app.directive("lazy-container", {
  18270. beforeMount: lazyContainer.bind.bind(lazyContainer),
  18271. updated: lazyContainer.update.bind(lazyContainer),
  18272. unmounted: lazyContainer.unbind.bind(lazyContainer)
  18273. });
  18274. }
  18275. };
  18276. const version = "4.9.9";
  18277. function install(app) {
  18278. const components = [
  18279. ActionBar,
  18280. ActionBarButton,
  18281. ActionBarIcon,
  18282. ActionSheet,
  18283. AddressEdit,
  18284. AddressList,
  18285. Area,
  18286. BackTop,
  18287. Badge,
  18288. Barrage,
  18289. Button,
  18290. Calendar,
  18291. Card,
  18292. Cascader,
  18293. Cell,
  18294. CellGroup,
  18295. Checkbox,
  18296. CheckboxGroup,
  18297. Circle,
  18298. Col,
  18299. Collapse,
  18300. CollapseItem,
  18301. ConfigProvider,
  18302. ContactCard,
  18303. ContactEdit,
  18304. ContactList,
  18305. CountDown,
  18306. Coupon,
  18307. CouponCell,
  18308. CouponList,
  18309. DatePicker,
  18310. Dialog,
  18311. Divider,
  18312. DropdownItem,
  18313. DropdownMenu,
  18314. Empty,
  18315. Field,
  18316. FloatingBubble,
  18317. FloatingPanel,
  18318. Form,
  18319. Grid,
  18320. GridItem,
  18321. Highlight,
  18322. Icon,
  18323. Image$1,
  18324. ImagePreview,
  18325. IndexAnchor,
  18326. IndexBar,
  18327. List,
  18328. Loading,
  18329. Locale,
  18330. NavBar,
  18331. NoticeBar,
  18332. Notify,
  18333. NumberKeyboard,
  18334. Overlay,
  18335. Pagination,
  18336. PasswordInput,
  18337. Picker,
  18338. PickerGroup,
  18339. Popover,
  18340. Popup,
  18341. Progress,
  18342. PullRefresh,
  18343. Radio,
  18344. RadioGroup,
  18345. Rate,
  18346. RollingText,
  18347. Row,
  18348. Search,
  18349. ShareSheet,
  18350. Sidebar,
  18351. SidebarItem,
  18352. Signature,
  18353. Skeleton,
  18354. SkeletonAvatar,
  18355. SkeletonImage,
  18356. SkeletonParagraph,
  18357. SkeletonTitle,
  18358. Slider,
  18359. Space,
  18360. Step,
  18361. Stepper,
  18362. Steps,
  18363. Sticky,
  18364. SubmitBar,
  18365. Swipe,
  18366. SwipeCell,
  18367. SwipeItem,
  18368. Switch,
  18369. Tab,
  18370. Tabbar,
  18371. TabbarItem,
  18372. Tabs,
  18373. Tag,
  18374. TextEllipsis,
  18375. TimePicker,
  18376. Toast,
  18377. TreeSelect,
  18378. Uploader,
  18379. Watermark
  18380. ];
  18381. components.forEach((item) => {
  18382. if (item.install) {
  18383. app.use(item);
  18384. } else if (item.name) {
  18385. app.component(item.name, item);
  18386. }
  18387. });
  18388. }
  18389. var stdin_default = {
  18390. install,
  18391. version
  18392. };
  18393. exports2.ActionBar = ActionBar;
  18394. exports2.ActionBarButton = ActionBarButton;
  18395. exports2.ActionBarIcon = ActionBarIcon;
  18396. exports2.ActionSheet = ActionSheet;
  18397. exports2.AddressEdit = AddressEdit;
  18398. exports2.AddressList = AddressList;
  18399. exports2.Area = Area;
  18400. exports2.BackTop = BackTop;
  18401. exports2.Badge = Badge;
  18402. exports2.Barrage = Barrage;
  18403. exports2.Button = Button;
  18404. exports2.Calendar = Calendar;
  18405. exports2.Card = Card;
  18406. exports2.Cascader = Cascader;
  18407. exports2.Cell = Cell;
  18408. exports2.CellGroup = CellGroup;
  18409. exports2.Checkbox = Checkbox;
  18410. exports2.CheckboxGroup = CheckboxGroup;
  18411. exports2.Circle = Circle;
  18412. exports2.Col = Col;
  18413. exports2.Collapse = Collapse;
  18414. exports2.CollapseItem = CollapseItem;
  18415. exports2.ConfigProvider = ConfigProvider;
  18416. exports2.ContactCard = ContactCard;
  18417. exports2.ContactEdit = ContactEdit;
  18418. exports2.ContactList = ContactList;
  18419. exports2.CountDown = CountDown;
  18420. exports2.Coupon = Coupon;
  18421. exports2.CouponCell = CouponCell;
  18422. exports2.CouponList = CouponList;
  18423. exports2.DEFAULT_ROW_WIDTH = DEFAULT_ROW_WIDTH;
  18424. exports2.DatePicker = DatePicker;
  18425. exports2.Dialog = Dialog;
  18426. exports2.Divider = Divider;
  18427. exports2.DropdownItem = DropdownItem;
  18428. exports2.DropdownMenu = DropdownMenu;
  18429. exports2.Empty = Empty;
  18430. exports2.Field = Field;
  18431. exports2.FloatingBubble = FloatingBubble;
  18432. exports2.FloatingPanel = FloatingPanel;
  18433. exports2.Form = Form;
  18434. exports2.Grid = Grid;
  18435. exports2.GridItem = GridItem;
  18436. exports2.Highlight = Highlight;
  18437. exports2.Icon = Icon;
  18438. exports2.Image = Image$1;
  18439. exports2.ImagePreview = ImagePreview;
  18440. exports2.IndexAnchor = IndexAnchor;
  18441. exports2.IndexBar = IndexBar;
  18442. exports2.Lazyload = Lazyload;
  18443. exports2.List = List;
  18444. exports2.Loading = Loading;
  18445. exports2.Locale = Locale;
  18446. exports2.NavBar = NavBar;
  18447. exports2.NoticeBar = NoticeBar;
  18448. exports2.Notify = Notify;
  18449. exports2.NumberKeyboard = NumberKeyboard;
  18450. exports2.Overlay = Overlay;
  18451. exports2.Pagination = Pagination;
  18452. exports2.PasswordInput = PasswordInput;
  18453. exports2.Picker = Picker;
  18454. exports2.PickerGroup = PickerGroup;
  18455. exports2.Popover = Popover;
  18456. exports2.Popup = Popup;
  18457. exports2.Progress = Progress;
  18458. exports2.PullRefresh = PullRefresh;
  18459. exports2.Radio = Radio;
  18460. exports2.RadioGroup = RadioGroup;
  18461. exports2.Rate = Rate;
  18462. exports2.RollingText = RollingText;
  18463. exports2.Row = Row;
  18464. exports2.Search = Search;
  18465. exports2.ShareSheet = ShareSheet;
  18466. exports2.Sidebar = Sidebar;
  18467. exports2.SidebarItem = SidebarItem;
  18468. exports2.Signature = Signature;
  18469. exports2.Skeleton = Skeleton;
  18470. exports2.SkeletonAvatar = SkeletonAvatar;
  18471. exports2.SkeletonImage = SkeletonImage;
  18472. exports2.SkeletonParagraph = SkeletonParagraph;
  18473. exports2.SkeletonTitle = SkeletonTitle;
  18474. exports2.Slider = Slider;
  18475. exports2.Space = Space;
  18476. exports2.Step = Step;
  18477. exports2.Stepper = Stepper;
  18478. exports2.Steps = Steps;
  18479. exports2.Sticky = Sticky;
  18480. exports2.SubmitBar = SubmitBar;
  18481. exports2.Swipe = Swipe;
  18482. exports2.SwipeCell = SwipeCell;
  18483. exports2.SwipeItem = SwipeItem;
  18484. exports2.Switch = Switch;
  18485. exports2.Tab = Tab;
  18486. exports2.Tabbar = Tabbar;
  18487. exports2.TabbarItem = TabbarItem;
  18488. exports2.Tabs = Tabs;
  18489. exports2.Tag = Tag;
  18490. exports2.TextEllipsis = TextEllipsis;
  18491. exports2.TimePicker = TimePicker;
  18492. exports2.Toast = Toast;
  18493. exports2.TreeSelect = TreeSelect;
  18494. exports2.Uploader = Uploader;
  18495. exports2.Watermark = Watermark;
  18496. exports2.actionBarButtonProps = actionBarButtonProps;
  18497. exports2.actionBarIconProps = actionBarIconProps;
  18498. exports2.actionBarProps = actionBarProps;
  18499. exports2.actionSheetProps = actionSheetProps;
  18500. exports2.addressEditProps = addressEditProps;
  18501. exports2.addressListProps = addressListProps;
  18502. exports2.allowMultipleToast = allowMultipleToast;
  18503. exports2.areaProps = areaProps;
  18504. exports2.backTopProps = backTopProps;
  18505. exports2.badgeProps = badgeProps;
  18506. exports2.barrageProps = barrageProps;
  18507. exports2.buttonProps = buttonProps;
  18508. exports2.calendarProps = calendarProps;
  18509. exports2.cardProps = cardProps;
  18510. exports2.cascaderProps = cascaderProps;
  18511. exports2.cellGroupProps = cellGroupProps;
  18512. exports2.cellProps = cellProps;
  18513. exports2.checkboxGroupProps = checkboxGroupProps;
  18514. exports2.checkboxProps = checkboxProps;
  18515. exports2.circleProps = circleProps;
  18516. exports2.closeDialog = closeDialog;
  18517. exports2.closeNotify = closeNotify;
  18518. exports2.closeToast = closeToast;
  18519. exports2.colProps = colProps;
  18520. exports2.collapseItemProps = collapseItemProps;
  18521. exports2.collapseProps = collapseProps;
  18522. exports2.configProviderProps = configProviderProps;
  18523. exports2.contactCardProps = contactCardProps;
  18524. exports2.contactEditProps = contactEditProps;
  18525. exports2.contactListProps = contactListProps;
  18526. exports2.countDownProps = countDownProps;
  18527. exports2.couponCellProps = couponCellProps;
  18528. exports2.couponListProps = couponListProps;
  18529. exports2.datePickerProps = datePickerProps;
  18530. exports2.default = stdin_default;
  18531. exports2.dialogProps = dialogProps;
  18532. exports2.dividerProps = dividerProps;
  18533. exports2.dropdownItemProps = dropdownItemProps;
  18534. exports2.dropdownMenuProps = dropdownMenuProps;
  18535. exports2.emptyProps = emptyProps;
  18536. exports2.fieldProps = fieldProps;
  18537. exports2.floatingBubbleProps = floatingBubbleProps;
  18538. exports2.floatingPanelProps = floatingPanelProps;
  18539. exports2.formProps = formProps;
  18540. exports2.gridItemProps = gridItemProps;
  18541. exports2.gridProps = gridProps;
  18542. exports2.highlightProps = highlightProps;
  18543. exports2.iconProps = iconProps;
  18544. exports2.imagePreviewProps = imagePreviewProps;
  18545. exports2.imageProps = imageProps;
  18546. exports2.indexAnchorProps = indexAnchorProps;
  18547. exports2.indexBarProps = indexBarProps;
  18548. exports2.install = install;
  18549. exports2.listProps = listProps;
  18550. exports2.loadingProps = loadingProps;
  18551. exports2.navBarProps = navBarProps;
  18552. exports2.noticeBarProps = noticeBarProps;
  18553. exports2.notifyProps = notifyProps;
  18554. exports2.numberKeyboardProps = numberKeyboardProps;
  18555. exports2.overlayProps = overlayProps;
  18556. exports2.paginationProps = paginationProps;
  18557. exports2.passwordInputProps = passwordInputProps;
  18558. exports2.pickerGroupProps = pickerGroupProps;
  18559. exports2.pickerProps = pickerProps;
  18560. exports2.popoverProps = popoverProps;
  18561. exports2.popupProps = popupProps$2;
  18562. exports2.progressProps = progressProps;
  18563. exports2.pullRefreshProps = pullRefreshProps;
  18564. exports2.radioGroupProps = radioGroupProps;
  18565. exports2.radioProps = radioProps;
  18566. exports2.rateProps = rateProps;
  18567. exports2.resetDialogDefaultOptions = resetDialogDefaultOptions;
  18568. exports2.resetNotifyDefaultOptions = resetNotifyDefaultOptions;
  18569. exports2.resetToastDefaultOptions = resetToastDefaultOptions;
  18570. exports2.rollingTextProps = rollingTextProps;
  18571. exports2.rowProps = rowProps;
  18572. exports2.searchProps = searchProps;
  18573. exports2.setDialogDefaultOptions = setDialogDefaultOptions;
  18574. exports2.setNotifyDefaultOptions = setNotifyDefaultOptions;
  18575. exports2.setToastDefaultOptions = setToastDefaultOptions;
  18576. exports2.shareSheetProps = shareSheetProps;
  18577. exports2.showConfirmDialog = showConfirmDialog;
  18578. exports2.showDialog = showDialog;
  18579. exports2.showFailToast = showFailToast;
  18580. exports2.showImagePreview = showImagePreview;
  18581. exports2.showLoadingToast = showLoadingToast;
  18582. exports2.showNotify = showNotify;
  18583. exports2.showSuccessToast = showSuccessToast;
  18584. exports2.showToast = showToast;
  18585. exports2.sidebarItemProps = sidebarItemProps;
  18586. exports2.sidebarProps = sidebarProps;
  18587. exports2.skeletonAvatarProps = skeletonAvatarProps;
  18588. exports2.skeletonImageProps = skeletonImageProps;
  18589. exports2.skeletonParagraphProps = skeletonParagraphProps;
  18590. exports2.skeletonProps = skeletonProps;
  18591. exports2.skeletonTitleProps = skeletonTitleProps;
  18592. exports2.sliderProps = sliderProps;
  18593. exports2.spaceProps = spaceProps;
  18594. exports2.stepperProps = stepperProps;
  18595. exports2.stepsProps = stepsProps;
  18596. exports2.stickyProps = stickyProps;
  18597. exports2.submitBarProps = submitBarProps;
  18598. exports2.swipeCellProps = swipeCellProps;
  18599. exports2.swipeProps = swipeProps;
  18600. exports2.switchProps = switchProps;
  18601. exports2.tabProps = tabProps;
  18602. exports2.tabbarItemProps = tabbarItemProps;
  18603. exports2.tabbarProps = tabbarProps;
  18604. exports2.tabsProps = tabsProps;
  18605. exports2.tagProps = tagProps;
  18606. exports2.textEllipsisProps = textEllipsisProps;
  18607. exports2.timePickerProps = timePickerProps;
  18608. exports2.toastProps = toastProps;
  18609. exports2.treeSelectProps = treeSelectProps;
  18610. exports2.uploaderProps = uploaderProps;
  18611. exports2.useCurrentLang = useCurrentLang;
  18612. exports2.version = version;
  18613. exports2.watermarkProps = watermarkProps;
  18614. Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
  18615. });